~ubuntu-branches/ubuntu/warty/curl/warty-security

« back to all changes in this revision

Viewing changes to depcomp

  • Committer: Bazaar Package Importer
  • Author(s): Domenico Andreoli
  • Date: 2004-06-04 19:09:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040604190925-wy048bp31320r2z6
Tags: 7.12.0.is.7.11.2-1
* Reverted to version 7.11.2 (closes: #252348).
* Disabled support for libidn (closes: #252367). This is to leave
  curl in unstable as much similar as possible to the one in testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
2
 
3
3
# depcomp - compile a program generating dependencies as side-effects
4
 
# Copyright 1999, 2000 Free Software Foundation, Inc.
 
4
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
5
5
 
6
6
# This program is free software; you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
31
31
fi
32
32
# `libtool' can also be set to `yes' or `no'.
33
33
 
34
 
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
 
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
 
35
44
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
36
45
 
37
46
rm -f "$tmpdepfile"
163
172
 
164
173
aix)
165
174
  # The C for AIX Compiler uses -M and outputs the dependencies
166
 
  # in a .u file.  This file always lives in the current directory.
167
 
  # Also, the AIX compiler puts `$object:' at the start of each line;
168
 
  # $object doesn't have directory information.
169
 
  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
 
175
  # in a .u file.  In older versions, this file always lives in the
 
176
  # current directory.  Also, the AIX compiler puts `$object:' at the
 
177
  # start of each line; $object doesn't have directory information.
 
178
  # Version 6 uses the directory in both cases.
 
179
  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
170
180
  tmpdepfile="$stripped.u"
171
 
  outname="$stripped.o"
172
181
  if test "$libtool" = yes; then
173
182
    "$@" -Wc,-M
174
183
  else
175
184
    "$@" -M
176
185
  fi
177
 
 
178
186
  stat=$?
 
187
 
 
188
  if test -f "$tmpdepfile"; then :
 
189
  else
 
190
    stripped=`echo "$stripped" | sed 's,^.*/,,'`
 
191
    tmpdepfile="$stripped.u"
 
192
  fi
 
193
 
179
194
  if test $stat -eq 0; then :
180
195
  else
181
196
    rm -f "$tmpdepfile"
183
198
  fi
184
199
 
185
200
  if test -f "$tmpdepfile"; then
 
201
    outname="$stripped.o"
186
202
    # Each line is of the form `foo.o: dependent.h'.
187
203
    # Do two passes, one to just change these to
188
204
    # `$object: dependent.h' and one to simply `dependent.h:'.
197
213
  rm -f "$tmpdepfile"
198
214
  ;;
199
215
 
 
216
icc)
 
217
  # Intel's C compiler understands `-MD -MF file'.  However on
 
218
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
 
219
  # ICC 7.0 will fill foo.d with something like
 
220
  #    foo.o: sub/foo.c
 
221
  #    foo.o: sub/foo.h
 
222
  # which is wrong.  We want:
 
223
  #    sub/foo.o: sub/foo.c
 
224
  #    sub/foo.o: sub/foo.h
 
225
  #    sub/foo.c:
 
226
  #    sub/foo.h:
 
227
  # ICC 7.1 will output
 
228
  #    foo.o: sub/foo.c sub/foo.h
 
229
  # and will wrap long lines using \ :
 
230
  #    foo.o: sub/foo.c ... \
 
231
  #     sub/foo.h ... \
 
232
  #     ...
 
233
 
 
234
  "$@" -MD -MF "$tmpdepfile"
 
235
  stat=$?
 
236
  if test $stat -eq 0; then :
 
237
  else
 
238
    rm -f "$tmpdepfile"
 
239
    exit $stat
 
240
  fi
 
241
  rm -f "$depfile"
 
242
  # Each line is of the form `foo.o: dependent.h',
 
243
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
 
244
  # Do two passes, one to just change these to
 
245
  # `$object: dependent.h' and one to simply `dependent.h:'.
 
246
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
 
247
  # Some versions of the HPUX 10.20 sed can't process this invocation
 
248
  # correctly.  Breaking it into two sed invocations is a workaround.
 
249
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
 
250
    sed -e 's/$/ :/' >> "$depfile"
 
251
  rm -f "$tmpdepfile"
 
252
  ;;
 
253
 
200
254
tru64)
201
 
   # The Tru64 AIX compiler uses -MD to generate dependencies as a side
 
255
   # The Tru64 compiler uses -MD to generate dependencies as a side
202
256
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
203
 
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
 
257
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
204
258
   # dependencies in `foo.d' instead, so we check for that too.
205
259
   # Subdirectories are respected.
 
260
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
 
261
   test "x$dir" = "x$object" && dir=
 
262
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
206
263
 
207
 
   tmpdepfile1="$object.d"
208
 
   tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` 
209
264
   if test "$libtool" = yes; then
 
265
      tmpdepfile1="$dir.libs/$base.lo.d"
 
266
      tmpdepfile2="$dir.libs/$base.d"
210
267
      "$@" -Wc,-MD
211
268
   else
 
269
      tmpdepfile1="$dir$base.o.d"
 
270
      tmpdepfile2="$dir$base.d"
212
271
      "$@" -MD
213
272
   fi
214
273
 
226
285
   fi
227
286
   if test -f "$tmpdepfile"; then
228
287
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
229
 
      # That's a space and a tab in the [].
230
 
      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
 
288
      # That's a tab and a space in the [].
 
289
      sed -e 's,^.*\.[a-z]*:[    ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
231
290
   else
232
291
      echo "#dummy" > "$depfile"
233
292
   fi
240
299
 
241
300
dashmstdout)
242
301
  # Important note: in order to support this mode, a compiler *must*
243
 
  # always write the proprocessed file to stdout, regardless of -o,
244
 
  # because we must use -o when running libtool.
 
302
  # always write the preprocessed file to stdout, regardless of -o.
 
303
  "$@" || exit $?
 
304
 
 
305
  # Remove the call to Libtool.
 
306
  if test "$libtool" = yes; then
 
307
    while test $1 != '--mode=compile'; do
 
308
      shift
 
309
    done
 
310
    shift
 
311
  fi
 
312
 
 
313
  # Remove `-o $object'.
 
314
  IFS=" "
 
315
  for arg
 
316
  do
 
317
    case $arg in
 
318
    -o)
 
319
      shift
 
320
      ;;
 
321
    $object)
 
322
      shift
 
323
      ;;
 
324
    *)
 
325
      set fnord "$@" "$arg"
 
326
      shift # fnord
 
327
      shift # $arg
 
328
      ;;
 
329
    esac
 
330
  done
 
331
 
245
332
  test -z "$dashmflag" && dashmflag=-M
246
 
  ( IFS=" "
247
 
    case " $* " in
248
 
    *" --mode=compile "*) # this is libtool, let us make it quiet
249
 
      for arg
250
 
      do # cycle over the arguments
251
 
        case "$arg" in
252
 
        "--mode=compile")
253
 
          # insert --quiet before "--mode=compile"
254
 
          set fnord "$@" --quiet
255
 
          shift # fnord
256
 
          ;;
257
 
        esac
258
 
        set fnord "$@" "$arg"
259
 
        shift # fnord
260
 
        shift # "$arg"
261
 
      done
262
 
      ;;
263
 
    esac
264
 
    "$@" $dashmflag | sed 's:^[^:]*\:[  ]*:'"$object"'\: :' > "$tmpdepfile"
265
 
  ) &
266
 
  proc=$!
267
 
  "$@"
268
 
  stat=$?
269
 
  wait "$proc"
270
 
  if test "$stat" != 0; then exit $stat; fi
 
333
  # Require at least two characters before searching for `:'
 
334
  # in the target name.  This is to cope with DOS-style filenames:
 
335
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
 
336
  "$@" $dashmflag |
 
337
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
271
338
  rm -f "$depfile"
272
339
  cat < "$tmpdepfile" > "$depfile"
273
340
  tr ' ' '
285
352
  ;;
286
353
 
287
354
makedepend)
 
355
  "$@" || exit $?
 
356
  # Remove any Libtool call
 
357
  if test "$libtool" = yes; then
 
358
    while test $1 != '--mode=compile'; do
 
359
      shift
 
360
    done
 
361
    shift
 
362
  fi
288
363
  # X makedepend
289
 
  (
290
 
    shift
291
 
    cleared=no
292
 
    for arg in "$@"; do
293
 
      case $cleared in no)
294
 
        set ""; shift
295
 
        cleared=yes
296
 
      esac
297
 
      case "$arg" in
298
 
        -D*|-I*)
299
 
          set fnord "$@" "$arg"; shift;;
300
 
        -*)
301
 
          ;;
302
 
        *)
303
 
          set fnord "$@" "$arg"; shift;;
304
 
      esac
305
 
    done
306
 
    obj_suffix="`echo $object | sed 's/^.*\././'`"
307
 
    touch "$tmpdepfile"
308
 
    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
309
 
  ) &
310
 
  proc=$!
311
 
  "$@"
312
 
  stat=$?
313
 
  wait "$proc"
314
 
  if test "$stat" != 0; then exit $stat; fi
 
364
  shift
 
365
  cleared=no
 
366
  for arg in "$@"; do
 
367
    case $cleared in
 
368
    no)
 
369
      set ""; shift
 
370
      cleared=yes ;;
 
371
    esac
 
372
    case "$arg" in
 
373
    -D*|-I*)
 
374
      set fnord "$@" "$arg"; shift ;;
 
375
    # Strip any option that makedepend may not understand.  Remove
 
376
    # the object too, otherwise makedepend will parse it as a source file.
 
377
    -*|$object)
 
378
      ;;
 
379
    *)
 
380
      set fnord "$@" "$arg"; shift ;;
 
381
    esac
 
382
  done
 
383
  obj_suffix="`echo $object | sed 's/^.*\././'`"
 
384
  touch "$tmpdepfile"
 
385
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
315
386
  rm -f "$depfile"
316
387
  cat < "$tmpdepfile" > "$depfile"
317
 
  tail +3 "$tmpdepfile" | tr ' ' '
 
388
  sed '1,2d' "$tmpdepfile" | tr ' ' '
318
389
' | \
319
390
## Some versions of the HPUX 10.20 sed can't process this invocation
320
391
## correctly.  Breaking it into two sed invocations is a workaround.
324
395
 
325
396
cpp)
326
397
  # Important note: in order to support this mode, a compiler *must*
327
 
  # always write the proprocessed file to stdout, regardless of -o,
328
 
  # because we must use -o when running libtool.
329
 
  ( IFS=" "
330
 
    case " $* " in
331
 
    *" --mode=compile "*)
332
 
      for arg
333
 
      do # cycle over the arguments
334
 
        case $arg in
335
 
        "--mode=compile")
336
 
          # insert --quiet before "--mode=compile"
337
 
          set fnord "$@" --quiet
338
 
          shift # fnord
339
 
          ;;
340
 
        esac
341
 
        set fnord "$@" "$arg"
342
 
        shift # fnord
343
 
        shift # "$arg"
344
 
      done
 
398
  # always write the preprocessed file to stdout.
 
399
  "$@" || exit $?
 
400
 
 
401
  # Remove the call to Libtool.
 
402
  if test "$libtool" = yes; then
 
403
    while test $1 != '--mode=compile'; do
 
404
      shift
 
405
    done
 
406
    shift
 
407
  fi
 
408
 
 
409
  # Remove `-o $object'.
 
410
  IFS=" "
 
411
  for arg
 
412
  do
 
413
    case $arg in
 
414
    -o)
 
415
      shift
 
416
      ;;
 
417
    $object)
 
418
      shift
 
419
      ;;
 
420
    *)
 
421
      set fnord "$@" "$arg"
 
422
      shift # fnord
 
423
      shift # $arg
345
424
      ;;
346
425
    esac
347
 
    "$@" -E |
 
426
  done
 
427
 
 
428
  "$@" -E |
348
429
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
349
430
    sed '$ s: \\$::' > "$tmpdepfile"
350
 
  ) &
351
 
  proc=$!
352
 
  "$@"
353
 
  stat=$?
354
 
  wait "$proc"
355
 
  if test "$stat" != 0; then exit $stat; fi
356
431
  rm -f "$depfile"
357
432
  echo "$object : \\" > "$depfile"
358
433
  cat < "$tmpdepfile" >> "$depfile"
362
437
 
363
438
msvisualcpp)
364
439
  # Important note: in order to support this mode, a compiler *must*
365
 
  # always write the proprocessed file to stdout, regardless of -o,
 
440
  # always write the preprocessed file to stdout, regardless of -o,
366
441
  # because we must use -o when running libtool.
367
 
  ( IFS=" "
368
 
    case " $* " in
369
 
    *" --mode=compile "*)
370
 
      for arg
371
 
      do # cycle over the arguments
372
 
        case $arg in
373
 
        "--mode=compile")
374
 
          # insert --quiet before "--mode=compile"
375
 
          set fnord "$@" --quiet
376
 
          shift # fnord
377
 
          ;;
378
 
        esac
 
442
  "$@" || exit $?
 
443
  IFS=" "
 
444
  for arg
 
445
  do
 
446
    case "$arg" in
 
447
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
 
448
        set fnord "$@"
 
449
        shift
 
450
        shift
 
451
        ;;
 
452
    *)
379
453
        set fnord "$@" "$arg"
380
 
        shift # fnord
381
 
        shift # "$arg"
382
 
      done
383
 
      ;;
 
454
        shift
 
455
        shift
 
456
        ;;
384
457
    esac
385
 
    "$@" -E |
386
 
    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
387
 
  ) &
388
 
  proc=$!
389
 
  "$@"
390
 
  stat=$?
391
 
  wait "$proc"
392
 
  if test "$stat" != 0; then exit $stat; fi
 
458
  done
 
459
  "$@" -E |
 
460
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
393
461
  rm -f "$depfile"
394
462
  echo "$object : \\" > "$depfile"
395
463
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::    \1 \\:p' >> "$depfile"