annotate src/libid3tag-0.15.1b/depcomp @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents c7265573341e
children
rev   line source
Chris@0 1 #! /bin/sh
Chris@0 2
Chris@0 3 # depcomp - compile a program generating dependencies as side-effects
Chris@0 4 # Copyright 1999, 2000 Free Software Foundation, Inc.
Chris@0 5
Chris@0 6 # This program is free software; you can redistribute it and/or modify
Chris@0 7 # it under the terms of the GNU General Public License as published by
Chris@0 8 # the Free Software Foundation; either version 2, or (at your option)
Chris@0 9 # any later version.
Chris@0 10
Chris@0 11 # This program is distributed in the hope that it will be useful,
Chris@0 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 14 # GNU General Public License for more details.
Chris@0 15
Chris@0 16 # You should have received a copy of the GNU General Public License
Chris@0 17 # along with this program; if not, write to the Free Software
Chris@0 18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
Chris@0 19 # 02111-1307, USA.
Chris@0 20
Chris@0 21 # As a special exception to the GNU General Public License, if you
Chris@0 22 # distribute this file as part of a program that contains a
Chris@0 23 # configuration script generated by Autoconf, you may include it under
Chris@0 24 # the same distribution terms that you use for the rest of that program.
Chris@0 25
Chris@0 26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
Chris@0 27
Chris@0 28 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
Chris@0 29 echo "depcomp: Variables source, object and depmode must be set" 1>&2
Chris@0 30 exit 1
Chris@0 31 fi
Chris@0 32 # `libtool' can also be set to `yes' or `no'.
Chris@0 33
Chris@0 34 if test -z "$depfile"; then
Chris@0 35 base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
Chris@0 36 dir=`echo "$object" | sed 's,/.*$,/,'`
Chris@0 37 if test "$dir" = "$object"; then
Chris@0 38 dir=
Chris@0 39 fi
Chris@0 40 # FIXME: should be _deps on DOS.
Chris@0 41 depfile="$dir.deps/$base"
Chris@0 42 fi
Chris@0 43
Chris@0 44 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
Chris@0 45
Chris@0 46 rm -f "$tmpdepfile"
Chris@0 47
Chris@0 48 # Some modes work just like other modes, but use different flags. We
Chris@0 49 # parameterize here, but still list the modes in the big case below,
Chris@0 50 # to make depend.m4 easier to write. Note that we *cannot* use a case
Chris@0 51 # here, because this file can only contain one case statement.
Chris@0 52 if test "$depmode" = hp; then
Chris@0 53 # HP compiler uses -M and no extra arg.
Chris@0 54 gccflag=-M
Chris@0 55 depmode=gcc
Chris@0 56 fi
Chris@0 57
Chris@0 58 if test "$depmode" = dashXmstdout; then
Chris@0 59 # This is just like dashmstdout with a different argument.
Chris@0 60 dashmflag=-xM
Chris@0 61 depmode=dashmstdout
Chris@0 62 fi
Chris@0 63
Chris@0 64 case "$depmode" in
Chris@0 65 gcc3)
Chris@0 66 ## gcc 3 implements dependency tracking that does exactly what
Chris@0 67 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
Chris@0 68 ## it if -MD -MP comes after the -MF stuff. Hmm.
Chris@0 69 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
Chris@0 70 stat=$?
Chris@0 71 if test $stat -eq 0; then :
Chris@0 72 else
Chris@0 73 rm -f "$tmpdepfile"
Chris@0 74 exit $stat
Chris@0 75 fi
Chris@0 76 mv "$tmpdepfile" "$depfile"
Chris@0 77 ;;
Chris@0 78
Chris@0 79 gcc)
Chris@0 80 ## There are various ways to get dependency output from gcc. Here's
Chris@0 81 ## why we pick this rather obscure method:
Chris@0 82 ## - Don't want to use -MD because we'd like the dependencies to end
Chris@0 83 ## up in a subdir. Having to rename by hand is ugly.
Chris@0 84 ## (We might end up doing this anyway to support other compilers.)
Chris@0 85 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
Chris@0 86 ## -MM, not -M (despite what the docs say).
Chris@0 87 ## - Using -M directly means running the compiler twice (even worse
Chris@0 88 ## than renaming).
Chris@0 89 if test -z "$gccflag"; then
Chris@0 90 gccflag=-MD,
Chris@0 91 fi
Chris@0 92 "$@" -Wp,"$gccflag$tmpdepfile"
Chris@0 93 stat=$?
Chris@0 94 if test $stat -eq 0; then :
Chris@0 95 else
Chris@0 96 rm -f "$tmpdepfile"
Chris@0 97 exit $stat
Chris@0 98 fi
Chris@0 99 rm -f "$depfile"
Chris@0 100 echo "$object : \\" > "$depfile"
Chris@0 101 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Chris@0 102 ## The second -e expression handles DOS-style file names with drive letters.
Chris@0 103 sed -e 's/^[^:]*: / /' \
Chris@0 104 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
Chris@0 105 ## This next piece of magic avoids the `deleted header file' problem.
Chris@0 106 ## The problem is that when a header file which appears in a .P file
Chris@0 107 ## is deleted, the dependency causes make to die (because there is
Chris@0 108 ## typically no way to rebuild the header). We avoid this by adding
Chris@0 109 ## dummy dependencies for each header file. Too bad gcc doesn't do
Chris@0 110 ## this for us directly.
Chris@0 111 tr ' ' '
Chris@0 112 ' < "$tmpdepfile" |
Chris@0 113 ## Some versions of gcc put a space before the `:'. On the theory
Chris@0 114 ## that the space means something, we add a space to the output as
Chris@0 115 ## well.
Chris@0 116 ## Some versions of the HPUX 10.20 sed can't process this invocation
Chris@0 117 ## correctly. Breaking it into two sed invocations is a workaround.
Chris@0 118 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
Chris@0 119 rm -f "$tmpdepfile"
Chris@0 120 ;;
Chris@0 121
Chris@0 122 hp)
Chris@0 123 # This case exists only to let depend.m4 do its work. It works by
Chris@0 124 # looking at the text of this script. This case will never be run,
Chris@0 125 # since it is checked for above.
Chris@0 126 exit 1
Chris@0 127 ;;
Chris@0 128
Chris@0 129 sgi)
Chris@0 130 if test "$libtool" = yes; then
Chris@0 131 "$@" "-Wp,-MDupdate,$tmpdepfile"
Chris@0 132 else
Chris@0 133 "$@" -MDupdate "$tmpdepfile"
Chris@0 134 fi
Chris@0 135 stat=$?
Chris@0 136 if test $stat -eq 0; then :
Chris@0 137 else
Chris@0 138 rm -f "$tmpdepfile"
Chris@0 139 exit $stat
Chris@0 140 fi
Chris@0 141 rm -f "$depfile"
Chris@0 142
Chris@0 143 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
Chris@0 144 echo "$object : \\" > "$depfile"
Chris@0 145
Chris@0 146 # Clip off the initial element (the dependent). Don't try to be
Chris@0 147 # clever and replace this with sed code, as IRIX sed won't handle
Chris@0 148 # lines with more than a fixed number of characters (4096 in
Chris@0 149 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
Chris@0 150 # the IRIX cc adds comments like `#:fec' to the end of the
Chris@0 151 # dependency line.
Chris@0 152 tr ' ' '
Chris@0 153 ' < "$tmpdepfile" \
Chris@0 154 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
Chris@0 155 tr '
Chris@0 156 ' ' ' >> $depfile
Chris@0 157 echo >> $depfile
Chris@0 158
Chris@0 159 # The second pass generates a dummy entry for each header file.
Chris@0 160 tr ' ' '
Chris@0 161 ' < "$tmpdepfile" \
Chris@0 162 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
Chris@0 163 >> $depfile
Chris@0 164 else
Chris@0 165 # The sourcefile does not contain any dependencies, so just
Chris@0 166 # store a dummy comment line, to avoid errors with the Makefile
Chris@0 167 # "include basename.Plo" scheme.
Chris@0 168 echo "#dummy" > "$depfile"
Chris@0 169 fi
Chris@0 170 rm -f "$tmpdepfile"
Chris@0 171 ;;
Chris@0 172
Chris@0 173 aix)
Chris@0 174 # The C for AIX Compiler uses -M and outputs the dependencies
Chris@0 175 # in a .u file. This file always lives in the current directory.
Chris@0 176 # Also, the AIX compiler puts `$object:' at the start of each line;
Chris@0 177 # $object doesn't have directory information.
Chris@0 178 stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
Chris@0 179 tmpdepfile="$stripped.u"
Chris@0 180 outname="$stripped.o"
Chris@0 181 if test "$libtool" = yes; then
Chris@0 182 "$@" -Wc,-M
Chris@0 183 else
Chris@0 184 "$@" -M
Chris@0 185 fi
Chris@0 186
Chris@0 187 stat=$?
Chris@0 188 if test $stat -eq 0; then :
Chris@0 189 else
Chris@0 190 rm -f "$tmpdepfile"
Chris@0 191 exit $stat
Chris@0 192 fi
Chris@0 193
Chris@0 194 if test -f "$tmpdepfile"; then
Chris@0 195 # Each line is of the form `foo.o: dependent.h'.
Chris@0 196 # Do two passes, one to just change these to
Chris@0 197 # `$object: dependent.h' and one to simply `dependent.h:'.
Chris@0 198 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
Chris@0 199 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
Chris@0 200 else
Chris@0 201 # The sourcefile does not contain any dependencies, so just
Chris@0 202 # store a dummy comment line, to avoid errors with the Makefile
Chris@0 203 # "include basename.Plo" scheme.
Chris@0 204 echo "#dummy" > "$depfile"
Chris@0 205 fi
Chris@0 206 rm -f "$tmpdepfile"
Chris@0 207 ;;
Chris@0 208
Chris@0 209 icc)
Chris@0 210 # Must come before tru64.
Chris@0 211
Chris@0 212 # Intel's C compiler understands `-MD -MF file'. However
Chris@0 213 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
Chris@0 214 # will fill foo.d with something like
Chris@0 215 # foo.o: sub/foo.c
Chris@0 216 # foo.o: sub/foo.h
Chris@0 217 # which is wrong. We want:
Chris@0 218 # sub/foo.o: sub/foo.c
Chris@0 219 # sub/foo.o: sub/foo.h
Chris@0 220 # sub/foo.c:
Chris@0 221 # sub/foo.h:
Chris@0 222
Chris@0 223 "$@" -MD -MF "$tmpdepfile"
Chris@0 224 stat=$?
Chris@0 225 if test $stat -eq 0; then :
Chris@0 226 else
Chris@0 227 rm -f "$tmpdepfile"
Chris@0 228 exit $stat
Chris@0 229 fi
Chris@0 230 rm -f "$depfile"
Chris@0 231 # Each line is of the form `foo.o: dependent.h'.
Chris@0 232 # Do two passes, one to just change these to
Chris@0 233 # `$object: dependent.h' and one to simply `dependent.h:'.
Chris@0 234 sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
Chris@0 235 sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
Chris@0 236 rm -f "$tmpdepfile"
Chris@0 237 ;;
Chris@0 238
Chris@0 239 tru64)
Chris@0 240 # The Tru64 compiler uses -MD to generate dependencies as a side
Chris@0 241 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
Chris@0 242 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
Chris@0 243 # dependencies in `foo.d' instead, so we check for that too.
Chris@0 244 # Subdirectories are respected.
Chris@0 245 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
Chris@0 246 test "x$dir" = "x$object" && dir=
Chris@0 247 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
Chris@0 248
Chris@0 249 if test "$libtool" = yes; then
Chris@0 250 tmpdepfile1="$dir.libs/$base.lo.d"
Chris@0 251 tmpdepfile2="$dir.libs/$base.d"
Chris@0 252 "$@" -Wc,-MD
Chris@0 253 else
Chris@0 254 tmpdepfile1="$dir$base.o.d"
Chris@0 255 tmpdepfile2="$dir$base.d"
Chris@0 256 "$@" -MD
Chris@0 257 fi
Chris@0 258
Chris@0 259 stat=$?
Chris@0 260 if test $stat -eq 0; then :
Chris@0 261 else
Chris@0 262 rm -f "$tmpdepfile1" "$tmpdepfile2"
Chris@0 263 exit $stat
Chris@0 264 fi
Chris@0 265
Chris@0 266 if test -f "$tmpdepfile1"; then
Chris@0 267 tmpdepfile="$tmpdepfile1"
Chris@0 268 else
Chris@0 269 tmpdepfile="$tmpdepfile2"
Chris@0 270 fi
Chris@0 271 if test -f "$tmpdepfile"; then
Chris@0 272 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
Chris@0 273 # That's a space and a tab in the [].
Chris@0 274 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
Chris@0 275 else
Chris@0 276 echo "#dummy" > "$depfile"
Chris@0 277 fi
Chris@0 278 rm -f "$tmpdepfile"
Chris@0 279 ;;
Chris@0 280
Chris@0 281 #nosideeffect)
Chris@0 282 # This comment above is used by automake to tell side-effect
Chris@0 283 # dependency tracking mechanisms from slower ones.
Chris@0 284
Chris@0 285 dashmstdout)
Chris@0 286 # Important note: in order to support this mode, a compiler *must*
Chris@0 287 # always write the proprocessed file to stdout, regardless of -o.
Chris@0 288 "$@" || exit $?
Chris@0 289
Chris@0 290 # Remove the call to Libtool.
Chris@0 291 if test "$libtool" = yes; then
Chris@0 292 while test $1 != '--mode=compile'; do
Chris@0 293 shift
Chris@0 294 done
Chris@0 295 shift
Chris@0 296 fi
Chris@0 297
Chris@0 298 # Remove `-o $object'.
Chris@0 299 IFS=" "
Chris@0 300 for arg
Chris@0 301 do
Chris@0 302 case $arg in
Chris@0 303 -o)
Chris@0 304 shift
Chris@0 305 ;;
Chris@0 306 $object)
Chris@0 307 shift
Chris@0 308 ;;
Chris@0 309 *)
Chris@0 310 set fnord "$@" "$arg"
Chris@0 311 shift # fnord
Chris@0 312 shift # $arg
Chris@0 313 ;;
Chris@0 314 esac
Chris@0 315 done
Chris@0 316
Chris@0 317 test -z "$dashmflag" && dashmflag=-M
Chris@0 318 # Require at least two characters before searching for `:'
Chris@0 319 # in the target name. This is to cope with DOS-style filenames:
Chris@0 320 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
Chris@0 321 "$@" $dashmflag |
Chris@0 322 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
Chris@0 323 rm -f "$depfile"
Chris@0 324 cat < "$tmpdepfile" > "$depfile"
Chris@0 325 tr ' ' '
Chris@0 326 ' < "$tmpdepfile" | \
Chris@0 327 ## Some versions of the HPUX 10.20 sed can't process this invocation
Chris@0 328 ## correctly. Breaking it into two sed invocations is a workaround.
Chris@0 329 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
Chris@0 330 rm -f "$tmpdepfile"
Chris@0 331 ;;
Chris@0 332
Chris@0 333 dashXmstdout)
Chris@0 334 # This case only exists to satisfy depend.m4. It is never actually
Chris@0 335 # run, as this mode is specially recognized in the preamble.
Chris@0 336 exit 1
Chris@0 337 ;;
Chris@0 338
Chris@0 339 makedepend)
Chris@0 340 "$@" || exit $?
Chris@0 341 # Remove any Libtool call
Chris@0 342 if test "$libtool" = yes; then
Chris@0 343 while test $1 != '--mode=compile'; do
Chris@0 344 shift
Chris@0 345 done
Chris@0 346 shift
Chris@0 347 fi
Chris@0 348 # X makedepend
Chris@0 349 shift
Chris@0 350 cleared=no
Chris@0 351 for arg in "$@"; do
Chris@0 352 case $cleared in
Chris@0 353 no)
Chris@0 354 set ""; shift
Chris@0 355 cleared=yes ;;
Chris@0 356 esac
Chris@0 357 case "$arg" in
Chris@0 358 -D*|-I*)
Chris@0 359 set fnord "$@" "$arg"; shift ;;
Chris@0 360 # Strip any option that makedepend may not understand. Remove
Chris@0 361 # the object too, otherwise makedepend will parse it as a source file.
Chris@0 362 -*|$object)
Chris@0 363 ;;
Chris@0 364 *)
Chris@0 365 set fnord "$@" "$arg"; shift ;;
Chris@0 366 esac
Chris@0 367 done
Chris@0 368 obj_suffix="`echo $object | sed 's/^.*\././'`"
Chris@0 369 touch "$tmpdepfile"
Chris@0 370 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
Chris@0 371 rm -f "$depfile"
Chris@0 372 cat < "$tmpdepfile" > "$depfile"
Chris@0 373 sed '1,2d' "$tmpdepfile" | tr ' ' '
Chris@0 374 ' | \
Chris@0 375 ## Some versions of the HPUX 10.20 sed can't process this invocation
Chris@0 376 ## correctly. Breaking it into two sed invocations is a workaround.
Chris@0 377 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
Chris@0 378 rm -f "$tmpdepfile" "$tmpdepfile".bak
Chris@0 379 ;;
Chris@0 380
Chris@0 381 cpp)
Chris@0 382 # Important note: in order to support this mode, a compiler *must*
Chris@0 383 # always write the proprocessed file to stdout.
Chris@0 384 "$@" || exit $?
Chris@0 385
Chris@0 386 # Remove the call to Libtool.
Chris@0 387 if test "$libtool" = yes; then
Chris@0 388 while test $1 != '--mode=compile'; do
Chris@0 389 shift
Chris@0 390 done
Chris@0 391 shift
Chris@0 392 fi
Chris@0 393
Chris@0 394 # Remove `-o $object'.
Chris@0 395 IFS=" "
Chris@0 396 for arg
Chris@0 397 do
Chris@0 398 case $arg in
Chris@0 399 -o)
Chris@0 400 shift
Chris@0 401 ;;
Chris@0 402 $object)
Chris@0 403 shift
Chris@0 404 ;;
Chris@0 405 *)
Chris@0 406 set fnord "$@" "$arg"
Chris@0 407 shift # fnord
Chris@0 408 shift # $arg
Chris@0 409 ;;
Chris@0 410 esac
Chris@0 411 done
Chris@0 412
Chris@0 413 "$@" -E |
Chris@0 414 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
Chris@0 415 sed '$ s: \\$::' > "$tmpdepfile"
Chris@0 416 rm -f "$depfile"
Chris@0 417 echo "$object : \\" > "$depfile"
Chris@0 418 cat < "$tmpdepfile" >> "$depfile"
Chris@0 419 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
Chris@0 420 rm -f "$tmpdepfile"
Chris@0 421 ;;
Chris@0 422
Chris@0 423 msvisualcpp)
Chris@0 424 # Important note: in order to support this mode, a compiler *must*
Chris@0 425 # always write the proprocessed file to stdout, regardless of -o,
Chris@0 426 # because we must use -o when running libtool.
Chris@0 427 "$@" || exit $?
Chris@0 428 IFS=" "
Chris@0 429 for arg
Chris@0 430 do
Chris@0 431 case "$arg" in
Chris@0 432 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
Chris@0 433 set fnord "$@"
Chris@0 434 shift
Chris@0 435 shift
Chris@0 436 ;;
Chris@0 437 *)
Chris@0 438 set fnord "$@" "$arg"
Chris@0 439 shift
Chris@0 440 shift
Chris@0 441 ;;
Chris@0 442 esac
Chris@0 443 done
Chris@0 444 "$@" -E |
Chris@0 445 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
Chris@0 446 rm -f "$depfile"
Chris@0 447 echo "$object : \\" > "$depfile"
Chris@0 448 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
Chris@0 449 echo " " >> "$depfile"
Chris@0 450 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
Chris@0 451 rm -f "$tmpdepfile"
Chris@0 452 ;;
Chris@0 453
Chris@0 454 none)
Chris@0 455 exec "$@"
Chris@0 456 ;;
Chris@0 457
Chris@0 458 *)
Chris@0 459 echo "Unknown depmode $depmode" 1>&2
Chris@0 460 exit 1
Chris@0 461 ;;
Chris@0 462 esac
Chris@0 463
Chris@0 464 exit 0