~ubuntu-branches/ubuntu/lucid/sage/lucid

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2007-12-24 11:26:32 UTC
  • mfrom: (1.1.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20071224112632-lle5ptmz1sa60orh
Tags: 0.2.0-3
* Fixed clean target in debian/rules.
* Replaced ${Source-Version} in debian/control.
* Updated Standards-Version to 3.7.3.

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
33
33
# function.
34
34
progpath="$0"
35
35
 
36
 
# RH: define SED for historic ltconfig's generated by Libtool 1.3
37
 
[ -z "$SED" ] && SED=sed
38
 
 
39
36
# The name of this program:
40
37
progname=`echo "$progpath" | $SED $basename`
41
38
modename="$progname"
46
43
 
47
44
PROGRAM=ltmain.sh
48
45
PACKAGE=libtool
49
 
VERSION=1.5.6
50
 
TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
 
46
VERSION=1.5.22
 
47
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
51
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
52
54
 
53
55
# Check that we have a working $echo.
54
56
if test "X$1" = X--no-reexec; then
86
88
Xsed="${SED}"' -e 1s/^X//'
87
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
88
90
# test EBCDIC or ASCII
89
 
case `echo A|tr A '\301'` in
90
 
 A) # EBCDIC based system
91
 
  SP2NL="tr '\100' '\n'"
92
 
  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'
93
96
  ;;
94
 
 *) # Assume ASCII based system
95
 
  SP2NL="tr '\040' '\012'"
96
 
  NL2SP="tr '\015\012' '\040\040'"
 
97
 *) # EBCDIC based system
 
98
  SP2NL='tr \100 \n'
 
99
  NL2SP='tr \r\n \100\100'
97
100
  ;;
98
101
esac
99
102
 
110
113
fi
111
114
 
112
115
# Make sure IFS has a sensible default
113
 
: ${IFS="       
114
 
"}
 
116
lt_nl='
 
117
'
 
118
IFS="   $lt_nl"
115
119
 
116
120
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
117
121
  $echo "$modename: not configured to build any kind of library" 1>&2
128
132
show="$echo"
129
133
show_help=
130
134
execute_dlfiles=
 
135
duplicate_deps=no
 
136
preserve_args=
131
137
lo2o="s/\\.lo\$/.${objext}/"
132
138
o2lo="s/\\.${objext}\$/.lo/"
133
139
 
135
141
# Shell function definitions:
136
142
# This seems to be the best place for them
137
143
 
 
144
# func_mktempdir [string]
 
145
# Make a temporary directory that won't clash with other running
 
146
# libtool processes, and avoids race conditions if possible.  If
 
147
# given, STRING is the basename for that directory.
 
148
func_mktempdir ()
 
149
{
 
150
    my_template="${TMPDIR-/tmp}/${1-$progname}"
 
151
 
 
152
    if test "$run" = ":"; then
 
153
      # Return a directory name, but don't create it in dry-run mode
 
154
      my_tmpdir="${my_template}-$$"
 
155
    else
 
156
 
 
157
      # If mktemp works, use that first and foremost
 
158
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
159
 
 
160
      if test ! -d "$my_tmpdir"; then
 
161
        # Failing that, at least try and use $RANDOM to avoid a race
 
162
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
163
 
 
164
        save_mktempdir_umask=`umask`
 
165
        umask 0077
 
166
        $mkdir "$my_tmpdir"
 
167
        umask $save_mktempdir_umask
 
168
      fi
 
169
 
 
170
      # If we're not in dry-run mode, bomb out on failure
 
171
      test -d "$my_tmpdir" || {
 
172
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
 
173
        exit $EXIT_FAILURE
 
174
      }
 
175
    fi
 
176
 
 
177
    $echo "X$my_tmpdir" | $Xsed
 
178
}
 
179
 
 
180
 
138
181
# func_win32_libid arg
139
182
# return the library type of file 'arg'
140
183
#
141
184
# Need a lot of goo to handle *both* DLLs and import libs
142
185
# Has to be a shell function in order to 'eat' the argument
143
186
# that is supplied when $file_magic_command is called.
144
 
func_win32_libid () {
 
187
func_win32_libid ()
 
188
{
145
189
  win32_libid_type="unknown"
146
190
  win32_fileres=`file -L $1 2>/dev/null`
147
191
  case $win32_fileres in
152
196
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
153
197
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
154
198
      win32_nmres=`eval $NM -f posix -A $1 | \
155
 
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
156
 
      if test "X$win32_nmres" = "Ximport" ; then
157
 
        win32_libid_type="x86 archive import"
158
 
      else
159
 
        win32_libid_type="x86 archive static"
160
 
      fi
 
199
        $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
 
200
      case $win32_nmres in
 
201
      import*)  win32_libid_type="x86 archive import";;
 
202
      *)        win32_libid_type="x86 archive static";;
 
203
      esac
161
204
    fi
162
205
    ;;
163
206
  *DLL*)
181
224
# Only attempt this if the compiler in the base compile
182
225
# command doesn't match the default compiler.
183
226
# arg is usually of the form 'gcc ...'
184
 
func_infer_tag () {
 
227
func_infer_tag ()
 
228
{
185
229
    if test -n "$available_tags" && test -z "$tagname"; then
186
230
      CC_quoted=
187
231
      for arg in $CC; do
238
282
      esac
239
283
    fi
240
284
}
 
285
 
 
286
 
 
287
# func_extract_an_archive dir oldlib
 
288
func_extract_an_archive ()
 
289
{
 
290
    f_ex_an_ar_dir="$1"; shift
 
291
    f_ex_an_ar_oldlib="$1"
 
292
 
 
293
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
 
294
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
 
295
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 
296
     :
 
297
    else
 
298
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
 
299
      exit $EXIT_FAILURE
 
300
    fi
 
301
}
 
302
 
 
303
# func_extract_archives gentop oldlib ...
 
304
func_extract_archives ()
 
305
{
 
306
    my_gentop="$1"; shift
 
307
    my_oldlibs=${1+"$@"}
 
308
    my_oldobjs=""
 
309
    my_xlib=""
 
310
    my_xabs=""
 
311
    my_xdir=""
 
312
    my_status=""
 
313
 
 
314
    $show "${rm}r $my_gentop"
 
315
    $run ${rm}r "$my_gentop"
 
316
    $show "$mkdir $my_gentop"
 
317
    $run $mkdir "$my_gentop"
 
318
    my_status=$?
 
319
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
 
320
      exit $my_status
 
321
    fi
 
322
 
 
323
    for my_xlib in $my_oldlibs; do
 
324
      # Extract the objects.
 
325
      case $my_xlib in
 
326
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
327
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
328
      esac
 
329
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
 
330
      my_xdir="$my_gentop/$my_xlib"
 
331
 
 
332
      $show "${rm}r $my_xdir"
 
333
      $run ${rm}r "$my_xdir"
 
334
      $show "$mkdir $my_xdir"
 
335
      $run $mkdir "$my_xdir"
 
336
      exit_status=$?
 
337
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
 
338
        exit $exit_status
 
339
      fi
 
340
      case $host in
 
341
      *-darwin*)
 
342
        $show "Extracting $my_xabs"
 
343
        # Do not bother doing anything if just a dry run
 
344
        if test -z "$run"; then
 
345
          darwin_orig_dir=`pwd`
 
346
          cd $my_xdir || exit $?
 
347
          darwin_archive=$my_xabs
 
348
          darwin_curdir=`pwd`
 
349
          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
 
350
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
 
351
          if test -n "$darwin_arches"; then 
 
352
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
 
353
            darwin_arch=
 
354
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
 
355
            for darwin_arch in  $darwin_arches ; do
 
356
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
357
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
358
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
359
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
360
              cd "$darwin_curdir"
 
361
              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
362
            done # $darwin_arches
 
363
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
 
364
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
 
365
            darwin_file=
 
366
            darwin_files=
 
367
            for darwin_file in $darwin_filelist; do
 
368
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 
369
              lipo -create -output "$darwin_file" $darwin_files
 
370
            done # $darwin_filelist
 
371
            ${rm}r unfat-$$
 
372
            cd "$darwin_orig_dir"
 
373
          else
 
374
            cd "$darwin_orig_dir"
 
375
            func_extract_an_archive "$my_xdir" "$my_xabs"
 
376
          fi # $darwin_arches
 
377
        fi # $run
 
378
        ;;
 
379
      *)
 
380
        func_extract_an_archive "$my_xdir" "$my_xabs"
 
381
        ;;
 
382
      esac
 
383
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
384
    done
 
385
    func_extract_archives_result="$my_oldobjs"
 
386
}
241
387
# End of Shell function definitions
242
388
#####################################
243
389
 
244
390
# Darwin sucks
245
391
eval std_shrext=\"$shrext_cmds\"
246
392
 
 
393
disable_libs=no
 
394
 
247
395
# Parse our command line options once, thoroughly.
248
396
while test "$#" -gt 0
249
397
do
308
456
  --version)
309
457
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
310
458
    $echo
311
 
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
 
459
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
312
460
    $echo "This is free software; see the source for copying conditions.  There is NO"
313
461
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
314
 
    exit $EXIT_SUCCESS
 
462
    exit $?
315
463
    ;;
316
464
 
317
465
  --config)
320
468
    for tagname in $taglist; do
321
469
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
322
470
    done
323
 
    exit $EXIT_SUCCESS
 
471
    exit $?
324
472
    ;;
325
473
 
326
474
  --debug)
345
493
    else
346
494
      $echo "disable static libraries"
347
495
    fi
348
 
    exit $EXIT_SUCCESS
 
496
    exit $?
349
497
    ;;
350
498
 
351
499
  --finish) mode="finish" ;;
360
508
    preserve_args="$preserve_args $arg"
361
509
    ;;
362
510
 
363
 
  --tag) prevopt="--tag" prev=tag ;;
 
511
  --tag)
 
512
    prevopt="--tag"
 
513
    prev=tag
 
514
    preserve_args="$preserve_args --tag"
 
515
    ;;
364
516
  --tag=*)
365
517
    set tag "$optarg" ${1+"$@"}
366
518
    shift
392
544
  exit $EXIT_FAILURE
393
545
fi
394
546
 
 
547
case $disable_libs in
 
548
no) 
 
549
  ;;
 
550
shared)
 
551
  build_libtool_libs=no
 
552
  build_old_libs=yes
 
553
  ;;
 
554
static)
 
555
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 
556
  ;;
 
557
esac
 
558
 
395
559
# If this variable is set in any of the actions, the command in it
396
560
# will be execed at the end.  This prevents here-documents from being
397
561
# left over by shells.
402
566
  # Infer the operation mode.
403
567
  if test -z "$mode"; then
404
568
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
405
 
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
 
569
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
406
570
    case $nonopt in
407
571
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
408
572
      mode=link
468
632
 
469
633
    for arg
470
634
    do
471
 
      case "$arg_mode" in
 
635
      case $arg_mode in
472
636
      arg  )
473
637
        # do not "continue".  Instead, add this to base_compile
474
638
        lastarg="$arg"
550
714
      case $lastarg in
551
715
      # Double-quote args containing other shell metacharacters.
552
716
      # Many Bourne shells cannot handle close brackets correctly
553
 
      # in scan sets, so we specify it separately.
 
717
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
 
718
      # in scan sets (worked around with variable expansion),
 
719
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
 
720
      # at all, so we specify them separately.
554
721
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
555
722
        lastarg="\"$lastarg\""
556
723
        ;;
624
791
      esac
625
792
    done
626
793
 
 
794
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
 
795
    case $qlibobj in
 
796
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
797
        qlibobj="\"$qlibobj\"" ;;
 
798
    esac
 
799
    test "X$libobj" != "X$qlibobj" \
 
800
        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
 
801
        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
627
802
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
628
803
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
629
804
    if test "X$xdir" = "X$obj"; then
696
871
        $run $rm $removelist
697
872
        exit $EXIT_FAILURE
698
873
      fi
699
 
      $echo $srcfile > "$lockfile"
 
874
      $echo "$srcfile" > "$lockfile"
700
875
    fi
701
876
 
702
877
    if test -n "$fix_srcfile_path"; then
703
878
      eval srcfile=\"$fix_srcfile_path\"
704
879
    fi
 
880
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
 
881
    case $qsrcfile in
 
882
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
883
      qsrcfile="\"$qsrcfile\"" ;;
 
884
    esac
705
885
 
706
886
    $run $rm "$libobj" "${libobj}T"
707
887
 
723
903
      fbsd_hideous_sh_bug=$base_compile
724
904
 
725
905
      if test "$pic_mode" != no; then
726
 
        command="$base_compile $srcfile $pic_flag"
 
906
        command="$base_compile $qsrcfile $pic_flag"
727
907
      else
728
908
        # Don't build PIC code
729
 
        command="$base_compile $srcfile"
 
909
        command="$base_compile $qsrcfile"
730
910
      fi
731
911
 
732
912
      if test ! -d "${xdir}$objdir"; then
733
913
        $show "$mkdir ${xdir}$objdir"
734
914
        $run $mkdir ${xdir}$objdir
735
 
        status=$?
736
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
737
 
          exit $status
 
915
        exit_status=$?
 
916
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
917
          exit $exit_status
738
918
        fi
739
919
      fi
740
920
 
806
986
    if test "$build_old_libs" = yes; then
807
987
      if test "$pic_mode" != yes; then
808
988
        # Don't build PIC code
809
 
        command="$base_compile $srcfile"
 
989
        command="$base_compile $qsrcfile"
810
990
      else
811
 
        command="$base_compile $srcfile $pic_flag"
 
991
        command="$base_compile $qsrcfile $pic_flag"
812
992
      fi
813
993
      if test "$compiler_c_o" = yes; then
814
994
        command="$command -o $obj"
937
1117
    no_install=no
938
1118
    objs=
939
1119
    non_pic_objects=
 
1120
    notinst_path= # paths that contain not-installed libtool libraries
940
1121
    precious_files_regex=
941
1122
    prefer_static_libs=no
942
1123
    preload=no
965
1146
          if test -n "$link_static_flag"; then
966
1147
            dlopen_self=$dlopen_self_static
967
1148
          fi
 
1149
          prefer_static_libs=yes
968
1150
        else
969
1151
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
970
1152
            dlopen_self=$dlopen_self_static
971
1153
          fi
 
1154
          prefer_static_libs=built
972
1155
        fi
973
1156
        build_libtool_libs=no
974
1157
        build_old_libs=yes
975
 
        prefer_static_libs=yes
976
1158
        break
977
1159
        ;;
978
1160
      esac
1147
1329
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1148
1330
                    arg="$non_pic_object"
1149
1331
                  fi
 
1332
                else
 
1333
                  # If the PIC object exists, use it instead.
 
1334
                  # $xdir was prepended to $pic_object above.
 
1335
                  non_pic_object="$pic_object"
 
1336
                  non_pic_objects="$non_pic_objects $non_pic_object"
1150
1337
                fi
1151
1338
              else
1152
1339
                # Only an error if not doing a dry-run.
1230
1417
          prev=
1231
1418
          continue
1232
1419
          ;;
 
1420
        darwin_framework|darwin_framework_skip)
 
1421
          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
 
1422
          compile_command="$compile_command $arg"
 
1423
          finalize_command="$finalize_command $arg"
 
1424
          prev=
 
1425
          continue
 
1426
          ;;
1233
1427
        *)
1234
1428
          eval "$prev=\"\$arg\""
1235
1429
          prev=
1288
1482
        continue
1289
1483
        ;;
1290
1484
 
 
1485
      -framework|-arch|-isysroot)
 
1486
        case " $CC " in
 
1487
          *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
 
1488
                prev=darwin_framework_skip ;;
 
1489
          *) compiler_flags="$compiler_flags $arg"
 
1490
             prev=darwin_framework ;;
 
1491
        esac
 
1492
        compile_command="$compile_command $arg"
 
1493
        finalize_command="$finalize_command $arg"
 
1494
        continue
 
1495
        ;;
 
1496
 
1291
1497
      -inst-prefix-dir)
1292
1498
        prev=inst_prefix
1293
1499
        continue
1314
1520
          absdir=`cd "$dir" && pwd`
1315
1521
          if test -z "$absdir"; then
1316
1522
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1317
 
            exit $EXIT_FAILURE
 
1523
            absdir="$dir"
 
1524
            notinst_path="$notinst_path $dir"
1318
1525
          fi
1319
1526
          dir="$absdir"
1320
1527
          ;;
1328
1535
        esac
1329
1536
        case $host in
1330
1537
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1538
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1331
1539
          case :$dllsearchpath: in
1332
1540
          *":$dir:"*) ;;
1333
1541
          *) dllsearchpath="$dllsearchpath:$dir";;
1334
1542
          esac
 
1543
          case :$dllsearchpath: in
 
1544
          *":$testbindir:"*) ;;
 
1545
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1546
          esac
1335
1547
          ;;
1336
1548
        esac
1337
1549
        continue
1340
1552
      -l*)
1341
1553
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1342
1554
          case $host in
1343
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1555
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1344
1556
            # These systems don't actually have a C or math library (as such)
1345
1557
            continue
1346
1558
            ;;
1347
 
          *-*-mingw* | *-*-os2*)
 
1559
          *-*-os2*)
1348
1560
            # These systems don't actually have a C library (as such)
1349
1561
            test "X$arg" = "X-lc" && continue
1350
1562
            ;;
1351
 
          *-*-openbsd* | *-*-freebsd*)
 
1563
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1352
1564
            # Do not include libc due to us having libc/libc_r.
1353
1565
            test "X$arg" = "X-lc" && continue
1354
1566
            ;;
1356
1568
            # Rhapsody C and math libraries are in the System framework
1357
1569
            deplibs="$deplibs -framework System"
1358
1570
            continue
 
1571
            ;;
 
1572
          *-*-sco3.2v5* | *-*-sco5v6*)
 
1573
            # Causes problems with __ctype
 
1574
            test "X$arg" = "X-lc" && continue
 
1575
            ;;
 
1576
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
1577
            # Compiler inserts libc in the correct place for threads to work
 
1578
            test "X$arg" = "X-lc" && continue
 
1579
            ;;
1359
1580
          esac
1360
1581
        elif test "X$arg" = "X-lc_r"; then
1361
1582
         case $host in
1362
 
         *-*-openbsd* | *-*-freebsd*)
 
1583
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1363
1584
           # Do not include libc_r directly, use -pthread flag.
1364
1585
           continue
1365
1586
           ;;
1369
1590
        continue
1370
1591
        ;;
1371
1592
 
 
1593
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
1594
      # classes, name mangling, and exception handling.
 
1595
      -model)
 
1596
        compile_command="$compile_command $arg"
 
1597
        compiler_flags="$compiler_flags $arg"
 
1598
        finalize_command="$finalize_command $arg"
 
1599
        prev=xcompiler
 
1600
        continue
 
1601
        ;;
 
1602
 
1372
1603
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1373
 
        deplibs="$deplibs $arg"
 
1604
        compiler_flags="$compiler_flags $arg"
 
1605
        compile_command="$compile_command $arg"
 
1606
        finalize_command="$finalize_command $arg"
1374
1607
        continue
1375
1608
        ;;
1376
1609
 
1379
1612
        continue
1380
1613
        ;;
1381
1614
 
1382
 
      # gcc -m* arguments should be passed to the linker via $compiler_flags
1383
 
      # in order to pass architecture information to the linker
1384
 
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1385
 
      # but this is not reliable with gcc because gcc may use -mfoo to
1386
 
      # select a different linker, different libraries, etc, while
1387
 
      # -Wl,-mfoo simply passes -mfoo to the linker.
1388
 
      -m*)
 
1615
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
 
1616
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
 
1617
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
 
1618
      # +DA*, +DD* enable 64-bit mode on the HP compiler
 
1619
      # -q* pass through compiler args for the IBM compiler
 
1620
      # -m* pass through architecture-specific compiler args for GCC
 
1621
      # -m*, -t[45]*, -txscale* pass through architecture-specific
 
1622
      # compiler args for GCC
 
1623
      # -pg pass through profiling flag for GCC
 
1624
      # @file GCC response files
 
1625
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
 
1626
      -t[45]*|-txscale*|@*)
 
1627
 
1389
1628
        # Unknown arguments in both finalize_command and compile_command need
1390
1629
        # to be aesthetically quoted because they are evaled later.
1391
1630
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1396
1635
        esac
1397
1636
        compile_command="$compile_command $arg"
1398
1637
        finalize_command="$finalize_command $arg"
1399
 
        if test "$with_gcc" = "yes" ; then
1400
 
          compiler_flags="$compiler_flags $arg"
1401
 
        fi
 
1638
        compiler_flags="$compiler_flags $arg"
1402
1639
        continue
1403
1640
        ;;
1404
1641
 
1636
1873
            if test -z "$pic_object" || test "$pic_object" = none ; then
1637
1874
              arg="$non_pic_object"
1638
1875
            fi
 
1876
          else
 
1877
            # If the PIC object exists, use it instead.
 
1878
            # $xdir was prepended to $pic_object above.
 
1879
            non_pic_object="$pic_object"
 
1880
            non_pic_objects="$non_pic_objects $non_pic_object"
1639
1881
          fi
1640
1882
        else
1641
1883
          # Only an error if not doing a dry-run.
1741
1983
    if test ! -d "$output_objdir"; then
1742
1984
      $show "$mkdir $output_objdir"
1743
1985
      $run $mkdir $output_objdir
1744
 
      status=$?
1745
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1746
 
        exit $status
 
1986
      exit_status=$?
 
1987
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
1988
        exit $exit_status
1747
1989
      fi
1748
1990
    fi
1749
1991
 
1806
2048
    newlib_search_path=
1807
2049
    need_relink=no # whether we're linking any uninstalled libtool libraries
1808
2050
    notinst_deplibs= # not-installed libtool libraries
1809
 
    notinst_path= # paths that contain not-installed libtool libraries
1810
2051
    case $linkmode in
1811
2052
    lib)
1812
2053
        passes="conv link"
1858
2099
            compile_deplibs="$deplib $compile_deplibs"
1859
2100
            finalize_deplibs="$deplib $finalize_deplibs"
1860
2101
          else
1861
 
            deplibs="$deplib $deplibs"
 
2102
            compiler_flags="$compiler_flags $deplib"
1862
2103
          fi
1863
2104
          continue
1864
2105
          ;;
1867
2108
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1868
2109
            continue
1869
2110
          fi
1870
 
          if test "$pass" = conv; then
1871
 
            deplibs="$deplib $deplibs"
1872
 
            continue
1873
 
          fi
1874
2111
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1875
2112
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1876
2113
            for search_ext in .la $std_shrext .so .a; do
1981
2218
          fi
1982
2219
          case $linkmode in
1983
2220
          lib)
1984
 
            if test "$deplibs_check_method" != pass_all; then
 
2221
            valid_a_lib=no
 
2222
            case $deplibs_check_method in
 
2223
              match_pattern*)
 
2224
                set dummy $deplibs_check_method
 
2225
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2226
                if eval $echo \"$deplib\" 2>/dev/null \
 
2227
                    | $SED 10q \
 
2228
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2229
                  valid_a_lib=yes
 
2230
                fi
 
2231
                ;;
 
2232
              pass_all)
 
2233
                valid_a_lib=yes
 
2234
                ;;
 
2235
            esac
 
2236
            if test "$valid_a_lib" != yes; then
1985
2237
              $echo
1986
2238
              $echo "*** Warning: Trying to link with static lib archive $deplib."
1987
2239
              $echo "*** I have the capability to make that library automatically link in when"
2031
2283
        esac # case $deplib
2032
2284
        if test "$found" = yes || test -f "$lib"; then :
2033
2285
        else
2034
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
2286
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2035
2287
          exit $EXIT_FAILURE
2036
2288
        fi
2037
2289
 
2055
2307
        # it will not redefine variables installed, or shouldnotlink
2056
2308
        installed=yes
2057
2309
        shouldnotlink=no
 
2310
        avoidtemprpath=
 
2311
 
2058
2312
 
2059
2313
        # Read the .la file
2060
2314
        case $lib in
2153
2407
            dir="$libdir"
2154
2408
            absdir="$libdir"
2155
2409
          fi
 
2410
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2156
2411
        else
2157
 
          dir="$ladir/$objdir"
2158
 
          absdir="$abs_ladir/$objdir"
2159
 
          # Remove this search path later
2160
 
          notinst_path="$notinst_path $abs_ladir"
 
2412
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2413
            dir="$ladir"
 
2414
            absdir="$abs_ladir"
 
2415
            # Remove this search path later
 
2416
            notinst_path="$notinst_path $abs_ladir"
 
2417
          else
 
2418
            dir="$ladir/$objdir"
 
2419
            absdir="$abs_ladir/$objdir"
 
2420
            # Remove this search path later
 
2421
            notinst_path="$notinst_path $abs_ladir"
 
2422
          fi
2161
2423
        fi # $installed = yes
2162
2424
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2163
2425
 
2230
2492
          if test -n "$library_names" &&
2231
2493
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2232
2494
            # We need to hardcode the library path
2233
 
            if test -n "$shlibpath_var"; then
 
2495
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2234
2496
              # Make sure the rpath contains only unique directories.
2235
2497
              case "$temp_rpath " in
2236
2498
              *" $dir "*) ;;
2237
2499
              *" $absdir "*) ;;
2238
 
              *) temp_rpath="$temp_rpath $dir" ;;
 
2500
              *) temp_rpath="$temp_rpath $absdir" ;;
2239
2501
              esac
2240
2502
            fi
2241
2503
 
2272
2534
        fi
2273
2535
 
2274
2536
        link_static=no # Whether the deplib will be linked statically
 
2537
        use_static_libs=$prefer_static_libs
 
2538
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2539
          use_static_libs=no
 
2540
        fi
2275
2541
        if test -n "$library_names" &&
2276
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2542
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2277
2543
          if test "$installed" = no; then
2278
2544
            notinst_deplibs="$notinst_deplibs $lib"
2279
2545
            need_relink=yes
2386
2652
              if test "$hardcode_direct" = no; then
2387
2653
                add="$dir/$linklib"
2388
2654
                case $host in
2389
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2655
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2656
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2657
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2658
                    *-*-unixware7*) add_dir="-L$dir" ;;
2390
2659
                  *-*-darwin* )
2391
2660
                    # if the lib is a module then we can not link against
2392
2661
                    # it, someone is ignoring the new warnings I added
2393
 
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2662
                    if /usr/bin/file -L $add 2> /dev/null |
 
2663
                      $EGREP ": [^:]* bundle" >/dev/null ; then
2394
2664
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2395
2665
                      if test -z "$old_library" ; then
2396
2666
                        $echo
2421
2691
                add_dir="-L$dir"
2422
2692
                # Try looking first in the location we're being installed to.
2423
2693
                if test -n "$inst_prefix_dir"; then
2424
 
                  case "$libdir" in
 
2694
                  case $libdir in
2425
2695
                    [\\/]*)
2426
2696
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2427
2697
                      ;;
2494
2764
              add_dir="-L$libdir"
2495
2765
              # Try looking first in the location we're being installed to.
2496
2766
              if test -n "$inst_prefix_dir"; then
2497
 
                case "$libdir" in
 
2767
                case $libdir in
2498
2768
                  [\\/]*)
2499
2769
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2500
2770
                    ;;
2555
2825
              fi
2556
2826
            fi
2557
2827
          else
2558
 
            convenience="$convenience $dir/$old_library"
2559
 
            old_convenience="$old_convenience $dir/$old_library"
2560
2828
            deplibs="$dir/$old_library $deplibs"
2561
2829
            link_static=yes
2562
2830
          fi
2674
2942
              *) continue ;;
2675
2943
              esac
2676
2944
              case " $deplibs " in
 
2945
              *" $path "*) ;;
 
2946
              *) deplibs="$path $deplibs" ;;
 
2947
              esac
 
2948
              case " $deplibs " in
2677
2949
              *" $depdepl "*) ;;
2678
2950
              *) deplibs="$depdepl $deplibs" ;;
2679
2951
              esac
2680
 
              case " $deplibs " in
2681
 
              *" $path "*) ;;
2682
 
              *) deplibs="$deplibs $path" ;;
2683
 
              esac
2684
2952
            done
2685
2953
          fi # link_all_deplibs != no
2686
2954
        fi # linkmode = lib
2944
3212
 
2945
3213
        # Check that each of the things are valid numbers.
2946
3214
        case $current in
2947
 
        [0-9]*) ;;
 
3215
        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]) ;;
2948
3216
        *)
2949
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3217
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2950
3218
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2951
3219
          exit $EXIT_FAILURE
2952
3220
          ;;
2953
3221
        esac
2954
3222
 
2955
3223
        case $revision in
2956
 
        [0-9]*) ;;
 
3224
        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]) ;;
2957
3225
        *)
2958
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3226
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2959
3227
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2960
3228
          exit $EXIT_FAILURE
2961
3229
          ;;
2962
3230
        esac
2963
3231
 
2964
3232
        case $age in
2965
 
        [0-9]*) ;;
 
3233
        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]) ;;
2966
3234
        *)
2967
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3235
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2968
3236
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2969
3237
          exit $EXIT_FAILURE
2970
3238
          ;;
2990
3258
          versuffix="$major.$age.$revision"
2991
3259
          # Darwin ld doesn't like 0 for these options...
2992
3260
          minor_current=`expr $current + 1`
2993
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3261
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2994
3262
          ;;
2995
3263
 
2996
3264
        freebsd-aout)
3143
3411
 
3144
3412
      # Eliminate all temporary directories.
3145
3413
      for path in $notinst_path; do
3146
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3147
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3148
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3414
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3415
        deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3416
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3149
3417
      done
3150
3418
 
3151
3419
      if test -n "$xrpath"; then
3196
3464
          *-*-netbsd*)
3197
3465
            # Don't link with libc until the a.out ld.so is fixed.
3198
3466
            ;;
3199
 
          *-*-openbsd* | *-*-freebsd*)
 
3467
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3200
3468
            # Do not include libc due to us having libc/libc_r.
3201
 
            test "X$arg" = "X-lc" && continue
 
3469
            ;;
 
3470
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3471
            # Causes problems with __ctype
 
3472
            ;;
 
3473
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3474
            # Compiler inserts libc in the correct place for threads to work
3202
3475
            ;;
3203
3476
          *)
3204
3477
            # Add libc to deplibs on all other systems if necessary.
3242
3515
          int main() { return 0; }
3243
3516
EOF
3244
3517
          $rm conftest
3245
 
          $LTCC -o conftest conftest.c $deplibs
 
3518
          $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3246
3519
          if test "$?" -eq 0 ; then
3247
3520
            ldd_output=`ldd conftest`
3248
3521
            for i in $deplibs; do
3249
 
              name="`expr $i : '-l\(.*\)'`"
 
3522
              name=`expr $i : '-l\(.*\)'`
3250
3523
              # If $name is empty we are operating on a -L argument.
3251
3524
              if test "$name" != "" && test "$name" -ne "0"; then
3252
3525
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3283
3556
            # Error occurred in the first compile.  Let's try to salvage
3284
3557
            # the situation: Compile a separate program for each library.
3285
3558
            for i in $deplibs; do
3286
 
              name="`expr $i : '-l\(.*\)'`"
 
3559
              name=`expr $i : '-l\(.*\)'`
3287
3560
              # If $name is empty we are operating on a -L argument.
3288
3561
              if test "$name" != "" && test "$name" != "0"; then
3289
3562
                $rm conftest
3290
 
                $LTCC -o conftest conftest.c $i
 
3563
                $LTCC $LTCFLAGS -o conftest conftest.c $i
3291
3564
                # Did it work?
3292
3565
                if test "$?" -eq 0 ; then
3293
3566
                  ldd_output=`ldd conftest`
3335
3608
          set dummy $deplibs_check_method
3336
3609
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3337
3610
          for a_deplib in $deplibs; do
3338
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3611
            name=`expr $a_deplib : '-l\(.*\)'`
3339
3612
            # If $name is empty we are operating on a -L argument.
3340
3613
            if test "$name" != "" && test  "$name" != "0"; then
3341
3614
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3404
3677
          set dummy $deplibs_check_method
3405
3678
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3406
3679
          for a_deplib in $deplibs; do
3407
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3680
            name=`expr $a_deplib : '-l\(.*\)'`
3408
3681
            # If $name is empty we are operating on a -L argument.
3409
3682
            if test -n "$name" && test "$name" != "0"; then
3410
3683
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3534
3807
        deplibs=$newdeplibs
3535
3808
      fi
3536
3809
 
 
3810
 
 
3811
      # move library search paths that coincide with paths to not yet
 
3812
      # installed libraries to the beginning of the library search list
 
3813
      new_libs=
 
3814
      for path in $notinst_path; do
 
3815
        case " $new_libs " in
 
3816
        *" -L$path/$objdir "*) ;;
 
3817
        *)
 
3818
          case " $deplibs " in
 
3819
          *" -L$path/$objdir "*)
 
3820
            new_libs="$new_libs -L$path/$objdir" ;;
 
3821
          esac
 
3822
          ;;
 
3823
        esac
 
3824
      done
 
3825
      for deplib in $deplibs; do
 
3826
        case $deplib in
 
3827
        -L*)
 
3828
          case " $new_libs " in
 
3829
          *" $deplib "*) ;;
 
3830
          *) new_libs="$new_libs $deplib" ;;
 
3831
          esac
 
3832
          ;;
 
3833
        *) new_libs="$new_libs $deplib" ;;
 
3834
        esac
 
3835
      done
 
3836
      deplibs="$new_libs"
 
3837
 
 
3838
 
3537
3839
      # All the library-specific variables (install_libdir is set above).
3538
3840
      library_names=
3539
3841
      old_library=
3617
3919
        fi
3618
3920
 
3619
3921
        lib="$output_objdir/$realname"
 
3922
        linknames=
3620
3923
        for link
3621
3924
        do
3622
3925
          linknames="$linknames $link"
3645
3948
                # The command line is too long to execute in one step.
3646
3949
                $show "using reloadable object file for export list..."
3647
3950
                skipped_export=:
 
3951
                # Break out early, otherwise skipped_export may be
 
3952
                # set to false by a later but shorter cmd.
 
3953
                break
3648
3954
              fi
3649
3955
            done
3650
3956
            IFS="$save_ifs"
3678
3984
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3679
3985
          else
3680
3986
            gentop="$output_objdir/${outputname}x"
3681
 
            $show "${rm}r $gentop"
3682
 
            $run ${rm}r "$gentop"
3683
 
            $show "$mkdir $gentop"
3684
 
            $run $mkdir "$gentop"
3685
 
            status=$?
3686
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
3687
 
              exit $status
3688
 
            fi
3689
3987
            generated="$generated $gentop"
3690
3988
 
3691
 
            for xlib in $convenience; do
3692
 
              # Extract the objects.
3693
 
              case $xlib in
3694
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3695
 
              *) xabs=`pwd`"/$xlib" ;;
3696
 
              esac
3697
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3698
 
              xdir="$gentop/$xlib"
3699
 
 
3700
 
              $show "${rm}r $xdir"
3701
 
              $run ${rm}r "$xdir"
3702
 
              $show "$mkdir $xdir"
3703
 
              $run $mkdir "$xdir"
3704
 
              status=$?
3705
 
              if test "$status" -ne 0 && test ! -d "$xdir"; then
3706
 
                exit $status
3707
 
              fi
3708
 
              # We will extract separately just the conflicting names and we will no
3709
 
              # longer touch any unique names. It is faster to leave these extract
3710
 
              # automatically by $AR in one run.
3711
 
              $show "(cd $xdir && $AR x $xabs)"
3712
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3713
 
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3714
 
                :
3715
 
              else
3716
 
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3717
 
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3718
 
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
3719
 
                do
3720
 
                  i=1
3721
 
                  while test "$i" -le "$count"
3722
 
                  do
3723
 
                   # Put our $i before any first dot (extension)
3724
 
                   # Never overwrite any file
3725
 
                   name_to="$name"
3726
 
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3727
 
                   do
3728
 
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3729
 
                   done
3730
 
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3731
 
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3732
 
                   i=`expr $i + 1`
3733
 
                  done
3734
 
                done
3735
 
              fi
3736
 
 
3737
 
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3738
 
            done
 
3989
            func_extract_archives $gentop $convenience
 
3990
            libobjs="$libobjs $func_extract_archives_result"
3739
3991
          fi
3740
3992
        fi
3741
 
 
 
3993
        
3742
3994
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3743
3995
          eval flag=\"$thread_safe_flag_spec\"
3744
3996
          linker_flags="$linker_flags $flag"
3768
4020
          fi
3769
4021
        fi
3770
4022
 
3771
 
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
4023
        if test "X$skipped_export" != "X:" &&
 
4024
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3772
4025
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3773
4026
          :
3774
4027
        else
3787
4040
            save_libobjs=$libobjs
3788
4041
          fi
3789
4042
          save_output=$output
 
4043
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
3790
4044
 
3791
4045
          # Clear the reloadable object creation command queue and
3792
4046
          # initialize k to one.
3796
4050
          delfiles=
3797
4051
          last_robj=
3798
4052
          k=1
3799
 
          output=$output_objdir/$save_output-${k}.$objext
 
4053
          output=$output_objdir/$output_la-${k}.$objext
3800
4054
          # Loop over the list of objects to be linked.
3801
4055
          for obj in $save_libobjs
3802
4056
          do
3803
4057
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3804
4058
            if test "X$objlist" = X ||
3805
 
               { len=`expr "X$test_cmds" : ".*"` &&
 
4059
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3806
4060
                 test "$len" -le "$max_cmd_len"; }; then
3807
4061
              objlist="$objlist $obj"
3808
4062
            else
3816
4070
                # the last one created.
3817
4071
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3818
4072
              fi
3819
 
              last_robj=$output_objdir/$save_output-${k}.$objext
 
4073
              last_robj=$output_objdir/$output_la-${k}.$objext
3820
4074
              k=`expr $k + 1`
3821
 
              output=$output_objdir/$save_output-${k}.$objext
 
4075
              output=$output_objdir/$output_la-${k}.$objext
3822
4076
              objlist=$obj
3823
4077
              len=1
3824
4078
            fi
3838
4092
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3839
4093
          fi
3840
4094
 
3841
 
          # Set up a command to remove the reloadale object files
 
4095
          # Set up a command to remove the reloadable object files
3842
4096
          # after they are used.
3843
4097
          i=0
3844
4098
          while test "$i" -lt "$k"
3845
4099
          do
3846
4100
            i=`expr $i + 1`
3847
 
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
4101
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3848
4102
          done
3849
4103
 
3850
4104
          $echo "creating a temporary reloadable object file: $output"
3892
4146
          IFS="$save_ifs"
3893
4147
          eval cmd=\"$cmd\"
3894
4148
          $show "$cmd"
3895
 
          $run eval "$cmd" || exit $?
 
4149
          $run eval "$cmd" || {
 
4150
            lt_exit=$?
 
4151
 
 
4152
            # Restore the uninstalled library and exit
 
4153
            if test "$mode" = relink; then
 
4154
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4155
            fi
 
4156
 
 
4157
            exit $lt_exit
 
4158
          }
3896
4159
        done
3897
4160
        IFS="$save_ifs"
3898
4161
 
3899
4162
        # Restore the uninstalled library and exit
3900
4163
        if test "$mode" = relink; then
3901
4164
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
 
4165
 
 
4166
          if test -n "$convenience"; then
 
4167
            if test -z "$whole_archive_flag_spec"; then
 
4168
              $show "${rm}r $gentop"
 
4169
              $run ${rm}r "$gentop"
 
4170
            fi
 
4171
          fi
 
4172
 
3902
4173
          exit $EXIT_SUCCESS
3903
4174
        fi
3904
4175
 
3976
4247
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3977
4248
        else
3978
4249
          gentop="$output_objdir/${obj}x"
3979
 
          $show "${rm}r $gentop"
3980
 
          $run ${rm}r "$gentop"
3981
 
          $show "$mkdir $gentop"
3982
 
          $run $mkdir "$gentop"
3983
 
          status=$?
3984
 
          if test "$status" -ne 0 && test ! -d "$gentop"; then
3985
 
            exit $status
3986
 
          fi
3987
4250
          generated="$generated $gentop"
3988
4251
 
3989
 
          for xlib in $convenience; do
3990
 
            # Extract the objects.
3991
 
            case $xlib in
3992
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3993
 
            *) xabs=`pwd`"/$xlib" ;;
3994
 
            esac
3995
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3996
 
            xdir="$gentop/$xlib"
3997
 
 
3998
 
            $show "${rm}r $xdir"
3999
 
            $run ${rm}r "$xdir"
4000
 
            $show "$mkdir $xdir"
4001
 
            $run $mkdir "$xdir"
4002
 
            status=$?
4003
 
            if test "$status" -ne 0 && test ! -d "$xdir"; then
4004
 
              exit $status
4005
 
            fi
4006
 
            # We will extract separately just the conflicting names and we will no
4007
 
            # longer touch any unique names. It is faster to leave these extract
4008
 
            # automatically by $AR in one run.
4009
 
            $show "(cd $xdir && $AR x $xabs)"
4010
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4011
 
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4012
 
              :
4013
 
            else
4014
 
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4015
 
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4016
 
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
4017
 
              do
4018
 
                i=1
4019
 
                while test "$i" -le "$count"
4020
 
                do
4021
 
                 # Put our $i before any first dot (extension)
4022
 
                 # Never overwrite any file
4023
 
                 name_to="$name"
4024
 
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4025
 
                 do
4026
 
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4027
 
                 done
4028
 
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4029
 
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4030
 
                 i=`expr $i + 1`
4031
 
                done
4032
 
              done
4033
 
            fi
4034
 
 
4035
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4036
 
          done
 
4252
          func_extract_archives $gentop $convenience
 
4253
          reload_conv_objs="$reload_objs $func_extract_archives_result"
4037
4254
        fi
4038
4255
      fi
4039
4256
 
4134
4351
        ;;
4135
4352
      esac
4136
4353
 
 
4354
 
 
4355
      # move library search paths that coincide with paths to not yet
 
4356
      # installed libraries to the beginning of the library search list
 
4357
      new_libs=
 
4358
      for path in $notinst_path; do
 
4359
        case " $new_libs " in
 
4360
        *" -L$path/$objdir "*) ;;
 
4361
        *)
 
4362
          case " $compile_deplibs " in
 
4363
          *" -L$path/$objdir "*)
 
4364
            new_libs="$new_libs -L$path/$objdir" ;;
 
4365
          esac
 
4366
          ;;
 
4367
        esac
 
4368
      done
 
4369
      for deplib in $compile_deplibs; do
 
4370
        case $deplib in
 
4371
        -L*)
 
4372
          case " $new_libs " in
 
4373
          *" $deplib "*) ;;
 
4374
          *) new_libs="$new_libs $deplib" ;;
 
4375
          esac
 
4376
          ;;
 
4377
        *) new_libs="$new_libs $deplib" ;;
 
4378
        esac
 
4379
      done
 
4380
      compile_deplibs="$new_libs"
 
4381
 
 
4382
 
4137
4383
      compile_command="$compile_command $compile_deplibs"
4138
4384
      finalize_command="$finalize_command $finalize_deplibs"
4139
4385
 
4178
4424
        fi
4179
4425
        case $host in
4180
4426
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4427
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4181
4428
          case :$dllsearchpath: in
4182
4429
          *":$libdir:"*) ;;
4183
4430
          *) dllsearchpath="$dllsearchpath:$libdir";;
4184
4431
          esac
 
4432
          case :$dllsearchpath: in
 
4433
          *":$testbindir:"*) ;;
 
4434
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4435
          esac
4185
4436
          ;;
4186
4437
        esac
4187
4438
      done
4295
4546
 
4296
4547
            # Prepare the list of exported symbols
4297
4548
            if test -z "$export_symbols"; then
4298
 
              export_symbols="$output_objdir/$output.exp"
 
4549
              export_symbols="$output_objdir/$outputname.exp"
4299
4550
              $run $rm $export_symbols
4300
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4551
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4552
              case $host in
 
4553
              *cygwin* | *mingw* )
 
4554
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4555
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4556
                ;;
 
4557
              esac
4301
4558
            else
4302
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4303
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4559
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4560
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4304
4561
              $run eval 'mv "$nlist"T "$nlist"'
 
4562
              case $host in
 
4563
              *cygwin* | *mingw* )
 
4564
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4565
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4566
                ;;
 
4567
              esac
4305
4568
            fi
4306
4569
          fi
4307
4570
 
4352
4615
#endif
4353
4616
 
4354
4617
/* The mapping between symbol names and symbols. */
 
4618
"
 
4619
 
 
4620
            case $host in
 
4621
            *cygwin* | *mingw* )
 
4622
          $echo >> "$output_objdir/$dlsyms" "\
 
4623
/* DATA imports from DLLs on WIN32 can't be const, because
 
4624
   runtime relocations are performed -- see ld's documentation
 
4625
   on pseudo-relocs */
 
4626
struct {
 
4627
"
 
4628
              ;;
 
4629
            * )
 
4630
          $echo >> "$output_objdir/$dlsyms" "\
4355
4631
const struct {
 
4632
"
 
4633
              ;;
 
4634
            esac
 
4635
 
 
4636
 
 
4637
          $echo >> "$output_objdir/$dlsyms" "\
4356
4638
  const char *name;
4357
4639
  lt_ptr address;
4358
4640
}
4399
4681
          esac
4400
4682
 
4401
4683
          # Now compile the dynamic symbol file.
4402
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4403
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4684
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4685
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4404
4686
 
4405
4687
          # Clean up the generated files.
4406
4688
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4407
4689
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4408
4690
 
4409
4691
          # Transform the symbol file into the correct name.
4410
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4411
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4692
          case $host in
 
4693
          *cygwin* | *mingw* )
 
4694
            if test -f "$output_objdir/${outputname}.def" ; then
 
4695
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4696
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4697
            else
 
4698
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4699
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4700
             fi
 
4701
            ;;
 
4702
          * )
 
4703
            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4704
            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4705
            ;;
 
4706
          esac
4412
4707
          ;;
4413
4708
        *)
4414
4709
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4433
4728
        # We have no uninstalled library dependencies, so finalize right now.
4434
4729
        $show "$link_command"
4435
4730
        $run eval "$link_command"
4436
 
        status=$?
 
4731
        exit_status=$?
4437
4732
 
4438
4733
        # Delete the generated files.
4439
4734
        if test -n "$dlsyms"; then
4441
4736
          $run $rm "$output_objdir/${outputname}S.${objext}"
4442
4737
        fi
4443
4738
 
4444
 
        exit $status
 
4739
        exit $exit_status
4445
4740
      fi
4446
4741
 
4447
4742
      if test -n "$shlibpath_var"; then
4581
4876
        esac
4582
4877
        case $host in
4583
4878
          *cygwin* | *mingw* )
4584
 
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4585
 
            cwrapper=`$echo ${output}.exe`
4586
 
            $rm $cwrappersource $cwrapper
4587
 
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4879
            output_name=`basename $output`
 
4880
            output_path=`dirname $output`
 
4881
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4882
            cwrapper="$output_path/$output_name.exe"
 
4883
            $rm $cwrappersource $cwrapper
 
4884
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4588
4885
 
4589
4886
            cat > $cwrappersource <<EOF
4590
4887
 
4609
4906
#include <malloc.h>
4610
4907
#include <stdarg.h>
4611
4908
#include <assert.h>
 
4909
#include <string.h>
 
4910
#include <ctype.h>
 
4911
#include <sys/stat.h>
4612
4912
 
4613
4913
#if defined(PATH_MAX)
4614
4914
# define LT_PATHMAX PATH_MAX
4619
4919
#endif
4620
4920
 
4621
4921
#ifndef DIR_SEPARATOR
4622
 
#define DIR_SEPARATOR '/'
 
4922
# define DIR_SEPARATOR '/'
 
4923
# define PATH_SEPARATOR ':'
4623
4924
#endif
4624
4925
 
4625
4926
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4626
4927
  defined (__OS2__)
4627
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4628
 
#ifndef DIR_SEPARATOR_2
4629
 
#define DIR_SEPARATOR_2 '\\'
4630
 
#endif
 
4928
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4929
# ifndef DIR_SEPARATOR_2
 
4930
#  define DIR_SEPARATOR_2 '\\'
 
4931
# endif
 
4932
# ifndef PATH_SEPARATOR_2
 
4933
#  define PATH_SEPARATOR_2 ';'
 
4934
# endif
4631
4935
#endif
4632
4936
 
4633
4937
#ifndef DIR_SEPARATOR_2
4637
4941
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4638
4942
#endif /* DIR_SEPARATOR_2 */
4639
4943
 
 
4944
#ifndef PATH_SEPARATOR_2
 
4945
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4946
#else /* PATH_SEPARATOR_2 */
 
4947
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4948
#endif /* PATH_SEPARATOR_2 */
 
4949
 
4640
4950
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4641
4951
#define XFREE(stale) do { \
4642
4952
  if (stale) { free ((void *) stale); stale = 0; } \
4643
4953
} while (0)
4644
4954
 
 
4955
/* -DDEBUG is fairly common in CFLAGS.  */
 
4956
#undef DEBUG
 
4957
#if defined DEBUGWRAPPER
 
4958
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
4959
#else
 
4960
# define DEBUG(format, ...)
 
4961
#endif
 
4962
 
4645
4963
const char *program_name = NULL;
4646
4964
 
4647
4965
void * xmalloc (size_t num);
4648
4966
char * xstrdup (const char *string);
4649
 
char * basename (const char *name);
4650
 
char * fnqualify(const char *path);
 
4967
const char * base_name (const char *name);
 
4968
char * find_executable(const char *wrapper);
 
4969
int    check_executable(const char *path);
4651
4970
char * strendzap(char *str, const char *pat);
4652
4971
void lt_fatal (const char *message, ...);
4653
4972
 
4657
4976
  char **newargz;
4658
4977
  int i;
4659
4978
 
4660
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4979
  program_name = (char *) xstrdup (base_name (argv[0]));
 
4980
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
4981
  DEBUG("(main) program_name : %s\n",program_name);
4661
4982
  newargz = XMALLOC(char *, argc+2);
4662
4983
EOF
4663
4984
 
4664
 
            cat >> $cwrappersource <<EOF
4665
 
  newargz[0] = "$SHELL";
 
4985
            cat >> $cwrappersource <<EOF
 
4986
  newargz[0] = (char *) xstrdup("$SHELL");
4666
4987
EOF
4667
4988
 
4668
 
            cat >> $cwrappersource <<"EOF"
4669
 
  newargz[1] = fnqualify(argv[0]);
 
4989
            cat >> $cwrappersource <<"EOF"
 
4990
  newargz[1] = find_executable(argv[0]);
 
4991
  if (newargz[1] == NULL)
 
4992
    lt_fatal("Couldn't find %s", argv[0]);
 
4993
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4670
4994
  /* we know the script has the same name, without the .exe */
4671
4995
  /* so make sure newargz[1] doesn't end in .exe */
4672
4996
  strendzap(newargz[1],".exe");
4673
4997
  for (i = 1; i < argc; i++)
4674
4998
    newargz[i+1] = xstrdup(argv[i]);
4675
4999
  newargz[argc+1] = NULL;
4676
 
EOF
4677
 
 
4678
 
            cat >> $cwrappersource <<EOF
 
5000
 
 
5001
  for (i=0; i<argc+1; i++)
 
5002
  {
 
5003
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
5004
    ;
 
5005
  }
 
5006
 
 
5007
EOF
 
5008
 
 
5009
            case $host_os in
 
5010
              mingw*)
 
5011
                cat >> $cwrappersource <<EOF
 
5012
  execv("$SHELL",(char const **)newargz);
 
5013
EOF
 
5014
              ;;
 
5015
              *)
 
5016
                cat >> $cwrappersource <<EOF
4679
5017
  execv("$SHELL",newargz);
4680
5018
EOF
 
5019
              ;;
 
5020
            esac
4681
5021
 
4682
 
            cat >> $cwrappersource <<"EOF"
 
5022
            cat >> $cwrappersource <<"EOF"
 
5023
  return 127;
4683
5024
}
4684
5025
 
4685
5026
void *
4699
5040
;
4700
5041
}
4701
5042
 
4702
 
char *
4703
 
basename (const char *name)
 
5043
const char *
 
5044
base_name (const char *name)
4704
5045
{
4705
5046
  const char *base;
4706
5047
 
4707
5048
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4708
5049
  /* Skip over the disk name in MSDOS pathnames. */
4709
 
  if (isalpha (name[0]) && name[1] == ':')
 
5050
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4710
5051
    name += 2;
4711
5052
#endif
4712
5053
 
4713
5054
  for (base = name; *name; name++)
4714
5055
    if (IS_DIR_SEPARATOR (*name))
4715
5056
      base = name + 1;
4716
 
  return (char *) base;
4717
 
}
4718
 
 
 
5057
  return base;
 
5058
}
 
5059
 
 
5060
int
 
5061
check_executable(const char * path)
 
5062
{
 
5063
  struct stat st;
 
5064
 
 
5065
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
 
5066
  if ((!path) || (!*path))
 
5067
    return 0;
 
5068
 
 
5069
  if ((stat (path, &st) >= 0) &&
 
5070
      (
 
5071
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5072
#if defined (S_IXOTH)
 
5073
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
5074
#endif
 
5075
#if defined (S_IXGRP)
 
5076
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
5077
#endif
 
5078
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5079
      )
 
5080
    return 1;
 
5081
  else
 
5082
    return 0;
 
5083
}
 
5084
 
 
5085
/* Searches for the full path of the wrapper.  Returns
 
5086
   newly allocated full path name if found, NULL otherwise */
4719
5087
char *
4720
 
fnqualify(const char *path)
 
5088
find_executable (const char* wrapper)
4721
5089
{
4722
 
  size_t size;
4723
 
  char *p;
 
5090
  int has_slash = 0;
 
5091
  const char* p;
 
5092
  const char* p_next;
 
5093
  /* static buffer for getcwd */
4724
5094
  char tmp[LT_PATHMAX + 1];
4725
 
 
4726
 
  assert(path != NULL);
4727
 
 
4728
 
  /* Is it qualified already? */
4729
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4730
 
  if (isalpha (path[0]) && path[1] == ':')
4731
 
    return xstrdup (path);
4732
 
#endif
4733
 
  if (IS_DIR_SEPARATOR (path[0]))
4734
 
    return xstrdup (path);
4735
 
 
4736
 
  /* prepend the current directory */
4737
 
  /* doesn't handle '~' */
 
5095
  int tmp_len;
 
5096
  char* concat_name;
 
5097
 
 
5098
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
 
5099
 
 
5100
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
5101
    return NULL;
 
5102
 
 
5103
  /* Absolute path? */
 
5104
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5105
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
5106
  {
 
5107
    concat_name = xstrdup (wrapper);
 
5108
    if (check_executable(concat_name))
 
5109
      return concat_name;
 
5110
    XFREE(concat_name);
 
5111
  }
 
5112
  else
 
5113
  {
 
5114
#endif
 
5115
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
5116
    {
 
5117
      concat_name = xstrdup (wrapper);
 
5118
      if (check_executable(concat_name))
 
5119
        return concat_name;
 
5120
      XFREE(concat_name);
 
5121
    }
 
5122
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5123
  }
 
5124
#endif
 
5125
 
 
5126
  for (p = wrapper; *p; p++)
 
5127
    if (*p == '/')
 
5128
    {
 
5129
      has_slash = 1;
 
5130
      break;
 
5131
    }
 
5132
  if (!has_slash)
 
5133
  {
 
5134
    /* no slashes; search PATH */
 
5135
    const char* path = getenv ("PATH");
 
5136
    if (path != NULL)
 
5137
    {
 
5138
      for (p = path; *p; p = p_next)
 
5139
      {
 
5140
        const char* q;
 
5141
        size_t p_len;
 
5142
        for (q = p; *q; q++)
 
5143
          if (IS_PATH_SEPARATOR(*q))
 
5144
            break;
 
5145
        p_len = q - p;
 
5146
        p_next = (*q == '\0' ? q : q + 1);
 
5147
        if (p_len == 0)
 
5148
        {
 
5149
          /* empty path: current directory */
 
5150
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5151
            lt_fatal ("getcwd failed");
 
5152
          tmp_len = strlen(tmp);
 
5153
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5154
          memcpy (concat_name, tmp, tmp_len);
 
5155
          concat_name[tmp_len] = '/';
 
5156
          strcpy (concat_name + tmp_len + 1, wrapper);
 
5157
        }
 
5158
        else
 
5159
        {
 
5160
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
5161
          memcpy (concat_name, p, p_len);
 
5162
          concat_name[p_len] = '/';
 
5163
          strcpy (concat_name + p_len + 1, wrapper);
 
5164
        }
 
5165
        if (check_executable(concat_name))
 
5166
          return concat_name;
 
5167
        XFREE(concat_name);
 
5168
      }
 
5169
    }
 
5170
    /* not found in PATH; assume curdir */
 
5171
  }
 
5172
  /* Relative path | not found in path: prepend cwd */
4738
5173
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4739
5174
    lt_fatal ("getcwd failed");
4740
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4741
 
  p = XMALLOC(char, size);
4742
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4743
 
  return p;
 
5175
  tmp_len = strlen(tmp);
 
5176
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5177
  memcpy (concat_name, tmp, tmp_len);
 
5178
  concat_name[tmp_len] = '/';
 
5179
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5180
 
 
5181
  if (check_executable(concat_name))
 
5182
    return concat_name;
 
5183
  XFREE(concat_name);
 
5184
  return NULL;
4744
5185
}
4745
5186
 
4746
5187
char *
4784
5225
  va_end (ap);
4785
5226
}
4786
5227
EOF
4787
 
          # we should really use a build-platform specific compiler
4788
 
          # here, but OTOH, the wrappers (shell script and this C one)
4789
 
          # are only useful if you want to execute the "real" binary.
4790
 
          # Since the "real" binary is built for $host, then this
4791
 
          # wrapper might as well be built for $host, too.
4792
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4793
 
          ;;
4794
 
        esac
4795
 
        $rm $output
4796
 
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
 
5228
          # we should really use a build-platform specific compiler
 
5229
          # here, but OTOH, the wrappers (shell script and this C one)
 
5230
          # are only useful if you want to execute the "real" binary.
 
5231
          # Since the "real" binary is built for $host, then this
 
5232
          # wrapper might as well be built for $host, too.
 
5233
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5234
          ;;
 
5235
        esac
 
5236
        $rm $output
 
5237
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4797
5238
 
4798
5239
        $echo > $output "\
4799
5240
#! $SHELL
4814
5255
 
4815
5256
# The HP-UX ksh and POSIX shell print the target directory to stdout
4816
5257
# if CDPATH is set.
4817
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
5258
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4818
5259
 
4819
5260
relink_command=\"$relink_command\"
4820
5261
 
4943
5384
        # Backslashes separate directories on plain windows
4944
5385
        *-*-mingw | *-*-os2*)
4945
5386
          $echo >> $output "\
4946
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5387
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4947
5388
"
4948
5389
          ;;
4949
5390
 
4950
5391
        *)
4951
5392
          $echo >> $output "\
4952
 
      exec \$progdir/\$program \${1+\"\$@\"}
 
5393
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
4953
5394
"
4954
5395
          ;;
4955
5396
        esac
4959
5400
    fi
4960
5401
  else
4961
5402
    # The program doesn't exist.
4962
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5403
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4963
5404
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4964
5405
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4965
5406
    exit $EXIT_FAILURE
4991
5432
 
4992
5433
      if test -n "$addlibs"; then
4993
5434
        gentop="$output_objdir/${outputname}x"
4994
 
        $show "${rm}r $gentop"
4995
 
        $run ${rm}r "$gentop"
4996
 
        $show "$mkdir $gentop"
4997
 
        $run $mkdir "$gentop"
4998
 
        status=$?
4999
 
        if test "$status" -ne 0 && test ! -d "$gentop"; then
5000
 
          exit $status
5001
 
        fi
5002
5435
        generated="$generated $gentop"
5003
5436
 
5004
 
        # Add in members from convenience archives.
5005
 
        for xlib in $addlibs; do
5006
 
          # Extract the objects.
5007
 
          case $xlib in
5008
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5009
 
          *) xabs=`pwd`"/$xlib" ;;
5010
 
          esac
5011
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5012
 
          xdir="$gentop/$xlib"
5013
 
 
5014
 
          $show "${rm}r $xdir"
5015
 
          $run ${rm}r "$xdir"
5016
 
          $show "$mkdir $xdir"
5017
 
          $run $mkdir "$xdir"
5018
 
          status=$?
5019
 
          if test "$status" -ne 0 && test ! -d "$xdir"; then
5020
 
            exit $status
5021
 
          fi
5022
 
          # We will extract separately just the conflicting names and we will no
5023
 
          # longer touch any unique names. It is faster to leave these extract
5024
 
          # automatically by $AR in one run.
5025
 
          $show "(cd $xdir && $AR x $xabs)"
5026
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5027
 
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5028
 
            :
5029
 
          else
5030
 
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5031
 
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5032
 
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
5033
 
            do
5034
 
              i=1
5035
 
              while test "$i" -le "$count"
5036
 
              do
5037
 
               # Put our $i before any first dot (extension)
5038
 
               # Never overwrite any file
5039
 
               name_to="$name"
5040
 
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5041
 
               do
5042
 
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5043
 
               done
5044
 
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5045
 
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5046
 
               i=`expr $i + 1`
5047
 
              done
5048
 
            done
5049
 
          fi
5050
 
 
5051
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5052
 
        done
 
5437
        func_extract_archives $gentop $addlibs
 
5438
        oldobjs="$oldobjs $func_extract_archives_result"
5053
5439
      fi
5054
5440
 
5055
5441
      # Do each command in the archive commands.
5056
5442
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5057
5443
       cmds=$old_archive_from_new_cmds
5058
5444
      else
 
5445
        # POSIX demands no paths to be encoded in archives.  We have
 
5446
        # to avoid creating archives with duplicate basenames if we
 
5447
        # might have to extract them afterwards, e.g., when creating a
 
5448
        # static archive out of a convenience library, or when linking
 
5449
        # the entirety of a libtool archive into another (currently
 
5450
        # not supported by libtool).
 
5451
        if (for obj in $oldobjs
 
5452
            do
 
5453
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5454
            done | sort | sort -uc >/dev/null 2>&1); then
 
5455
          :
 
5456
        else
 
5457
          $echo "copying selected object files to avoid basename conflicts..."
 
5458
 
 
5459
          if test -z "$gentop"; then
 
5460
            gentop="$output_objdir/${outputname}x"
 
5461
            generated="$generated $gentop"
 
5462
 
 
5463
            $show "${rm}r $gentop"
 
5464
            $run ${rm}r "$gentop"
 
5465
            $show "$mkdir $gentop"
 
5466
            $run $mkdir "$gentop"
 
5467
            exit_status=$?
 
5468
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5469
              exit $exit_status
 
5470
            fi
 
5471
          fi
 
5472
 
 
5473
          save_oldobjs=$oldobjs
 
5474
          oldobjs=
 
5475
          counter=1
 
5476
          for obj in $save_oldobjs
 
5477
          do
 
5478
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5479
            case " $oldobjs " in
 
5480
            " ") oldobjs=$obj ;;
 
5481
            *[\ /]"$objbase "*)
 
5482
              while :; do
 
5483
                # Make sure we don't pick an alternate name that also
 
5484
                # overlaps.
 
5485
                newobj=lt$counter-$objbase
 
5486
                counter=`expr $counter + 1`
 
5487
                case " $oldobjs " in
 
5488
                *[\ /]"$newobj "*) ;;
 
5489
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5490
                esac
 
5491
              done
 
5492
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5493
              $run ln "$obj" "$gentop/$newobj" ||
 
5494
              $run cp "$obj" "$gentop/$newobj"
 
5495
              oldobjs="$oldobjs $gentop/$newobj"
 
5496
              ;;
 
5497
            *) oldobjs="$oldobjs $obj" ;;
 
5498
            esac
 
5499
          done
 
5500
        fi
 
5501
 
5059
5502
        eval cmds=\"$old_archive_cmds\"
5060
5503
 
5061
5504
        if len=`expr "X$cmds" : ".*"` &&
5069
5512
          objlist=
5070
5513
          concat_cmds=
5071
5514
          save_oldobjs=$oldobjs
5072
 
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5073
 
          # encoded into archives.  This makes 'ar r' malfunction in
5074
 
          # this piecewise linking case whenever conflicting object
5075
 
          # names appear in distinct ar calls; check, warn and compensate.
5076
 
            if (for obj in $save_oldobjs
5077
 
            do
5078
 
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
5079
 
            done | sort | sort -uc >/dev/null 2>&1); then
5080
 
            :
5081
 
          else
5082
 
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5083
 
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5084
 
            AR_FLAGS=cq
5085
 
          fi
 
5515
 
5086
5516
          # Is there a better way of finding the last object in the list?
5087
5517
          for obj in $save_oldobjs
5088
5518
          do
5093
5523
            oldobjs="$objlist $obj"
5094
5524
            objlist="$objlist $obj"
5095
5525
            eval test_cmds=\"$old_archive_cmds\"
5096
 
            if len=`expr "X$test_cmds" : ".*"` &&
 
5526
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5097
5527
               test "$len" -le "$max_cmd_len"; then
5098
5528
              :
5099
5529
            else
5290
5720
    # install_prog (especially on Windows NT).
5291
5721
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5292
5722
       # Allow the use of GNU shtool's install command.
5293
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5723
       $echo "X$nonopt" | grep shtool > /dev/null; then
5294
5724
      # Aesthetically quote it.
5295
5725
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5296
5726
      case $arg in
5297
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5727
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5298
5728
        arg="\"$arg\""
5299
5729
        ;;
5300
5730
      esac
5303
5733
      shift
5304
5734
    else
5305
5735
      install_prog=
5306
 
      arg="$nonopt"
 
5736
      arg=$nonopt
5307
5737
    fi
5308
5738
 
5309
5739
    # The real first argument should be the name of the installation program.
5310
5740
    # Aesthetically quote it.
5311
5741
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5312
5742
    case $arg in
5313
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5743
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5314
5744
      arg="\"$arg\""
5315
5745
      ;;
5316
5746
    esac
5328
5758
    do
5329
5759
      if test -n "$dest"; then
5330
5760
        files="$files $dest"
5331
 
        dest="$arg"
 
5761
        dest=$arg
5332
5762
        continue
5333
5763
      fi
5334
5764
 
5335
5765
      case $arg in
5336
5766
      -d) isdir=yes ;;
5337
 
      -f) prev="-f" ;;
5338
 
      -g) prev="-g" ;;
5339
 
      -m) prev="-m" ;;
5340
 
      -o) prev="-o" ;;
 
5767
      -f) 
 
5768
        case " $install_prog " in
 
5769
        *[\\\ /]cp\ *) ;;
 
5770
        *) prev=$arg ;;
 
5771
        esac
 
5772
        ;;
 
5773
      -g | -m | -o) prev=$arg ;;
5341
5774
      -s)
5342
5775
        stripme=" -s"
5343
5776
        continue
5344
5777
        ;;
5345
 
      -*) ;;
5346
 
 
 
5778
      -*)
 
5779
        ;;
5347
5780
      *)
5348
5781
        # If the previous option needed an argument, then skip it.
5349
5782
        if test -n "$prev"; then
5350
5783
          prev=
5351
5784
        else
5352
 
          dest="$arg"
 
5785
          dest=$arg
5353
5786
          continue
5354
5787
        fi
5355
5788
        ;;
5358
5791
      # Aesthetically quote the argument.
5359
5792
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5360
5793
      case $arg in
5361
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5794
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5362
5795
        arg="\"$arg\""
5363
5796
        ;;
5364
5797
      esac
5527
5960
 
5528
5961
          if test "$#" -gt 0; then
5529
5962
            # Delete the old symlinks, and create new ones.
 
5963
            # Try `ln -sf' first, because the `ln' binary might depend on
 
5964
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
5965
            # so we also need to try rm && ln -s.
5530
5966
            for linkname
5531
5967
            do
5532
5968
              if test "$linkname" != "$realname"; then
5533
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5534
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
5969
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
5970
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5535
5971
              fi
5536
5972
            done
5537
5973
          fi
5544
5980
            IFS="$save_ifs"
5545
5981
            eval cmd=\"$cmd\"
5546
5982
            $show "$cmd"
5547
 
            $run eval "$cmd" || exit $?
 
5983
            $run eval "$cmd" || {
 
5984
              lt_exit=$?
 
5985
 
 
5986
              # Restore the uninstalled library and exit
 
5987
              if test "$mode" = relink; then
 
5988
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
5989
              fi
 
5990
 
 
5991
              exit $lt_exit
 
5992
            }
5548
5993
          done
5549
5994
          IFS="$save_ifs"
5550
5995
        fi
5638
6083
          notinst_deplibs=
5639
6084
          relink_command=
5640
6085
 
5641
 
          # To insure that "foo" is sourced, and not "foo.exe",
5642
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5643
 
          # which disallows the automatic-append-.exe behavior.
5644
 
          case $build in
5645
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5646
 
          *) wrapperdot=${wrapper} ;;
5647
 
          esac
 
6086
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6087
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6088
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6089
          # `FILE.' does not work on cygwin managed mounts.
 
6090
          #
5648
6091
          # If there is no directory component, then add one.
5649
 
          case $file in
5650
 
          */* | *\\*) . ${wrapperdot} ;;
5651
 
          *) . ./${wrapperdot} ;;
 
6092
          case $wrapper in
 
6093
          */* | *\\*) . ${wrapper} ;;
 
6094
          *) . ./${wrapper} ;;
5652
6095
          esac
5653
6096
 
5654
6097
          # Check the variables that should have been set.
5676
6119
          done
5677
6120
 
5678
6121
          relink_command=
5679
 
          # To insure that "foo" is sourced, and not "foo.exe",
5680
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5681
 
          # which disallows the automatic-append-.exe behavior.
5682
 
          case $build in
5683
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5684
 
          *) wrapperdot=${wrapper} ;;
5685
 
          esac
 
6122
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6123
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6124
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6125
          # `FILE.' does not work on cygwin managed mounts.
 
6126
          #
5686
6127
          # If there is no directory component, then add one.
5687
 
          case $file in
5688
 
          */* | *\\*) . ${wrapperdot} ;;
5689
 
          *) . ./${wrapperdot} ;;
 
6128
          case $wrapper in
 
6129
          */* | *\\*) . ${wrapper} ;;
 
6130
          *) . ./${wrapper} ;;
5690
6131
          esac
5691
6132
 
5692
6133
          outputname=
5693
6134
          if test "$fast_install" = no && test -n "$relink_command"; then
5694
6135
            if test "$finalize" = yes && test -z "$run"; then
5695
 
              tmpdir="/tmp"
5696
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5697
 
              tmpdir="$tmpdir/libtool-$$"
5698
 
              save_umask=`umask`
5699
 
              umask 0077
5700
 
              if $mkdir "$tmpdir"; then
5701
 
                umask $save_umask
5702
 
              else
5703
 
                umask $save_umask
5704
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5705
 
                continue
5706
 
              fi
 
6136
              tmpdir=`func_mktempdir`
5707
6137
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5708
6138
              outputname="$tmpdir/$file"
5709
6139
              # Replace the output file specification.
5727
6157
        fi
5728
6158
 
5729
6159
        # remove .exe since cygwin /usr/bin/install will append another
5730
 
        # one anyways
 
6160
        # one anyway 
5731
6161
        case $install_prog,$host in
5732
6162
        */usr/bin/install*,*cygwin*)
5733
6163
          case $file:$destfile in
5827
6257
    # Exit here if they wanted silent mode.
5828
6258
    test "$show" = : && exit $EXIT_SUCCESS
5829
6259
 
5830
 
    $echo "----------------------------------------------------------------------"
 
6260
    $echo "X----------------------------------------------------------------------" | $Xsed
5831
6261
    $echo "Libraries have been installed in:"
5832
6262
    for libdir in $libdirs; do
5833
6263
      $echo "   $libdir"
5860
6290
    $echo
5861
6291
    $echo "See any operating system documentation about shared libraries for"
5862
6292
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5863
 
    $echo "----------------------------------------------------------------------"
 
6293
    $echo "X----------------------------------------------------------------------" | $Xsed
5864
6294
    exit $EXIT_SUCCESS
5865
6295
    ;;
5866
6296
 
6077
6507
            rmfiles="$rmfiles $objdir/$n"
6078
6508
          done
6079
6509
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6080
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6081
6510
 
6082
 
          if test "$mode" = uninstall; then
 
6511
          case "$mode" in
 
6512
          clean)
 
6513
            case "  $library_names " in
 
6514
            # "  " in the beginning catches empty $dlname
 
6515
            *" $dlname "*) ;;
 
6516
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6517
            esac
 
6518
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6519
            ;;
 
6520
          uninstall)
6083
6521
            if test -n "$library_names"; then
6084
6522
              # Do each command in the postuninstall commands.
6085
6523
              cmds=$postuninstall_cmds
6112
6550
              IFS="$save_ifs"
6113
6551
            fi
6114
6552
            # FIXME: should reinstall the best remaining shared library.
6115
 
          fi
 
6553
            ;;
 
6554
          esac
6116
6555
        fi
6117
6556
        ;;
6118
6557
 
6397
6836
$echo
6398
6837
$echo "Try \`$modename --help' for more information about other modes."
6399
6838
 
6400
 
exit $EXIT_SUCCESS
 
6839
exit $?
6401
6840
 
6402
6841
# The TAGs below are defined such that we never get into a situation
6403
6842
# in which we disable both kinds of libraries.  Given conflicting
6411
6850
# configuration.  But we'll never go from static-only to shared-only.
6412
6851
 
6413
6852
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6414
 
build_libtool_libs=no
6415
 
build_old_libs=yes
 
6853
disable_libs=shared
6416
6854
# ### END LIBTOOL TAG CONFIG: disable-shared
6417
6855
 
6418
6856
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6419
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6857
disable_libs=static
6420
6858
# ### END LIBTOOL TAG CONFIG: disable-static
6421
6859
 
6422
6860
# Local Variables: