~ubuntu-branches/debian/lenny/wavpack/lenny

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-04-24 20:30:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060424203048-lztb33vr33kd8uug
Tags: 4.32-2
Make sure that dh_makeshlibs of libwavpack0 is called before dh_shlibdeps
of wavpack to generate correct dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
PROGRAM=ltmain.sh
45
45
PACKAGE=libtool
46
 
VERSION=1.5.10
47
 
TIMESTAMP=" (1.1220.2.131 2004/09/19 12:46:56)"
 
46
VERSION=1.5.6
 
47
TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $"
48
48
 
49
 
# See if we are running on zsh, and set the options which allow our
50
 
# commands through without removal of \ escapes.
51
 
if test -n "${ZSH_VERSION+set}" ; then
52
 
  setopt NO_GLOB_SUBST
53
 
fi
54
49
 
55
50
# Check that we have a working $echo.
56
51
if test "X$1" = X--no-reexec; then
240
235
      esac
241
236
    fi
242
237
}
243
 
 
244
 
 
245
 
# func_extract_archives gentop oldlib ...
246
 
func_extract_archives () {
247
 
    my_gentop="$1"; shift
248
 
    my_oldlibs=${1+"$@"}
249
 
    my_oldobjs=""
250
 
    my_xlib=""
251
 
    my_xabs=""
252
 
    my_xdir=""
253
 
    my_status=""
254
 
 
255
 
    $show "${rm}r $my_gentop"
256
 
    $run ${rm}r "$my_gentop"
257
 
    $show "$mkdir $my_gentop"
258
 
    $run $mkdir "$my_gentop"
259
 
    my_status=$?
260
 
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
261
 
      exit $my_status
262
 
    fi
263
 
 
264
 
    for my_xlib in $my_oldlibs; do
265
 
      # Extract the objects.
266
 
      case $my_xlib in
267
 
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
268
 
        *) my_xabs=`pwd`"/$my_xlib" ;;
269
 
      esac
270
 
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
271
 
      my_xdir="$my_gentop/$my_xlib"
272
 
 
273
 
      $show "${rm}r $my_xdir"
274
 
      $run ${rm}r "$my_xdir"
275
 
      $show "$mkdir $my_xdir"
276
 
      $run $mkdir "$my_xdir"
277
 
      status=$?
278
 
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
279
 
        exit $status
280
 
      fi
281
 
      case $host in
282
 
      *-darwin*)
283
 
        $show "Extracting $my_xabs"
284
 
        # Do not bother doing anything if just a dry run
285
 
        if test -z "$run"; then
286
 
          darwin_orig_dir=`pwd`
287
 
          cd $my_xdir || exit $?
288
 
          darwin_archive=$my_xabs
289
 
          darwin_curdir=`pwd`
290
 
          darwin_base_archive=`basename $darwin_archive`
291
 
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
292
 
          if test -n "$darwin_arches"; then 
293
 
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
294
 
            darwin_arch=
295
 
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
296
 
            for darwin_arch in  $darwin_arches ; do
297
 
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
298
 
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
299
 
              # Remove the table of contents from the thin files.
300
 
              $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
301
 
              $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
302
 
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
303
 
              $AR -xo "${darwin_base_archive}"
304
 
              rm "${darwin_base_archive}"
305
 
              cd "$darwin_curdir"
306
 
            done # $darwin_arches
307
 
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
308
 
            darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
309
 
            darwin_file=
310
 
            darwin_files=
311
 
            for darwin_file in $darwin_filelist; do
312
 
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
313
 
              lipo -create -output "$darwin_file" $darwin_files
314
 
            done # $darwin_filelist
315
 
            rm -rf unfat-$$
316
 
            cd "$darwin_orig_dir"
317
 
          else
318
 
            cd $darwin_orig_dir
319
 
            (cd $my_xdir && $AR x $my_xabs) || exit $?
320
 
          fi # $darwin_arches
321
 
        fi # $run
322
 
      ;;
323
 
      *)
324
 
        # We will extract separately just the conflicting names and we will
325
 
        # no longer touch any unique names. It is faster to leave these
326
 
        # extract automatically by $AR in one run.
327
 
        $show "(cd $my_xdir && $AR x $my_xabs)"
328
 
        $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
329
 
        if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
330
 
          :
331
 
        else
332
 
          $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
333
 
          $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
334
 
          $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
335
 
          do
336
 
            i=1
337
 
            while test "$i" -le "$count"
338
 
            do
339
 
              # Put our $i before any first dot (extension)
340
 
              # Never overwrite any file
341
 
              name_to="$name"
342
 
              while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
343
 
              do
344
 
                name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
345
 
              done
346
 
              $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
347
 
              $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
348
 
              i=`expr $i + 1`
349
 
            done
350
 
          done
351
 
        fi
352
 
        ;;
353
 
      esac
354
 
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
355
 
    done
356
 
 
357
 
    func_extract_archives_result="$my_oldobjs"
358
 
}
359
238
# End of Shell function definitions
360
239
#####################################
361
240
 
1959
1838
        case $pass in
1960
1839
        dlopen) libs="$dlfiles" ;;
1961
1840
        dlpreopen) libs="$dlprefiles" ;;
1962
 
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
1841
        link)
 
1842
          libs="$deplibs %DEPLIBS%"
 
1843
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
 
1844
          ;;
1963
1845
        esac
1964
1846
      fi
1965
1847
      if test "$pass" = dlopen; then
1985
1867
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1986
1868
            continue
1987
1869
          fi
1988
 
          if test "$pass" = conv; then
1989
 
            deplibs="$deplib $deplibs"
1990
 
            continue
1991
 
          fi
1992
1870
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1993
1871
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1994
1872
            for search_ext in .la $std_shrext .so .a; do
2099
1977
          fi
2100
1978
          case $linkmode in
2101
1979
          lib)
2102
 
            valid_a_lib=no
2103
 
            case $deplibs_check_method in
2104
 
              match_pattern*)
2105
 
                set dummy $deplibs_check_method
2106
 
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2107
 
                if eval $echo \"$deplib\" 2>/dev/null \
2108
 
                    | $SED 10q \
2109
 
                    | $EGREP "$match_pattern_regex" > /dev/null; then
2110
 
                  valid_a_lib=yes
2111
 
                fi
2112
 
                ;;
2113
 
              pass_all)
2114
 
                valid_a_lib=yes
2115
 
                ;;
2116
 
            esac
2117
 
            if test "$valid_a_lib" != yes; then
 
1980
            if test "$deplibs_check_method" != pass_all; then
2118
1981
              $echo
2119
1982
              $echo "*** Warning: Trying to link with static lib archive $deplib."
2120
1983
              $echo "*** I have the capability to make that library automatically link in when"
2287
2150
            absdir="$libdir"
2288
2151
          fi
2289
2152
        else
2290
 
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2291
 
            dir="$ladir"
2292
 
            absdir="$abs_ladir"
2293
 
            # Remove this search path later
2294
 
            notinst_path="$notinst_path $abs_ladir"
2295
 
          else
2296
 
            dir="$ladir/$objdir"
2297
 
            absdir="$abs_ladir/$objdir"
2298
 
            # Remove this search path later
2299
 
            notinst_path="$notinst_path $abs_ladir"
2300
 
          fi
 
2153
          dir="$ladir/$objdir"
 
2154
          absdir="$abs_ladir/$objdir"
 
2155
          # Remove this search path later
 
2156
          notinst_path="$notinst_path $abs_ladir"
2301
2157
        fi # $installed = yes
2302
2158
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2303
2159
 
3073
2929
            age="$number_minor"
3074
2930
            revision="$number_minor"
3075
2931
            ;;
 
2932
          *)
 
2933
            $echo "$modename: unknown library version type \`$version_type'" 1>&2
 
2934
            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
2935
            exit $EXIT_FAILURE
 
2936
            ;;
3076
2937
          esac
3077
2938
          ;;
3078
2939
        no)
3084
2945
 
3085
2946
        # Check that each of the things are valid numbers.
3086
2947
        case $current in
3087
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2948
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3088
2949
        *)
3089
2950
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3090
2951
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3093
2954
        esac
3094
2955
 
3095
2956
        case $revision in
3096
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2957
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3097
2958
        *)
3098
2959
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3099
2960
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3102
2963
        esac
3103
2964
 
3104
2965
        case $age in
3105
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2966
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3106
2967
        *)
3107
2968
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3108
2969
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3130
2991
          versuffix="$major.$age.$revision"
3131
2992
          # Darwin ld doesn't like 0 for these options...
3132
2993
          minor_current=`expr $current + 1`
3133
 
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
 
2994
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3134
2995
          ;;
3135
2996
 
3136
2997
        freebsd-aout)
3818
3679
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3819
3680
          else
3820
3681
            gentop="$output_objdir/${outputname}x"
 
3682
            $show "${rm}r $gentop"
 
3683
            $run ${rm}r "$gentop"
 
3684
            $show "$mkdir $gentop"
 
3685
            $run $mkdir "$gentop"
 
3686
            status=$?
 
3687
            if test "$status" -ne 0 && test ! -d "$gentop"; then
 
3688
              exit $status
 
3689
            fi
3821
3690
            generated="$generated $gentop"
3822
3691
 
3823
 
            func_extract_archives $gentop $convenience
3824
 
            libobjs="$libobjs $func_extract_archives_result"
 
3692
            for xlib in $convenience; do
 
3693
              # Extract the objects.
 
3694
              case $xlib in
 
3695
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
3696
              *) xabs=`pwd`"/$xlib" ;;
 
3697
              esac
 
3698
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
3699
              xdir="$gentop/$xlib"
 
3700
 
 
3701
              $show "${rm}r $xdir"
 
3702
              $run ${rm}r "$xdir"
 
3703
              $show "$mkdir $xdir"
 
3704
              $run $mkdir "$xdir"
 
3705
              status=$?
 
3706
              if test "$status" -ne 0 && test ! -d "$xdir"; then
 
3707
                exit $status
 
3708
              fi
 
3709
              # We will extract separately just the conflicting names and we will no
 
3710
              # longer touch any unique names. It is faster to leave these extract
 
3711
              # automatically by $AR in one run.
 
3712
              $show "(cd $xdir && $AR x $xabs)"
 
3713
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
3714
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
3715
                :
 
3716
              else
 
3717
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
3718
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
3719
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
3720
                do
 
3721
                  i=1
 
3722
                  while test "$i" -le "$count"
 
3723
                  do
 
3724
                   # Put our $i before any first dot (extension)
 
3725
                   # Never overwrite any file
 
3726
                   name_to="$name"
 
3727
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
3728
                   do
 
3729
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
3730
                   done
 
3731
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
3732
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
3733
                   i=`expr $i + 1`
 
3734
                  done
 
3735
                done
 
3736
              fi
 
3737
 
 
3738
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
3739
            done
3825
3740
          fi
3826
3741
        fi
3827
 
        
 
3742
 
3828
3743
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3829
3744
          eval flag=\"$thread_safe_flag_spec\"
3830
3745
          linker_flags="$linker_flags $flag"
4062
3977
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4063
3978
        else
4064
3979
          gentop="$output_objdir/${obj}x"
 
3980
          $show "${rm}r $gentop"
 
3981
          $run ${rm}r "$gentop"
 
3982
          $show "$mkdir $gentop"
 
3983
          $run $mkdir "$gentop"
 
3984
          status=$?
 
3985
          if test "$status" -ne 0 && test ! -d "$gentop"; then
 
3986
            exit $status
 
3987
          fi
4065
3988
          generated="$generated $gentop"
4066
3989
 
4067
 
          func_extract_archives $gentop $convenience
4068
 
          reload_conv_objs="$reload_objs $func_extract_archives_result"
 
3990
          for xlib in $convenience; do
 
3991
            # Extract the objects.
 
3992
            case $xlib in
 
3993
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
3994
            *) xabs=`pwd`"/$xlib" ;;
 
3995
            esac
 
3996
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
3997
            xdir="$gentop/$xlib"
 
3998
 
 
3999
            $show "${rm}r $xdir"
 
4000
            $run ${rm}r "$xdir"
 
4001
            $show "$mkdir $xdir"
 
4002
            $run $mkdir "$xdir"
 
4003
            status=$?
 
4004
            if test "$status" -ne 0 && test ! -d "$xdir"; then
 
4005
              exit $status
 
4006
            fi
 
4007
            # We will extract separately just the conflicting names and we will no
 
4008
            # longer touch any unique names. It is faster to leave these extract
 
4009
            # automatically by $AR in one run.
 
4010
            $show "(cd $xdir && $AR x $xabs)"
 
4011
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
4012
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
4013
              :
 
4014
            else
 
4015
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
4016
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
4017
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
4018
              do
 
4019
                i=1
 
4020
                while test "$i" -le "$count"
 
4021
                do
 
4022
                 # Put our $i before any first dot (extension)
 
4023
                 # Never overwrite any file
 
4024
                 name_to="$name"
 
4025
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
4026
                 do
 
4027
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
4028
                 done
 
4029
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
4030
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
4031
                 i=`expr $i + 1`
 
4032
                done
 
4033
              done
 
4034
            fi
 
4035
 
 
4036
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
4037
          done
4069
4038
        fi
4070
4039
      fi
4071
4040
 
4330
4299
              export_symbols="$output_objdir/$output.exp"
4331
4300
              $run $rm $export_symbols
4332
4301
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4333
 
              case $host in
4334
 
              *cygwin* | *mingw* )
4335
 
                $run eval "${SED} -e '1iEXPORTS'"' < "$export_symbols" > "$output_objdir/$output.def"'
4336
 
                ;;
4337
 
              esac
4338
4302
            else
4339
4303
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4340
 
              case $host in
4341
 
              *cygwin* | *mingw* )
4342
 
                $run eval "${SED} -e '1iEXPORTS'"' < "$output_objdir/$output.exp" > "$output_objdir/$output.def"'
4343
 
                ;;
4344
 
              esac
4345
4304
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4346
4305
              $run eval 'mv "$nlist"T "$nlist"'
4347
4306
            fi
4394
4353
#endif
4395
4354
 
4396
4355
/* The mapping between symbol names and symbols. */
4397
 
"
4398
 
 
4399
 
            case $host in
4400
 
            *cygwin* | *mingw* )
4401
 
              $echo >> "$output_objdir/$dlsyms" "\
4402
 
/* DATA imports from DLLs on WIN32 can't be const, because
4403
 
   runtime relocations are performed -- see ld's documentation
4404
 
   on pseudo-relocs */
4405
 
struct {
4406
 
"
4407
 
              ;;
4408
 
            * )
4409
 
              $echo >> "$output_objdir/$dlsyms" "\
4410
4356
const struct {
4411
 
"
4412
 
              ;;
4413
 
            esac
4414
 
 
4415
 
 
4416
 
            $echo >> "$output_objdir/$dlsyms" "\
4417
4357
  const char *name;
4418
4358
  lt_ptr address;
4419
4359
}
4464
4404
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4465
4405
 
4466
4406
          # Clean up the generated files.
4467
 
          #$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4468
 
          #$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
 
4407
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
 
4408
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4469
4409
 
4470
4410
          # Transform the symbol file into the correct name.
4471
 
          case $host in
4472
 
          *cygwin* | *mingw* )
4473
 
            if test -f "$output_objdir/${outputname}.def" ; then
4474
 
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4475
 
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4476
 
            else
4477
 
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4478
 
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4479
 
            fi
4480
 
            ;;
4481
 
          * )
4482
 
            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4483
 
            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4484
 
            ;;
4485
 
          esac
 
4411
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4412
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4486
4413
          ;;
4487
4414
        *)
4488
4415
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4511
4438
 
4512
4439
        # Delete the generated files.
4513
4440
        if test -n "$dlsyms"; then
4514
 
          #$show "$rm $output_objdir/${outputname}S.${objext}"
4515
 
          #$run $rm "$output_objdir/${outputname}S.${objext}"
4516
 
          :
 
4441
          $show "$rm $output_objdir/${outputname}S.${objext}"
 
4442
          $run $rm "$output_objdir/${outputname}S.${objext}"
4517
4443
        fi
4518
4444
 
4519
4445
        exit $status
4656
4582
        esac
4657
4583
        case $host in
4658
4584
          *cygwin* | *mingw* )
4659
 
            output_name=`basename $output`
4660
 
            output_path=`dirname $output`
4661
 
            cwrappersource=`$echo ${output_path}/${objdir}/lt-${output_name}.c`
4662
 
            cwrapper=`$echo ${output_path}/${output_name}.exe`
 
4585
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
 
4586
            cwrapper=`$echo ${output}.exe`
4663
4587
            $rm $cwrappersource $cwrapper
4664
4588
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4665
4589
 
4686
4610
#include <malloc.h>
4687
4611
#include <stdarg.h>
4688
4612
#include <assert.h>
4689
 
#include <sys/stat.h>
4690
4613
 
4691
4614
#if defined(PATH_MAX)
4692
4615
# define LT_PATHMAX PATH_MAX
4697
4620
#endif
4698
4621
 
4699
4622
#ifndef DIR_SEPARATOR
4700
 
# define DIR_SEPARATOR '/'
4701
 
# define PATH_SEPARATOR ':'
 
4623
#define DIR_SEPARATOR '/'
4702
4624
#endif
4703
4625
 
4704
4626
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4705
4627
  defined (__OS2__)
4706
 
# define HAVE_DOS_BASED_FILE_SYSTEM
4707
 
# ifndef DIR_SEPARATOR_2 
4708
 
#  define DIR_SEPARATOR_2 '\\'
4709
 
# endif
4710
 
# ifndef PATH_SEPARATOR_2 
4711
 
#  define PATH_SEPARATOR_2 ';'
4712
 
# endif
 
4628
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4629
#ifndef DIR_SEPARATOR_2
 
4630
#define DIR_SEPARATOR_2 '\\'
 
4631
#endif
4713
4632
#endif
4714
4633
 
4715
4634
#ifndef DIR_SEPARATOR_2
4719
4638
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4720
4639
#endif /* DIR_SEPARATOR_2 */
4721
4640
 
4722
 
#ifndef PATH_SEPARATOR_2
4723
 
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4724
 
#else /* PATH_SEPARATOR_2 */
4725
 
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4726
 
#endif /* PATH_SEPARATOR_2 */
4727
 
 
4728
4641
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4729
4642
#define XFREE(stale) do { \
4730
4643
  if (stale) { free ((void *) stale); stale = 0; } \
4731
4644
} while (0)
4732
4645
 
4733
 
#if defined DEBUGWRAPPER
4734
 
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4735
 
#else
4736
 
# define DEBUG(format, ...) 
4737
 
#endif
4738
 
 
4739
4646
const char *program_name = NULL;
4740
4647
 
4741
4648
void * xmalloc (size_t num);
4742
4649
char * xstrdup (const char *string);
4743
4650
char * basename (const char *name);
4744
 
char * find_executable(const char *wrapper);
4745
 
int    check_executable(const char *path);
 
4651
char * fnqualify(const char *path);
4746
4652
char * strendzap(char *str, const char *pat);
4747
4653
void lt_fatal (const char *message, ...);
4748
4654
 
4753
4659
  int i;
4754
4660
 
4755
4661
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4756
 
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
4757
 
  DEBUG("(main) program_name : %s\n",program_name);
4758
4662
  newargz = XMALLOC(char *, argc+2);
4759
4663
EOF
4760
4664
 
4763
4667
EOF
4764
4668
 
4765
4669
            cat >> $cwrappersource <<"EOF"
4766
 
  newargz[1] = find_executable(argv[0]);
4767
 
  if (newargz[1] == NULL)
4768
 
    lt_fatal("Couldn't find %s", argv[0]);
4769
 
  DEBUG("(main) found exe at : %s\n",newargz[1]);
 
4670
  newargz[1] = fnqualify(argv[0]);
4770
4671
  /* we know the script has the same name, without the .exe */
4771
4672
  /* so make sure newargz[1] doesn't end in .exe */
4772
4673
  strendzap(newargz[1],".exe");
4773
4674
  for (i = 1; i < argc; i++)
4774
4675
    newargz[i+1] = xstrdup(argv[i]);
4775
4676
  newargz[argc+1] = NULL;
4776
 
 
4777
 
  for (i=0; i<argc+1; i++)
4778
 
  {
4779
 
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
4780
 
    ;
4781
 
  }
4782
 
 
4783
4677
EOF
4784
4678
 
4785
4679
            cat >> $cwrappersource <<EOF
4823
4717
  return (char *) base;
4824
4718
}
4825
4719
 
4826
 
int
4827
 
check_executable(const char * path)
4828
 
{
4829
 
  struct stat st;
4830
 
 
4831
 
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
4832
 
  if ((!path) || (!*path))
4833
 
    return 0;
4834
 
 
4835
 
  if ((stat (path, &st) >= 0) &&
4836
 
      (((st.st_mode & S_IXOTH) == S_IXOTH) ||
4837
 
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
4838
 
       ((st.st_mode & S_IXUSR) == S_IXUSR)))
4839
 
    return 1;
4840
 
  else
4841
 
    return 0;
4842
 
}
4843
 
 
4844
 
/* Searches for the full path of the wrapper.  Returns
4845
 
   newly allocated full path name if found, NULL otherwise */
4846
4720
char *
4847
 
find_executable (const char* wrapper)
 
4721
fnqualify(const char *path)
4848
4722
{
4849
 
  int has_slash = 0;
4850
 
  const char* p;
4851
 
  const char* p_next;
4852
 
  struct stat st;
4853
 
  /* static buffer for getcwd */
 
4723
  size_t size;
 
4724
  char *p;
4854
4725
  char tmp[LT_PATHMAX + 1];
4855
 
  int tmp_len;
4856
 
  char* concat_name;
4857
 
 
4858
 
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
4859
 
  
4860
 
  if ((wrapper == NULL) || (*wrapper == '\0'))
4861
 
    return NULL;
4862
 
 
4863
 
  /* Absolute path? */
4864
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4865
 
  if (isalpha (wrapper[0]) && wrapper[1] == ':')
4866
 
  {
4867
 
    concat_name = xstrdup (wrapper);
4868
 
    if (check_executable(concat_name))
4869
 
      return concat_name;
4870
 
    XFREE(concat_name);
4871
 
  }
4872
 
  else
4873
 
  {
4874
 
#endif
4875
 
    if (IS_DIR_SEPARATOR (wrapper[0]))
4876
 
    {
4877
 
      concat_name = xstrdup (wrapper);
4878
 
      if (check_executable(concat_name))
4879
 
        return concat_name;
4880
 
      XFREE(concat_name);
4881
 
    }
4882
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4883
 
}
4884
 
#endif
4885
 
 
4886
 
  for (p = wrapper; *p; p++)
4887
 
    if (*p == '/')
4888
 
    {
4889
 
      has_slash = 1;
4890
 
      break;
4891
 
    }
4892
 
  if (!has_slash)
4893
 
  {
4894
 
    /* no slashes; search PATH */
4895
 
    const char* path = getenv ("PATH");
4896
 
    if (path != NULL)
4897
 
    {
4898
 
      for (p = path; *p; p = p_next)
4899
 
      {
4900
 
        const char* q;
4901
 
        size_t p_len;
4902
 
        for (q = p; *q; q++)
4903
 
          if (IS_PATH_SEPARATOR(*q))
4904
 
            break;
4905
 
        p_len = q - p;
4906
 
        p_next = (*q == '\0' ? q : q + 1);
4907
 
        if (p_len == 0)
4908
 
        {
4909
 
          /* empty path: current directory */
4910
 
          if (getcwd (tmp, LT_PATHMAX) == NULL)
4911
 
            lt_fatal ("getcwd failed");
4912
 
          tmp_len = strlen(tmp);
4913
 
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
4914
 
          memcpy (concat_name, tmp, tmp_len);
4915
 
          concat_name[tmp_len] = '/';
4916
 
          strcpy (concat_name + tmp_len + 1, wrapper);
4917
 
        }
4918
 
        else
4919
 
        {
4920
 
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
4921
 
          memcpy (concat_name, p, p_len);
4922
 
          concat_name[p_len] = '/';
4923
 
          strcpy (concat_name + p_len + 1, wrapper);
4924
 
        }
4925
 
        if (check_executable(concat_name))
4926
 
          return concat_name;
4927
 
        XFREE(concat_name);
4928
 
      }
4929
 
    }
4930
 
    /* not found in PATH; assume curdir */
4931
 
  }
4932
 
  /* Relative path | not found in path: prepend cwd */
 
4726
 
 
4727
  assert(path != NULL);
 
4728
 
 
4729
  /* Is it qualified already? */
 
4730
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4731
  if (isalpha (path[0]) && path[1] == ':')
 
4732
    return xstrdup (path);
 
4733
#endif
 
4734
  if (IS_DIR_SEPARATOR (path[0]))
 
4735
    return xstrdup (path);
 
4736
 
 
4737
  /* prepend the current directory */
 
4738
  /* doesn't handle '~' */
4933
4739
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4934
4740
    lt_fatal ("getcwd failed");
4935
 
  tmp_len = strlen(tmp);
4936
 
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
4937
 
  memcpy (concat_name, tmp, tmp_len);
4938
 
  concat_name[tmp_len] = '/';
4939
 
  strcpy (concat_name + tmp_len + 1, wrapper);
4940
 
 
4941
 
  if (check_executable(concat_name))
4942
 
    return concat_name;
4943
 
  XFREE(concat_name);
4944
 
  return NULL;
 
4741
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4742
  p = XMALLOC(char, size);
 
4743
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4744
  return p;
4945
4745
}
4946
4746
 
4947
4747
char *
5015
4815
 
5016
4816
# The HP-UX ksh and POSIX shell print the target directory to stdout
5017
4817
# if CDPATH is set.
5018
 
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
4818
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
5019
4819
 
5020
4820
relink_command=\"$relink_command\"
5021
4821
 
5192
4992
 
5193
4993
      if test -n "$addlibs"; then
5194
4994
        gentop="$output_objdir/${outputname}x"
 
4995
        $show "${rm}r $gentop"
 
4996
        $run ${rm}r "$gentop"
 
4997
        $show "$mkdir $gentop"
 
4998
        $run $mkdir "$gentop"
 
4999
        status=$?
 
5000
        if test "$status" -ne 0 && test ! -d "$gentop"; then
 
5001
          exit $status
 
5002
        fi
5195
5003
        generated="$generated $gentop"
5196
5004
 
5197
 
        func_extract_archives $gentop $addlibs
5198
 
        oldobjs="$oldobjs $func_extract_archives_result"
 
5005
        # Add in members from convenience archives.
 
5006
        for xlib in $addlibs; do
 
5007
          # Extract the objects.
 
5008
          case $xlib in
 
5009
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
5010
          *) xabs=`pwd`"/$xlib" ;;
 
5011
          esac
 
5012
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
5013
          xdir="$gentop/$xlib"
 
5014
 
 
5015
          $show "${rm}r $xdir"
 
5016
          $run ${rm}r "$xdir"
 
5017
          $show "$mkdir $xdir"
 
5018
          $run $mkdir "$xdir"
 
5019
          status=$?
 
5020
          if test "$status" -ne 0 && test ! -d "$xdir"; then
 
5021
            exit $status
 
5022
          fi
 
5023
          # We will extract separately just the conflicting names and we will no
 
5024
          # longer touch any unique names. It is faster to leave these extract
 
5025
          # automatically by $AR in one run.
 
5026
          $show "(cd $xdir && $AR x $xabs)"
 
5027
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
5028
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
5029
            :
 
5030
          else
 
5031
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
5032
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
5033
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
5034
            do
 
5035
              i=1
 
5036
              while test "$i" -le "$count"
 
5037
              do
 
5038
               # Put our $i before any first dot (extension)
 
5039
               # Never overwrite any file
 
5040
               name_to="$name"
 
5041
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
5042
               do
 
5043
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
5044
               done
 
5045
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
5046
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
5047
               i=`expr $i + 1`
 
5048
              done
 
5049
            done
 
5050
          fi
 
5051
 
 
5052
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
 
5053
        done
5199
5054
      fi
5200
5055
 
5201
5056
      # Do each command in the archive commands.