~ubuntu-branches/ubuntu/precise/kde-i18n-sk/precise

« back to all changes in this revision

Viewing changes to admin/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-10-01 15:22:40 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20071001152240-o5uqnq08qlizm1z2
Tags: 4:3.5.8~pre20071001-0ubuntu1
New snapshot

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
 
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
#
24
24
# configuration script generated by Autoconf, you may include it under
25
25
# the same distribution terms that you use for the rest of that program.
26
26
 
 
27
basename="s,^.*/,,g"
 
28
 
 
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
 
30
# is ksh but when the shell is invoked as "sh" and the current value of
 
31
# the _XPG environment variable is not equal to 1 (one), the special
 
32
# positional parameter $0, within a function call, is the name of the
 
33
# function.
 
34
progpath="$0"
 
35
 
 
36
# The name of this program:
 
37
progname=`echo "$progpath" | $SED $basename`
 
38
modename="$progname"
 
39
 
 
40
# Global variables:
 
41
EXIT_SUCCESS=0
 
42
EXIT_FAILURE=1
 
43
 
 
44
PROGRAM=ltmain.sh
 
45
PACKAGE=libtool
 
46
VERSION="1.5.22 Debian 1.5.22-4"
 
47
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
 
48
 
 
49
# See if we are running on zsh, and set the options which allow our
 
50
# commands through without removal of \ escapes.
 
51
if test -n "${ZSH_VERSION+set}" ; then
 
52
  setopt NO_GLOB_SUBST
 
53
fi
 
54
 
27
55
# Check that we have a working $echo.
28
56
if test "X$1" = X--no-reexec; then
29
57
  # Discard the --no-reexec flag, and continue.
36
64
  :
37
65
else
38
66
  # Restart under the correct shell, and then maybe $echo will work.
39
 
  exec $SHELL "$0" --no-reexec ${1+"$@"}
 
67
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
40
68
fi
41
69
 
42
70
if test "X$1" = X--fallback-echo; then
45
73
  cat <<EOF
46
74
$*
47
75
EOF
48
 
  exit 0
 
76
  exit $EXIT_SUCCESS
49
77
fi
50
78
 
51
 
# The name of this program.
52
 
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53
 
modename="$progname"
54
 
 
55
 
# Constants.
56
 
PROGRAM=ltmain.sh
57
 
PACKAGE=libtool
58
 
VERSION=1.5a
59
 
TIMESTAMP=" (1.1240 2003/06/26 06:55:19)"
60
 
 
61
79
default_mode=
62
80
help="Try \`$progname --help' for more information."
63
81
magic="%%%MAGIC variable%%%"
70
88
Xsed="${SED}"' -e 1s/^X//'
71
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
90
# test EBCDIC or ASCII
73
 
case `echo A|tr A '\301'` in
74
 
 A) # EBCDIC based system
75
 
  SP2NL="tr '\100' '\n'"
76
 
  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'
77
96
  ;;
78
 
 *) # Assume ASCII based system
79
 
  SP2NL="tr '\040' '\012'"
80
 
  NL2SP="tr '\015\012' '\040\040'"
 
97
 *) # EBCDIC based system
 
98
  SP2NL='tr \100 \n'
 
99
  NL2SP='tr \r\n \100\100'
81
100
  ;;
82
101
esac
83
102
 
94
113
fi
95
114
 
96
115
# Make sure IFS has a sensible default
97
 
: ${IFS="       "}
 
116
lt_nl='
 
117
'
 
118
IFS="   $lt_nl"
98
119
 
99
120
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100
121
  $echo "$modename: not configured to build any kind of library" 1>&2
101
122
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
102
 
  exit 1
 
123
  exit $EXIT_FAILURE
103
124
fi
104
125
 
105
126
# Global variables.
111
132
show="$echo"
112
133
show_help=
113
134
execute_dlfiles=
 
135
duplicate_deps=no
 
136
preserve_args=
114
137
lo2o="s/\\.lo\$/.${objext}/"
115
138
o2lo="s/\\.${objext}\$/.lo/"
116
139
 
118
141
# Shell function definitions:
119
142
# This seems to be the best place for them
120
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
 
 
181
# func_win32_libid arg
 
182
# return the library type of file 'arg'
 
183
#
121
184
# Need a lot of goo to handle *both* DLLs and import libs
122
185
# Has to be a shell function in order to 'eat' the argument
123
186
# that is supplied when $file_magic_command is called.
124
 
win32_libid () {
 
187
func_win32_libid ()
 
188
{
125
189
  win32_libid_type="unknown"
126
190
  win32_fileres=`file -L $1 2>/dev/null`
127
191
  case $win32_fileres in
130
194
    ;;
131
195
  *ar\ archive*) # could be an import, or static
132
196
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
133
 
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
197
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
134
198
      win32_nmres=`eval $NM -f posix -A $1 | \
135
 
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
136
 
      if test "X$win32_nmres" = "Ximport" ; then
137
 
        win32_libid_type="x86 archive import"
138
 
      else
139
 
        win32_libid_type="x86 archive static"
140
 
      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
141
204
    fi
142
205
    ;;
143
 
  *DLL*) 
 
206
  *DLL*)
144
207
    win32_libid_type="x86 DLL"
145
208
    ;;
146
209
  *executable*) # but shell scripts are "executable" too...
154
217
  $echo $win32_libid_type
155
218
}
156
219
 
 
220
 
 
221
# func_infer_tag arg
 
222
# Infer tagged configuration to use if any are available and
 
223
# if one wasn't chosen via the "--tag" command line option.
 
224
# Only attempt this if the compiler in the base compile
 
225
# command doesn't match the default compiler.
 
226
# arg is usually of the form 'gcc ...'
 
227
func_infer_tag ()
 
228
{
 
229
    if test -n "$available_tags" && test -z "$tagname"; then
 
230
      CC_quoted=
 
231
      for arg in $CC; do
 
232
        case $arg in
 
233
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
234
          arg="\"$arg\""
 
235
          ;;
 
236
        esac
 
237
        CC_quoted="$CC_quoted $arg"
 
238
      done
 
239
      case $@ in
 
240
      # Blanks in the command may have been stripped by the calling shell,
 
241
      # but not from the CC environment variable when configure was run.
 
242
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
243
      # Blanks at the start of $base_compile will cause this to fail
 
244
      # if we don't check for them as well.
 
245
      *)
 
246
        for z in $available_tags; do
 
247
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
248
            # Evaluate the configuration.
 
249
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
250
            CC_quoted=
 
251
            for arg in $CC; do
 
252
            # Double-quote args containing other shell metacharacters.
 
253
            case $arg in
 
254
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
255
              arg="\"$arg\""
 
256
              ;;
 
257
            esac
 
258
            CC_quoted="$CC_quoted $arg"
 
259
          done
 
260
            case "$@ " in
 
261
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
262
              # The compiler in the base compile command matches
 
263
              # the one in the tagged configuration.
 
264
              # Assume this is the tagged configuration we want.
 
265
              tagname=$z
 
266
              break
 
267
              ;;
 
268
            esac
 
269
          fi
 
270
        done
 
271
        # If $tagname still isn't set, then no tagged configuration
 
272
        # was found and let the user know that the "--tag" command
 
273
        # line option must be used.
 
274
        if test -z "$tagname"; then
 
275
          $echo "$modename: unable to infer tagged configuration"
 
276
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
277
          exit $EXIT_FAILURE
 
278
#        else
 
279
#          $echo "$modename: using $tagname tagged configuration"
 
280
        fi
 
281
        ;;
 
282
      esac
 
283
    fi
 
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
}
157
387
# End of Shell function definitions
158
388
#####################################
159
389
 
 
390
# Darwin sucks
 
391
eval std_shrext=\"$shrext_cmds\"
 
392
 
 
393
disable_libs=no
 
394
 
160
395
# Parse our command line options once, thoroughly.
161
396
while test "$#" -gt 0
162
397
do
176
411
      ;;
177
412
    tag)
178
413
      tagname="$arg"
 
414
      preserve_args="${preserve_args}=$arg"
179
415
 
180
416
      # Check whether tagname contains only valid characters
181
417
      case $tagname in
182
418
      *[!-_A-Za-z0-9,/]*)
183
419
        $echo "$progname: invalid tag name: $tagname" 1>&2
184
 
        exit 1
 
420
        exit $EXIT_FAILURE
185
421
        ;;
186
422
      esac
187
423
 
191
427
        # not specially marked.
192
428
        ;;
193
429
      *)
194
 
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
 
430
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
195
431
          taglist="$taglist $tagname"
196
432
          # Evaluate the configuration.
197
 
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
 
433
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
198
434
        else
199
435
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
200
436
        fi
220
456
  --version)
221
457
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
222
458
    $echo
223
 
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
 
459
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
224
460
    $echo "This is free software; see the source for copying conditions.  There is NO"
225
461
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
226
 
    exit 0
 
462
    exit $?
227
463
    ;;
228
464
 
229
465
  --config)
230
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
 
466
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
231
467
    # Now print the configurations for the tags.
232
468
    for tagname in $taglist; do
233
 
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
 
469
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
234
470
    done
235
 
    exit 0
 
471
    exit $?
236
472
    ;;
237
473
 
238
474
  --debug)
239
475
    $echo "$progname: enabling shell trace mode"
240
476
    set -x
 
477
    preserve_args="$preserve_args $arg"
241
478
    ;;
242
479
 
243
480
  --dry-run | -n)
256
493
    else
257
494
      $echo "disable static libraries"
258
495
    fi
259
 
    exit 0
 
496
    exit $?
260
497
    ;;
261
498
 
262
499
  --finish) mode="finish" ;;
268
505
 
269
506
  --quiet | --silent)
270
507
    show=:
 
508
    preserve_args="$preserve_args $arg"
271
509
    ;;
272
510
 
273
 
  --tag) prevopt="--tag" prev=tag ;;
 
511
  --tag)
 
512
    prevopt="--tag"
 
513
    prev=tag
 
514
    preserve_args="$preserve_args --tag"
 
515
    ;;
274
516
  --tag=*)
275
517
    set tag "$optarg" ${1+"$@"}
276
518
    shift
277
519
    prev=tag
 
520
    preserve_args="$preserve_args --tag"
278
521
    ;;
279
522
 
280
523
  -dlopen)
285
528
  -*)
286
529
    $echo "$modename: unrecognized option \`$arg'" 1>&2
287
530
    $echo "$help" 1>&2
288
 
    exit 1
 
531
    exit $EXIT_FAILURE
289
532
    ;;
290
533
 
291
534
  *)
298
541
if test -n "$prevopt"; then
299
542
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
300
543
  $echo "$help" 1>&2
301
 
  exit 1
 
544
  exit $EXIT_FAILURE
302
545
fi
303
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
 
304
559
# If this variable is set in any of the actions, the command in it
305
560
# will be execed at the end.  This prevents here-documents from being
306
561
# left over by shells.
311
566
  # Infer the operation mode.
312
567
  if test -z "$mode"; then
313
568
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
314
 
    $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
315
570
    case $nonopt in
316
571
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
317
572
      mode=link
354
609
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
355
610
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
356
611
    $echo "$help" 1>&2
357
 
    exit 1
 
612
    exit $EXIT_FAILURE
358
613
  fi
359
614
 
360
615
  # Change the help message to a mode-specific one.
369
624
    # Get the compilation command and the source file.
370
625
    base_compile=
371
626
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
627
    suppress_opt=yes
372
628
    suppress_output=
373
629
    arg_mode=normal
374
630
    libobj=
 
631
    later=
375
632
 
376
633
    for arg
377
634
    do
378
 
      case "$arg_mode" in
 
635
      case $arg_mode in
379
636
      arg  )
380
637
        # do not "continue".  Instead, add this to base_compile
381
638
        lastarg="$arg"
394
651
        -o)
395
652
          if test -n "$libobj" ; then
396
653
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
397
 
            exit 1
 
654
            exit $EXIT_FAILURE
398
655
          fi
399
656
          arg_mode=target
400
657
          continue
401
658
          ;;
402
659
 
403
 
        -static)
404
 
          build_old_libs=yes
405
 
          continue
406
 
          ;;
407
 
 
408
 
        -prefer-pic)
409
 
          pic_mode=yes
410
 
          continue
411
 
          ;;
412
 
 
413
 
        -prefer-non-pic)
414
 
          pic_mode=no
 
660
        -static | -prefer-pic | -prefer-non-pic)
 
661
          later="$later $arg"
 
662
          continue
 
663
          ;;
 
664
 
 
665
        -no-suppress)
 
666
          suppress_opt=no
415
667
          continue
416
668
          ;;
417
669
 
424
676
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
425
677
          lastarg=
426
678
          save_ifs="$IFS"; IFS=','
427
 
          for arg in $args; do
 
679
          for arg in $args; do
428
680
            IFS="$save_ifs"
429
681
 
430
682
            # Double-quote args containing other shell metacharacters.
462
714
      case $lastarg in
463
715
      # Double-quote args containing other shell metacharacters.
464
716
      # Many Bourne shells cannot handle close brackets correctly
465
 
      # 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.
466
721
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
467
722
        lastarg="\"$lastarg\""
468
723
        ;;
474
729
    case $arg_mode in
475
730
    arg)
476
731
      $echo "$modename: you must specify an argument for -Xcompile"
477
 
      exit 1
 
732
      exit $EXIT_FAILURE
478
733
      ;;
479
734
    target)
480
735
      $echo "$modename: you must specify a target with \`-o'" 1>&2
481
 
      exit 1
 
736
      exit $EXIT_FAILURE
482
737
      ;;
483
738
    *)
484
739
      # Get the name of the library object.
511
766
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
512
767
    *)
513
768
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
514
 
      exit 1
 
769
      exit $EXIT_FAILURE
515
770
      ;;
516
771
    esac
517
772
 
518
 
    # Infer tagged configuration to use if any are available and
519
 
    # if one wasn't chosen via the "--tag" command line option.
520
 
    # Only attempt this if the compiler in the base compile
521
 
    # command doesn't match the default compiler.
522
 
    if test -n "$available_tags" && test -z "$tagname"; then
523
 
      case $base_compile in
524
 
      # Blanks in the command may have been stripped by the calling shell,
525
 
      # but not from the CC environment variable when configure was run.
526
 
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
527
 
      # Blanks at the start of $base_compile will cause this to fail
528
 
      # if we don't check for them as well.
529
 
      *)
530
 
        for z in $available_tags; do
531
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
532
 
            # Evaluate the configuration.
533
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
534
 
            case "$base_compile " in
535
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
536
 
              # The compiler in the base compile command matches
537
 
              # the one in the tagged configuration.
538
 
              # Assume this is the tagged configuration we want.
539
 
              tagname=$z
540
 
              break
541
 
              ;;
542
 
            esac
543
 
          fi
544
 
        done
545
 
        # If $tagname still isn't set, then no tagged configuration
546
 
        # was found and let the user know that the "--tag" command
547
 
        # line option must be used.
548
 
        if test -z "$tagname"; then
549
 
          $echo "$modename: unable to infer tagged configuration"
550
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
551
 
          exit 1
552
 
#        else
553
 
#          $echo "$modename: using $tagname tagged configuration"
554
 
        fi
 
773
    func_infer_tag $base_compile
 
774
 
 
775
    for arg in $later; do
 
776
      case $arg in
 
777
      -static)
 
778
        build_old_libs=yes
 
779
        continue
 
780
        ;;
 
781
 
 
782
      -prefer-pic)
 
783
        pic_mode=yes
 
784
        continue
 
785
        ;;
 
786
 
 
787
      -prefer-non-pic)
 
788
        pic_mode=no
 
789
        continue
555
790
        ;;
556
791
      esac
557
 
    fi
 
792
    done
558
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."
559
802
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
560
803
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
561
804
    if test "X$xdir" = "X$obj"; then
568
811
    if test -z "$base_compile"; then
569
812
      $echo "$modename: you must specify a compilation command" 1>&2
570
813
      $echo "$help" 1>&2
571
 
      exit 1
 
814
      exit $EXIT_FAILURE
572
815
    fi
573
816
 
574
817
    # Delete any leftover library objects.
579
822
    fi
580
823
 
581
824
    $run $rm $removelist
582
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
825
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
583
826
 
584
827
    # On Cygwin there's no "real" PIC flag so we must build both object types
585
828
    case $host_os in
598
841
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
599
842
      lockfile="$output_obj.lock"
600
843
      removelist="$removelist $output_obj $lockfile"
601
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
844
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
602
845
    else
603
846
      output_obj=
604
847
      need_locks=no
608
851
    # Lock this critical section if it is needed
609
852
    # We use this script file to make the link, it avoids creating a new file
610
853
    if test "$need_locks" = yes; then
611
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
854
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
612
855
        $show "Waiting for $lockfile to be removed"
613
856
        sleep 2
614
857
      done
626
869
compiler."
627
870
 
628
871
        $run $rm $removelist
629
 
        exit 1
 
872
        exit $EXIT_FAILURE
630
873
      fi
631
 
      $echo $srcfile > "$lockfile"
 
874
      $echo "$srcfile" > "$lockfile"
632
875
    fi
633
876
 
634
877
    if test -n "$fix_srcfile_path"; then
635
878
      eval srcfile=\"$fix_srcfile_path\"
636
879
    fi
 
880
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
 
881
    case $qsrcfile in
 
882
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
883
      qsrcfile="\"$qsrcfile\"" ;;
 
884
    esac
637
885
 
638
886
    $run $rm "$libobj" "${libobj}T"
639
887
 
655
903
      fbsd_hideous_sh_bug=$base_compile
656
904
 
657
905
      if test "$pic_mode" != no; then
658
 
        command="$base_compile $srcfile $pic_flag"
 
906
        command="$base_compile $qsrcfile $pic_flag"
659
907
      else
660
908
        # Don't build PIC code
661
 
        command="$base_compile $srcfile"
 
909
        command="$base_compile $qsrcfile"
662
910
      fi
663
911
 
664
912
      if test ! -d "${xdir}$objdir"; then
665
913
        $show "$mkdir ${xdir}$objdir"
666
914
        $run $mkdir ${xdir}$objdir
667
 
        status=$?
668
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
669
 
          exit $status
 
915
        exit_status=$?
 
916
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
917
          exit $exit_status
670
918
        fi
671
919
      fi
672
920
 
681
929
      if $run eval "$command"; then :
682
930
      else
683
931
        test -n "$output_obj" && $run $rm $removelist
684
 
        exit 1
 
932
        exit $EXIT_FAILURE
685
933
      fi
686
934
 
687
935
      if test "$need_locks" = warn &&
701
949
compiler."
702
950
 
703
951
        $run $rm $removelist
704
 
        exit 1
 
952
        exit $EXIT_FAILURE
705
953
      fi
706
954
 
707
955
      # Just move the object if needed, then go on to compile the next one
722
970
EOF
723
971
 
724
972
      # Allow error messages only from the first compilation.
725
 
      suppress_output=' >/dev/null 2>&1'
 
973
      if test "$suppress_opt" = yes; then
 
974
        suppress_output=' >/dev/null 2>&1'
 
975
      fi
726
976
    else
727
977
      # No PIC object so indicate it doesn't exist in the libtool
728
978
      # object file.
736
986
    if test "$build_old_libs" = yes; then
737
987
      if test "$pic_mode" != yes; then
738
988
        # Don't build PIC code
739
 
        command="$base_compile $srcfile"
 
989
        command="$base_compile $qsrcfile"
740
990
      else
741
 
        command="$base_compile $srcfile $pic_flag"
 
991
        command="$base_compile $qsrcfile $pic_flag"
742
992
      fi
743
993
      if test "$compiler_c_o" = yes; then
744
994
        command="$command -o $obj"
751
1001
      if $run eval "$command"; then :
752
1002
      else
753
1003
        $run $rm $removelist
754
 
        exit 1
 
1004
        exit $EXIT_FAILURE
755
1005
      fi
756
1006
 
757
1007
      if test "$need_locks" = warn &&
771
1021
compiler."
772
1022
 
773
1023
        $run $rm $removelist
774
 
        exit 1
 
1024
        exit $EXIT_FAILURE
775
1025
      fi
776
1026
 
777
1027
      # Just move the object if needed
809
1059
      $run $rm "$lockfile"
810
1060
    fi
811
1061
 
812
 
    exit 0
 
1062
    exit $EXIT_SUCCESS
813
1063
    ;;
814
1064
 
815
1065
  # libtool link mode
835
1085
      ;;
836
1086
    esac
837
1087
    libtool_args="$nonopt"
838
 
    base_compile="$nonopt"
 
1088
    base_compile="$nonopt $@"
839
1089
    compile_command="$nonopt"
840
1090
    finalize_command="$nonopt"
841
1091
 
847
1097
    old_convenience=
848
1098
    deplibs=
849
1099
    old_deplibs=
850
 
    add_flags=
851
1100
    compiler_flags=
852
1101
    linker_flags=
853
1102
    dllsearchpath=
868
1117
    no_install=no
869
1118
    objs=
870
1119
    non_pic_objects=
 
1120
    notinst_path= # paths that contain not-installed libtool libraries
 
1121
    precious_files_regex=
871
1122
    prefer_static_libs=no
872
1123
    preload=no
873
1124
    prev=
881
1132
    vinfo=
882
1133
    vinfo_number=no
883
1134
 
 
1135
    func_infer_tag $base_compile
 
1136
 
884
1137
    # We need to know -static, to get the right output filenames.
885
1138
    for arg
886
1139
    do
893
1146
          if test -n "$link_static_flag"; then
894
1147
            dlopen_self=$dlopen_self_static
895
1148
          fi
 
1149
          prefer_static_libs=yes
896
1150
        else
897
1151
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
898
1152
            dlopen_self=$dlopen_self_static
899
1153
          fi
 
1154
          prefer_static_libs=built
900
1155
        fi
901
1156
        build_libtool_libs=no
902
1157
        build_old_libs=yes
903
 
        prefer_static_libs=yes
904
1158
        break
905
1159
        ;;
906
1160
      esac
912
1166
    # Go through the arguments, transforming them on the way.
913
1167
    while test "$#" -gt 0; do
914
1168
      arg="$1"
915
 
      base_compile="$base_compile $arg"
916
1169
      shift
917
1170
      case $arg in
918
1171
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
976
1229
          export_symbols="$arg"
977
1230
          if test ! -f "$arg"; then
978
1231
            $echo "$modename: symbol file \`$arg' does not exist"
979
 
            exit 1
 
1232
            exit $EXIT_FAILURE
980
1233
          fi
981
1234
          prev=
982
1235
          continue
991
1244
          prev=
992
1245
          continue
993
1246
          ;;
 
1247
        precious_regex)
 
1248
          precious_files_regex="$arg"
 
1249
          prev=
 
1250
          continue
 
1251
          ;;
994
1252
        release)
995
1253
          release="-$arg"
996
1254
          prev=
1023
1281
                   test "$pic_object" = none && \
1024
1282
                   test "$non_pic_object" = none; then
1025
1283
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1026
 
                  exit 1
 
1284
                  exit $EXIT_FAILURE
1027
1285
                fi
1028
1286
 
1029
1287
                # Extract subdirectory from the argument.
1071
1329
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1072
1330
                    arg="$non_pic_object"
1073
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"
1074
1337
                fi
1075
1338
              else
1076
1339
                # Only an error if not doing a dry-run.
1077
1340
                if test -z "$run"; then
1078
1341
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1079
 
                  exit 1
 
1342
                  exit $EXIT_FAILURE
1080
1343
                else
1081
1344
                  # Dry-run case.
1082
1345
 
1097
1360
            done
1098
1361
          else
1099
1362
            $echo "$modename: link input file \`$save_arg' does not exist"
1100
 
            exit 1
 
1363
            exit $EXIT_FAILURE
1101
1364
          fi
1102
1365
          arg=$save_arg
1103
1366
          prev=
1109
1372
          [\\/]* | [A-Za-z]:[\\/]*) ;;
1110
1373
          *)
1111
1374
            $echo "$modename: only absolute run-paths are allowed" 1>&2
1112
 
            exit 1
 
1375
            exit $EXIT_FAILURE
1113
1376
            ;;
1114
1377
          esac
1115
1378
          if test "$prev" = rpath; then
1149
1412
          finalize_command="$finalize_command $qarg"
1150
1413
          continue
1151
1414
          ;;
1152
 
        framework)
1153
 
          case $host in
1154
 
            *-*-darwin*)
1155
 
              case "$deplibs " in
1156
 
                *" $qarg.ltframework "*) ;;
1157
 
                *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
1158
 
                   ;;
1159
 
              esac
1160
 
              ;;
1161
 
          esac
 
1415
        shrext)
 
1416
          shrext_cmds="$arg"
 
1417
          prev=
 
1418
          continue
 
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"
1162
1424
          prev=
1163
1425
          continue
1164
1426
          ;;
1210
1472
      -export-symbols | -export-symbols-regex)
1211
1473
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1212
1474
          $echo "$modename: more than one -exported-symbols argument is not allowed"
1213
 
          exit 1
 
1475
          exit $EXIT_FAILURE
1214
1476
        fi
1215
1477
        if test "X$arg" = "X-export-symbols"; then
1216
1478
          prev=expsyms
1220
1482
        continue
1221
1483
        ;;
1222
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
 
1223
1497
      -inst-prefix-dir)
1224
1498
        prev=inst_prefix
1225
1499
        continue
1246
1520
          absdir=`cd "$dir" && pwd`
1247
1521
          if test -z "$absdir"; then
1248
1522
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1249
 
            exit 1
 
1523
            absdir="$dir"
 
1524
            notinst_path="$notinst_path $dir"
1250
1525
          fi
1251
1526
          dir="$absdir"
1252
1527
          ;;
1260
1535
        esac
1261
1536
        case $host in
1262
1537
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1538
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1263
1539
          case :$dllsearchpath: in
1264
1540
          *":$dir:"*) ;;
1265
1541
          *) dllsearchpath="$dllsearchpath:$dir";;
1266
1542
          esac
 
1543
          case :$dllsearchpath: in
 
1544
          *":$testbindir:"*) ;;
 
1545
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1546
          esac
1267
1547
          ;;
1268
1548
        esac
1269
1549
        continue
1272
1552
      -l*)
1273
1553
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1274
1554
          case $host in
1275
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1555
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1276
1556
            # These systems don't actually have a C or math library (as such)
1277
1557
            continue
1278
1558
            ;;
1279
 
          *-*-mingw* | *-*-os2*)
 
1559
          *-*-os2*)
1280
1560
            # These systems don't actually have a C library (as such)
1281
1561
            test "X$arg" = "X-lc" && continue
1282
1562
            ;;
1283
 
          *-*-openbsd* | *-*-freebsd*)
 
1563
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1284
1564
            # Do not include libc due to us having libc/libc_r.
1285
1565
            test "X$arg" = "X-lc" && continue
1286
1566
            ;;
1287
1567
          *-*-rhapsody* | *-*-darwin1.[012])
1288
1568
            # Rhapsody C and math libraries are in the System framework
1289
 
            deplibs="$deplibs System.ltframework"
 
1569
            deplibs="$deplibs -framework System"
1290
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
            ;;
1291
1580
          esac
1292
1581
        elif test "X$arg" = "X-lc_r"; then
1293
1582
         case $host in
1294
 
         *-*-openbsd*)
 
1583
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1295
1584
           # Do not include libc_r directly, use -pthread flag.
1296
1585
           continue
1297
1586
           ;;
1301
1590
        continue
1302
1591
        ;;
1303
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
 
 
1603
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1604
        compiler_flags="$compiler_flags $arg"
 
1605
        compile_command="$compile_command $arg"
 
1606
        finalize_command="$finalize_command $arg"
 
1607
        continue
 
1608
        ;;
 
1609
 
1304
1610
      -module)
1305
1611
        module=yes
1306
1612
        continue
1307
1613
        ;;
1308
1614
 
1309
 
      # gcc -m* arguments should be passed to the linker via $compiler_flags
1310
 
      # in order to pass architecture information to the linker
1311
 
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1312
 
      # but this is not reliable with gcc because gcc may use -mfoo to
1313
 
      # select a different linker, different libraries, etc, while
1314
 
      # -Wl,-mfoo simply passes -mfoo to the linker.
1315
 
      -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
 
1316
1628
        # Unknown arguments in both finalize_command and compile_command need
1317
1629
        # to be aesthetically quoted because they are evaled later.
1318
1630
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1323
1635
        esac
1324
1636
        compile_command="$compile_command $arg"
1325
1637
        finalize_command="$finalize_command $arg"
1326
 
        if test "$with_gcc" = "yes" ; then
1327
 
          compiler_flags="$compiler_flags $arg"
1328
 
        fi
 
1638
        compiler_flags="$compiler_flags $arg"
1329
1639
        continue
1330
1640
        ;;
1331
1641
 
1365
1675
 
1366
1676
      -o) prev=output ;;
1367
1677
 
 
1678
      -precious-files-regex)
 
1679
        prev=precious_regex
 
1680
        continue
 
1681
        ;;
 
1682
 
1368
1683
      -release)
1369
1684
        prev=release
1370
1685
        continue
1387
1702
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1388
1703
        *)
1389
1704
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1390
 
          exit 1
 
1705
          exit $EXIT_FAILURE
1391
1706
          ;;
1392
1707
        esac
1393
1708
        case "$xrpath " in
1473
1788
        continue
1474
1789
        ;;
1475
1790
 
1476
 
      -framework)
1477
 
        prev=framework
1478
 
        continue
1479
 
        ;;
1480
 
 
1481
1791
      # Some other compiler flag.
1482
1792
      -* | +*)
1483
1793
        # Unknown arguments in both finalize_command and compile_command need
1488
1798
          arg="\"$arg\""
1489
1799
          ;;
1490
1800
        esac
1491
 
        add_flags="$add_flags $arg"
1492
1801
        ;;
1493
1802
 
1494
1803
      *.$objext)
1516
1825
             test "$pic_object" = none && \
1517
1826
             test "$non_pic_object" = none; then
1518
1827
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1519
 
            exit 1
 
1828
            exit $EXIT_FAILURE
1520
1829
          fi
1521
1830
 
1522
1831
          # Extract subdirectory from the argument.
1564
1873
            if test -z "$pic_object" || test "$pic_object" = none ; then
1565
1874
              arg="$non_pic_object"
1566
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"
1567
1881
          fi
1568
1882
        else
1569
1883
          # Only an error if not doing a dry-run.
1570
1884
          if test -z "$run"; then
1571
1885
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1572
 
            exit 1
 
1886
            exit $EXIT_FAILURE
1573
1887
          else
1574
1888
            # Dry-run case.
1575
1889
 
1623
1937
          arg="\"$arg\""
1624
1938
          ;;
1625
1939
        esac
1626
 
        add_flags="$add_flags $arg"
1627
1940
        ;;
1628
1941
      esac # arg
1629
1942
 
1637
1950
    if test -n "$prev"; then
1638
1951
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1639
1952
      $echo "$help" 1>&2
1640
 
      exit 1
1641
 
    fi
1642
 
 
1643
 
    # Infer tagged configuration to use if any are available and
1644
 
    # if one wasn't chosen via the "--tag" command line option.
1645
 
    # Only attempt this if the compiler in the base link
1646
 
    # command doesn't match the default compiler.
1647
 
    if test -n "$available_tags" && test -z "$tagname"; then
1648
 
      case $base_compile in
1649
 
      # Blanks in the command may have been stripped by the calling shell,
1650
 
      # but not from the CC environment variable when configure was run.
1651
 
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1652
 
      # Blanks at the start of $base_compile will cause this to fail
1653
 
      # if we don't check for them as well.
1654
 
      *)
1655
 
        for z in $available_tags; do
1656
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1657
 
            # Evaluate the configuration.
1658
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1659
 
            case $base_compile in
1660
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1661
 
              # The compiler in $compile_command matches
1662
 
              # the one in the tagged configuration.
1663
 
              # Assume this is the tagged configuration we want.
1664
 
              tagname=$z
1665
 
              break
1666
 
              ;;
1667
 
            esac
1668
 
          fi
1669
 
        done
1670
 
        # If $tagname still isn't set, then no tagged configuration
1671
 
        # was found and let the user know that the "--tag" command
1672
 
        # line option must be used.
1673
 
        if test -z "$tagname"; then
1674
 
          $echo "$modename: unable to infer tagged configuration"
1675
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
1676
 
          exit 1
1677
 
#       else
1678
 
#         $echo "$modename: using $tagname tagged configuration"
1679
 
        fi
1680
 
        ;;
1681
 
      esac
 
1953
      exit $EXIT_FAILURE
1682
1954
    fi
1683
1955
 
1684
1956
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1711
1983
    if test ! -d "$output_objdir"; then
1712
1984
      $show "$mkdir $output_objdir"
1713
1985
      $run $mkdir $output_objdir
1714
 
      status=$?
1715
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1716
 
        exit $status
 
1986
      exit_status=$?
 
1987
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
1988
        exit $exit_status
1717
1989
      fi
1718
1990
    fi
1719
1991
 
1722
1994
    "")
1723
1995
      $echo "$modename: you must specify an output file" 1>&2
1724
1996
      $echo "$help" 1>&2
1725
 
      exit 1
 
1997
      exit $EXIT_FAILURE
1726
1998
      ;;
1727
1999
    *.$libext) linkmode=oldlib ;;
1728
2000
    *.lo | *.$objext) linkmode=obj ;;
1732
2004
 
1733
2005
    case $host in
1734
2006
    *cygwin* | *mingw* | *pw32*)
1735
 
      # don't eliminate duplcations in $postdeps and $predeps
 
2007
      # don't eliminate duplications in $postdeps and $predeps
1736
2008
      duplicate_compiler_generated_deps=yes
1737
2009
      ;;
1738
2010
    *)
1776
2048
    newlib_search_path=
1777
2049
    need_relink=no # whether we're linking any uninstalled libtool libraries
1778
2050
    notinst_deplibs= # not-installed libtool libraries
1779
 
    notinst_path= # paths that contain not-installed libtool libraries
1780
2051
    case $linkmode in
1781
2052
    lib)
1782
2053
        passes="conv link"
1785
2056
          *.la) ;;
1786
2057
          *)
1787
2058
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1788
 
            exit 1
 
2059
            exit $EXIT_FAILURE
1789
2060
            ;;
1790
2061
          esac
1791
2062
        done
1811
2082
        case $pass in
1812
2083
        dlopen) libs="$dlfiles" ;;
1813
2084
        dlpreopen) libs="$dlprefiles" ;;
1814
 
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
2085
        link)
 
2086
          libs="$deplibs %DEPLIBS%"
 
2087
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
 
2088
          ;;
1815
2089
        esac
1816
2090
      fi
1817
2091
      if test "$pass" = dlopen; then
1823
2097
        lib=
1824
2098
        found=no
1825
2099
        case $deplib in
 
2100
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
2101
          if test "$linkmode,$pass" = "prog,link"; then
 
2102
            compile_deplibs="$deplib $compile_deplibs"
 
2103
            finalize_deplibs="$deplib $finalize_deplibs"
 
2104
          else
 
2105
            compiler_flags="$compiler_flags $deplib"
 
2106
          fi
 
2107
          continue
 
2108
          ;;
1826
2109
        -l*)
1827
2110
          if test "$linkmode" != lib && test "$linkmode" != prog; then
1828
2111
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1829
2112
            continue
1830
2113
          fi
1831
 
          if test "$pass" = conv && test "$allow_undefined" = yes; then
1832
 
            deplibs="$deplib $deplibs"
1833
 
            continue
1834
 
          fi
1835
2114
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1836
2115
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1837
 
            for search_ext in .la $shrext .so .a; do
 
2116
            for search_ext in .la $std_shrext .so .a; do
1838
2117
              # Search the libtool library
1839
2118
              lib="$searchdir/lib${name}${search_ext}"
1840
2119
              if test -f "$lib"; then
1895
2174
            fi
1896
2175
          fi
1897
2176
          ;; # -l
1898
 
        *.ltframework)
1899
 
          if test "$linkmode,$pass" = "prog,link"; then
1900
 
            compile_deplibs="$deplib $compile_deplibs"
1901
 
            finalize_deplibs="$deplib $finalize_deplibs"
1902
 
          else
1903
 
            deplibs="$deplib $deplibs"
1904
 
            if test "$linkmode" = lib ; then
1905
 
              newdependency_libs="$deplib $newdependency_libs"
1906
 
            fi
1907
 
          fi
1908
 
          continue
1909
 
          ;;
1910
2177
        -L*)
1911
2178
          case $linkmode in
1912
2179
          lib)
1922
2189
            fi
1923
2190
            if test "$pass" = scan; then
1924
2191
              deplibs="$deplib $deplibs"
1925
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1926
2192
            else
1927
2193
              compile_deplibs="$deplib $compile_deplibs"
1928
2194
              finalize_deplibs="$deplib $finalize_deplibs"
1929
2195
            fi
 
2196
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1930
2197
            ;;
1931
2198
          *)
1932
2199
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1954
2221
          fi
1955
2222
          case $linkmode in
1956
2223
          lib)
1957
 
            if test "$deplibs_check_method" != pass_all; then
 
2224
            valid_a_lib=no
 
2225
            case $deplibs_check_method in
 
2226
              match_pattern*)
 
2227
                set dummy $deplibs_check_method
 
2228
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2229
                if eval $echo \"$deplib\" 2>/dev/null \
 
2230
                    | $SED 10q \
 
2231
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2232
                  valid_a_lib=yes
 
2233
                fi
 
2234
                ;;
 
2235
              pass_all)
 
2236
                valid_a_lib=yes
 
2237
                ;;
 
2238
            esac
 
2239
            if test "$valid_a_lib" != yes; then
1958
2240
              $echo
1959
2241
              $echo "*** Warning: Trying to link with static lib archive $deplib."
1960
2242
              $echo "*** I have the capability to make that library automatically link in when"
2004
2286
        esac # case $deplib
2005
2287
        if test "$found" = yes || test -f "$lib"; then :
2006
2288
        else
2007
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
2008
 
          exit 1
 
2289
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
 
2290
          exit $EXIT_FAILURE
2009
2291
        fi
2010
2292
 
2011
2293
        # Check to see that this really is a libtool archive.
2012
2294
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2013
2295
        else
2014
2296
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2015
 
          exit 1
 
2297
          exit $EXIT_FAILURE
2016
2298
        fi
2017
2299
 
2018
2300
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2028
2310
        # it will not redefine variables installed, or shouldnotlink
2029
2311
        installed=yes
2030
2312
        shouldnotlink=no
 
2313
        avoidtemprpath=
 
2314
 
2031
2315
 
2032
2316
        # Read the .la file
2033
2317
        case $lib in
2035
2319
        *) . ./$lib ;;
2036
2320
        esac
2037
2321
 
2038
 
        case $host in
2039
 
        *-*-darwin*)
2040
 
          # Convert "-framework foo" to "foo.ltframework" in dependency_libs
2041
 
          test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
2042
 
          ;;
2043
 
        esac
2044
 
 
2045
2322
        if test "$linkmode,$pass" = "lib,link" ||
2046
2323
           test "$linkmode,$pass" = "prog,scan" ||
2047
2324
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2052
2329
        if test "$pass" = conv; then
2053
2330
          # Only check for convenience libraries
2054
2331
          deplibs="$lib $deplibs"
2055
 
          tmp_libs=
2056
 
          for deplib in $dependency_libs; do
2057
 
            #echo "Adding $deplib to \$deplibs"
2058
 
            deplibs="$deplib $deplibs"
2059
 
            if test "X$duplicate_deps" = "Xyes" ; then
2060
 
              case "$tmp_libs " in
2061
 
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2062
 
              esac
2063
 
            fi
2064
 
            tmp_libs="$tmp_libs $deplib"
2065
 
          done
2066
2332
          if test -z "$libdir"; then
2067
2333
            if test -z "$old_library"; then
2068
2334
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2069
 
              exit 1
 
2335
              exit $EXIT_FAILURE
2070
2336
            fi
2071
2337
            # It is a libtool convenience library, so add in its objects.
2072
2338
            convenience="$convenience $ladir/$objdir/$old_library"
2073
2339
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
 
2340
            tmp_libs=
 
2341
            for deplib in $dependency_libs; do
 
2342
              deplibs="$deplib $deplibs"
 
2343
              if test "X$duplicate_deps" = "Xyes" ; then
 
2344
                case "$tmp_libs " in
 
2345
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2346
                esac
 
2347
              fi
 
2348
              tmp_libs="$tmp_libs $deplib"
 
2349
            done
2074
2350
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2075
2351
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2076
 
            exit 1
 
2352
            exit $EXIT_FAILURE
2077
2353
          fi
2078
2354
          continue
2079
2355
        fi # $pass = conv
2080
2356
 
2081
 
    
 
2357
 
2082
2358
        # Get the name of the library we link against.
2083
2359
        linklib=
2084
2360
        for l in $old_library $library_names; do
2086
2362
        done
2087
2363
        if test -z "$linklib"; then
2088
2364
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2089
 
          exit 1
 
2365
          exit $EXIT_FAILURE
2090
2366
        fi
2091
2367
 
2092
2368
        # This library was specified with -dlopen.
2093
2369
        if test "$pass" = dlopen; then
2094
2370
          if test -z "$libdir"; then
2095
2371
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2096
 
            exit 1
 
2372
            exit $EXIT_FAILURE
2097
2373
          fi
2098
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2374
          if test -z "$dlname" ||
 
2375
             test "$dlopen_support" != yes ||
 
2376
             test "$build_libtool_libs" = no; then
2099
2377
            # If there is no dlname, no dlopen support or we're linking
2100
2378
            # statically, we need to preload.  We also need to preload any
2101
2379
            # dependent libraries so libltdl's deplib preloader doesn't
2132
2410
            dir="$libdir"
2133
2411
            absdir="$libdir"
2134
2412
          fi
 
2413
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2135
2414
        else
2136
 
          dir="$ladir/$objdir"
2137
 
          absdir="$abs_ladir/$objdir"
2138
 
          # Remove this search path later
2139
 
          notinst_path="$notinst_path $abs_ladir"
 
2415
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2416
            dir="$ladir"
 
2417
            absdir="$abs_ladir"
 
2418
            # Remove this search path later
 
2419
            notinst_path="$notinst_path $abs_ladir"
 
2420
          else
 
2421
            dir="$ladir/$objdir"
 
2422
            absdir="$abs_ladir/$objdir"
 
2423
            # Remove this search path later
 
2424
            notinst_path="$notinst_path $abs_ladir"
 
2425
          fi
2140
2426
        fi # $installed = yes
2141
2427
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2142
2428
 
2144
2430
        if test "$pass" = dlpreopen; then
2145
2431
          if test -z "$libdir"; then
2146
2432
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2147
 
            exit 1
 
2433
            exit $EXIT_FAILURE
2148
2434
          fi
2149
2435
          # Prefer using a static library (so that no silly _DYNAMIC symbols
2150
2436
          # are required to link).
2171
2457
          continue
2172
2458
        fi
2173
2459
 
2174
 
    
 
2460
 
2175
2461
        if test "$linkmode" = prog && test "$pass" != link; then
2176
2462
          newlib_search_path="$newlib_search_path $ladir"
2177
2463
          deplibs="$lib $deplibs"
2209
2495
          if test -n "$library_names" &&
2210
2496
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2211
2497
            # We need to hardcode the library path
2212
 
            if test -n "$shlibpath_var"; then
 
2498
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2213
2499
              # Make sure the rpath contains only unique directories.
2214
2500
              case "$temp_rpath " in
2215
2501
              *" $dir "*) ;;
2216
2502
              *" $absdir "*) ;;
2217
 
              *) temp_rpath="$temp_rpath $dir" ;;
 
2503
              *) temp_rpath="$temp_rpath $absdir" ;;
2218
2504
              esac
2219
2505
            fi
2220
2506
 
2251
2537
        fi
2252
2538
 
2253
2539
        link_static=no # Whether the deplib will be linked statically
 
2540
        use_static_libs=$prefer_static_libs
 
2541
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2542
          use_static_libs=no
 
2543
        fi
2254
2544
        if test -n "$library_names" &&
2255
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2545
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2256
2546
          if test "$installed" = no; then
2257
2547
            notinst_deplibs="$notinst_deplibs $lib"
2258
2548
            need_relink=yes
2259
2549
          fi
2260
2550
          # This is a shared library
2261
 
        
2262
 
      # Warn about portability, can't link against -module's on some systems (darwin)
2263
 
      if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2551
 
 
2552
          # Warn about portability, can't link against -module's on
 
2553
          # some systems (darwin)
 
2554
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
2264
2555
            $echo
2265
2556
            if test "$linkmode" = prog; then
2266
2557
              $echo "*** Warning: Linking the executable $output against the loadable module"
2267
2558
            else
2268
2559
              $echo "*** Warning: Linking the shared library $output against the loadable module"
2269
2560
            fi
2270
 
            $echo "*** $linklib is not portable!"    
2271
 
      fi          
 
2561
            $echo "*** $linklib is not portable!"
 
2562
          fi
2272
2563
          if test "$linkmode" = lib &&
2273
2564
             test "$hardcode_into_libs" = yes; then
2274
2565
            # Hardcode the library path.
2326
2617
            else
2327
2618
              $show "extracting exported symbol list from \`$soname'"
2328
2619
              save_ifs="$IFS"; IFS='~'
2329
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2620
              cmds=$extract_expsyms_cmds
2330
2621
              for cmd in $cmds; do
2331
2622
                IFS="$save_ifs"
 
2623
                eval cmd=\"$cmd\"
2332
2624
                $show "$cmd"
2333
2625
                $run eval "$cmd" || exit $?
2334
2626
              done
2339
2631
            if test -f "$output_objdir/$newlib"; then :; else
2340
2632
              $show "generating import library for \`$soname'"
2341
2633
              save_ifs="$IFS"; IFS='~'
2342
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2634
              cmds=$old_archive_from_expsyms_cmds
2343
2635
              for cmd in $cmds; do
2344
2636
                IFS="$save_ifs"
 
2637
                eval cmd=\"$cmd\"
2345
2638
                $show "$cmd"
2346
2639
                $run eval "$cmd" || exit $?
2347
2640
              done
2362
2655
              if test "$hardcode_direct" = no; then
2363
2656
                add="$dir/$linklib"
2364
2657
                case $host in
2365
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2658
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2659
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2660
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2661
                    *-*-unixware7*) add_dir="-L$dir" ;;
2366
2662
                  *-*-darwin* )
2367
 
                    # if the lib is a module then we can not link against it, someone
2368
 
                    # is ignoring the new warnings I added
2369
 
                    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
 
2663
                    # if the lib is a module then we can not link against
 
2664
                    # it, someone is ignoring the new warnings I added
 
2665
                    if /usr/bin/file -L $add 2> /dev/null |
 
2666
                      $EGREP ": [^:]* bundle" >/dev/null ; then
2370
2667
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2371
2668
                      if test -z "$old_library" ; then
2372
2669
                        $echo
2374
2671
                        $echo "** The link will probably fail, sorry"
2375
2672
                      else
2376
2673
                        add="$dir/$old_library"
2377
 
                      fi 
 
2674
                      fi
2378
2675
                    fi
2379
2676
                esac
2380
2677
              elif test "$hardcode_minus_L" = no; then
2397
2694
                add_dir="-L$dir"
2398
2695
                # Try looking first in the location we're being installed to.
2399
2696
                if test -n "$inst_prefix_dir"; then
2400
 
                  case "$libdir" in
 
2697
                  case $libdir in
2401
2698
                    [\\/]*)
2402
 
                      add_dir="-L$inst_prefix_dir$libdir $add_dir"
 
2699
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2403
2700
                      ;;
2404
2701
                  esac
2405
2702
                fi
2416
2713
 
2417
2714
            if test "$lib_linked" != yes; then
2418
2715
              $echo "$modename: configuration error: unsupported hardcode properties"
2419
 
              exit 1
 
2716
              exit $EXIT_FAILURE
2420
2717
            fi
2421
2718
 
2422
2719
            if test -n "$add_shlibpath"; then
2459
2756
              esac
2460
2757
              add="-l$name"
2461
2758
            elif test "$hardcode_automatic" = yes; then
2462
 
              if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2759
              if test -n "$inst_prefix_dir" &&
 
2760
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2463
2761
                add="$inst_prefix_dir$libdir/$linklib"
2464
2762
              else
2465
2763
                add="$libdir/$linklib"
2469
2767
              add_dir="-L$libdir"
2470
2768
              # Try looking first in the location we're being installed to.
2471
2769
              if test -n "$inst_prefix_dir"; then
2472
 
                case "$libdir" in
 
2770
                case $libdir in
2473
2771
                  [\\/]*)
2474
 
                    add_dir="-L$inst_prefix_dir$libdir $add_dir"
 
2772
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2475
2773
                    ;;
2476
2774
                esac
2477
2775
              fi
2530
2828
              fi
2531
2829
            fi
2532
2830
          else
2533
 
            convenience="$convenience $dir/$old_library"
2534
 
            old_convenience="$old_convenience $dir/$old_library"
2535
2831
            deplibs="$dir/$old_library $deplibs"
2536
2832
            link_static=yes
2537
2833
          fi
2538
2834
        fi # link shared/static library?
2539
2835
 
2540
2836
        if test "$linkmode" = lib; then
2541
 
          #if test -n "$dependency_libs" &&
2542
 
          #   { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2543
 
          #     test "$link_static" = yes; }; then
 
2837
          if test -n "$dependency_libs" &&
 
2838
             { test "$hardcode_into_libs" != yes ||
 
2839
               test "$build_old_libs" = yes ||
 
2840
               test "$link_static" = yes; }; then
2544
2841
            # Extract -R from dependency_libs
2545
2842
            temp_deplibs=
2546
2843
            for libdir in $dependency_libs; do
2554
2851
              esac
2555
2852
            done
2556
2853
            dependency_libs="$temp_deplibs"
2557
 
          #fi
 
2854
          fi
2558
2855
 
2559
2856
          newlib_search_path="$newlib_search_path $absdir"
2560
2857
          # Link against this library
2596
2893
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2597
2894
                  if test -z "$libdir"; then
2598
2895
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2599
 
                    exit 1
 
2896
                    exit $EXIT_FAILURE
2600
2897
                  fi
2601
2898
                  if test "$absdir" != "$libdir"; then
2602
 
                    # Sure, some shells/systems don't implement the -ef.
2603
 
                    # Those will have to live with the warning.
2604
 
                    test "$absdir" -ef "$libdir" > /dev/null 2>&1 ||
2605
 
                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
 
2899
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2606
2900
                  fi
2607
2901
                  path="$absdir"
2608
2902
                fi
2609
2903
                depdepl=
2610
2904
                case $host in
2611
2905
                *-*-darwin*)
2612
 
                  # we do not want to link against static libs, but need to link against shared
 
2906
                  # we do not want to link against static libs,
 
2907
                  # but need to link against shared
2613
2908
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2614
2909
                  if test -n "$deplibrary_names" ; then
2615
2910
                    for tmp in $deplibrary_names ; do
2617
2912
                    done
2618
2913
                    if test -f "$path/$depdepl" ; then
2619
2914
                      depdepl="$path/$depdepl"
2620
 
                   fi
 
2915
                    fi
2621
2916
                    # do not add paths which are already there
2622
2917
                    case " $newlib_search_path " in
2623
2918
                    *" $path "*) ;;
2624
2919
                    *) newlib_search_path="$newlib_search_path $path";;
2625
2920
                    esac
2626
 
                    path=""
2627
2921
                  fi
 
2922
                  path=""
2628
2923
                  ;;
2629
2924
                *)
2630
 
                path="-L$path"
2631
 
                ;;
2632
 
                esac 
2633
 
                
2634
 
                ;;
2635
 
                  -l*)
 
2925
                  path="-L$path"
 
2926
                  ;;
 
2927
                esac
 
2928
                ;;
 
2929
              -l*)
2636
2930
                case $host in
2637
2931
                *-*-darwin*)
2638
 
                 # Again, we only want to link against shared libraries
2639
 
                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2640
 
                 for tmp in $newlib_search_path ; do
2641
 
                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
2642
 
                       eval depdepl="$tmp/lib$tmp_libs.dylib"
2643
 
                       break
2644
 
                     fi  
2645
 
         done
2646
 
         path=""
 
2932
                  # Again, we only want to link against shared libraries
 
2933
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2934
                  for tmp in $newlib_search_path ; do
 
2935
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2936
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2937
                      break
 
2938
                    fi
 
2939
                  done
 
2940
                  path=""
2647
2941
                  ;;
2648
2942
                *) continue ;;
2649
 
                esac              
2650
 
                ;;
2651
 
 
2652
 
              *.ltframework)
2653
 
                case $host in
2654
 
                  *-*-darwin*)
2655
 
                    depdepl="$deplib"
2656
 
                    ;;
2657
2943
                esac
2658
2944
                ;;
2659
 
 
2660
2945
              *) continue ;;
2661
2946
              esac
2662
2947
              case " $deplibs " in
 
2948
              *" $path "*) ;;
 
2949
              *) deplibs="$path $deplibs" ;;
 
2950
              esac
 
2951
              case " $deplibs " in
2663
2952
              *" $depdepl "*) ;;
2664
 
              *) deplibs="$deplibs $depdepl" ;;
2665
 
              esac            
2666
 
              case " $deplibs " in
2667
 
              *" $path "*) ;;
2668
 
              *) deplibs="$deplibs $path" ;;
 
2953
              *) deplibs="$depdepl $deplibs" ;;
2669
2954
              esac
2670
2955
            done
2671
2956
          fi # link_all_deplibs != no
2752
3037
          eval $var=\"$tmp_libs\"
2753
3038
        done # for var
2754
3039
      fi
2755
 
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
 
3040
      # Last step: remove runtime libs from dependency_libs
 
3041
      # (they stay in deplibs)
2756
3042
      tmp_libs=
2757
3043
      for i in $dependency_libs ; do
2758
3044
        case " $predeps $postdeps $compiler_lib_search_path " in
2812
3098
      case $outputname in
2813
3099
      lib*)
2814
3100
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2815
 
        eval shared_ext=\"$shrext\"
 
3101
        eval shared_ext=\"$shrext_cmds\"
2816
3102
        eval libname=\"$libname_spec\"
2817
3103
        ;;
2818
3104
      *)
2819
3105
        if test "$module" = no; then
2820
3106
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2821
3107
          $echo "$help" 1>&2
2822
 
          exit 1
 
3108
          exit $EXIT_FAILURE
2823
3109
        fi
2824
3110
        if test "$need_lib_prefix" != no; then
2825
3111
          # Add the "lib" prefix for modules if required
2826
3112
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2827
 
          eval shared_ext=\"$shrext\"
 
3113
          eval shared_ext=\"$shrext_cmds\"
2828
3114
          eval libname=\"$libname_spec\"
2829
3115
        else
2830
3116
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2835
3121
      if test -n "$objs"; then
2836
3122
        if test "$deplibs_check_method" != pass_all; then
2837
3123
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2838
 
          exit 1
 
3124
          exit $EXIT_FAILURE
2839
3125
        else
2840
3126
          $echo
2841
3127
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
2883
3169
        if test -n "$8"; then
2884
3170
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2885
3171
          $echo "$help" 1>&2
2886
 
          exit 1
 
3172
          exit $EXIT_FAILURE
2887
3173
        fi
2888
3174
 
2889
3175
        # convert absolute version numbers to libtool ages
2890
3176
        # this retains compatibility with .la files and attempts
2891
3177
        # to make the code below a bit more comprehensible
2892
 
        
 
3178
 
2893
3179
        case $vinfo_number in
2894
3180
        yes)
2895
3181
          number_major="$2"
2918
3204
            age="$number_minor"
2919
3205
            revision="$number_minor"
2920
3206
            ;;
 
3207
          *)
 
3208
            $echo "$modename: unknown library version type \`$version_type'" 1>&2
 
3209
            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3210
            exit $EXIT_FAILURE
 
3211
            ;;
2921
3212
          esac
2922
3213
          ;;
2923
3214
        no)
2929
3220
 
2930
3221
        # Check that each of the things are valid numbers.
2931
3222
        case $current in
2932
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3223
        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]) ;;
2933
3224
        *)
2934
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3225
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2935
3226
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2936
 
          exit 1
 
3227
          exit $EXIT_FAILURE
2937
3228
          ;;
2938
3229
        esac
2939
3230
 
2940
3231
        case $revision in
2941
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3232
        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]) ;;
2942
3233
        *)
2943
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3234
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2944
3235
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2945
 
          exit 1
 
3236
          exit $EXIT_FAILURE
2946
3237
          ;;
2947
3238
        esac
2948
3239
 
2949
3240
        case $age in
2950
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3241
        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]) ;;
2951
3242
        *)
2952
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3243
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2953
3244
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2954
 
          exit 1
 
3245
          exit $EXIT_FAILURE
2955
3246
          ;;
2956
3247
        esac
2957
3248
 
2958
3249
        if test "$age" -gt "$current"; then
2959
3250
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2960
3251
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2961
 
          exit 1
 
3252
          exit $EXIT_FAILURE
2962
3253
        fi
2963
3254
 
2964
3255
        # Calculate the version variables.
2975
3266
          versuffix="$major.$age.$revision"
2976
3267
          # Darwin ld doesn't like 0 for these options...
2977
3268
          minor_current=`expr $current + 1`
2978
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3269
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2979
3270
          ;;
2980
3271
 
2981
3272
        freebsd-aout)
3047
3338
        *)
3048
3339
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
3049
3340
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3050
 
          exit 1
 
3341
          exit $EXIT_FAILURE
3051
3342
          ;;
3052
3343
        esac
3053
3344
 
3098
3389
        tempremovelist=`$echo "$output_objdir/*"`
3099
3390
        for p in $tempremovelist; do
3100
3391
          case $p in
3101
 
            *.$objext | *$exeext)
 
3392
            *.$objext)
3102
3393
               ;;
3103
3394
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3395
               if test "X$precious_files_regex" != "X"; then
 
3396
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3397
                 then
 
3398
                   continue
 
3399
                 fi
 
3400
               fi
3104
3401
               removelist="$removelist $p"
3105
3402
               ;;
3106
3403
            *) ;;
3122
3419
 
3123
3420
      # Eliminate all temporary directories.
3124
3421
      for path in $notinst_path; do
3125
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3126
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3127
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3422
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3423
        deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3424
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3128
3425
      done
3129
3426
 
3130
3427
      if test -n "$xrpath"; then
3137
3434
          *) finalize_rpath="$finalize_rpath $libdir" ;;
3138
3435
          esac
3139
3436
        done
3140
 
        if true || test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
 
3437
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3141
3438
          dependency_libs="$temp_xrpath $dependency_libs"
3142
3439
        fi
3143
3440
      fi
3170
3467
            ;;
3171
3468
          *-*-rhapsody* | *-*-darwin1.[012])
3172
3469
            # Rhapsody C library is in the System framework
3173
 
            deplibs="$deplibs System.ltframework"
 
3470
            deplibs="$deplibs -framework System"
3174
3471
            ;;
3175
3472
          *-*-netbsd*)
3176
3473
            # Don't link with libc until the a.out ld.so is fixed.
3177
3474
            ;;
3178
 
          *-*-openbsd* | *-*-freebsd*)
 
3475
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3179
3476
            # Do not include libc due to us having libc/libc_r.
3180
 
            test "X$arg" = "X-lc" && continue
 
3477
            ;;
 
3478
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3479
            # Causes problems with __ctype
 
3480
            ;;
 
3481
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3482
            # Compiler inserts libc in the correct place for threads to work
3181
3483
            ;;
3182
3484
          *)
3183
3485
            # Add libc to deplibs on all other systems if necessary.
3221
3523
          int main() { return 0; }
3222
3524
EOF
3223
3525
          $rm conftest
3224
 
          $LTCC -o conftest conftest.c $deplibs
 
3526
          $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3225
3527
          if test "$?" -eq 0 ; then
3226
3528
            ldd_output=`ldd conftest`
3227
3529
            for i in $deplibs; do
3228
 
              name="`expr $i : '-l\(.*\)'`"
 
3530
              name=`expr $i : '-l\(.*\)'`
3229
3531
              # If $name is empty we are operating on a -L argument.
3230
3532
              if test "$name" != "" && test "$name" -ne "0"; then
3231
3533
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3262
3564
            # Error occurred in the first compile.  Let's try to salvage
3263
3565
            # the situation: Compile a separate program for each library.
3264
3566
            for i in $deplibs; do
3265
 
              name="`expr $i : '-l\(.*\)'`"
 
3567
              name=`expr $i : '-l\(.*\)'`
3266
3568
              # If $name is empty we are operating on a -L argument.
3267
3569
              if test "$name" != "" && test "$name" != "0"; then
3268
3570
                $rm conftest
3269
 
                $LTCC -o conftest conftest.c $i
 
3571
                $LTCC $LTCFLAGS -o conftest conftest.c $i
3270
3572
                # Did it work?
3271
3573
                if test "$?" -eq 0 ; then
3272
3574
                  ldd_output=`ldd conftest`
3314
3616
          set dummy $deplibs_check_method
3315
3617
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3316
3618
          for a_deplib in $deplibs; do
3317
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3619
            name=`expr $a_deplib : '-l\(.*\)'`
3318
3620
            # If $name is empty we are operating on a -L argument.
3319
3621
            if test "$name" != "" && test  "$name" != "0"; then
3320
3622
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3383
3685
          set dummy $deplibs_check_method
3384
3686
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3385
3687
          for a_deplib in $deplibs; do
3386
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3688
            name=`expr $a_deplib : '-l\(.*\)'`
3387
3689
            # If $name is empty we are operating on a -L argument.
3388
3690
            if test -n "$name" && test "$name" != "0"; then
3389
3691
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3463
3765
        case $host in
3464
3766
        *-*-rhapsody* | *-*-darwin1.[012])
3465
3767
          # On Rhapsody replace the C library is the System framework
3466
 
          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 
3768
          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3467
3769
          ;;
3468
3770
        esac
3469
3771
 
3509
3811
            fi
3510
3812
          fi
3511
3813
        fi
3512
 
        # Time to change all our "foo.ltframework" stuff back to "-framework foo"
3513
 
        case $host in
3514
 
          *-*-darwin*)
3515
 
            newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3516
 
            dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3517
 
            ;;
3518
 
        esac
3519
3814
        # Done checking deplibs!
3520
3815
        deplibs=$newdeplibs
3521
3816
      fi
3522
3817
 
 
3818
 
 
3819
      # move library search paths that coincide with paths to not yet
 
3820
      # installed libraries to the beginning of the library search list
 
3821
      new_libs=
 
3822
      for path in $notinst_path; do
 
3823
        case " $new_libs " in
 
3824
        *" -L$path/$objdir "*) ;;
 
3825
        *)
 
3826
          case " $deplibs " in
 
3827
          *" -L$path/$objdir "*)
 
3828
            new_libs="$new_libs -L$path/$objdir" ;;
 
3829
          esac
 
3830
          ;;
 
3831
        esac
 
3832
      done
 
3833
      for deplib in $deplibs; do
 
3834
        case $deplib in
 
3835
        -L*)
 
3836
          case " $new_libs " in
 
3837
          *" $deplib "*) ;;
 
3838
          *) new_libs="$new_libs $deplib" ;;
 
3839
          esac
 
3840
          ;;
 
3841
        *) new_libs="$new_libs $deplib" ;;
 
3842
        esac
 
3843
      done
 
3844
      deplibs="$new_libs"
 
3845
 
 
3846
 
3523
3847
      # All the library-specific variables (install_libdir is set above).
3524
3848
      library_names=
3525
3849
      old_library=
3532
3856
          hardcode_libdirs=
3533
3857
          dep_rpath=
3534
3858
          rpath="$finalize_rpath"
3535
 
          test "$mode" != relink && test "$fast_install" = no && rpath="$compile_rpath$rpath"
 
3859
          test "$mode" != relink && rpath="$compile_rpath$rpath"
3536
3860
          for libdir in $rpath; do
3537
3861
            if test -n "$hardcode_libdir_flag_spec"; then
3538
3862
              if test -n "$hardcode_libdir_separator"; then
3587
3911
        fi
3588
3912
 
3589
3913
        # Get the real and link names of the library.
3590
 
        eval shared_ext=\"$shrext\"
 
3914
        eval shared_ext=\"$shrext_cmds\"
3591
3915
        eval library_names=\"$library_names_spec\"
3592
3916
        set dummy $library_names
3593
3917
        realname="$2"
3603
3927
        fi
3604
3928
 
3605
3929
        lib="$output_objdir/$realname"
 
3930
        linknames=
3606
3931
        for link
3607
3932
        do
3608
3933
          linknames="$linknames $link"
3617
3942
            $show "generating symbol list for \`$libname.la'"
3618
3943
            export_symbols="$output_objdir/$libname.exp"
3619
3944
            $run $rm $export_symbols
3620
 
            eval cmds=\"$export_symbols_cmds\"
 
3945
            cmds=$export_symbols_cmds
3621
3946
            save_ifs="$IFS"; IFS='~'
3622
3947
            for cmd in $cmds; do
3623
3948
              IFS="$save_ifs"
 
3949
              eval cmd=\"$cmd\"
3624
3950
              if len=`expr "X$cmd" : ".*"` &&
3625
3951
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3626
3952
                $show "$cmd"
3630
3956
                # The command line is too long to execute in one step.
3631
3957
                $show "using reloadable object file for export list..."
3632
3958
                skipped_export=:
 
3959
                # Break out early, otherwise skipped_export may be
 
3960
                # set to false by a later but shorter cmd.
 
3961
                break
3633
3962
              fi
3634
3963
            done
3635
3964
            IFS="$save_ifs"
3650
3979
        for test_deplib in $deplibs; do
3651
3980
                case " $convenience " in
3652
3981
                *" $test_deplib "*) ;;
3653
 
                *) 
 
3982
                *)
3654
3983
                        tmp_deplibs="$tmp_deplibs $test_deplib"
3655
3984
                        ;;
3656
3985
                esac
3657
3986
        done
3658
 
        deplibs="$tmp_deplibs" 
 
3987
        deplibs="$tmp_deplibs"
3659
3988
 
3660
3989
        if test -n "$convenience"; then
3661
3990
          if test -n "$whole_archive_flag_spec"; then
3663
3992
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3664
3993
          else
3665
3994
            gentop="$output_objdir/${outputname}x"
3666
 
            $show "${rm}r $gentop"
3667
 
            $run ${rm}r "$gentop"
3668
 
            $show "$mkdir $gentop"
3669
 
            $run $mkdir "$gentop"
3670
 
            status=$?
3671
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
3672
 
              exit $status
3673
 
            fi
3674
3995
            generated="$generated $gentop"
3675
3996
 
3676
 
            for xlib in $convenience; do
3677
 
              # Extract the objects.
3678
 
              case $xlib in
3679
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3680
 
              *) xabs=`pwd`"/$xlib" ;;
3681
 
              esac
3682
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3683
 
              xdir="$gentop/$xlib"
3684
 
 
3685
 
              $show "${rm}r $xdir"
3686
 
              $run ${rm}r "$xdir"
3687
 
              $show "$mkdir $xdir"
3688
 
              $run $mkdir "$xdir"
3689
 
              status=$?
3690
 
              if test "$status" -ne 0 && test ! -d "$xdir"; then
3691
 
                exit $status
3692
 
              fi
3693
 
              # We will extract separately just the conflicting names and we will no
3694
 
              # longer touch any unique names. It is faster to leave these extract
3695
 
              # automatically by $AR in one run.
3696
 
              $show "(cd $xdir && $AR x $xabs)"
3697
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3698
 
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3699
 
                :
3700
 
              else
3701
 
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3702
 
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3703
 
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
3704
 
                do
3705
 
                  i=1
3706
 
                  while test "$i" -le "$count"
3707
 
                  do
3708
 
                   # Put our $i before any first dot (extension)
3709
 
                   # Never overwrite any file
3710
 
                   name_to="$name"
3711
 
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3712
 
                   do
3713
 
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3714
 
                   done
3715
 
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3716
 
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3717
 
                   i=`expr $i + 1`
3718
 
                  done
3719
 
                done
3720
 
              fi
3721
 
 
3722
 
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3723
 
            done
 
3997
            func_extract_archives $gentop $convenience
 
3998
            libobjs="$libobjs $func_extract_archives_result"
3724
3999
          fi
3725
4000
        fi
3726
 
 
 
4001
        
3727
4002
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3728
4003
          eval flag=\"$thread_safe_flag_spec\"
3729
4004
          linker_flags="$linker_flags $flag"
3734
4009
          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3735
4010
        fi
3736
4011
 
3737
 
        # Add all flags from the command line.  We here create a library,
3738
 
        # but those flags were only added to compile_command and
3739
 
        # finalize_command, which are only used when creating executables.
3740
 
        # So do it by hand here.
3741
 
        compiler_flags="$compiler_flags $add_flags"
3742
 
        # Only add it to commands which use CC, instead of LD, i.e.
3743
 
        # only to $compiler_flags
3744
 
        #linker_flags="$linker_flags $add_flags"
3745
 
 
3746
4012
        # Do each of the archive commands.
3747
4013
        if test "$module" = yes && test -n "$module_cmds" ; then
3748
4014
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3749
 
            eval cmds=\"$module_expsym_cmds\"
 
4015
            eval test_cmds=\"$module_expsym_cmds\"
 
4016
            cmds=$module_expsym_cmds
3750
4017
          else
3751
 
            eval cmds=\"$module_cmds\"
 
4018
            eval test_cmds=\"$module_cmds\"
 
4019
            cmds=$module_cmds
3752
4020
          fi
3753
4021
        else
3754
4022
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3755
 
          eval cmds=\"$archive_expsym_cmds\"
 
4023
          eval test_cmds=\"$archive_expsym_cmds\"
 
4024
          cmds=$archive_expsym_cmds
3756
4025
        else
3757
 
          eval cmds=\"$archive_cmds\"
 
4026
          eval test_cmds=\"$archive_cmds\"
 
4027
          cmds=$archive_cmds
3758
4028
          fi
3759
4029
        fi
3760
4030
 
3761
 
        if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
 
4031
        if test "X$skipped_export" != "X:" &&
 
4032
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3762
4033
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3763
4034
          :
3764
4035
        else
3777
4048
            save_libobjs=$libobjs
3778
4049
          fi
3779
4050
          save_output=$output
 
4051
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
3780
4052
 
3781
4053
          # Clear the reloadable object creation command queue and
3782
4054
          # initialize k to one.
3786
4058
          delfiles=
3787
4059
          last_robj=
3788
4060
          k=1
3789
 
          output=$output_objdir/$save_output-${k}.$objext
 
4061
          output=$output_objdir/$output_la-${k}.$objext
3790
4062
          # Loop over the list of objects to be linked.
3791
4063
          for obj in $save_libobjs
3792
4064
          do
3793
4065
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3794
4066
            if test "X$objlist" = X ||
3795
 
               { len=`expr "X$test_cmds" : ".*"` &&
 
4067
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3796
4068
                 test "$len" -le "$max_cmd_len"; }; then
3797
4069
              objlist="$objlist $obj"
3798
4070
            else
3806
4078
                # the last one created.
3807
4079
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3808
4080
              fi
3809
 
              last_robj=$output_objdir/$save_output-${k}.$objext
 
4081
              last_robj=$output_objdir/$output_la-${k}.$objext
3810
4082
              k=`expr $k + 1`
3811
 
              output=$output_objdir/$save_output-${k}.$objext
 
4083
              output=$output_objdir/$output_la-${k}.$objext
3812
4084
              objlist=$obj
3813
4085
              len=1
3814
4086
            fi
3828
4100
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3829
4101
          fi
3830
4102
 
3831
 
          # Set up a command to remove the reloadale object files
 
4103
          # Set up a command to remove the reloadable object files
3832
4104
          # after they are used.
3833
4105
          i=0
3834
4106
          while test "$i" -lt "$k"
3835
4107
          do
3836
4108
            i=`expr $i + 1`
3837
 
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
4109
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3838
4110
          done
3839
4111
 
3840
4112
          $echo "creating a temporary reloadable object file: $output"
3859
4131
          # value of $libobjs for piecewise linking.
3860
4132
 
3861
4133
          # Do each of the archive commands.
 
4134
          if test "$module" = yes && test -n "$module_cmds" ; then
 
4135
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
4136
              cmds=$module_expsym_cmds
 
4137
            else
 
4138
              cmds=$module_cmds
 
4139
            fi
 
4140
          else
3862
4141
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3863
 
            eval cmds=\"$archive_expsym_cmds\"
 
4142
            cmds=$archive_expsym_cmds
3864
4143
          else
3865
 
            eval cmds=\"$archive_cmds\"
 
4144
            cmds=$archive_cmds
 
4145
            fi
3866
4146
          fi
3867
4147
 
3868
4148
          # Append the command to remove the reloadable object files
3869
4149
          # to the just-reset $cmds.
3870
 
          eval cmds=\"\$cmds~$rm $delfiles\"
 
4150
          eval cmds=\"\$cmds~\$rm $delfiles\"
3871
4151
        fi
3872
4152
        save_ifs="$IFS"; IFS='~'
3873
4153
        for cmd in $cmds; do
3874
4154
          IFS="$save_ifs"
 
4155
          eval cmd=\"$cmd\"
3875
4156
          $show "$cmd"
3876
 
          $run eval "$cmd" || exit $?
 
4157
          $run eval "$cmd" || {
 
4158
            lt_exit=$?
 
4159
 
 
4160
            # Restore the uninstalled library and exit
 
4161
            if test "$mode" = relink; then
 
4162
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4163
            fi
 
4164
 
 
4165
            exit $lt_exit
 
4166
          }
3877
4167
        done
3878
4168
        IFS="$save_ifs"
3879
4169
 
3880
4170
        # Restore the uninstalled library and exit
3881
4171
        if test "$mode" = relink; then
3882
4172
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3883
 
          exit 0
 
4173
 
 
4174
          if test -n "$convenience"; then
 
4175
            if test -z "$whole_archive_flag_spec"; then
 
4176
              $show "${rm}r $gentop"
 
4177
              $run ${rm}r "$gentop"
 
4178
            fi
 
4179
          fi
 
4180
 
 
4181
          exit $EXIT_SUCCESS
3884
4182
        fi
3885
4183
 
3886
4184
        # Create links to the real library.
3928
4226
      *.lo)
3929
4227
        if test -n "$objs$old_deplibs"; then
3930
4228
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3931
 
          exit 1
 
4229
          exit $EXIT_FAILURE
3932
4230
        fi
3933
4231
        libobj="$output"
3934
4232
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3957
4255
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3958
4256
        else
3959
4257
          gentop="$output_objdir/${obj}x"
3960
 
          $show "${rm}r $gentop"
3961
 
          $run ${rm}r "$gentop"
3962
 
          $show "$mkdir $gentop"
3963
 
          $run $mkdir "$gentop"
3964
 
          status=$?
3965
 
          if test "$status" -ne 0 && test ! -d "$gentop"; then
3966
 
            exit $status
3967
 
          fi
3968
4258
          generated="$generated $gentop"
3969
4259
 
3970
 
          for xlib in $convenience; do
3971
 
            # Extract the objects.
3972
 
            case $xlib in
3973
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3974
 
            *) xabs=`pwd`"/$xlib" ;;
3975
 
            esac
3976
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3977
 
            xdir="$gentop/$xlib"
3978
 
 
3979
 
            $show "${rm}r $xdir"
3980
 
            $run ${rm}r "$xdir"
3981
 
            $show "$mkdir $xdir"
3982
 
            $run $mkdir "$xdir"
3983
 
            status=$?
3984
 
            if test "$status" -ne 0 && test ! -d "$xdir"; then
3985
 
              exit $status
3986
 
            fi
3987
 
            # We will extract separately just the conflicting names and we will no
3988
 
            # longer touch any unique names. It is faster to leave these extract
3989
 
            # automatically by $AR in one run.
3990
 
            $show "(cd $xdir && $AR x $xabs)"
3991
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3992
 
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3993
 
              :
3994
 
            else
3995
 
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3996
 
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3997
 
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
3998
 
              do
3999
 
                i=1
4000
 
                while test "$i" -le "$count"
4001
 
                do
4002
 
                 # Put our $i before any first dot (extension)
4003
 
                 # Never overwrite any file
4004
 
                 name_to="$name"
4005
 
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4006
 
                 do
4007
 
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4008
 
                 done
4009
 
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4010
 
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4011
 
                 i=`expr $i + 1`
4012
 
                done
4013
 
              done
4014
 
            fi
4015
 
 
4016
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4017
 
          done
 
4260
          func_extract_archives $gentop $convenience
 
4261
          reload_conv_objs="$reload_objs $func_extract_archives_result"
4018
4262
        fi
4019
4263
      fi
4020
4264
 
4022
4266
      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4023
4267
 
4024
4268
      output="$obj"
4025
 
      eval cmds=\"$reload_cmds\"
 
4269
      cmds=$reload_cmds
4026
4270
      save_ifs="$IFS"; IFS='~'
4027
4271
      for cmd in $cmds; do
4028
4272
        IFS="$save_ifs"
 
4273
        eval cmd=\"$cmd\"
4029
4274
        $show "$cmd"
4030
4275
        $run eval "$cmd" || exit $?
4031
4276
      done
4038
4283
          $run ${rm}r $gentop
4039
4284
        fi
4040
4285
 
4041
 
        exit 0
 
4286
        exit $EXIT_SUCCESS
4042
4287
      fi
4043
4288
 
4044
4289
      if test "$build_libtool_libs" != yes; then
4051
4296
        # accidentally link it into a program.
4052
4297
        # $show "echo timestamp > $libobj"
4053
4298
        # $run eval "echo timestamp > $libobj" || exit $?
4054
 
        exit 0
 
4299
        exit $EXIT_SUCCESS
4055
4300
      fi
4056
4301
 
4057
4302
      if test -n "$pic_flag" || test "$pic_mode" != default; then
4058
4303
        # Only do commands if we really have different PIC objects.
4059
4304
        reload_objs="$libobjs $reload_conv_objs"
4060
4305
        output="$libobj"
4061
 
        eval cmds=\"$reload_cmds\"
 
4306
        cmds=$reload_cmds
4062
4307
        save_ifs="$IFS"; IFS='~'
4063
4308
        for cmd in $cmds; do
4064
4309
          IFS="$save_ifs"
 
4310
          eval cmd=\"$cmd\"
4065
4311
          $show "$cmd"
4066
4312
          $run eval "$cmd" || exit $?
4067
4313
        done
4073
4319
        $run ${rm}r $gentop
4074
4320
      fi
4075
4321
 
4076
 
      exit 0
 
4322
      exit $EXIT_SUCCESS
4077
4323
      ;;
4078
4324
 
4079
4325
    prog)
4098
4344
      case $host in
4099
4345
      *-*-rhapsody* | *-*-darwin1.[012])
4100
4346
        # On Rhapsody replace the C library is the System framework
4101
 
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
4102
 
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 
4347
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
4348
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4103
4349
        ;;
4104
4350
      esac
4105
4351
 
4106
4352
      case $host in
4107
 
      *-*-darwin*)
 
4353
      *darwin*)
4108
4354
        # Don't allow lazy linking, it breaks C++ global constructors
4109
4355
        if test "$tagname" = CXX ; then
4110
4356
        compile_command="$compile_command ${wl}-bind_at_load"
4111
4357
        finalize_command="$finalize_command ${wl}-bind_at_load"
4112
4358
        fi
4113
 
        # Time to change all our "foo.ltframework" stuff back to "-framework foo"
4114
 
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4115
 
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4116
4359
        ;;
4117
4360
      esac
4118
4361
 
 
4362
 
 
4363
      # move library search paths that coincide with paths to not yet
 
4364
      # installed libraries to the beginning of the library search list
 
4365
      new_libs=
 
4366
      for path in $notinst_path; do
 
4367
        case " $new_libs " in
 
4368
        *" -L$path/$objdir "*) ;;
 
4369
        *)
 
4370
          case " $compile_deplibs " in
 
4371
          *" -L$path/$objdir "*)
 
4372
            new_libs="$new_libs -L$path/$objdir" ;;
 
4373
          esac
 
4374
          ;;
 
4375
        esac
 
4376
      done
 
4377
      for deplib in $compile_deplibs; do
 
4378
        case $deplib in
 
4379
        -L*)
 
4380
          case " $new_libs " in
 
4381
          *" $deplib "*) ;;
 
4382
          *) new_libs="$new_libs $deplib" ;;
 
4383
          esac
 
4384
          ;;
 
4385
        *) new_libs="$new_libs $deplib" ;;
 
4386
        esac
 
4387
      done
 
4388
      compile_deplibs="$new_libs"
 
4389
 
 
4390
 
4119
4391
      compile_command="$compile_command $compile_deplibs"
4120
4392
      finalize_command="$finalize_command $finalize_deplibs"
4121
4393
 
4160
4432
        fi
4161
4433
        case $host in
4162
4434
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4435
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4163
4436
          case :$dllsearchpath: in
4164
4437
          *":$libdir:"*) ;;
4165
4438
          *) dllsearchpath="$dllsearchpath:$libdir";;
4166
4439
          esac
 
4440
          case :$dllsearchpath: in
 
4441
          *":$testbindir:"*) ;;
 
4442
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4443
          esac
4167
4444
          ;;
4168
4445
        esac
4169
4446
      done
4277
4554
 
4278
4555
            # Prepare the list of exported symbols
4279
4556
            if test -z "$export_symbols"; then
4280
 
              export_symbols="$output_objdir/$output.exp"
 
4557
              export_symbols="$output_objdir/$outputname.exp"
4281
4558
              $run $rm $export_symbols
4282
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4559
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4560
              case $host in
 
4561
              *cygwin* | *mingw* )
 
4562
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4563
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4564
                ;;
 
4565
              esac
4283
4566
            else
4284
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4285
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4567
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4568
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4286
4569
              $run eval 'mv "$nlist"T "$nlist"'
 
4570
              case $host in
 
4571
              *cygwin* | *mingw* )
 
4572
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4573
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4574
                ;;
 
4575
              esac
4287
4576
            fi
4288
4577
          fi
4289
4578
 
4334
4623
#endif
4335
4624
 
4336
4625
/* The mapping between symbol names and symbols. */
 
4626
"
 
4627
 
 
4628
            case $host in
 
4629
            *cygwin* | *mingw* )
 
4630
          $echo >> "$output_objdir/$dlsyms" "\
 
4631
/* DATA imports from DLLs on WIN32 can't be const, because
 
4632
   runtime relocations are performed -- see ld's documentation
 
4633
   on pseudo-relocs */
 
4634
struct {
 
4635
"
 
4636
              ;;
 
4637
            * )
 
4638
          $echo >> "$output_objdir/$dlsyms" "\
4337
4639
const struct {
 
4640
"
 
4641
              ;;
 
4642
            esac
 
4643
 
 
4644
 
 
4645
          $echo >> "$output_objdir/$dlsyms" "\
4338
4646
  const char *name;
4339
4647
  lt_ptr address;
4340
4648
}
4381
4689
          esac
4382
4690
 
4383
4691
          # Now compile the dynamic symbol file.
4384
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4385
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4692
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4693
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4386
4694
 
4387
4695
          # Clean up the generated files.
4388
4696
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4389
4697
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4390
4698
 
4391
4699
          # Transform the symbol file into the correct name.
4392
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4393
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4700
          case $host in
 
4701
          *cygwin* | *mingw* )
 
4702
            if test -f "$output_objdir/${outputname}.def" ; then
 
4703
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4704
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4705
            else
 
4706
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4707
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4708
             fi
 
4709
            ;;
 
4710
          * )
 
4711
            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4712
            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4713
            ;;
 
4714
          esac
4394
4715
          ;;
4395
4716
        *)
4396
4717
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4397
 
          exit 1
 
4718
          exit $EXIT_FAILURE
4398
4719
          ;;
4399
4720
        esac
4400
4721
      else
4407
4728
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4408
4729
      fi
4409
4730
 
4410
 
      # AIX runtime linking requires linking programs with -Wl,-brtl and libs with -Wl,-G
4411
 
      # Also add -bnolibpath to the beginning of the link line, to clear the hardcoded runpath.
4412
 
      # Otherwise, things like the -L path to libgcc.a are accidentally hardcoded by ld.
4413
 
      # This does not apply on AIX for ia64, which uses a SysV linker.
4414
 
      case "$host" in
4415
 
        ia64-*-aix5*) ;;
4416
 
        *-*-aix4* | *-*-aix5*)
4417
 
                   compile_command=`$echo "X$compile_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"`
4418
 
                   finalize_command=`$echo "X$finalize_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` ;;
4419
 
      esac
4420
 
 
4421
4731
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4422
4732
        # Replace the output file specification.
4423
4733
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4426
4736
        # We have no uninstalled library dependencies, so finalize right now.
4427
4737
        $show "$link_command"
4428
4738
        $run eval "$link_command"
4429
 
        status=$?
 
4739
        exit_status=$?
4430
4740
 
4431
4741
        # Delete the generated files.
4432
4742
        if test -n "$dlsyms"; then
4434
4744
          $run $rm "$output_objdir/${outputname}S.${objext}"
4435
4745
        fi
4436
4746
 
4437
 
        exit $status
 
4747
        exit $exit_status
4438
4748
      fi
4439
4749
 
4440
4750
      if test -n "$shlibpath_var"; then
4493
4803
        # Link the executable and exit
4494
4804
        $show "$link_command"
4495
4805
        $run eval "$link_command" || exit $?
4496
 
        exit 0
 
4806
        exit $EXIT_SUCCESS
4497
4807
      fi
4498
4808
 
4499
4809
      if test "$hardcode_action" = relink; then
4548
4858
      fi
4549
4859
 
4550
4860
      # Quote $echo for shipping.
4551
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4552
 
        case $0 in
4553
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4554
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4861
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4862
        case $progpath in
 
4863
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4864
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4555
4865
        esac
4556
4866
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4557
4867
      else
4573
4883
          *) exeext= ;;
4574
4884
        esac
4575
4885
        case $host in
4576
 
          *mingw* )
4577
 
            cwrappersource=`$echo ${output_objdir}/lt-${outputname}.c`
4578
 
            cwrapper=`$echo ${output}.exe`
4579
 
            $rm $cwrappersource $cwrapper
4580
 
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
 
4886
          *cygwin* | *mingw* )
 
4887
            output_name=`basename $output`
 
4888
            output_path=`dirname $output`
 
4889
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4890
            cwrapper="$output_path/$output_name.exe"
 
4891
            $rm $cwrappersource $cwrapper
 
4892
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4581
4893
 
4582
4894
            cat > $cwrappersource <<EOF
4583
4895
 
4586
4898
 
4587
4899
   The $output program cannot be directly executed until all the libtool
4588
4900
   libraries that it depends on are installed.
4589
 
   
 
4901
 
4590
4902
   This wrapper executable should never be moved out of the build directory.
4591
4903
   If it is, it will not operate correctly.
4592
4904
 
4602
4914
#include <malloc.h>
4603
4915
#include <stdarg.h>
4604
4916
#include <assert.h>
 
4917
#include <string.h>
 
4918
#include <ctype.h>
 
4919
#include <sys/stat.h>
4605
4920
 
4606
4921
#if defined(PATH_MAX)
4607
4922
# define LT_PATHMAX PATH_MAX
4612
4927
#endif
4613
4928
 
4614
4929
#ifndef DIR_SEPARATOR
4615
 
#define DIR_SEPARATOR '/'
 
4930
# define DIR_SEPARATOR '/'
 
4931
# define PATH_SEPARATOR ':'
4616
4932
#endif
4617
4933
 
4618
4934
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4619
4935
  defined (__OS2__)
4620
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4621
 
#ifndef DIR_SEPARATOR_2 
4622
 
#define DIR_SEPARATOR_2 '\\'
4623
 
#endif
 
4936
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4937
# ifndef DIR_SEPARATOR_2
 
4938
#  define DIR_SEPARATOR_2 '\\'
 
4939
# endif
 
4940
# ifndef PATH_SEPARATOR_2
 
4941
#  define PATH_SEPARATOR_2 ';'
 
4942
# endif
4624
4943
#endif
4625
4944
 
4626
4945
#ifndef DIR_SEPARATOR_2
4630
4949
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4631
4950
#endif /* DIR_SEPARATOR_2 */
4632
4951
 
 
4952
#ifndef PATH_SEPARATOR_2
 
4953
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4954
#else /* PATH_SEPARATOR_2 */
 
4955
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4956
#endif /* PATH_SEPARATOR_2 */
 
4957
 
4633
4958
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4634
4959
#define XFREE(stale) do { \
4635
4960
  if (stale) { free ((void *) stale); stale = 0; } \
4636
4961
} while (0)
4637
4962
 
 
4963
/* -DDEBUG is fairly common in CFLAGS.  */
 
4964
#undef DEBUG
 
4965
#if defined DEBUGWRAPPER
 
4966
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
4967
#else
 
4968
# define DEBUG(format, ...)
 
4969
#endif
 
4970
 
4638
4971
const char *program_name = NULL;
4639
4972
 
4640
4973
void * xmalloc (size_t num);
4641
4974
char * xstrdup (const char *string);
4642
 
char * basename (const char *name);
4643
 
char * fnqualify(const char *path);
 
4975
const char * base_name (const char *name);
 
4976
char * find_executable(const char *wrapper);
 
4977
int    check_executable(const char *path);
4644
4978
char * strendzap(char *str, const char *pat);
4645
4979
void lt_fatal (const char *message, ...);
4646
4980
 
4649
4983
{
4650
4984
  char **newargz;
4651
4985
  int i;
4652
 
  
4653
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4986
 
 
4987
  program_name = (char *) xstrdup (base_name (argv[0]));
 
4988
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
4989
  DEBUG("(main) program_name : %s\n",program_name);
4654
4990
  newargz = XMALLOC(char *, argc+2);
4655
4991
EOF
4656
4992
 
4657
 
            cat >> $cwrappersource <<EOF
4658
 
  newargz[0] = "$SHELL";
 
4993
            cat >> $cwrappersource <<EOF
 
4994
  newargz[0] = (char *) xstrdup("$SHELL");
4659
4995
EOF
4660
4996
 
4661
 
            cat >> $cwrappersource <<"EOF"
4662
 
  newargz[1] = fnqualify(argv[0]);
 
4997
            cat >> $cwrappersource <<"EOF"
 
4998
  newargz[1] = find_executable(argv[0]);
 
4999
  if (newargz[1] == NULL)
 
5000
    lt_fatal("Couldn't find %s", argv[0]);
 
5001
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4663
5002
  /* we know the script has the same name, without the .exe */
4664
5003
  /* so make sure newargz[1] doesn't end in .exe */
4665
 
  strendzap(newargz[1],".exe"); 
 
5004
  strendzap(newargz[1],".exe");
4666
5005
  for (i = 1; i < argc; i++)
4667
5006
    newargz[i+1] = xstrdup(argv[i]);
4668
5007
  newargz[argc+1] = NULL;
4669
 
EOF
4670
 
 
4671
 
            cat >> $cwrappersource <<EOF
 
5008
 
 
5009
  for (i=0; i<argc+1; i++)
 
5010
  {
 
5011
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
5012
    ;
 
5013
  }
 
5014
 
 
5015
EOF
 
5016
 
 
5017
            case $host_os in
 
5018
              mingw*)
 
5019
                cat >> $cwrappersource <<EOF
 
5020
  execv("$SHELL",(char const **)newargz);
 
5021
EOF
 
5022
              ;;
 
5023
              *)
 
5024
                cat >> $cwrappersource <<EOF
4672
5025
  execv("$SHELL",newargz);
4673
5026
EOF
 
5027
              ;;
 
5028
            esac
4674
5029
 
4675
 
            cat >> $cwrappersource <<"EOF"
 
5030
            cat >> $cwrappersource <<"EOF"
 
5031
  return 127;
4676
5032
}
4677
5033
 
4678
5034
void *
4685
5041
  return p;
4686
5042
}
4687
5043
 
4688
 
char * 
 
5044
char *
4689
5045
xstrdup (const char *string)
4690
5046
{
4691
5047
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4692
5048
;
4693
5049
}
4694
5050
 
4695
 
char *
4696
 
basename (const char *name)
 
5051
const char *
 
5052
base_name (const char *name)
4697
5053
{
4698
5054
  const char *base;
4699
5055
 
4700
5056
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4701
5057
  /* Skip over the disk name in MSDOS pathnames. */
4702
 
  if (isalpha (name[0]) && name[1] == ':') 
 
5058
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4703
5059
    name += 2;
4704
5060
#endif
4705
5061
 
4706
5062
  for (base = name; *name; name++)
4707
5063
    if (IS_DIR_SEPARATOR (*name))
4708
5064
      base = name + 1;
4709
 
  return (char *) base;
4710
 
}
4711
 
 
4712
 
char * 
4713
 
fnqualify(const char *path)
4714
 
{
4715
 
  size_t size;
4716
 
  char *p;
 
5065
  return base;
 
5066
}
 
5067
 
 
5068
int
 
5069
check_executable(const char * path)
 
5070
{
 
5071
  struct stat st;
 
5072
 
 
5073
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
 
5074
  if ((!path) || (!*path))
 
5075
    return 0;
 
5076
 
 
5077
  if ((stat (path, &st) >= 0) &&
 
5078
      (
 
5079
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5080
#if defined (S_IXOTH)
 
5081
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
5082
#endif
 
5083
#if defined (S_IXGRP)
 
5084
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
5085
#endif
 
5086
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5087
      )
 
5088
    return 1;
 
5089
  else
 
5090
    return 0;
 
5091
}
 
5092
 
 
5093
/* Searches for the full path of the wrapper.  Returns
 
5094
   newly allocated full path name if found, NULL otherwise */
 
5095
char *
 
5096
find_executable (const char* wrapper)
 
5097
{
 
5098
  int has_slash = 0;
 
5099
  const char* p;
 
5100
  const char* p_next;
 
5101
  /* static buffer for getcwd */
4717
5102
  char tmp[LT_PATHMAX + 1];
4718
 
 
4719
 
  assert(path != NULL);
4720
 
 
4721
 
  /* Is it qualified already? */
4722
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4723
 
  if (isalpha (path[0]) && path[1] == ':')
4724
 
    return xstrdup (path);
4725
 
#endif
4726
 
  if (IS_DIR_SEPARATOR (path[0]))
4727
 
    return xstrdup (path);
4728
 
 
4729
 
  /* prepend the current directory */
4730
 
  /* doesn't handle '~' */
 
5103
  int tmp_len;
 
5104
  char* concat_name;
 
5105
 
 
5106
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
 
5107
 
 
5108
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
5109
    return NULL;
 
5110
 
 
5111
  /* Absolute path? */
 
5112
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5113
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
5114
  {
 
5115
    concat_name = xstrdup (wrapper);
 
5116
    if (check_executable(concat_name))
 
5117
      return concat_name;
 
5118
    XFREE(concat_name);
 
5119
  }
 
5120
  else
 
5121
  {
 
5122
#endif
 
5123
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
5124
    {
 
5125
      concat_name = xstrdup (wrapper);
 
5126
      if (check_executable(concat_name))
 
5127
        return concat_name;
 
5128
      XFREE(concat_name);
 
5129
    }
 
5130
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5131
  }
 
5132
#endif
 
5133
 
 
5134
  for (p = wrapper; *p; p++)
 
5135
    if (*p == '/')
 
5136
    {
 
5137
      has_slash = 1;
 
5138
      break;
 
5139
    }
 
5140
  if (!has_slash)
 
5141
  {
 
5142
    /* no slashes; search PATH */
 
5143
    const char* path = getenv ("PATH");
 
5144
    if (path != NULL)
 
5145
    {
 
5146
      for (p = path; *p; p = p_next)
 
5147
      {
 
5148
        const char* q;
 
5149
        size_t p_len;
 
5150
        for (q = p; *q; q++)
 
5151
          if (IS_PATH_SEPARATOR(*q))
 
5152
            break;
 
5153
        p_len = q - p;
 
5154
        p_next = (*q == '\0' ? q : q + 1);
 
5155
        if (p_len == 0)
 
5156
        {
 
5157
          /* empty path: current directory */
 
5158
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5159
            lt_fatal ("getcwd failed");
 
5160
          tmp_len = strlen(tmp);
 
5161
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5162
          memcpy (concat_name, tmp, tmp_len);
 
5163
          concat_name[tmp_len] = '/';
 
5164
          strcpy (concat_name + tmp_len + 1, wrapper);
 
5165
        }
 
5166
        else
 
5167
        {
 
5168
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
5169
          memcpy (concat_name, p, p_len);
 
5170
          concat_name[p_len] = '/';
 
5171
          strcpy (concat_name + p_len + 1, wrapper);
 
5172
        }
 
5173
        if (check_executable(concat_name))
 
5174
          return concat_name;
 
5175
        XFREE(concat_name);
 
5176
      }
 
5177
    }
 
5178
    /* not found in PATH; assume curdir */
 
5179
  }
 
5180
  /* Relative path | not found in path: prepend cwd */
4731
5181
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4732
5182
    lt_fatal ("getcwd failed");
4733
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4734
 
  p = XMALLOC(char, size);
4735
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4736
 
  return p;
 
5183
  tmp_len = strlen(tmp);
 
5184
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5185
  memcpy (concat_name, tmp, tmp_len);
 
5186
  concat_name[tmp_len] = '/';
 
5187
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5188
 
 
5189
  if (check_executable(concat_name))
 
5190
    return concat_name;
 
5191
  XFREE(concat_name);
 
5192
  return NULL;
4737
5193
}
4738
5194
 
4739
5195
char *
4740
 
strendzap(char *str, const char *pat) 
 
5196
strendzap(char *str, const char *pat)
4741
5197
{
4742
5198
  size_t len, patlen;
4743
5199
 
4757
5213
}
4758
5214
 
4759
5215
static void
4760
 
lt_error_core (int exit_status, const char * mode, 
 
5216
lt_error_core (int exit_status, const char * mode,
4761
5217
          const char * message, va_list ap)
4762
5218
{
4763
5219
  fprintf (stderr, "%s: %s: ", program_name, mode);
4777
5233
  va_end (ap);
4778
5234
}
4779
5235
EOF
4780
 
          # we should really use a build-platform specific compiler
4781
 
          # here, but OTOH, the wrappers (shell script and this C one)
4782
 
          # are only useful if you want to execute the "real" binary.
4783
 
          # Since the "real" binary is built for $host, then this
4784
 
          # wrapper might as well be built for $host, too.
4785
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4786
 
          ;;
4787
 
        esac
4788
 
        $rm $output
4789
 
        trap "$rm $output; exit 1" 1 2 15
 
5236
          # we should really use a build-platform specific compiler
 
5237
          # here, but OTOH, the wrappers (shell script and this C one)
 
5238
          # are only useful if you want to execute the "real" binary.
 
5239
          # Since the "real" binary is built for $host, then this
 
5240
          # wrapper might as well be built for $host, too.
 
5241
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5242
          ;;
 
5243
        esac
 
5244
        $rm $output
 
5245
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4790
5246
 
4791
5247
        $echo > $output "\
4792
5248
#! $SHELL
4807
5263
 
4808
5264
# The HP-UX ksh and POSIX shell print the target directory to stdout
4809
5265
# if CDPATH is set.
4810
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
5266
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4811
5267
 
4812
5268
relink_command=\"$relink_command\"
4813
5269
 
4886
5342
      else
4887
5343
        $echo \"\$relink_command_output\" >&2
4888
5344
        $rm \"\$progdir/\$file\"
4889
 
        exit 1
 
5345
        exit $EXIT_FAILURE
4890
5346
      fi
4891
5347
    fi
4892
5348
 
4936
5392
        # Backslashes separate directories on plain windows
4937
5393
        *-*-mingw | *-*-os2*)
4938
5394
          $echo >> $output "\
4939
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5395
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4940
5396
"
4941
5397
          ;;
4942
5398
 
4943
5399
        *)
4944
 
          # Need to set LD_LIBRARY_PATH, to the value already
4945
 
          # computed within libtool.
4946
5400
          $echo >> $output "\
4947
 
      LD_LIBRARY_PATH=\"$rpath\" exec \$progdir/\$program \${1+\"\$@\"}
 
5401
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
4948
5402
"
4949
5403
          ;;
4950
5404
        esac
4951
5405
        $echo >> $output "\
4952
5406
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4953
 
      exit 1
 
5407
      exit $EXIT_FAILURE
4954
5408
    fi
4955
5409
  else
4956
5410
    # The program doesn't exist.
4957
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5411
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4958
5412
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4959
5413
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4960
 
    exit 1
 
5414
    exit $EXIT_FAILURE
4961
5415
  fi
4962
5416
fi\
4963
5417
"
4964
5418
        chmod +x $output
4965
5419
      fi
4966
 
      exit 0
 
5420
      exit $EXIT_SUCCESS
4967
5421
      ;;
4968
5422
    esac
4969
5423
 
4986
5440
 
4987
5441
      if test -n "$addlibs"; then
4988
5442
        gentop="$output_objdir/${outputname}x"
4989
 
        $show "${rm}r $gentop"
4990
 
        $run ${rm}r "$gentop"
4991
 
        $show "$mkdir $gentop"
4992
 
        $run $mkdir "$gentop"
4993
 
        status=$?
4994
 
        if test "$status" -ne 0 && test ! -d "$gentop"; then
4995
 
          exit $status
4996
 
        fi
4997
5443
        generated="$generated $gentop"
4998
5444
 
4999
 
        # Add in members from convenience archives.
5000
 
        for xlib in $addlibs; do
5001
 
          # Extract the objects.
5002
 
          case $xlib in
5003
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5004
 
          *) xabs=`pwd`"/$xlib" ;;
5005
 
          esac
5006
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5007
 
          xdir="$gentop/$xlib"
5008
 
 
5009
 
          $show "${rm}r $xdir"
5010
 
          $run ${rm}r "$xdir"
5011
 
          $show "$mkdir $xdir"
5012
 
          $run $mkdir "$xdir"
5013
 
          status=$?
5014
 
          if test "$status" -ne 0 && test ! -d "$xdir"; then
5015
 
            exit $status
5016
 
          fi
5017
 
          # We will extract separately just the conflicting names and we will no
5018
 
          # longer touch any unique names. It is faster to leave these extract
5019
 
          # automatically by $AR in one run.
5020
 
          $show "(cd $xdir && $AR x $xabs)"
5021
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5022
 
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5023
 
            :
5024
 
          else
5025
 
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5026
 
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5027
 
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
5028
 
            do
5029
 
              i=1
5030
 
              while test "$i" -le "$count"
5031
 
              do
5032
 
               # Put our $i before any first dot (extension)
5033
 
               # Never overwrite any file
5034
 
               name_to="$name"
5035
 
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5036
 
               do
5037
 
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5038
 
               done
5039
 
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5040
 
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5041
 
               i=`expr $i + 1`
5042
 
              done
5043
 
            done
5044
 
          fi
5045
 
 
5046
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5047
 
        done
 
5445
        func_extract_archives $gentop $addlibs
 
5446
        oldobjs="$oldobjs $func_extract_archives_result"
5048
5447
      fi
5049
5448
 
5050
 
      compiler_flags="$compiler_flags $add_flags"
5051
 
 
5052
5449
      # Do each command in the archive commands.
5053
5450
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5054
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5451
       cmds=$old_archive_from_new_cmds
5055
5452
      else
 
5453
        # POSIX demands no paths to be encoded in archives.  We have
 
5454
        # to avoid creating archives with duplicate basenames if we
 
5455
        # might have to extract them afterwards, e.g., when creating a
 
5456
        # static archive out of a convenience library, or when linking
 
5457
        # the entirety of a libtool archive into another (currently
 
5458
        # not supported by libtool).
 
5459
        if (for obj in $oldobjs
 
5460
            do
 
5461
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5462
            done | sort | sort -uc >/dev/null 2>&1); then
 
5463
          :
 
5464
        else
 
5465
          $echo "copying selected object files to avoid basename conflicts..."
 
5466
 
 
5467
          if test -z "$gentop"; then
 
5468
            gentop="$output_objdir/${outputname}x"
 
5469
            generated="$generated $gentop"
 
5470
 
 
5471
            $show "${rm}r $gentop"
 
5472
            $run ${rm}r "$gentop"
 
5473
            $show "$mkdir $gentop"
 
5474
            $run $mkdir "$gentop"
 
5475
            exit_status=$?
 
5476
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5477
              exit $exit_status
 
5478
            fi
 
5479
          fi
 
5480
 
 
5481
          save_oldobjs=$oldobjs
 
5482
          oldobjs=
 
5483
          counter=1
 
5484
          for obj in $save_oldobjs
 
5485
          do
 
5486
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5487
            case " $oldobjs " in
 
5488
            " ") oldobjs=$obj ;;
 
5489
            *[\ /]"$objbase "*)
 
5490
              while :; do
 
5491
                # Make sure we don't pick an alternate name that also
 
5492
                # overlaps.
 
5493
                newobj=lt$counter-$objbase
 
5494
                counter=`expr $counter + 1`
 
5495
                case " $oldobjs " in
 
5496
                *[\ /]"$newobj "*) ;;
 
5497
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5498
                esac
 
5499
              done
 
5500
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5501
              $run ln "$obj" "$gentop/$newobj" ||
 
5502
              $run cp "$obj" "$gentop/$newobj"
 
5503
              oldobjs="$oldobjs $gentop/$newobj"
 
5504
              ;;
 
5505
            *) oldobjs="$oldobjs $obj" ;;
 
5506
            esac
 
5507
          done
 
5508
        fi
 
5509
 
5056
5510
        eval cmds=\"$old_archive_cmds\"
5057
5511
 
5058
5512
        if len=`expr "X$cmds" : ".*"` &&
5059
5513
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5060
 
          :
 
5514
          cmds=$old_archive_cmds
5061
5515
        else
5062
5516
          # the command line is too long to link in one step, link in parts
5063
5517
          $echo "using piecewise archive linking..."
5066
5520
          objlist=
5067
5521
          concat_cmds=
5068
5522
          save_oldobjs=$oldobjs
5069
 
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5070
 
          # encoded into archives.  This makes 'ar r' malfunction in
5071
 
          # this piecewise linking case whenever conflicting object
5072
 
          # names appear in distinct ar calls; check, warn and compensate.
5073
 
            if (for obj in $save_oldobjs
5074
 
            do
5075
 
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
5076
 
            done | sort | sort -uc >/dev/null 2>&1); then
5077
 
            :
5078
 
          else
5079
 
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5080
 
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5081
 
            AR_FLAGS=cq
5082
 
          fi
 
5523
 
5083
5524
          # Is there a better way of finding the last object in the list?
5084
5525
          for obj in $save_oldobjs
5085
5526
          do
5086
5527
            last_oldobj=$obj
5087
 
          done  
 
5528
          done
5088
5529
          for obj in $save_oldobjs
5089
5530
          do
5090
5531
            oldobjs="$objlist $obj"
5091
5532
            objlist="$objlist $obj"
5092
5533
            eval test_cmds=\"$old_archive_cmds\"
5093
 
            if len=`expr "X$test_cmds" : ".*"` &&
 
5534
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5094
5535
               test "$len" -le "$max_cmd_len"; then
5095
5536
              :
5096
5537
            else
5098
5539
              oldobjs=$objlist
5099
5540
              if test "$obj" = "$last_oldobj" ; then
5100
5541
                RANLIB=$save_RANLIB
5101
 
              fi  
 
5542
              fi
5102
5543
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5103
5544
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5104
5545
              objlist=
5109
5550
          if test "X$oldobjs" = "X" ; then
5110
5551
            eval cmds=\"\$concat_cmds\"
5111
5552
          else
5112
 
            eval cmds=\"\$concat_cmds~$old_archive_cmds\"
 
5553
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5113
5554
          fi
5114
5555
        fi
5115
5556
      fi
5116
5557
      save_ifs="$IFS"; IFS='~'
5117
5558
      for cmd in $cmds; do
 
5559
        eval cmd=\"$cmd\"
5118
5560
        IFS="$save_ifs"
5119
5561
        $show "$cmd"
5120
5562
        $run eval "$cmd" || exit $?
5146
5588
        fi
5147
5589
      done
5148
5590
      # Quote the link command for shipping.
5149
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
 
5591
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5150
5592
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5151
5593
      if test "$hardcode_automatic" = yes ; then
5152
 
        relink_command=
5153
 
      fi  
 
5594
        relink_command=
 
5595
      fi
 
5596
 
 
5597
 
5154
5598
      # Only create the output if not a dry run.
5155
5599
      if test -z "$run"; then
5156
5600
        for installed in no yes; do
5168
5612
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5169
5613
                if test -z "$libdir"; then
5170
5614
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5171
 
                  exit 1
 
5615
                  exit $EXIT_FAILURE
5172
5616
                fi
5173
5617
                newdependency_libs="$newdependency_libs $libdir/$name"
5174
5618
                ;;
5182
5626
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5183
5627
              if test -z "$libdir"; then
5184
5628
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5185
 
                exit 1
 
5629
                exit $EXIT_FAILURE
5186
5630
              fi
5187
5631
              newdlfiles="$newdlfiles $libdir/$name"
5188
5632
            done
5193
5637
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5194
5638
              if test -z "$libdir"; then
5195
5639
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5196
 
                exit 1
 
5640
                exit $EXIT_FAILURE
5197
5641
              fi
5198
5642
              newdlprefiles="$newdlprefiles $libdir/$name"
5199
5643
            done
5200
5644
            dlprefiles="$newdlprefiles"
 
5645
          else
 
5646
            newdlfiles=
 
5647
            for lib in $dlfiles; do
 
5648
              case $lib in
 
5649
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5650
                *) abs=`pwd`"/$lib" ;;
 
5651
              esac
 
5652
              newdlfiles="$newdlfiles $abs"
 
5653
            done
 
5654
            dlfiles="$newdlfiles"
 
5655
            newdlprefiles=
 
5656
            for lib in $dlprefiles; do
 
5657
              case $lib in
 
5658
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5659
                *) abs=`pwd`"/$lib" ;;
 
5660
              esac
 
5661
              newdlprefiles="$newdlprefiles $abs"
 
5662
            done
 
5663
            dlprefiles="$newdlprefiles"
5201
5664
          fi
5202
5665
          $rm $output
5203
5666
          # place dlname in correct position for cygwin
5241
5704
 
5242
5705
# Directory that this library needs to be installed in:
5243
5706
libdir='$install_libdir'"
5244
 
          if test "$installed" = no && test "$need_relink" = yes && test "$fast_install" = no; then
 
5707
          if test "$installed" = no && test "$need_relink" = yes; then
5245
5708
            $echo >> $output "\
5246
5709
relink_command=\"$relink_command\""
5247
5710
          fi
5254
5717
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5255
5718
      ;;
5256
5719
    esac
5257
 
    exit 0
 
5720
    exit $EXIT_SUCCESS
5258
5721
    ;;
5259
5722
 
5260
5723
  # libtool install mode
5265
5728
    # install_prog (especially on Windows NT).
5266
5729
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5267
5730
       # Allow the use of GNU shtool's install command.
5268
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5731
       $echo "X$nonopt" | grep shtool > /dev/null; then
5269
5732
      # Aesthetically quote it.
5270
5733
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5271
5734
      case $arg in
5272
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5735
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5273
5736
        arg="\"$arg\""
5274
5737
        ;;
5275
5738
      esac
5278
5741
      shift
5279
5742
    else
5280
5743
      install_prog=
5281
 
      arg="$nonopt"
 
5744
      arg=$nonopt
5282
5745
    fi
5283
5746
 
5284
5747
    # The real first argument should be the name of the installation program.
5285
5748
    # Aesthetically quote it.
5286
5749
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5287
5750
    case $arg in
5288
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5751
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5289
5752
      arg="\"$arg\""
5290
5753
      ;;
5291
5754
    esac
5303
5766
    do
5304
5767
      if test -n "$dest"; then
5305
5768
        files="$files $dest"
5306
 
        dest="$arg"
 
5769
        dest=$arg
5307
5770
        continue
5308
5771
      fi
5309
5772
 
5310
5773
      case $arg in
5311
5774
      -d) isdir=yes ;;
5312
 
      -f) prev="-f" ;;
5313
 
      -g) prev="-g" ;;
5314
 
      -m) prev="-m" ;;
5315
 
      -o) prev="-o" ;;
 
5775
      -f) 
 
5776
        case " $install_prog " in
 
5777
        *[\\\ /]cp\ *) ;;
 
5778
        *) prev=$arg ;;
 
5779
        esac
 
5780
        ;;
 
5781
      -g | -m | -o) prev=$arg ;;
5316
5782
      -s)
5317
5783
        stripme=" -s"
5318
5784
        continue
5319
5785
        ;;
5320
 
      -*) ;;
5321
 
 
 
5786
      -*)
 
5787
        ;;
5322
5788
      *)
5323
5789
        # If the previous option needed an argument, then skip it.
5324
5790
        if test -n "$prev"; then
5325
5791
          prev=
5326
5792
        else
5327
 
          dest="$arg"
 
5793
          dest=$arg
5328
5794
          continue
5329
5795
        fi
5330
5796
        ;;
5333
5799
      # Aesthetically quote the argument.
5334
5800
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5335
5801
      case $arg in
5336
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5802
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5337
5803
        arg="\"$arg\""
5338
5804
        ;;
5339
5805
      esac
5343
5809
    if test -z "$install_prog"; then
5344
5810
      $echo "$modename: you must specify an install program" 1>&2
5345
5811
      $echo "$help" 1>&2
5346
 
      exit 1
 
5812
      exit $EXIT_FAILURE
5347
5813
    fi
5348
5814
 
5349
5815
    if test -n "$prev"; then
5350
5816
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5351
5817
      $echo "$help" 1>&2
5352
 
      exit 1
 
5818
      exit $EXIT_FAILURE
5353
5819
    fi
5354
5820
 
5355
5821
    if test -z "$files"; then
5359
5825
        $echo "$modename: you must specify a destination" 1>&2
5360
5826
      fi
5361
5827
      $echo "$help" 1>&2
5362
 
      exit 1
 
5828
      exit $EXIT_FAILURE
5363
5829
    fi
5364
5830
 
5365
5831
    # Strip any trailing slash from the destination.
5380
5846
      if test "$#" -gt 2; then
5381
5847
        $echo "$modename: \`$dest' is not a directory" 1>&2
5382
5848
        $echo "$help" 1>&2
5383
 
        exit 1
 
5849
        exit $EXIT_FAILURE
5384
5850
      fi
5385
5851
    fi
5386
5852
    case $destdir in
5392
5858
        *)
5393
5859
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5394
5860
          $echo "$help" 1>&2
5395
 
          exit 1
 
5861
          exit $EXIT_FAILURE
5396
5862
          ;;
5397
5863
        esac
5398
5864
      done
5421
5887
        else
5422
5888
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5423
5889
          $echo "$help" 1>&2
5424
 
          exit 1
 
5890
          exit $EXIT_FAILURE
5425
5891
        fi
5426
5892
 
5427
5893
        library_names=
5463
5929
          # but it's something to keep an eye on.
5464
5930
          if test "$inst_prefix_dir" = "$destdir"; then
5465
5931
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5466
 
            exit 1
 
5932
            exit $EXIT_FAILURE
5467
5933
          fi
5468
5934
 
5469
5935
          if test -n "$inst_prefix_dir"; then
5478
5944
          if $run eval "$relink_command"; then :
5479
5945
          else
5480
5946
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5481
 
            exit 1
 
5947
            exit $EXIT_FAILURE
5482
5948
          fi
5483
5949
        fi
5484
5950
 
5502
5968
 
5503
5969
          if test "$#" -gt 0; then
5504
5970
            # Delete the old symlinks, and create new ones.
 
5971
            # Try `ln -sf' first, because the `ln' binary might depend on
 
5972
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
5973
            # so we also need to try rm && ln -s.
5505
5974
            for linkname
5506
5975
            do
5507
5976
              if test "$linkname" != "$realname"; then
5508
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5509
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
5977
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
5978
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5510
5979
              fi
5511
5980
            done
5512
5981
          fi
5513
5982
 
5514
5983
          # Do each command in the postinstall commands.
5515
5984
          lib="$destdir/$realname"
5516
 
          eval cmds=\"$postinstall_cmds\"
 
5985
          cmds=$postinstall_cmds
5517
5986
          save_ifs="$IFS"; IFS='~'
5518
5987
          for cmd in $cmds; do
5519
5988
            IFS="$save_ifs"
 
5989
            eval cmd=\"$cmd\"
5520
5990
            $show "$cmd"
5521
 
            $run eval "$cmd" || exit $?
 
5991
            $run eval "$cmd" || {
 
5992
              lt_exit=$?
 
5993
 
 
5994
              # Restore the uninstalled library and exit
 
5995
              if test "$mode" = relink; then
 
5996
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
5997
              fi
 
5998
 
 
5999
              exit $lt_exit
 
6000
            }
5522
6001
          done
5523
6002
          IFS="$save_ifs"
5524
6003
        fi
5556
6035
        *)
5557
6036
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5558
6037
          $echo "$help" 1>&2
5559
 
          exit 1
 
6038
          exit $EXIT_FAILURE
5560
6039
          ;;
5561
6040
        esac
5562
6041
 
5574
6053
          $show "$install_prog $staticobj $staticdest"
5575
6054
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5576
6055
        fi
5577
 
        exit 0
 
6056
        exit $EXIT_SUCCESS
5578
6057
        ;;
5579
6058
 
5580
6059
      *)
5612
6091
          notinst_deplibs=
5613
6092
          relink_command=
5614
6093
 
5615
 
          # To insure that "foo" is sourced, and not "foo.exe",
5616
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5617
 
          # which disallows the automatic-append-.exe behavior.
5618
 
          case $build in
5619
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5620
 
          *) wrapperdot=${wrapper} ;;
5621
 
          esac
 
6094
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6095
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6096
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6097
          # `FILE.' does not work on cygwin managed mounts.
 
6098
          #
5622
6099
          # If there is no directory component, then add one.
5623
 
          case $file in
5624
 
          */* | *\\*) . ${wrapperdot} ;;
5625
 
          *) . ./${wrapperdot} ;;
 
6100
          case $wrapper in
 
6101
          */* | *\\*) . ${wrapper} ;;
 
6102
          *) . ./${wrapper} ;;
5626
6103
          esac
5627
6104
 
5628
6105
          # Check the variables that should have been set.
5629
6106
          if test -z "$notinst_deplibs"; then
5630
6107
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5631
 
            exit 1
 
6108
            exit $EXIT_FAILURE
5632
6109
          fi
5633
6110
 
5634
6111
          finalize=yes
5650
6127
          done
5651
6128
 
5652
6129
          relink_command=
5653
 
          # To insure that "foo" is sourced, and not "foo.exe",
5654
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5655
 
          # which disallows the automatic-append-.exe behavior.
5656
 
          case $build in
5657
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5658
 
          *) wrapperdot=${wrapper} ;;
5659
 
          esac
 
6130
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6131
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6132
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6133
          # `FILE.' does not work on cygwin managed mounts.
 
6134
          #
5660
6135
          # If there is no directory component, then add one.
5661
 
          case $file in
5662
 
          */* | *\\*) . ${wrapperdot} ;;
5663
 
          *) . ./${wrapperdot} ;;
 
6136
          case $wrapper in
 
6137
          */* | *\\*) . ${wrapper} ;;
 
6138
          *) . ./${wrapper} ;;
5664
6139
          esac
5665
6140
 
5666
6141
          outputname=
5667
6142
          if test "$fast_install" = no && test -n "$relink_command"; then
5668
6143
            if test "$finalize" = yes && test -z "$run"; then
5669
 
              tmpdir="/tmp"
5670
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5671
 
              tmpdir="$tmpdir/libtool-$$"
5672
 
              if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
5673
 
              else
5674
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5675
 
                continue
5676
 
              fi
 
6144
              tmpdir=`func_mktempdir`
5677
6145
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5678
6146
              outputname="$tmpdir/$file"
5679
6147
              # Replace the output file specification.
5697
6165
        fi
5698
6166
 
5699
6167
        # remove .exe since cygwin /usr/bin/install will append another
5700
 
        # one anyways
 
6168
        # one anyway 
5701
6169
        case $install_prog,$host in
5702
6170
        */usr/bin/install*,*cygwin*)
5703
6171
          case $file:$destfile in
5729
6197
      $show "$install_prog $file $oldlib"
5730
6198
      $run eval "$install_prog \$file \$oldlib" || exit $?
5731
6199
 
5732
 
      if test -n "$stripme" && test -n "$striplib"; then
 
6200
      if test -n "$stripme" && test -n "$old_striplib"; then
5733
6201
        $show "$old_striplib $oldlib"
5734
6202
        $run eval "$old_striplib $oldlib" || exit $?
5735
6203
      fi
5736
6204
 
5737
6205
      # Do each command in the postinstall commands.
5738
 
      eval cmds=\"$old_postinstall_cmds\"
 
6206
      cmds=$old_postinstall_cmds
5739
6207
      save_ifs="$IFS"; IFS='~'
5740
6208
      for cmd in $cmds; do
5741
6209
        IFS="$save_ifs"
 
6210
        eval cmd=\"$cmd\"
5742
6211
        $show "$cmd"
5743
6212
        $run eval "$cmd" || exit $?
5744
6213
      done
5752
6221
    if test -n "$current_libdirs"; then
5753
6222
      # Maybe just do a dry run.
5754
6223
      test -n "$run" && current_libdirs=" -n$current_libdirs"
5755
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
6224
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
5756
6225
    else
5757
 
      exit 0
 
6226
      exit $EXIT_SUCCESS
5758
6227
    fi
5759
6228
    ;;
5760
6229
 
5773
6242
      for libdir in $libdirs; do
5774
6243
        if test -n "$finish_cmds"; then
5775
6244
          # Do each command in the finish commands.
5776
 
          eval cmds=\"$finish_cmds\"
 
6245
          cmds=$finish_cmds
5777
6246
          save_ifs="$IFS"; IFS='~'
5778
6247
          for cmd in $cmds; do
5779
6248
            IFS="$save_ifs"
 
6249
            eval cmd=\"$cmd\"
5780
6250
            $show "$cmd"
5781
6251
            $run eval "$cmd" || admincmds="$admincmds
5782
6252
       $cmd"
5793
6263
    fi
5794
6264
 
5795
6265
    # Exit here if they wanted silent mode.
5796
 
    exit 0
 
6266
    test "$show" = : && exit $EXIT_SUCCESS
5797
6267
 
5798
 
    $echo "----------------------------------------------------------------------"
 
6268
    $echo "X----------------------------------------------------------------------" | $Xsed
5799
6269
    $echo "Libraries have been installed in:"
5800
6270
    for libdir in $libdirs; do
5801
6271
      $echo "   $libdir"
5828
6298
    $echo
5829
6299
    $echo "See any operating system documentation about shared libraries for"
5830
6300
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5831
 
    $echo "----------------------------------------------------------------------"
5832
 
    exit 0
 
6301
    $echo "X----------------------------------------------------------------------" | $Xsed
 
6302
    exit $EXIT_SUCCESS
5833
6303
    ;;
5834
6304
 
5835
6305
  # libtool execute mode
5841
6311
    if test -z "$cmd"; then
5842
6312
      $echo "$modename: you must specify a COMMAND" 1>&2
5843
6313
      $echo "$help"
5844
 
      exit 1
 
6314
      exit $EXIT_FAILURE
5845
6315
    fi
5846
6316
 
5847
6317
    # Handle -dlopen flags immediately.
5849
6319
      if test ! -f "$file"; then
5850
6320
        $echo "$modename: \`$file' is not a file" 1>&2
5851
6321
        $echo "$help" 1>&2
5852
 
        exit 1
 
6322
        exit $EXIT_FAILURE
5853
6323
      fi
5854
6324
 
5855
6325
      dir=
5860
6330
        else
5861
6331
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5862
6332
          $echo "$help" 1>&2
5863
 
          exit 1
 
6333
          exit $EXIT_FAILURE
5864
6334
        fi
5865
6335
 
5866
6336
        # Read the libtool library.
5887
6357
          dir="$dir/$objdir"
5888
6358
        else
5889
6359
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5890
 
          exit 1
 
6360
          exit $EXIT_FAILURE
5891
6361
        fi
5892
6362
        ;;
5893
6363
 
5967
6437
        $echo "export $shlibpath_var"
5968
6438
      fi
5969
6439
      $echo "$cmd$args"
5970
 
      exit 0
 
6440
      exit $EXIT_SUCCESS
5971
6441
    fi
5972
6442
    ;;
5973
6443
 
5995
6465
    if test -z "$rm"; then
5996
6466
      $echo "$modename: you must specify an RM program" 1>&2
5997
6467
      $echo "$help" 1>&2
5998
 
      exit 1
 
6468
      exit $EXIT_FAILURE
5999
6469
    fi
6000
6470
 
6001
6471
    rmdirs=
6045
6515
            rmfiles="$rmfiles $objdir/$n"
6046
6516
          done
6047
6517
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6048
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6049
6518
 
6050
 
          if test "$mode" = uninstall; then
 
6519
          case "$mode" in
 
6520
          clean)
 
6521
            case "  $library_names " in
 
6522
            # "  " in the beginning catches empty $dlname
 
6523
            *" $dlname "*) ;;
 
6524
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6525
            esac
 
6526
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6527
            ;;
 
6528
          uninstall)
6051
6529
            if test -n "$library_names"; then
6052
6530
              # Do each command in the postuninstall commands.
6053
 
              eval cmds=\"$postuninstall_cmds\"
 
6531
              cmds=$postuninstall_cmds
6054
6532
              save_ifs="$IFS"; IFS='~'
6055
6533
              for cmd in $cmds; do
6056
6534
                IFS="$save_ifs"
 
6535
                eval cmd=\"$cmd\"
6057
6536
                $show "$cmd"
6058
6537
                $run eval "$cmd"
6059
6538
                if test "$?" -ne 0 && test "$rmforce" != yes; then
6065
6544
 
6066
6545
            if test -n "$old_library"; then
6067
6546
              # Do each command in the old_postuninstall commands.
6068
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6547
              cmds=$old_postuninstall_cmds
6069
6548
              save_ifs="$IFS"; IFS='~'
6070
6549
              for cmd in $cmds; do
6071
6550
                IFS="$save_ifs"
 
6551
                eval cmd=\"$cmd\"
6072
6552
                $show "$cmd"
6073
6553
                $run eval "$cmd"
6074
6554
                if test "$?" -ne 0 && test "$rmforce" != yes; then
6078
6558
              IFS="$save_ifs"
6079
6559
            fi
6080
6560
            # FIXME: should reinstall the best remaining shared library.
6081
 
          fi
 
6561
            ;;
 
6562
          esac
6082
6563
        fi
6083
6564
        ;;
6084
6565
 
6107
6588
        if test "$mode" = clean ; then
6108
6589
          noexename=$name
6109
6590
          case $file in
6110
 
          *.exe) 
 
6591
          *.exe)
6111
6592
            file=`$echo $file|${SED} 's,.exe$,,'`
6112
6593
            noexename=`$echo $name|${SED} 's,.exe$,,'`
6113
6594
            # $file with .exe has already been added to rmfiles,
6152
6633
  "")
6153
6634
    $echo "$modename: you must specify a MODE" 1>&2
6154
6635
    $echo "$generic_help" 1>&2
6155
 
    exit 1
 
6636
    exit $EXIT_FAILURE
6156
6637
    ;;
6157
6638
  esac
6158
6639
 
6159
6640
  if test -z "$exec_cmd"; then
6160
6641
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6161
6642
    $echo "$generic_help" 1>&2
6162
 
    exit 1
 
6643
    exit $EXIT_FAILURE
6163
6644
  fi
6164
6645
fi # test -z "$show_help"
6165
6646
 
6166
6647
if test -n "$exec_cmd"; then
6167
6648
  eval exec $exec_cmd
6168
 
  exit 1
 
6649
  exit $EXIT_FAILURE
6169
6650
fi
6170
6651
 
6171
6652
# We need to display help for each of the modes.
6201
6682
a more detailed description of MODE.
6202
6683
 
6203
6684
Report bugs to <bug-libtool@gnu.org>."
6204
 
  exit 0
 
6685
  exit $EXIT_SUCCESS
6205
6686
  ;;
6206
6687
 
6207
6688
clean)
6313
6794
  -no-undefined     declare that a library does not refer to external symbols
6314
6795
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6315
6796
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6797
  -precious-files-regex REGEX
 
6798
                    don't remove output files matching REGEX
6316
6799
  -release RELEASE  specify package release information
6317
6800
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6318
6801
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6354
6837
*)
6355
6838
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6356
6839
  $echo "$help" 1>&2
6357
 
  exit 1
 
6840
  exit $EXIT_FAILURE
6358
6841
  ;;
6359
6842
esac
6360
6843
 
6361
6844
$echo
6362
6845
$echo "Try \`$modename --help' for more information about other modes."
6363
6846
 
6364
 
exit 0
 
6847
exit $?
6365
6848
 
6366
6849
# The TAGs below are defined such that we never get into a situation
6367
6850
# in which we disable both kinds of libraries.  Given conflicting
6375
6858
# configuration.  But we'll never go from static-only to shared-only.
6376
6859
 
6377
6860
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6378
 
build_libtool_libs=no
6379
 
build_old_libs=yes
 
6861
disable_libs=shared
6380
6862
# ### END LIBTOOL TAG CONFIG: disable-shared
6381
6863
 
6382
6864
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6383
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6865
disable_libs=static
6384
6866
# ### END LIBTOOL TAG CONFIG: disable-static
6385
6867
 
6386
6868
# Local Variables: