ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.0.x/depcomp
(Generate patch)

Comparing ircd-hybrid-8/depcomp (file contents):
Revision 1375 by michael, Fri Apr 27 08:01:46 2012 UTC vs.
Revision 1504 by michael, Thu Aug 16 18:03:00 2012 UTC

# Line 1 | Line 1
1   #! /bin/sh
2   # depcomp - compile a program generating dependencies as side-effects
3  
4 < scriptversion=2012-03-27.16; # UTC
4 > scriptversion=2012-07-12.20; # UTC
5  
6   # Copyright (C) 1999-2012 Free Software Foundation, Inc.
7  
# Line 334 | Line 334 | icc)
334    rm -f "$tmpdepfile"
335    ;;
336  
337 + ## The order of this option in the case statement is important, since the
338 + ## shell code in configure will try each of these formats in the order
339 + ## listed in this file.  A plain '-MD' option would be understood by many
340 + ## compilers, so we must ensure this comes after the gcc and icc options.
341 + pgcc)
342 +  # Portland's C compiler understands '-MD'.
343 +  # Will always output deps to 'file.d' where file is the root name of the
344 +  # source file under compilation, even if file resides in a subdirectory.
345 +  # The object file name does not affect the name of the '.d' file.
346 +  # pgcc 10.2 will output
347 +  #    foo.o: sub/foo.c sub/foo.h
348 +  # and will wrap long lines using '\' :
349 +  #    foo.o: sub/foo.c ... \
350 +  #     sub/foo.h ... \
351 +  #     ...
352 +  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
353 +  test "x$dir" = "x$object" && dir=
354 +  # Use the source, not the object, to determine the base name, since
355 +  # that's sadly what pgcc will do too.
356 +  base=`echo "$source" | sed -e 's|^.*/||' -e 's/\.[-_a-zA-Z0-9]*$//'`
357 +  tmpdepfile="$base.d"
358 +
359 +  # For projects that build the same source file twice into different object
360 +  # files, the pgcc approach of using the *source* file root name can cause
361 +  # problems in parallel builds.  Use a locking strategy to avoid stomping on
362 +  # the same $tmpdepfile.
363 +  lockdir="$base.d-lock"
364 +  trap "echo '$0: caught signal, cleaning up...' >&2; rm -rf $lockdir" 1 2 13 15
365 +  numtries=100
366 +  i=$numtries
367 +  while test $i -gt 0 ; do
368 +    # mkdir is a portable test-and-set.
369 +    if mkdir $lockdir 2>/dev/null; then
370 +      # This process acquired the lock.
371 +      "$@" -MD
372 +      stat=$?
373 +      # Release the lock.
374 +      rm -rf $lockdir
375 +      break
376 +    else
377 +      ## the lock is being held by a different process,
378 +      ## wait until the winning process is done or we timeout
379 +      while test -d $lockdir && test $i -gt 0; do
380 +        sleep 1
381 +        i=`expr $i - 1`
382 +      done
383 +    fi
384 +    i=`expr $i - 1`
385 +  done
386 +  trap - 1 2 13 15
387 +  if test $i -le 0; then
388 +    echo "$0: failed to acquire lock after $numtries attempts" >&2
389 +    echo "$0: check lockdir '$lockdir'" >&2
390 +    exit 1
391 +  fi
392 +
393 +  if test $stat -ne 0; then
394 +    rm -f "$tmpdepfile"
395 +    exit $stat
396 +  fi
397 +  rm -f "$depfile"
398 +  # Each line is of the form `foo.o: dependent.h',
399 +  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
400 +  # Do two passes, one to just change these to
401 +  # `$object: dependent.h' and one to simply `dependent.h:'.
402 +  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
403 +  # Some versions of the HPUX 10.20 sed can't process this invocation
404 +  # correctly.  Breaking it into two sed invocations is a workaround.
405 +  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
406 +    sed -e 's/$/ :/' >> "$depfile"
407 +  rm -f "$tmpdepfile"
408 +  ;;
409 +
410   hp2)
411    # The "hp" stanza above does not work with aCC (C++) and HP's ia64
412    # compilers, which have integrated preprocessors.  The correct option

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines