~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to scripts/depcomp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
 
 
3
2
# depcomp - compile a program generating dependencies as side-effects
4
 
# Copyright 1999, 2000 Free Software Foundation, Inc.
 
3
 
 
4
scriptversion=2006-10-15.18
 
5
 
 
6
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
 
7
# Foundation, Inc.
5
8
 
6
9
# This program is free software; you can redistribute it and/or modify
7
10
# it under the terms of the GNU General Public License as published by
8
 
# the Free Software Foundation; either version 2, or (at your option)
 
11
# the Free Software Foundation; either version 3, or (at your option)
9
12
# any later version.
10
13
 
11
14
# This program is distributed in the hope that it will be useful,
14
17
# GNU General Public License for more details.
15
18
 
16
19
# You should have received a copy of the GNU General Public License
17
 
# along with this program; if not, write to the Free Software
18
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
 
# 02111-1307, USA.
 
20
# along with this program; if not, see <http://www.gnu.org/licenses/>.
20
21
 
21
22
# As a special exception to the GNU General Public License, if you
22
23
# distribute this file as part of a program that contains a
25
26
 
26
27
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
27
28
 
 
29
case $1 in
 
30
  '')
 
31
     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
 
32
     exit 1;
 
33
     ;;
 
34
  -h | --h*)
 
35
    cat <<\EOF
 
36
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
 
37
 
 
38
Run PROGRAMS ARGS to compile a file, generating dependencies
 
39
as side-effects.
 
40
 
 
41
Environment variables:
 
42
  depmode     Dependency tracking mode.
 
43
  source      Source file read by `PROGRAMS ARGS'.
 
44
  object      Object file output by `PROGRAMS ARGS'.
 
45
  DEPDIR      directory where to store dependencies.
 
46
  depfile     Dependency file to output.
 
47
  tmpdepfile  Temporary file to use when outputing dependencies.
 
48
  libtool     Whether libtool is used (yes/no).
 
49
 
 
50
Report bugs to <bug-automake@gnu.org>.
 
51
EOF
 
52
    exit $?
 
53
    ;;
 
54
  -v | --v*)
 
55
    echo "depcomp $scriptversion"
 
56
    exit $?
 
57
    ;;
 
58
esac
 
59
 
28
60
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
29
61
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
30
62
  exit 1
31
63
fi
32
 
# `libtool' can also be set to `yes' or `no'.
33
 
 
34
 
if test -z "$depfile"; then
35
 
   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
36
 
   dir=`echo "$object" | sed 's,/.*$,/,'`
37
 
   if test "$dir" = "$object"; then
38
 
      dir=
39
 
   fi
40
 
   # FIXME: should be _deps on DOS.
41
 
   depfile="$dir.deps/$base"
42
 
fi
43
 
 
 
64
 
 
65
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
 
66
depfile=${depfile-`echo "$object" |
 
67
  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
44
68
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
45
69
 
46
70
rm -f "$tmpdepfile"
66
90
## gcc 3 implements dependency tracking that does exactly what
67
91
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
68
92
## it if -MD -MP comes after the -MF stuff.  Hmm.
69
 
  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
 
93
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
 
94
## the command line argument order; so add the flags where they
 
95
## appear in depend2.am.  Note that the slowdown incurred here
 
96
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
 
97
  for arg
 
98
  do
 
99
    case $arg in
 
100
    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
 
101
    *)  set fnord "$@" "$arg" ;;
 
102
    esac
 
103
    shift # fnord
 
104
    shift # $arg
 
105
  done
 
106
  "$@"
70
107
  stat=$?
71
108
  if test $stat -eq 0; then :
72
109
  else
172
209
 
173
210
aix)
174
211
  # The C for AIX Compiler uses -M and outputs the dependencies
175
 
  # in a .u file.  This file always lives in the current directory.
176
 
  # Also, the AIX compiler puts `$object:' at the start of each line;
177
 
  # $object doesn't have directory information.
178
 
  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
 
212
  # in a .u file.  In older versions, this file always lives in the
 
213
  # current directory.  Also, the AIX compiler puts `$object:' at the
 
214
  # start of each line; $object doesn't have directory information.
 
215
  # Version 6 uses the directory in both cases.
 
216
  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
179
217
  tmpdepfile="$stripped.u"
180
 
  outname="$stripped.o"
181
218
  if test "$libtool" = yes; then
182
219
    "$@" -Wc,-M
183
220
  else
184
221
    "$@" -M
185
222
  fi
186
 
 
187
223
  stat=$?
 
224
 
 
225
  if test -f "$tmpdepfile"; then :
 
226
  else
 
227
    stripped=`echo "$stripped" | sed 's,^.*/,,'`
 
228
    tmpdepfile="$stripped.u"
 
229
  fi
 
230
 
188
231
  if test $stat -eq 0; then :
189
232
  else
190
233
    rm -f "$tmpdepfile"
192
235
  fi
193
236
 
194
237
  if test -f "$tmpdepfile"; then
 
238
    outname="$stripped.o"
195
239
    # Each line is of the form `foo.o: dependent.h'.
196
240
    # Do two passes, one to just change these to
197
241
    # `$object: dependent.h' and one to simply `dependent.h:'.
244
288
  rm -f "$tmpdepfile"
245
289
  ;;
246
290
 
 
291
hp2)
 
292
  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
 
293
  # compilers, which have integrated preprocessors.  The correct option
 
294
  # to use with these is +Maked; it writes dependencies to a file named
 
295
  # 'foo.d', which lands next to the object file, wherever that
 
296
  # happens to be.
 
297
  # Much of this is similar to the tru64 case; see comments there.
 
298
  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
 
299
  test "x$dir" = "x$object" && dir=
 
300
  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
 
301
  if test "$libtool" = yes; then
 
302
    tmpdepfile1=$dir$base.d
 
303
    tmpdepfile2=$dir.libs/$base.d
 
304
    "$@" -Wc,+Maked
 
305
  else
 
306
    tmpdepfile1=$dir$base.d
 
307
    tmpdepfile2=$dir$base.d
 
308
    "$@" +Maked
 
309
  fi
 
310
  stat=$?
 
311
  if test $stat -eq 0; then :
 
312
  else
 
313
     rm -f "$tmpdepfile1" "$tmpdepfile2"
 
314
     exit $stat
 
315
  fi
 
316
 
 
317
  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
 
318
  do
 
319
    test -f "$tmpdepfile" && break
 
320
  done
 
321
  if test -f "$tmpdepfile"; then
 
322
    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
 
323
    # Add `dependent.h:' lines.
 
324
    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
 
325
  else
 
326
    echo "#dummy" > "$depfile"
 
327
  fi
 
328
  rm -f "$tmpdepfile" "$tmpdepfile2"
 
329
  ;;
 
330
 
247
331
tru64)
248
332
   # The Tru64 compiler uses -MD to generate dependencies as a side
249
333
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
255
339
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
256
340
 
257
341
   if test "$libtool" = yes; then
258
 
      tmpdepfile1="$dir.libs/$base.lo.d"
259
 
      tmpdepfile2="$dir.libs/$base.d"
 
342
      # With Tru64 cc, shared objects can also be used to make a
 
343
      # static library.  This mechanism is used in libtool 1.4 series to
 
344
      # handle both shared and static libraries in a single compilation.
 
345
      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
 
346
      #
 
347
      # With libtool 1.5 this exception was removed, and libtool now
 
348
      # generates 2 separate objects for the 2 libraries.  These two
 
349
      # compilations output dependencies in $dir.libs/$base.o.d and
 
350
      # in $dir$base.o.d.  We have to check for both files, because
 
351
      # one of the two compilations can be disabled.  We should prefer
 
352
      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
 
353
      # automatically cleaned when .libs/ is deleted, while ignoring
 
354
      # the former would cause a distcleancheck panic.
 
355
      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
 
356
      tmpdepfile2=$dir$base.o.d          # libtool 1.5
 
357
      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
 
358
      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
260
359
      "$@" -Wc,-MD
261
360
   else
262
 
      tmpdepfile1="$dir$base.o.d"
263
 
      tmpdepfile2="$dir$base.d"
 
361
      tmpdepfile1=$dir$base.o.d
 
362
      tmpdepfile2=$dir$base.d
 
363
      tmpdepfile3=$dir$base.d
 
364
      tmpdepfile4=$dir$base.d
264
365
      "$@" -MD
265
366
   fi
266
367
 
267
368
   stat=$?
268
369
   if test $stat -eq 0; then :
269
370
   else
270
 
      rm -f "$tmpdepfile1" "$tmpdepfile2"
 
371
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
271
372
      exit $stat
272
373
   fi
273
374
 
274
 
   if test -f "$tmpdepfile1"; then
275
 
      tmpdepfile="$tmpdepfile1"
276
 
   else
277
 
      tmpdepfile="$tmpdepfile2"
278
 
   fi
 
375
   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
 
376
   do
 
377
     test -f "$tmpdepfile" && break
 
378
   done
279
379
   if test -f "$tmpdepfile"; then
280
380
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
281
 
      # That's a space and a tab in the [].
282
 
      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
 
381
      # That's a tab and a space in the [].
 
382
      sed -e 's,^.*\.[a-z]*:[    ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
283
383
   else
284
384
      echo "#dummy" > "$depfile"
285
385
   fi
292
392
 
293
393
dashmstdout)
294
394
  # Important note: in order to support this mode, a compiler *must*
295
 
  # always write the proprocessed file to stdout, regardless of -o.
 
395
  # always write the preprocessed file to stdout, regardless of -o.
296
396
  "$@" || exit $?
297
397
 
298
398
  # Remove the call to Libtool.
388
488
 
389
489
cpp)
390
490
  # Important note: in order to support this mode, a compiler *must*
391
 
  # always write the proprocessed file to stdout.
 
491
  # always write the preprocessed file to stdout.
392
492
  "$@" || exit $?
393
493
 
394
494
  # Remove the call to Libtool.
419
519
  done
420
520
 
421
521
  "$@" -E |
422
 
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
 
522
    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
 
523
       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
423
524
    sed '$ s: \\$::' > "$tmpdepfile"
424
525
  rm -f "$depfile"
425
526
  echo "$object : \\" > "$depfile"
430
531
 
431
532
msvisualcpp)
432
533
  # Important note: in order to support this mode, a compiler *must*
433
 
  # always write the proprocessed file to stdout, regardless of -o,
 
534
  # always write the preprocessed file to stdout, regardless of -o,
434
535
  # because we must use -o when running libtool.
435
536
  "$@" || exit $?
436
537
  IFS=" "
470
571
esac
471
572
 
472
573
exit 0
 
574
 
 
575
# Local Variables:
 
576
# mode: shell-script
 
577
# sh-indentation: 2
 
578
# eval: (add-hook 'write-file-hooks 'time-stamp)
 
579
# time-stamp-start: "scriptversion="
 
580
# time-stamp-format: "%:y-%02m-%02d.%02H"
 
581
# time-stamp-end: "$"
 
582
# End: