>From 883723873c94bdd3a9a3c9a376e3b2b266db5ca3 Mon Sep 17 00:00:00 2001 Message-Id: From: Stefano Lattarini Date: Thu, 18 Oct 2012 12:47:17 +0200 Subject: [PATCH 01/20] depcomp: be more idiomatic in checking for zero exit statuses * lib/depcomp: Prefer "if test $stat -ne 0; then ..." over the longer "if test $stat -eq 0; then :; else ...". Signed-off-by: Stefano Lattarini --- lib/depcomp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index e1f51f4..dfc97de 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2012-07-12.20; # UTC +scriptversion=2012-10-18.11; # UTC # Copyright (C) 1999-2012 Free Software Foundation, Inc. @@ -136,8 +136,7 @@ gcc3) done "$@" stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi @@ -163,8 +162,7 @@ gcc) fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi @@ -206,8 +204,7 @@ sgi) "$@" -MDupdate "$tmpdepfile" fi stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi @@ -269,8 +266,7 @@ aix) fi stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi @@ -317,8 +313,7 @@ icc) # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi @@ -434,8 +429,7 @@ hp2) "$@" +Maked fi stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi @@ -497,8 +491,7 @@ tru64) fi stat=$? - if test $stat -eq 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi @@ -525,8 +518,7 @@ msvc7) "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" - if test "$stat" = 0; then : - else + if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi -- 1.8.0.209.gf3828dc >From 8469853ac0e693b28a48e30310ff1417bcf61d6a Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 13:22:56 +0200 Subject: [PATCH 02/20] depcomp: remove useless quoting in variable definitions * lib/depcomp (pgcc): Here. Signed-off-by: Stefano Lattarini --- lib/depcomp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index dfc97de..2ccf719 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -356,13 +356,13 @@ pgcc) # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. base=`echo "$source" | sed -e 's|^.*/||' -e 's/\.[-_a-zA-Z0-9]*$//'` - tmpdepfile="$base.d" + tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. - lockdir="$base.d-lock" + lockdir=$base.d-lock trap "echo '$0: caught signal, cleaning up...' >&2; rm -rf $lockdir" 1 2 13 15 numtries=100 i=$numtries -- 1.8.0.209.gf3828dc >From 1d51ce40acac781d98e23ab234b3a00bfc1885a7 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 13:24:21 +0200 Subject: [PATCH 03/20] depcomp: use "rmdir", not "rm -rf", to remove the empty lock directory * lib/depcomp (pgcc): Here. Signed-off-by: Stefano Lattarini --- lib/depcomp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index 2ccf719..973c389 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -363,7 +363,7 @@ pgcc) # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock - trap "echo '$0: caught signal, cleaning up...' >&2; rm -rf $lockdir" 1 2 13 15 + trap "echo '$0: caught signal, cleaning up...' >&2; rmdir $lockdir" 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0 ; do @@ -373,7 +373,7 @@ pgcc) "$@" -MD stat=$? # Release the lock. - rm -rf $lockdir + rmdir $lockdir break else ## the lock is being held by a different process, -- 1.8.0.209.gf3828dc >From 5d84b891ff16e702cc273a0584e6746e7cd70458 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 13:27:19 +0200 Subject: [PATCH 04/20] depcomp: correctly propagate exit status in exit trap * lib/depcomp (pgcc): Here. Signed-off-by: Stefano Lattarini --- lib/depcomp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/depcomp b/lib/depcomp index 973c389..fb818b0 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -363,7 +363,11 @@ pgcc) # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock - trap "echo '$0: caught signal, cleaning up...' >&2; rmdir $lockdir" 1 2 13 15 + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir $lockdir + exit 1 + " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0 ; do -- 1.8.0.209.gf3828dc >From 0c1a92102dc1cf17e32aacde6dc1f21584425711 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 13:28:54 +0200 Subject: [PATCH 05/20] depcomp: safer quoting in variable expansion * lib/depcomp (pgcc): Here. Probably not needed, but since the rest of the script seems to employ proper quoting, better to be consistent. Signed-off-by: Stefano Lattarini --- lib/depcomp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index fb818b0..af4b18c 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -365,24 +365,24 @@ pgcc) lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 - rmdir $lockdir + rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0 ; do # mkdir is a portable test-and-set. - if mkdir $lockdir 2>/dev/null; then + if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. - rmdir $lockdir + rmdir "$lockdir" break else ## the lock is being held by a different process, ## wait until the winning process is done or we timeout - while test -d $lockdir && test $i -gt 0; do + while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done -- 1.8.0.209.gf3828dc >From 35ef2ffe421130676ee10361dda09bef4785a194 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 13:36:20 +0200 Subject: [PATCH 06/20] depcomp: cosmetic fixlets to a comment * lib/depcomp (pgcc): Here, as that's unportable according to the autoconf manual. In fact, there's no need to re-trap the signals just before exiting, since at that point a signal would cause at most a useless but harmless attempt to remove the Signed-off-by: Stefano Lattarini --- lib/depcomp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index af4b18c..8fac158 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -380,8 +380,8 @@ pgcc) rmdir "$lockdir" break else - ## the lock is being held by a different process, - ## wait until the winning process is done or we timeout + ## If the lock is being held by a different process, wait + ## until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` -- 1.8.0.209.gf3828dc >From b53a3b016eba7c20e0d445fa6bd8923c7a3334bb Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 13:46:48 +0200 Subject: [PATCH 07/20] depcomp: don't rely on character ranges working as in C locale * lib/depcomp (pgcc): Here. Related reorganization, with the unconditional definition of ... ($upper, $lower, $digits, $alnum, $alpha): ... these shell variables. Signed-off-by: Stefano Lattarini --- lib/depcomp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index 8fac158..2850339 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -61,6 +61,13 @@ tab=' ' # A newline character. nl=' ' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} +alnum=${alpha}${digits} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 @@ -168,7 +175,6 @@ gcc) fi rm -f "$depfile" echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" @@ -279,8 +285,8 @@ aix) # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" > "$depfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -355,7 +361,7 @@ pgcc) test "x$dir" = "x$object" && dir= # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. - base=`echo "$source" | sed -e 's|^.*/||' -e 's/\.[-_a-zA-Z0-9]*$//'` + base=`echo "$source" | sed -e 's|^.*/||' -e "s/\.[-_$alnum]*$//"` tmpdepfile=$base.d # For projects that build the same source file twice into different object @@ -443,7 +449,7 @@ hp2) test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// @@ -505,8 +511,8 @@ tru64) test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" > "$depfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi -- 1.8.0.209.gf3828dc >From 5d3b980bd2b63733a98f626e5f23c5c9661cc3cc Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 13:59:52 +0200 Subject: [PATCH 08/20] depcomp: reduce code duplication * lib/depcomp: Here, when we have to get the directory and basename components of objects or source files; do so with the help of ... (set_dir_from, set_base_from): ... these new shell functions. Signed-off-by: Stefano Lattarini --- lib/depcomp | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index 2850339..1707586 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -56,6 +56,22 @@ EOF ;; esac +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + dir=`echo "$1" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$1" && dir= +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + # A tabulation character. tab=' ' # A newline character. @@ -256,9 +272,8 @@ aix) # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + set_dir_from "$object" + set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u @@ -357,11 +372,10 @@ pgcc) # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= + set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. - base=`echo "$source" | sed -e 's|^.*/||' -e "s/\.[-_$alnum]*$//"` + set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object @@ -426,9 +440,8 @@ hp2) # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + set_dir_from "$object" + set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d @@ -469,9 +482,8 @@ tru64) # 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. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + set_dir_from "$object" + set_base_from "$object" if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a -- 1.8.0.209.gf3828dc >From 83cc9fd054566db15736c07c0a46c288d28082c2 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 14:45:21 +0200 Subject: [PATCH 09/20] depcomp: avoid an extra fork when possible * lib/depcomp (set_dir_from): Here. Signed-off-by: Stefano Lattarini --- lib/depcomp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index 1707586..23a9fcb 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -61,8 +61,10 @@ esac # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { - dir=`echo "$1" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$1" && dir= + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac } # Get the suffix-stripped basename of the given path, and save it the -- 1.8.0.209.gf3828dc >From 1518257a9328d914d763da188c5fda9a03dba3f2 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 14:45:38 +0200 Subject: [PATCH 10/20] depcomp: less duplication between AIX and Tru64 modes * lib/depcomp (tru64, aix): In these entries of the big 'case' switch, with the help of ... (aix_post_process_depfile): ... this new function. Signed-off-by: Stefano Lattarini --- lib/depcomp | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index 23a9fcb..adda121 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -74,6 +74,30 @@ set_base_from () base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + # No dependency file was actually created by the compiler invocation. + # No real dependency information will be available. + echo "#dummy" > "$depfile" + fi +} + # A tabulation character. tab=' ' # A newline character. @@ -298,19 +322,7 @@ aix) do test -f "$tmpdepfile" && break done - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependent.h'. - # Do two passes, one to just change these to - # '$object: dependent.h' and one to simply 'dependent.h:'. - sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" > "$depfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" + aix_post_process_depfile ;; icc) @@ -524,13 +536,8 @@ tru64) do test -f "$tmpdepfile" && break done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" > "$depfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" + # Same post-processing that is required for AIX mode. + aix_post_process_depfile ;; msvc7) -- 1.8.0.209.gf3828dc >From 3ad09d87325a64e5619268f4afa20a7adb9eeabf Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 16:29:21 +0200 Subject: [PATCH 11/20] depcomp: make some code more self-documenting * lib/depcomp (make_dummy_makefile): With the help of this function. Use it throughout. Signed-off-by: Stefano Lattarini --- lib/depcomp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index adda121..0f37d09 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -74,6 +74,14 @@ set_base_from () base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () @@ -92,9 +100,7 @@ aix_post_process_depfile () } > "$depfile" rm -f "$tmpdepfile" else - # No dependency file was actually created by the compiler invocation. - # No real dependency information will be available. - echo "#dummy" > "$depfile" + make_dummy_depfile fi } @@ -277,10 +283,7 @@ sgi) | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" + make_dummy_depfile fi rm -f "$tmpdepfile" ;; @@ -485,7 +488,7 @@ hp2) p }' "$tmpdepfile" >> "$depfile" else - echo "#dummy" > "$depfile" + make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; -- 1.8.0.209.gf3828dc >From 2b09f2006452cc6b1dfb4ce56565b6af3f72fb92 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 16:47:41 +0200 Subject: [PATCH 12/20] depcomp: shell code style changes * lib/depcomp: Here, in comments and line continuations. Signed-off-by: Stefano Lattarini --- lib/depcomp | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index 0f37d09..e02d730 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -223,7 +223,8 @@ gcc) fi rm -f "$depfile" echo "$object : \\" > "$depfile" -## The second -e expression handles DOS-style file names with drive letters. + # The second -e expression handles DOS-style file names with drive + # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. @@ -232,15 +233,15 @@ gcc) ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. - tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -266,7 +267,6 @@ sgi) if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" - # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in @@ -274,10 +274,9 @@ sgi) # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr "$nl" ' ' >> "$depfile" + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" - # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ @@ -315,7 +314,6 @@ aix) "$@" -M fi stat=$? - if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat @@ -417,8 +415,8 @@ pgcc) rmdir "$lockdir" break else - ## If the lock is being held by a different process, wait - ## until the winning process is done or we timeout. + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` @@ -445,8 +443,8 @@ pgcc) sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -632,10 +630,11 @@ dashmstdout) sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" - tr ' ' "$nl" < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -688,10 +687,12 @@ makedepend) # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; @@ -727,10 +728,10 @@ cpp) esac done - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" -- 1.8.0.209.gf3828dc >From afd3bc19e09591e1e11ef46513cccd2e38382922 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 16:49:23 +0200 Subject: [PATCH 13/20] depcomp: whitespace fixes * lib/depcomp: We indent by two spaces, and without using tabs. Signed-off-by: Stefano Lattarini --- lib/depcomp | 166 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index e02d730..221a80c 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -27,9 +27,9 @@ scriptversion=2012-10-18.11; # UTC case $1 in '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] @@ -143,32 +143,32 @@ if test "$depmode" = hp; then fi if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 fi if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. - gccflag=-qmakedep=gcc,-MF - depmode=gcc + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc fi case "$depmode" in @@ -279,8 +279,8 @@ sgi) echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" else make_dummy_depfile fi @@ -405,7 +405,7 @@ pgcc) " 1 2 13 15 numtries=100 i=$numtries - while test $i -gt 0 ; do + while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. @@ -480,11 +480,11 @@ hp2) sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi @@ -492,54 +492,54 @@ hp2) ;; tru64) - # The Tru64 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. - set_dir_from "$object" - set_base_from "$object" - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - # Same post-processing that is required for AIX mode. - aix_post_process_depfile - ;; + # The Tru64 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. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; msvc7) if test "$libtool" = yes; then @@ -763,15 +763,15 @@ msvisualcpp) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; + set fnord "$@" + shift + shift + ;; *) - set fnord "$@" "$arg" - shift - shift - ;; + set fnord "$@" "$arg" + shift + shift + ;; esac done "$@" -E 2>/dev/null | -- 1.8.0.209.gf3828dc >From 4d27453ce1fae61e4ef4a5e2f21122515e4f0260 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 16:55:25 +0200 Subject: [PATCH 14/20] depcomp: rewrite a sed invocation for less quoting * lib/depcomp (dashmstdout): Here. Signed-off-by: Stefano Lattarini --- lib/depcomp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/depcomp b/lib/depcomp index 221a80c..8cd39b0 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -627,7 +627,7 @@ dashmstdout) # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | - sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation -- 1.8.0.209.gf3828dc >From 24d0dcbe1777e20fb07505ebe215df72bda21c42 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 16:55:44 +0200 Subject: [PATCH 15/20] depcomp: remove an unused variable * lib/depcomp ($alnum): This. Signed-off-by: Stefano Lattarini --- lib/depcomp | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/depcomp b/lib/depcomp index 8cd39b0..cfe0542 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -115,7 +115,6 @@ upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} -alnum=${alpha}${digits} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 -- 1.8.0.209.gf3828dc >From 4f855e0d1078bb7c1d869d3929259c525f4c5fff Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 17:14:15 +0200 Subject: [PATCH 16/20] depcomp: remove last relics of libtool 1.4 support * lib/depcomp (tru64): Here. Signed-off-by: Stefano Lattarini --- lib/depcomp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/lib/depcomp b/lib/depcomp index cfe0542..7b78133 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -500,39 +500,31 @@ tru64) set_base_from "$object" if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else - tmpdepfile1=$dir$base.o.d + tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done -- 1.8.0.209.gf3828dc >From 3a00a3c5db2ccdea53485e93e154ab7c89ed512e Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 17:42:21 +0200 Subject: [PATCH 17/20] depcomp: improve comments about tcc support * lib/depcomp (icc): Here. See also tcc commit 0394caf7 "Emit spaces for -MD" and automake commit v1.11-768-gb96263 "depcomp: support tcc (Tiny C Compiler)". Signed-off-by: Stefano Lattarini --- lib/depcomp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/depcomp b/lib/depcomp index 7b78133..ac74c7a 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -326,7 +326,7 @@ aix) ;; icc) - # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. + # Intel's C compiler and tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like @@ -346,6 +346,11 @@ icc) # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. + # Or at least, it did before its commit 0394caf7 "Emit spaces for -MD", + # which, accordingly to the commit message, was written explicitly to + # cater to limitations in the depcomp script. Limitations we had + # removed with automake commit v1.11-768-gb96263 "depcomp: support tcc + # (Tiny C Compiler)". Looks like we are chasing each other tail here ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then -- 1.8.0.209.gf3828dc >From 2543f06b180e91371eb9e20c38d96142e0827fde Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 17:47:46 +0200 Subject: [PATCH 18/20] tests: fix spurious failures with tcc * t/depcomp8a.sh, t/depcomp8b.sh: Here, by avoiding initialization of global 'extern' variables, preferring functions definitions instead. Signed-off-by: Stefano Lattarini --- t/depcomp8a.sh | 9 ++++++--- t/depcomp8b.sh | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/t/depcomp8a.sh b/t/depcomp8a.sh index 61ffa56..3d58a3e 100755 --- a/t/depcomp8a.sh +++ b/t/depcomp8a.sh @@ -37,12 +37,15 @@ mkdir sub cat > foo.c << 'END' int main (void) { - extern int bar; - return bar; + extern int bar (void); + return bar (); } END cat > sub/bar.c << 'END' -extern int bar = 0; +int bar (void) +{ + return 0; +} END $ACLOCAL diff --git a/t/depcomp8b.sh b/t/depcomp8b.sh index a97e2c3..6fed215 100755 --- a/t/depcomp8b.sh +++ b/t/depcomp8b.sh @@ -36,8 +36,8 @@ libzardoz_la_SOURCES = foo.c sub/bar.c END mkdir sub -echo 'extern int foo = 0;' > foo.c -echo 'extern int bar = 0;' > sub/bar.c +echo 'int foo (void) { return 0; }' > foo.c +echo 'int bar (void) { return 0; }' > sub/bar.c libtoolize -- 1.8.0.209.gf3828dc >From 487cf08d4c76d4cd1ff1e30d169eb6b5edf354a4 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 17:17:17 +0200 Subject: [PATCH 19/20] news: update w.r.t. recent depcomp changes * NEWS: Here. Signed-off-by: Stefano Lattarini --- NEWS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS b/NEWS index e672ad1..0b10b19 100644 --- a/NEWS +++ b/NEWS @@ -148,6 +148,14 @@ New in 1.13: Automake versions will warn about its use, and later version will remove support for it altogether. +* The depcomp script: + + - Dropped support for libtool 1.4. + + - Various internal refactorings. They should cause no visible change, + but the chance for regression is there anyway, so please report any + unexpected or suspicious behaviour. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 1.12.6: -- 1.8.0.209.gf3828dc >From 0ff68f958c88e6dfbee2f1c5091561e2eb1f6cba Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Stefano Lattarini Date: Thu, 18 Oct 2012 21:07:56 +0200 Subject: [PATCH 20/20] depcomp: remove 'icc' depmode, add 'tcc' one According to the comments in the now-removed test 'depcomp5.test' (removed by commit 'v1.11-1829-g5066c1b' of 2012-02-08, "tests: improve and rework tests on dependency tracking") "icc 8.0 and greater understand gcc options, so depmode is set to gcc". According to Wikipedia, the 8.0 version of the Intel C compiler has been released in December 2003, that is, almost nine yeas ago. So we can remove explicit support for icc 7.x from the depcomp script. Since our support for tcc has so far been relied on the icc depmode, we must write a new explicit 'tcc' depmode. That is easy to do, since we can rely on the simpler and better-specified format of tcc-specified makefiles; for more info, see: * lib/depcomp (icc): Remove. (tcc): New. * NEWS: Update. Signed-off-by: Stefano Lattarini --- NEWS | 7 +++++++ lib/depcomp | 62 +++++++++++++++++++++---------------------------------------- 2 files changed, 28 insertions(+), 41 deletions(-) diff --git a/NEWS b/NEWS index 0b10b19..7c0b173 100644 --- a/NEWS +++ b/NEWS @@ -156,6 +156,13 @@ New in 1.13: but the chance for regression is there anyway, so please report any unexpected or suspicious behaviour. + - Support for pre-8.0 versions of the Intel C Compiler has been dropped. + This should cause no problem, since icc 8.0 has been released in + December 2003 -- almost nine years ago. + + - Support for tcc (the Tiny C Compiler) has been improved, and is now + handled through a dedicated 'tcc' mode. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 1.12.6: diff --git a/lib/depcomp b/lib/depcomp index ac74c7a..3f02f5d 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -325,32 +325,21 @@ aix) aix_post_process_depfile ;; -icc) - # Intel's C compiler and tcc (Tiny C Compiler) understand '-MD -MF file'. - # However on - # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\': - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - # tcc 0.9.26 (FIXME still under development at the moment of writing) - # will emit a similar output, but also prepend the continuation lines - # with horizontal tabulation characters. - # Or at least, it did before its commit 0394caf7 "Emit spaces for -MD", - # which, accordingly to the commit message, was written explicitly to - # cater to limitations in the depcomp script. Limitations we had - # removed with automake commit v1.11-768-gb96263 "depcomp: support tcc - # (Tiny C Compiler)". Looks like we are chasing each other tail here ... +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then @@ -358,21 +347,12 @@ icc) exit $stat fi rm -f "$depfile" - # Each line is of the form 'foo.o: dependent.h', - # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. - # Do two passes, one to just change these to - # '$object: dependent.h' and one to simply 'dependent.h:'. - sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ - < "$tmpdepfile" > "$depfile" - sed ' - s/[ '"$tab"'][ '"$tab"']*/ /g - s/^ *// - s/ *\\*$// - s/^[^:]*: *// - /^$/d - /:$/d - s/$/ :/ - ' < "$tmpdepfile" >> "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; -- 1.8.0.209.gf3828dc