~ubuntu-branches/ubuntu/edgy/djvulibre/edgy

« back to all changes in this revision

Viewing changes to config/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-07-03 11:38:23 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060703113823-un2te7742kk04c63
Tags: 3.5.17-1ubuntu1
* Sync with Debian
* debian/rules:
  - use dh_iconcache.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ltmain.sh - Provide generalized library-building support services.
2
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
3
#
4
 
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5
5
# Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
17
17
#
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program; if not, write to the Free Software
20
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
21
#
22
22
# As a special exception to the GNU General Public License, if you
23
23
# distribute this file as part of a program that contains a
43
43
 
44
44
PROGRAM=ltmain.sh
45
45
PACKAGE=libtool
46
 
VERSION=1.5.6
47
 
TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $"
 
46
VERSION=1.5.20
 
47
TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
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
49
54
 
50
55
# Check that we have a working $echo.
51
56
if test "X$1" = X--no-reexec; then
83
88
Xsed="${SED}"' -e 1s/^X//'
84
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
85
90
# test EBCDIC or ASCII
86
 
case `echo A|tr A '\301'` in
87
 
 A) # EBCDIC based system
88
 
  SP2NL="tr '\100' '\n'"
89
 
  NL2SP="tr '\r\n' '\100\100'"
 
91
case `echo X|tr X '\101'` in
 
92
 A) # ASCII based system
 
93
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
 
94
  SP2NL='tr \040 \012'
 
95
  NL2SP='tr \015\012 \040\040'
90
96
  ;;
91
 
 *) # Assume ASCII based system
92
 
  SP2NL="tr '\040' '\012'"
93
 
  NL2SP="tr '\015\012' '\040\040'"
 
97
 *) # EBCDIC based system
 
98
  SP2NL='tr \100 \n'
 
99
  NL2SP='tr \r\n \100\100'
94
100
  ;;
95
101
esac
96
102
 
107
113
fi
108
114
 
109
115
# Make sure IFS has a sensible default
110
 
: ${IFS="       
111
 
"}
 
116
lt_nl='
 
117
'
 
118
IFS="   $lt_nl"
112
119
 
113
120
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
114
121
  $echo "$modename: not configured to build any kind of library" 1>&2
138
145
# Need a lot of goo to handle *both* DLLs and import libs
139
146
# Has to be a shell function in order to 'eat' the argument
140
147
# that is supplied when $file_magic_command is called.
141
 
func_win32_libid () {
 
148
func_win32_libid ()
 
149
{
142
150
  win32_libid_type="unknown"
143
151
  win32_fileres=`file -L $1 2>/dev/null`
144
152
  case $win32_fileres in
178
186
# Only attempt this if the compiler in the base compile
179
187
# command doesn't match the default compiler.
180
188
# arg is usually of the form 'gcc ...'
181
 
func_infer_tag () {
 
189
func_infer_tag ()
 
190
{
182
191
    if test -n "$available_tags" && test -z "$tagname"; then
183
192
      CC_quoted=
184
193
      for arg in $CC; do
235
244
      esac
236
245
    fi
237
246
}
 
247
 
 
248
 
 
249
# func_extract_an_archive dir oldlib
 
250
func_extract_an_archive ()
 
251
{
 
252
    f_ex_an_ar_dir="$1"; shift
 
253
    f_ex_an_ar_oldlib="$1"
 
254
 
 
255
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
 
256
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
 
257
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 
258
     :
 
259
    else
 
260
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
 
261
      exit $EXIT_FAILURE
 
262
    fi
 
263
}
 
264
 
 
265
# func_extract_archives gentop oldlib ...
 
266
func_extract_archives ()
 
267
{
 
268
    my_gentop="$1"; shift
 
269
    my_oldlibs=${1+"$@"}
 
270
    my_oldobjs=""
 
271
    my_xlib=""
 
272
    my_xabs=""
 
273
    my_xdir=""
 
274
    my_status=""
 
275
 
 
276
    $show "${rm}r $my_gentop"
 
277
    $run ${rm}r "$my_gentop"
 
278
    $show "$mkdir $my_gentop"
 
279
    $run $mkdir "$my_gentop"
 
280
    my_status=$?
 
281
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
 
282
      exit $my_status
 
283
    fi
 
284
 
 
285
    for my_xlib in $my_oldlibs; do
 
286
      # Extract the objects.
 
287
      case $my_xlib in
 
288
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
289
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
290
      esac
 
291
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
 
292
      my_xdir="$my_gentop/$my_xlib"
 
293
 
 
294
      $show "${rm}r $my_xdir"
 
295
      $run ${rm}r "$my_xdir"
 
296
      $show "$mkdir $my_xdir"
 
297
      $run $mkdir "$my_xdir"
 
298
      status=$?
 
299
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
 
300
        exit $status
 
301
      fi
 
302
      case $host in
 
303
      *-darwin*)
 
304
        $show "Extracting $my_xabs"
 
305
        # Do not bother doing anything if just a dry run
 
306
        if test -z "$run"; then
 
307
          darwin_orig_dir=`pwd`
 
308
          cd $my_xdir || exit $?
 
309
          darwin_archive=$my_xabs
 
310
          darwin_curdir=`pwd`
 
311
          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
 
312
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
 
313
          if test -n "$darwin_arches"; then 
 
314
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
 
315
            darwin_arch=
 
316
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
 
317
            for darwin_arch in  $darwin_arches ; do
 
318
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
319
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
320
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
321
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
322
              cd "$darwin_curdir"
 
323
              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
324
            done # $darwin_arches
 
325
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
 
326
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
 
327
            darwin_file=
 
328
            darwin_files=
 
329
            for darwin_file in $darwin_filelist; do
 
330
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 
331
              lipo -create -output "$darwin_file" $darwin_files
 
332
            done # $darwin_filelist
 
333
            ${rm}r unfat-$$
 
334
            cd "$darwin_orig_dir"
 
335
          else
 
336
            cd "$darwin_orig_dir"
 
337
            func_extract_an_archive "$my_xdir" "$my_xabs"
 
338
          fi # $darwin_arches
 
339
        fi # $run
 
340
        ;;
 
341
      *)
 
342
        func_extract_an_archive "$my_xdir" "$my_xabs"
 
343
        ;;
 
344
      esac
 
345
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
346
    done
 
347
    func_extract_archives_result="$my_oldobjs"
 
348
}
238
349
# End of Shell function definitions
239
350
#####################################
240
351
 
305
416
  --version)
306
417
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
307
418
    $echo
308
 
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
 
419
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
309
420
    $echo "This is free software; see the source for copying conditions.  There is NO"
310
421
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
311
 
    exit $EXIT_SUCCESS
 
422
    exit $?
312
423
    ;;
313
424
 
314
425
  --config)
317
428
    for tagname in $taglist; do
318
429
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
319
430
    done
320
 
    exit $EXIT_SUCCESS
 
431
    exit $?
321
432
    ;;
322
433
 
323
434
  --debug)
342
453
    else
343
454
      $echo "disable static libraries"
344
455
    fi
345
 
    exit $EXIT_SUCCESS
 
456
    exit $?
346
457
    ;;
347
458
 
348
459
  --finish) mode="finish" ;;
399
510
  # Infer the operation mode.
400
511
  if test -z "$mode"; then
401
512
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
402
 
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
 
513
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
403
514
    case $nonopt in
404
515
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
405
516
      mode=link
465
576
 
466
577
    for arg
467
578
    do
468
 
      case "$arg_mode" in
 
579
      case $arg_mode in
469
580
      arg  )
470
581
        # do not "continue".  Instead, add this to base_compile
471
582
        lastarg="$arg"
547
658
      case $lastarg in
548
659
      # Double-quote args containing other shell metacharacters.
549
660
      # Many Bourne shells cannot handle close brackets correctly
550
 
      # in scan sets, so we specify it separately.
 
661
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
 
662
      # in scan sets (worked around with variable expansion),
 
663
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
 
664
      # at all, so we specify them separately.
551
665
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
552
666
        lastarg="\"$lastarg\""
553
667
        ;;
621
735
      esac
622
736
    done
623
737
 
 
738
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
 
739
    case $qlibobj in
 
740
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
741
        qlibobj="\"$qlibobj\"" ;;
 
742
    esac
 
743
    test "X$libobj" != "X$qlibobj" \
 
744
        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
 
745
        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
624
746
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
625
747
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
626
748
    if test "X$xdir" = "X$obj"; then
693
815
        $run $rm $removelist
694
816
        exit $EXIT_FAILURE
695
817
      fi
696
 
      $echo $srcfile > "$lockfile"
 
818
      $echo "$srcfile" > "$lockfile"
697
819
    fi
698
820
 
699
821
    if test -n "$fix_srcfile_path"; then
700
822
      eval srcfile=\"$fix_srcfile_path\"
701
823
    fi
 
824
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
 
825
    case $qsrcfile in
 
826
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
827
      qsrcfile="\"$qsrcfile\"" ;;
 
828
    esac
702
829
 
703
830
    $run $rm "$libobj" "${libobj}T"
704
831
 
720
847
      fbsd_hideous_sh_bug=$base_compile
721
848
 
722
849
      if test "$pic_mode" != no; then
723
 
        command="$base_compile $srcfile $pic_flag"
 
850
        command="$base_compile $qsrcfile $pic_flag"
724
851
      else
725
852
        # Don't build PIC code
726
 
        command="$base_compile $srcfile"
 
853
        command="$base_compile $qsrcfile"
727
854
      fi
728
855
 
729
856
      if test ! -d "${xdir}$objdir"; then
803
930
    if test "$build_old_libs" = yes; then
804
931
      if test "$pic_mode" != yes; then
805
932
        # Don't build PIC code
806
 
        command="$base_compile $srcfile"
 
933
        command="$base_compile $qsrcfile"
807
934
      else
808
 
        command="$base_compile $srcfile $pic_flag"
 
935
        command="$base_compile $qsrcfile $pic_flag"
809
936
      fi
810
937
      if test "$compiler_c_o" = yes; then
811
938
        command="$command -o $obj"
1227
1354
          prev=
1228
1355
          continue
1229
1356
          ;;
 
1357
        darwin_framework)
 
1358
          compiler_flags="$compiler_flags $arg"
 
1359
          compile_command="$compile_command $arg"
 
1360
          finalize_command="$finalize_command $arg"
 
1361
          prev=
 
1362
          continue
 
1363
          ;;
1230
1364
        *)
1231
1365
          eval "$prev=\"\$arg\""
1232
1366
          prev=
1285
1419
        continue
1286
1420
        ;;
1287
1421
 
 
1422
      -framework|-arch)
 
1423
        prev=darwin_framework
 
1424
        compiler_flags="$compiler_flags $arg"
 
1425
        compile_command="$compile_command $arg"
 
1426
        finalize_command="$finalize_command $arg"
 
1427
        continue
 
1428
        ;;
 
1429
 
1288
1430
      -inst-prefix-dir)
1289
1431
        prev=inst_prefix
1290
1432
        continue
1345
1487
            # These systems don't actually have a C library (as such)
1346
1488
            test "X$arg" = "X-lc" && continue
1347
1489
            ;;
1348
 
          *-*-openbsd* | *-*-freebsd*)
 
1490
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1349
1491
            # Do not include libc due to us having libc/libc_r.
1350
1492
            test "X$arg" = "X-lc" && continue
1351
1493
            ;;
1356
1498
          esac
1357
1499
        elif test "X$arg" = "X-lc_r"; then
1358
1500
         case $host in
1359
 
         *-*-openbsd* | *-*-freebsd*)
 
1501
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1360
1502
           # Do not include libc_r directly, use -pthread flag.
1361
1503
           continue
1362
1504
           ;;
1366
1508
        continue
1367
1509
        ;;
1368
1510
 
 
1511
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
1512
      # classes, name mangling, and exception handling.
 
1513
      -model)
 
1514
        compile_command="$compile_command $arg"
 
1515
        compiler_flags="$compiler_flags $arg"
 
1516
        finalize_command="$finalize_command $arg"
 
1517
        prev=xcompiler
 
1518
        continue
 
1519
        ;;
 
1520
 
1369
1521
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1370
 
        deplibs="$deplibs $arg"
 
1522
        compiler_flags="$compiler_flags $arg"
 
1523
        compile_command="$compile_command $arg"
 
1524
        finalize_command="$finalize_command $arg"
1371
1525
        continue
1372
1526
        ;;
1373
1527
 
1376
1530
        continue
1377
1531
        ;;
1378
1532
 
1379
 
      # gcc -m* arguments should be passed to the linker via $compiler_flags
1380
 
      # in order to pass architecture information to the linker
1381
 
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1382
 
      # but this is not reliable with gcc because gcc may use -mfoo to
1383
 
      # select a different linker, different libraries, etc, while
1384
 
      # -Wl,-mfoo simply passes -mfoo to the linker.
1385
 
      -m*)
 
1533
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
 
1534
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
 
1535
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
 
1536
      # +DA*, +DD* enable 64-bit mode on the HP compiler
 
1537
      # -q* pass through compiler args for the IBM compiler
 
1538
      # -m* pass through architecture-specific compiler args for GCC
 
1539
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
 
1540
 
1386
1541
        # Unknown arguments in both finalize_command and compile_command need
1387
1542
        # to be aesthetically quoted because they are evaled later.
1388
1543
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1838
1993
        case $pass in
1839
1994
        dlopen) libs="$dlfiles" ;;
1840
1995
        dlpreopen) libs="$dlprefiles" ;;
1841
 
        link)
1842
 
          libs="$deplibs %DEPLIBS%"
1843
 
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
1844
 
          ;;
 
1996
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1845
1997
        esac
1846
1998
      fi
1847
1999
      if test "$pass" = dlopen; then
1858
2010
            compile_deplibs="$deplib $compile_deplibs"
1859
2011
            finalize_deplibs="$deplib $finalize_deplibs"
1860
2012
          else
1861
 
            deplibs="$deplib $deplibs"
 
2013
            compiler_flags="$compiler_flags $deplib"
1862
2014
          fi
1863
2015
          continue
1864
2016
          ;;
1977
2129
          fi
1978
2130
          case $linkmode in
1979
2131
          lib)
1980
 
            if test "$deplibs_check_method" != pass_all; then
 
2132
            valid_a_lib=no
 
2133
            case $deplibs_check_method in
 
2134
              match_pattern*)
 
2135
                set dummy $deplibs_check_method
 
2136
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2137
                if eval $echo \"$deplib\" 2>/dev/null \
 
2138
                    | $SED 10q \
 
2139
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2140
                  valid_a_lib=yes
 
2141
                fi
 
2142
                ;;
 
2143
              pass_all)
 
2144
                valid_a_lib=yes
 
2145
                ;;
 
2146
            esac
 
2147
            if test "$valid_a_lib" != yes; then
1981
2148
              $echo
1982
2149
              $echo "*** Warning: Trying to link with static lib archive $deplib."
1983
2150
              $echo "*** I have the capability to make that library automatically link in when"
2051
2218
        # it will not redefine variables installed, or shouldnotlink
2052
2219
        installed=yes
2053
2220
        shouldnotlink=no
 
2221
        avoidtemprpath=
 
2222
 
2054
2223
 
2055
2224
        # Read the .la file
2056
2225
        case $lib in
2149
2318
            dir="$libdir"
2150
2319
            absdir="$libdir"
2151
2320
          fi
 
2321
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2152
2322
        else
2153
 
          dir="$ladir/$objdir"
2154
 
          absdir="$abs_ladir/$objdir"
2155
 
          # Remove this search path later
2156
 
          notinst_path="$notinst_path $abs_ladir"
 
2323
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2324
            dir="$ladir"
 
2325
            absdir="$abs_ladir"
 
2326
            # Remove this search path later
 
2327
            notinst_path="$notinst_path $abs_ladir"
 
2328
          else
 
2329
            dir="$ladir/$objdir"
 
2330
            absdir="$abs_ladir/$objdir"
 
2331
            # Remove this search path later
 
2332
            notinst_path="$notinst_path $abs_ladir"
 
2333
          fi
2157
2334
        fi # $installed = yes
2158
2335
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2159
2336
 
2226
2403
          if test -n "$library_names" &&
2227
2404
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2228
2405
            # We need to hardcode the library path
2229
 
            if test -n "$shlibpath_var"; then
 
2406
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2230
2407
              # Make sure the rpath contains only unique directories.
2231
2408
              case "$temp_rpath " in
2232
2409
              *" $dir "*) ;;
2233
2410
              *" $absdir "*) ;;
2234
 
              *) temp_rpath="$temp_rpath $dir" ;;
 
2411
              *) temp_rpath="$temp_rpath $absdir" ;;
2235
2412
              esac
2236
2413
            fi
2237
2414
 
2417
2594
                add_dir="-L$dir"
2418
2595
                # Try looking first in the location we're being installed to.
2419
2596
                if test -n "$inst_prefix_dir"; then
2420
 
                  case "$libdir" in
 
2597
                  case $libdir in
2421
2598
                    [\\/]*)
2422
2599
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2423
2600
                      ;;
2490
2667
              add_dir="-L$libdir"
2491
2668
              # Try looking first in the location we're being installed to.
2492
2669
              if test -n "$inst_prefix_dir"; then
2493
 
                case "$libdir" in
 
2670
                case $libdir in
2494
2671
                  [\\/]*)
2495
2672
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2496
2673
                    ;;
2551
2728
              fi
2552
2729
            fi
2553
2730
          else
2554
 
            convenience="$convenience $dir/$old_library"
2555
 
            old_convenience="$old_convenience $dir/$old_library"
2556
2731
            deplibs="$dir/$old_library $deplibs"
2557
2732
            link_static=yes
2558
2733
          fi
2670
2845
              *) continue ;;
2671
2846
              esac
2672
2847
              case " $deplibs " in
 
2848
              *" $path "*) ;;
 
2849
              *) deplibs="$path $deplibs" ;;
 
2850
              esac
 
2851
              case " $deplibs " in
2673
2852
              *" $depdepl "*) ;;
2674
2853
              *) deplibs="$depdepl $deplibs" ;;
2675
2854
              esac
2676
 
              case " $deplibs " in
2677
 
              *" $path "*) ;;
2678
 
              *) deplibs="$deplibs $path" ;;
2679
 
              esac
2680
2855
            done
2681
2856
          fi # link_all_deplibs != no
2682
2857
        fi # linkmode = lib
2929
3104
            age="$number_minor"
2930
3105
            revision="$number_minor"
2931
3106
            ;;
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
 
            ;;
2937
3107
          esac
2938
3108
          ;;
2939
3109
        no)
2947
3117
        case $current in
2948
3118
        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]) ;;
2949
3119
        *)
2950
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3120
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2951
3121
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2952
3122
          exit $EXIT_FAILURE
2953
3123
          ;;
2956
3126
        case $revision in
2957
3127
        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]) ;;
2958
3128
        *)
2959
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3129
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2960
3130
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2961
3131
          exit $EXIT_FAILURE
2962
3132
          ;;
2965
3135
        case $age in
2966
3136
        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]) ;;
2967
3137
        *)
2968
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3138
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2969
3139
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2970
3140
          exit $EXIT_FAILURE
2971
3141
          ;;
2991
3161
          versuffix="$major.$age.$revision"
2992
3162
          # Darwin ld doesn't like 0 for these options...
2993
3163
          minor_current=`expr $current + 1`
2994
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3164
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2995
3165
          ;;
2996
3166
 
2997
3167
        freebsd-aout)
3197
3367
          *-*-netbsd*)
3198
3368
            # Don't link with libc until the a.out ld.so is fixed.
3199
3369
            ;;
3200
 
          *-*-openbsd* | *-*-freebsd*)
 
3370
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3201
3371
            # Do not include libc due to us having libc/libc_r.
3202
3372
            test "X$arg" = "X-lc" && continue
3203
3373
            ;;
3247
3417
          if test "$?" -eq 0 ; then
3248
3418
            ldd_output=`ldd conftest`
3249
3419
            for i in $deplibs; do
3250
 
              name="`expr $i : '-l\(.*\)'`"
 
3420
              name=`expr $i : '-l\(.*\)'`
3251
3421
              # If $name is empty we are operating on a -L argument.
3252
3422
              if test "$name" != "" && test "$name" -ne "0"; then
3253
3423
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3284
3454
            # Error occurred in the first compile.  Let's try to salvage
3285
3455
            # the situation: Compile a separate program for each library.
3286
3456
            for i in $deplibs; do
3287
 
              name="`expr $i : '-l\(.*\)'`"
 
3457
              name=`expr $i : '-l\(.*\)'`
3288
3458
              # If $name is empty we are operating on a -L argument.
3289
3459
              if test "$name" != "" && test "$name" != "0"; then
3290
3460
                $rm conftest
3336
3506
          set dummy $deplibs_check_method
3337
3507
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3338
3508
          for a_deplib in $deplibs; do
3339
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3509
            name=`expr $a_deplib : '-l\(.*\)'`
3340
3510
            # If $name is empty we are operating on a -L argument.
3341
3511
            if test "$name" != "" && test  "$name" != "0"; then
3342
3512
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3405
3575
          set dummy $deplibs_check_method
3406
3576
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3407
3577
          for a_deplib in $deplibs; do
3408
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3578
            name=`expr $a_deplib : '-l\(.*\)'`
3409
3579
            # If $name is empty we are operating on a -L argument.
3410
3580
            if test -n "$name" && test "$name" != "0"; then
3411
3581
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3646
3816
                # The command line is too long to execute in one step.
3647
3817
                $show "using reloadable object file for export list..."
3648
3818
                skipped_export=:
 
3819
                # Break out early, otherwise skipped_export may be
 
3820
                # set to false by a later but shorter cmd.
 
3821
                break
3649
3822
              fi
3650
3823
            done
3651
3824
            IFS="$save_ifs"
3679
3852
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3680
3853
          else
3681
3854
            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
3690
3855
            generated="$generated $gentop"
3691
3856
 
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
 
3857
            func_extract_archives $gentop $convenience
 
3858
            libobjs="$libobjs $func_extract_archives_result"
3740
3859
          fi
3741
3860
        fi
3742
 
 
 
3861
        
3743
3862
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3744
3863
          eval flag=\"$thread_safe_flag_spec\"
3745
3864
          linker_flags="$linker_flags $flag"
3769
3888
          fi
3770
3889
        fi
3771
3890
 
3772
 
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
3891
        if test "X$skipped_export" != "X:" &&
 
3892
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3773
3893
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3774
3894
          :
3775
3895
        else
3788
3908
            save_libobjs=$libobjs
3789
3909
          fi
3790
3910
          save_output=$output
 
3911
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
3791
3912
 
3792
3913
          # Clear the reloadable object creation command queue and
3793
3914
          # initialize k to one.
3797
3918
          delfiles=
3798
3919
          last_robj=
3799
3920
          k=1
3800
 
          output=$output_objdir/$save_output-${k}.$objext
 
3921
          output=$output_objdir/$output_la-${k}.$objext
3801
3922
          # Loop over the list of objects to be linked.
3802
3923
          for obj in $save_libobjs
3803
3924
          do
3804
3925
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3805
3926
            if test "X$objlist" = X ||
3806
 
               { len=`expr "X$test_cmds" : ".*"` &&
 
3927
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3807
3928
                 test "$len" -le "$max_cmd_len"; }; then
3808
3929
              objlist="$objlist $obj"
3809
3930
            else
3817
3938
                # the last one created.
3818
3939
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3819
3940
              fi
3820
 
              last_robj=$output_objdir/$save_output-${k}.$objext
 
3941
              last_robj=$output_objdir/$output_la-${k}.$objext
3821
3942
              k=`expr $k + 1`
3822
 
              output=$output_objdir/$save_output-${k}.$objext
 
3943
              output=$output_objdir/$output_la-${k}.$objext
3823
3944
              objlist=$obj
3824
3945
              len=1
3825
3946
            fi
3839
3960
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3840
3961
          fi
3841
3962
 
3842
 
          # Set up a command to remove the reloadale object files
 
3963
          # Set up a command to remove the reloadable object files
3843
3964
          # after they are used.
3844
3965
          i=0
3845
3966
          while test "$i" -lt "$k"
3846
3967
          do
3847
3968
            i=`expr $i + 1`
3848
 
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
3969
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3849
3970
          done
3850
3971
 
3851
3972
          $echo "creating a temporary reloadable object file: $output"
3893
4014
          IFS="$save_ifs"
3894
4015
          eval cmd=\"$cmd\"
3895
4016
          $show "$cmd"
3896
 
          $run eval "$cmd" || exit $?
 
4017
          $run eval "$cmd" || {
 
4018
            lt_exit=$?
 
4019
 
 
4020
            # Restore the uninstalled library and exit
 
4021
            if test "$mode" = relink; then
 
4022
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4023
            fi
 
4024
 
 
4025
            exit $lt_exit
 
4026
          }
3897
4027
        done
3898
4028
        IFS="$save_ifs"
3899
4029
 
3900
4030
        # Restore the uninstalled library and exit
3901
4031
        if test "$mode" = relink; then
3902
4032
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
 
4033
 
 
4034
          if test -n "$convenience"; then
 
4035
            if test -z "$whole_archive_flag_spec"; then
 
4036
              $show "${rm}r $gentop"
 
4037
              $run ${rm}r "$gentop"
 
4038
            fi
 
4039
          fi
 
4040
 
3903
4041
          exit $EXIT_SUCCESS
3904
4042
        fi
3905
4043
 
3977
4115
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3978
4116
        else
3979
4117
          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
3988
4118
          generated="$generated $gentop"
3989
4119
 
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
 
4120
          func_extract_archives $gentop $convenience
 
4121
          reload_conv_objs="$reload_objs $func_extract_archives_result"
4038
4122
        fi
4039
4123
      fi
4040
4124
 
4296
4380
 
4297
4381
            # Prepare the list of exported symbols
4298
4382
            if test -z "$export_symbols"; then
4299
 
              export_symbols="$output_objdir/$output.exp"
 
4383
              export_symbols="$output_objdir/$outputname.exp"
4300
4384
              $run $rm $export_symbols
4301
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4385
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4386
              case $host in
 
4387
              *cygwin* | *mingw* )
 
4388
                $run eval "${SED} -e '1iEXPORTS'"' < "$export_symbols" > "$output_objdir/$outputname.def"'
 
4389
                ;;
 
4390
              esac
4302
4391
            else
4303
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4304
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4392
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4393
              case $host in
 
4394
              *cygwin* | *mingw* )
 
4395
                $run eval "${SED} -e '1iEXPORTS'"' < "$output_objdir/$outputname.exp" > "$output_objdir/$outputname.def"'
 
4396
                ;;
 
4397
              esac
 
4398
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4305
4399
              $run eval 'mv "$nlist"T "$nlist"'
4306
4400
            fi
4307
4401
          fi
4353
4447
#endif
4354
4448
 
4355
4449
/* The mapping between symbol names and symbols. */
 
4450
"
 
4451
 
 
4452
            case $host in
 
4453
            *cygwin* | *mingw* )
 
4454
          $echo >> "$output_objdir/$dlsyms" "\
 
4455
/* DATA imports from DLLs on WIN32 can't be const, because
 
4456
   runtime relocations are performed -- see ld's documentation
 
4457
   on pseudo-relocs */
 
4458
struct {
 
4459
"
 
4460
              ;;
 
4461
            * )
 
4462
          $echo >> "$output_objdir/$dlsyms" "\
4356
4463
const struct {
 
4464
"
 
4465
              ;;
 
4466
            esac
 
4467
 
 
4468
 
 
4469
          $echo >> "$output_objdir/$dlsyms" "\
4357
4470
  const char *name;
4358
4471
  lt_ptr address;
4359
4472
}
4404
4517
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4405
4518
 
4406
4519
          # Clean up the generated files.
4407
 
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4408
 
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
 
4520
          #$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
 
4521
          #$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4409
4522
 
4410
4523
          # Transform the symbol file into the correct name.
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}%"`
 
4524
          case $host in
 
4525
          *cygwin* | *mingw* )
 
4526
            if test -f "$output_objdir/${outputname}.def" ; then
 
4527
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4528
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4529
            else
 
4530
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4531
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4532
             fi
 
4533
            ;;
 
4534
          * )
 
4535
            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4536
            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4537
            ;;
 
4538
          esac
4413
4539
          ;;
4414
4540
        *)
4415
4541
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4438
4564
 
4439
4565
        # Delete the generated files.
4440
4566
        if test -n "$dlsyms"; then
4441
 
          $show "$rm $output_objdir/${outputname}S.${objext}"
4442
 
          $run $rm "$output_objdir/${outputname}S.${objext}"
 
4567
          #$show "$rm $output_objdir/${outputname}S.${objext}"
 
4568
          #$run $rm "$output_objdir/${outputname}S.${objext}"
 
4569
          :
4443
4570
        fi
4444
4571
 
4445
4572
        exit $status
4582
4709
        esac
4583
4710
        case $host in
4584
4711
          *cygwin* | *mingw* )
4585
 
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4586
 
            cwrapper=`$echo ${output}.exe`
4587
 
            $rm $cwrappersource $cwrapper
4588
 
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4712
            output_name=`basename $output`
 
4713
            output_path=`dirname $output`
 
4714
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4715
            cwrapper="$output_path/$output_name.exe"
 
4716
            $rm $cwrappersource $cwrapper
 
4717
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4589
4718
 
4590
4719
            cat > $cwrappersource <<EOF
4591
4720
 
4610
4739
#include <malloc.h>
4611
4740
#include <stdarg.h>
4612
4741
#include <assert.h>
 
4742
#include <string.h>
 
4743
#include <ctype.h>
 
4744
#include <sys/stat.h>
4613
4745
 
4614
4746
#if defined(PATH_MAX)
4615
4747
# define LT_PATHMAX PATH_MAX
4620
4752
#endif
4621
4753
 
4622
4754
#ifndef DIR_SEPARATOR
4623
 
#define DIR_SEPARATOR '/'
 
4755
# define DIR_SEPARATOR '/'
 
4756
# define PATH_SEPARATOR ':'
4624
4757
#endif
4625
4758
 
4626
4759
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4627
4760
  defined (__OS2__)
4628
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4629
 
#ifndef DIR_SEPARATOR_2
4630
 
#define DIR_SEPARATOR_2 '\\'
4631
 
#endif
 
4761
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4762
# ifndef DIR_SEPARATOR_2
 
4763
#  define DIR_SEPARATOR_2 '\\'
 
4764
# endif
 
4765
# ifndef PATH_SEPARATOR_2
 
4766
#  define PATH_SEPARATOR_2 ';'
 
4767
# endif
4632
4768
#endif
4633
4769
 
4634
4770
#ifndef DIR_SEPARATOR_2
4638
4774
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4639
4775
#endif /* DIR_SEPARATOR_2 */
4640
4776
 
 
4777
#ifndef PATH_SEPARATOR_2
 
4778
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4779
#else /* PATH_SEPARATOR_2 */
 
4780
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4781
#endif /* PATH_SEPARATOR_2 */
 
4782
 
4641
4783
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4642
4784
#define XFREE(stale) do { \
4643
4785
  if (stale) { free ((void *) stale); stale = 0; } \
4644
4786
} while (0)
4645
4787
 
 
4788
/* -DDEBUG is fairly common in CFLAGS.  */
 
4789
#undef DEBUG
 
4790
#if defined DEBUGWRAPPER
 
4791
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
4792
#else
 
4793
# define DEBUG(format, ...)
 
4794
#endif
 
4795
 
4646
4796
const char *program_name = NULL;
4647
4797
 
4648
4798
void * xmalloc (size_t num);
4649
4799
char * xstrdup (const char *string);
4650
 
char * basename (const char *name);
4651
 
char * fnqualify(const char *path);
 
4800
const char * base_name (const char *name);
 
4801
char * find_executable(const char *wrapper);
 
4802
int    check_executable(const char *path);
4652
4803
char * strendzap(char *str, const char *pat);
4653
4804
void lt_fatal (const char *message, ...);
4654
4805
 
4658
4809
  char **newargz;
4659
4810
  int i;
4660
4811
 
4661
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4812
  program_name = (char *) xstrdup (base_name (argv[0]));
 
4813
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
4814
  DEBUG("(main) program_name : %s\n",program_name);
4662
4815
  newargz = XMALLOC(char *, argc+2);
4663
4816
EOF
4664
4817
 
4665
 
            cat >> $cwrappersource <<EOF
4666
 
  newargz[0] = "$SHELL";
 
4818
            cat >> $cwrappersource <<EOF
 
4819
  newargz[0] = (char *) xstrdup("$SHELL");
4667
4820
EOF
4668
4821
 
4669
 
            cat >> $cwrappersource <<"EOF"
4670
 
  newargz[1] = fnqualify(argv[0]);
 
4822
            cat >> $cwrappersource <<"EOF"
 
4823
  newargz[1] = find_executable(argv[0]);
 
4824
  if (newargz[1] == NULL)
 
4825
    lt_fatal("Couldn't find %s", argv[0]);
 
4826
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4671
4827
  /* we know the script has the same name, without the .exe */
4672
4828
  /* so make sure newargz[1] doesn't end in .exe */
4673
4829
  strendzap(newargz[1],".exe");
4674
4830
  for (i = 1; i < argc; i++)
4675
4831
    newargz[i+1] = xstrdup(argv[i]);
4676
4832
  newargz[argc+1] = NULL;
4677
 
EOF
4678
 
 
4679
 
            cat >> $cwrappersource <<EOF
 
4833
 
 
4834
  for (i=0; i<argc+1; i++)
 
4835
  {
 
4836
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
4837
    ;
 
4838
  }
 
4839
 
 
4840
EOF
 
4841
 
 
4842
            case $host_os in
 
4843
              mingw*)
 
4844
                cat >> $cwrappersource <<EOF
 
4845
  execv("$SHELL",(char const **)newargz);
 
4846
EOF
 
4847
              ;;
 
4848
              *)
 
4849
                cat >> $cwrappersource <<EOF
4680
4850
  execv("$SHELL",newargz);
4681
4851
EOF
 
4852
              ;;
 
4853
            esac
4682
4854
 
4683
 
            cat >> $cwrappersource <<"EOF"
 
4855
            cat >> $cwrappersource <<"EOF"
 
4856
  return 127;
4684
4857
}
4685
4858
 
4686
4859
void *
4700
4873
;
4701
4874
}
4702
4875
 
4703
 
char *
4704
 
basename (const char *name)
 
4876
const char *
 
4877
base_name (const char *name)
4705
4878
{
4706
4879
  const char *base;
4707
4880
 
4708
4881
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4709
4882
  /* Skip over the disk name in MSDOS pathnames. */
4710
 
  if (isalpha (name[0]) && name[1] == ':')
 
4883
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4711
4884
    name += 2;
4712
4885
#endif
4713
4886
 
4714
4887
  for (base = name; *name; name++)
4715
4888
    if (IS_DIR_SEPARATOR (*name))
4716
4889
      base = name + 1;
4717
 
  return (char *) base;
4718
 
}
4719
 
 
 
4890
  return base;
 
4891
}
 
4892
 
 
4893
int
 
4894
check_executable(const char * path)
 
4895
{
 
4896
  struct stat st;
 
4897
 
 
4898
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"
 
4899
);
 
4900
  if ((!path) || (!*path))
 
4901
    return 0;
 
4902
 
 
4903
  if ((stat (path, &st) >= 0) &&
 
4904
      (
 
4905
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
4906
#if defined (S_IXOTH)
 
4907
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
4908
#endif
 
4909
#if defined (S_IXGRP)
 
4910
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
4911
#endif
 
4912
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
4913
      )
 
4914
    return 1;
 
4915
  else
 
4916
    return 0;
 
4917
}
 
4918
 
 
4919
/* Searches for the full path of the wrapper.  Returns
 
4920
   newly allocated full path name if found, NULL otherwise */
4720
4921
char *
4721
 
fnqualify(const char *path)
 
4922
find_executable (const char* wrapper)
4722
4923
{
4723
 
  size_t size;
4724
 
  char *p;
 
4924
  int has_slash = 0;
 
4925
  const char* p;
 
4926
  const char* p_next;
 
4927
  /* static buffer for getcwd */
4725
4928
  char tmp[LT_PATHMAX + 1];
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 '~' */
 
4929
  int tmp_len;
 
4930
  char* concat_name;
 
4931
 
 
4932
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") :
 
4933
 "NULL!");
 
4934
 
 
4935
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
4936
    return NULL;
 
4937
 
 
4938
  /* Absolute path? */
 
4939
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4940
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
4941
  {
 
4942
    concat_name = xstrdup (wrapper);
 
4943
    if (check_executable(concat_name))
 
4944
      return concat_name;
 
4945
    XFREE(concat_name);
 
4946
  }
 
4947
  else
 
4948
  {
 
4949
#endif
 
4950
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
4951
    {
 
4952
      concat_name = xstrdup (wrapper);
 
4953
      if (check_executable(concat_name))
 
4954
        return concat_name;
 
4955
      XFREE(concat_name);
 
4956
    }
 
4957
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4958
  }
 
4959
#endif
 
4960
 
 
4961
  for (p = wrapper; *p; p++)
 
4962
    if (*p == '/')
 
4963
    {
 
4964
      has_slash = 1;
 
4965
      break;
 
4966
    }
 
4967
  if (!has_slash)
 
4968
  {
 
4969
    /* no slashes; search PATH */
 
4970
    const char* path = getenv ("PATH");
 
4971
    if (path != NULL)
 
4972
    {
 
4973
      for (p = path; *p; p = p_next)
 
4974
      {
 
4975
        const char* q;
 
4976
        size_t p_len;
 
4977
        for (q = p; *q; q++)
 
4978
          if (IS_PATH_SEPARATOR(*q))
 
4979
            break;
 
4980
        p_len = q - p;
 
4981
        p_next = (*q == '\0' ? q : q + 1);
 
4982
        if (p_len == 0)
 
4983
        {
 
4984
          /* empty path: current directory */
 
4985
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4986
            lt_fatal ("getcwd failed");
 
4987
          tmp_len = strlen(tmp);
 
4988
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
4989
          memcpy (concat_name, tmp, tmp_len);
 
4990
          concat_name[tmp_len] = '/';
 
4991
          strcpy (concat_name + tmp_len + 1, wrapper);
 
4992
        }
 
4993
        else
 
4994
        {
 
4995
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
4996
          memcpy (concat_name, p, p_len);
 
4997
          concat_name[p_len] = '/';
 
4998
          strcpy (concat_name + p_len + 1, wrapper);
 
4999
        }
 
5000
        if (check_executable(concat_name))
 
5001
          return concat_name;
 
5002
        XFREE(concat_name);
 
5003
      }
 
5004
    }
 
5005
    /* not found in PATH; assume curdir */
 
5006
  }
 
5007
  /* Relative path | not found in path: prepend cwd */
4739
5008
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4740
5009
    lt_fatal ("getcwd failed");
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;
 
5010
  tmp_len = strlen(tmp);
 
5011
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5012
  memcpy (concat_name, tmp, tmp_len);
 
5013
  concat_name[tmp_len] = '/';
 
5014
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5015
 
 
5016
  if (check_executable(concat_name))
 
5017
    return concat_name;
 
5018
  XFREE(concat_name);
 
5019
  return NULL;
4745
5020
}
4746
5021
 
4747
5022
char *
4785
5060
  va_end (ap);
4786
5061
}
4787
5062
EOF
4788
 
          # we should really use a build-platform specific compiler
4789
 
          # here, but OTOH, the wrappers (shell script and this C one)
4790
 
          # are only useful if you want to execute the "real" binary.
4791
 
          # Since the "real" binary is built for $host, then this
4792
 
          # wrapper might as well be built for $host, too.
4793
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4794
 
          ;;
4795
 
        esac
4796
 
        $rm $output
4797
 
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
 
5063
          # we should really use a build-platform specific compiler
 
5064
          # here, but OTOH, the wrappers (shell script and this C one)
 
5065
          # are only useful if you want to execute the "real" binary.
 
5066
          # Since the "real" binary is built for $host, then this
 
5067
          # wrapper might as well be built for $host, too.
 
5068
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5069
          ;;
 
5070
        esac
 
5071
        $rm $output
 
5072
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4798
5073
 
4799
5074
        $echo > $output "\
4800
5075
#! $SHELL
4815
5090
 
4816
5091
# The HP-UX ksh and POSIX shell print the target directory to stdout
4817
5092
# if CDPATH is set.
4818
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
5093
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4819
5094
 
4820
5095
relink_command=\"$relink_command\"
4821
5096
 
4944
5219
        # Backslashes separate directories on plain windows
4945
5220
        *-*-mingw | *-*-os2*)
4946
5221
          $echo >> $output "\
4947
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5222
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4948
5223
"
4949
5224
          ;;
4950
5225
 
4951
5226
        *)
4952
5227
          $echo >> $output "\
4953
 
      exec \$progdir/\$program \${1+\"\$@\"}
 
5228
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
4954
5229
"
4955
5230
          ;;
4956
5231
        esac
4960
5235
    fi
4961
5236
  else
4962
5237
    # The program doesn't exist.
4963
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5238
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4964
5239
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4965
5240
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4966
5241
    exit $EXIT_FAILURE
4992
5267
 
4993
5268
      if test -n "$addlibs"; then
4994
5269
        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
5003
5270
        generated="$generated $gentop"
5004
5271
 
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
 
5272
        func_extract_archives $gentop $addlibs
 
5273
        oldobjs="$oldobjs $func_extract_archives_result"
5054
5274
      fi
5055
5275
 
5056
5276
      # Do each command in the archive commands.
5057
5277
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5058
5278
       cmds=$old_archive_from_new_cmds
5059
5279
      else
 
5280
        # POSIX demands no paths to be encoded in archives.  We have
 
5281
        # to avoid creating archives with duplicate basenames if we
 
5282
        # might have to extract them afterwards, e.g., when creating a
 
5283
        # static archive out of a convenience library, or when linking
 
5284
        # the entirety of a libtool archive into another (currently
 
5285
        # not supported by libtool).
 
5286
        if (for obj in $oldobjs
 
5287
            do
 
5288
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5289
            done | sort | sort -uc >/dev/null 2>&1); then
 
5290
          :
 
5291
        else
 
5292
          $echo "copying selected object files to avoid basename conflicts..."
 
5293
 
 
5294
          if test -z "$gentop"; then
 
5295
            gentop="$output_objdir/${outputname}x"
 
5296
            generated="$generated $gentop"
 
5297
 
 
5298
            $show "${rm}r $gentop"
 
5299
            $run ${rm}r "$gentop"
 
5300
            $show "$mkdir $gentop"
 
5301
            $run $mkdir "$gentop"
 
5302
            status=$?
 
5303
            if test "$status" -ne 0 && test ! -d "$gentop"; then
 
5304
              exit $status
 
5305
            fi
 
5306
          fi
 
5307
 
 
5308
          save_oldobjs=$oldobjs
 
5309
          oldobjs=
 
5310
          counter=1
 
5311
          for obj in $save_oldobjs
 
5312
          do
 
5313
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5314
            case " $oldobjs " in
 
5315
            " ") oldobjs=$obj ;;
 
5316
            *[\ /]"$objbase "*)
 
5317
              while :; do
 
5318
                # Make sure we don't pick an alternate name that also
 
5319
                # overlaps.
 
5320
                newobj=lt$counter-$objbase
 
5321
                counter=`expr $counter + 1`
 
5322
                case " $oldobjs " in
 
5323
                *[\ /]"$newobj "*) ;;
 
5324
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5325
                esac
 
5326
              done
 
5327
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5328
              $run ln "$obj" "$gentop/$newobj" ||
 
5329
              $run cp "$obj" "$gentop/$newobj"
 
5330
              oldobjs="$oldobjs $gentop/$newobj"
 
5331
              ;;
 
5332
            *) oldobjs="$oldobjs $obj" ;;
 
5333
            esac
 
5334
          done
 
5335
        fi
 
5336
 
5060
5337
        eval cmds=\"$old_archive_cmds\"
5061
5338
 
5062
5339
        if len=`expr "X$cmds" : ".*"` &&
5070
5347
          objlist=
5071
5348
          concat_cmds=
5072
5349
          save_oldobjs=$oldobjs
5073
 
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5074
 
          # encoded into archives.  This makes 'ar r' malfunction in
5075
 
          # this piecewise linking case whenever conflicting object
5076
 
          # names appear in distinct ar calls; check, warn and compensate.
5077
 
            if (for obj in $save_oldobjs
5078
 
            do
5079
 
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
5080
 
            done | sort | sort -uc >/dev/null 2>&1); then
5081
 
            :
5082
 
          else
5083
 
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5084
 
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5085
 
            AR_FLAGS=cq
5086
 
          fi
 
5350
 
5087
5351
          # Is there a better way of finding the last object in the list?
5088
5352
          for obj in $save_oldobjs
5089
5353
          do
5094
5358
            oldobjs="$objlist $obj"
5095
5359
            objlist="$objlist $obj"
5096
5360
            eval test_cmds=\"$old_archive_cmds\"
5097
 
            if len=`expr "X$test_cmds" : ".*"` &&
 
5361
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5098
5362
               test "$len" -le "$max_cmd_len"; then
5099
5363
              :
5100
5364
            else
5291
5555
    # install_prog (especially on Windows NT).
5292
5556
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5293
5557
       # Allow the use of GNU shtool's install command.
5294
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5558
       $echo "X$nonopt" | grep shtool > /dev/null; then
5295
5559
      # Aesthetically quote it.
5296
5560
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5297
5561
      case $arg in
5298
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5562
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5299
5563
        arg="\"$arg\""
5300
5564
        ;;
5301
5565
      esac
5304
5568
      shift
5305
5569
    else
5306
5570
      install_prog=
5307
 
      arg="$nonopt"
 
5571
      arg=$nonopt
5308
5572
    fi
5309
5573
 
5310
5574
    # The real first argument should be the name of the installation program.
5311
5575
    # Aesthetically quote it.
5312
5576
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5313
5577
    case $arg in
5314
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5578
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5315
5579
      arg="\"$arg\""
5316
5580
      ;;
5317
5581
    esac
5329
5593
    do
5330
5594
      if test -n "$dest"; then
5331
5595
        files="$files $dest"
5332
 
        dest="$arg"
 
5596
        dest=$arg
5333
5597
        continue
5334
5598
      fi
5335
5599
 
5336
5600
      case $arg in
5337
5601
      -d) isdir=yes ;;
5338
 
      -f) prev="-f" ;;
5339
 
      -g) prev="-g" ;;
5340
 
      -m) prev="-m" ;;
5341
 
      -o) prev="-o" ;;
 
5602
      -f) 
 
5603
        case " $install_prog " in
 
5604
        *[\\\ /]cp\ *) ;;
 
5605
        *) prev=$arg ;;
 
5606
        esac
 
5607
        ;;
 
5608
      -g | -m | -o) prev=$arg ;;
5342
5609
      -s)
5343
5610
        stripme=" -s"
5344
5611
        continue
5345
5612
        ;;
5346
 
      -*) ;;
5347
 
 
 
5613
      -*)
 
5614
        ;;
5348
5615
      *)
5349
5616
        # If the previous option needed an argument, then skip it.
5350
5617
        if test -n "$prev"; then
5351
5618
          prev=
5352
5619
        else
5353
 
          dest="$arg"
 
5620
          dest=$arg
5354
5621
          continue
5355
5622
        fi
5356
5623
        ;;
5359
5626
      # Aesthetically quote the argument.
5360
5627
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5361
5628
      case $arg in
5362
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5629
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5363
5630
        arg="\"$arg\""
5364
5631
        ;;
5365
5632
      esac
5528
5795
 
5529
5796
          if test "$#" -gt 0; then
5530
5797
            # Delete the old symlinks, and create new ones.
 
5798
            # Try `ln -sf' first, because the `ln' binary might depend on
 
5799
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
5800
            # so we also need to try rm && ln -s.
5531
5801
            for linkname
5532
5802
            do
5533
5803
              if test "$linkname" != "$realname"; then
5534
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5535
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
5804
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
5805
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5536
5806
              fi
5537
5807
            done
5538
5808
          fi
5545
5815
            IFS="$save_ifs"
5546
5816
            eval cmd=\"$cmd\"
5547
5817
            $show "$cmd"
5548
 
            $run eval "$cmd" || exit $?
 
5818
            $run eval "$cmd" || {
 
5819
              lt_exit=$?
 
5820
 
 
5821
              # Restore the uninstalled library and exit
 
5822
              if test "$mode" = relink; then
 
5823
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
5824
              fi
 
5825
 
 
5826
              exit $lt_exit
 
5827
            }
5549
5828
          done
5550
5829
          IFS="$save_ifs"
5551
5830
        fi
5639
5918
          notinst_deplibs=
5640
5919
          relink_command=
5641
5920
 
5642
 
          # To insure that "foo" is sourced, and not "foo.exe",
5643
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5644
 
          # which disallows the automatic-append-.exe behavior.
5645
 
          case $build in
5646
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5647
 
          *) wrapperdot=${wrapper} ;;
5648
 
          esac
 
5921
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
5922
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
5923
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
5924
          # `FILE.' does not work on cygwin managed mounts.
 
5925
          #
5649
5926
          # If there is no directory component, then add one.
5650
 
          case $file in
5651
 
          */* | *\\*) . ${wrapperdot} ;;
5652
 
          *) . ./${wrapperdot} ;;
 
5927
          case $wrapper in
 
5928
          */* | *\\*) . ${wrapper} ;;
 
5929
          *) . ./${wrapper} ;;
5653
5930
          esac
5654
5931
 
5655
5932
          # Check the variables that should have been set.
5677
5954
          done
5678
5955
 
5679
5956
          relink_command=
5680
 
          # To insure that "foo" is sourced, and not "foo.exe",
5681
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5682
 
          # which disallows the automatic-append-.exe behavior.
5683
 
          case $build in
5684
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5685
 
          *) wrapperdot=${wrapper} ;;
5686
 
          esac
 
5957
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
5958
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
5959
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
5960
          # `FILE.' does not work on cygwin managed mounts.
 
5961
          #
5687
5962
          # If there is no directory component, then add one.
5688
 
          case $file in
5689
 
          */* | *\\*) . ${wrapperdot} ;;
5690
 
          *) . ./${wrapperdot} ;;
 
5963
          case $wrapper in
 
5964
          */* | *\\*) . ${wrapper} ;;
 
5965
          *) . ./${wrapper} ;;
5691
5966
          esac
5692
5967
 
5693
5968
          outputname=
5728
6003
        fi
5729
6004
 
5730
6005
        # remove .exe since cygwin /usr/bin/install will append another
5731
 
        # one anyways
 
6006
        # one anyway 
5732
6007
        case $install_prog,$host in
5733
6008
        */usr/bin/install*,*cygwin*)
5734
6009
          case $file:$destfile in
6398
6673
$echo
6399
6674
$echo "Try \`$modename --help' for more information about other modes."
6400
6675
 
6401
 
exit $EXIT_SUCCESS
 
6676
exit $?
6402
6677
 
6403
6678
# The TAGs below are defined such that we never get into a situation
6404
6679
# in which we disable both kinds of libraries.  Given conflicting