~ubuntu-branches/ubuntu/edgy/strutilsxx/edgy

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2005-12-04 23:38:46 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051204233846-m4kho0pkodyneqae
Tags: 0.7.2-1.1
* Non-maintainer upload.
* Medium-urgency upload for RC bugfix.
* Rename libstrutilsxx-0.7 to libstrutilsxx-0.7c2a for the C++ mt allocator
  ABI transition, and conflict/replace libstrutilsxx-0.7 accordingly
  (closes: #339268).

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
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
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.6
 
47
TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $"
 
48
 
 
49
 
27
50
# Check that we have a working $echo.
28
51
if test "X$1" = X--no-reexec; then
29
52
  # Discard the --no-reexec flag, and continue.
36
59
  :
37
60
else
38
61
  # Restart under the correct shell, and then maybe $echo will work.
39
 
  exec $SHELL "$0" --no-reexec ${1+"$@"}
 
62
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
40
63
fi
41
64
 
42
65
if test "X$1" = X--fallback-echo; then
45
68
  cat <<EOF
46
69
$*
47
70
EOF
48
 
  exit 0
 
71
  exit $EXIT_SUCCESS
49
72
fi
50
73
 
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.4.3
59
 
TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
60
 
 
61
74
default_mode=
62
75
help="Try \`$progname --help' for more information."
63
76
magic="%%%MAGIC variable%%%"
69
82
# metacharacters that are still active within double-quoted strings.
70
83
Xsed="${SED}"' -e 1s/^X//'
71
84
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
# test EBCDIC or ASCII                                                         
73
 
case `echo A|od -x` in                                                         
74
 
 *[Cc]1*) # EBCDIC based system                                                
75
 
  SP2NL="tr '\100' '\n'"                                                       
76
 
  NL2SP="tr '\r\n' '\100\100'"                                                 
77
 
  ;;                                                                           
78
 
 *) # Assume ASCII based system                                                
79
 
  SP2NL="tr '\040' '\012'"                                                     
80
 
  NL2SP="tr '\015\012' '\040\040'"                                             
81
 
  ;;                                                                           
82
 
esac                                                                           
 
85
# test EBCDIC or ASCII
 
86
case `echo A|tr A '\301'` in
 
87
 A) # EBCDIC based system
 
88
  SP2NL="tr '\100' '\n'"
 
89
  NL2SP="tr '\r\n' '\100\100'"
 
90
  ;;
 
91
 *) # Assume ASCII based system
 
92
  SP2NL="tr '\040' '\012'"
 
93
  NL2SP="tr '\015\012' '\040\040'"
 
94
  ;;
 
95
esac
83
96
 
84
97
# NLS nuisances.
85
98
# Only set LANG and LC_ALL to C if already set.
94
107
fi
95
108
 
96
109
# Make sure IFS has a sensible default
97
 
: ${IFS="       "}
 
110
: ${IFS="       
 
111
"}
98
112
 
99
113
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100
 
  echo "$modename: not configured to build any kind of library" 1>&2
101
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
102
 
  exit 1
 
114
  $echo "$modename: not configured to build any kind of library" 1>&2
 
115
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
116
  exit $EXIT_FAILURE
103
117
fi
104
118
 
105
119
# Global variables.
114
128
lo2o="s/\\.lo\$/.${objext}/"
115
129
o2lo="s/\\.${objext}\$/.lo/"
116
130
 
 
131
#####################################
 
132
# Shell function definitions:
 
133
# This seems to be the best place for them
 
134
 
 
135
# func_win32_libid arg
 
136
# return the library type of file 'arg'
 
137
#
 
138
# Need a lot of goo to handle *both* DLLs and import libs
 
139
# Has to be a shell function in order to 'eat' the argument
 
140
# that is supplied when $file_magic_command is called.
 
141
func_win32_libid () {
 
142
  win32_libid_type="unknown"
 
143
  win32_fileres=`file -L $1 2>/dev/null`
 
144
  case $win32_fileres in
 
145
  *ar\ archive\ import\ library*) # definitely import
 
146
    win32_libid_type="x86 archive import"
 
147
    ;;
 
148
  *ar\ archive*) # could be an import, or static
 
149
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
 
150
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
151
      win32_nmres=`eval $NM -f posix -A $1 | \
 
152
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
 
153
      if test "X$win32_nmres" = "Ximport" ; then
 
154
        win32_libid_type="x86 archive import"
 
155
      else
 
156
        win32_libid_type="x86 archive static"
 
157
      fi
 
158
    fi
 
159
    ;;
 
160
  *DLL*)
 
161
    win32_libid_type="x86 DLL"
 
162
    ;;
 
163
  *executable*) # but shell scripts are "executable" too...
 
164
    case $win32_fileres in
 
165
    *MS\ Windows\ PE\ Intel*)
 
166
      win32_libid_type="x86 DLL"
 
167
      ;;
 
168
    esac
 
169
    ;;
 
170
  esac
 
171
  $echo $win32_libid_type
 
172
}
 
173
 
 
174
 
 
175
# func_infer_tag arg
 
176
# Infer tagged configuration to use if any are available and
 
177
# if one wasn't chosen via the "--tag" command line option.
 
178
# Only attempt this if the compiler in the base compile
 
179
# command doesn't match the default compiler.
 
180
# arg is usually of the form 'gcc ...'
 
181
func_infer_tag () {
 
182
    if test -n "$available_tags" && test -z "$tagname"; then
 
183
      CC_quoted=
 
184
      for arg in $CC; do
 
185
        case $arg in
 
186
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
187
          arg="\"$arg\""
 
188
          ;;
 
189
        esac
 
190
        CC_quoted="$CC_quoted $arg"
 
191
      done
 
192
      case $@ in
 
193
      # Blanks in the command may have been stripped by the calling shell,
 
194
      # but not from the CC environment variable when configure was run.
 
195
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
196
      # Blanks at the start of $base_compile will cause this to fail
 
197
      # if we don't check for them as well.
 
198
      *)
 
199
        for z in $available_tags; do
 
200
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
201
            # Evaluate the configuration.
 
202
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
203
            CC_quoted=
 
204
            for arg in $CC; do
 
205
            # Double-quote args containing other shell metacharacters.
 
206
            case $arg in
 
207
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
208
              arg="\"$arg\""
 
209
              ;;
 
210
            esac
 
211
            CC_quoted="$CC_quoted $arg"
 
212
          done
 
213
            case "$@ " in
 
214
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
215
              # The compiler in the base compile command matches
 
216
              # the one in the tagged configuration.
 
217
              # Assume this is the tagged configuration we want.
 
218
              tagname=$z
 
219
              break
 
220
              ;;
 
221
            esac
 
222
          fi
 
223
        done
 
224
        # If $tagname still isn't set, then no tagged configuration
 
225
        # was found and let the user know that the "--tag" command
 
226
        # line option must be used.
 
227
        if test -z "$tagname"; then
 
228
          $echo "$modename: unable to infer tagged configuration"
 
229
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
230
          exit $EXIT_FAILURE
 
231
#        else
 
232
#          $echo "$modename: using $tagname tagged configuration"
 
233
        fi
 
234
        ;;
 
235
      esac
 
236
    fi
 
237
}
 
238
# End of Shell function definitions
 
239
#####################################
 
240
 
 
241
# Darwin sucks
 
242
eval std_shrext=\"$shrext_cmds\"
 
243
 
117
244
# Parse our command line options once, thoroughly.
118
 
while test $# -gt 0
 
245
while test "$#" -gt 0
119
246
do
120
247
  arg="$1"
121
248
  shift
131
258
    execute_dlfiles)
132
259
      execute_dlfiles="$execute_dlfiles $arg"
133
260
      ;;
 
261
    tag)
 
262
      tagname="$arg"
 
263
      preserve_args="${preserve_args}=$arg"
 
264
 
 
265
      # Check whether tagname contains only valid characters
 
266
      case $tagname in
 
267
      *[!-_A-Za-z0-9,/]*)
 
268
        $echo "$progname: invalid tag name: $tagname" 1>&2
 
269
        exit $EXIT_FAILURE
 
270
        ;;
 
271
      esac
 
272
 
 
273
      case $tagname in
 
274
      CC)
 
275
        # Don't test for the "default" C tag, as we know, it's there, but
 
276
        # not specially marked.
 
277
        ;;
 
278
      *)
 
279
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
 
280
          taglist="$taglist $tagname"
 
281
          # Evaluate the configuration.
 
282
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
 
283
        else
 
284
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
 
285
        fi
 
286
        ;;
 
287
      esac
 
288
      ;;
134
289
    *)
135
290
      eval "$prev=\$arg"
136
291
      ;;
148
303
    ;;
149
304
 
150
305
  --version)
151
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
152
 
    exit 0
 
306
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
 
307
    $echo
 
308
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
 
309
    $echo "This is free software; see the source for copying conditions.  There is NO"
 
310
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
311
    exit $EXIT_SUCCESS
153
312
    ;;
154
313
 
155
314
  --config)
156
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
157
 
    exit 0
 
315
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
 
316
    # Now print the configurations for the tags.
 
317
    for tagname in $taglist; do
 
318
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
 
319
    done
 
320
    exit $EXIT_SUCCESS
158
321
    ;;
159
322
 
160
323
  --debug)
161
 
    echo "$progname: enabling shell trace mode"
 
324
    $echo "$progname: enabling shell trace mode"
162
325
    set -x
 
326
    preserve_args="$preserve_args $arg"
163
327
    ;;
164
328
 
165
329
  --dry-run | -n)
167
331
    ;;
168
332
 
169
333
  --features)
170
 
    echo "host: $host"
 
334
    $echo "host: $host"
171
335
    if test "$build_libtool_libs" = yes; then
172
 
      echo "enable shared libraries"
 
336
      $echo "enable shared libraries"
173
337
    else
174
 
      echo "disable shared libraries"
 
338
      $echo "disable shared libraries"
175
339
    fi
176
340
    if test "$build_old_libs" = yes; then
177
 
      echo "enable static libraries"
 
341
      $echo "enable static libraries"
178
342
    else
179
 
      echo "disable static libraries"
 
343
      $echo "disable static libraries"
180
344
    fi
181
 
    exit 0
 
345
    exit $EXIT_SUCCESS
182
346
    ;;
183
347
 
184
348
  --finish) mode="finish" ;;
190
354
 
191
355
  --quiet | --silent)
192
356
    show=:
 
357
    preserve_args="$preserve_args $arg"
 
358
    ;;
 
359
 
 
360
  --tag) prevopt="--tag" prev=tag ;;
 
361
  --tag=*)
 
362
    set tag "$optarg" ${1+"$@"}
 
363
    shift
 
364
    prev=tag
 
365
    preserve_args="$preserve_args --tag"
193
366
    ;;
194
367
 
195
368
  -dlopen)
200
373
  -*)
201
374
    $echo "$modename: unrecognized option \`$arg'" 1>&2
202
375
    $echo "$help" 1>&2
203
 
    exit 1
 
376
    exit $EXIT_FAILURE
204
377
    ;;
205
378
 
206
379
  *)
213
386
if test -n "$prevopt"; then
214
387
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
215
388
  $echo "$help" 1>&2
216
 
  exit 1
 
389
  exit $EXIT_FAILURE
217
390
fi
218
391
 
219
392
# If this variable is set in any of the actions, the command in it
225
398
 
226
399
  # Infer the operation mode.
227
400
  if test -z "$mode"; then
 
401
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
 
402
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
228
403
    case $nonopt in
229
 
    *cc | *++ | gcc* | *-gcc* | g++* | xlc*)
 
404
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
230
405
      mode=link
231
406
      for arg
232
407
      do
267
442
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
268
443
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
269
444
    $echo "$help" 1>&2
270
 
    exit 1
 
445
    exit $EXIT_FAILURE
271
446
  fi
272
447
 
273
448
  # Change the help message to a mode-specific one.
281
456
    modename="$modename: compile"
282
457
    # Get the compilation command and the source file.
283
458
    base_compile=
284
 
    prev=
285
 
    lastarg=
286
 
    srcfile="$nonopt"
 
459
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
460
    suppress_opt=yes
287
461
    suppress_output=
 
462
    arg_mode=normal
 
463
    libobj=
 
464
    later=
288
465
 
289
 
    user_target=no
290
466
    for arg
291
467
    do
292
 
      case $prev in
293
 
      "") ;;
294
 
      xcompiler)
295
 
        # Aesthetically quote the previous argument.
296
 
        prev=
297
 
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
298
 
 
299
 
        case $arg in
300
 
        # Double-quote args containing other shell metacharacters.
301
 
        # Many Bourne shells cannot handle close brackets correctly
302
 
        # in scan sets, so we specify it separately.
303
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
304
 
          arg="\"$arg\""
305
 
          ;;
306
 
        esac
307
 
 
308
 
        # Add the previous argument to base_compile.
309
 
        if test -z "$base_compile"; then
310
 
          base_compile="$lastarg"
311
 
        else
312
 
          base_compile="$base_compile $lastarg"
313
 
        fi
314
 
        continue
315
 
        ;;
316
 
      esac
317
 
 
318
 
      # Accept any command-line options.
319
 
      case $arg in
320
 
      -o)
321
 
        if test "$user_target" != "no"; then
322
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
323
 
          exit 1
324
 
        fi
325
 
        user_target=next
326
 
        ;;
327
 
 
328
 
      -static)
329
 
        build_old_libs=yes
330
 
        continue
331
 
        ;;
332
 
 
333
 
      -prefer-pic)
334
 
        pic_mode=yes
335
 
        continue
336
 
        ;;
337
 
 
338
 
      -prefer-non-pic)
339
 
        pic_mode=no
340
 
        continue
341
 
        ;;
342
 
 
343
 
      -Xcompiler)
344
 
        prev=xcompiler
345
 
        continue
346
 
        ;;
347
 
 
348
 
      -Wc,*)
349
 
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
350
 
        lastarg=
351
 
        save_ifs="$IFS"; IFS=','
352
 
        for arg in $args; do
353
 
          IFS="$save_ifs"
354
 
 
355
 
          # Double-quote args containing other shell metacharacters.
356
 
          # Many Bourne shells cannot handle close brackets correctly
357
 
          # in scan sets, so we specify it separately.
358
 
          case $arg in
359
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
360
 
            arg="\"$arg\""
361
 
            ;;
362
 
          esac
363
 
          lastarg="$lastarg $arg"
364
 
        done
365
 
        IFS="$save_ifs"
366
 
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
367
 
 
368
 
        # Add the arguments to base_compile.
369
 
        if test -z "$base_compile"; then
370
 
          base_compile="$lastarg"
371
 
        else
372
 
          base_compile="$base_compile $lastarg"
373
 
        fi
374
 
        continue
375
 
        ;;
376
 
      esac
377
 
 
378
 
      case $user_target in
379
 
      next)
380
 
        # The next one is the -o target name
381
 
        user_target=yes
382
 
        continue
383
 
        ;;
384
 
      yes)
385
 
        # We got the output file
386
 
        user_target=set
 
468
      case "$arg_mode" in
 
469
      arg  )
 
470
        # do not "continue".  Instead, add this to base_compile
 
471
        lastarg="$arg"
 
472
        arg_mode=normal
 
473
        ;;
 
474
 
 
475
      target )
387
476
        libobj="$arg"
 
477
        arg_mode=normal
388
478
        continue
389
479
        ;;
390
 
      esac
391
 
 
392
 
      # Accept the current argument as the source file.
393
 
      lastarg="$srcfile"
394
 
      srcfile="$arg"
 
480
 
 
481
      normal )
 
482
        # Accept any command-line options.
 
483
        case $arg in
 
484
        -o)
 
485
          if test -n "$libobj" ; then
 
486
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
487
            exit $EXIT_FAILURE
 
488
          fi
 
489
          arg_mode=target
 
490
          continue
 
491
          ;;
 
492
 
 
493
        -static | -prefer-pic | -prefer-non-pic)
 
494
          later="$later $arg"
 
495
          continue
 
496
          ;;
 
497
 
 
498
        -no-suppress)
 
499
          suppress_opt=no
 
500
          continue
 
501
          ;;
 
502
 
 
503
        -Xcompiler)
 
504
          arg_mode=arg  #  the next one goes into the "base_compile" arg list
 
505
          continue      #  The current "srcfile" will either be retained or
 
506
          ;;            #  replaced later.  I would guess that would be a bug.
 
507
 
 
508
        -Wc,*)
 
509
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
510
          lastarg=
 
511
          save_ifs="$IFS"; IFS=','
 
512
          for arg in $args; do
 
513
            IFS="$save_ifs"
 
514
 
 
515
            # Double-quote args containing other shell metacharacters.
 
516
            # Many Bourne shells cannot handle close brackets correctly
 
517
            # in scan sets, so we specify it separately.
 
518
            case $arg in
 
519
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
520
              arg="\"$arg\""
 
521
              ;;
 
522
            esac
 
523
            lastarg="$lastarg $arg"
 
524
          done
 
525
          IFS="$save_ifs"
 
526
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
527
 
 
528
          # Add the arguments to base_compile.
 
529
          base_compile="$base_compile $lastarg"
 
530
          continue
 
531
          ;;
 
532
 
 
533
        * )
 
534
          # Accept the current argument as the source file.
 
535
          # The previous "srcfile" becomes the current argument.
 
536
          #
 
537
          lastarg="$srcfile"
 
538
          srcfile="$arg"
 
539
          ;;
 
540
        esac  #  case $arg
 
541
        ;;
 
542
      esac    #  case $arg_mode
395
543
 
396
544
      # Aesthetically quote the previous argument.
397
 
 
398
 
      # Backslashify any backslashes, double quotes, and dollar signs.
399
 
      # These are the only characters that are still specially
400
 
      # interpreted inside of double-quoted scrings.
401
545
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
402
546
 
 
547
      case $lastarg in
403
548
      # Double-quote args containing other shell metacharacters.
404
549
      # Many Bourne shells cannot handle close brackets correctly
405
550
      # in scan sets, so we specify it separately.
406
 
      case $lastarg in
407
551
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
408
552
        lastarg="\"$lastarg\""
409
553
        ;;
410
554
      esac
411
555
 
412
 
      # Add the previous argument to base_compile.
413
 
      if test -z "$base_compile"; then
414
 
        base_compile="$lastarg"
415
 
      else
416
 
        base_compile="$base_compile $lastarg"
417
 
      fi
418
 
    done
 
556
      base_compile="$base_compile $lastarg"
 
557
    done # for arg
419
558
 
420
 
    case $user_target in
421
 
    set)
422
 
      ;;
423
 
    no)
 
559
    case $arg_mode in
 
560
    arg)
 
561
      $echo "$modename: you must specify an argument for -Xcompile"
 
562
      exit $EXIT_FAILURE
 
563
      ;;
 
564
    target)
 
565
      $echo "$modename: you must specify a target with \`-o'" 1>&2
 
566
      exit $EXIT_FAILURE
 
567
      ;;
 
568
    *)
424
569
      # Get the name of the library object.
425
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
426
 
      ;;
427
 
    *)
428
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
429
 
      exit 1
 
570
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
430
571
      ;;
431
572
    esac
432
573
 
433
574
    # Recognize several different file suffixes.
434
575
    # If the user specifies -o file.o, it is replaced with file.lo
435
 
    xform='[cCFSfmso]'
 
576
    xform='[cCFSifmso]'
436
577
    case $libobj in
437
578
    *.ada) xform=ada ;;
438
579
    *.adb) xform=adb ;;
440
581
    *.asm) xform=asm ;;
441
582
    *.c++) xform=c++ ;;
442
583
    *.cc) xform=cc ;;
 
584
    *.ii) xform=ii ;;
 
585
    *.class) xform=class ;;
443
586
    *.cpp) xform=cpp ;;
444
587
    *.cxx) xform=cxx ;;
445
588
    *.f90) xform=f90 ;;
446
589
    *.for) xform=for ;;
 
590
    *.java) xform=java ;;
447
591
    esac
448
592
 
449
593
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
452
596
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
453
597
    *)
454
598
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
455
 
      exit 1
 
599
      exit $EXIT_FAILURE
456
600
      ;;
457
601
    esac
458
602
 
 
603
    func_infer_tag $base_compile
 
604
 
 
605
    for arg in $later; do
 
606
      case $arg in
 
607
      -static)
 
608
        build_old_libs=yes
 
609
        continue
 
610
        ;;
 
611
 
 
612
      -prefer-pic)
 
613
        pic_mode=yes
 
614
        continue
 
615
        ;;
 
616
 
 
617
      -prefer-non-pic)
 
618
        pic_mode=no
 
619
        continue
 
620
        ;;
 
621
      esac
 
622
    done
 
623
 
 
624
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
625
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
626
    if test "X$xdir" = "X$obj"; then
 
627
      xdir=
 
628
    else
 
629
      xdir=$xdir/
 
630
    fi
 
631
    lobj=${xdir}$objdir/$objname
 
632
 
459
633
    if test -z "$base_compile"; then
460
634
      $echo "$modename: you must specify a compilation command" 1>&2
461
635
      $echo "$help" 1>&2
462
 
      exit 1
 
636
      exit $EXIT_FAILURE
463
637
    fi
464
638
 
465
639
    # Delete any leftover library objects.
466
640
    if test "$build_old_libs" = yes; then
467
 
      removelist="$obj $libobj"
 
641
      removelist="$obj $lobj $libobj ${libobj}T"
468
642
    else
469
 
      removelist="$libobj"
 
643
      removelist="$lobj $libobj ${libobj}T"
470
644
    fi
471
645
 
472
646
    $run $rm $removelist
473
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
647
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
474
648
 
475
649
    # On Cygwin there's no "real" PIC flag so we must build both object types
476
650
    case $host_os in
489
663
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
490
664
      lockfile="$output_obj.lock"
491
665
      removelist="$removelist $output_obj $lockfile"
492
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
666
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
493
667
    else
 
668
      output_obj=
494
669
      need_locks=no
495
670
      lockfile=
496
671
    fi
498
673
    # Lock this critical section if it is needed
499
674
    # We use this script file to make the link, it avoids creating a new file
500
675
    if test "$need_locks" = yes; then
501
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
676
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
502
677
        $show "Waiting for $lockfile to be removed"
503
678
        sleep 2
504
679
      done
505
680
    elif test "$need_locks" = warn; then
506
681
      if test -f "$lockfile"; then
507
 
        echo "\
 
682
        $echo "\
508
683
*** ERROR, $lockfile exists and contains:
509
684
`cat $lockfile 2>/dev/null`
510
685
 
516
691
compiler."
517
692
 
518
693
        $run $rm $removelist
519
 
        exit 1
 
694
        exit $EXIT_FAILURE
520
695
      fi
521
 
      echo $srcfile > "$lockfile"
 
696
      $echo $srcfile > "$lockfile"
522
697
    fi
523
698
 
524
699
    if test -n "$fix_srcfile_path"; then
525
700
      eval srcfile=\"$fix_srcfile_path\"
526
701
    fi
527
702
 
 
703
    $run $rm "$libobj" "${libobj}T"
 
704
 
 
705
    # Create a libtool object file (analogous to a ".la" file),
 
706
    # but don't create it if we're doing a dry run.
 
707
    test -z "$run" && cat > ${libobj}T <<EOF
 
708
# $libobj - a libtool object file
 
709
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
710
#
 
711
# Please DO NOT delete this file!
 
712
# It is necessary for linking the library.
 
713
 
 
714
# Name of the PIC object.
 
715
EOF
 
716
 
528
717
    # Only build a PIC object if we are building libtool libraries.
529
718
    if test "$build_libtool_libs" = yes; then
530
719
      # Without this assignment, base_compile gets emptied.
531
720
      fbsd_hideous_sh_bug=$base_compile
532
721
 
533
722
      if test "$pic_mode" != no; then
534
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
535
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
723
        command="$base_compile $srcfile $pic_flag"
536
724
      else
537
725
        # Don't build PIC code
538
726
        command="$base_compile $srcfile"
539
727
      fi
540
 
      if test "$build_old_libs" = yes; then
541
 
        lo_libobj="$libobj"
542
 
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
543
 
        if test "X$dir" = "X$libobj"; then
544
 
          dir="$objdir"
545
 
        else
546
 
          dir="$dir/$objdir"
547
 
        fi
548
 
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
549
 
 
550
 
        if test -d "$dir"; then
551
 
          $show "$rm $libobj"
552
 
          $run $rm $libobj
553
 
        else
554
 
          $show "$mkdir $dir"
555
 
          $run $mkdir $dir
556
 
          status=$?
557
 
          if test $status -ne 0 && test ! -d $dir; then
558
 
            exit $status
559
 
          fi
560
 
        fi
561
 
      fi
562
 
      if test "$compiler_o_lo" = yes; then
563
 
        output_obj="$libobj"
564
 
        command="$command -o $output_obj"
565
 
      elif test "$compiler_c_o" = yes; then
566
 
        output_obj="$obj"
567
 
        command="$command -o $output_obj"
568
 
      fi
569
 
 
570
 
      $run $rm "$output_obj"
 
728
 
 
729
      if test ! -d "${xdir}$objdir"; then
 
730
        $show "$mkdir ${xdir}$objdir"
 
731
        $run $mkdir ${xdir}$objdir
 
732
        status=$?
 
733
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
734
          exit $status
 
735
        fi
 
736
      fi
 
737
 
 
738
      if test -z "$output_obj"; then
 
739
        # Place PIC objects in $objdir
 
740
        command="$command -o $lobj"
 
741
      fi
 
742
 
 
743
      $run $rm "$lobj" "$output_obj"
 
744
 
571
745
      $show "$command"
572
746
      if $run eval "$command"; then :
573
747
      else
574
748
        test -n "$output_obj" && $run $rm $removelist
575
 
        exit 1
 
749
        exit $EXIT_FAILURE
576
750
      fi
577
751
 
578
752
      if test "$need_locks" = warn &&
579
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
580
 
        echo "\
 
753
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
754
        $echo "\
581
755
*** ERROR, $lockfile contains:
582
756
`cat $lockfile 2>/dev/null`
583
757
 
592
766
compiler."
593
767
 
594
768
        $run $rm $removelist
595
 
        exit 1
 
769
        exit $EXIT_FAILURE
596
770
      fi
597
771
 
598
772
      # Just move the object if needed, then go on to compile the next one
599
 
      if test x"$output_obj" != x"$libobj"; then
600
 
        $show "$mv $output_obj $libobj"
601
 
        if $run $mv $output_obj $libobj; then :
602
 
        else
603
 
          error=$?
604
 
          $run $rm $removelist
605
 
          exit $error
606
 
        fi
607
 
      fi
608
 
 
609
 
      # If we have no pic_flag, then copy the object into place and finish.
610
 
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
611
 
         test "$build_old_libs" = yes; then
612
 
        # Rename the .lo from within objdir to obj
613
 
        if test -f $obj; then
614
 
          $show $rm $obj
615
 
          $run $rm $obj
616
 
        fi
617
 
 
618
 
        $show "$mv $libobj $obj"
619
 
        if $run $mv $libobj $obj; then :
620
 
        else
621
 
          error=$?
622
 
          $run $rm $removelist
623
 
          exit $error
624
 
        fi
625
 
 
626
 
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
627
 
        if test "X$xdir" = "X$obj"; then
628
 
          xdir="."
629
 
        else
630
 
          xdir="$xdir"
631
 
        fi
632
 
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
633
 
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
634
 
        # Now arrange that obj and lo_libobj become the same file
635
 
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
636
 
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
637
 
          # Unlock the critical section if it was locked
638
 
          if test "$need_locks" != no; then
639
 
            $run $rm "$lockfile"
640
 
          fi
641
 
          exit 0
642
 
        else
643
 
          error=$?
644
 
          $run $rm $removelist
645
 
          exit $error
646
 
        fi
647
 
      fi
 
773
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 
774
        $show "$mv $output_obj $lobj"
 
775
        if $run $mv $output_obj $lobj; then :
 
776
        else
 
777
          error=$?
 
778
          $run $rm $removelist
 
779
          exit $error
 
780
        fi
 
781
      fi
 
782
 
 
783
      # Append the name of the PIC object to the libtool object file.
 
784
      test -z "$run" && cat >> ${libobj}T <<EOF
 
785
pic_object='$objdir/$objname'
 
786
 
 
787
EOF
648
788
 
649
789
      # Allow error messages only from the first compilation.
650
 
      suppress_output=' >/dev/null 2>&1'
 
790
      if test "$suppress_opt" = yes; then
 
791
        suppress_output=' >/dev/null 2>&1'
 
792
      fi
 
793
    else
 
794
      # No PIC object so indicate it doesn't exist in the libtool
 
795
      # object file.
 
796
      test -z "$run" && cat >> ${libobj}T <<EOF
 
797
pic_object=none
 
798
 
 
799
EOF
651
800
    fi
652
801
 
653
802
    # Only build a position-dependent object if we build old libraries.
656
805
        # Don't build PIC code
657
806
        command="$base_compile $srcfile"
658
807
      else
659
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
660
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
808
        command="$base_compile $srcfile $pic_flag"
661
809
      fi
662
810
      if test "$compiler_c_o" = yes; then
663
811
        command="$command -o $obj"
664
 
        output_obj="$obj"
665
812
      fi
666
813
 
667
814
      # Suppress compiler output if we already did a PIC compilation.
668
815
      command="$command$suppress_output"
669
 
      $run $rm "$output_obj"
 
816
      $run $rm "$obj" "$output_obj"
670
817
      $show "$command"
671
818
      if $run eval "$command"; then :
672
819
      else
673
820
        $run $rm $removelist
674
 
        exit 1
 
821
        exit $EXIT_FAILURE
675
822
      fi
676
823
 
677
824
      if test "$need_locks" = warn &&
678
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
679
 
        echo "\
 
825
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
826
        $echo "\
680
827
*** ERROR, $lockfile contains:
681
828
`cat $lockfile 2>/dev/null`
682
829
 
691
838
compiler."
692
839
 
693
840
        $run $rm $removelist
694
 
        exit 1
 
841
        exit $EXIT_FAILURE
695
842
      fi
696
843
 
697
844
      # Just move the object if needed
698
 
      if test x"$output_obj" != x"$obj"; then
 
845
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
699
846
        $show "$mv $output_obj $obj"
700
847
        if $run $mv $output_obj $obj; then :
701
848
        else
705
852
        fi
706
853
      fi
707
854
 
708
 
      # Create an invalid libtool object if no PIC, so that we do not
709
 
      # accidentally link it into a program.
710
 
      if test "$build_libtool_libs" != yes; then
711
 
        $show "echo timestamp > $libobj"
712
 
        $run eval "echo timestamp > \$libobj" || exit $?
713
 
      else
714
 
        # Move the .lo from within objdir
715
 
        $show "$mv $libobj $lo_libobj"
716
 
        if $run $mv $libobj $lo_libobj; then :
717
 
        else
718
 
          error=$?
719
 
          $run $rm $removelist
720
 
          exit $error
721
 
        fi
722
 
      fi
 
855
      # Append the name of the non-PIC object the libtool object file.
 
856
      # Only append if the libtool object file exists.
 
857
      test -z "$run" && cat >> ${libobj}T <<EOF
 
858
# Name of the non-PIC object.
 
859
non_pic_object='$objname'
 
860
 
 
861
EOF
 
862
    else
 
863
      # Append the name of the non-PIC object the libtool object file.
 
864
      # Only append if the libtool object file exists.
 
865
      test -z "$run" && cat >> ${libobj}T <<EOF
 
866
# Name of the non-PIC object.
 
867
non_pic_object=none
 
868
 
 
869
EOF
723
870
    fi
724
871
 
 
872
    $run $mv "${libobj}T" "${libobj}"
 
873
 
725
874
    # Unlock the critical section if it was locked
726
875
    if test "$need_locks" != no; then
727
876
      $run $rm "$lockfile"
728
877
    fi
729
878
 
730
 
    exit 0
 
879
    exit $EXIT_SUCCESS
731
880
    ;;
732
881
 
733
882
  # libtool link mode
738
887
      # It is impossible to link a dll without this setting, and
739
888
      # we shouldn't force the makefile maintainer to figure out
740
889
      # which system we are compiling for in order to pass an extra
741
 
      # flag for every libtool invokation.
 
890
      # flag for every libtool invocation.
742
891
      # allow_undefined=no
743
892
 
744
893
      # FIXME: Unfortunately, there are problems with the above when trying
753
902
      ;;
754
903
    esac
755
904
    libtool_args="$nonopt"
 
905
    base_compile="$nonopt $@"
756
906
    compile_command="$nonopt"
757
907
    finalize_command="$nonopt"
758
908
 
783
933
    module=no
784
934
    no_install=no
785
935
    objs=
 
936
    non_pic_objects=
 
937
    precious_files_regex=
786
938
    prefer_static_libs=no
787
939
    preload=no
788
940
    prev=
794
946
    temp_rpath=
795
947
    thread_safe=no
796
948
    vinfo=
 
949
    vinfo_number=no
 
950
 
 
951
    func_infer_tag $base_compile
797
952
 
798
953
    # We need to know -static, to get the right output filenames.
799
954
    for arg
824
979
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
825
980
 
826
981
    # Go through the arguments, transforming them on the way.
827
 
    while test $# -gt 0; do
 
982
    while test "$#" -gt 0; do
828
983
      arg="$1"
829
984
      shift
830
985
      case $arg in
889
1044
          export_symbols="$arg"
890
1045
          if test ! -f "$arg"; then
891
1046
            $echo "$modename: symbol file \`$arg' does not exist"
892
 
            exit 1
 
1047
            exit $EXIT_FAILURE
893
1048
          fi
894
1049
          prev=
895
1050
          continue
904
1059
          prev=
905
1060
          continue
906
1061
          ;;
 
1062
        precious_regex)
 
1063
          precious_files_regex="$arg"
 
1064
          prev=
 
1065
          continue
 
1066
          ;;
907
1067
        release)
908
1068
          release="-$arg"
909
1069
          prev=
910
1070
          continue
911
1071
          ;;
 
1072
        objectlist)
 
1073
          if test -f "$arg"; then
 
1074
            save_arg=$arg
 
1075
            moreargs=
 
1076
            for fil in `cat $save_arg`
 
1077
            do
 
1078
#             moreargs="$moreargs $fil"
 
1079
              arg=$fil
 
1080
              # A libtool-controlled object.
 
1081
 
 
1082
              # Check to see that this really is a libtool object.
 
1083
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1084
                pic_object=
 
1085
                non_pic_object=
 
1086
 
 
1087
                # Read the .lo file
 
1088
                # If there is no directory component, then add one.
 
1089
                case $arg in
 
1090
                */* | *\\*) . $arg ;;
 
1091
                *) . ./$arg ;;
 
1092
                esac
 
1093
 
 
1094
                if test -z "$pic_object" || \
 
1095
                   test -z "$non_pic_object" ||
 
1096
                   test "$pic_object" = none && \
 
1097
                   test "$non_pic_object" = none; then
 
1098
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1099
                  exit $EXIT_FAILURE
 
1100
                fi
 
1101
 
 
1102
                # Extract subdirectory from the argument.
 
1103
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1104
                if test "X$xdir" = "X$arg"; then
 
1105
                  xdir=
 
1106
                else
 
1107
                  xdir="$xdir/"
 
1108
                fi
 
1109
 
 
1110
                if test "$pic_object" != none; then
 
1111
                  # Prepend the subdirectory the object is found in.
 
1112
                  pic_object="$xdir$pic_object"
 
1113
 
 
1114
                  if test "$prev" = dlfiles; then
 
1115
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1116
                      dlfiles="$dlfiles $pic_object"
 
1117
                      prev=
 
1118
                      continue
 
1119
                    else
 
1120
                      # If libtool objects are unsupported, then we need to preload.
 
1121
                      prev=dlprefiles
 
1122
                    fi
 
1123
                  fi
 
1124
 
 
1125
                  # CHECK ME:  I think I busted this.  -Ossama
 
1126
                  if test "$prev" = dlprefiles; then
 
1127
                    # Preload the old-style object.
 
1128
                    dlprefiles="$dlprefiles $pic_object"
 
1129
                    prev=
 
1130
                  fi
 
1131
 
 
1132
                  # A PIC object.
 
1133
                  libobjs="$libobjs $pic_object"
 
1134
                  arg="$pic_object"
 
1135
                fi
 
1136
 
 
1137
                # Non-PIC object.
 
1138
                if test "$non_pic_object" != none; then
 
1139
                  # Prepend the subdirectory the object is found in.
 
1140
                  non_pic_object="$xdir$non_pic_object"
 
1141
 
 
1142
                  # A standard non-PIC object
 
1143
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1144
                  if test -z "$pic_object" || test "$pic_object" = none ; then
 
1145
                    arg="$non_pic_object"
 
1146
                  fi
 
1147
                fi
 
1148
              else
 
1149
                # Only an error if not doing a dry-run.
 
1150
                if test -z "$run"; then
 
1151
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1152
                  exit $EXIT_FAILURE
 
1153
                else
 
1154
                  # Dry-run case.
 
1155
 
 
1156
                  # Extract subdirectory from the argument.
 
1157
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1158
                  if test "X$xdir" = "X$arg"; then
 
1159
                    xdir=
 
1160
                  else
 
1161
                    xdir="$xdir/"
 
1162
                  fi
 
1163
 
 
1164
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1165
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1166
                  libobjs="$libobjs $pic_object"
 
1167
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1168
                fi
 
1169
              fi
 
1170
            done
 
1171
          else
 
1172
            $echo "$modename: link input file \`$save_arg' does not exist"
 
1173
            exit $EXIT_FAILURE
 
1174
          fi
 
1175
          arg=$save_arg
 
1176
          prev=
 
1177
          continue
 
1178
          ;;
912
1179
        rpath | xrpath)
913
1180
          # We need an absolute path.
914
1181
          case $arg in
915
1182
          [\\/]* | [A-Za-z]:[\\/]*) ;;
916
1183
          *)
917
1184
            $echo "$modename: only absolute run-paths are allowed" 1>&2
918
 
            exit 1
 
1185
            exit $EXIT_FAILURE
919
1186
            ;;
920
1187
          esac
921
1188
          if test "$prev" = rpath; then
947
1214
          finalize_command="$finalize_command $wl$qarg"
948
1215
          continue
949
1216
          ;;
 
1217
        xcclinker)
 
1218
          linker_flags="$linker_flags $qarg"
 
1219
          compiler_flags="$compiler_flags $qarg"
 
1220
          prev=
 
1221
          compile_command="$compile_command $qarg"
 
1222
          finalize_command="$finalize_command $qarg"
 
1223
          continue
 
1224
          ;;
 
1225
        shrext)
 
1226
          shrext_cmds="$arg"
 
1227
          prev=
 
1228
          continue
 
1229
          ;;
950
1230
        *)
951
1231
          eval "$prev=\"\$arg\""
952
1232
          prev=
953
1233
          continue
954
1234
          ;;
955
1235
        esac
956
 
      fi # test -n $prev
 
1236
      fi # test -n "$prev"
957
1237
 
958
1238
      prevarg="$arg"
959
1239
 
995
1275
      -export-symbols | -export-symbols-regex)
996
1276
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
997
1277
          $echo "$modename: more than one -exported-symbols argument is not allowed"
998
 
          exit 1
 
1278
          exit $EXIT_FAILURE
999
1279
        fi
1000
1280
        if test "X$arg" = "X-export-symbols"; then
1001
1281
          prev=expsyms
1006
1286
        ;;
1007
1287
 
1008
1288
      -inst-prefix-dir)
1009
 
       prev=inst_prefix
1010
 
       continue
1011
 
       ;;
 
1289
        prev=inst_prefix
 
1290
        continue
 
1291
        ;;
1012
1292
 
1013
1293
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1014
1294
      # so, if we see these flags be careful not to treat them like -L
1015
1295
      -L[A-Z][A-Z]*:*)
1016
1296
        case $with_gcc/$host in
1017
 
        no/*-*-irix* | no/*-*-nonstopux*)
 
1297
        no/*-*-irix* | /*-*-irix*)
1018
1298
          compile_command="$compile_command $arg"
1019
1299
          finalize_command="$finalize_command $arg"
1020
1300
          ;;
1031
1311
          absdir=`cd "$dir" && pwd`
1032
1312
          if test -z "$absdir"; then
1033
1313
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1034
 
            exit 1
 
1314
            exit $EXIT_FAILURE
1035
1315
          fi
1036
1316
          dir="$absdir"
1037
1317
          ;;
1069
1349
            # Do not include libc due to us having libc/libc_r.
1070
1350
            test "X$arg" = "X-lc" && continue
1071
1351
            ;;
 
1352
          *-*-rhapsody* | *-*-darwin1.[012])
 
1353
            # Rhapsody C and math libraries are in the System framework
 
1354
            deplibs="$deplibs -framework System"
 
1355
            continue
1072
1356
          esac
1073
 
         elif test "X$arg" = "X-lc_r"; then
1074
 
          case $host in
 
1357
        elif test "X$arg" = "X-lc_r"; then
 
1358
         case $host in
1075
1359
         *-*-openbsd* | *-*-freebsd*)
1076
 
            # Do not include libc_r directly, use -pthread flag.
1077
 
            continue
1078
 
            ;;
1079
 
          esac
 
1360
           # Do not include libc_r directly, use -pthread flag.
 
1361
           continue
 
1362
           ;;
 
1363
         esac
1080
1364
        fi
1081
1365
        deplibs="$deplibs $arg"
1082
1366
        continue
1083
1367
        ;;
1084
1368
 
 
1369
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1370
        deplibs="$deplibs $arg"
 
1371
        continue
 
1372
        ;;
 
1373
 
1085
1374
      -module)
1086
1375
        module=yes
1087
1376
        continue
1088
1377
        ;;
1089
1378
 
 
1379
      # gcc -m* arguments should be passed to the linker via $compiler_flags
 
1380
      # in order to pass architecture information to the linker
 
1381
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
 
1382
      # but this is not reliable with gcc because gcc may use -mfoo to
 
1383
      # select a different linker, different libraries, etc, while
 
1384
      # -Wl,-mfoo simply passes -mfoo to the linker.
 
1385
      -m*)
 
1386
        # Unknown arguments in both finalize_command and compile_command need
 
1387
        # to be aesthetically quoted because they are evaled later.
 
1388
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1389
        case $arg in
 
1390
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1391
          arg="\"$arg\""
 
1392
          ;;
 
1393
        esac
 
1394
        compile_command="$compile_command $arg"
 
1395
        finalize_command="$finalize_command $arg"
 
1396
        if test "$with_gcc" = "yes" ; then
 
1397
          compiler_flags="$compiler_flags $arg"
 
1398
        fi
 
1399
        continue
 
1400
        ;;
 
1401
 
 
1402
      -shrext)
 
1403
        prev=shrext
 
1404
        continue
 
1405
        ;;
 
1406
 
1090
1407
      -no-fast-install)
1091
1408
        fast_install=no
1092
1409
        continue
1111
1428
        continue
1112
1429
        ;;
1113
1430
 
 
1431
      -objectlist)
 
1432
        prev=objectlist
 
1433
        continue
 
1434
        ;;
 
1435
 
1114
1436
      -o) prev=output ;;
1115
1437
 
 
1438
      -precious-files-regex)
 
1439
        prev=precious_regex
 
1440
        continue
 
1441
        ;;
 
1442
 
1116
1443
      -release)
1117
1444
        prev=release
1118
1445
        continue
1135
1462
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1136
1463
        *)
1137
1464
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1138
 
          exit 1
 
1465
          exit $EXIT_FAILURE
1139
1466
          ;;
1140
1467
        esac
1141
1468
        case "$xrpath " in
1163
1490
        prev=vinfo
1164
1491
        continue
1165
1492
        ;;
 
1493
      -version-number)
 
1494
        prev=vinfo
 
1495
        vinfo_number=yes
 
1496
        continue
 
1497
        ;;
1166
1498
 
1167
1499
      -Wc,*)
1168
1500
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1211
1543
        continue
1212
1544
        ;;
1213
1545
 
 
1546
      -XCClinker)
 
1547
        prev=xcclinker
 
1548
        continue
 
1549
        ;;
 
1550
 
1214
1551
      # Some other compiler flag.
1215
1552
      -* | +*)
1216
1553
        # Unknown arguments in both finalize_command and compile_command need
1223
1560
        esac
1224
1561
        ;;
1225
1562
 
1226
 
      *.lo | *.$objext)
1227
 
        # A library or standard object.
1228
 
        if test "$prev" = dlfiles; then
1229
 
          # This file was specified with -dlopen.
1230
 
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1231
 
            dlfiles="$dlfiles $arg"
1232
 
            prev=
1233
 
            continue
1234
 
          else
1235
 
            # If libtool objects are unsupported, then we need to preload.
1236
 
            prev=dlprefiles
1237
 
          fi
1238
 
        fi
1239
 
 
1240
 
        if test "$prev" = dlprefiles; then
1241
 
          # Preload the old-style object.
1242
 
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1243
 
          prev=
1244
 
        else
 
1563
      *.$objext)
 
1564
        # A standard object.
 
1565
        objs="$objs $arg"
 
1566
        ;;
 
1567
 
 
1568
      *.lo)
 
1569
        # A libtool-controlled object.
 
1570
 
 
1571
        # Check to see that this really is a libtool object.
 
1572
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1573
          pic_object=
 
1574
          non_pic_object=
 
1575
 
 
1576
          # Read the .lo file
 
1577
          # If there is no directory component, then add one.
1245
1578
          case $arg in
1246
 
          *.lo) libobjs="$libobjs $arg" ;;
1247
 
          *) objs="$objs $arg" ;;
 
1579
          */* | *\\*) . $arg ;;
 
1580
          *) . ./$arg ;;
1248
1581
          esac
 
1582
 
 
1583
          if test -z "$pic_object" || \
 
1584
             test -z "$non_pic_object" ||
 
1585
             test "$pic_object" = none && \
 
1586
             test "$non_pic_object" = none; then
 
1587
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1588
            exit $EXIT_FAILURE
 
1589
          fi
 
1590
 
 
1591
          # Extract subdirectory from the argument.
 
1592
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1593
          if test "X$xdir" = "X$arg"; then
 
1594
            xdir=
 
1595
          else
 
1596
            xdir="$xdir/"
 
1597
          fi
 
1598
 
 
1599
          if test "$pic_object" != none; then
 
1600
            # Prepend the subdirectory the object is found in.
 
1601
            pic_object="$xdir$pic_object"
 
1602
 
 
1603
            if test "$prev" = dlfiles; then
 
1604
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1605
                dlfiles="$dlfiles $pic_object"
 
1606
                prev=
 
1607
                continue
 
1608
              else
 
1609
                # If libtool objects are unsupported, then we need to preload.
 
1610
                prev=dlprefiles
 
1611
              fi
 
1612
            fi
 
1613
 
 
1614
            # CHECK ME:  I think I busted this.  -Ossama
 
1615
            if test "$prev" = dlprefiles; then
 
1616
              # Preload the old-style object.
 
1617
              dlprefiles="$dlprefiles $pic_object"
 
1618
              prev=
 
1619
            fi
 
1620
 
 
1621
            # A PIC object.
 
1622
            libobjs="$libobjs $pic_object"
 
1623
            arg="$pic_object"
 
1624
          fi
 
1625
 
 
1626
          # Non-PIC object.
 
1627
          if test "$non_pic_object" != none; then
 
1628
            # Prepend the subdirectory the object is found in.
 
1629
            non_pic_object="$xdir$non_pic_object"
 
1630
 
 
1631
            # A standard non-PIC object
 
1632
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1633
            if test -z "$pic_object" || test "$pic_object" = none ; then
 
1634
              arg="$non_pic_object"
 
1635
            fi
 
1636
          fi
 
1637
        else
 
1638
          # Only an error if not doing a dry-run.
 
1639
          if test -z "$run"; then
 
1640
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1641
            exit $EXIT_FAILURE
 
1642
          else
 
1643
            # Dry-run case.
 
1644
 
 
1645
            # Extract subdirectory from the argument.
 
1646
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1647
            if test "X$xdir" = "X$arg"; then
 
1648
              xdir=
 
1649
            else
 
1650
              xdir="$xdir/"
 
1651
            fi
 
1652
 
 
1653
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1654
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1655
            libobjs="$libobjs $pic_object"
 
1656
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1657
          fi
1249
1658
        fi
1250
1659
        ;;
1251
1660
 
1296
1705
    if test -n "$prev"; then
1297
1706
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1298
1707
      $echo "$help" 1>&2
1299
 
      exit 1
 
1708
      exit $EXIT_FAILURE
1300
1709
    fi
1301
1710
 
1302
1711
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1305
1714
      finalize_command="$finalize_command $arg"
1306
1715
    fi
1307
1716
 
 
1717
    oldlibs=
1308
1718
    # calculate the name of the file, without its directory
1309
1719
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1310
1720
    libobjs_save="$libobjs"
1325
1735
      output_objdir="$output_objdir/$objdir"
1326
1736
    fi
1327
1737
    # Create the object directory.
1328
 
    if test ! -d $output_objdir; then
 
1738
    if test ! -d "$output_objdir"; then
1329
1739
      $show "$mkdir $output_objdir"
1330
1740
      $run $mkdir $output_objdir
1331
1741
      status=$?
1332
 
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1742
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1333
1743
        exit $status
1334
1744
      fi
1335
1745
    fi
1339
1749
    "")
1340
1750
      $echo "$modename: you must specify an output file" 1>&2
1341
1751
      $echo "$help" 1>&2
1342
 
      exit 1
 
1752
      exit $EXIT_FAILURE
1343
1753
      ;;
1344
1754
    *.$libext) linkmode=oldlib ;;
1345
1755
    *.lo | *.$objext) linkmode=obj ;;
1347
1757
    *) linkmode=prog ;; # Anything else should be a program.
1348
1758
    esac
1349
1759
 
 
1760
    case $host in
 
1761
    *cygwin* | *mingw* | *pw32*)
 
1762
      # don't eliminate duplications in $postdeps and $predeps
 
1763
      duplicate_compiler_generated_deps=yes
 
1764
      ;;
 
1765
    *)
 
1766
      duplicate_compiler_generated_deps=$duplicate_deps
 
1767
      ;;
 
1768
    esac
1350
1769
    specialdeplibs=
 
1770
 
1351
1771
    libs=
1352
1772
    # Find all interdependent deplibs by searching for libraries
1353
1773
    # that are linked more than once (e.g. -la -lb -la)
1359
1779
      fi
1360
1780
      libs="$libs $deplib"
1361
1781
    done
 
1782
 
 
1783
    if test "$linkmode" = lib; then
 
1784
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
1785
 
 
1786
      # Compute libraries that are listed more than once in $predeps
 
1787
      # $postdeps and mark them as special (i.e., whose duplicates are
 
1788
      # not to be eliminated).
 
1789
      pre_post_deps=
 
1790
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
1791
        for pre_post_dep in $predeps $postdeps; do
 
1792
          case "$pre_post_deps " in
 
1793
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
1794
          esac
 
1795
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
1796
        done
 
1797
      fi
 
1798
      pre_post_deps=
 
1799
    fi
 
1800
 
1362
1801
    deplibs=
1363
1802
    newdependency_libs=
1364
1803
    newlib_search_path=
1373
1812
          *.la) ;;
1374
1813
          *)
1375
1814
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1376
 
            exit 1
 
1815
            exit $EXIT_FAILURE
1377
1816
            ;;
1378
1817
          esac
1379
1818
        done
1390
1829
        ;;
1391
1830
    esac
1392
1831
    for pass in $passes; do
1393
 
      if test $linkmode = prog; then
1394
 
        # Determine which files to process
 
1832
      if test "$linkmode,$pass" = "lib,link" ||
 
1833
         test "$linkmode,$pass" = "prog,scan"; then
 
1834
        libs="$deplibs"
 
1835
        deplibs=
 
1836
      fi
 
1837
      if test "$linkmode" = prog; then
1395
1838
        case $pass in
1396
 
        dlopen)
1397
 
          libs="$dlfiles"
1398
 
          save_deplibs="$deplibs" # Collect dlpreopened libraries
1399
 
          deplibs=
1400
 
          ;;
 
1839
        dlopen) libs="$dlfiles" ;;
1401
1840
        dlpreopen) libs="$dlprefiles" ;;
1402
 
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
1841
        link)
 
1842
          libs="$deplibs %DEPLIBS%"
 
1843
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
 
1844
          ;;
1403
1845
        esac
1404
1846
      fi
 
1847
      if test "$pass" = dlopen; then
 
1848
        # Collect dlpreopened libraries
 
1849
        save_deplibs="$deplibs"
 
1850
        deplibs=
 
1851
      fi
1405
1852
      for deplib in $libs; do
1406
1853
        lib=
1407
1854
        found=no
1408
1855
        case $deplib in
 
1856
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1857
          if test "$linkmode,$pass" = "prog,link"; then
 
1858
            compile_deplibs="$deplib $compile_deplibs"
 
1859
            finalize_deplibs="$deplib $finalize_deplibs"
 
1860
          else
 
1861
            deplibs="$deplib $deplibs"
 
1862
          fi
 
1863
          continue
 
1864
          ;;
1409
1865
        -l*)
1410
 
          if test $linkmode = oldlib && test $linkmode = obj; then
1411
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1412
 
            continue
1413
 
          fi
1414
 
          if test $pass = conv; then
1415
 
            deplibs="$deplib $deplibs"
 
1866
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
1867
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1416
1868
            continue
1417
1869
          fi
1418
1870
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1419
1871
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1420
 
            # Search the libtool library
1421
 
            lib="$searchdir/lib${name}.la"
1422
 
            if test -f "$lib"; then
1423
 
              found=yes
1424
 
              break
1425
 
            fi
 
1872
            for search_ext in .la $std_shrext .so .a; do
 
1873
              # Search the libtool library
 
1874
              lib="$searchdir/lib${name}${search_ext}"
 
1875
              if test -f "$lib"; then
 
1876
                if test "$search_ext" = ".la"; then
 
1877
                  found=yes
 
1878
                else
 
1879
                  found=no
 
1880
                fi
 
1881
                break 2
 
1882
              fi
 
1883
            done
1426
1884
          done
1427
1885
          if test "$found" != yes; then
1428
1886
            # deplib doesn't seem to be a libtool library
1431
1889
              finalize_deplibs="$deplib $finalize_deplibs"
1432
1890
            else
1433
1891
              deplibs="$deplib $deplibs"
1434
 
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
1892
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1435
1893
            fi
1436
1894
            continue
 
1895
          else # deplib is a libtool library
 
1896
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
1897
            # We need to do some special things here, and not later.
 
1898
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
1899
              case " $predeps $postdeps " in
 
1900
              *" $deplib "*)
 
1901
                if (${SED} -e '2q' $lib |
 
1902
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1903
                  library_names=
 
1904
                  old_library=
 
1905
                  case $lib in
 
1906
                  */* | *\\*) . $lib ;;
 
1907
                  *) . ./$lib ;;
 
1908
                  esac
 
1909
                  for l in $old_library $library_names; do
 
1910
                    ll="$l"
 
1911
                  done
 
1912
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
1913
                    found=no
 
1914
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
1915
                    test "X$ladir" = "X$lib" && ladir="."
 
1916
                    lib=$ladir/$old_library
 
1917
                    if test "$linkmode,$pass" = "prog,link"; then
 
1918
                      compile_deplibs="$deplib $compile_deplibs"
 
1919
                      finalize_deplibs="$deplib $finalize_deplibs"
 
1920
                    else
 
1921
                      deplibs="$deplib $deplibs"
 
1922
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
1923
                    fi
 
1924
                    continue
 
1925
                  fi
 
1926
                fi
 
1927
                ;;
 
1928
              *) ;;
 
1929
              esac
 
1930
            fi
1437
1931
          fi
1438
1932
          ;; # -l
1439
1933
        -L*)
1440
1934
          case $linkmode in
1441
1935
          lib)
1442
1936
            deplibs="$deplib $deplibs"
1443
 
            test $pass = conv && continue
 
1937
            test "$pass" = conv && continue
1444
1938
            newdependency_libs="$deplib $newdependency_libs"
1445
1939
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1446
1940
            ;;
1447
1941
          prog)
1448
 
            if test $pass = conv; then
 
1942
            if test "$pass" = conv; then
1449
1943
              deplibs="$deplib $deplibs"
1450
1944
              continue
1451
1945
            fi
1452
 
            if test $pass = scan; then
 
1946
            if test "$pass" = scan; then
1453
1947
              deplibs="$deplib $deplibs"
1454
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1455
1948
            else
1456
1949
              compile_deplibs="$deplib $compile_deplibs"
1457
1950
              finalize_deplibs="$deplib $finalize_deplibs"
1458
1951
            fi
 
1952
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1459
1953
            ;;
1460
1954
          *)
1461
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
1955
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1462
1956
            ;;
1463
1957
          esac # linkmode
1464
1958
          continue
1465
1959
          ;; # -L
1466
1960
        -R*)
1467
 
          if test $pass = link; then
 
1961
          if test "$pass" = link; then
1468
1962
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1469
1963
            # Make sure the xrpath contains only unique directories.
1470
1964
            case "$xrpath " in
1477
1971
          ;;
1478
1972
        *.la) lib="$deplib" ;;
1479
1973
        *.$libext)
1480
 
          if test $pass = conv; then
 
1974
          if test "$pass" = conv; then
1481
1975
            deplibs="$deplib $deplibs"
1482
1976
            continue
1483
1977
          fi
1484
1978
          case $linkmode in
1485
1979
          lib)
1486
1980
            if test "$deplibs_check_method" != pass_all; then
1487
 
              echo
1488
 
              echo "*** Warning: Trying to link with static lib archive $deplib."
1489
 
              echo "*** I have the capability to make that library automatically link in when"
1490
 
              echo "*** you link to this library.  But I can only do this if you have a"
1491
 
              echo "*** shared version of the library, which you do not appear to have"
1492
 
              echo "*** because the file extensions .$libext of this argument makes me believe"
1493
 
              echo "*** that it is just a static archive that I should not used here."
 
1981
              $echo
 
1982
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
1983
              $echo "*** I have the capability to make that library automatically link in when"
 
1984
              $echo "*** you link to this library.  But I can only do this if you have a"
 
1985
              $echo "*** shared version of the library, which you do not appear to have"
 
1986
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
1987
              $echo "*** that it is just a static archive that I should not used here."
1494
1988
            else
1495
 
              echo
1496
 
              echo "*** Warning: Linking the shared library $output against the"
1497
 
              echo "*** static library $deplib is not portable!"
 
1989
              $echo
 
1990
              $echo "*** Warning: Linking the shared library $output against the"
 
1991
              $echo "*** static library $deplib is not portable!"
1498
1992
              deplibs="$deplib $deplibs"
1499
1993
            fi
1500
1994
            continue
1501
1995
            ;;
1502
1996
          prog)
1503
 
            if test $pass != link; then
 
1997
            if test "$pass" != link; then
1504
1998
              deplibs="$deplib $deplibs"
1505
1999
            else
1506
2000
              compile_deplibs="$deplib $compile_deplibs"
1511
2005
          esac # linkmode
1512
2006
          ;; # *.$libext
1513
2007
        *.lo | *.$objext)
1514
 
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1515
 
            # If there is no dlopen support or we're linking statically,
1516
 
            # we need to preload.
1517
 
            newdlprefiles="$newdlprefiles $deplib"
1518
 
            compile_deplibs="$deplib $compile_deplibs"
1519
 
            finalize_deplibs="$deplib $finalize_deplibs"
1520
 
          else
1521
 
            newdlfiles="$newdlfiles $deplib"
 
2008
          if test "$pass" = conv; then
 
2009
            deplibs="$deplib $deplibs"
 
2010
          elif test "$linkmode" = prog; then
 
2011
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2012
              # If there is no dlopen support or we're linking statically,
 
2013
              # we need to preload.
 
2014
              newdlprefiles="$newdlprefiles $deplib"
 
2015
              compile_deplibs="$deplib $compile_deplibs"
 
2016
              finalize_deplibs="$deplib $finalize_deplibs"
 
2017
            else
 
2018
              newdlfiles="$newdlfiles $deplib"
 
2019
            fi
1522
2020
          fi
1523
2021
          continue
1524
2022
          ;;
1527
2025
          continue
1528
2026
          ;;
1529
2027
        esac # case $deplib
1530
 
        if test $found = yes || test -f "$lib"; then :
 
2028
        if test "$found" = yes || test -f "$lib"; then :
1531
2029
        else
1532
2030
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1533
 
          exit 1
 
2031
          exit $EXIT_FAILURE
1534
2032
        fi
1535
2033
 
1536
2034
        # Check to see that this really is a libtool archive.
1537
 
        if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2035
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1538
2036
        else
1539
2037
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1540
 
          exit 1
 
2038
          exit $EXIT_FAILURE
1541
2039
        fi
1542
2040
 
1543
2041
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1550
2048
        library_names=
1551
2049
        old_library=
1552
2050
        # If the library was installed with an old release of libtool,
1553
 
        # it will not redefine variable installed.
 
2051
        # it will not redefine variables installed, or shouldnotlink
1554
2052
        installed=yes
 
2053
        shouldnotlink=no
1555
2054
 
1556
2055
        # Read the .la file
1557
2056
        case $lib in
1561
2060
 
1562
2061
        if test "$linkmode,$pass" = "lib,link" ||
1563
2062
           test "$linkmode,$pass" = "prog,scan" ||
1564
 
           { test $linkmode = oldlib && test $linkmode = obj; }; then
1565
 
           # Add dl[pre]opened files of deplib
 
2063
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1566
2064
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1567
2065
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1568
2066
        fi
1569
2067
 
1570
 
        if test $pass = conv; then
 
2068
        if test "$pass" = conv; then
1571
2069
          # Only check for convenience libraries
1572
2070
          deplibs="$lib $deplibs"
1573
2071
          if test -z "$libdir"; then
1574
2072
            if test -z "$old_library"; then
1575
2073
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1576
 
              exit 1
 
2074
              exit $EXIT_FAILURE
1577
2075
            fi
1578
2076
            # It is a libtool convenience library, so add in its objects.
1579
2077
            convenience="$convenience $ladir/$objdir/$old_library"
1588
2086
              fi
1589
2087
              tmp_libs="$tmp_libs $deplib"
1590
2088
            done
1591
 
          elif test $linkmode != prog && test $linkmode != lib; then
 
2089
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1592
2090
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1593
 
            exit 1
 
2091
            exit $EXIT_FAILURE
1594
2092
          fi
1595
2093
          continue
1596
2094
        fi # $pass = conv
1597
2095
 
 
2096
 
1598
2097
        # Get the name of the library we link against.
1599
2098
        linklib=
1600
2099
        for l in $old_library $library_names; do
1602
2101
        done
1603
2102
        if test -z "$linklib"; then
1604
2103
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1605
 
          exit 1
 
2104
          exit $EXIT_FAILURE
1606
2105
        fi
1607
2106
 
1608
2107
        # This library was specified with -dlopen.
1609
 
        if test $pass = dlopen; then
 
2108
        if test "$pass" = dlopen; then
1610
2109
          if test -z "$libdir"; then
1611
2110
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1612
 
            exit 1
 
2111
            exit $EXIT_FAILURE
1613
2112
          fi
1614
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2113
          if test -z "$dlname" ||
 
2114
             test "$dlopen_support" != yes ||
 
2115
             test "$build_libtool_libs" = no; then
1615
2116
            # If there is no dlname, no dlopen support or we're linking
1616
 
            # statically, we need to preload.
1617
 
            dlprefiles="$dlprefiles $lib"
 
2117
            # statically, we need to preload.  We also need to preload any
 
2118
            # dependent libraries so libltdl's deplib preloader doesn't
 
2119
            # bomb out in the load deplibs phase.
 
2120
            dlprefiles="$dlprefiles $lib $dependency_libs"
1618
2121
          else
1619
2122
            newdlfiles="$newdlfiles $lib"
1620
2123
          fi
1655
2158
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1656
2159
 
1657
2160
        # This library was specified with -dlpreopen.
1658
 
        if test $pass = dlpreopen; then
 
2161
        if test "$pass" = dlpreopen; then
1659
2162
          if test -z "$libdir"; then
1660
2163
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1661
 
            exit 1
 
2164
            exit $EXIT_FAILURE
1662
2165
          fi
1663
2166
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1664
2167
          # are required to link).
1674
2177
 
1675
2178
        if test -z "$libdir"; then
1676
2179
          # Link the convenience library
1677
 
          if test $linkmode = lib; then
 
2180
          if test "$linkmode" = lib; then
1678
2181
            deplibs="$dir/$old_library $deplibs"
1679
2182
          elif test "$linkmode,$pass" = "prog,link"; then
1680
2183
            compile_deplibs="$dir/$old_library $compile_deplibs"
1681
2184
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1682
2185
          else
1683
 
            deplibs="$lib $deplibs"
 
2186
            deplibs="$lib $deplibs" # used for prog,scan pass
1684
2187
          fi
1685
2188
          continue
1686
2189
        fi
1687
2190
 
1688
 
        if test $linkmode = prog && test $pass != link; then
 
2191
 
 
2192
        if test "$linkmode" = prog && test "$pass" != link; then
1689
2193
          newlib_search_path="$newlib_search_path $ladir"
1690
2194
          deplibs="$lib $deplibs"
1691
2195
 
1701
2205
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1702
2206
            esac
1703
2207
            # Need to link against all dependency_libs?
1704
 
            if test $linkalldeplibs = yes; then
 
2208
            if test "$linkalldeplibs" = yes; then
1705
2209
              deplibs="$deplib $deplibs"
1706
2210
            else
1707
2211
              # Need to hardcode shared library paths
1718
2222
          continue
1719
2223
        fi # $linkmode = prog...
1720
2224
 
 
2225
        if test "$linkmode,$pass" = "prog,link"; then
 
2226
          if test -n "$library_names" &&
 
2227
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2228
            # We need to hardcode the library path
 
2229
            if test -n "$shlibpath_var"; then
 
2230
              # Make sure the rpath contains only unique directories.
 
2231
              case "$temp_rpath " in
 
2232
              *" $dir "*) ;;
 
2233
              *" $absdir "*) ;;
 
2234
              *) temp_rpath="$temp_rpath $dir" ;;
 
2235
              esac
 
2236
            fi
 
2237
 
 
2238
            # Hardcode the library path.
 
2239
            # Skip directories that are in the system default run-time
 
2240
            # search path.
 
2241
            case " $sys_lib_dlsearch_path " in
 
2242
            *" $absdir "*) ;;
 
2243
            *)
 
2244
              case "$compile_rpath " in
 
2245
              *" $absdir "*) ;;
 
2246
              *) compile_rpath="$compile_rpath $absdir"
 
2247
              esac
 
2248
              ;;
 
2249
            esac
 
2250
            case " $sys_lib_dlsearch_path " in
 
2251
            *" $libdir "*) ;;
 
2252
            *)
 
2253
              case "$finalize_rpath " in
 
2254
              *" $libdir "*) ;;
 
2255
              *) finalize_rpath="$finalize_rpath $libdir"
 
2256
              esac
 
2257
              ;;
 
2258
            esac
 
2259
          fi # $linkmode,$pass = prog,link...
 
2260
 
 
2261
          if test "$alldeplibs" = yes &&
 
2262
             { test "$deplibs_check_method" = pass_all ||
 
2263
               { test "$build_libtool_libs" = yes &&
 
2264
                 test -n "$library_names"; }; }; then
 
2265
            # We only need to search for static libraries
 
2266
            continue
 
2267
          fi
 
2268
        fi
 
2269
 
1721
2270
        link_static=no # Whether the deplib will be linked statically
1722
2271
        if test -n "$library_names" &&
1723
2272
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1724
 
          # Link against this shared library
1725
 
 
1726
 
          if test "$linkmode,$pass" = "prog,link" ||
1727
 
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1728
 
            # Hardcode the library path.
1729
 
            # Skip directories that are in the system default run-time
1730
 
            # search path.
1731
 
            case " $sys_lib_dlsearch_path " in
1732
 
            *" $absdir "*) ;;
1733
 
            *)
1734
 
              case "$compile_rpath " in
1735
 
              *" $absdir "*) ;;
1736
 
              *) compile_rpath="$compile_rpath $absdir"
1737
 
              esac
1738
 
              ;;
1739
 
            esac
1740
 
            case " $sys_lib_dlsearch_path " in
1741
 
            *" $libdir "*) ;;
1742
 
            *)
1743
 
              case "$finalize_rpath " in
1744
 
              *" $libdir "*) ;;
1745
 
              *) finalize_rpath="$finalize_rpath $libdir"
1746
 
              esac
1747
 
              ;;
1748
 
            esac
1749
 
            if test $linkmode = prog; then
1750
 
              # We need to hardcode the library path
1751
 
              if test -n "$shlibpath_var"; then
1752
 
                # Make sure the rpath contains only unique directories.
1753
 
                case "$temp_rpath " in
1754
 
                *" $dir "*) ;;
1755
 
                *" $absdir "*) ;;
1756
 
                *) temp_rpath="$temp_rpath $dir" ;;
1757
 
                esac
1758
 
              fi
1759
 
            fi
1760
 
          fi # $linkmode,$pass = prog,link...
1761
 
 
1762
 
          if test "$alldeplibs" = yes &&
1763
 
             { test "$deplibs_check_method" = pass_all ||
1764
 
               { test "$build_libtool_libs" = yes &&
1765
 
                 test -n "$library_names"; }; }; then
1766
 
            # We only need to search for static libraries
1767
 
            continue
1768
 
          fi
1769
 
 
1770
2273
          if test "$installed" = no; then
1771
2274
            notinst_deplibs="$notinst_deplibs $lib"
1772
2275
            need_relink=yes
1773
2276
          fi
 
2277
          # This is a shared library
 
2278
 
 
2279
          # Warn about portability, can't link against -module's on
 
2280
          # some systems (darwin)
 
2281
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2282
            $echo
 
2283
            if test "$linkmode" = prog; then
 
2284
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
2285
            else
 
2286
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
2287
            fi
 
2288
            $echo "*** $linklib is not portable!"
 
2289
          fi
 
2290
          if test "$linkmode" = lib &&
 
2291
             test "$hardcode_into_libs" = yes; then
 
2292
            # Hardcode the library path.
 
2293
            # Skip directories that are in the system default run-time
 
2294
            # search path.
 
2295
            case " $sys_lib_dlsearch_path " in
 
2296
            *" $absdir "*) ;;
 
2297
            *)
 
2298
              case "$compile_rpath " in
 
2299
              *" $absdir "*) ;;
 
2300
              *) compile_rpath="$compile_rpath $absdir"
 
2301
              esac
 
2302
              ;;
 
2303
            esac
 
2304
            case " $sys_lib_dlsearch_path " in
 
2305
            *" $libdir "*) ;;
 
2306
            *)
 
2307
              case "$finalize_rpath " in
 
2308
              *" $libdir "*) ;;
 
2309
              *) finalize_rpath="$finalize_rpath $libdir"
 
2310
              esac
 
2311
              ;;
 
2312
            esac
 
2313
          fi
1774
2314
 
1775
2315
          if test -n "$old_archive_from_expsyms_cmds"; then
1776
2316
            # figure out the soname
1784
2324
            elif test -n "$soname_spec"; then
1785
2325
              # bleh windows
1786
2326
              case $host in
1787
 
              *cygwin*)
 
2327
              *cygwin* | mingw*)
1788
2328
                major=`expr $current - $age`
1789
2329
                versuffix="-$major"
1790
2330
                ;;
1796
2336
 
1797
2337
            # Make a new name for the extract_expsyms_cmds to use
1798
2338
            soroot="$soname"
1799
 
            soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1800
 
            newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
2339
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2340
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1801
2341
 
1802
2342
            # If the library has no export list, then create one now
1803
2343
            if test -f "$output_objdir/$soname-def"; then :
1804
2344
            else
1805
2345
              $show "extracting exported symbol list from \`$soname'"
1806
2346
              save_ifs="$IFS"; IFS='~'
1807
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2347
              cmds=$extract_expsyms_cmds
1808
2348
              for cmd in $cmds; do
1809
2349
                IFS="$save_ifs"
 
2350
                eval cmd=\"$cmd\"
1810
2351
                $show "$cmd"
1811
2352
                $run eval "$cmd" || exit $?
1812
2353
              done
1817
2358
            if test -f "$output_objdir/$newlib"; then :; else
1818
2359
              $show "generating import library for \`$soname'"
1819
2360
              save_ifs="$IFS"; IFS='~'
1820
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2361
              cmds=$old_archive_from_expsyms_cmds
1821
2362
              for cmd in $cmds; do
1822
2363
                IFS="$save_ifs"
 
2364
                eval cmd=\"$cmd\"
1823
2365
                $show "$cmd"
1824
2366
                $run eval "$cmd" || exit $?
1825
2367
              done
1828
2370
            # make sure the library variables are pointing to the new library
1829
2371
            dir=$output_objdir
1830
2372
            linklib=$newlib
1831
 
          fi # test -n $old_archive_from_expsyms_cmds
 
2373
          fi # test -n "$old_archive_from_expsyms_cmds"
1832
2374
 
1833
 
          if test $linkmode = prog || test "$mode" != relink; then
 
2375
          if test "$linkmode" = prog || test "$mode" != relink; then
1834
2376
            add_shlibpath=
1835
2377
            add_dir=
1836
2378
            add=
1839
2381
            immediate | unsupported)
1840
2382
              if test "$hardcode_direct" = no; then
1841
2383
                add="$dir/$linklib"
 
2384
                case $host in
 
2385
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2386
                  *-*-darwin* )
 
2387
                    # if the lib is a module then we can not link against
 
2388
                    # it, someone is ignoring the new warnings I added
 
2389
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2390
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2391
                      if test -z "$old_library" ; then
 
2392
                        $echo
 
2393
                        $echo "** And there doesn't seem to be a static archive available"
 
2394
                        $echo "** The link will probably fail, sorry"
 
2395
                      else
 
2396
                        add="$dir/$old_library"
 
2397
                      fi
 
2398
                    fi
 
2399
                esac
1842
2400
              elif test "$hardcode_minus_L" = no; then
1843
2401
                case $host in
1844
2402
                *-*-sunos*) add_shlibpath="$dir" ;;
1860
2418
                # Try looking first in the location we're being installed to.
1861
2419
                if test -n "$inst_prefix_dir"; then
1862
2420
                  case "$libdir" in
1863
 
                  [\/]*)
1864
 
                    add_dir="-L$inst_prefix_dir$libdir $add_dir"
1865
 
                    ;;
 
2421
                    [\\/]*)
 
2422
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2423
                      ;;
1866
2424
                  esac
1867
2425
                fi
1868
2426
                add="-l$name"
1878
2436
 
1879
2437
            if test "$lib_linked" != yes; then
1880
2438
              $echo "$modename: configuration error: unsupported hardcode properties"
1881
 
              exit 1
 
2439
              exit $EXIT_FAILURE
1882
2440
            fi
1883
2441
 
1884
2442
            if test -n "$add_shlibpath"; then
1887
2445
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1888
2446
              esac
1889
2447
            fi
1890
 
            if test $linkmode = prog; then
 
2448
            if test "$linkmode" = prog; then
1891
2449
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1892
2450
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1893
2451
            else
1904
2462
            fi
1905
2463
          fi
1906
2464
 
1907
 
          if test $linkmode = prog || test "$mode" = relink; then
 
2465
          if test "$linkmode" = prog || test "$mode" = relink; then
1908
2466
            add_shlibpath=
1909
2467
            add_dir=
1910
2468
            add=
1920
2478
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1921
2479
              esac
1922
2480
              add="-l$name"
 
2481
            elif test "$hardcode_automatic" = yes; then
 
2482
              if test -n "$inst_prefix_dir" &&
 
2483
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2484
                add="$inst_prefix_dir$libdir/$linklib"
 
2485
              else
 
2486
                add="$libdir/$linklib"
 
2487
              fi
1923
2488
            else
1924
2489
              # We cannot seem to hardcode it, guess we'll fake it.
1925
2490
              add_dir="-L$libdir"
1926
2491
              # Try looking first in the location we're being installed to.
1927
2492
              if test -n "$inst_prefix_dir"; then
1928
2493
                case "$libdir" in
1929
 
                [\/]*)
1930
 
                  add_dir="-L$inst_prefix_dir$libdir $add_dir"
1931
 
                  ;;
 
2494
                  [\\/]*)
 
2495
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2496
                    ;;
1932
2497
                esac
1933
2498
              fi
1934
2499
              add="-l$name"
1935
2500
            fi
1936
2501
 
1937
 
            if test $linkmode = prog; then
 
2502
            if test "$linkmode" = prog; then
1938
2503
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1939
2504
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1940
2505
            else
1942
2507
              test -n "$add" && deplibs="$add $deplibs"
1943
2508
            fi
1944
2509
          fi
1945
 
        elif test $linkmode = prog; then
1946
 
          if test "$alldeplibs" = yes &&
1947
 
             { test "$deplibs_check_method" = pass_all ||
1948
 
               { test "$build_libtool_libs" = yes &&
1949
 
                 test -n "$library_names"; }; }; then
1950
 
            # We only need to search for static libraries
1951
 
            continue
1952
 
          fi
1953
 
 
1954
 
          # Try to link the static library
 
2510
        elif test "$linkmode" = prog; then
1955
2511
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1956
2512
          # is not unsupported.  This is valid on all known static and
1957
2513
          # shared platforms.
1971
2527
 
1972
2528
            # Just print a warning and add the library to dependency_libs so
1973
2529
            # that the program can be linked against the static library.
1974
 
            echo
1975
 
            echo "*** Warning: This system can not link to static lib archive $lib."
1976
 
            echo "*** I have the capability to make that library automatically link in when"
1977
 
            echo "*** you link to this library.  But I can only do this if you have a"
1978
 
            echo "*** shared version of the library, which you do not appear to have."
 
2530
            $echo
 
2531
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2532
            $echo "*** I have the capability to make that library automatically link in when"
 
2533
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2534
            $echo "*** shared version of the library, which you do not appear to have."
1979
2535
            if test "$module" = yes; then
1980
 
              echo "*** But as you try to build a module library, libtool will still create "
1981
 
              echo "*** a static module, that should work as long as the dlopening application"
1982
 
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
2536
              $echo "*** But as you try to build a module library, libtool will still create "
 
2537
              $echo "*** a static module, that should work as long as the dlopening application"
 
2538
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1983
2539
              if test -z "$global_symbol_pipe"; then
1984
 
                echo
1985
 
                echo "*** However, this would only work if libtool was able to extract symbol"
1986
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1987
 
                echo "*** not find such a program.  So, this module is probably useless."
1988
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2540
                $echo
 
2541
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2542
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2543
                $echo "*** not find such a program.  So, this module is probably useless."
 
2544
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
1989
2545
              fi
1990
2546
              if test "$build_old_libs" = no; then
1991
2547
                build_libtool_libs=module
2002
2558
          fi
2003
2559
        fi # link shared/static library?
2004
2560
 
2005
 
        if test $linkmode = lib; then
 
2561
        if test "$linkmode" = lib; then
2006
2562
          if test -n "$dependency_libs" &&
2007
 
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2008
 
               test $link_static = yes; }; then
 
2563
             { test "$hardcode_into_libs" != yes ||
 
2564
               test "$build_old_libs" = yes ||
 
2565
               test "$link_static" = yes; }; then
2009
2566
            # Extract -R from dependency_libs
2010
2567
            temp_deplibs=
2011
2568
            for libdir in $dependency_libs; do
2036
2593
            tmp_libs="$tmp_libs $deplib"
2037
2594
          done
2038
2595
 
2039
 
          if test $link_all_deplibs != no; then
 
2596
          if test "$link_all_deplibs" != no; then
2040
2597
            # Add the search paths of all dependency libraries
2041
2598
            for deplib in $dependency_libs; do
2042
2599
              case $deplib in
2056
2613
                  ;;
2057
2614
                esac
2058
2615
                if grep "^installed=no" $deplib > /dev/null; then
2059
 
                  path="-L$absdir/$objdir"
 
2616
                  path="$absdir/$objdir"
2060
2617
                else
2061
2618
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2062
2619
                  if test -z "$libdir"; then
2063
2620
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2064
 
                    exit 1
 
2621
                    exit $EXIT_FAILURE
2065
2622
                  fi
2066
2623
                  if test "$absdir" != "$libdir"; then
2067
2624
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2068
2625
                  fi
2069
 
                  path="-L$absdir"
 
2626
                  path="$absdir"
2070
2627
                fi
 
2628
                depdepl=
 
2629
                case $host in
 
2630
                *-*-darwin*)
 
2631
                  # we do not want to link against static libs,
 
2632
                  # but need to link against shared
 
2633
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2634
                  if test -n "$deplibrary_names" ; then
 
2635
                    for tmp in $deplibrary_names ; do
 
2636
                      depdepl=$tmp
 
2637
                    done
 
2638
                    if test -f "$path/$depdepl" ; then
 
2639
                      depdepl="$path/$depdepl"
 
2640
                    fi
 
2641
                    # do not add paths which are already there
 
2642
                    case " $newlib_search_path " in
 
2643
                    *" $path "*) ;;
 
2644
                    *) newlib_search_path="$newlib_search_path $path";;
 
2645
                    esac
 
2646
                  fi
 
2647
                  path=""
 
2648
                  ;;
 
2649
                *)
 
2650
                  path="-L$path"
 
2651
                  ;;
 
2652
                esac
 
2653
                ;;
 
2654
              -l*)
 
2655
                case $host in
 
2656
                *-*-darwin*)
 
2657
                  # Again, we only want to link against shared libraries
 
2658
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2659
                  for tmp in $newlib_search_path ; do
 
2660
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2661
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2662
                      break
 
2663
                    fi
 
2664
                  done
 
2665
                  path=""
 
2666
                  ;;
 
2667
                *) continue ;;
 
2668
                esac
2071
2669
                ;;
2072
2670
              *) continue ;;
2073
2671
              esac
2074
2672
              case " $deplibs " in
 
2673
              *" $depdepl "*) ;;
 
2674
              *) deplibs="$depdepl $deplibs" ;;
 
2675
              esac
 
2676
              case " $deplibs " in
2075
2677
              *" $path "*) ;;
2076
2678
              *) deplibs="$deplibs $path" ;;
2077
2679
              esac
2079
2681
          fi # link_all_deplibs != no
2080
2682
        fi # linkmode = lib
2081
2683
      done # for deplib in $libs
2082
 
      if test $pass = dlpreopen; then
 
2684
      dependency_libs="$newdependency_libs"
 
2685
      if test "$pass" = dlpreopen; then
2083
2686
        # Link the dlpreopened libraries before other libraries
2084
2687
        for deplib in $save_deplibs; do
2085
2688
          deplibs="$deplib $deplibs"
2086
2689
        done
2087
2690
      fi
2088
 
      if test $pass != dlopen; then
2089
 
        test $pass != scan && dependency_libs="$newdependency_libs"
2090
 
        if test $pass != conv; then
 
2691
      if test "$pass" != dlopen; then
 
2692
        if test "$pass" != conv; then
2091
2693
          # Make sure lib_search_path contains only unique directories.
2092
2694
          lib_search_path=
2093
2695
          for dir in $newlib_search_path; do
2109
2711
          eval tmp_libs=\"\$$var\"
2110
2712
          new_libs=
2111
2713
          for deplib in $tmp_libs; do
 
2714
            # FIXME: Pedantically, this is the right thing to do, so
 
2715
            #        that some nasty dependency loop isn't accidentally
 
2716
            #        broken:
 
2717
            #new_libs="$deplib $new_libs"
 
2718
            # Pragmatically, this seems to cause very few problems in
 
2719
            # practice:
2112
2720
            case $deplib in
2113
2721
            -L*) new_libs="$deplib $new_libs" ;;
 
2722
            -R*) ;;
2114
2723
            *)
 
2724
              # And here is the reason: when a library appears more
 
2725
              # than once as an explicit dependence of a library, or
 
2726
              # is implicitly linked in more than once by the
 
2727
              # compiler, it is considered special, and multiple
 
2728
              # occurrences thereof are not removed.  Compare this
 
2729
              # with having the same library being listed as a
 
2730
              # dependency of multiple other libraries: in this case,
 
2731
              # we know (pedantically, we assume) the library does not
 
2732
              # need to be listed more than once, so we keep only the
 
2733
              # last copy.  This is not always right, but it is rare
 
2734
              # enough that we require users that really mean to play
 
2735
              # such unportable linking tricks to link the library
 
2736
              # using -Wl,-lname, so that libtool does not consider it
 
2737
              # for duplicate removal.
2115
2738
              case " $specialdeplibs " in
2116
2739
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2117
2740
              *)
2139
2762
          eval $var=\"$tmp_libs\"
2140
2763
        done # for var
2141
2764
      fi
2142
 
      if test "$pass" = "conv" &&
2143
 
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2144
 
        libs="$deplibs" # reset libs
2145
 
        deplibs=
2146
 
      fi
 
2765
      # Last step: remove runtime libs from dependency_libs
 
2766
      # (they stay in deplibs)
 
2767
      tmp_libs=
 
2768
      for i in $dependency_libs ; do
 
2769
        case " $predeps $postdeps $compiler_lib_search_path " in
 
2770
        *" $i "*)
 
2771
          i=""
 
2772
          ;;
 
2773
        esac
 
2774
        if test -n "$i" ; then
 
2775
          tmp_libs="$tmp_libs $i"
 
2776
        fi
 
2777
      done
 
2778
      dependency_libs=$tmp_libs
2147
2779
    done # for pass
2148
 
    if test $linkmode = prog; then
 
2780
    if test "$linkmode" = prog; then
2149
2781
      dlfiles="$newdlfiles"
2150
2782
      dlprefiles="$newdlprefiles"
2151
2783
    fi
2152
2784
 
2153
2785
    case $linkmode in
2154
2786
    oldlib)
 
2787
      if test -n "$deplibs"; then
 
2788
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
 
2789
      fi
 
2790
 
2155
2791
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2156
2792
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2157
2793
      fi
2165
2801
      fi
2166
2802
 
2167
2803
      if test -n "$vinfo"; then
2168
 
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
2804
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2169
2805
      fi
2170
2806
 
2171
2807
      if test -n "$release"; then
2187
2823
      case $outputname in
2188
2824
      lib*)
2189
2825
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
2826
        eval shared_ext=\"$shrext_cmds\"
2190
2827
        eval libname=\"$libname_spec\"
2191
2828
        ;;
2192
2829
      *)
2193
2830
        if test "$module" = no; then
2194
2831
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2195
2832
          $echo "$help" 1>&2
2196
 
          exit 1
 
2833
          exit $EXIT_FAILURE
2197
2834
        fi
2198
2835
        if test "$need_lib_prefix" != no; then
2199
2836
          # Add the "lib" prefix for modules if required
2200
2837
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
2838
          eval shared_ext=\"$shrext_cmds\"
2201
2839
          eval libname=\"$libname_spec\"
2202
2840
        else
2203
2841
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2208
2846
      if test -n "$objs"; then
2209
2847
        if test "$deplibs_check_method" != pass_all; then
2210
2848
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2211
 
          exit 1
 
2849
          exit $EXIT_FAILURE
2212
2850
        else
2213
 
          echo
2214
 
          echo "*** Warning: Linking the shared library $output against the non-libtool"
2215
 
          echo "*** objects $objs is not portable!"
 
2851
          $echo
 
2852
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
2853
          $echo "*** objects $objs is not portable!"
2216
2854
          libobjs="$libobjs $objs"
2217
2855
        fi
2218
2856
      fi
2222
2860
      fi
2223
2861
 
2224
2862
      set dummy $rpath
2225
 
      if test $# -gt 2; then
 
2863
      if test "$#" -gt 2; then
2226
2864
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2227
2865
      fi
2228
2866
      install_libdir="$2"
2231
2869
      if test -z "$rpath"; then
2232
2870
        if test "$build_libtool_libs" = yes; then
2233
2871
          # Building a libtool convenience library.
2234
 
          libext=al
 
2872
          # Some compilers have problems with a `.al' extension so
 
2873
          # convenience libraries should have the same extension an
 
2874
          # archive normally would.
2235
2875
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2236
2876
          build_libtool_libs=convenience
2237
2877
          build_old_libs=yes
2238
2878
        fi
2239
2879
 
2240
2880
        if test -n "$vinfo"; then
2241
 
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
2881
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2242
2882
        fi
2243
2883
 
2244
2884
        if test -n "$release"; then
2254
2894
        if test -n "$8"; then
2255
2895
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2256
2896
          $echo "$help" 1>&2
2257
 
          exit 1
 
2897
          exit $EXIT_FAILURE
2258
2898
        fi
2259
2899
 
2260
 
        current="$2"
2261
 
        revision="$3"
2262
 
        age="$4"
 
2900
        # convert absolute version numbers to libtool ages
 
2901
        # this retains compatibility with .la files and attempts
 
2902
        # to make the code below a bit more comprehensible
 
2903
 
 
2904
        case $vinfo_number in
 
2905
        yes)
 
2906
          number_major="$2"
 
2907
          number_minor="$3"
 
2908
          number_revision="$4"
 
2909
          #
 
2910
          # There are really only two kinds -- those that
 
2911
          # use the current revision as the major version
 
2912
          # and those that subtract age and use age as
 
2913
          # a minor version.  But, then there is irix
 
2914
          # which has an extra 1 added just for fun
 
2915
          #
 
2916
          case $version_type in
 
2917
          darwin|linux|osf|windows)
 
2918
            current=`expr $number_major + $number_minor`
 
2919
            age="$number_minor"
 
2920
            revision="$number_revision"
 
2921
            ;;
 
2922
          freebsd-aout|freebsd-elf|sunos)
 
2923
            current="$number_major"
 
2924
            revision="$number_minor"
 
2925
            age="0"
 
2926
            ;;
 
2927
          irix|nonstopux)
 
2928
            current=`expr $number_major + $number_minor - 1`
 
2929
            age="$number_minor"
 
2930
            revision="$number_minor"
 
2931
            ;;
 
2932
          *)
 
2933
            $echo "$modename: unknown library version type \`$version_type'" 1>&2
 
2934
            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
2935
            exit $EXIT_FAILURE
 
2936
            ;;
 
2937
          esac
 
2938
          ;;
 
2939
        no)
 
2940
          current="$2"
 
2941
          revision="$3"
 
2942
          age="$4"
 
2943
          ;;
 
2944
        esac
2263
2945
 
2264
2946
        # Check that each of the things are valid numbers.
2265
2947
        case $current in
2266
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2948
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2267
2949
        *)
2268
2950
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2269
2951
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2270
 
          exit 1
 
2952
          exit $EXIT_FAILURE
2271
2953
          ;;
2272
2954
        esac
2273
2955
 
2274
2956
        case $revision in
2275
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2957
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2276
2958
        *)
2277
2959
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2278
2960
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2279
 
          exit 1
 
2961
          exit $EXIT_FAILURE
2280
2962
          ;;
2281
2963
        esac
2282
2964
 
2283
2965
        case $age in
2284
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2966
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2285
2967
        *)
2286
2968
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2287
2969
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2288
 
          exit 1
 
2970
          exit $EXIT_FAILURE
2289
2971
          ;;
2290
2972
        esac
2291
2973
 
2292
 
        if test $age -gt $current; then
 
2974
        if test "$age" -gt "$current"; then
2293
2975
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2294
2976
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2295
 
          exit 1
 
2977
          exit $EXIT_FAILURE
2296
2978
        fi
2297
2979
 
2298
2980
        # Calculate the version variables.
2333
3015
 
2334
3016
          # Add in all the interfaces that we are compatible with.
2335
3017
          loop=$revision
2336
 
          while test $loop != 0; do
 
3018
          while test "$loop" -ne 0; do
2337
3019
            iface=`expr $revision - $loop`
2338
3020
            loop=`expr $loop - 1`
2339
3021
            verstring="$verstring_prefix$major.$iface:$verstring"
2356
3038
 
2357
3039
          # Add in all the interfaces that we are compatible with.
2358
3040
          loop=$age
2359
 
          while test $loop != 0; do
 
3041
          while test "$loop" -ne 0; do
2360
3042
            iface=`expr $current - $loop`
2361
3043
            loop=`expr $loop - 1`
2362
3044
            verstring="$verstring:${iface}.0"
2380
3062
 
2381
3063
        *)
2382
3064
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2383
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2384
 
          exit 1
 
3065
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3066
          exit $EXIT_FAILURE
2385
3067
          ;;
2386
3068
        esac
2387
3069
 
2388
3070
        # Clear the version info if we defaulted, and they specified a release.
2389
3071
        if test -z "$vinfo" && test -n "$release"; then
2390
3072
          major=
2391
 
          verstring="0.0"
2392
3073
          case $version_type in
2393
3074
          darwin)
2394
3075
            # we can't check for "0.0" in archive_cmds due to quoting
2395
3076
            # problems, so we reset it completely
2396
 
            verstring=""
 
3077
            verstring=
2397
3078
            ;;
2398
3079
          *)
2399
3080
            verstring="0.0"
2427
3108
      fi
2428
3109
 
2429
3110
      if test "$mode" != relink; then
2430
 
        # Remove our outputs.
2431
 
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2432
 
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
 
3111
        # Remove our outputs, but don't remove object files since they
 
3112
        # may have been created when compiling PIC objects.
 
3113
        removelist=
 
3114
        tempremovelist=`$echo "$output_objdir/*"`
 
3115
        for p in $tempremovelist; do
 
3116
          case $p in
 
3117
            *.$objext)
 
3118
               ;;
 
3119
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3120
               if test "X$precious_files_regex" != "X"; then
 
3121
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3122
                 then
 
3123
                   continue
 
3124
                 fi
 
3125
               fi
 
3126
               removelist="$removelist $p"
 
3127
               ;;
 
3128
            *) ;;
 
3129
          esac
 
3130
        done
 
3131
        if test -n "$removelist"; then
 
3132
          $show "${rm}r $removelist"
 
3133
          $run ${rm}r $removelist
 
3134
        fi
2433
3135
      fi
2434
3136
 
2435
3137
      # Now set the variables for building old libraries.
2442
3144
 
2443
3145
      # Eliminate all temporary directories.
2444
3146
      for path in $notinst_path; do
2445
 
        lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2446
 
        deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2447
 
        dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3147
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3148
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3149
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2448
3150
      done
2449
3151
 
2450
3152
      if test -n "$xrpath"; then
2457
3159
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2458
3160
          esac
2459
3161
        done
2460
 
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
3162
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2461
3163
          dependency_libs="$temp_xrpath $dependency_libs"
2462
3164
        fi
2463
3165
      fi
2497
3199
            ;;
2498
3200
          *-*-openbsd* | *-*-freebsd*)
2499
3201
            # Do not include libc due to us having libc/libc_r.
 
3202
            test "X$arg" = "X-lc" && continue
2500
3203
            ;;
2501
 
          *)
 
3204
          *)
2502
3205
            # Add libc to deplibs on all other systems if necessary.
2503
 
            if test $build_libtool_need_lc = "yes"; then
 
3206
            if test "$build_libtool_need_lc" = "yes"; then
2504
3207
              deplibs="$deplibs -lc"
2505
3208
            fi
2506
3209
            ;;
2527
3230
          # This might be a little naive.  We might want to check
2528
3231
          # whether the library exists or not.  But this is on
2529
3232
          # osf3 & osf4 and I'm not really sure... Just
2530
 
          # implementing what was already the behaviour.
 
3233
          # implementing what was already the behavior.
2531
3234
          newdeplibs=$deplibs
2532
3235
          ;;
2533
3236
        test_compile)
2540
3243
          int main() { return 0; }
2541
3244
EOF
2542
3245
          $rm conftest
2543
 
          $CC -o conftest conftest.c $deplibs
2544
 
          if test $? -eq 0 ; then
 
3246
          $LTCC -o conftest conftest.c $deplibs
 
3247
          if test "$?" -eq 0 ; then
2545
3248
            ldd_output=`ldd conftest`
2546
3249
            for i in $deplibs; do
2547
3250
              name="`expr $i : '-l\(.*\)'`"
2548
3251
              # If $name is empty we are operating on a -L argument.
2549
 
              if test -n "$name" && test "$name" != "0"; then
2550
 
                libname=`eval \\$echo \"$libname_spec\"`
2551
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2552
 
                set dummy $deplib_matches
2553
 
                deplib_match=$2
2554
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2555
 
                  newdeplibs="$newdeplibs $i"
2556
 
                else
2557
 
                  droppeddeps=yes
2558
 
                  echo
2559
 
                  echo "*** Warning: dynamic linker does not accept needed library $i."
2560
 
                  echo "*** I have the capability to make that library automatically link in when"
2561
 
                  echo "*** you link to this library.  But I can only do this if you have a"
2562
 
                  echo "*** shared version of the library, which I believe you do not have"
2563
 
                  echo "*** because a test_compile did reveal that the linker did not use it for"
2564
 
                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
2565
 
                fi
2566
 
              else
2567
 
                newdeplibs="$newdeplibs $i"
2568
 
              fi
2569
 
            done
2570
 
          else
2571
 
            # Error occured in the first compile.  Let's try to salvage
2572
 
            # the situation: Compile a separate program for each library.
2573
 
            for i in $deplibs; do
2574
 
              name="`expr $i : '-l\(.*\)'`"
2575
 
             # If $name is empty we are operating on a -L argument.
2576
 
              if test -n "$name" && test "$name" != "0"; then
2577
 
                $rm conftest
2578
 
                $CC -o conftest conftest.c $i
2579
 
                # Did it work?
2580
 
                if test $? -eq 0 ; then
2581
 
                  ldd_output=`ldd conftest`
 
3252
              if test "$name" != "" && test "$name" -ne "0"; then
 
3253
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3254
                  case " $predeps $postdeps " in
 
3255
                  *" $i "*)
 
3256
                    newdeplibs="$newdeplibs $i"
 
3257
                    i=""
 
3258
                    ;;
 
3259
                  esac
 
3260
                fi
 
3261
                if test -n "$i" ; then
2582
3262
                  libname=`eval \\$echo \"$libname_spec\"`
2583
3263
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2584
3264
                  set dummy $deplib_matches
2587
3267
                    newdeplibs="$newdeplibs $i"
2588
3268
                  else
2589
3269
                    droppeddeps=yes
2590
 
                    echo
2591
 
                    echo "*** Warning: dynamic linker does not accept needed library $i."
2592
 
                    echo "*** I have the capability to make that library automatically link in when"
2593
 
                    echo "*** you link to this library.  But I can only do this if you have a"
2594
 
                    echo "*** shared version of the library, which you do not appear to have"
2595
 
                    echo "*** because a test_compile did reveal that the linker did not use this one"
2596
 
                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3270
                    $echo
 
3271
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3272
                    $echo "*** I have the capability to make that library automatically link in when"
 
3273
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3274
                    $echo "*** shared version of the library, which I believe you do not have"
 
3275
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3276
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3277
                  fi
 
3278
                fi
 
3279
              else
 
3280
                newdeplibs="$newdeplibs $i"
 
3281
              fi
 
3282
            done
 
3283
          else
 
3284
            # Error occurred in the first compile.  Let's try to salvage
 
3285
            # the situation: Compile a separate program for each library.
 
3286
            for i in $deplibs; do
 
3287
              name="`expr $i : '-l\(.*\)'`"
 
3288
              # If $name is empty we are operating on a -L argument.
 
3289
              if test "$name" != "" && test "$name" != "0"; then
 
3290
                $rm conftest
 
3291
                $LTCC -o conftest conftest.c $i
 
3292
                # Did it work?
 
3293
                if test "$?" -eq 0 ; then
 
3294
                  ldd_output=`ldd conftest`
 
3295
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3296
                    case " $predeps $postdeps " in
 
3297
                    *" $i "*)
 
3298
                      newdeplibs="$newdeplibs $i"
 
3299
                      i=""
 
3300
                      ;;
 
3301
                    esac
 
3302
                  fi
 
3303
                  if test -n "$i" ; then
 
3304
                    libname=`eval \\$echo \"$libname_spec\"`
 
3305
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3306
                    set dummy $deplib_matches
 
3307
                    deplib_match=$2
 
3308
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3309
                      newdeplibs="$newdeplibs $i"
 
3310
                    else
 
3311
                      droppeddeps=yes
 
3312
                      $echo
 
3313
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3314
                      $echo "*** I have the capability to make that library automatically link in when"
 
3315
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3316
                      $echo "*** shared version of the library, which you do not appear to have"
 
3317
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3318
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3319
                    fi
2597
3320
                  fi
2598
3321
                else
2599
3322
                  droppeddeps=yes
2600
 
                  echo
2601
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2602
 
                  echo "***  make it link in!  You will probably need to install it or some"
2603
 
                  echo "*** library that it depends on before this library will be fully"
2604
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3323
                  $echo
 
3324
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3325
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3326
                  $echo "*** library that it depends on before this library will be fully"
 
3327
                  $echo "*** functional.  Installing it before continuing would be even better."
2605
3328
                fi
2606
3329
              else
2607
3330
                newdeplibs="$newdeplibs $i"
2615
3338
          for a_deplib in $deplibs; do
2616
3339
            name="`expr $a_deplib : '-l\(.*\)'`"
2617
3340
            # If $name is empty we are operating on a -L argument.
2618
 
            if test -n "$name" && test "$name" != "0"; then
2619
 
              libname=`eval \\$echo \"$libname_spec\"`
2620
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2621
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2622
 
                    for potent_lib in $potential_libs; do
 
3341
            if test "$name" != "" && test  "$name" != "0"; then
 
3342
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3343
                case " $predeps $postdeps " in
 
3344
                *" $a_deplib "*)
 
3345
                  newdeplibs="$newdeplibs $a_deplib"
 
3346
                  a_deplib=""
 
3347
                  ;;
 
3348
                esac
 
3349
              fi
 
3350
              if test -n "$a_deplib" ; then
 
3351
                libname=`eval \\$echo \"$libname_spec\"`
 
3352
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3353
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3354
                  for potent_lib in $potential_libs; do
2623
3355
                      # Follow soft links.
2624
3356
                      if ls -lLd "$potent_lib" 2>/dev/null \
2625
3357
                         | grep " -> " >/dev/null; then
2640
3372
                      done
2641
3373
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2642
3374
                         | ${SED} 10q \
2643
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3375
                         | $EGREP "$file_magic_regex" > /dev/null; then
2644
3376
                        newdeplibs="$newdeplibs $a_deplib"
2645
3377
                        a_deplib=""
2646
3378
                        break 2
2647
3379
                      fi
2648
 
                    done
2649
 
              done
 
3380
                  done
 
3381
                done
 
3382
              fi
2650
3383
              if test -n "$a_deplib" ; then
2651
3384
                droppeddeps=yes
2652
 
                echo
2653
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2654
 
                echo "*** I have the capability to make that library automatically link in when"
2655
 
                echo "*** you link to this library.  But I can only do this if you have a"
2656
 
                echo "*** shared version of the library, which you do not appear to have"
2657
 
                echo "*** because I did check the linker path looking for a file starting"
 
3385
                $echo
 
3386
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3387
                $echo "*** I have the capability to make that library automatically link in when"
 
3388
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3389
                $echo "*** shared version of the library, which you do not appear to have"
 
3390
                $echo "*** because I did check the linker path looking for a file starting"
2658
3391
                if test -z "$potlib" ; then
2659
 
                  echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3392
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
2660
3393
                else
2661
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2662
 
                  echo "*** using a file magic. Last file checked: $potlib"
 
3394
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3395
                  $echo "*** using a file magic. Last file checked: $potlib"
2663
3396
                fi
2664
3397
              fi
2665
3398
            else
2675
3408
            name="`expr $a_deplib : '-l\(.*\)'`"
2676
3409
            # If $name is empty we are operating on a -L argument.
2677
3410
            if test -n "$name" && test "$name" != "0"; then
2678
 
              libname=`eval \\$echo \"$libname_spec\"`
2679
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2680
 
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2681
 
                for potent_lib in $potential_libs; do
2682
 
                  potlib="$potent_lib" # see symlink-check below in file_magic test
2683
 
                  if eval echo \"$potent_lib\" 2>/dev/null \
2684
 
                      | ${SED} 10q \
2685
 
                      | egrep "$match_pattern_regex" > /dev/null; then
2686
 
                    newdeplibs="$newdeplibs $a_deplib"
2687
 
                    a_deplib=""
2688
 
                    break 2
2689
 
                  fi
 
3411
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3412
                case " $predeps $postdeps " in
 
3413
                *" $a_deplib "*)
 
3414
                  newdeplibs="$newdeplibs $a_deplib"
 
3415
                  a_deplib=""
 
3416
                  ;;
 
3417
                esac
 
3418
              fi
 
3419
              if test -n "$a_deplib" ; then
 
3420
                libname=`eval \\$echo \"$libname_spec\"`
 
3421
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3422
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3423
                  for potent_lib in $potential_libs; do
 
3424
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3425
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3426
                        | ${SED} 10q \
 
3427
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3428
                      newdeplibs="$newdeplibs $a_deplib"
 
3429
                      a_deplib=""
 
3430
                      break 2
 
3431
                    fi
 
3432
                  done
2690
3433
                done
2691
 
              done
 
3434
              fi
2692
3435
              if test -n "$a_deplib" ; then
2693
3436
                droppeddeps=yes
2694
 
                echo
2695
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2696
 
                echo "*** I have the capability to make that library automatically link in when"
2697
 
                echo "*** you link to this library.  But I can only do this if you have a"
2698
 
                echo "*** shared version of the library, which you do not appear to have"
2699
 
                echo "*** because I did check the linker path looking for a file starting"
 
3437
                $echo
 
3438
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3439
                $echo "*** I have the capability to make that library automatically link in when"
 
3440
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3441
                $echo "*** shared version of the library, which you do not appear to have"
 
3442
                $echo "*** because I did check the linker path looking for a file starting"
2700
3443
                if test -z "$potlib" ; then
2701
 
                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3444
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2702
3445
                else
2703
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2704
 
                  echo "*** using a regex pattern. Last file checked: $potlib"
 
3446
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3447
                  $echo "*** using a regex pattern. Last file checked: $potlib"
2705
3448
                fi
2706
3449
              fi
2707
3450
            else
2712
3455
          ;;
2713
3456
        none | unknown | *)
2714
3457
          newdeplibs=""
2715
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2716
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2717
 
             grep . >/dev/null; then
2718
 
            echo
 
3458
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3459
            -e 's/ -[LR][^ ]*//g'`
 
3460
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3461
            for i in $predeps $postdeps ; do
 
3462
              # can't use Xsed below, because $i might contain '/'
 
3463
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3464
            done
 
3465
          fi
 
3466
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3467
            | grep . >/dev/null; then
 
3468
            $echo
2719
3469
            if test "X$deplibs_check_method" = "Xnone"; then
2720
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3470
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2721
3471
            else
2722
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3472
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2723
3473
            fi
2724
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3474
            $echo "*** All declared inter-library dependencies are being dropped."
2725
3475
            droppeddeps=yes
2726
3476
          fi
2727
3477
          ;;
2741
3491
 
2742
3492
        if test "$droppeddeps" = yes; then
2743
3493
          if test "$module" = yes; then
2744
 
            echo
2745
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2746
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2747
 
            echo "*** a static module, that should work as long as the dlopening"
2748
 
            echo "*** application is linked with the -dlopen flag."
 
3494
            $echo
 
3495
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3496
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3497
            $echo "*** a static module, that should work as long as the dlopening"
 
3498
            $echo "*** application is linked with the -dlopen flag."
2749
3499
            if test -z "$global_symbol_pipe"; then
2750
 
              echo
2751
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2752
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2753
 
              echo "*** not find such a program.  So, this module is probably useless."
2754
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3500
              $echo
 
3501
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3502
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3503
              $echo "*** not find such a program.  So, this module is probably useless."
 
3504
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2755
3505
            fi
2756
3506
            if test "$build_old_libs" = no; then
2757
3507
              oldlibs="$output_objdir/$libname.$libext"
2761
3511
              build_libtool_libs=no
2762
3512
            fi
2763
3513
          else
2764
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2765
 
            echo "*** automatically added whenever a program is linked with this library"
2766
 
            echo "*** or is declared to -dlopen it."
 
3514
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3515
            $echo "*** automatically added whenever a program is linked with this library"
 
3516
            $echo "*** or is declared to -dlopen it."
2767
3517
 
2768
 
            if test $allow_undefined = no; then
2769
 
              echo
2770
 
              echo "*** Since this library must not contain undefined symbols,"
2771
 
              echo "*** because either the platform does not support them or"
2772
 
              echo "*** it was explicitly requested with -no-undefined,"
2773
 
              echo "*** libtool will only create a static version of it."
 
3518
            if test "$allow_undefined" = no; then
 
3519
              $echo
 
3520
              $echo "*** Since this library must not contain undefined symbols,"
 
3521
              $echo "*** because either the platform does not support them or"
 
3522
              $echo "*** it was explicitly requested with -no-undefined,"
 
3523
              $echo "*** libtool will only create a static version of it."
2774
3524
              if test "$build_old_libs" = no; then
2775
3525
                oldlibs="$output_objdir/$libname.$libext"
2776
3526
                build_libtool_libs=module
2792
3542
 
2793
3543
      # Test again, we may have decided not to build it any more
2794
3544
      if test "$build_libtool_libs" = yes; then
2795
 
        if test $hardcode_into_libs = yes; then
 
3545
        if test "$hardcode_into_libs" = yes; then
2796
3546
          # Hardcode the library paths
2797
3547
          hardcode_libdirs=
2798
3548
          dep_rpath=
2828
3578
          if test -n "$hardcode_libdir_separator" &&
2829
3579
             test -n "$hardcode_libdirs"; then
2830
3580
            libdir="$hardcode_libdirs"
2831
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3581
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3582
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3583
            else
 
3584
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3585
            fi
2832
3586
          fi
2833
3587
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2834
3588
            # We should set the runpath_var.
2848
3602
        fi
2849
3603
 
2850
3604
        # Get the real and link names of the library.
 
3605
        eval shared_ext=\"$shrext_cmds\"
2851
3606
        eval library_names=\"$library_names_spec\"
2852
3607
        set dummy $library_names
2853
3608
        realname="$2"
2858
3613
        else
2859
3614
          soname="$realname"
2860
3615
        fi
2861
 
        test -z "$dlname" && dlname=$soname
 
3616
        if test -z "$dlname"; then
 
3617
          dlname=$soname
 
3618
        fi
2862
3619
 
2863
3620
        lib="$output_objdir/$realname"
2864
3621
        for link
2866
3623
          linknames="$linknames $link"
2867
3624
        done
2868
3625
 
2869
 
        # Ensure that we have .o objects for linkers which dislike .lo
2870
 
        # (e.g. aix) in case we are running --disable-static
2871
 
        for obj in $libobjs; do
2872
 
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2873
 
          if test "X$xdir" = "X$obj"; then
2874
 
            xdir="."
2875
 
          else
2876
 
            xdir="$xdir"
2877
 
          fi
2878
 
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2879
 
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2880
 
          if test ! -f $xdir/$oldobj; then
2881
 
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2882
 
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2883
 
          fi
2884
 
        done
2885
 
 
2886
3626
        # Use standard objects if they are pic
2887
3627
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2888
3628
 
2892
3632
            $show "generating symbol list for \`$libname.la'"
2893
3633
            export_symbols="$output_objdir/$libname.exp"
2894
3634
            $run $rm $export_symbols
2895
 
            eval cmds=\"$export_symbols_cmds\"
 
3635
            cmds=$export_symbols_cmds
2896
3636
            save_ifs="$IFS"; IFS='~'
2897
3637
            for cmd in $cmds; do
2898
3638
              IFS="$save_ifs"
2899
 
              $show "$cmd"
2900
 
              $run eval "$cmd" || exit $?
 
3639
              eval cmd=\"$cmd\"
 
3640
              if len=`expr "X$cmd" : ".*"` &&
 
3641
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3642
                $show "$cmd"
 
3643
                $run eval "$cmd" || exit $?
 
3644
                skipped_export=false
 
3645
              else
 
3646
                # The command line is too long to execute in one step.
 
3647
                $show "using reloadable object file for export list..."
 
3648
                skipped_export=:
 
3649
              fi
2901
3650
            done
2902
3651
            IFS="$save_ifs"
2903
3652
            if test -n "$export_symbols_regex"; then
2904
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2905
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
3653
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3654
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2906
3655
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2907
3656
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2908
3657
            fi
2913
3662
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2914
3663
        fi
2915
3664
 
 
3665
        tmp_deplibs=
 
3666
        for test_deplib in $deplibs; do
 
3667
                case " $convenience " in
 
3668
                *" $test_deplib "*) ;;
 
3669
                *)
 
3670
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3671
                        ;;
 
3672
                esac
 
3673
        done
 
3674
        deplibs="$tmp_deplibs"
 
3675
 
2916
3676
        if test -n "$convenience"; then
2917
3677
          if test -n "$whole_archive_flag_spec"; then
 
3678
            save_libobjs=$libobjs
2918
3679
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2919
3680
          else
2920
3681
            gentop="$output_objdir/${outputname}x"
2921
3682
            $show "${rm}r $gentop"
2922
3683
            $run ${rm}r "$gentop"
2923
 
            $show "mkdir $gentop"
2924
 
            $run mkdir "$gentop"
 
3684
            $show "$mkdir $gentop"
 
3685
            $run $mkdir "$gentop"
2925
3686
            status=$?
2926
 
            if test $status -ne 0 && test ! -d "$gentop"; then
 
3687
            if test "$status" -ne 0 && test ! -d "$gentop"; then
2927
3688
              exit $status
2928
3689
            fi
2929
3690
            generated="$generated $gentop"
2939
3700
 
2940
3701
              $show "${rm}r $xdir"
2941
3702
              $run ${rm}r "$xdir"
2942
 
              $show "mkdir $xdir"
2943
 
              $run mkdir "$xdir"
 
3703
              $show "$mkdir $xdir"
 
3704
              $run $mkdir "$xdir"
2944
3705
              status=$?
2945
 
              if test $status -ne 0 && test ! -d "$xdir"; then
 
3706
              if test "$status" -ne 0 && test ! -d "$xdir"; then
2946
3707
                exit $status
2947
3708
              fi
 
3709
              # We will extract separately just the conflicting names and we will no
 
3710
              # longer touch any unique names. It is faster to leave these extract
 
3711
              # automatically by $AR in one run.
2948
3712
              $show "(cd $xdir && $AR x $xabs)"
2949
3713
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
3714
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
3715
                :
 
3716
              else
 
3717
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
3718
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
3719
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
3720
                do
 
3721
                  i=1
 
3722
                  while test "$i" -le "$count"
 
3723
                  do
 
3724
                   # Put our $i before any first dot (extension)
 
3725
                   # Never overwrite any file
 
3726
                   name_to="$name"
 
3727
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
3728
                   do
 
3729
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
3730
                   done
 
3731
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
3732
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
3733
                   i=`expr $i + 1`
 
3734
                  done
 
3735
                done
 
3736
              fi
2950
3737
 
2951
 
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
 
3738
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2952
3739
            done
2953
3740
          fi
2954
3741
        fi
2964
3751
        fi
2965
3752
 
2966
3753
        # Do each of the archive commands.
 
3754
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3755
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3756
            eval test_cmds=\"$module_expsym_cmds\"
 
3757
            cmds=$module_expsym_cmds
 
3758
          else
 
3759
            eval test_cmds=\"$module_cmds\"
 
3760
            cmds=$module_cmds
 
3761
          fi
 
3762
        else
2967
3763
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2968
 
          eval cmds=\"$archive_expsym_cmds\"
2969
 
        else
2970
 
          save_deplibs="$deplibs"
2971
 
          for conv in $convenience; do
2972
 
            tmp_deplibs=
2973
 
            for test_deplib in $deplibs; do
2974
 
              if test "$test_deplib" != "$conv"; then
2975
 
                tmp_deplibs="$tmp_deplibs $test_deplib"
 
3764
          eval test_cmds=\"$archive_expsym_cmds\"
 
3765
          cmds=$archive_expsym_cmds
 
3766
        else
 
3767
          eval test_cmds=\"$archive_cmds\"
 
3768
          cmds=$archive_cmds
 
3769
          fi
 
3770
        fi
 
3771
 
 
3772
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
3773
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3774
          :
 
3775
        else
 
3776
          # The command line is too long to link in one step, link piecewise.
 
3777
          $echo "creating reloadable object files..."
 
3778
 
 
3779
          # Save the value of $output and $libobjs because we want to
 
3780
          # use them later.  If we have whole_archive_flag_spec, we
 
3781
          # want to use save_libobjs as it was before
 
3782
          # whole_archive_flag_spec was expanded, because we can't
 
3783
          # assume the linker understands whole_archive_flag_spec.
 
3784
          # This may have to be revisited, in case too many
 
3785
          # convenience libraries get linked in and end up exceeding
 
3786
          # the spec.
 
3787
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
3788
            save_libobjs=$libobjs
 
3789
          fi
 
3790
          save_output=$output
 
3791
 
 
3792
          # Clear the reloadable object creation command queue and
 
3793
          # initialize k to one.
 
3794
          test_cmds=
 
3795
          concat_cmds=
 
3796
          objlist=
 
3797
          delfiles=
 
3798
          last_robj=
 
3799
          k=1
 
3800
          output=$output_objdir/$save_output-${k}.$objext
 
3801
          # Loop over the list of objects to be linked.
 
3802
          for obj in $save_libobjs
 
3803
          do
 
3804
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3805
            if test "X$objlist" = X ||
 
3806
               { len=`expr "X$test_cmds" : ".*"` &&
 
3807
                 test "$len" -le "$max_cmd_len"; }; then
 
3808
              objlist="$objlist $obj"
 
3809
            else
 
3810
              # The command $test_cmds is almost too long, add a
 
3811
              # command to the queue.
 
3812
              if test "$k" -eq 1 ; then
 
3813
                # The first file doesn't have a previous command to add.
 
3814
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3815
              else
 
3816
                # All subsequent reloadable object files will link in
 
3817
                # the last one created.
 
3818
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
2976
3819
              fi
2977
 
            done
2978
 
            deplibs="$tmp_deplibs"
2979
 
          done
2980
 
          eval cmds=\"$archive_cmds\"
2981
 
          deplibs="$save_deplibs"
 
3820
              last_robj=$output_objdir/$save_output-${k}.$objext
 
3821
              k=`expr $k + 1`
 
3822
              output=$output_objdir/$save_output-${k}.$objext
 
3823
              objlist=$obj
 
3824
              len=1
 
3825
            fi
 
3826
          done
 
3827
          # Handle the remaining objects by creating one last
 
3828
          # reloadable object file.  All subsequent reloadable object
 
3829
          # files will link in the last one created.
 
3830
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
3831
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3832
 
 
3833
          if ${skipped_export-false}; then
 
3834
            $show "generating symbol list for \`$libname.la'"
 
3835
            export_symbols="$output_objdir/$libname.exp"
 
3836
            $run $rm $export_symbols
 
3837
            libobjs=$output
 
3838
            # Append the command to create the export file.
 
3839
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3840
          fi
 
3841
 
 
3842
          # Set up a command to remove the reloadale object files
 
3843
          # after they are used.
 
3844
          i=0
 
3845
          while test "$i" -lt "$k"
 
3846
          do
 
3847
            i=`expr $i + 1`
 
3848
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
3849
          done
 
3850
 
 
3851
          $echo "creating a temporary reloadable object file: $output"
 
3852
 
 
3853
          # Loop through the commands generated above and execute them.
 
3854
          save_ifs="$IFS"; IFS='~'
 
3855
          for cmd in $concat_cmds; do
 
3856
            IFS="$save_ifs"
 
3857
            $show "$cmd"
 
3858
            $run eval "$cmd" || exit $?
 
3859
          done
 
3860
          IFS="$save_ifs"
 
3861
 
 
3862
          libobjs=$output
 
3863
          # Restore the value of output.
 
3864
          output=$save_output
 
3865
 
 
3866
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
3867
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
3868
          fi
 
3869
          # Expand the library linking commands again to reset the
 
3870
          # value of $libobjs for piecewise linking.
 
3871
 
 
3872
          # Do each of the archive commands.
 
3873
          if test "$module" = yes && test -n "$module_cmds" ; then
 
3874
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3875
              cmds=$module_expsym_cmds
 
3876
            else
 
3877
              cmds=$module_cmds
 
3878
            fi
 
3879
          else
 
3880
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
3881
            cmds=$archive_expsym_cmds
 
3882
          else
 
3883
            cmds=$archive_cmds
 
3884
            fi
 
3885
          fi
 
3886
 
 
3887
          # Append the command to remove the reloadable object files
 
3888
          # to the just-reset $cmds.
 
3889
          eval cmds=\"\$cmds~\$rm $delfiles\"
2982
3890
        fi
2983
3891
        save_ifs="$IFS"; IFS='~'
2984
3892
        for cmd in $cmds; do
2985
3893
          IFS="$save_ifs"
 
3894
          eval cmd=\"$cmd\"
2986
3895
          $show "$cmd"
2987
3896
          $run eval "$cmd" || exit $?
2988
3897
        done
2991
3900
        # Restore the uninstalled library and exit
2992
3901
        if test "$mode" = relink; then
2993
3902
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2994
 
          exit 0
 
3903
          exit $EXIT_SUCCESS
2995
3904
        fi
2996
3905
 
2997
3906
        # Create links to the real library.
3039
3948
      *.lo)
3040
3949
        if test -n "$objs$old_deplibs"; then
3041
3950
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3042
 
          exit 1
 
3951
          exit $EXIT_FAILURE
3043
3952
        fi
3044
3953
        libobj="$output"
3045
3954
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3070
3979
          gentop="$output_objdir/${obj}x"
3071
3980
          $show "${rm}r $gentop"
3072
3981
          $run ${rm}r "$gentop"
3073
 
          $show "mkdir $gentop"
3074
 
          $run mkdir "$gentop"
 
3982
          $show "$mkdir $gentop"
 
3983
          $run $mkdir "$gentop"
3075
3984
          status=$?
3076
 
          if test $status -ne 0 && test ! -d "$gentop"; then
 
3985
          if test "$status" -ne 0 && test ! -d "$gentop"; then
3077
3986
            exit $status
3078
3987
          fi
3079
3988
          generated="$generated $gentop"
3089
3998
 
3090
3999
            $show "${rm}r $xdir"
3091
4000
            $run ${rm}r "$xdir"
3092
 
            $show "mkdir $xdir"
3093
 
            $run mkdir "$xdir"
 
4001
            $show "$mkdir $xdir"
 
4002
            $run $mkdir "$xdir"
3094
4003
            status=$?
3095
 
            if test $status -ne 0 && test ! -d "$xdir"; then
 
4004
            if test "$status" -ne 0 && test ! -d "$xdir"; then
3096
4005
              exit $status
3097
4006
            fi
 
4007
            # We will extract separately just the conflicting names and we will no
 
4008
            # longer touch any unique names. It is faster to leave these extract
 
4009
            # automatically by $AR in one run.
3098
4010
            $show "(cd $xdir && $AR x $xabs)"
3099
4011
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
4012
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
4013
              :
 
4014
            else
 
4015
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
4016
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
4017
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
4018
              do
 
4019
                i=1
 
4020
                while test "$i" -le "$count"
 
4021
                do
 
4022
                 # Put our $i before any first dot (extension)
 
4023
                 # Never overwrite any file
 
4024
                 name_to="$name"
 
4025
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
4026
                 do
 
4027
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
4028
                 done
 
4029
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
4030
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
4031
                 i=`expr $i + 1`
 
4032
                done
 
4033
              done
 
4034
            fi
3100
4035
 
3101
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
 
4036
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3102
4037
          done
3103
4038
        fi
3104
4039
      fi
3107
4042
      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
3108
4043
 
3109
4044
      output="$obj"
3110
 
      eval cmds=\"$reload_cmds\"
 
4045
      cmds=$reload_cmds
3111
4046
      save_ifs="$IFS"; IFS='~'
3112
4047
      for cmd in $cmds; do
3113
4048
        IFS="$save_ifs"
 
4049
        eval cmd=\"$cmd\"
3114
4050
        $show "$cmd"
3115
4051
        $run eval "$cmd" || exit $?
3116
4052
      done
3123
4059
          $run ${rm}r $gentop
3124
4060
        fi
3125
4061
 
3126
 
        exit 0
 
4062
        exit $EXIT_SUCCESS
3127
4063
      fi
3128
4064
 
3129
4065
      if test "$build_libtool_libs" != yes; then
3134
4070
 
3135
4071
        # Create an invalid libtool object if no PIC, so that we don't
3136
4072
        # accidentally link it into a program.
3137
 
        $show "echo timestamp > $libobj"
3138
 
        $run eval "echo timestamp > $libobj" || exit $?
3139
 
        exit 0
 
4073
        # $show "echo timestamp > $libobj"
 
4074
        # $run eval "echo timestamp > $libobj" || exit $?
 
4075
        exit $EXIT_SUCCESS
3140
4076
      fi
3141
4077
 
3142
4078
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3143
4079
        # Only do commands if we really have different PIC objects.
3144
4080
        reload_objs="$libobjs $reload_conv_objs"
3145
4081
        output="$libobj"
3146
 
        eval cmds=\"$reload_cmds\"
 
4082
        cmds=$reload_cmds
3147
4083
        save_ifs="$IFS"; IFS='~'
3148
4084
        for cmd in $cmds; do
3149
4085
          IFS="$save_ifs"
 
4086
          eval cmd=\"$cmd\"
3150
4087
          $show "$cmd"
3151
4088
          $run eval "$cmd" || exit $?
3152
4089
        done
3153
4090
        IFS="$save_ifs"
3154
 
      else
3155
 
        # Just create a symlink.
3156
 
        $show $rm $libobj
3157
 
        $run $rm $libobj
3158
 
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3159
 
        if test "X$xdir" = "X$libobj"; then
3160
 
          xdir="."
3161
 
        else
3162
 
          xdir="$xdir"
3163
 
        fi
3164
 
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3165
 
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3166
 
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3167
 
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3168
4091
      fi
3169
4092
 
3170
4093
      if test -n "$gentop"; then
3172
4095
        $run ${rm}r $gentop
3173
4096
      fi
3174
4097
 
3175
 
      exit 0
 
4098
      exit $EXIT_SUCCESS
3176
4099
      ;;
3177
4100
 
3178
4101
    prog)
3179
4102
      case $host in
3180
 
        *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
 
4103
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3181
4104
      esac
3182
4105
      if test -n "$vinfo"; then
3183
4106
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3199
4122
        # On Rhapsody replace the C library is the System framework
3200
4123
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3201
4124
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3202
 
        case $host in
3203
 
        *darwin*)
3204
 
          # Don't allow lazy linking, it breaks C++ global constructors
3205
 
          compile_command="$compile_command ${wl}-bind_at_load"
3206
 
          finalize_command="$finalize_command ${wl}-bind_at_load"
3207
 
          ;;
3208
 
        esac
3209
4125
        ;;
3210
4126
      esac
3211
4127
 
 
4128
      case $host in
 
4129
      *darwin*)
 
4130
        # Don't allow lazy linking, it breaks C++ global constructors
 
4131
        if test "$tagname" = CXX ; then
 
4132
        compile_command="$compile_command ${wl}-bind_at_load"
 
4133
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4134
        fi
 
4135
        ;;
 
4136
      esac
 
4137
 
3212
4138
      compile_command="$compile_command $compile_deplibs"
3213
4139
      finalize_command="$finalize_command $finalize_deplibs"
3214
4140
 
3359
4285
            done
3360
4286
 
3361
4287
            if test -n "$exclude_expsyms"; then
3362
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4288
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3363
4289
              $run eval '$mv "$nlist"T "$nlist"'
3364
4290
            fi
3365
4291
 
3366
4292
            if test -n "$export_symbols_regex"; then
3367
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4293
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3368
4294
              $run eval '$mv "$nlist"T "$nlist"'
3369
4295
            fi
3370
4296
 
3382
4308
 
3383
4309
          for arg in $dlprefiles; do
3384
4310
            $show "extracting global C symbols from \`$arg'"
3385
 
            name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3386
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4311
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4312
            $run eval '$echo ": $name " >> "$nlist"'
3387
4313
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3388
4314
          done
3389
4315
 
3392
4318
            test -f "$nlist" || : > "$nlist"
3393
4319
 
3394
4320
            if test -n "$exclude_expsyms"; then
3395
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4321
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3396
4322
              $mv "$nlist"T "$nlist"
3397
4323
            fi
3398
4324
 
3412
4338
            if test -f "$nlist"S; then
3413
4339
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3414
4340
            else
3415
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4341
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3416
4342
            fi
3417
4343
 
3418
4344
            $echo >> "$output_objdir/$dlsyms" "\
3464
4390
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3465
4391
            case "$compile_command " in
3466
4392
            *" -static "*) ;;
3467
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4393
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3468
4394
            esac;;
3469
4395
          *-*-hpux*)
3470
4396
            case "$compile_command " in
3471
4397
            *" -static "*) ;;
3472
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4398
            *) pic_flag_for_symtable=" $pic_flag";;
3473
4399
            esac
3474
4400
          esac
3475
4401
 
3476
4402
          # Now compile the dynamic symbol file.
3477
 
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3478
 
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4403
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4404
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3479
4405
 
3480
4406
          # Clean up the generated files.
3481
4407
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3487
4413
          ;;
3488
4414
        *)
3489
4415
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3490
 
          exit 1
 
4416
          exit $EXIT_FAILURE
3491
4417
          ;;
3492
4418
        esac
3493
4419
      else
3500
4426
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3501
4427
      fi
3502
4428
 
3503
 
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
4429
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3504
4430
        # Replace the output file specification.
3505
4431
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3506
4432
        link_command="$compile_command$compile_rpath"
3575
4501
        # Link the executable and exit
3576
4502
        $show "$link_command"
3577
4503
        $run eval "$link_command" || exit $?
3578
 
        exit 0
 
4504
        exit $EXIT_SUCCESS
3579
4505
      fi
3580
4506
 
3581
4507
      if test "$hardcode_action" = relink; then
3630
4556
      fi
3631
4557
 
3632
4558
      # Quote $echo for shipping.
3633
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3634
 
        case $0 in
3635
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3636
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4559
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4560
        case $progpath in
 
4561
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4562
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
3637
4563
        esac
3638
4564
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3639
4565
      else
3645
4571
        # win32 will think the script is a binary if it has
3646
4572
        # a .exe suffix, so we strip it off here.
3647
4573
        case $output in
3648
 
          *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
 
4574
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3649
4575
        esac
3650
4576
        # test for cygwin because mv fails w/o .exe extensions
3651
4577
        case $host in
3652
 
          *cygwin*) exeext=.exe ;;
 
4578
          *cygwin*)
 
4579
            exeext=.exe
 
4580
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3653
4581
          *) exeext= ;;
3654
4582
        esac
 
4583
        case $host in
 
4584
          *cygwin* | *mingw* )
 
4585
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
 
4586
            cwrapper=`$echo ${output}.exe`
 
4587
            $rm $cwrappersource $cwrapper
 
4588
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4589
 
 
4590
            cat > $cwrappersource <<EOF
 
4591
 
 
4592
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4593
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4594
 
 
4595
   The $output program cannot be directly executed until all the libtool
 
4596
   libraries that it depends on are installed.
 
4597
 
 
4598
   This wrapper executable should never be moved out of the build directory.
 
4599
   If it is, it will not operate correctly.
 
4600
 
 
4601
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4602
   but could eventually absorb all of the scripts functionality and
 
4603
   exec $objdir/$outputname directly.
 
4604
*/
 
4605
EOF
 
4606
            cat >> $cwrappersource<<"EOF"
 
4607
#include <stdio.h>
 
4608
#include <stdlib.h>
 
4609
#include <unistd.h>
 
4610
#include <malloc.h>
 
4611
#include <stdarg.h>
 
4612
#include <assert.h>
 
4613
 
 
4614
#if defined(PATH_MAX)
 
4615
# define LT_PATHMAX PATH_MAX
 
4616
#elif defined(MAXPATHLEN)
 
4617
# define LT_PATHMAX MAXPATHLEN
 
4618
#else
 
4619
# define LT_PATHMAX 1024
 
4620
#endif
 
4621
 
 
4622
#ifndef DIR_SEPARATOR
 
4623
#define DIR_SEPARATOR '/'
 
4624
#endif
 
4625
 
 
4626
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4627
  defined (__OS2__)
 
4628
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4629
#ifndef DIR_SEPARATOR_2
 
4630
#define DIR_SEPARATOR_2 '\\'
 
4631
#endif
 
4632
#endif
 
4633
 
 
4634
#ifndef DIR_SEPARATOR_2
 
4635
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4636
#else /* DIR_SEPARATOR_2 */
 
4637
# define IS_DIR_SEPARATOR(ch) \
 
4638
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4639
#endif /* DIR_SEPARATOR_2 */
 
4640
 
 
4641
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4642
#define XFREE(stale) do { \
 
4643
  if (stale) { free ((void *) stale); stale = 0; } \
 
4644
} while (0)
 
4645
 
 
4646
const char *program_name = NULL;
 
4647
 
 
4648
void * xmalloc (size_t num);
 
4649
char * xstrdup (const char *string);
 
4650
char * basename (const char *name);
 
4651
char * fnqualify(const char *path);
 
4652
char * strendzap(char *str, const char *pat);
 
4653
void lt_fatal (const char *message, ...);
 
4654
 
 
4655
int
 
4656
main (int argc, char *argv[])
 
4657
{
 
4658
  char **newargz;
 
4659
  int i;
 
4660
 
 
4661
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4662
  newargz = XMALLOC(char *, argc+2);
 
4663
EOF
 
4664
 
 
4665
            cat >> $cwrappersource <<EOF
 
4666
  newargz[0] = "$SHELL";
 
4667
EOF
 
4668
 
 
4669
            cat >> $cwrappersource <<"EOF"
 
4670
  newargz[1] = fnqualify(argv[0]);
 
4671
  /* we know the script has the same name, without the .exe */
 
4672
  /* so make sure newargz[1] doesn't end in .exe */
 
4673
  strendzap(newargz[1],".exe");
 
4674
  for (i = 1; i < argc; i++)
 
4675
    newargz[i+1] = xstrdup(argv[i]);
 
4676
  newargz[argc+1] = NULL;
 
4677
EOF
 
4678
 
 
4679
            cat >> $cwrappersource <<EOF
 
4680
  execv("$SHELL",newargz);
 
4681
EOF
 
4682
 
 
4683
            cat >> $cwrappersource <<"EOF"
 
4684
}
 
4685
 
 
4686
void *
 
4687
xmalloc (size_t num)
 
4688
{
 
4689
  void * p = (void *) malloc (num);
 
4690
  if (!p)
 
4691
    lt_fatal ("Memory exhausted");
 
4692
 
 
4693
  return p;
 
4694
}
 
4695
 
 
4696
char *
 
4697
xstrdup (const char *string)
 
4698
{
 
4699
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4700
;
 
4701
}
 
4702
 
 
4703
char *
 
4704
basename (const char *name)
 
4705
{
 
4706
  const char *base;
 
4707
 
 
4708
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4709
  /* Skip over the disk name in MSDOS pathnames. */
 
4710
  if (isalpha (name[0]) && name[1] == ':')
 
4711
    name += 2;
 
4712
#endif
 
4713
 
 
4714
  for (base = name; *name; name++)
 
4715
    if (IS_DIR_SEPARATOR (*name))
 
4716
      base = name + 1;
 
4717
  return (char *) base;
 
4718
}
 
4719
 
 
4720
char *
 
4721
fnqualify(const char *path)
 
4722
{
 
4723
  size_t size;
 
4724
  char *p;
 
4725
  char tmp[LT_PATHMAX + 1];
 
4726
 
 
4727
  assert(path != NULL);
 
4728
 
 
4729
  /* Is it qualified already? */
 
4730
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4731
  if (isalpha (path[0]) && path[1] == ':')
 
4732
    return xstrdup (path);
 
4733
#endif
 
4734
  if (IS_DIR_SEPARATOR (path[0]))
 
4735
    return xstrdup (path);
 
4736
 
 
4737
  /* prepend the current directory */
 
4738
  /* doesn't handle '~' */
 
4739
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4740
    lt_fatal ("getcwd failed");
 
4741
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4742
  p = XMALLOC(char, size);
 
4743
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4744
  return p;
 
4745
}
 
4746
 
 
4747
char *
 
4748
strendzap(char *str, const char *pat)
 
4749
{
 
4750
  size_t len, patlen;
 
4751
 
 
4752
  assert(str != NULL);
 
4753
  assert(pat != NULL);
 
4754
 
 
4755
  len = strlen(str);
 
4756
  patlen = strlen(pat);
 
4757
 
 
4758
  if (patlen <= len)
 
4759
  {
 
4760
    str += len - patlen;
 
4761
    if (strcmp(str, pat) == 0)
 
4762
      *str = '\0';
 
4763
  }
 
4764
  return str;
 
4765
}
 
4766
 
 
4767
static void
 
4768
lt_error_core (int exit_status, const char * mode,
 
4769
          const char * message, va_list ap)
 
4770
{
 
4771
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4772
  vfprintf (stderr, message, ap);
 
4773
  fprintf (stderr, ".\n");
 
4774
 
 
4775
  if (exit_status >= 0)
 
4776
    exit (exit_status);
 
4777
}
 
4778
 
 
4779
void
 
4780
lt_fatal (const char *message, ...)
 
4781
{
 
4782
  va_list ap;
 
4783
  va_start (ap, message);
 
4784
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4785
  va_end (ap);
 
4786
}
 
4787
EOF
 
4788
          # we should really use a build-platform specific compiler
 
4789
          # here, but OTOH, the wrappers (shell script and this C one)
 
4790
          # are only useful if you want to execute the "real" binary.
 
4791
          # Since the "real" binary is built for $host, then this
 
4792
          # wrapper might as well be built for $host, too.
 
4793
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4794
          ;;
 
4795
        esac
3655
4796
        $rm $output
3656
 
        trap "$rm $output; exit 1" 1 2 15
 
4797
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
3657
4798
 
3658
4799
        $echo > $output "\
3659
4800
#! $SHELL
3669
4810
 
3670
4811
# Sed substitution that helps us do robust quoting.  It backslashifies
3671
4812
# metacharacters that are still active within double-quoted strings.
3672
 
Xsed="${SED}"' -e 1s/^X//'
 
4813
Xsed='${SED} -e 1s/^X//'
3673
4814
sed_quote_subst='$sed_quote_subst'
3674
4815
 
3675
4816
# The HP-UX ksh and POSIX shell print the target directory to stdout
3729
4870
"
3730
4871
 
3731
4872
        if test "$fast_install" = yes; then
3732
 
          echo >> $output "\
 
4873
          $echo >> $output "\
3733
4874
  program=lt-'$outputname'$exeext
3734
4875
  progdir=\"\$thisdir/$objdir\"
3735
4876
 
3745
4886
      $rm \"\$progdir/\$file\"
3746
4887
    fi"
3747
4888
 
3748
 
          echo >> $output "\
 
4889
          $echo >> $output "\
3749
4890
 
3750
4891
    # relink executable if necessary
3751
4892
    if test -n \"\$relink_command\"; then
3753
4894
      else
3754
4895
        $echo \"\$relink_command_output\" >&2
3755
4896
        $rm \"\$progdir/\$file\"
3756
 
        exit 1
 
4897
        exit $EXIT_FAILURE
3757
4898
      fi
3758
4899
    fi
3759
4900
 
3763
4904
    $rm \"\$progdir/\$file\"
3764
4905
  fi"
3765
4906
        else
3766
 
          echo >> $output "\
 
4907
          $echo >> $output "\
3767
4908
  program='$outputname'
3768
4909
  progdir=\"\$thisdir/$objdir\"
3769
4910
"
3770
4911
        fi
3771
4912
 
3772
 
        echo >> $output "\
 
4913
        $echo >> $output "\
3773
4914
 
3774
4915
  if test -f \"\$progdir/\$program\"; then"
3775
4916
 
3780
4921
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3781
4922
 
3782
4923
    # Some systems cannot cope with colon-terminated $shlibpath_var
3783
 
    # The second colon is a workaround for a bug in BeOS R4 ${SED}
 
4924
    # The second colon is a workaround for a bug in BeOS R4 sed
3784
4925
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3785
4926
 
3786
4927
    export $shlibpath_var
3800
4941
      # Run the actual program with our arguments.
3801
4942
"
3802
4943
        case $host in
3803
 
        # win32 systems need to use the prog path for dll
3804
 
        # lookup to work
3805
 
        *-*-cygwin* | *-*-pw32*)
3806
 
          $echo >> $output "\
3807
 
      exec \$progdir/\$program \${1+\"\$@\"}
3808
 
"
3809
 
          ;;
3810
 
 
3811
4944
        # Backslashes separate directories on plain windows
3812
4945
        *-*-mingw | *-*-os2*)
3813
4946
          $echo >> $output "\
3817
4950
 
3818
4951
        *)
3819
4952
          $echo >> $output "\
3820
 
      # Export the path to the program.
3821
 
      PATH=\"\$progdir:\$PATH\"
3822
 
      export PATH
3823
 
 
3824
 
      exec \$program \${1+\"\$@\"}
 
4953
      exec \$progdir/\$program \${1+\"\$@\"}
3825
4954
"
3826
4955
          ;;
3827
4956
        esac
3828
4957
        $echo >> $output "\
3829
4958
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3830
 
      exit 1
 
4959
      exit $EXIT_FAILURE
3831
4960
    fi
3832
4961
  else
3833
4962
    # The program doesn't exist.
3834
4963
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3835
4964
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
3836
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
3837
 
    exit 1
 
4965
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
4966
    exit $EXIT_FAILURE
3838
4967
  fi
3839
4968
fi\
3840
4969
"
3841
4970
        chmod +x $output
3842
4971
      fi
3843
 
      exit 0
 
4972
      exit $EXIT_SUCCESS
3844
4973
      ;;
3845
4974
    esac
3846
4975
 
3856
4985
          oldobjs="$libobjs_save"
3857
4986
          build_libtool_libs=no
3858
4987
        else
3859
 
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
4988
          oldobjs="$old_deplibs $non_pic_objects"
3860
4989
        fi
3861
4990
        addlibs="$old_convenience"
3862
4991
      fi
3865
4994
        gentop="$output_objdir/${outputname}x"
3866
4995
        $show "${rm}r $gentop"
3867
4996
        $run ${rm}r "$gentop"
3868
 
        $show "mkdir $gentop"
3869
 
        $run mkdir "$gentop"
 
4997
        $show "$mkdir $gentop"
 
4998
        $run $mkdir "$gentop"
3870
4999
        status=$?
3871
 
        if test $status -ne 0 && test ! -d "$gentop"; then
 
5000
        if test "$status" -ne 0 && test ! -d "$gentop"; then
3872
5001
          exit $status
3873
5002
        fi
3874
5003
        generated="$generated $gentop"
3885
5014
 
3886
5015
          $show "${rm}r $xdir"
3887
5016
          $run ${rm}r "$xdir"
3888
 
          $show "mkdir $xdir"
3889
 
          $run mkdir "$xdir"
 
5017
          $show "$mkdir $xdir"
 
5018
          $run $mkdir "$xdir"
3890
5019
          status=$?
3891
 
          if test $status -ne 0 && test ! -d "$xdir"; then
 
5020
          if test "$status" -ne 0 && test ! -d "$xdir"; then
3892
5021
            exit $status
3893
5022
          fi
 
5023
          # We will extract separately just the conflicting names and we will no
 
5024
          # longer touch any unique names. It is faster to leave these extract
 
5025
          # automatically by $AR in one run.
3894
5026
          $show "(cd $xdir && $AR x $xabs)"
3895
5027
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
5028
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
5029
            :
 
5030
          else
 
5031
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
5032
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
5033
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
5034
            do
 
5035
              i=1
 
5036
              while test "$i" -le "$count"
 
5037
              do
 
5038
               # Put our $i before any first dot (extension)
 
5039
               # Never overwrite any file
 
5040
               name_to="$name"
 
5041
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
5042
               do
 
5043
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
5044
               done
 
5045
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
5046
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
5047
               i=`expr $i + 1`
 
5048
              done
 
5049
            done
 
5050
          fi
3896
5051
 
3897
5052
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3898
5053
        done
3900
5055
 
3901
5056
      # Do each command in the archive commands.
3902
5057
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3903
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5058
       cmds=$old_archive_from_new_cmds
3904
5059
      else
3905
 
        # Ensure that we have .o objects in place in case we decided
3906
 
        # not to build a shared library, and have fallen back to building
3907
 
        # static libs even though --disable-static was passed!
3908
 
        for oldobj in $oldobjs; do
3909
 
          if test ! -f $oldobj; then
3910
 
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3911
 
            if test "X$xdir" = "X$oldobj"; then
3912
 
              xdir="."
3913
 
            else
3914
 
              xdir="$xdir"
3915
 
            fi
3916
 
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3917
 
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3918
 
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3919
 
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3920
 
          fi
3921
 
        done
3922
 
 
3923
5060
        eval cmds=\"$old_archive_cmds\"
 
5061
 
 
5062
        if len=`expr "X$cmds" : ".*"` &&
 
5063
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5064
          cmds=$old_archive_cmds
 
5065
        else
 
5066
          # the command line is too long to link in one step, link in parts
 
5067
          $echo "using piecewise archive linking..."
 
5068
          save_RANLIB=$RANLIB
 
5069
          RANLIB=:
 
5070
          objlist=
 
5071
          concat_cmds=
 
5072
          save_oldobjs=$oldobjs
 
5073
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
 
5074
          # encoded into archives.  This makes 'ar r' malfunction in
 
5075
          # this piecewise linking case whenever conflicting object
 
5076
          # names appear in distinct ar calls; check, warn and compensate.
 
5077
            if (for obj in $save_oldobjs
 
5078
            do
 
5079
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5080
            done | sort | sort -uc >/dev/null 2>&1); then
 
5081
            :
 
5082
          else
 
5083
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
 
5084
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
 
5085
            AR_FLAGS=cq
 
5086
          fi
 
5087
          # Is there a better way of finding the last object in the list?
 
5088
          for obj in $save_oldobjs
 
5089
          do
 
5090
            last_oldobj=$obj
 
5091
          done
 
5092
          for obj in $save_oldobjs
 
5093
          do
 
5094
            oldobjs="$objlist $obj"
 
5095
            objlist="$objlist $obj"
 
5096
            eval test_cmds=\"$old_archive_cmds\"
 
5097
            if len=`expr "X$test_cmds" : ".*"` &&
 
5098
               test "$len" -le "$max_cmd_len"; then
 
5099
              :
 
5100
            else
 
5101
              # the above command should be used before it gets too long
 
5102
              oldobjs=$objlist
 
5103
              if test "$obj" = "$last_oldobj" ; then
 
5104
                RANLIB=$save_RANLIB
 
5105
              fi
 
5106
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5107
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5108
              objlist=
 
5109
            fi
 
5110
          done
 
5111
          RANLIB=$save_RANLIB
 
5112
          oldobjs=$objlist
 
5113
          if test "X$oldobjs" = "X" ; then
 
5114
            eval cmds=\"\$concat_cmds\"
 
5115
          else
 
5116
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5117
          fi
 
5118
        fi
3924
5119
      fi
3925
5120
      save_ifs="$IFS"; IFS='~'
3926
5121
      for cmd in $cmds; do
 
5122
        eval cmd=\"$cmd\"
3927
5123
        IFS="$save_ifs"
3928
5124
        $show "$cmd"
3929
5125
        $run eval "$cmd" || exit $?
3955
5151
        fi
3956
5152
      done
3957
5153
      # Quote the link command for shipping.
3958
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
 
5154
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
3959
5155
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5156
      if test "$hardcode_automatic" = yes ; then
 
5157
        relink_command=
 
5158
      fi
 
5159
 
3960
5160
 
3961
5161
      # Only create the output if not a dry run.
3962
5162
      if test -z "$run"; then
3975
5175
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3976
5176
                if test -z "$libdir"; then
3977
5177
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3978
 
                  exit 1
 
5178
                  exit $EXIT_FAILURE
3979
5179
                fi
3980
5180
                newdependency_libs="$newdependency_libs $libdir/$name"
3981
5181
                ;;
3989
5189
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3990
5190
              if test -z "$libdir"; then
3991
5191
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3992
 
                exit 1
 
5192
                exit $EXIT_FAILURE
3993
5193
              fi
3994
5194
              newdlfiles="$newdlfiles $libdir/$name"
3995
5195
            done
4000
5200
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4001
5201
              if test -z "$libdir"; then
4002
5202
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4003
 
                exit 1
 
5203
                exit $EXIT_FAILURE
4004
5204
              fi
4005
5205
              newdlprefiles="$newdlprefiles $libdir/$name"
4006
5206
            done
4007
5207
            dlprefiles="$newdlprefiles"
 
5208
          else
 
5209
            newdlfiles=
 
5210
            for lib in $dlfiles; do
 
5211
              case $lib in
 
5212
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5213
                *) abs=`pwd`"/$lib" ;;
 
5214
              esac
 
5215
              newdlfiles="$newdlfiles $abs"
 
5216
            done
 
5217
            dlfiles="$newdlfiles"
 
5218
            newdlprefiles=
 
5219
            for lib in $dlprefiles; do
 
5220
              case $lib in
 
5221
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5222
                *) abs=`pwd`"/$lib" ;;
 
5223
              esac
 
5224
              newdlprefiles="$newdlprefiles $abs"
 
5225
            done
 
5226
            dlprefiles="$newdlprefiles"
4008
5227
          fi
4009
5228
          $rm $output
4010
5229
          # place dlname in correct position for cygwin
4011
5230
          tdlname=$dlname
4012
5231
          case $host,$output,$installed,$module,$dlname in
4013
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5232
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4014
5233
          esac
4015
5234
          $echo > $output "\
4016
5235
# $outputname - a libtool library file
4039
5258
# Is this an already installed library?
4040
5259
installed=$installed
4041
5260
 
 
5261
# Should we warn about portability when linking against -modules?
 
5262
shouldnotlink=$module
 
5263
 
4042
5264
# Files to dlopen/dlpreopen
4043
5265
dlopen='$dlfiles'
4044
5266
dlpreopen='$dlprefiles'
4045
5267
 
4046
5268
# Directory that this library needs to be installed in:
4047
5269
libdir='$install_libdir'"
4048
 
          if test "$installed" = no && test $need_relink = yes; then
 
5270
          if test "$installed" = no && test "$need_relink" = yes; then
4049
5271
            $echo >> $output "\
4050
5272
relink_command=\"$relink_command\""
4051
5273
          fi
4058
5280
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4059
5281
      ;;
4060
5282
    esac
4061
 
    exit 0
 
5283
    exit $EXIT_SUCCESS
4062
5284
    ;;
4063
5285
 
4064
5286
  # libtool install mode
4147
5369
    if test -z "$install_prog"; then
4148
5370
      $echo "$modename: you must specify an install program" 1>&2
4149
5371
      $echo "$help" 1>&2
4150
 
      exit 1
 
5372
      exit $EXIT_FAILURE
4151
5373
    fi
4152
5374
 
4153
5375
    if test -n "$prev"; then
4154
5376
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4155
5377
      $echo "$help" 1>&2
4156
 
      exit 1
 
5378
      exit $EXIT_FAILURE
4157
5379
    fi
4158
5380
 
4159
5381
    if test -z "$files"; then
4163
5385
        $echo "$modename: you must specify a destination" 1>&2
4164
5386
      fi
4165
5387
      $echo "$help" 1>&2
4166
 
      exit 1
 
5388
      exit $EXIT_FAILURE
4167
5389
    fi
4168
5390
 
4169
5391
    # Strip any trailing slash from the destination.
4181
5403
 
4182
5404
      # Not a directory, so check to see that there is only one file specified.
4183
5405
      set dummy $files
4184
 
      if test $# -gt 2; then
 
5406
      if test "$#" -gt 2; then
4185
5407
        $echo "$modename: \`$dest' is not a directory" 1>&2
4186
5408
        $echo "$help" 1>&2
4187
 
        exit 1
 
5409
        exit $EXIT_FAILURE
4188
5410
      fi
4189
5411
    fi
4190
5412
    case $destdir in
4196
5418
        *)
4197
5419
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4198
5420
          $echo "$help" 1>&2
4199
 
          exit 1
 
5421
          exit $EXIT_FAILURE
4200
5422
          ;;
4201
5423
        esac
4202
5424
      done
4221
5443
 
4222
5444
      *.la)
4223
5445
        # Check to see that this really is a libtool archive.
4224
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5446
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4225
5447
        else
4226
5448
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4227
5449
          $echo "$help" 1>&2
4228
 
          exit 1
 
5450
          exit $EXIT_FAILURE
4229
5451
        fi
4230
5452
 
4231
5453
        library_names=
4256
5478
        dir="$dir$objdir"
4257
5479
 
4258
5480
        if test -n "$relink_command"; then
4259
 
          # Determine the prefix the user has applied to our future dir.
4260
 
          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
4261
 
 
4262
 
          # Don't allow the user to place us outside of our expected
4263
 
          # location b/c this prevents finding dependent libraries that
4264
 
          # are installed to the same prefix.
4265
 
          if test "$inst_prefix_dir" = "$destdir"; then
4266
 
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4267
 
            exit 1
4268
 
          fi
4269
 
 
4270
 
          if test -n "$inst_prefix_dir"; then
4271
 
            # Stick the inst_prefix_dir data into the link command.
4272
 
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4273
 
          else
4274
 
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
4275
 
          fi
 
5481
          # Determine the prefix the user has applied to our future dir.
 
5482
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
 
5483
 
 
5484
          # Don't allow the user to place us outside of our expected
 
5485
          # location b/c this prevents finding dependent libraries that
 
5486
          # are installed to the same prefix.
 
5487
          # At present, this check doesn't affect windows .dll's that
 
5488
          # are installed into $libdir/../bin (currently, that works fine)
 
5489
          # but it's something to keep an eye on.
 
5490
          if test "$inst_prefix_dir" = "$destdir"; then
 
5491
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
 
5492
            exit $EXIT_FAILURE
 
5493
          fi
 
5494
 
 
5495
          if test -n "$inst_prefix_dir"; then
 
5496
            # Stick the inst_prefix_dir data into the link command.
 
5497
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5498
          else
 
5499
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
5500
          fi
4276
5501
 
4277
5502
          $echo "$modename: warning: relinking \`$file'" 1>&2
4278
5503
          $show "$relink_command"
4279
5504
          if $run eval "$relink_command"; then :
4280
5505
          else
4281
5506
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4282
 
            exit 1
 
5507
            exit $EXIT_FAILURE
4283
5508
          fi
4284
5509
        fi
4285
5510
 
4301
5526
            $run eval "$striplib $destdir/$realname" || exit $?
4302
5527
          fi
4303
5528
 
4304
 
          if test $# -gt 0; then
 
5529
          if test "$#" -gt 0; then
4305
5530
            # Delete the old symlinks, and create new ones.
4306
5531
            for linkname
4307
5532
            do
4314
5539
 
4315
5540
          # Do each command in the postinstall commands.
4316
5541
          lib="$destdir/$realname"
4317
 
          eval cmds=\"$postinstall_cmds\"
 
5542
          cmds=$postinstall_cmds
4318
5543
          save_ifs="$IFS"; IFS='~'
4319
5544
          for cmd in $cmds; do
4320
5545
            IFS="$save_ifs"
 
5546
            eval cmd=\"$cmd\"
4321
5547
            $show "$cmd"
4322
5548
            $run eval "$cmd" || exit $?
4323
5549
          done
4357
5583
        *)
4358
5584
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4359
5585
          $echo "$help" 1>&2
4360
 
          exit 1
 
5586
          exit $EXIT_FAILURE
4361
5587
          ;;
4362
5588
        esac
4363
5589
 
4375
5601
          $show "$install_prog $staticobj $staticdest"
4376
5602
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4377
5603
        fi
4378
 
        exit 0
 
5604
        exit $EXIT_SUCCESS
4379
5605
        ;;
4380
5606
 
4381
5607
      *)
4387
5613
          destfile="$destdir/$destfile"
4388
5614
        fi
4389
5615
 
 
5616
        # If the file is missing, and there is a .exe on the end, strip it
 
5617
        # because it is most likely a libtool script we actually want to
 
5618
        # install
 
5619
        stripped_ext=""
 
5620
        case $file in
 
5621
          *.exe)
 
5622
            if test ! -f "$file"; then
 
5623
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5624
              stripped_ext=".exe"
 
5625
            fi
 
5626
            ;;
 
5627
        esac
 
5628
 
4390
5629
        # Do a test to see if this is really a libtool program.
4391
5630
        case $host in
4392
5631
        *cygwin*|*mingw*)
4393
 
            wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
 
5632
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
4394
5633
            ;;
4395
5634
        *)
4396
5635
            wrapper=$file
4397
5636
            ;;
4398
5637
        esac
4399
 
        if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
5638
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4400
5639
          notinst_deplibs=
4401
5640
          relink_command=
4402
5641
 
 
5642
          # To insure that "foo" is sourced, and not "foo.exe",
 
5643
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5644
          # which disallows the automatic-append-.exe behavior.
 
5645
          case $build in
 
5646
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5647
          *) wrapperdot=${wrapper} ;;
 
5648
          esac
4403
5649
          # If there is no directory component, then add one.
4404
5650
          case $file in
4405
 
          */* | *\\*) . $wrapper ;;
4406
 
          *) . ./$wrapper ;;
 
5651
          */* | *\\*) . ${wrapperdot} ;;
 
5652
          *) . ./${wrapperdot} ;;
4407
5653
          esac
4408
5654
 
4409
5655
          # Check the variables that should have been set.
4410
5656
          if test -z "$notinst_deplibs"; then
4411
5657
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4412
 
            exit 1
 
5658
            exit $EXIT_FAILURE
4413
5659
          fi
4414
5660
 
4415
5661
          finalize=yes
4431
5677
          done
4432
5678
 
4433
5679
          relink_command=
 
5680
          # To insure that "foo" is sourced, and not "foo.exe",
 
5681
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5682
          # which disallows the automatic-append-.exe behavior.
 
5683
          case $build in
 
5684
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5685
          *) wrapperdot=${wrapper} ;;
 
5686
          esac
4434
5687
          # If there is no directory component, then add one.
4435
5688
          case $file in
4436
 
          */* | *\\*) . $wrapper ;;
4437
 
          *) . ./$wrapper ;;
 
5689
          */* | *\\*) . ${wrapperdot} ;;
 
5690
          *) . ./${wrapperdot} ;;
4438
5691
          esac
4439
5692
 
4440
5693
          outputname=
4443
5696
              tmpdir="/tmp"
4444
5697
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4445
5698
              tmpdir="$tmpdir/libtool-$$"
4446
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5699
              save_umask=`umask`
 
5700
              umask 0077
 
5701
              if $mkdir "$tmpdir"; then
 
5702
                umask $save_umask
4447
5703
              else
 
5704
                umask $save_umask
4448
5705
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4449
5706
                continue
4450
5707
              fi
4451
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
5708
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4452
5709
              outputname="$tmpdir/$file"
4453
5710
              # Replace the output file specification.
4454
5711
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4466
5723
            fi
4467
5724
          else
4468
5725
            # Install the binary that we compiled earlier.
4469
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5726
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4470
5727
          fi
4471
5728
        fi
4472
5729
 
4473
5730
        # remove .exe since cygwin /usr/bin/install will append another
4474
5731
        # one anyways
4475
5732
        case $install_prog,$host in
4476
 
        /usr/bin/install*,*cygwin*)
 
5733
        */usr/bin/install*,*cygwin*)
4477
5734
          case $file:$destfile in
4478
5735
          *.exe:*.exe)
4479
5736
            # this is ok
4482
5739
            destfile=$destfile.exe
4483
5740
            ;;
4484
5741
          *:*.exe)
4485
 
            destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
 
5742
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4486
5743
            ;;
4487
5744
          esac
4488
5745
          ;;
4503
5760
      $show "$install_prog $file $oldlib"
4504
5761
      $run eval "$install_prog \$file \$oldlib" || exit $?
4505
5762
 
4506
 
      if test -n "$stripme" && test -n "$striplib"; then
 
5763
      if test -n "$stripme" && test -n "$old_striplib"; then
4507
5764
        $show "$old_striplib $oldlib"
4508
5765
        $run eval "$old_striplib $oldlib" || exit $?
4509
5766
      fi
4510
5767
 
4511
5768
      # Do each command in the postinstall commands.
4512
 
      eval cmds=\"$old_postinstall_cmds\"
 
5769
      cmds=$old_postinstall_cmds
4513
5770
      save_ifs="$IFS"; IFS='~'
4514
5771
      for cmd in $cmds; do
4515
5772
        IFS="$save_ifs"
 
5773
        eval cmd=\"$cmd\"
4516
5774
        $show "$cmd"
4517
5775
        $run eval "$cmd" || exit $?
4518
5776
      done
4526
5784
    if test -n "$current_libdirs"; then
4527
5785
      # Maybe just do a dry run.
4528
5786
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4529
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
5787
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
4530
5788
    else
4531
 
      exit 0
 
5789
      exit $EXIT_SUCCESS
4532
5790
    fi
4533
5791
    ;;
4534
5792
 
4547
5805
      for libdir in $libdirs; do
4548
5806
        if test -n "$finish_cmds"; then
4549
5807
          # Do each command in the finish commands.
4550
 
          eval cmds=\"$finish_cmds\"
 
5808
          cmds=$finish_cmds
4551
5809
          save_ifs="$IFS"; IFS='~'
4552
5810
          for cmd in $cmds; do
4553
5811
            IFS="$save_ifs"
 
5812
            eval cmd=\"$cmd\"
4554
5813
            $show "$cmd"
4555
5814
            $run eval "$cmd" || admincmds="$admincmds
4556
5815
       $cmd"
4567
5826
    fi
4568
5827
 
4569
5828
    # Exit here if they wanted silent mode.
4570
 
    test "$show" = ":" && exit 0
 
5829
    test "$show" = : && exit $EXIT_SUCCESS
4571
5830
 
4572
 
    echo "----------------------------------------------------------------------"
4573
 
    echo "Libraries have been installed in:"
 
5831
    $echo "----------------------------------------------------------------------"
 
5832
    $echo "Libraries have been installed in:"
4574
5833
    for libdir in $libdirs; do
4575
 
      echo "   $libdir"
 
5834
      $echo "   $libdir"
4576
5835
    done
4577
 
    echo
4578
 
    echo "If you ever happen to want to link against installed libraries"
4579
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4580
 
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4581
 
    echo "flag during linking and do at least one of the following:"
 
5836
    $echo
 
5837
    $echo "If you ever happen to want to link against installed libraries"
 
5838
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5839
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5840
    $echo "flag during linking and do at least one of the following:"
4582
5841
    if test -n "$shlibpath_var"; then
4583
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4584
 
      echo "     during execution"
 
5842
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5843
      $echo "     during execution"
4585
5844
    fi
4586
5845
    if test -n "$runpath_var"; then
4587
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4588
 
      echo "     during linking"
 
5846
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5847
      $echo "     during linking"
4589
5848
    fi
4590
5849
    if test -n "$hardcode_libdir_flag_spec"; then
4591
5850
      libdir=LIBDIR
4592
5851
      eval flag=\"$hardcode_libdir_flag_spec\"
4593
5852
 
4594
 
      echo "   - use the \`$flag' linker flag"
 
5853
      $echo "   - use the \`$flag' linker flag"
4595
5854
    fi
4596
5855
    if test -n "$admincmds"; then
4597
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5856
      $echo "   - have your system administrator run these commands:$admincmds"
4598
5857
    fi
4599
5858
    if test -f /etc/ld.so.conf; then
4600
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5859
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4601
5860
    fi
4602
 
    echo
4603
 
    echo "See any operating system documentation about shared libraries for"
4604
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4605
 
    echo "----------------------------------------------------------------------"
4606
 
    exit 0
 
5861
    $echo
 
5862
    $echo "See any operating system documentation about shared libraries for"
 
5863
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5864
    $echo "----------------------------------------------------------------------"
 
5865
    exit $EXIT_SUCCESS
4607
5866
    ;;
4608
5867
 
4609
5868
  # libtool execute mode
4615
5874
    if test -z "$cmd"; then
4616
5875
      $echo "$modename: you must specify a COMMAND" 1>&2
4617
5876
      $echo "$help"
4618
 
      exit 1
 
5877
      exit $EXIT_FAILURE
4619
5878
    fi
4620
5879
 
4621
5880
    # Handle -dlopen flags immediately.
4623
5882
      if test ! -f "$file"; then
4624
5883
        $echo "$modename: \`$file' is not a file" 1>&2
4625
5884
        $echo "$help" 1>&2
4626
 
        exit 1
 
5885
        exit $EXIT_FAILURE
4627
5886
      fi
4628
5887
 
4629
5888
      dir=
4630
5889
      case $file in
4631
5890
      *.la)
4632
5891
        # Check to see that this really is a libtool archive.
4633
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5892
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4634
5893
        else
4635
5894
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4636
5895
          $echo "$help" 1>&2
4637
 
          exit 1
 
5896
          exit $EXIT_FAILURE
4638
5897
        fi
4639
5898
 
4640
5899
        # Read the libtool library.
4661
5920
          dir="$dir/$objdir"
4662
5921
        else
4663
5922
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4664
 
          exit 1
 
5923
          exit $EXIT_FAILURE
4665
5924
        fi
4666
5925
        ;;
4667
5926
 
4701
5960
      -*) ;;
4702
5961
      *)
4703
5962
        # Do a test to see if this is really a libtool program.
4704
 
        if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5963
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4705
5964
          # If there is no directory component, then add one.
4706
5965
          case $file in
4707
5966
          */* | *\\*) . $file ;;
4724
5983
        eval "export $shlibpath_var"
4725
5984
      fi
4726
5985
 
4727
 
      # Restore saved enviroment variables
 
5986
      # Restore saved environment variables
4728
5987
      if test "${save_LC_ALL+set}" = set; then
4729
5988
        LC_ALL="$save_LC_ALL"; export LC_ALL
4730
5989
      fi
4741
6000
        $echo "export $shlibpath_var"
4742
6001
      fi
4743
6002
      $echo "$cmd$args"
4744
 
      exit 0
 
6003
      exit $EXIT_SUCCESS
4745
6004
    fi
4746
6005
    ;;
4747
6006
 
4769
6028
    if test -z "$rm"; then
4770
6029
      $echo "$modename: you must specify an RM program" 1>&2
4771
6030
      $echo "$help" 1>&2
4772
 
      exit 1
 
6031
      exit $EXIT_FAILURE
4773
6032
    fi
4774
6033
 
4775
6034
    rmdirs=
4776
6035
 
 
6036
    origobjdir="$objdir"
4777
6037
    for file in $files; do
4778
6038
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4779
6039
      if test "X$dir" = "X$file"; then
4780
6040
        dir=.
4781
 
        objdir="$objdir"
 
6041
        objdir="$origobjdir"
4782
6042
      else
4783
 
        objdir="$dir/$objdir"
 
6043
        objdir="$dir/$origobjdir"
4784
6044
      fi
4785
6045
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4786
 
      test $mode = uninstall && objdir="$dir"
 
6046
      test "$mode" = uninstall && objdir="$dir"
4787
6047
 
4788
6048
      # Remember objdir for removal later, being careful to avoid duplicates
4789
 
      if test $mode = clean; then
 
6049
      if test "$mode" = clean; then
4790
6050
        case " $rmdirs " in
4791
6051
          *" $objdir "*) ;;
4792
6052
          *) rmdirs="$rmdirs $objdir" ;;
4810
6070
      case $name in
4811
6071
      *.la)
4812
6072
        # Possibly a libtool archive, so verify it.
4813
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6073
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4814
6074
          . $dir/$name
4815
6075
 
4816
6076
          # Delete the libtool libraries and symlinks.
4818
6078
            rmfiles="$rmfiles $objdir/$n"
4819
6079
          done
4820
6080
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4821
 
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6081
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4822
6082
 
4823
 
          if test $mode = uninstall; then
 
6083
          if test "$mode" = uninstall; then
4824
6084
            if test -n "$library_names"; then
4825
6085
              # Do each command in the postuninstall commands.
4826
 
              eval cmds=\"$postuninstall_cmds\"
 
6086
              cmds=$postuninstall_cmds
4827
6087
              save_ifs="$IFS"; IFS='~'
4828
6088
              for cmd in $cmds; do
4829
6089
                IFS="$save_ifs"
 
6090
                eval cmd=\"$cmd\"
4830
6091
                $show "$cmd"
4831
6092
                $run eval "$cmd"
4832
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6093
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4833
6094
                  exit_status=1
4834
6095
                fi
4835
6096
              done
4838
6099
 
4839
6100
            if test -n "$old_library"; then
4840
6101
              # Do each command in the old_postuninstall commands.
4841
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6102
              cmds=$old_postuninstall_cmds
4842
6103
              save_ifs="$IFS"; IFS='~'
4843
6104
              for cmd in $cmds; do
4844
6105
                IFS="$save_ifs"
 
6106
                eval cmd=\"$cmd\"
4845
6107
                $show "$cmd"
4846
6108
                $run eval "$cmd"
4847
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6109
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4848
6110
                  exit_status=1
4849
6111
                fi
4850
6112
              done
4856
6118
        ;;
4857
6119
 
4858
6120
      *.lo)
4859
 
        if test "$build_old_libs" = yes; then
4860
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4861
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6121
        # Possibly a libtool object, so verify it.
 
6122
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6123
 
 
6124
          # Read the .lo file
 
6125
          . $dir/$name
 
6126
 
 
6127
          # Add PIC object to the list of files to remove.
 
6128
          if test -n "$pic_object" \
 
6129
             && test "$pic_object" != none; then
 
6130
            rmfiles="$rmfiles $dir/$pic_object"
 
6131
          fi
 
6132
 
 
6133
          # Add non-PIC object to the list of files to remove.
 
6134
          if test -n "$non_pic_object" \
 
6135
             && test "$non_pic_object" != none; then
 
6136
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6137
          fi
4862
6138
        fi
4863
6139
        ;;
4864
6140
 
4865
6141
      *)
4866
 
        # Do a test to see if this is a libtool program.
4867
 
        if test $mode = clean &&
4868
 
           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4869
 
          relink_command=
4870
 
          . $dir/$file
 
6142
        if test "$mode" = clean ; then
 
6143
          noexename=$name
 
6144
          case $file in
 
6145
          *.exe)
 
6146
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6147
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6148
            # $file with .exe has already been added to rmfiles,
 
6149
            # add $file without .exe
 
6150
            rmfiles="$rmfiles $file"
 
6151
            ;;
 
6152
          esac
 
6153
          # Do a test to see if this is a libtool program.
 
6154
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6155
            relink_command=
 
6156
            . $dir/$noexename
4871
6157
 
4872
 
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4873
 
          if test "$fast_install" = yes && test -n "$relink_command"; then
4874
 
            rmfiles="$rmfiles $objdir/lt-$name"
 
6158
            # note $name still contains .exe if it was in $file originally
 
6159
            # as does the version of $file that was added into $rmfiles
 
6160
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6161
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6162
              rmfiles="$rmfiles $objdir/lt-$name"
 
6163
            fi
 
6164
            if test "X$noexename" != "X$name" ; then
 
6165
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6166
            fi
4875
6167
          fi
4876
6168
        fi
4877
6169
        ;;
4879
6171
      $show "$rm $rmfiles"
4880
6172
      $run $rm $rmfiles || exit_status=1
4881
6173
    done
 
6174
    objdir="$origobjdir"
4882
6175
 
4883
6176
    # Try to remove the ${objdir}s in the directories where we deleted files
4884
6177
    for dir in $rmdirs; do
4894
6187
  "")
4895
6188
    $echo "$modename: you must specify a MODE" 1>&2
4896
6189
    $echo "$generic_help" 1>&2
4897
 
    exit 1
 
6190
    exit $EXIT_FAILURE
4898
6191
    ;;
4899
6192
  esac
4900
6193
 
4901
6194
  if test -z "$exec_cmd"; then
4902
6195
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
4903
6196
    $echo "$generic_help" 1>&2
4904
 
    exit 1
 
6197
    exit $EXIT_FAILURE
4905
6198
  fi
4906
6199
fi # test -z "$show_help"
4907
6200
 
4908
6201
if test -n "$exec_cmd"; then
4909
6202
  eval exec $exec_cmd
4910
 
  exit 1
 
6203
  exit $EXIT_FAILURE
4911
6204
fi
4912
6205
 
4913
6206
# We need to display help for each of the modes.
4926
6219
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4927
6220
    --quiet           same as \`--silent'
4928
6221
    --silent          don't print informational messages
 
6222
    --tag=TAG         use configuration variables from tag TAG
4929
6223
    --version         print version information
4930
6224
 
4931
6225
MODE must be one of the following:
4939
6233
      uninstall       remove libraries from an installed directory
4940
6234
 
4941
6235
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4942
 
a more detailed description of MODE."
4943
 
  exit 0
 
6236
a more detailed description of MODE.
 
6237
 
 
6238
Report bugs to <bug-libtool@gnu.org>."
 
6239
  exit $EXIT_SUCCESS
4944
6240
  ;;
4945
6241
 
4946
6242
clean)
5051
6347
  -no-install       link a not-installable executable
5052
6348
  -no-undefined     declare that a library does not refer to external symbols
5053
6349
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6350
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6351
  -precious-files-regex REGEX
 
6352
                    don't remove output files matching REGEX
5054
6353
  -release RELEASE  specify package release information
5055
6354
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5056
6355
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5092
6391
*)
5093
6392
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5094
6393
  $echo "$help" 1>&2
5095
 
  exit 1
 
6394
  exit $EXIT_FAILURE
5096
6395
  ;;
5097
6396
esac
5098
6397
 
5099
 
echo
 
6398
$echo
5100
6399
$echo "Try \`$modename --help' for more information about other modes."
5101
6400
 
5102
 
exit 0
 
6401
exit $EXIT_SUCCESS
 
6402
 
 
6403
# The TAGs below are defined such that we never get into a situation
 
6404
# in which we disable both kinds of libraries.  Given conflicting
 
6405
# choices, we go for a static library, that is the most portable,
 
6406
# since we can't tell whether shared libraries were disabled because
 
6407
# the user asked for that or because the platform doesn't support
 
6408
# them.  This is particularly important on AIX, because we don't
 
6409
# support having both static and shared libraries enabled at the same
 
6410
# time on that platform, so we default to a shared-only configuration.
 
6411
# If a disable-shared tag is given, we'll fallback to a static-only
 
6412
# configuration.  But we'll never go from static-only to shared-only.
 
6413
 
 
6414
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6415
build_libtool_libs=no
 
6416
build_old_libs=yes
 
6417
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6418
 
 
6419
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6420
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6421
# ### END LIBTOOL TAG CONFIG: disable-static
5103
6422
 
5104
6423
# Local Variables:
5105
6424
# mode:shell-script