~ubuntu-branches/ubuntu/precise/stunnel4/precise-security

« back to all changes in this revision

Viewing changes to auto/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lemoine
  • Date: 2005-04-20 21:07:50 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050420210750-0vk5fj5vh75o4d00
Tags: 2:4.090-1
* New upstream release
* include better stunnel3 compability script from upstream, options 
  like -cd can now be use instead of -c -d ...
  (closes: #305259)
* Added depends on perl-modules to allow use of stunnel3 compatibilty script

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: 215 $"
 
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.2a
59
 
TIMESTAMP=" (1.922.2.79 2001/11/28 21:50:31)"
60
 
 
61
74
default_mode=
62
75
help="Try \`$progname --help' for more information."
63
76
magic="%%%MAGIC variable%%%"
67
80
 
68
81
# Sed substitution that helps us do robust quoting.  It backslashifies
69
82
# metacharacters that are still active within double-quoted strings.
70
 
Xsed='sed -e 1s/^X//'
 
83
Xsed="${SED}"' -e 1s/^X//'
71
84
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
SP2NL='tr \040 \012'
73
 
NL2SP='tr \015\012 \040\040'
 
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
74
96
 
75
97
# NLS nuisances.
76
98
# Only set LANG and LC_ALL to C if already set.
85
107
fi
86
108
 
87
109
# Make sure IFS has a sensible default
88
 
: ${IFS="       "}
 
110
: ${IFS="       
 
111
"}
89
112
 
90
113
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91
 
  echo "$modename: not configured to build any kind of library" 1>&2
92
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
93
 
  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
94
117
fi
95
118
 
96
119
# Global variables.
105
128
lo2o="s/\\.lo\$/.${objext}/"
106
129
o2lo="s/\\.${objext}\$/.lo/"
107
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
 
108
244
# Parse our command line options once, thoroughly.
109
 
while test $# -gt 0
 
245
while test "$#" -gt 0
110
246
do
111
247
  arg="$1"
112
248
  shift
122
258
    execute_dlfiles)
123
259
      execute_dlfiles="$execute_dlfiles $arg"
124
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
      ;;
125
289
    *)
126
290
      eval "$prev=\$arg"
127
291
      ;;
139
303
    ;;
140
304
 
141
305
  --version)
142
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
143
 
    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
144
312
    ;;
145
313
 
146
314
  --config)
147
 
    sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
148
 
    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
149
321
    ;;
150
322
 
151
323
  --debug)
152
 
    echo "$progname: enabling shell trace mode"
 
324
    $echo "$progname: enabling shell trace mode"
153
325
    set -x
 
326
    preserve_args="$preserve_args $arg"
154
327
    ;;
155
328
 
156
329
  --dry-run | -n)
158
331
    ;;
159
332
 
160
333
  --features)
161
 
    echo "host: $host"
 
334
    $echo "host: $host"
162
335
    if test "$build_libtool_libs" = yes; then
163
 
      echo "enable shared libraries"
 
336
      $echo "enable shared libraries"
164
337
    else
165
 
      echo "disable shared libraries"
 
338
      $echo "disable shared libraries"
166
339
    fi
167
340
    if test "$build_old_libs" = yes; then
168
 
      echo "enable static libraries"
 
341
      $echo "enable static libraries"
169
342
    else
170
 
      echo "disable static libraries"
 
343
      $echo "disable static libraries"
171
344
    fi
172
 
    exit 0
 
345
    exit $EXIT_SUCCESS
173
346
    ;;
174
347
 
175
348
  --finish) mode="finish" ;;
181
354
 
182
355
  --quiet | --silent)
183
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"
184
366
    ;;
185
367
 
186
368
  -dlopen)
191
373
  -*)
192
374
    $echo "$modename: unrecognized option \`$arg'" 1>&2
193
375
    $echo "$help" 1>&2
194
 
    exit 1
 
376
    exit $EXIT_FAILURE
195
377
    ;;
196
378
 
197
379
  *)
204
386
if test -n "$prevopt"; then
205
387
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
206
388
  $echo "$help" 1>&2
207
 
  exit 1
 
389
  exit $EXIT_FAILURE
208
390
fi
209
391
 
210
392
# If this variable is set in any of the actions, the command in it
216
398
 
217
399
  # Infer the operation mode.
218
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
219
403
    case $nonopt in
220
 
    *cc | *++ | gcc* | *-gcc*)
 
404
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
221
405
      mode=link
222
406
      for arg
223
407
      do
258
442
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
259
443
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
260
444
    $echo "$help" 1>&2
261
 
    exit 1
 
445
    exit $EXIT_FAILURE
262
446
  fi
263
447
 
264
448
  # Change the help message to a mode-specific one.
272
456
    modename="$modename: compile"
273
457
    # Get the compilation command and the source file.
274
458
    base_compile=
275
 
    prev=
276
 
    lastarg=
277
 
    srcfile="$nonopt"
 
459
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
460
    suppress_opt=yes
278
461
    suppress_output=
 
462
    arg_mode=normal
 
463
    libobj=
 
464
    later=
279
465
 
280
 
    user_target=no
281
466
    for arg
282
467
    do
283
 
      case $prev in
284
 
      "") ;;
285
 
      xcompiler)
286
 
        # Aesthetically quote the previous argument.
287
 
        prev=
288
 
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
289
 
 
290
 
        case $arg in
291
 
        # Double-quote args containing other shell metacharacters.
292
 
        # Many Bourne shells cannot handle close brackets correctly
293
 
        # in scan sets, so we specify it separately.
294
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
295
 
          arg="\"$arg\""
296
 
          ;;
297
 
        esac
298
 
 
299
 
        # Add the previous argument to base_compile.
300
 
        if test -z "$base_compile"; then
301
 
          base_compile="$lastarg"
302
 
        else
303
 
          base_compile="$base_compile $lastarg"
304
 
        fi
305
 
        continue
306
 
        ;;
307
 
      esac
308
 
 
309
 
      # Accept any command-line options.
310
 
      case $arg in
311
 
      -o)
312
 
        if test "$user_target" != "no"; then
313
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
314
 
          exit 1
315
 
        fi
316
 
        user_target=next
317
 
        ;;
318
 
 
319
 
      -static)
320
 
        build_old_libs=yes
321
 
        continue
322
 
        ;;
323
 
 
324
 
      -prefer-pic)
325
 
        pic_mode=yes
326
 
        continue
327
 
        ;;
328
 
 
329
 
      -prefer-non-pic)
330
 
        pic_mode=no
331
 
        continue
332
 
        ;;
333
 
 
334
 
      -Xcompiler)
335
 
        prev=xcompiler
336
 
        continue
337
 
        ;;
338
 
 
339
 
      -Wc,*)
340
 
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
341
 
        lastarg=
342
 
        save_ifs="$IFS"; IFS=','
343
 
        for arg in $args; do
344
 
          IFS="$save_ifs"
345
 
 
346
 
          # Double-quote args containing other shell metacharacters.
347
 
          # Many Bourne shells cannot handle close brackets correctly
348
 
          # in scan sets, so we specify it separately.
349
 
          case $arg in
350
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
351
 
            arg="\"$arg\""
352
 
            ;;
353
 
          esac
354
 
          lastarg="$lastarg $arg"
355
 
        done
356
 
        IFS="$save_ifs"
357
 
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
358
 
 
359
 
        # Add the arguments to base_compile.
360
 
        if test -z "$base_compile"; then
361
 
          base_compile="$lastarg"
362
 
        else
363
 
          base_compile="$base_compile $lastarg"
364
 
        fi
365
 
        continue
366
 
        ;;
367
 
      esac
368
 
 
369
 
      case $user_target in
370
 
      next)
371
 
        # The next one is the -o target name
372
 
        user_target=yes
373
 
        continue
374
 
        ;;
375
 
      yes)
376
 
        # We got the output file
377
 
        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 )
378
476
        libobj="$arg"
 
477
        arg_mode=normal
379
478
        continue
380
479
        ;;
381
 
      esac
382
 
 
383
 
      # Accept the current argument as the source file.
384
 
      lastarg="$srcfile"
385
 
      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
386
543
 
387
544
      # Aesthetically quote the previous argument.
388
 
 
389
 
      # Backslashify any backslashes, double quotes, and dollar signs.
390
 
      # These are the only characters that are still specially
391
 
      # interpreted inside of double-quoted scrings.
392
545
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
393
546
 
 
547
      case $lastarg in
394
548
      # Double-quote args containing other shell metacharacters.
395
549
      # Many Bourne shells cannot handle close brackets correctly
396
550
      # in scan sets, so we specify it separately.
397
 
      case $lastarg in
398
551
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
399
552
        lastarg="\"$lastarg\""
400
553
        ;;
401
554
      esac
402
555
 
403
 
      # Add the previous argument to base_compile.
404
 
      if test -z "$base_compile"; then
405
 
        base_compile="$lastarg"
406
 
      else
407
 
        base_compile="$base_compile $lastarg"
408
 
      fi
409
 
    done
 
556
      base_compile="$base_compile $lastarg"
 
557
    done # for arg
410
558
 
411
 
    case $user_target in
412
 
    set)
413
 
      ;;
414
 
    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
    *)
415
569
      # Get the name of the library object.
416
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
417
 
      ;;
418
 
    *)
419
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
420
 
      exit 1
 
570
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
421
571
      ;;
422
572
    esac
423
573
 
424
574
    # Recognize several different file suffixes.
425
575
    # If the user specifies -o file.o, it is replaced with file.lo
426
 
    xform='[cCFSfmso]'
 
576
    xform='[cCFSifmso]'
427
577
    case $libobj in
428
578
    *.ada) xform=ada ;;
429
579
    *.adb) xform=adb ;;
431
581
    *.asm) xform=asm ;;
432
582
    *.c++) xform=c++ ;;
433
583
    *.cc) xform=cc ;;
 
584
    *.ii) xform=ii ;;
 
585
    *.class) xform=class ;;
434
586
    *.cpp) xform=cpp ;;
435
587
    *.cxx) xform=cxx ;;
436
588
    *.f90) xform=f90 ;;
437
589
    *.for) xform=for ;;
 
590
    *.java) xform=java ;;
438
591
    esac
439
592
 
440
593
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
443
596
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
444
597
    *)
445
598
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
446
 
      exit 1
 
599
      exit $EXIT_FAILURE
447
600
      ;;
448
601
    esac
449
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
 
450
633
    if test -z "$base_compile"; then
451
634
      $echo "$modename: you must specify a compilation command" 1>&2
452
635
      $echo "$help" 1>&2
453
 
      exit 1
 
636
      exit $EXIT_FAILURE
454
637
    fi
455
638
 
456
639
    # Delete any leftover library objects.
457
640
    if test "$build_old_libs" = yes; then
458
 
      removelist="$obj $libobj"
 
641
      removelist="$obj $lobj $libobj ${libobj}T"
459
642
    else
460
 
      removelist="$libobj"
 
643
      removelist="$lobj $libobj ${libobj}T"
461
644
    fi
462
645
 
463
646
    $run $rm $removelist
464
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
647
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
465
648
 
466
649
    # On Cygwin there's no "real" PIC flag so we must build both object types
467
650
    case $host_os in
469
652
      pic_mode=default
470
653
      ;;
471
654
    esac
472
 
    if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
 
655
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
473
656
      # non-PIC code in shared libraries is not supported
474
657
      pic_mode=default
475
658
    fi
480
663
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
481
664
      lockfile="$output_obj.lock"
482
665
      removelist="$removelist $output_obj $lockfile"
483
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
666
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
484
667
    else
 
668
      output_obj=
485
669
      need_locks=no
486
670
      lockfile=
487
671
    fi
489
673
    # Lock this critical section if it is needed
490
674
    # We use this script file to make the link, it avoids creating a new file
491
675
    if test "$need_locks" = yes; then
492
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
676
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
493
677
        $show "Waiting for $lockfile to be removed"
494
678
        sleep 2
495
679
      done
496
680
    elif test "$need_locks" = warn; then
497
681
      if test -f "$lockfile"; then
498
 
        echo "\
 
682
        $echo "\
499
683
*** ERROR, $lockfile exists and contains:
500
684
`cat $lockfile 2>/dev/null`
501
685
 
507
691
compiler."
508
692
 
509
693
        $run $rm $removelist
510
 
        exit 1
 
694
        exit $EXIT_FAILURE
511
695
      fi
512
 
      echo $srcfile > "$lockfile"
 
696
      $echo $srcfile > "$lockfile"
513
697
    fi
514
698
 
515
699
    if test -n "$fix_srcfile_path"; then
516
700
      eval srcfile=\"$fix_srcfile_path\"
517
701
    fi
518
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
 
519
717
    # Only build a PIC object if we are building libtool libraries.
520
718
    if test "$build_libtool_libs" = yes; then
521
719
      # Without this assignment, base_compile gets emptied.
522
720
      fbsd_hideous_sh_bug=$base_compile
523
721
 
524
722
      if test "$pic_mode" != no; then
525
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
526
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
723
        command="$base_compile $srcfile $pic_flag"
527
724
      else
528
725
        # Don't build PIC code
529
726
        command="$base_compile $srcfile"
530
727
      fi
531
 
      if test "$build_old_libs" = yes; then
532
 
        lo_libobj="$libobj"
533
 
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
534
 
        if test "X$dir" = "X$libobj"; then
535
 
          dir="$objdir"
536
 
        else
537
 
          dir="$dir/$objdir"
538
 
        fi
539
 
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
540
 
 
541
 
        if test -d "$dir"; then
542
 
          $show "$rm $libobj"
543
 
          $run $rm $libobj
544
 
        else
545
 
          $show "$mkdir $dir"
546
 
          $run $mkdir $dir
547
 
          status=$?
548
 
          if test $status -ne 0 && test ! -d $dir; then
549
 
            exit $status
550
 
          fi
551
 
        fi
552
 
      fi
553
 
      if test "$compiler_o_lo" = yes; then
554
 
        output_obj="$libobj"
555
 
        command="$command -o $output_obj"
556
 
      elif test "$compiler_c_o" = yes; then
557
 
        output_obj="$obj"
558
 
        command="$command -o $output_obj"
559
 
      fi
560
 
 
561
 
      $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
 
562
745
      $show "$command"
563
746
      if $run eval "$command"; then :
564
747
      else
565
748
        test -n "$output_obj" && $run $rm $removelist
566
 
        exit 1
 
749
        exit $EXIT_FAILURE
567
750
      fi
568
751
 
569
752
      if test "$need_locks" = warn &&
570
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
571
 
        echo "\
 
753
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
754
        $echo "\
572
755
*** ERROR, $lockfile contains:
573
756
`cat $lockfile 2>/dev/null`
574
757
 
583
766
compiler."
584
767
 
585
768
        $run $rm $removelist
586
 
        exit 1
 
769
        exit $EXIT_FAILURE
587
770
      fi
588
771
 
589
772
      # Just move the object if needed, then go on to compile the next one
590
 
      if test x"$output_obj" != x"$libobj"; then
591
 
        $show "$mv $output_obj $libobj"
592
 
        if $run $mv $output_obj $libobj; then :
593
 
        else
594
 
          error=$?
595
 
          $run $rm $removelist
596
 
          exit $error
597
 
        fi
598
 
      fi
599
 
 
600
 
      # If we have no pic_flag, then copy the object into place and finish.
601
 
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
602
 
         test "$build_old_libs" = yes; then
603
 
        # Rename the .lo from within objdir to obj
604
 
        if test -f $obj; then
605
 
          $show $rm $obj
606
 
          $run $rm $obj
607
 
        fi
608
 
 
609
 
        $show "$mv $libobj $obj"
610
 
        if $run $mv $libobj $obj; then :
611
 
        else
612
 
          error=$?
613
 
          $run $rm $removelist
614
 
          exit $error
615
 
        fi
616
 
 
617
 
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
618
 
        if test "X$xdir" = "X$obj"; then
619
 
          xdir="."
620
 
        else
621
 
          xdir="$xdir"
622
 
        fi
623
 
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
624
 
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
625
 
        # Now arrange that obj and lo_libobj become the same file
626
 
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
627
 
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
628
 
          # Unlock the critical section if it was locked
629
 
          if test "$need_locks" != no; then
630
 
            $run $rm "$lockfile"
631
 
          fi
632
 
          exit 0
633
 
        else
634
 
          error=$?
635
 
          $run $rm $removelist
636
 
          exit $error
637
 
        fi
638
 
      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
639
788
 
640
789
      # Allow error messages only from the first compilation.
641
 
      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
642
800
    fi
643
801
 
644
802
    # Only build a position-dependent object if we build old libraries.
647
805
        # Don't build PIC code
648
806
        command="$base_compile $srcfile"
649
807
      else
650
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
651
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
808
        command="$base_compile $srcfile $pic_flag"
652
809
      fi
653
810
      if test "$compiler_c_o" = yes; then
654
811
        command="$command -o $obj"
655
 
        output_obj="$obj"
656
812
      fi
657
813
 
658
814
      # Suppress compiler output if we already did a PIC compilation.
659
815
      command="$command$suppress_output"
660
 
      $run $rm "$output_obj"
 
816
      $run $rm "$obj" "$output_obj"
661
817
      $show "$command"
662
818
      if $run eval "$command"; then :
663
819
      else
664
820
        $run $rm $removelist
665
 
        exit 1
 
821
        exit $EXIT_FAILURE
666
822
      fi
667
823
 
668
824
      if test "$need_locks" = warn &&
669
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
670
 
        echo "\
 
825
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
826
        $echo "\
671
827
*** ERROR, $lockfile contains:
672
828
`cat $lockfile 2>/dev/null`
673
829
 
682
838
compiler."
683
839
 
684
840
        $run $rm $removelist
685
 
        exit 1
 
841
        exit $EXIT_FAILURE
686
842
      fi
687
843
 
688
844
      # Just move the object if needed
689
 
      if test x"$output_obj" != x"$obj"; then
 
845
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
690
846
        $show "$mv $output_obj $obj"
691
847
        if $run $mv $output_obj $obj; then :
692
848
        else
696
852
        fi
697
853
      fi
698
854
 
699
 
      # Create an invalid libtool object if no PIC, so that we do not
700
 
      # accidentally link it into a program.
701
 
      if test "$build_libtool_libs" != yes; then
702
 
        $show "echo timestamp > $libobj"
703
 
        $run eval "echo timestamp > \$libobj" || exit $?
704
 
      else
705
 
        # Move the .lo from within objdir
706
 
        $show "$mv $libobj $lo_libobj"
707
 
        if $run $mv $libobj $lo_libobj; then :
708
 
        else
709
 
          error=$?
710
 
          $run $rm $removelist
711
 
          exit $error
712
 
        fi
713
 
      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
714
870
    fi
715
871
 
 
872
    $run $mv "${libobj}T" "${libobj}"
 
873
 
716
874
    # Unlock the critical section if it was locked
717
875
    if test "$need_locks" != no; then
718
876
      $run $rm "$lockfile"
719
877
    fi
720
878
 
721
 
    exit 0
 
879
    exit $EXIT_SUCCESS
722
880
    ;;
723
881
 
724
882
  # libtool link mode
729
887
      # It is impossible to link a dll without this setting, and
730
888
      # we shouldn't force the makefile maintainer to figure out
731
889
      # which system we are compiling for in order to pass an extra
732
 
      # flag for every libtool invokation.
 
890
      # flag for every libtool invocation.
733
891
      # allow_undefined=no
734
892
 
735
893
      # FIXME: Unfortunately, there are problems with the above when trying
744
902
      ;;
745
903
    esac
746
904
    libtool_args="$nonopt"
 
905
    base_compile="$nonopt $@"
747
906
    compile_command="$nonopt"
748
907
    finalize_command="$nonopt"
749
908
 
759
918
    linker_flags=
760
919
    dllsearchpath=
761
920
    lib_search_path=`pwd`
 
921
    inst_prefix_dir=
762
922
 
763
923
    avoid_version=no
764
924
    dlfiles=
773
933
    module=no
774
934
    no_install=no
775
935
    objs=
 
936
    non_pic_objects=
 
937
    precious_files_regex=
776
938
    prefer_static_libs=no
777
939
    preload=no
778
940
    prev=
784
946
    temp_rpath=
785
947
    thread_safe=no
786
948
    vinfo=
 
949
    vinfo_number=no
 
950
 
 
951
    func_infer_tag $base_compile
787
952
 
788
953
    # We need to know -static, to get the right output filenames.
789
954
    for arg
814
979
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
815
980
 
816
981
    # Go through the arguments, transforming them on the way.
817
 
    while test $# -gt 0; do
 
982
    while test "$#" -gt 0; do
818
983
      arg="$1"
819
984
      shift
820
985
      case $arg in
879
1044
          export_symbols="$arg"
880
1045
          if test ! -f "$arg"; then
881
1046
            $echo "$modename: symbol file \`$arg' does not exist"
882
 
            exit 1
 
1047
            exit $EXIT_FAILURE
883
1048
          fi
884
1049
          prev=
885
1050
          continue
889
1054
          prev=
890
1055
          continue
891
1056
          ;;
 
1057
        inst_prefix)
 
1058
          inst_prefix_dir="$arg"
 
1059
          prev=
 
1060
          continue
 
1061
          ;;
 
1062
        precious_regex)
 
1063
          precious_files_regex="$arg"
 
1064
          prev=
 
1065
          continue
 
1066
          ;;
892
1067
        release)
893
1068
          release="-$arg"
894
1069
          prev=
895
1070
          continue
896
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
          ;;
897
1179
        rpath | xrpath)
898
1180
          # We need an absolute path.
899
1181
          case $arg in
900
1182
          [\\/]* | [A-Za-z]:[\\/]*) ;;
901
1183
          *)
902
1184
            $echo "$modename: only absolute run-paths are allowed" 1>&2
903
 
            exit 1
 
1185
            exit $EXIT_FAILURE
904
1186
            ;;
905
1187
          esac
906
1188
          if test "$prev" = rpath; then
932
1214
          finalize_command="$finalize_command $wl$qarg"
933
1215
          continue
934
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
          ;;
935
1230
        *)
936
1231
          eval "$prev=\"\$arg\""
937
1232
          prev=
938
1233
          continue
939
1234
          ;;
940
1235
        esac
941
 
      fi # test -n $prev
 
1236
      fi # test -n "$prev"
942
1237
 
943
1238
      prevarg="$arg"
944
1239
 
980
1275
      -export-symbols | -export-symbols-regex)
981
1276
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
982
1277
          $echo "$modename: more than one -exported-symbols argument is not allowed"
983
 
          exit 1
 
1278
          exit $EXIT_FAILURE
984
1279
        fi
985
1280
        if test "X$arg" = "X-export-symbols"; then
986
1281
          prev=expsyms
990
1285
        continue
991
1286
        ;;
992
1287
 
 
1288
      -inst-prefix-dir)
 
1289
        prev=inst_prefix
 
1290
        continue
 
1291
        ;;
 
1292
 
993
1293
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
994
1294
      # so, if we see these flags be careful not to treat them like -L
995
1295
      -L[A-Z][A-Z]*:*)
996
1296
        case $with_gcc/$host in
997
 
        no/*-*-irix* | no/*-*-nonstopux*)
 
1297
        no/*-*-irix* | /*-*-irix*)
998
1298
          compile_command="$compile_command $arg"
999
1299
          finalize_command="$finalize_command $arg"
1000
1300
          ;;
1011
1311
          absdir=`cd "$dir" && pwd`
1012
1312
          if test -z "$absdir"; then
1013
1313
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1014
 
            exit 1
 
1314
            exit $EXIT_FAILURE
1015
1315
          fi
1016
1316
          dir="$absdir"
1017
1317
          ;;
1049
1349
            # Do not include libc due to us having libc/libc_r.
1050
1350
            test "X$arg" = "X-lc" && continue
1051
1351
            ;;
 
1352
          *-*-rhapsody* | *-*-darwin1.[012])
 
1353
            # Rhapsody C and math libraries are in the System framework
 
1354
            deplibs="$deplibs -framework System"
 
1355
            continue
1052
1356
          esac
1053
 
         elif test "X$arg" = "X-lc_r"; then
1054
 
          case $host in
 
1357
        elif test "X$arg" = "X-lc_r"; then
 
1358
         case $host in
1055
1359
         *-*-openbsd* | *-*-freebsd*)
1056
 
            # Do not include libc_r directly, use -pthread flag.
1057
 
            continue
1058
 
            ;;
1059
 
          esac
 
1360
           # Do not include libc_r directly, use -pthread flag.
 
1361
           continue
 
1362
           ;;
 
1363
         esac
1060
1364
        fi
1061
1365
        deplibs="$deplibs $arg"
1062
1366
        continue
1063
1367
        ;;
1064
1368
 
 
1369
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1370
        deplibs="$deplibs $arg"
 
1371
        continue
 
1372
        ;;
 
1373
 
1065
1374
      -module)
1066
1375
        module=yes
1067
1376
        continue
1068
1377
        ;;
1069
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
 
1070
1407
      -no-fast-install)
1071
1408
        fast_install=no
1072
1409
        continue
1091
1428
        continue
1092
1429
        ;;
1093
1430
 
 
1431
      -objectlist)
 
1432
        prev=objectlist
 
1433
        continue
 
1434
        ;;
 
1435
 
1094
1436
      -o) prev=output ;;
1095
1437
 
 
1438
      -precious-files-regex)
 
1439
        prev=precious_regex
 
1440
        continue
 
1441
        ;;
 
1442
 
1096
1443
      -release)
1097
1444
        prev=release
1098
1445
        continue
1115
1462
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1116
1463
        *)
1117
1464
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1118
 
          exit 1
 
1465
          exit $EXIT_FAILURE
1119
1466
          ;;
1120
1467
        esac
1121
1468
        case "$xrpath " in
1143
1490
        prev=vinfo
1144
1491
        continue
1145
1492
        ;;
 
1493
      -version-number)
 
1494
        prev=vinfo
 
1495
        vinfo_number=yes
 
1496
        continue
 
1497
        ;;
1146
1498
 
1147
1499
      -Wc,*)
1148
1500
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1191
1543
        continue
1192
1544
        ;;
1193
1545
 
 
1546
      -XCClinker)
 
1547
        prev=xcclinker
 
1548
        continue
 
1549
        ;;
 
1550
 
1194
1551
      # Some other compiler flag.
1195
1552
      -* | +*)
1196
1553
        # Unknown arguments in both finalize_command and compile_command need
1203
1560
        esac
1204
1561
        ;;
1205
1562
 
1206
 
      *.lo | *.$objext)
1207
 
        # A library or standard object.
1208
 
        if test "$prev" = dlfiles; then
1209
 
          # This file was specified with -dlopen.
1210
 
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1211
 
            dlfiles="$dlfiles $arg"
1212
 
            prev=
1213
 
            continue
1214
 
          else
1215
 
            # If libtool objects are unsupported, then we need to preload.
1216
 
            prev=dlprefiles
1217
 
          fi
1218
 
        fi
1219
 
 
1220
 
        if test "$prev" = dlprefiles; then
1221
 
          # Preload the old-style object.
1222
 
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1223
 
          prev=
1224
 
        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.
1225
1578
          case $arg in
1226
 
          *.lo) libobjs="$libobjs $arg" ;;
1227
 
          *) objs="$objs $arg" ;;
 
1579
          */* | *\\*) . $arg ;;
 
1580
          *) . ./$arg ;;
1228
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
1229
1658
        fi
1230
1659
        ;;
1231
1660
 
1276
1705
    if test -n "$prev"; then
1277
1706
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1278
1707
      $echo "$help" 1>&2
1279
 
      exit 1
 
1708
      exit $EXIT_FAILURE
1280
1709
    fi
1281
1710
 
1282
1711
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1285
1714
      finalize_command="$finalize_command $arg"
1286
1715
    fi
1287
1716
 
 
1717
    oldlibs=
1288
1718
    # calculate the name of the file, without its directory
1289
1719
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1290
1720
    libobjs_save="$libobjs"
1305
1735
      output_objdir="$output_objdir/$objdir"
1306
1736
    fi
1307
1737
    # Create the object directory.
1308
 
    if test ! -d $output_objdir; then
 
1738
    if test ! -d "$output_objdir"; then
1309
1739
      $show "$mkdir $output_objdir"
1310
1740
      $run $mkdir $output_objdir
1311
1741
      status=$?
1312
 
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1742
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1313
1743
        exit $status
1314
1744
      fi
1315
1745
    fi
1319
1749
    "")
1320
1750
      $echo "$modename: you must specify an output file" 1>&2
1321
1751
      $echo "$help" 1>&2
1322
 
      exit 1
 
1752
      exit $EXIT_FAILURE
1323
1753
      ;;
1324
1754
    *.$libext) linkmode=oldlib ;;
1325
1755
    *.lo | *.$objext) linkmode=obj ;;
1327
1757
    *) linkmode=prog ;; # Anything else should be a program.
1328
1758
    esac
1329
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
1330
1769
    specialdeplibs=
 
1770
 
1331
1771
    libs=
1332
1772
    # Find all interdependent deplibs by searching for libraries
1333
1773
    # that are linked more than once (e.g. -la -lb -la)
1339
1779
      fi
1340
1780
      libs="$libs $deplib"
1341
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
 
1342
1801
    deplibs=
1343
1802
    newdependency_libs=
1344
1803
    newlib_search_path=
1353
1812
          *.la) ;;
1354
1813
          *)
1355
1814
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1356
 
            exit 1
 
1815
            exit $EXIT_FAILURE
1357
1816
            ;;
1358
1817
          esac
1359
1818
        done
1370
1829
        ;;
1371
1830
    esac
1372
1831
    for pass in $passes; do
1373
 
      if test $linkmode = prog; then
1374
 
        # 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
1375
1838
        case $pass in
1376
 
        dlopen)
1377
 
          libs="$dlfiles"
1378
 
          save_deplibs="$deplibs" # Collect dlpreopened libraries
1379
 
          deplibs=
1380
 
          ;;
 
1839
        dlopen) libs="$dlfiles" ;;
1381
1840
        dlpreopen) libs="$dlprefiles" ;;
1382
 
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
1841
        link)
 
1842
          libs="$deplibs %DEPLIBS%"
 
1843
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
 
1844
          ;;
1383
1845
        esac
1384
1846
      fi
 
1847
      if test "$pass" = dlopen; then
 
1848
        # Collect dlpreopened libraries
 
1849
        save_deplibs="$deplibs"
 
1850
        deplibs=
 
1851
      fi
1385
1852
      for deplib in $libs; do
1386
1853
        lib=
1387
1854
        found=no
1388
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
          ;;
1389
1865
        -l*)
1390
 
          if test $linkmode = oldlib && test $linkmode = obj; then
1391
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
 
1866
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
1867
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1392
1868
            continue
1393
1869
          fi
1394
 
          if test $pass = conv; then
 
1870
          if test "$pass" = conv; then
1395
1871
            deplibs="$deplib $deplibs"
1396
1872
            continue
1397
1873
          fi
1398
1874
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1399
1875
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1400
 
            # Search the libtool library
1401
 
            lib="$searchdir/lib${name}.la"
1402
 
            if test -f "$lib"; then
1403
 
              found=yes
1404
 
              break
1405
 
            fi
 
1876
            for search_ext in .la $std_shrext .so .a; do
 
1877
              # Search the libtool library
 
1878
              lib="$searchdir/lib${name}${search_ext}"
 
1879
              if test -f "$lib"; then
 
1880
                if test "$search_ext" = ".la"; then
 
1881
                  found=yes
 
1882
                else
 
1883
                  found=no
 
1884
                fi
 
1885
                break 2
 
1886
              fi
 
1887
            done
1406
1888
          done
1407
1889
          if test "$found" != yes; then
1408
1890
            # deplib doesn't seem to be a libtool library
1411
1893
              finalize_deplibs="$deplib $finalize_deplibs"
1412
1894
            else
1413
1895
              deplibs="$deplib $deplibs"
1414
 
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
1896
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1415
1897
            fi
1416
1898
            continue
 
1899
          else # deplib is a libtool library
 
1900
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
1901
            # We need to do some special things here, and not later.
 
1902
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
1903
              case " $predeps $postdeps " in
 
1904
              *" $deplib "*)
 
1905
                if (${SED} -e '2q' $lib |
 
1906
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1907
                  library_names=
 
1908
                  old_library=
 
1909
                  case $lib in
 
1910
                  */* | *\\*) . $lib ;;
 
1911
                  *) . ./$lib ;;
 
1912
                  esac
 
1913
                  for l in $old_library $library_names; do
 
1914
                    ll="$l"
 
1915
                  done
 
1916
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
1917
                    found=no
 
1918
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
1919
                    test "X$ladir" = "X$lib" && ladir="."
 
1920
                    lib=$ladir/$old_library
 
1921
                    if test "$linkmode,$pass" = "prog,link"; then
 
1922
                      compile_deplibs="$deplib $compile_deplibs"
 
1923
                      finalize_deplibs="$deplib $finalize_deplibs"
 
1924
                    else
 
1925
                      deplibs="$deplib $deplibs"
 
1926
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
1927
                    fi
 
1928
                    continue
 
1929
                  fi
 
1930
                fi
 
1931
                ;;
 
1932
              *) ;;
 
1933
              esac
 
1934
            fi
1417
1935
          fi
1418
1936
          ;; # -l
1419
1937
        -L*)
1420
1938
          case $linkmode in
1421
1939
          lib)
1422
1940
            deplibs="$deplib $deplibs"
1423
 
            test $pass = conv && continue
 
1941
            test "$pass" = conv && continue
1424
1942
            newdependency_libs="$deplib $newdependency_libs"
1425
1943
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1426
1944
            ;;
1427
1945
          prog)
1428
 
            if test $pass = conv; then
 
1946
            if test "$pass" = conv; then
1429
1947
              deplibs="$deplib $deplibs"
1430
1948
              continue
1431
1949
            fi
1432
 
            if test $pass = scan; then
 
1950
            if test "$pass" = scan; then
1433
1951
              deplibs="$deplib $deplibs"
1434
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1435
1952
            else
1436
1953
              compile_deplibs="$deplib $compile_deplibs"
1437
1954
              finalize_deplibs="$deplib $finalize_deplibs"
1438
1955
            fi
 
1956
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1439
1957
            ;;
1440
1958
          *)
1441
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
1959
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1442
1960
            ;;
1443
1961
          esac # linkmode
1444
1962
          continue
1445
1963
          ;; # -L
1446
1964
        -R*)
1447
 
          if test $pass = link; then
 
1965
          if test "$pass" = link; then
1448
1966
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1449
1967
            # Make sure the xrpath contains only unique directories.
1450
1968
            case "$xrpath " in
1457
1975
          ;;
1458
1976
        *.la) lib="$deplib" ;;
1459
1977
        *.$libext)
1460
 
          if test $pass = conv; then
 
1978
          if test "$pass" = conv; then
1461
1979
            deplibs="$deplib $deplibs"
1462
1980
            continue
1463
1981
          fi
1464
1982
          case $linkmode in
1465
1983
          lib)
1466
1984
            if test "$deplibs_check_method" != pass_all; then
1467
 
              echo
1468
 
              echo "*** Warning: Trying to link with static lib archive $deplib."
1469
 
              echo "*** I have the capability to make that library automatically link in when"
1470
 
              echo "*** you link to this library.  But I can only do this if you have a"
1471
 
              echo "*** shared version of the library, which you do not appear to have"
1472
 
              echo "*** because the file extensions .$libext of this argument makes me believe"
1473
 
              echo "*** that it is just a static archive that I should not used here."
 
1985
              $echo
 
1986
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
1987
              $echo "*** I have the capability to make that library automatically link in when"
 
1988
              $echo "*** you link to this library.  But I can only do this if you have a"
 
1989
              $echo "*** shared version of the library, which you do not appear to have"
 
1990
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
1991
              $echo "*** that it is just a static archive that I should not used here."
1474
1992
            else
1475
 
              echo
1476
 
              echo "*** Warning: Linking the shared library $output against the"
1477
 
              echo "*** static library $deplib is not portable!"
 
1993
              $echo
 
1994
              $echo "*** Warning: Linking the shared library $output against the"
 
1995
              $echo "*** static library $deplib is not portable!"
1478
1996
              deplibs="$deplib $deplibs"
1479
1997
            fi
1480
1998
            continue
1481
1999
            ;;
1482
2000
          prog)
1483
 
            if test $pass != link; then
 
2001
            if test "$pass" != link; then
1484
2002
              deplibs="$deplib $deplibs"
1485
2003
            else
1486
2004
              compile_deplibs="$deplib $compile_deplibs"
1491
2009
          esac # linkmode
1492
2010
          ;; # *.$libext
1493
2011
        *.lo | *.$objext)
1494
 
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1495
 
            # If there is no dlopen support or we're linking statically,
1496
 
            # we need to preload.
1497
 
            newdlprefiles="$newdlprefiles $deplib"
1498
 
            compile_deplibs="$deplib $compile_deplibs"
1499
 
            finalize_deplibs="$deplib $finalize_deplibs"
1500
 
          else
1501
 
            newdlfiles="$newdlfiles $deplib"
 
2012
          if test "$pass" = conv; then
 
2013
            deplibs="$deplib $deplibs"
 
2014
          elif test "$linkmode" = prog; then
 
2015
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2016
              # If there is no dlopen support or we're linking statically,
 
2017
              # we need to preload.
 
2018
              newdlprefiles="$newdlprefiles $deplib"
 
2019
              compile_deplibs="$deplib $compile_deplibs"
 
2020
              finalize_deplibs="$deplib $finalize_deplibs"
 
2021
            else
 
2022
              newdlfiles="$newdlfiles $deplib"
 
2023
            fi
1502
2024
          fi
1503
2025
          continue
1504
2026
          ;;
1507
2029
          continue
1508
2030
          ;;
1509
2031
        esac # case $deplib
1510
 
        if test $found = yes || test -f "$lib"; then :
 
2032
        if test "$found" = yes || test -f "$lib"; then :
1511
2033
        else
1512
2034
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1513
 
          exit 1
 
2035
          exit $EXIT_FAILURE
1514
2036
        fi
1515
2037
 
1516
2038
        # Check to see that this really is a libtool archive.
1517
 
        if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2039
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1518
2040
        else
1519
2041
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1520
 
          exit 1
 
2042
          exit $EXIT_FAILURE
1521
2043
        fi
1522
2044
 
1523
2045
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1530
2052
        library_names=
1531
2053
        old_library=
1532
2054
        # If the library was installed with an old release of libtool,
1533
 
        # it will not redefine variable installed.
 
2055
        # it will not redefine variables installed, or shouldnotlink
1534
2056
        installed=yes
 
2057
        shouldnotlink=no
1535
2058
 
1536
2059
        # Read the .la file
1537
2060
        case $lib in
1541
2064
 
1542
2065
        if test "$linkmode,$pass" = "lib,link" ||
1543
2066
           test "$linkmode,$pass" = "prog,scan" ||
1544
 
           { test $linkmode = oldlib && test $linkmode = obj; }; then
1545
 
           # Add dl[pre]opened files of deplib
 
2067
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1546
2068
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1547
2069
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1548
2070
        fi
1549
2071
 
1550
 
        if test $pass = conv; then
 
2072
        if test "$pass" = conv; then
1551
2073
          # Only check for convenience libraries
1552
2074
          deplibs="$lib $deplibs"
1553
2075
          if test -z "$libdir"; then
1554
2076
            if test -z "$old_library"; then
1555
2077
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1556
 
              exit 1
 
2078
              exit $EXIT_FAILURE
1557
2079
            fi
1558
2080
            # It is a libtool convenience library, so add in its objects.
1559
2081
            convenience="$convenience $ladir/$objdir/$old_library"
1568
2090
              fi
1569
2091
              tmp_libs="$tmp_libs $deplib"
1570
2092
            done
1571
 
          elif test $linkmode != prog && test $linkmode != lib; then
 
2093
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1572
2094
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1573
 
            exit 1
 
2095
            exit $EXIT_FAILURE
1574
2096
          fi
1575
2097
          continue
1576
2098
        fi # $pass = conv
1577
2099
 
 
2100
 
1578
2101
        # Get the name of the library we link against.
1579
2102
        linklib=
1580
2103
        for l in $old_library $library_names; do
1582
2105
        done
1583
2106
        if test -z "$linklib"; then
1584
2107
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1585
 
          exit 1
 
2108
          exit $EXIT_FAILURE
1586
2109
        fi
1587
2110
 
1588
2111
        # This library was specified with -dlopen.
1589
 
        if test $pass = dlopen; then
 
2112
        if test "$pass" = dlopen; then
1590
2113
          if test -z "$libdir"; then
1591
2114
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1592
 
            exit 1
 
2115
            exit $EXIT_FAILURE
1593
2116
          fi
1594
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2117
          if test -z "$dlname" ||
 
2118
             test "$dlopen_support" != yes ||
 
2119
             test "$build_libtool_libs" = no; then
1595
2120
            # If there is no dlname, no dlopen support or we're linking
1596
 
            # statically, we need to preload.
1597
 
            dlprefiles="$dlprefiles $lib"
 
2121
            # statically, we need to preload.  We also need to preload any
 
2122
            # dependent libraries so libltdl's deplib preloader doesn't
 
2123
            # bomb out in the load deplibs phase.
 
2124
            dlprefiles="$dlprefiles $lib $dependency_libs"
1598
2125
          else
1599
2126
            newdlfiles="$newdlfiles $lib"
1600
2127
          fi
1635
2162
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1636
2163
 
1637
2164
        # This library was specified with -dlpreopen.
1638
 
        if test $pass = dlpreopen; then
 
2165
        if test "$pass" = dlpreopen; then
1639
2166
          if test -z "$libdir"; then
1640
2167
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1641
 
            exit 1
 
2168
            exit $EXIT_FAILURE
1642
2169
          fi
1643
2170
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1644
2171
          # are required to link).
1654
2181
 
1655
2182
        if test -z "$libdir"; then
1656
2183
          # Link the convenience library
1657
 
          if test $linkmode = lib; then
 
2184
          if test "$linkmode" = lib; then
1658
2185
            deplibs="$dir/$old_library $deplibs"
1659
2186
          elif test "$linkmode,$pass" = "prog,link"; then
1660
2187
            compile_deplibs="$dir/$old_library $compile_deplibs"
1661
2188
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1662
2189
          else
1663
 
            deplibs="$lib $deplibs"
 
2190
            deplibs="$lib $deplibs" # used for prog,scan pass
1664
2191
          fi
1665
2192
          continue
1666
2193
        fi
1667
2194
 
1668
 
        if test $linkmode = prog && test $pass != link; then
 
2195
 
 
2196
        if test "$linkmode" = prog && test "$pass" != link; then
1669
2197
          newlib_search_path="$newlib_search_path $ladir"
1670
2198
          deplibs="$lib $deplibs"
1671
2199
 
1681
2209
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1682
2210
            esac
1683
2211
            # Need to link against all dependency_libs?
1684
 
            if test $linkalldeplibs = yes; then
 
2212
            if test "$linkalldeplibs" = yes; then
1685
2213
              deplibs="$deplib $deplibs"
1686
2214
            else
1687
2215
              # Need to hardcode shared library paths
1698
2226
          continue
1699
2227
        fi # $linkmode = prog...
1700
2228
 
 
2229
        if test "$linkmode,$pass" = "prog,link"; then
 
2230
          if test -n "$library_names" &&
 
2231
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2232
            # We need to hardcode the library path
 
2233
            if test -n "$shlibpath_var"; then
 
2234
              # Make sure the rpath contains only unique directories.
 
2235
              case "$temp_rpath " in
 
2236
              *" $dir "*) ;;
 
2237
              *" $absdir "*) ;;
 
2238
              *) temp_rpath="$temp_rpath $dir" ;;
 
2239
              esac
 
2240
            fi
 
2241
 
 
2242
            # Hardcode the library path.
 
2243
            # Skip directories that are in the system default run-time
 
2244
            # search path.
 
2245
            case " $sys_lib_dlsearch_path " in
 
2246
            *" $absdir "*) ;;
 
2247
            *)
 
2248
              case "$compile_rpath " in
 
2249
              *" $absdir "*) ;;
 
2250
              *) compile_rpath="$compile_rpath $absdir"
 
2251
              esac
 
2252
              ;;
 
2253
            esac
 
2254
            case " $sys_lib_dlsearch_path " in
 
2255
            *" $libdir "*) ;;
 
2256
            *)
 
2257
              case "$finalize_rpath " in
 
2258
              *" $libdir "*) ;;
 
2259
              *) finalize_rpath="$finalize_rpath $libdir"
 
2260
              esac
 
2261
              ;;
 
2262
            esac
 
2263
          fi # $linkmode,$pass = prog,link...
 
2264
 
 
2265
          if test "$alldeplibs" = yes &&
 
2266
             { test "$deplibs_check_method" = pass_all ||
 
2267
               { test "$build_libtool_libs" = yes &&
 
2268
                 test -n "$library_names"; }; }; then
 
2269
            # We only need to search for static libraries
 
2270
            continue
 
2271
          fi
 
2272
        fi
 
2273
 
1701
2274
        link_static=no # Whether the deplib will be linked statically
1702
2275
        if test -n "$library_names" &&
1703
2276
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1704
 
          # Link against this shared library
1705
 
 
1706
 
          if test "$linkmode,$pass" = "prog,link" ||
1707
 
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1708
 
            # Hardcode the library path.
1709
 
            # Skip directories that are in the system default run-time
1710
 
            # search path.
1711
 
            case " $sys_lib_dlsearch_path " in
1712
 
            *" $absdir "*) ;;
1713
 
            *)
1714
 
              case "$compile_rpath " in
1715
 
              *" $absdir "*) ;;
1716
 
              *) compile_rpath="$compile_rpath $absdir"
1717
 
              esac
1718
 
              ;;
1719
 
            esac
1720
 
            case " $sys_lib_dlsearch_path " in
1721
 
            *" $libdir "*) ;;
1722
 
            *)
1723
 
              case "$finalize_rpath " in
1724
 
              *" $libdir "*) ;;
1725
 
              *) finalize_rpath="$finalize_rpath $libdir"
1726
 
              esac
1727
 
              ;;
1728
 
            esac
1729
 
            if test $linkmode = prog; then
1730
 
              # We need to hardcode the library path
1731
 
              if test -n "$shlibpath_var"; then
1732
 
                # Make sure the rpath contains only unique directories.
1733
 
                case "$temp_rpath " in
1734
 
                *" $dir "*) ;;
1735
 
                *" $absdir "*) ;;
1736
 
                *) temp_rpath="$temp_rpath $dir" ;;
1737
 
                esac
1738
 
              fi
1739
 
            fi
1740
 
          fi # $linkmode,$pass = prog,link...
1741
 
 
1742
 
          if test "$alldeplibs" = yes &&
1743
 
             { test "$deplibs_check_method" = pass_all ||
1744
 
               { test "$build_libtool_libs" = yes &&
1745
 
                 test -n "$library_names"; }; }; then
1746
 
            # We only need to search for static libraries
1747
 
            continue
1748
 
          fi
1749
 
 
1750
2277
          if test "$installed" = no; then
1751
2278
            notinst_deplibs="$notinst_deplibs $lib"
1752
2279
            need_relink=yes
1753
2280
          fi
 
2281
          # This is a shared library
 
2282
 
 
2283
          # Warn about portability, can't link against -module's on
 
2284
          # some systems (darwin)
 
2285
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2286
            $echo
 
2287
            if test "$linkmode" = prog; then
 
2288
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
2289
            else
 
2290
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
2291
            fi
 
2292
            $echo "*** $linklib is not portable!"
 
2293
          fi
 
2294
          if test "$linkmode" = lib &&
 
2295
             test "$hardcode_into_libs" = yes; then
 
2296
            # Hardcode the library path.
 
2297
            # Skip directories that are in the system default run-time
 
2298
            # search path.
 
2299
            case " $sys_lib_dlsearch_path " in
 
2300
            *" $absdir "*) ;;
 
2301
            *)
 
2302
              case "$compile_rpath " in
 
2303
              *" $absdir "*) ;;
 
2304
              *) compile_rpath="$compile_rpath $absdir"
 
2305
              esac
 
2306
              ;;
 
2307
            esac
 
2308
            case " $sys_lib_dlsearch_path " in
 
2309
            *" $libdir "*) ;;
 
2310
            *)
 
2311
              case "$finalize_rpath " in
 
2312
              *" $libdir "*) ;;
 
2313
              *) finalize_rpath="$finalize_rpath $libdir"
 
2314
              esac
 
2315
              ;;
 
2316
            esac
 
2317
          fi
1754
2318
 
1755
2319
          if test -n "$old_archive_from_expsyms_cmds"; then
1756
2320
            # figure out the soname
1764
2328
            elif test -n "$soname_spec"; then
1765
2329
              # bleh windows
1766
2330
              case $host in
1767
 
              *cygwin*)
 
2331
              *cygwin* | mingw*)
1768
2332
                major=`expr $current - $age`
1769
2333
                versuffix="-$major"
1770
2334
                ;;
1776
2340
 
1777
2341
            # Make a new name for the extract_expsyms_cmds to use
1778
2342
            soroot="$soname"
1779
 
            soname=`echo $soroot | sed -e 's/^.*\///'`
1780
 
            newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
 
2343
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2344
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1781
2345
 
1782
2346
            # If the library has no export list, then create one now
1783
2347
            if test -f "$output_objdir/$soname-def"; then :
1784
2348
            else
1785
2349
              $show "extracting exported symbol list from \`$soname'"
1786
2350
              save_ifs="$IFS"; IFS='~'
1787
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2351
              cmds=$extract_expsyms_cmds
1788
2352
              for cmd in $cmds; do
1789
2353
                IFS="$save_ifs"
 
2354
                eval cmd=\"$cmd\"
1790
2355
                $show "$cmd"
1791
2356
                $run eval "$cmd" || exit $?
1792
2357
              done
1797
2362
            if test -f "$output_objdir/$newlib"; then :; else
1798
2363
              $show "generating import library for \`$soname'"
1799
2364
              save_ifs="$IFS"; IFS='~'
1800
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2365
              cmds=$old_archive_from_expsyms_cmds
1801
2366
              for cmd in $cmds; do
1802
2367
                IFS="$save_ifs"
 
2368
                eval cmd=\"$cmd\"
1803
2369
                $show "$cmd"
1804
2370
                $run eval "$cmd" || exit $?
1805
2371
              done
1808
2374
            # make sure the library variables are pointing to the new library
1809
2375
            dir=$output_objdir
1810
2376
            linklib=$newlib
1811
 
          fi # test -n $old_archive_from_expsyms_cmds
 
2377
          fi # test -n "$old_archive_from_expsyms_cmds"
1812
2378
 
1813
 
          if test $linkmode = prog || test "$mode" != relink; then
 
2379
          if test "$linkmode" = prog || test "$mode" != relink; then
1814
2380
            add_shlibpath=
1815
2381
            add_dir=
1816
2382
            add=
1819
2385
            immediate | unsupported)
1820
2386
              if test "$hardcode_direct" = no; then
1821
2387
                add="$dir/$linklib"
 
2388
                case $host in
 
2389
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2390
                  *-*-darwin* )
 
2391
                    # if the lib is a module then we can not link against
 
2392
                    # it, someone is ignoring the new warnings I added
 
2393
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2394
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2395
                      if test -z "$old_library" ; then
 
2396
                        $echo
 
2397
                        $echo "** And there doesn't seem to be a static archive available"
 
2398
                        $echo "** The link will probably fail, sorry"
 
2399
                      else
 
2400
                        add="$dir/$old_library"
 
2401
                      fi
 
2402
                    fi
 
2403
                esac
1822
2404
              elif test "$hardcode_minus_L" = no; then
1823
2405
                case $host in
1824
2406
                *-*-sunos*) add_shlibpath="$dir" ;;
1837
2419
                add="$dir/$linklib"
1838
2420
              elif test "$hardcode_minus_L" = yes; then
1839
2421
                add_dir="-L$dir"
 
2422
                # Try looking first in the location we're being installed to.
 
2423
                if test -n "$inst_prefix_dir"; then
 
2424
                  case "$libdir" in
 
2425
                    [\\/]*)
 
2426
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2427
                      ;;
 
2428
                  esac
 
2429
                fi
1840
2430
                add="-l$name"
1841
2431
              elif test "$hardcode_shlibpath_var" = yes; then
1842
2432
                add_shlibpath="$dir"
1850
2440
 
1851
2441
            if test "$lib_linked" != yes; then
1852
2442
              $echo "$modename: configuration error: unsupported hardcode properties"
1853
 
              exit 1
 
2443
              exit $EXIT_FAILURE
1854
2444
            fi
1855
2445
 
1856
2446
            if test -n "$add_shlibpath"; then
1859
2449
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1860
2450
              esac
1861
2451
            fi
1862
 
            if test $linkmode = prog; then
 
2452
            if test "$linkmode" = prog; then
1863
2453
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1864
2454
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1865
2455
            else
1876
2466
            fi
1877
2467
          fi
1878
2468
 
1879
 
          if test $linkmode = prog || test "$mode" = relink; then
 
2469
          if test "$linkmode" = prog || test "$mode" = relink; then
1880
2470
            add_shlibpath=
1881
2471
            add_dir=
1882
2472
            add=
1892
2482
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1893
2483
              esac
1894
2484
              add="-l$name"
 
2485
            elif test "$hardcode_automatic" = yes; then
 
2486
              if test -n "$inst_prefix_dir" &&
 
2487
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2488
                add="$inst_prefix_dir$libdir/$linklib"
 
2489
              else
 
2490
                add="$libdir/$linklib"
 
2491
              fi
1895
2492
            else
1896
2493
              # We cannot seem to hardcode it, guess we'll fake it.
1897
2494
              add_dir="-L$libdir"
 
2495
              # Try looking first in the location we're being installed to.
 
2496
              if test -n "$inst_prefix_dir"; then
 
2497
                case "$libdir" in
 
2498
                  [\\/]*)
 
2499
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2500
                    ;;
 
2501
                esac
 
2502
              fi
1898
2503
              add="-l$name"
1899
2504
            fi
1900
2505
 
1901
 
            if test $linkmode = prog; then
 
2506
            if test "$linkmode" = prog; then
1902
2507
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1903
2508
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1904
2509
            else
1906
2511
              test -n "$add" && deplibs="$add $deplibs"
1907
2512
            fi
1908
2513
          fi
1909
 
        elif test $linkmode = prog; then
1910
 
          if test "$alldeplibs" = yes &&
1911
 
             { test "$deplibs_check_method" = pass_all ||
1912
 
               { test "$build_libtool_libs" = yes &&
1913
 
                 test -n "$library_names"; }; }; then
1914
 
            # We only need to search for static libraries
1915
 
            continue
1916
 
          fi
1917
 
 
1918
 
          # Try to link the static library
 
2514
        elif test "$linkmode" = prog; then
1919
2515
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1920
2516
          # is not unsupported.  This is valid on all known static and
1921
2517
          # shared platforms.
1935
2531
 
1936
2532
            # Just print a warning and add the library to dependency_libs so
1937
2533
            # that the program can be linked against the static library.
1938
 
            echo
1939
 
            echo "*** Warning: This system can not link to static lib archive $lib."
1940
 
            echo "*** I have the capability to make that library automatically link in when"
1941
 
            echo "*** you link to this library.  But I can only do this if you have a"
1942
 
            echo "*** shared version of the library, which you do not appear to have."
 
2534
            $echo
 
2535
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2536
            $echo "*** I have the capability to make that library automatically link in when"
 
2537
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2538
            $echo "*** shared version of the library, which you do not appear to have."
1943
2539
            if test "$module" = yes; then
1944
 
              echo "*** But as you try to build a module library, libtool will still create "
1945
 
              echo "*** a static module, that should work as long as the dlopening application"
1946
 
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
2540
              $echo "*** But as you try to build a module library, libtool will still create "
 
2541
              $echo "*** a static module, that should work as long as the dlopening application"
 
2542
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1947
2543
              if test -z "$global_symbol_pipe"; then
1948
 
                echo
1949
 
                echo "*** However, this would only work if libtool was able to extract symbol"
1950
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1951
 
                echo "*** not find such a program.  So, this module is probably useless."
1952
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2544
                $echo
 
2545
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2546
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2547
                $echo "*** not find such a program.  So, this module is probably useless."
 
2548
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
1953
2549
              fi
1954
2550
              if test "$build_old_libs" = no; then
1955
2551
                build_libtool_libs=module
1966
2562
          fi
1967
2563
        fi # link shared/static library?
1968
2564
 
1969
 
        if test $linkmode = lib; then
 
2565
        if test "$linkmode" = lib; then
1970
2566
          if test -n "$dependency_libs" &&
1971
 
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1972
 
               test $link_static = yes; }; then
 
2567
             { test "$hardcode_into_libs" != yes ||
 
2568
               test "$build_old_libs" = yes ||
 
2569
               test "$link_static" = yes; }; then
1973
2570
            # Extract -R from dependency_libs
1974
2571
            temp_deplibs=
1975
2572
            for libdir in $dependency_libs; do
2000
2597
            tmp_libs="$tmp_libs $deplib"
2001
2598
          done
2002
2599
 
2003
 
          if test $link_all_deplibs != no; then
 
2600
          if test "$link_all_deplibs" != no; then
2004
2601
            # Add the search paths of all dependency libraries
2005
2602
            for deplib in $dependency_libs; do
2006
2603
              case $deplib in
2020
2617
                  ;;
2021
2618
                esac
2022
2619
                if grep "^installed=no" $deplib > /dev/null; then
2023
 
                  path="-L$absdir/$objdir"
 
2620
                  path="$absdir/$objdir"
2024
2621
                else
2025
 
                  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
2622
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2026
2623
                  if test -z "$libdir"; then
2027
2624
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2028
 
                    exit 1
 
2625
                    exit $EXIT_FAILURE
2029
2626
                  fi
2030
2627
                  if test "$absdir" != "$libdir"; then
2031
2628
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2032
2629
                  fi
2033
 
                  path="-L$absdir"
 
2630
                  path="$absdir"
2034
2631
                fi
 
2632
                depdepl=
 
2633
                case $host in
 
2634
                *-*-darwin*)
 
2635
                  # we do not want to link against static libs,
 
2636
                  # but need to link against shared
 
2637
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2638
                  if test -n "$deplibrary_names" ; then
 
2639
                    for tmp in $deplibrary_names ; do
 
2640
                      depdepl=$tmp
 
2641
                    done
 
2642
                    if test -f "$path/$depdepl" ; then
 
2643
                      depdepl="$path/$depdepl"
 
2644
                    fi
 
2645
                    # do not add paths which are already there
 
2646
                    case " $newlib_search_path " in
 
2647
                    *" $path "*) ;;
 
2648
                    *) newlib_search_path="$newlib_search_path $path";;
 
2649
                    esac
 
2650
                  fi
 
2651
                  path=""
 
2652
                  ;;
 
2653
                *)
 
2654
                  path="-L$path"
 
2655
                  ;;
 
2656
                esac
 
2657
                ;;
 
2658
              -l*)
 
2659
                case $host in
 
2660
                *-*-darwin*)
 
2661
                  # Again, we only want to link against shared libraries
 
2662
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2663
                  for tmp in $newlib_search_path ; do
 
2664
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2665
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2666
                      break
 
2667
                    fi
 
2668
                  done
 
2669
                  path=""
 
2670
                  ;;
 
2671
                *) continue ;;
 
2672
                esac
2035
2673
                ;;
2036
2674
              *) continue ;;
2037
2675
              esac
2038
2676
              case " $deplibs " in
 
2677
              *" $depdepl "*) ;;
 
2678
              *) deplibs="$depdepl $deplibs" ;;
 
2679
              esac
 
2680
              case " $deplibs " in
2039
2681
              *" $path "*) ;;
2040
2682
              *) deplibs="$deplibs $path" ;;
2041
2683
              esac
2043
2685
          fi # link_all_deplibs != no
2044
2686
        fi # linkmode = lib
2045
2687
      done # for deplib in $libs
2046
 
      if test $pass = dlpreopen; then
 
2688
      dependency_libs="$newdependency_libs"
 
2689
      if test "$pass" = dlpreopen; then
2047
2690
        # Link the dlpreopened libraries before other libraries
2048
2691
        for deplib in $save_deplibs; do
2049
2692
          deplibs="$deplib $deplibs"
2050
2693
        done
2051
2694
      fi
2052
 
      if test $pass != dlopen; then
2053
 
        test $pass != scan && dependency_libs="$newdependency_libs"
2054
 
        if test $pass != conv; then
 
2695
      if test "$pass" != dlopen; then
 
2696
        if test "$pass" != conv; then
2055
2697
          # Make sure lib_search_path contains only unique directories.
2056
2698
          lib_search_path=
2057
2699
          for dir in $newlib_search_path; do
2073
2715
          eval tmp_libs=\"\$$var\"
2074
2716
          new_libs=
2075
2717
          for deplib in $tmp_libs; do
 
2718
            # FIXME: Pedantically, this is the right thing to do, so
 
2719
            #        that some nasty dependency loop isn't accidentally
 
2720
            #        broken:
 
2721
            #new_libs="$deplib $new_libs"
 
2722
            # Pragmatically, this seems to cause very few problems in
 
2723
            # practice:
2076
2724
            case $deplib in
2077
2725
            -L*) new_libs="$deplib $new_libs" ;;
 
2726
            -R*) ;;
2078
2727
            *)
 
2728
              # And here is the reason: when a library appears more
 
2729
              # than once as an explicit dependence of a library, or
 
2730
              # is implicitly linked in more than once by the
 
2731
              # compiler, it is considered special, and multiple
 
2732
              # occurrences thereof are not removed.  Compare this
 
2733
              # with having the same library being listed as a
 
2734
              # dependency of multiple other libraries: in this case,
 
2735
              # we know (pedantically, we assume) the library does not
 
2736
              # need to be listed more than once, so we keep only the
 
2737
              # last copy.  This is not always right, but it is rare
 
2738
              # enough that we require users that really mean to play
 
2739
              # such unportable linking tricks to link the library
 
2740
              # using -Wl,-lname, so that libtool does not consider it
 
2741
              # for duplicate removal.
2079
2742
              case " $specialdeplibs " in
2080
2743
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2081
2744
              *)
2103
2766
          eval $var=\"$tmp_libs\"
2104
2767
        done # for var
2105
2768
      fi
2106
 
      if test "$pass" = "conv" &&
2107
 
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2108
 
        libs="$deplibs" # reset libs
2109
 
        deplibs=
2110
 
      fi
 
2769
      # Last step: remove runtime libs from dependency_libs
 
2770
      # (they stay in deplibs)
 
2771
      tmp_libs=
 
2772
      for i in $dependency_libs ; do
 
2773
        case " $predeps $postdeps $compiler_lib_search_path " in
 
2774
        *" $i "*)
 
2775
          i=""
 
2776
          ;;
 
2777
        esac
 
2778
        if test -n "$i" ; then
 
2779
          tmp_libs="$tmp_libs $i"
 
2780
        fi
 
2781
      done
 
2782
      dependency_libs=$tmp_libs
2111
2783
    done # for pass
2112
 
    if test $linkmode = prog; then
 
2784
    if test "$linkmode" = prog; then
2113
2785
      dlfiles="$newdlfiles"
2114
2786
      dlprefiles="$newdlprefiles"
2115
2787
    fi
2116
2788
 
2117
2789
    case $linkmode in
2118
2790
    oldlib)
 
2791
      if test -n "$deplibs"; then
 
2792
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
 
2793
      fi
 
2794
 
2119
2795
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2120
2796
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2121
2797
      fi
2129
2805
      fi
2130
2806
 
2131
2807
      if test -n "$vinfo"; then
2132
 
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
2808
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2133
2809
      fi
2134
2810
 
2135
2811
      if test -n "$release"; then
2151
2827
      case $outputname in
2152
2828
      lib*)
2153
2829
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
2830
        eval shared_ext=\"$shrext_cmds\"
2154
2831
        eval libname=\"$libname_spec\"
2155
2832
        ;;
2156
2833
      *)
2157
2834
        if test "$module" = no; then
2158
2835
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2159
2836
          $echo "$help" 1>&2
2160
 
          exit 1
 
2837
          exit $EXIT_FAILURE
2161
2838
        fi
2162
2839
        if test "$need_lib_prefix" != no; then
2163
2840
          # Add the "lib" prefix for modules if required
2164
2841
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
2842
          eval shared_ext=\"$shrext_cmds\"
2165
2843
          eval libname=\"$libname_spec\"
2166
2844
        else
2167
2845
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2172
2850
      if test -n "$objs"; then
2173
2851
        if test "$deplibs_check_method" != pass_all; then
2174
2852
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2175
 
          exit 1
 
2853
          exit $EXIT_FAILURE
2176
2854
        else
2177
 
          echo
2178
 
          echo "*** Warning: Linking the shared library $output against the non-libtool"
2179
 
          echo "*** objects $objs is not portable!"
 
2855
          $echo
 
2856
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
2857
          $echo "*** objects $objs is not portable!"
2180
2858
          libobjs="$libobjs $objs"
2181
2859
        fi
2182
2860
      fi
2186
2864
      fi
2187
2865
 
2188
2866
      set dummy $rpath
2189
 
      if test $# -gt 2; then
 
2867
      if test "$#" -gt 2; then
2190
2868
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2191
2869
      fi
2192
2870
      install_libdir="$2"
2195
2873
      if test -z "$rpath"; then
2196
2874
        if test "$build_libtool_libs" = yes; then
2197
2875
          # Building a libtool convenience library.
2198
 
          libext=al
 
2876
          # Some compilers have problems with a `.al' extension so
 
2877
          # convenience libraries should have the same extension an
 
2878
          # archive normally would.
2199
2879
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2200
2880
          build_libtool_libs=convenience
2201
2881
          build_old_libs=yes
2202
2882
        fi
2203
2883
 
2204
2884
        if test -n "$vinfo"; then
2205
 
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
2885
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2206
2886
        fi
2207
2887
 
2208
2888
        if test -n "$release"; then
2218
2898
        if test -n "$8"; then
2219
2899
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2220
2900
          $echo "$help" 1>&2
2221
 
          exit 1
 
2901
          exit $EXIT_FAILURE
2222
2902
        fi
2223
2903
 
2224
 
        current="$2"
2225
 
        revision="$3"
2226
 
        age="$4"
 
2904
        # convert absolute version numbers to libtool ages
 
2905
        # this retains compatibility with .la files and attempts
 
2906
        # to make the code below a bit more comprehensible
 
2907
 
 
2908
        case $vinfo_number in
 
2909
        yes)
 
2910
          number_major="$2"
 
2911
          number_minor="$3"
 
2912
          number_revision="$4"
 
2913
          #
 
2914
          # There are really only two kinds -- those that
 
2915
          # use the current revision as the major version
 
2916
          # and those that subtract age and use age as
 
2917
          # a minor version.  But, then there is irix
 
2918
          # which has an extra 1 added just for fun
 
2919
          #
 
2920
          case $version_type in
 
2921
          darwin|linux|osf|windows)
 
2922
            current=`expr $number_major + $number_minor`
 
2923
            age="$number_minor"
 
2924
            revision="$number_revision"
 
2925
            ;;
 
2926
          freebsd-aout|freebsd-elf|sunos)
 
2927
            current="$number_major"
 
2928
            revision="$number_minor"
 
2929
            age="0"
 
2930
            ;;
 
2931
          irix|nonstopux)
 
2932
            current=`expr $number_major + $number_minor - 1`
 
2933
            age="$number_minor"
 
2934
            revision="$number_minor"
 
2935
            ;;
 
2936
          *)
 
2937
            $echo "$modename: unknown library version type \`$version_type'" 1>&2
 
2938
            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
2939
            exit $EXIT_FAILURE
 
2940
            ;;
 
2941
          esac
 
2942
          ;;
 
2943
        no)
 
2944
          current="$2"
 
2945
          revision="$3"
 
2946
          age="$4"
 
2947
          ;;
 
2948
        esac
2227
2949
 
2228
2950
        # Check that each of the things are valid numbers.
2229
2951
        case $current in
2231
2953
        *)
2232
2954
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2233
2955
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2234
 
          exit 1
 
2956
          exit $EXIT_FAILURE
2235
2957
          ;;
2236
2958
        esac
2237
2959
 
2240
2962
        *)
2241
2963
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2242
2964
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2243
 
          exit 1
 
2965
          exit $EXIT_FAILURE
2244
2966
          ;;
2245
2967
        esac
2246
2968
 
2249
2971
        *)
2250
2972
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2251
2973
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2252
 
          exit 1
 
2974
          exit $EXIT_FAILURE
2253
2975
          ;;
2254
2976
        esac
2255
2977
 
2256
 
        if test $age -gt $current; then
 
2978
        if test "$age" -gt "$current"; then
2257
2979
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2258
2980
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2259
 
          exit 1
 
2981
          exit $EXIT_FAILURE
2260
2982
        fi
2261
2983
 
2262
2984
        # Calculate the version variables.
2287
3009
          ;;
2288
3010
 
2289
3011
        irix | nonstopux)
 
3012
          major=`expr $current - $age + 1`
 
3013
 
2290
3014
          case $version_type in
2291
3015
            nonstopux) verstring_prefix=nonstopux ;;
2292
3016
            *)         verstring_prefix=sgi ;;
2293
3017
          esac
2294
3018
          verstring="$verstring_prefix$major.$revision"
2295
3019
 
2296
 
          major=`expr $current - $age + 1`
2297
 
 
2298
3020
          # Add in all the interfaces that we are compatible with.
2299
3021
          loop=$revision
2300
 
          while test $loop != 0; do
 
3022
          while test "$loop" -ne 0; do
2301
3023
            iface=`expr $revision - $loop`
2302
3024
            loop=`expr $loop - 1`
2303
3025
            verstring="$verstring_prefix$major.$iface:$verstring"
2314
3036
          ;;
2315
3037
 
2316
3038
        osf)
2317
 
          major=`expr $current - $age`
 
3039
          major=.`expr $current - $age`
2318
3040
          versuffix=".$current.$age.$revision"
2319
3041
          verstring="$current.$age.$revision"
2320
3042
 
2321
3043
          # Add in all the interfaces that we are compatible with.
2322
3044
          loop=$age
2323
 
          while test $loop != 0; do
 
3045
          while test "$loop" -ne 0; do
2324
3046
            iface=`expr $current - $loop`
2325
3047
            loop=`expr $loop - 1`
2326
3048
            verstring="$verstring:${iface}.0"
2344
3066
 
2345
3067
        *)
2346
3068
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2347
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2348
 
          exit 1
 
3069
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3070
          exit $EXIT_FAILURE
2349
3071
          ;;
2350
3072
        esac
2351
3073
 
2352
3074
        # Clear the version info if we defaulted, and they specified a release.
2353
3075
        if test -z "$vinfo" && test -n "$release"; then
2354
3076
          major=
2355
 
          verstring="0.0"
2356
3077
          case $version_type in
2357
3078
          darwin)
2358
3079
            # we can't check for "0.0" in archive_cmds due to quoting
2359
3080
            # problems, so we reset it completely
2360
 
            verstring=""
 
3081
            verstring=
2361
3082
            ;;
2362
3083
          *)
2363
3084
            verstring="0.0"
2391
3112
      fi
2392
3113
 
2393
3114
      if test "$mode" != relink; then
2394
 
        # Remove our outputs.
2395
 
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2396
 
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
 
3115
        # Remove our outputs, but don't remove object files since they
 
3116
        # may have been created when compiling PIC objects.
 
3117
        removelist=
 
3118
        tempremovelist=`$echo "$output_objdir/*"`
 
3119
        for p in $tempremovelist; do
 
3120
          case $p in
 
3121
            *.$objext)
 
3122
               ;;
 
3123
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3124
               if test "X$precious_files_regex" != "X"; then
 
3125
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3126
                 then
 
3127
                   continue
 
3128
                 fi
 
3129
               fi
 
3130
               removelist="$removelist $p"
 
3131
               ;;
 
3132
            *) ;;
 
3133
          esac
 
3134
        done
 
3135
        if test -n "$removelist"; then
 
3136
          $show "${rm}r $removelist"
 
3137
          $run ${rm}r $removelist
 
3138
        fi
2397
3139
      fi
2398
3140
 
2399
3141
      # Now set the variables for building old libraries.
2406
3148
 
2407
3149
      # Eliminate all temporary directories.
2408
3150
      for path in $notinst_path; do
2409
 
        lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2410
 
        deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2411
 
        dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
 
3151
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3152
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3153
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2412
3154
      done
2413
3155
 
2414
3156
      if test -n "$xrpath"; then
2421
3163
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2422
3164
          esac
2423
3165
        done
2424
 
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
3166
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2425
3167
          dependency_libs="$temp_xrpath $dependency_libs"
2426
3168
        fi
2427
3169
      fi
2461
3203
            ;;
2462
3204
          *-*-openbsd* | *-*-freebsd*)
2463
3205
            # Do not include libc due to us having libc/libc_r.
 
3206
            test "X$arg" = "X-lc" && continue
2464
3207
            ;;
2465
 
          *)
 
3208
          *)
2466
3209
            # Add libc to deplibs on all other systems if necessary.
2467
 
            if test $build_libtool_need_lc = "yes"; then
 
3210
            if test "$build_libtool_need_lc" = "yes"; then
2468
3211
              deplibs="$deplibs -lc"
2469
3212
            fi
2470
3213
            ;;
2491
3234
          # This might be a little naive.  We might want to check
2492
3235
          # whether the library exists or not.  But this is on
2493
3236
          # osf3 & osf4 and I'm not really sure... Just
2494
 
          # implementing what was already the behaviour.
 
3237
          # implementing what was already the behavior.
2495
3238
          newdeplibs=$deplibs
2496
3239
          ;;
2497
3240
        test_compile)
2504
3247
          int main() { return 0; }
2505
3248
EOF
2506
3249
          $rm conftest
2507
 
          $CC -o conftest conftest.c $deplibs
2508
 
          if test $? -eq 0 ; then
 
3250
          $LTCC -o conftest conftest.c $deplibs
 
3251
          if test "$?" -eq 0 ; then
2509
3252
            ldd_output=`ldd conftest`
2510
3253
            for i in $deplibs; do
2511
3254
              name="`expr $i : '-l\(.*\)'`"
2512
3255
              # If $name is empty we are operating on a -L argument.
2513
 
              if test -n "$name" && test "$name" != "0"; then
2514
 
                libname=`eval \\$echo \"$libname_spec\"`
2515
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2516
 
                set dummy $deplib_matches
2517
 
                deplib_match=$2
2518
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2519
 
                  newdeplibs="$newdeplibs $i"
2520
 
                else
2521
 
                  droppeddeps=yes
2522
 
                  echo
2523
 
                  echo "*** Warning: dynamic linker does not accept needed library $i."
2524
 
                  echo "*** I have the capability to make that library automatically link in when"
2525
 
                  echo "*** you link to this library.  But I can only do this if you have a"
2526
 
                  echo "*** shared version of the library, which I believe you do not have"
2527
 
                  echo "*** because a test_compile did reveal that the linker did not use it for"
2528
 
                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
2529
 
                fi
2530
 
              else
2531
 
                newdeplibs="$newdeplibs $i"
2532
 
              fi
2533
 
            done
2534
 
          else
2535
 
            # Error occured in the first compile.  Let's try to salvage
2536
 
            # the situation: Compile a separate program for each library.
2537
 
            for i in $deplibs; do
2538
 
              name="`expr $i : '-l\(.*\)'`"
2539
 
             # If $name is empty we are operating on a -L argument.
2540
 
              if test -n "$name" && test "$name" != "0"; then
2541
 
                $rm conftest
2542
 
                $CC -o conftest conftest.c $i
2543
 
                # Did it work?
2544
 
                if test $? -eq 0 ; then
2545
 
                  ldd_output=`ldd conftest`
 
3256
              if test "$name" != "" && test "$name" -ne "0"; then
 
3257
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3258
                  case " $predeps $postdeps " in
 
3259
                  *" $i "*)
 
3260
                    newdeplibs="$newdeplibs $i"
 
3261
                    i=""
 
3262
                    ;;
 
3263
                  esac
 
3264
                fi
 
3265
                if test -n "$i" ; then
2546
3266
                  libname=`eval \\$echo \"$libname_spec\"`
2547
3267
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2548
3268
                  set dummy $deplib_matches
2551
3271
                    newdeplibs="$newdeplibs $i"
2552
3272
                  else
2553
3273
                    droppeddeps=yes
2554
 
                    echo
2555
 
                    echo "*** Warning: dynamic linker does not accept needed library $i."
2556
 
                    echo "*** I have the capability to make that library automatically link in when"
2557
 
                    echo "*** you link to this library.  But I can only do this if you have a"
2558
 
                    echo "*** shared version of the library, which you do not appear to have"
2559
 
                    echo "*** because a test_compile did reveal that the linker did not use this one"
2560
 
                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3274
                    $echo
 
3275
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3276
                    $echo "*** I have the capability to make that library automatically link in when"
 
3277
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3278
                    $echo "*** shared version of the library, which I believe you do not have"
 
3279
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3280
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3281
                  fi
 
3282
                fi
 
3283
              else
 
3284
                newdeplibs="$newdeplibs $i"
 
3285
              fi
 
3286
            done
 
3287
          else
 
3288
            # Error occurred in the first compile.  Let's try to salvage
 
3289
            # the situation: Compile a separate program for each library.
 
3290
            for i in $deplibs; do
 
3291
              name="`expr $i : '-l\(.*\)'`"
 
3292
              # If $name is empty we are operating on a -L argument.
 
3293
              if test "$name" != "" && test "$name" != "0"; then
 
3294
                $rm conftest
 
3295
                $LTCC -o conftest conftest.c $i
 
3296
                # Did it work?
 
3297
                if test "$?" -eq 0 ; then
 
3298
                  ldd_output=`ldd conftest`
 
3299
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3300
                    case " $predeps $postdeps " in
 
3301
                    *" $i "*)
 
3302
                      newdeplibs="$newdeplibs $i"
 
3303
                      i=""
 
3304
                      ;;
 
3305
                    esac
 
3306
                  fi
 
3307
                  if test -n "$i" ; then
 
3308
                    libname=`eval \\$echo \"$libname_spec\"`
 
3309
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3310
                    set dummy $deplib_matches
 
3311
                    deplib_match=$2
 
3312
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3313
                      newdeplibs="$newdeplibs $i"
 
3314
                    else
 
3315
                      droppeddeps=yes
 
3316
                      $echo
 
3317
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3318
                      $echo "*** I have the capability to make that library automatically link in when"
 
3319
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3320
                      $echo "*** shared version of the library, which you do not appear to have"
 
3321
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3322
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3323
                    fi
2561
3324
                  fi
2562
3325
                else
2563
3326
                  droppeddeps=yes
2564
 
                  echo
2565
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2566
 
                  echo "***  make it link in!  You will probably need to install it or some"
2567
 
                  echo "*** library that it depends on before this library will be fully"
2568
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3327
                  $echo
 
3328
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3329
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3330
                  $echo "*** library that it depends on before this library will be fully"
 
3331
                  $echo "*** functional.  Installing it before continuing would be even better."
2569
3332
                fi
2570
3333
              else
2571
3334
                newdeplibs="$newdeplibs $i"
2579
3342
          for a_deplib in $deplibs; do
2580
3343
            name="`expr $a_deplib : '-l\(.*\)'`"
2581
3344
            # If $name is empty we are operating on a -L argument.
2582
 
            if test -n "$name" && test "$name" != "0"; then
2583
 
              libname=`eval \\$echo \"$libname_spec\"`
2584
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2585
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2586
 
                    for potent_lib in $potential_libs; do
 
3345
            if test "$name" != "" && test  "$name" != "0"; then
 
3346
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3347
                case " $predeps $postdeps " in
 
3348
                *" $a_deplib "*)
 
3349
                  newdeplibs="$newdeplibs $a_deplib"
 
3350
                  a_deplib=""
 
3351
                  ;;
 
3352
                esac
 
3353
              fi
 
3354
              if test -n "$a_deplib" ; then
 
3355
                libname=`eval \\$echo \"$libname_spec\"`
 
3356
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3357
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3358
                  for potent_lib in $potential_libs; do
2587
3359
                      # Follow soft links.
2588
3360
                      if ls -lLd "$potent_lib" 2>/dev/null \
2589
3361
                         | grep " -> " >/dev/null; then
2596
3368
                      # but so what?
2597
3369
                      potlib="$potent_lib"
2598
3370
                      while test -h "$potlib" 2>/dev/null; do
2599
 
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
 
3371
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2600
3372
                        case $potliblink in
2601
3373
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2602
3374
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2603
3375
                        esac
2604
3376
                      done
2605
3377
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2606
 
                         | sed 10q \
2607
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3378
                         | ${SED} 10q \
 
3379
                         | $EGREP "$file_magic_regex" > /dev/null; then
2608
3380
                        newdeplibs="$newdeplibs $a_deplib"
2609
3381
                        a_deplib=""
2610
3382
                        break 2
2611
3383
                      fi
2612
 
                    done
2613
 
              done
 
3384
                  done
 
3385
                done
 
3386
              fi
2614
3387
              if test -n "$a_deplib" ; then
2615
3388
                droppeddeps=yes
2616
 
                echo
2617
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2618
 
                echo "*** I have the capability to make that library automatically link in when"
2619
 
                echo "*** you link to this library.  But I can only do this if you have a"
2620
 
                echo "*** shared version of the library, which you do not appear to have"
2621
 
                echo "*** because I did check the linker path looking for a file starting"
 
3389
                $echo
 
3390
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3391
                $echo "*** I have the capability to make that library automatically link in when"
 
3392
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3393
                $echo "*** shared version of the library, which you do not appear to have"
 
3394
                $echo "*** because I did check the linker path looking for a file starting"
2622
3395
                if test -z "$potlib" ; then
2623
 
                  echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3396
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
2624
3397
                else
2625
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2626
 
                  echo "*** using a file magic. Last file checked: $potlib"
 
3398
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3399
                  $echo "*** using a file magic. Last file checked: $potlib"
2627
3400
                fi
2628
3401
              fi
2629
3402
            else
2639
3412
            name="`expr $a_deplib : '-l\(.*\)'`"
2640
3413
            # If $name is empty we are operating on a -L argument.
2641
3414
            if test -n "$name" && test "$name" != "0"; then
2642
 
              libname=`eval \\$echo \"$libname_spec\"`
2643
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2644
 
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2645
 
                for potent_lib in $potential_libs; do
2646
 
                  potlib="$potent_lib" # see symlink-check below in file_magic test
2647
 
                  if eval echo \"$potent_lib\" 2>/dev/null \
2648
 
                      | sed 10q \
2649
 
                      | egrep "$match_pattern_regex" > /dev/null; then
2650
 
                    newdeplibs="$newdeplibs $a_deplib"
2651
 
                    a_deplib=""
2652
 
                    break 2
2653
 
                  fi
 
3415
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3416
                case " $predeps $postdeps " in
 
3417
                *" $a_deplib "*)
 
3418
                  newdeplibs="$newdeplibs $a_deplib"
 
3419
                  a_deplib=""
 
3420
                  ;;
 
3421
                esac
 
3422
              fi
 
3423
              if test -n "$a_deplib" ; then
 
3424
                libname=`eval \\$echo \"$libname_spec\"`
 
3425
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3426
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3427
                  for potent_lib in $potential_libs; do
 
3428
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3429
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3430
                        | ${SED} 10q \
 
3431
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3432
                      newdeplibs="$newdeplibs $a_deplib"
 
3433
                      a_deplib=""
 
3434
                      break 2
 
3435
                    fi
 
3436
                  done
2654
3437
                done
2655
 
              done
 
3438
              fi
2656
3439
              if test -n "$a_deplib" ; then
2657
3440
                droppeddeps=yes
2658
 
                echo
2659
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2660
 
                echo "*** I have the capability to make that library automatically link in when"
2661
 
                echo "*** you link to this library.  But I can only do this if you have a"
2662
 
                echo "*** shared version of the library, which you do not appear to have"
2663
 
                echo "*** because I did check the linker path looking for a file starting"
 
3441
                $echo
 
3442
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3443
                $echo "*** I have the capability to make that library automatically link in when"
 
3444
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3445
                $echo "*** shared version of the library, which you do not appear to have"
 
3446
                $echo "*** because I did check the linker path looking for a file starting"
2664
3447
                if test -z "$potlib" ; then
2665
 
                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3448
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2666
3449
                else
2667
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2668
 
                  echo "*** using a regex pattern. Last file checked: $potlib"
 
3450
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3451
                  $echo "*** using a regex pattern. Last file checked: $potlib"
2669
3452
                fi
2670
3453
              fi
2671
3454
            else
2676
3459
          ;;
2677
3460
        none | unknown | *)
2678
3461
          newdeplibs=""
2679
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2680
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2681
 
             grep . >/dev/null; then
2682
 
            echo
 
3462
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3463
            -e 's/ -[LR][^ ]*//g'`
 
3464
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3465
            for i in $predeps $postdeps ; do
 
3466
              # can't use Xsed below, because $i might contain '/'
 
3467
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3468
            done
 
3469
          fi
 
3470
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3471
            | grep . >/dev/null; then
 
3472
            $echo
2683
3473
            if test "X$deplibs_check_method" = "Xnone"; then
2684
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3474
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2685
3475
            else
2686
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3476
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2687
3477
            fi
2688
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3478
            $echo "*** All declared inter-library dependencies are being dropped."
2689
3479
            droppeddeps=yes
2690
3480
          fi
2691
3481
          ;;
2705
3495
 
2706
3496
        if test "$droppeddeps" = yes; then
2707
3497
          if test "$module" = yes; then
2708
 
            echo
2709
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2710
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2711
 
            echo "*** a static module, that should work as long as the dlopening"
2712
 
            echo "*** application is linked with the -dlopen flag."
 
3498
            $echo
 
3499
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3500
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3501
            $echo "*** a static module, that should work as long as the dlopening"
 
3502
            $echo "*** application is linked with the -dlopen flag."
2713
3503
            if test -z "$global_symbol_pipe"; then
2714
 
              echo
2715
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2716
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2717
 
              echo "*** not find such a program.  So, this module is probably useless."
2718
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3504
              $echo
 
3505
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3506
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3507
              $echo "*** not find such a program.  So, this module is probably useless."
 
3508
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2719
3509
            fi
2720
3510
            if test "$build_old_libs" = no; then
2721
3511
              oldlibs="$output_objdir/$libname.$libext"
2725
3515
              build_libtool_libs=no
2726
3516
            fi
2727
3517
          else
2728
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2729
 
            echo "*** automatically added whenever a program is linked with this library"
2730
 
            echo "*** or is declared to -dlopen it."
 
3518
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3519
            $echo "*** automatically added whenever a program is linked with this library"
 
3520
            $echo "*** or is declared to -dlopen it."
2731
3521
 
2732
 
            if test $allow_undefined = no; then
2733
 
              echo
2734
 
              echo "*** Since this library must not contain undefined symbols,"
2735
 
              echo "*** because either the platform does not support them or"
2736
 
              echo "*** it was explicitly requested with -no-undefined,"
2737
 
              echo "*** libtool will only create a static version of it."
 
3522
            if test "$allow_undefined" = no; then
 
3523
              $echo
 
3524
              $echo "*** Since this library must not contain undefined symbols,"
 
3525
              $echo "*** because either the platform does not support them or"
 
3526
              $echo "*** it was explicitly requested with -no-undefined,"
 
3527
              $echo "*** libtool will only create a static version of it."
2738
3528
              if test "$build_old_libs" = no; then
2739
3529
                oldlibs="$output_objdir/$libname.$libext"
2740
3530
                build_libtool_libs=module
2756
3546
 
2757
3547
      # Test again, we may have decided not to build it any more
2758
3548
      if test "$build_libtool_libs" = yes; then
2759
 
        if test $hardcode_into_libs = yes; then
 
3549
        if test "$hardcode_into_libs" = yes; then
2760
3550
          # Hardcode the library paths
2761
3551
          hardcode_libdirs=
2762
3552
          dep_rpath=
2792
3582
          if test -n "$hardcode_libdir_separator" &&
2793
3583
             test -n "$hardcode_libdirs"; then
2794
3584
            libdir="$hardcode_libdirs"
2795
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3585
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3586
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3587
            else
 
3588
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3589
            fi
2796
3590
          fi
2797
3591
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2798
3592
            # We should set the runpath_var.
2812
3606
        fi
2813
3607
 
2814
3608
        # Get the real and link names of the library.
 
3609
        eval shared_ext=\"$shrext_cmds\"
2815
3610
        eval library_names=\"$library_names_spec\"
2816
3611
        set dummy $library_names
2817
3612
        realname="$2"
2822
3617
        else
2823
3618
          soname="$realname"
2824
3619
        fi
2825
 
        test -z "$dlname" && dlname=$soname
 
3620
        if test -z "$dlname"; then
 
3621
          dlname=$soname
 
3622
        fi
2826
3623
 
2827
3624
        lib="$output_objdir/$realname"
2828
3625
        for link
2830
3627
          linknames="$linknames $link"
2831
3628
        done
2832
3629
 
2833
 
        # Ensure that we have .o objects for linkers which dislike .lo
2834
 
        # (e.g. aix) in case we are running --disable-static
2835
 
        for obj in $libobjs; do
2836
 
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2837
 
          if test "X$xdir" = "X$obj"; then
2838
 
            xdir="."
2839
 
          else
2840
 
            xdir="$xdir"
2841
 
          fi
2842
 
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2843
 
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2844
 
          if test ! -f $xdir/$oldobj; then
2845
 
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2846
 
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2847
 
          fi
2848
 
        done
2849
 
 
2850
3630
        # Use standard objects if they are pic
2851
3631
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2852
3632
 
2856
3636
            $show "generating symbol list for \`$libname.la'"
2857
3637
            export_symbols="$output_objdir/$libname.exp"
2858
3638
            $run $rm $export_symbols
2859
 
            eval cmds=\"$export_symbols_cmds\"
 
3639
            cmds=$export_symbols_cmds
2860
3640
            save_ifs="$IFS"; IFS='~'
2861
3641
            for cmd in $cmds; do
2862
3642
              IFS="$save_ifs"
2863
 
              $show "$cmd"
2864
 
              $run eval "$cmd" || exit $?
 
3643
              eval cmd=\"$cmd\"
 
3644
              if len=`expr "X$cmd" : ".*"` &&
 
3645
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3646
                $show "$cmd"
 
3647
                $run eval "$cmd" || exit $?
 
3648
                skipped_export=false
 
3649
              else
 
3650
                # The command line is too long to execute in one step.
 
3651
                $show "using reloadable object file for export list..."
 
3652
                skipped_export=:
 
3653
              fi
2865
3654
            done
2866
3655
            IFS="$save_ifs"
2867
3656
            if test -n "$export_symbols_regex"; then
2868
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2869
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
3657
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3658
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2870
3659
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2871
3660
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2872
3661
            fi
2877
3666
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2878
3667
        fi
2879
3668
 
 
3669
        tmp_deplibs=
 
3670
        for test_deplib in $deplibs; do
 
3671
                case " $convenience " in
 
3672
                *" $test_deplib "*) ;;
 
3673
                *)
 
3674
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3675
                        ;;
 
3676
                esac
 
3677
        done
 
3678
        deplibs="$tmp_deplibs"
 
3679
 
2880
3680
        if test -n "$convenience"; then
2881
3681
          if test -n "$whole_archive_flag_spec"; then
 
3682
            save_libobjs=$libobjs
2882
3683
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2883
3684
          else
2884
3685
            gentop="$output_objdir/${outputname}x"
2885
3686
            $show "${rm}r $gentop"
2886
3687
            $run ${rm}r "$gentop"
2887
 
            $show "mkdir $gentop"
2888
 
            $run mkdir "$gentop"
 
3688
            $show "$mkdir $gentop"
 
3689
            $run $mkdir "$gentop"
2889
3690
            status=$?
2890
 
            if test $status -ne 0 && test ! -d "$gentop"; then
 
3691
            if test "$status" -ne 0 && test ! -d "$gentop"; then
2891
3692
              exit $status
2892
3693
            fi
2893
3694
            generated="$generated $gentop"
2903
3704
 
2904
3705
              $show "${rm}r $xdir"
2905
3706
              $run ${rm}r "$xdir"
2906
 
              $show "mkdir $xdir"
2907
 
              $run mkdir "$xdir"
 
3707
              $show "$mkdir $xdir"
 
3708
              $run $mkdir "$xdir"
2908
3709
              status=$?
2909
 
              if test $status -ne 0 && test ! -d "$xdir"; then
 
3710
              if test "$status" -ne 0 && test ! -d "$xdir"; then
2910
3711
                exit $status
2911
3712
              fi
 
3713
              # We will extract separately just the conflicting names and we will no
 
3714
              # longer touch any unique names. It is faster to leave these extract
 
3715
              # automatically by $AR in one run.
2912
3716
              $show "(cd $xdir && $AR x $xabs)"
2913
3717
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
3718
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
3719
                :
 
3720
              else
 
3721
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
3722
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
3723
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
3724
                do
 
3725
                  i=1
 
3726
                  while test "$i" -le "$count"
 
3727
                  do
 
3728
                   # Put our $i before any first dot (extension)
 
3729
                   # Never overwrite any file
 
3730
                   name_to="$name"
 
3731
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
3732
                   do
 
3733
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
3734
                   done
 
3735
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
3736
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
3737
                   i=`expr $i + 1`
 
3738
                  done
 
3739
                done
 
3740
              fi
2914
3741
 
2915
 
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
 
3742
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2916
3743
            done
2917
3744
          fi
2918
3745
        fi
2928
3755
        fi
2929
3756
 
2930
3757
        # Do each of the archive commands.
 
3758
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3759
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3760
            eval test_cmds=\"$module_expsym_cmds\"
 
3761
            cmds=$module_expsym_cmds
 
3762
          else
 
3763
            eval test_cmds=\"$module_cmds\"
 
3764
            cmds=$module_cmds
 
3765
          fi
 
3766
        else
2931
3767
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2932
 
          eval cmds=\"$archive_expsym_cmds\"
2933
 
        else
2934
 
          eval cmds=\"$archive_cmds\"
 
3768
          eval test_cmds=\"$archive_expsym_cmds\"
 
3769
          cmds=$archive_expsym_cmds
 
3770
        else
 
3771
          eval test_cmds=\"$archive_cmds\"
 
3772
          cmds=$archive_cmds
 
3773
          fi
 
3774
        fi
 
3775
 
 
3776
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
3777
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3778
          :
 
3779
        else
 
3780
          # The command line is too long to link in one step, link piecewise.
 
3781
          $echo "creating reloadable object files..."
 
3782
 
 
3783
          # Save the value of $output and $libobjs because we want to
 
3784
          # use them later.  If we have whole_archive_flag_spec, we
 
3785
          # want to use save_libobjs as it was before
 
3786
          # whole_archive_flag_spec was expanded, because we can't
 
3787
          # assume the linker understands whole_archive_flag_spec.
 
3788
          # This may have to be revisited, in case too many
 
3789
          # convenience libraries get linked in and end up exceeding
 
3790
          # the spec.
 
3791
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
3792
            save_libobjs=$libobjs
 
3793
          fi
 
3794
          save_output=$output
 
3795
 
 
3796
          # Clear the reloadable object creation command queue and
 
3797
          # initialize k to one.
 
3798
          test_cmds=
 
3799
          concat_cmds=
 
3800
          objlist=
 
3801
          delfiles=
 
3802
          last_robj=
 
3803
          k=1
 
3804
          output=$output_objdir/$save_output-${k}.$objext
 
3805
          # Loop over the list of objects to be linked.
 
3806
          for obj in $save_libobjs
 
3807
          do
 
3808
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3809
            if test "X$objlist" = X ||
 
3810
               { len=`expr "X$test_cmds" : ".*"` &&
 
3811
                 test "$len" -le "$max_cmd_len"; }; then
 
3812
              objlist="$objlist $obj"
 
3813
            else
 
3814
              # The command $test_cmds is almost too long, add a
 
3815
              # command to the queue.
 
3816
              if test "$k" -eq 1 ; then
 
3817
                # The first file doesn't have a previous command to add.
 
3818
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3819
              else
 
3820
                # All subsequent reloadable object files will link in
 
3821
                # the last one created.
 
3822
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
 
3823
              fi
 
3824
              last_robj=$output_objdir/$save_output-${k}.$objext
 
3825
              k=`expr $k + 1`
 
3826
              output=$output_objdir/$save_output-${k}.$objext
 
3827
              objlist=$obj
 
3828
              len=1
 
3829
            fi
 
3830
          done
 
3831
          # Handle the remaining objects by creating one last
 
3832
          # reloadable object file.  All subsequent reloadable object
 
3833
          # files will link in the last one created.
 
3834
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
3835
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3836
 
 
3837
          if ${skipped_export-false}; then
 
3838
            $show "generating symbol list for \`$libname.la'"
 
3839
            export_symbols="$output_objdir/$libname.exp"
 
3840
            $run $rm $export_symbols
 
3841
            libobjs=$output
 
3842
            # Append the command to create the export file.
 
3843
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3844
          fi
 
3845
 
 
3846
          # Set up a command to remove the reloadale object files
 
3847
          # after they are used.
 
3848
          i=0
 
3849
          while test "$i" -lt "$k"
 
3850
          do
 
3851
            i=`expr $i + 1`
 
3852
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
3853
          done
 
3854
 
 
3855
          $echo "creating a temporary reloadable object file: $output"
 
3856
 
 
3857
          # Loop through the commands generated above and execute them.
 
3858
          save_ifs="$IFS"; IFS='~'
 
3859
          for cmd in $concat_cmds; do
 
3860
            IFS="$save_ifs"
 
3861
            $show "$cmd"
 
3862
            $run eval "$cmd" || exit $?
 
3863
          done
 
3864
          IFS="$save_ifs"
 
3865
 
 
3866
          libobjs=$output
 
3867
          # Restore the value of output.
 
3868
          output=$save_output
 
3869
 
 
3870
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
3871
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
3872
          fi
 
3873
          # Expand the library linking commands again to reset the
 
3874
          # value of $libobjs for piecewise linking.
 
3875
 
 
3876
          # Do each of the archive commands.
 
3877
          if test "$module" = yes && test -n "$module_cmds" ; then
 
3878
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3879
              cmds=$module_expsym_cmds
 
3880
            else
 
3881
              cmds=$module_cmds
 
3882
            fi
 
3883
          else
 
3884
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
3885
            cmds=$archive_expsym_cmds
 
3886
          else
 
3887
            cmds=$archive_cmds
 
3888
            fi
 
3889
          fi
 
3890
 
 
3891
          # Append the command to remove the reloadable object files
 
3892
          # to the just-reset $cmds.
 
3893
          eval cmds=\"\$cmds~\$rm $delfiles\"
2935
3894
        fi
2936
3895
        save_ifs="$IFS"; IFS='~'
2937
3896
        for cmd in $cmds; do
2938
3897
          IFS="$save_ifs"
 
3898
          eval cmd=\"$cmd\"
2939
3899
          $show "$cmd"
2940
3900
          $run eval "$cmd" || exit $?
2941
3901
        done
2944
3904
        # Restore the uninstalled library and exit
2945
3905
        if test "$mode" = relink; then
2946
3906
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2947
 
          exit 0
 
3907
          exit $EXIT_SUCCESS
2948
3908
        fi
2949
3909
 
2950
3910
        # Create links to the real library.
2992
3952
      *.lo)
2993
3953
        if test -n "$objs$old_deplibs"; then
2994
3954
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2995
 
          exit 1
 
3955
          exit $EXIT_FAILURE
2996
3956
        fi
2997
3957
        libobj="$output"
2998
3958
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3023
3983
          gentop="$output_objdir/${obj}x"
3024
3984
          $show "${rm}r $gentop"
3025
3985
          $run ${rm}r "$gentop"
3026
 
          $show "mkdir $gentop"
3027
 
          $run mkdir "$gentop"
 
3986
          $show "$mkdir $gentop"
 
3987
          $run $mkdir "$gentop"
3028
3988
          status=$?
3029
 
          if test $status -ne 0 && test ! -d "$gentop"; then
 
3989
          if test "$status" -ne 0 && test ! -d "$gentop"; then
3030
3990
            exit $status
3031
3991
          fi
3032
3992
          generated="$generated $gentop"
3042
4002
 
3043
4003
            $show "${rm}r $xdir"
3044
4004
            $run ${rm}r "$xdir"
3045
 
            $show "mkdir $xdir"
3046
 
            $run mkdir "$xdir"
 
4005
            $show "$mkdir $xdir"
 
4006
            $run $mkdir "$xdir"
3047
4007
            status=$?
3048
 
            if test $status -ne 0 && test ! -d "$xdir"; then
 
4008
            if test "$status" -ne 0 && test ! -d "$xdir"; then
3049
4009
              exit $status
3050
4010
            fi
 
4011
            # We will extract separately just the conflicting names and we will no
 
4012
            # longer touch any unique names. It is faster to leave these extract
 
4013
            # automatically by $AR in one run.
3051
4014
            $show "(cd $xdir && $AR x $xabs)"
3052
4015
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
4016
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
4017
              :
 
4018
            else
 
4019
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
4020
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
4021
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
4022
              do
 
4023
                i=1
 
4024
                while test "$i" -le "$count"
 
4025
                do
 
4026
                 # Put our $i before any first dot (extension)
 
4027
                 # Never overwrite any file
 
4028
                 name_to="$name"
 
4029
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
4030
                 do
 
4031
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
4032
                 done
 
4033
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
4034
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
4035
                 i=`expr $i + 1`
 
4036
                done
 
4037
              done
 
4038
            fi
3053
4039
 
3054
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
 
4040
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3055
4041
          done
3056
4042
        fi
3057
4043
      fi
3060
4046
      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
3061
4047
 
3062
4048
      output="$obj"
3063
 
      eval cmds=\"$reload_cmds\"
 
4049
      cmds=$reload_cmds
3064
4050
      save_ifs="$IFS"; IFS='~'
3065
4051
      for cmd in $cmds; do
3066
4052
        IFS="$save_ifs"
 
4053
        eval cmd=\"$cmd\"
3067
4054
        $show "$cmd"
3068
4055
        $run eval "$cmd" || exit $?
3069
4056
      done
3076
4063
          $run ${rm}r $gentop
3077
4064
        fi
3078
4065
 
3079
 
        exit 0
 
4066
        exit $EXIT_SUCCESS
3080
4067
      fi
3081
4068
 
3082
4069
      if test "$build_libtool_libs" != yes; then
3087
4074
 
3088
4075
        # Create an invalid libtool object if no PIC, so that we don't
3089
4076
        # accidentally link it into a program.
3090
 
        $show "echo timestamp > $libobj"
3091
 
        $run eval "echo timestamp > $libobj" || exit $?
3092
 
        exit 0
 
4077
        # $show "echo timestamp > $libobj"
 
4078
        # $run eval "echo timestamp > $libobj" || exit $?
 
4079
        exit $EXIT_SUCCESS
3093
4080
      fi
3094
4081
 
3095
4082
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3096
4083
        # Only do commands if we really have different PIC objects.
3097
4084
        reload_objs="$libobjs $reload_conv_objs"
3098
4085
        output="$libobj"
3099
 
        eval cmds=\"$reload_cmds\"
 
4086
        cmds=$reload_cmds
3100
4087
        save_ifs="$IFS"; IFS='~'
3101
4088
        for cmd in $cmds; do
3102
4089
          IFS="$save_ifs"
 
4090
          eval cmd=\"$cmd\"
3103
4091
          $show "$cmd"
3104
4092
          $run eval "$cmd" || exit $?
3105
4093
        done
3106
4094
        IFS="$save_ifs"
3107
 
      else
3108
 
        # Just create a symlink.
3109
 
        $show $rm $libobj
3110
 
        $run $rm $libobj
3111
 
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3112
 
        if test "X$xdir" = "X$libobj"; then
3113
 
          xdir="."
3114
 
        else
3115
 
          xdir="$xdir"
3116
 
        fi
3117
 
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3118
 
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3119
 
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3120
 
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3121
4095
      fi
3122
4096
 
3123
4097
      if test -n "$gentop"; then
3125
4099
        $run ${rm}r $gentop
3126
4100
      fi
3127
4101
 
3128
 
      exit 0
 
4102
      exit $EXIT_SUCCESS
3129
4103
      ;;
3130
4104
 
3131
4105
    prog)
3132
4106
      case $host in
3133
 
        *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
 
4107
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3134
4108
      esac
3135
4109
      if test -n "$vinfo"; then
3136
4110
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3155
4129
        ;;
3156
4130
      esac
3157
4131
 
 
4132
      case $host in
 
4133
      *darwin*)
 
4134
        # Don't allow lazy linking, it breaks C++ global constructors
 
4135
        if test "$tagname" = CXX ; then
 
4136
        compile_command="$compile_command ${wl}-bind_at_load"
 
4137
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4138
        fi
 
4139
        ;;
 
4140
      esac
 
4141
 
3158
4142
      compile_command="$compile_command $compile_deplibs"
3159
4143
      finalize_command="$finalize_command $finalize_deplibs"
3160
4144
 
3305
4289
            done
3306
4290
 
3307
4291
            if test -n "$exclude_expsyms"; then
3308
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4292
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3309
4293
              $run eval '$mv "$nlist"T "$nlist"'
3310
4294
            fi
3311
4295
 
3312
4296
            if test -n "$export_symbols_regex"; then
3313
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4297
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3314
4298
              $run eval '$mv "$nlist"T "$nlist"'
3315
4299
            fi
3316
4300
 
3318
4302
            if test -z "$export_symbols"; then
3319
4303
              export_symbols="$output_objdir/$output.exp"
3320
4304
              $run $rm $export_symbols
3321
 
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4305
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3322
4306
            else
3323
 
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
 
4307
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3324
4308
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3325
4309
              $run eval 'mv "$nlist"T "$nlist"'
3326
4310
            fi
3328
4312
 
3329
4313
          for arg in $dlprefiles; do
3330
4314
            $show "extracting global C symbols from \`$arg'"
3331
 
            name=`echo "$arg" | sed -e 's%^.*/%%'`
3332
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4315
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4316
            $run eval '$echo ": $name " >> "$nlist"'
3333
4317
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3334
4318
          done
3335
4319
 
3338
4322
            test -f "$nlist" || : > "$nlist"
3339
4323
 
3340
4324
            if test -n "$exclude_expsyms"; then
3341
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4325
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3342
4326
              $mv "$nlist"T "$nlist"
3343
4327
            fi
3344
4328
 
3345
4329
            # Try sorting and uniquifying the output.
3346
 
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
4330
            if grep -v "^: " < "$nlist" |
 
4331
                if sort -k 3 </dev/null >/dev/null 2>&1; then
 
4332
                  sort -k 3
 
4333
                else
 
4334
                  sort +2
 
4335
                fi |
 
4336
                uniq > "$nlist"S; then
3347
4337
              :
3348
4338
            else
3349
4339
              grep -v "^: " < "$nlist" > "$nlist"S
3352
4342
            if test -f "$nlist"S; then
3353
4343
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3354
4344
            else
3355
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4345
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3356
4346
            fi
3357
4347
 
3358
4348
            $echo >> "$output_objdir/$dlsyms" "\
3404
4394
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3405
4395
            case "$compile_command " in
3406
4396
            *" -static "*) ;;
3407
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4397
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3408
4398
            esac;;
3409
4399
          *-*-hpux*)
3410
4400
            case "$compile_command " in
3411
4401
            *" -static "*) ;;
3412
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4402
            *) pic_flag_for_symtable=" $pic_flag";;
3413
4403
            esac
3414
4404
          esac
3415
4405
 
3416
4406
          # Now compile the dynamic symbol file.
3417
 
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3418
 
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4407
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4408
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3419
4409
 
3420
4410
          # Clean up the generated files.
3421
4411
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3427
4417
          ;;
3428
4418
        *)
3429
4419
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3430
 
          exit 1
 
4420
          exit $EXIT_FAILURE
3431
4421
          ;;
3432
4422
        esac
3433
4423
      else
3440
4430
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3441
4431
      fi
3442
4432
 
3443
 
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
4433
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3444
4434
        # Replace the output file specification.
3445
4435
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3446
4436
        link_command="$compile_command$compile_rpath"
3515
4505
        # Link the executable and exit
3516
4506
        $show "$link_command"
3517
4507
        $run eval "$link_command" || exit $?
3518
 
        exit 0
 
4508
        exit $EXIT_SUCCESS
3519
4509
      fi
3520
4510
 
3521
4511
      if test "$hardcode_action" = relink; then
3570
4560
      fi
3571
4561
 
3572
4562
      # Quote $echo for shipping.
3573
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3574
 
        case $0 in
3575
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3576
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4563
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4564
        case $progpath in
 
4565
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4566
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
3577
4567
        esac
3578
4568
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3579
4569
      else
3585
4575
        # win32 will think the script is a binary if it has
3586
4576
        # a .exe suffix, so we strip it off here.
3587
4577
        case $output in
3588
 
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
4578
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3589
4579
        esac
3590
4580
        # test for cygwin because mv fails w/o .exe extensions
3591
4581
        case $host in
3592
 
          *cygwin*) exeext=.exe ;;
 
4582
          *cygwin*)
 
4583
            exeext=.exe
 
4584
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3593
4585
          *) exeext= ;;
3594
4586
        esac
 
4587
        case $host in
 
4588
          *cygwin* | *mingw* )
 
4589
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
 
4590
            cwrapper=`$echo ${output}.exe`
 
4591
            $rm $cwrappersource $cwrapper
 
4592
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4593
 
 
4594
            cat > $cwrappersource <<EOF
 
4595
 
 
4596
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4597
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4598
 
 
4599
   The $output program cannot be directly executed until all the libtool
 
4600
   libraries that it depends on are installed.
 
4601
 
 
4602
   This wrapper executable should never be moved out of the build directory.
 
4603
   If it is, it will not operate correctly.
 
4604
 
 
4605
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4606
   but could eventually absorb all of the scripts functionality and
 
4607
   exec $objdir/$outputname directly.
 
4608
*/
 
4609
EOF
 
4610
            cat >> $cwrappersource<<"EOF"
 
4611
#include <stdio.h>
 
4612
#include <stdlib.h>
 
4613
#include <unistd.h>
 
4614
#include <malloc.h>
 
4615
#include <stdarg.h>
 
4616
#include <assert.h>
 
4617
 
 
4618
#if defined(PATH_MAX)
 
4619
# define LT_PATHMAX PATH_MAX
 
4620
#elif defined(MAXPATHLEN)
 
4621
# define LT_PATHMAX MAXPATHLEN
 
4622
#else
 
4623
# define LT_PATHMAX 1024
 
4624
#endif
 
4625
 
 
4626
#ifndef DIR_SEPARATOR
 
4627
#define DIR_SEPARATOR '/'
 
4628
#endif
 
4629
 
 
4630
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4631
  defined (__OS2__)
 
4632
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4633
#ifndef DIR_SEPARATOR_2
 
4634
#define DIR_SEPARATOR_2 '\\'
 
4635
#endif
 
4636
#endif
 
4637
 
 
4638
#ifndef DIR_SEPARATOR_2
 
4639
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4640
#else /* DIR_SEPARATOR_2 */
 
4641
# define IS_DIR_SEPARATOR(ch) \
 
4642
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4643
#endif /* DIR_SEPARATOR_2 */
 
4644
 
 
4645
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4646
#define XFREE(stale) do { \
 
4647
  if (stale) { free ((void *) stale); stale = 0; } \
 
4648
} while (0)
 
4649
 
 
4650
const char *program_name = NULL;
 
4651
 
 
4652
void * xmalloc (size_t num);
 
4653
char * xstrdup (const char *string);
 
4654
char * basename (const char *name);
 
4655
char * fnqualify(const char *path);
 
4656
char * strendzap(char *str, const char *pat);
 
4657
void lt_fatal (const char *message, ...);
 
4658
 
 
4659
int
 
4660
main (int argc, char *argv[])
 
4661
{
 
4662
  char **newargz;
 
4663
  int i;
 
4664
 
 
4665
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4666
  newargz = XMALLOC(char *, argc+2);
 
4667
EOF
 
4668
 
 
4669
            cat >> $cwrappersource <<EOF
 
4670
  newargz[0] = "$SHELL";
 
4671
EOF
 
4672
 
 
4673
            cat >> $cwrappersource <<"EOF"
 
4674
  newargz[1] = fnqualify(argv[0]);
 
4675
  /* we know the script has the same name, without the .exe */
 
4676
  /* so make sure newargz[1] doesn't end in .exe */
 
4677
  strendzap(newargz[1],".exe");
 
4678
  for (i = 1; i < argc; i++)
 
4679
    newargz[i+1] = xstrdup(argv[i]);
 
4680
  newargz[argc+1] = NULL;
 
4681
EOF
 
4682
 
 
4683
            cat >> $cwrappersource <<EOF
 
4684
  execv("$SHELL",newargz);
 
4685
EOF
 
4686
 
 
4687
            cat >> $cwrappersource <<"EOF"
 
4688
}
 
4689
 
 
4690
void *
 
4691
xmalloc (size_t num)
 
4692
{
 
4693
  void * p = (void *) malloc (num);
 
4694
  if (!p)
 
4695
    lt_fatal ("Memory exhausted");
 
4696
 
 
4697
  return p;
 
4698
}
 
4699
 
 
4700
char *
 
4701
xstrdup (const char *string)
 
4702
{
 
4703
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4704
;
 
4705
}
 
4706
 
 
4707
char *
 
4708
basename (const char *name)
 
4709
{
 
4710
  const char *base;
 
4711
 
 
4712
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4713
  /* Skip over the disk name in MSDOS pathnames. */
 
4714
  if (isalpha (name[0]) && name[1] == ':')
 
4715
    name += 2;
 
4716
#endif
 
4717
 
 
4718
  for (base = name; *name; name++)
 
4719
    if (IS_DIR_SEPARATOR (*name))
 
4720
      base = name + 1;
 
4721
  return (char *) base;
 
4722
}
 
4723
 
 
4724
char *
 
4725
fnqualify(const char *path)
 
4726
{
 
4727
  size_t size;
 
4728
  char *p;
 
4729
  char tmp[LT_PATHMAX + 1];
 
4730
 
 
4731
  assert(path != NULL);
 
4732
 
 
4733
  /* Is it qualified already? */
 
4734
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4735
  if (isalpha (path[0]) && path[1] == ':')
 
4736
    return xstrdup (path);
 
4737
#endif
 
4738
  if (IS_DIR_SEPARATOR (path[0]))
 
4739
    return xstrdup (path);
 
4740
 
 
4741
  /* prepend the current directory */
 
4742
  /* doesn't handle '~' */
 
4743
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4744
    lt_fatal ("getcwd failed");
 
4745
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4746
  p = XMALLOC(char, size);
 
4747
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4748
  return p;
 
4749
}
 
4750
 
 
4751
char *
 
4752
strendzap(char *str, const char *pat)
 
4753
{
 
4754
  size_t len, patlen;
 
4755
 
 
4756
  assert(str != NULL);
 
4757
  assert(pat != NULL);
 
4758
 
 
4759
  len = strlen(str);
 
4760
  patlen = strlen(pat);
 
4761
 
 
4762
  if (patlen <= len)
 
4763
  {
 
4764
    str += len - patlen;
 
4765
    if (strcmp(str, pat) == 0)
 
4766
      *str = '\0';
 
4767
  }
 
4768
  return str;
 
4769
}
 
4770
 
 
4771
static void
 
4772
lt_error_core (int exit_status, const char * mode,
 
4773
          const char * message, va_list ap)
 
4774
{
 
4775
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4776
  vfprintf (stderr, message, ap);
 
4777
  fprintf (stderr, ".\n");
 
4778
 
 
4779
  if (exit_status >= 0)
 
4780
    exit (exit_status);
 
4781
}
 
4782
 
 
4783
void
 
4784
lt_fatal (const char *message, ...)
 
4785
{
 
4786
  va_list ap;
 
4787
  va_start (ap, message);
 
4788
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4789
  va_end (ap);
 
4790
}
 
4791
EOF
 
4792
          # we should really use a build-platform specific compiler
 
4793
          # here, but OTOH, the wrappers (shell script and this C one)
 
4794
          # are only useful if you want to execute the "real" binary.
 
4795
          # Since the "real" binary is built for $host, then this
 
4796
          # wrapper might as well be built for $host, too.
 
4797
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4798
          ;;
 
4799
        esac
3595
4800
        $rm $output
3596
 
        trap "$rm $output; exit 1" 1 2 15
 
4801
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
3597
4802
 
3598
4803
        $echo > $output "\
3599
4804
#! $SHELL
3609
4814
 
3610
4815
# Sed substitution that helps us do robust quoting.  It backslashifies
3611
4816
# metacharacters that are still active within double-quoted strings.
3612
 
Xsed='sed -e 1s/^X//'
 
4817
Xsed='${SED} -e 1s/^X//'
3613
4818
sed_quote_subst='$sed_quote_subst'
3614
4819
 
3615
4820
# The HP-UX ksh and POSIX shell print the target directory to stdout
3647
4852
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3648
4853
 
3649
4854
  # Follow symbolic links until we get to the real thisdir.
3650
 
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
4855
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3651
4856
  while test -n \"\$file\"; do
3652
4857
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3653
4858
 
3660
4865
    fi
3661
4866
 
3662
4867
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3663
 
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
4868
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3664
4869
  done
3665
4870
 
3666
4871
  # Try to get the absolute directory name.
3669
4874
"
3670
4875
 
3671
4876
        if test "$fast_install" = yes; then
3672
 
          echo >> $output "\
 
4877
          $echo >> $output "\
3673
4878
  program=lt-'$outputname'$exeext
3674
4879
  progdir=\"\$thisdir/$objdir\"
3675
4880
 
3676
4881
  if test ! -f \"\$progdir/\$program\" || \\
3677
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
4882
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3678
4883
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3679
4884
 
3680
4885
    file=\"\$\$-\$program\"
3685
4890
      $rm \"\$progdir/\$file\"
3686
4891
    fi"
3687
4892
 
3688
 
          echo >> $output "\
 
4893
          $echo >> $output "\
3689
4894
 
3690
4895
    # relink executable if necessary
3691
4896
    if test -n \"\$relink_command\"; then
3693
4898
      else
3694
4899
        $echo \"\$relink_command_output\" >&2
3695
4900
        $rm \"\$progdir/\$file\"
3696
 
        exit 1
 
4901
        exit $EXIT_FAILURE
3697
4902
      fi
3698
4903
    fi
3699
4904
 
3703
4908
    $rm \"\$progdir/\$file\"
3704
4909
  fi"
3705
4910
        else
3706
 
          echo >> $output "\
 
4911
          $echo >> $output "\
3707
4912
  program='$outputname'
3708
4913
  progdir=\"\$thisdir/$objdir\"
3709
4914
"
3710
4915
        fi
3711
4916
 
3712
 
        echo >> $output "\
 
4917
        $echo >> $output "\
3713
4918
 
3714
4919
  if test -f \"\$progdir/\$program\"; then"
3715
4920
 
3740
4945
      # Run the actual program with our arguments.
3741
4946
"
3742
4947
        case $host in
3743
 
        # win32 systems need to use the prog path for dll
3744
 
        # lookup to work
3745
 
        *-*-cygwin* | *-*-pw32*)
3746
 
          $echo >> $output "\
3747
 
      exec \$progdir/\$program \${1+\"\$@\"}
3748
 
"
3749
 
          ;;
3750
 
 
3751
4948
        # Backslashes separate directories on plain windows
3752
4949
        *-*-mingw | *-*-os2*)
3753
4950
          $echo >> $output "\
3757
4954
 
3758
4955
        *)
3759
4956
          $echo >> $output "\
3760
 
      # Export the path to the program.
3761
 
      PATH=\"\$progdir:\$PATH\"
3762
 
      export PATH
3763
 
 
3764
 
      exec \$program \${1+\"\$@\"}
 
4957
      exec \$progdir/\$program \${1+\"\$@\"}
3765
4958
"
3766
4959
          ;;
3767
4960
        esac
3768
4961
        $echo >> $output "\
3769
4962
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3770
 
      exit 1
 
4963
      exit $EXIT_FAILURE
3771
4964
    fi
3772
4965
  else
3773
4966
    # The program doesn't exist.
3774
4967
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3775
4968
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
3776
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
3777
 
    exit 1
 
4969
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
4970
    exit $EXIT_FAILURE
3778
4971
  fi
3779
4972
fi\
3780
4973
"
3781
4974
        chmod +x $output
3782
4975
      fi
3783
 
      exit 0
 
4976
      exit $EXIT_SUCCESS
3784
4977
      ;;
3785
4978
    esac
3786
4979
 
3796
4989
          oldobjs="$libobjs_save"
3797
4990
          build_libtool_libs=no
3798
4991
        else
3799
 
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
4992
          oldobjs="$old_deplibs $non_pic_objects"
3800
4993
        fi
3801
4994
        addlibs="$old_convenience"
3802
4995
      fi
3805
4998
        gentop="$output_objdir/${outputname}x"
3806
4999
        $show "${rm}r $gentop"
3807
5000
        $run ${rm}r "$gentop"
3808
 
        $show "mkdir $gentop"
3809
 
        $run mkdir "$gentop"
 
5001
        $show "$mkdir $gentop"
 
5002
        $run $mkdir "$gentop"
3810
5003
        status=$?
3811
 
        if test $status -ne 0 && test ! -d "$gentop"; then
 
5004
        if test "$status" -ne 0 && test ! -d "$gentop"; then
3812
5005
          exit $status
3813
5006
        fi
3814
5007
        generated="$generated $gentop"
3825
5018
 
3826
5019
          $show "${rm}r $xdir"
3827
5020
          $run ${rm}r "$xdir"
3828
 
          $show "mkdir $xdir"
3829
 
          $run mkdir "$xdir"
 
5021
          $show "$mkdir $xdir"
 
5022
          $run $mkdir "$xdir"
3830
5023
          status=$?
3831
 
          if test $status -ne 0 && test ! -d "$xdir"; then
 
5024
          if test "$status" -ne 0 && test ! -d "$xdir"; then
3832
5025
            exit $status
3833
5026
          fi
 
5027
          # We will extract separately just the conflicting names and we will no
 
5028
          # longer touch any unique names. It is faster to leave these extract
 
5029
          # automatically by $AR in one run.
3834
5030
          $show "(cd $xdir && $AR x $xabs)"
3835
5031
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
5032
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
5033
            :
 
5034
          else
 
5035
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
5036
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
5037
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
5038
            do
 
5039
              i=1
 
5040
              while test "$i" -le "$count"
 
5041
              do
 
5042
               # Put our $i before any first dot (extension)
 
5043
               # Never overwrite any file
 
5044
               name_to="$name"
 
5045
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
5046
               do
 
5047
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
5048
               done
 
5049
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
5050
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
5051
               i=`expr $i + 1`
 
5052
              done
 
5053
            done
 
5054
          fi
3836
5055
 
3837
5056
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3838
5057
        done
3840
5059
 
3841
5060
      # Do each command in the archive commands.
3842
5061
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3843
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5062
       cmds=$old_archive_from_new_cmds
3844
5063
      else
3845
 
        # Ensure that we have .o objects in place in case we decided
3846
 
        # not to build a shared library, and have fallen back to building
3847
 
        # static libs even though --disable-static was passed!
3848
 
        for oldobj in $oldobjs; do
3849
 
          if test ! -f $oldobj; then
3850
 
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3851
 
            if test "X$xdir" = "X$oldobj"; then
3852
 
              xdir="."
3853
 
            else
3854
 
              xdir="$xdir"
3855
 
            fi
3856
 
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3857
 
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3858
 
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3859
 
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3860
 
          fi
3861
 
        done
3862
 
 
3863
5064
        eval cmds=\"$old_archive_cmds\"
 
5065
 
 
5066
        if len=`expr "X$cmds" : ".*"` &&
 
5067
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5068
          cmds=$old_archive_cmds
 
5069
        else
 
5070
          # the command line is too long to link in one step, link in parts
 
5071
          $echo "using piecewise archive linking..."
 
5072
          save_RANLIB=$RANLIB
 
5073
          RANLIB=:
 
5074
          objlist=
 
5075
          concat_cmds=
 
5076
          save_oldobjs=$oldobjs
 
5077
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
 
5078
          # encoded into archives.  This makes 'ar r' malfunction in
 
5079
          # this piecewise linking case whenever conflicting object
 
5080
          # names appear in distinct ar calls; check, warn and compensate.
 
5081
            if (for obj in $save_oldobjs
 
5082
            do
 
5083
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5084
            done | sort | sort -uc >/dev/null 2>&1); then
 
5085
            :
 
5086
          else
 
5087
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
 
5088
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
 
5089
            AR_FLAGS=cq
 
5090
          fi
 
5091
          # Is there a better way of finding the last object in the list?
 
5092
          for obj in $save_oldobjs
 
5093
          do
 
5094
            last_oldobj=$obj
 
5095
          done
 
5096
          for obj in $save_oldobjs
 
5097
          do
 
5098
            oldobjs="$objlist $obj"
 
5099
            objlist="$objlist $obj"
 
5100
            eval test_cmds=\"$old_archive_cmds\"
 
5101
            if len=`expr "X$test_cmds" : ".*"` &&
 
5102
               test "$len" -le "$max_cmd_len"; then
 
5103
              :
 
5104
            else
 
5105
              # the above command should be used before it gets too long
 
5106
              oldobjs=$objlist
 
5107
              if test "$obj" = "$last_oldobj" ; then
 
5108
                RANLIB=$save_RANLIB
 
5109
              fi
 
5110
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5111
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5112
              objlist=
 
5113
            fi
 
5114
          done
 
5115
          RANLIB=$save_RANLIB
 
5116
          oldobjs=$objlist
 
5117
          if test "X$oldobjs" = "X" ; then
 
5118
            eval cmds=\"\$concat_cmds\"
 
5119
          else
 
5120
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5121
          fi
 
5122
        fi
3864
5123
      fi
3865
5124
      save_ifs="$IFS"; IFS='~'
3866
5125
      for cmd in $cmds; do
 
5126
        eval cmd=\"$cmd\"
3867
5127
        IFS="$save_ifs"
3868
5128
        $show "$cmd"
3869
5129
        $run eval "$cmd" || exit $?
3895
5155
        fi
3896
5156
      done
3897
5157
      # Quote the link command for shipping.
3898
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
 
5158
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
3899
5159
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5160
      if test "$hardcode_automatic" = yes ; then
 
5161
        relink_command=
 
5162
      fi
 
5163
 
3900
5164
 
3901
5165
      # Only create the output if not a dry run.
3902
5166
      if test -z "$run"; then
3912
5176
              case $deplib in
3913
5177
              *.la)
3914
5178
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3915
 
                eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
5179
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3916
5180
                if test -z "$libdir"; then
3917
5181
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3918
 
                  exit 1
 
5182
                  exit $EXIT_FAILURE
3919
5183
                fi
3920
5184
                newdependency_libs="$newdependency_libs $libdir/$name"
3921
5185
                ;;
3926
5190
            newdlfiles=
3927
5191
            for lib in $dlfiles; do
3928
5192
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3929
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5193
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3930
5194
              if test -z "$libdir"; then
3931
5195
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3932
 
                exit 1
 
5196
                exit $EXIT_FAILURE
3933
5197
              fi
3934
5198
              newdlfiles="$newdlfiles $libdir/$name"
3935
5199
            done
3937
5201
            newdlprefiles=
3938
5202
            for lib in $dlprefiles; do
3939
5203
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3940
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5204
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3941
5205
              if test -z "$libdir"; then
3942
5206
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3943
 
                exit 1
 
5207
                exit $EXIT_FAILURE
3944
5208
              fi
3945
5209
              newdlprefiles="$newdlprefiles $libdir/$name"
3946
5210
            done
3947
5211
            dlprefiles="$newdlprefiles"
 
5212
          else
 
5213
            newdlfiles=
 
5214
            for lib in $dlfiles; do
 
5215
              case $lib in
 
5216
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5217
                *) abs=`pwd`"/$lib" ;;
 
5218
              esac
 
5219
              newdlfiles="$newdlfiles $abs"
 
5220
            done
 
5221
            dlfiles="$newdlfiles"
 
5222
            newdlprefiles=
 
5223
            for lib in $dlprefiles; do
 
5224
              case $lib in
 
5225
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5226
                *) abs=`pwd`"/$lib" ;;
 
5227
              esac
 
5228
              newdlprefiles="$newdlprefiles $abs"
 
5229
            done
 
5230
            dlprefiles="$newdlprefiles"
3948
5231
          fi
3949
5232
          $rm $output
3950
5233
          # place dlname in correct position for cygwin
3951
5234
          tdlname=$dlname
3952
5235
          case $host,$output,$installed,$module,$dlname in
3953
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5236
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3954
5237
          esac
3955
5238
          $echo > $output "\
3956
5239
# $outputname - a libtool library file
3979
5262
# Is this an already installed library?
3980
5263
installed=$installed
3981
5264
 
 
5265
# Should we warn about portability when linking against -modules?
 
5266
shouldnotlink=$module
 
5267
 
3982
5268
# Files to dlopen/dlpreopen
3983
5269
dlopen='$dlfiles'
3984
5270
dlpreopen='$dlprefiles'
3985
5271
 
3986
5272
# Directory that this library needs to be installed in:
3987
5273
libdir='$install_libdir'"
3988
 
          if test "$installed" = no && test $need_relink = yes; then
 
5274
          if test "$installed" = no && test "$need_relink" = yes; then
3989
5275
            $echo >> $output "\
3990
5276
relink_command=\"$relink_command\""
3991
5277
          fi
3998
5284
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3999
5285
      ;;
4000
5286
    esac
4001
 
    exit 0
 
5287
    exit $EXIT_SUCCESS
4002
5288
    ;;
4003
5289
 
4004
5290
  # libtool install mode
4087
5373
    if test -z "$install_prog"; then
4088
5374
      $echo "$modename: you must specify an install program" 1>&2
4089
5375
      $echo "$help" 1>&2
4090
 
      exit 1
 
5376
      exit $EXIT_FAILURE
4091
5377
    fi
4092
5378
 
4093
5379
    if test -n "$prev"; then
4094
5380
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4095
5381
      $echo "$help" 1>&2
4096
 
      exit 1
 
5382
      exit $EXIT_FAILURE
4097
5383
    fi
4098
5384
 
4099
5385
    if test -z "$files"; then
4103
5389
        $echo "$modename: you must specify a destination" 1>&2
4104
5390
      fi
4105
5391
      $echo "$help" 1>&2
4106
 
      exit 1
 
5392
      exit $EXIT_FAILURE
4107
5393
    fi
4108
5394
 
4109
5395
    # Strip any trailing slash from the destination.
4121
5407
 
4122
5408
      # Not a directory, so check to see that there is only one file specified.
4123
5409
      set dummy $files
4124
 
      if test $# -gt 2; then
 
5410
      if test "$#" -gt 2; then
4125
5411
        $echo "$modename: \`$dest' is not a directory" 1>&2
4126
5412
        $echo "$help" 1>&2
4127
 
        exit 1
 
5413
        exit $EXIT_FAILURE
4128
5414
      fi
4129
5415
    fi
4130
5416
    case $destdir in
4136
5422
        *)
4137
5423
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4138
5424
          $echo "$help" 1>&2
4139
 
          exit 1
 
5425
          exit $EXIT_FAILURE
4140
5426
          ;;
4141
5427
        esac
4142
5428
      done
4161
5447
 
4162
5448
      *.la)
4163
5449
        # Check to see that this really is a libtool archive.
4164
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5450
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4165
5451
        else
4166
5452
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4167
5453
          $echo "$help" 1>&2
4168
 
          exit 1
 
5454
          exit $EXIT_FAILURE
4169
5455
        fi
4170
5456
 
4171
5457
        library_names=
4196
5482
        dir="$dir$objdir"
4197
5483
 
4198
5484
        if test -n "$relink_command"; then
 
5485
          # Determine the prefix the user has applied to our future dir.
 
5486
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
 
5487
 
 
5488
          # Don't allow the user to place us outside of our expected
 
5489
          # location b/c this prevents finding dependent libraries that
 
5490
          # are installed to the same prefix.
 
5491
          # At present, this check doesn't affect windows .dll's that
 
5492
          # are installed into $libdir/../bin (currently, that works fine)
 
5493
          # but it's something to keep an eye on.
 
5494
          if test "$inst_prefix_dir" = "$destdir"; then
 
5495
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
 
5496
            exit $EXIT_FAILURE
 
5497
          fi
 
5498
 
 
5499
          if test -n "$inst_prefix_dir"; then
 
5500
            # Stick the inst_prefix_dir data into the link command.
 
5501
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5502
          else
 
5503
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
5504
          fi
 
5505
 
4199
5506
          $echo "$modename: warning: relinking \`$file'" 1>&2
4200
5507
          $show "$relink_command"
4201
5508
          if $run eval "$relink_command"; then :
4202
5509
          else
4203
5510
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4204
 
            continue
 
5511
            exit $EXIT_FAILURE
4205
5512
          fi
4206
5513
        fi
4207
5514
 
4223
5530
            $run eval "$striplib $destdir/$realname" || exit $?
4224
5531
          fi
4225
5532
 
4226
 
          if test $# -gt 0; then
 
5533
          if test "$#" -gt 0; then
4227
5534
            # Delete the old symlinks, and create new ones.
4228
5535
            for linkname
4229
5536
            do
4236
5543
 
4237
5544
          # Do each command in the postinstall commands.
4238
5545
          lib="$destdir/$realname"
4239
 
          eval cmds=\"$postinstall_cmds\"
 
5546
          cmds=$postinstall_cmds
4240
5547
          save_ifs="$IFS"; IFS='~'
4241
5548
          for cmd in $cmds; do
4242
5549
            IFS="$save_ifs"
 
5550
            eval cmd=\"$cmd\"
4243
5551
            $show "$cmd"
4244
5552
            $run eval "$cmd" || exit $?
4245
5553
          done
4279
5587
        *)
4280
5588
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4281
5589
          $echo "$help" 1>&2
4282
 
          exit 1
 
5590
          exit $EXIT_FAILURE
4283
5591
          ;;
4284
5592
        esac
4285
5593
 
4297
5605
          $show "$install_prog $staticobj $staticdest"
4298
5606
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4299
5607
        fi
4300
 
        exit 0
 
5608
        exit $EXIT_SUCCESS
4301
5609
        ;;
4302
5610
 
4303
5611
      *)
4309
5617
          destfile="$destdir/$destfile"
4310
5618
        fi
4311
5619
 
 
5620
        # If the file is missing, and there is a .exe on the end, strip it
 
5621
        # because it is most likely a libtool script we actually want to
 
5622
        # install
 
5623
        stripped_ext=""
 
5624
        case $file in
 
5625
          *.exe)
 
5626
            if test ! -f "$file"; then
 
5627
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5628
              stripped_ext=".exe"
 
5629
            fi
 
5630
            ;;
 
5631
        esac
 
5632
 
4312
5633
        # Do a test to see if this is really a libtool program.
4313
5634
        case $host in
4314
5635
        *cygwin*|*mingw*)
4315
 
            wrapper=`echo $file | sed -e 's,.exe$,,'`
 
5636
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
4316
5637
            ;;
4317
5638
        *)
4318
5639
            wrapper=$file
4319
5640
            ;;
4320
5641
        esac
4321
 
        if (sed -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
5642
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4322
5643
          notinst_deplibs=
4323
5644
          relink_command=
4324
5645
 
 
5646
          # To insure that "foo" is sourced, and not "foo.exe",
 
5647
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5648
          # which disallows the automatic-append-.exe behavior.
 
5649
          case $build in
 
5650
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5651
          *) wrapperdot=${wrapper} ;;
 
5652
          esac
4325
5653
          # If there is no directory component, then add one.
4326
5654
          case $file in
4327
 
          */* | *\\*) . $wrapper ;;
4328
 
          *) . ./$wrapper ;;
 
5655
          */* | *\\*) . ${wrapperdot} ;;
 
5656
          *) . ./${wrapperdot} ;;
4329
5657
          esac
4330
5658
 
4331
5659
          # Check the variables that should have been set.
4332
5660
          if test -z "$notinst_deplibs"; then
4333
5661
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4334
 
            exit 1
 
5662
            exit $EXIT_FAILURE
4335
5663
          fi
4336
5664
 
4337
5665
          finalize=yes
4353
5681
          done
4354
5682
 
4355
5683
          relink_command=
 
5684
          # To insure that "foo" is sourced, and not "foo.exe",
 
5685
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5686
          # which disallows the automatic-append-.exe behavior.
 
5687
          case $build in
 
5688
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5689
          *) wrapperdot=${wrapper} ;;
 
5690
          esac
4356
5691
          # If there is no directory component, then add one.
4357
5692
          case $file in
4358
 
          */* | *\\*) . $wrapper ;;
4359
 
          *) . ./$wrapper ;;
 
5693
          */* | *\\*) . ${wrapperdot} ;;
 
5694
          *) . ./${wrapperdot} ;;
4360
5695
          esac
4361
5696
 
4362
5697
          outputname=
4365
5700
              tmpdir="/tmp"
4366
5701
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4367
5702
              tmpdir="$tmpdir/libtool-$$"
4368
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5703
              save_umask=`umask`
 
5704
              umask 0077
 
5705
              if $mkdir "$tmpdir"; then
 
5706
                umask $save_umask
4369
5707
              else
 
5708
                umask $save_umask
4370
5709
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4371
5710
                continue
4372
5711
              fi
4373
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
5712
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4374
5713
              outputname="$tmpdir/$file"
4375
5714
              # Replace the output file specification.
4376
5715
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4388
5727
            fi
4389
5728
          else
4390
5729
            # Install the binary that we compiled earlier.
4391
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5730
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4392
5731
          fi
4393
5732
        fi
4394
5733
 
4395
5734
        # remove .exe since cygwin /usr/bin/install will append another
4396
5735
        # one anyways
4397
5736
        case $install_prog,$host in
4398
 
        /usr/bin/install*,*cygwin*)
 
5737
        */usr/bin/install*,*cygwin*)
4399
5738
          case $file:$destfile in
4400
5739
          *.exe:*.exe)
4401
5740
            # this is ok
4404
5743
            destfile=$destfile.exe
4405
5744
            ;;
4406
5745
          *:*.exe)
4407
 
            destfile=`echo $destfile | sed -e 's,.exe$,,'`
 
5746
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4408
5747
            ;;
4409
5748
          esac
4410
5749
          ;;
4425
5764
      $show "$install_prog $file $oldlib"
4426
5765
      $run eval "$install_prog \$file \$oldlib" || exit $?
4427
5766
 
4428
 
      if test -n "$stripme" && test -n "$striplib"; then
 
5767
      if test -n "$stripme" && test -n "$old_striplib"; then
4429
5768
        $show "$old_striplib $oldlib"
4430
5769
        $run eval "$old_striplib $oldlib" || exit $?
4431
5770
      fi
4432
5771
 
4433
5772
      # Do each command in the postinstall commands.
4434
 
      eval cmds=\"$old_postinstall_cmds\"
 
5773
      cmds=$old_postinstall_cmds
4435
5774
      save_ifs="$IFS"; IFS='~'
4436
5775
      for cmd in $cmds; do
4437
5776
        IFS="$save_ifs"
 
5777
        eval cmd=\"$cmd\"
4438
5778
        $show "$cmd"
4439
5779
        $run eval "$cmd" || exit $?
4440
5780
      done
4448
5788
    if test -n "$current_libdirs"; then
4449
5789
      # Maybe just do a dry run.
4450
5790
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4451
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
5791
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
4452
5792
    else
4453
 
      exit 0
 
5793
      exit $EXIT_SUCCESS
4454
5794
    fi
4455
5795
    ;;
4456
5796
 
4469
5809
      for libdir in $libdirs; do
4470
5810
        if test -n "$finish_cmds"; then
4471
5811
          # Do each command in the finish commands.
4472
 
          eval cmds=\"$finish_cmds\"
 
5812
          cmds=$finish_cmds
4473
5813
          save_ifs="$IFS"; IFS='~'
4474
5814
          for cmd in $cmds; do
4475
5815
            IFS="$save_ifs"
 
5816
            eval cmd=\"$cmd\"
4476
5817
            $show "$cmd"
4477
5818
            $run eval "$cmd" || admincmds="$admincmds
4478
5819
       $cmd"
4489
5830
    fi
4490
5831
 
4491
5832
    # Exit here if they wanted silent mode.
4492
 
    test "$show" = ":" && exit 0
 
5833
    test "$show" = : && exit $EXIT_SUCCESS
4493
5834
 
4494
 
    echo "----------------------------------------------------------------------"
4495
 
    echo "Libraries have been installed in:"
 
5835
    $echo "----------------------------------------------------------------------"
 
5836
    $echo "Libraries have been installed in:"
4496
5837
    for libdir in $libdirs; do
4497
 
      echo "   $libdir"
 
5838
      $echo "   $libdir"
4498
5839
    done
4499
 
    echo
4500
 
    echo "If you ever happen to want to link against installed libraries"
4501
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4502
 
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4503
 
    echo "flag during linking and do at least one of the following:"
 
5840
    $echo
 
5841
    $echo "If you ever happen to want to link against installed libraries"
 
5842
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5843
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5844
    $echo "flag during linking and do at least one of the following:"
4504
5845
    if test -n "$shlibpath_var"; then
4505
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4506
 
      echo "     during execution"
 
5846
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5847
      $echo "     during execution"
4507
5848
    fi
4508
5849
    if test -n "$runpath_var"; then
4509
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4510
 
      echo "     during linking"
 
5850
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5851
      $echo "     during linking"
4511
5852
    fi
4512
5853
    if test -n "$hardcode_libdir_flag_spec"; then
4513
5854
      libdir=LIBDIR
4514
5855
      eval flag=\"$hardcode_libdir_flag_spec\"
4515
5856
 
4516
 
      echo "   - use the \`$flag' linker flag"
 
5857
      $echo "   - use the \`$flag' linker flag"
4517
5858
    fi
4518
5859
    if test -n "$admincmds"; then
4519
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5860
      $echo "   - have your system administrator run these commands:$admincmds"
4520
5861
    fi
4521
5862
    if test -f /etc/ld.so.conf; then
4522
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5863
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4523
5864
    fi
4524
 
    echo
4525
 
    echo "See any operating system documentation about shared libraries for"
4526
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4527
 
    echo "----------------------------------------------------------------------"
4528
 
    exit 0
 
5865
    $echo
 
5866
    $echo "See any operating system documentation about shared libraries for"
 
5867
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5868
    $echo "----------------------------------------------------------------------"
 
5869
    exit $EXIT_SUCCESS
4529
5870
    ;;
4530
5871
 
4531
5872
  # libtool execute mode
4537
5878
    if test -z "$cmd"; then
4538
5879
      $echo "$modename: you must specify a COMMAND" 1>&2
4539
5880
      $echo "$help"
4540
 
      exit 1
 
5881
      exit $EXIT_FAILURE
4541
5882
    fi
4542
5883
 
4543
5884
    # Handle -dlopen flags immediately.
4545
5886
      if test ! -f "$file"; then
4546
5887
        $echo "$modename: \`$file' is not a file" 1>&2
4547
5888
        $echo "$help" 1>&2
4548
 
        exit 1
 
5889
        exit $EXIT_FAILURE
4549
5890
      fi
4550
5891
 
4551
5892
      dir=
4552
5893
      case $file in
4553
5894
      *.la)
4554
5895
        # Check to see that this really is a libtool archive.
4555
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5896
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4556
5897
        else
4557
5898
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4558
5899
          $echo "$help" 1>&2
4559
 
          exit 1
 
5900
          exit $EXIT_FAILURE
4560
5901
        fi
4561
5902
 
4562
5903
        # Read the libtool library.
4583
5924
          dir="$dir/$objdir"
4584
5925
        else
4585
5926
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4586
 
          exit 1
 
5927
          exit $EXIT_FAILURE
4587
5928
        fi
4588
5929
        ;;
4589
5930
 
4623
5964
      -*) ;;
4624
5965
      *)
4625
5966
        # Do a test to see if this is really a libtool program.
4626
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5967
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4627
5968
          # If there is no directory component, then add one.
4628
5969
          case $file in
4629
5970
          */* | *\\*) . $file ;;
4646
5987
        eval "export $shlibpath_var"
4647
5988
      fi
4648
5989
 
4649
 
      # Restore saved enviroment variables
 
5990
      # Restore saved environment variables
4650
5991
      if test "${save_LC_ALL+set}" = set; then
4651
5992
        LC_ALL="$save_LC_ALL"; export LC_ALL
4652
5993
      fi
4663
6004
        $echo "export $shlibpath_var"
4664
6005
      fi
4665
6006
      $echo "$cmd$args"
4666
 
      exit 0
 
6007
      exit $EXIT_SUCCESS
4667
6008
    fi
4668
6009
    ;;
4669
6010
 
4691
6032
    if test -z "$rm"; then
4692
6033
      $echo "$modename: you must specify an RM program" 1>&2
4693
6034
      $echo "$help" 1>&2
4694
 
      exit 1
 
6035
      exit $EXIT_FAILURE
4695
6036
    fi
4696
6037
 
4697
6038
    rmdirs=
4698
6039
 
 
6040
    origobjdir="$objdir"
4699
6041
    for file in $files; do
4700
6042
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4701
6043
      if test "X$dir" = "X$file"; then
4702
6044
        dir=.
4703
 
        objdir="$objdir"
 
6045
        objdir="$origobjdir"
4704
6046
      else
4705
 
        objdir="$dir/$objdir"
 
6047
        objdir="$dir/$origobjdir"
4706
6048
      fi
4707
6049
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4708
 
      test $mode = uninstall && objdir="$dir"
 
6050
      test "$mode" = uninstall && objdir="$dir"
4709
6051
 
4710
6052
      # Remember objdir for removal later, being careful to avoid duplicates
4711
 
      if test $mode = clean; then
 
6053
      if test "$mode" = clean; then
4712
6054
        case " $rmdirs " in
4713
6055
          *" $objdir "*) ;;
4714
6056
          *) rmdirs="$rmdirs $objdir" ;;
4732
6074
      case $name in
4733
6075
      *.la)
4734
6076
        # Possibly a libtool archive, so verify it.
4735
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6077
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4736
6078
          . $dir/$name
4737
6079
 
4738
6080
          # Delete the libtool libraries and symlinks.
4740
6082
            rmfiles="$rmfiles $objdir/$n"
4741
6083
          done
4742
6084
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4743
 
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6085
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4744
6086
 
4745
 
          if test $mode = uninstall; then
 
6087
          if test "$mode" = uninstall; then
4746
6088
            if test -n "$library_names"; then
4747
6089
              # Do each command in the postuninstall commands.
4748
 
              eval cmds=\"$postuninstall_cmds\"
 
6090
              cmds=$postuninstall_cmds
4749
6091
              save_ifs="$IFS"; IFS='~'
4750
6092
              for cmd in $cmds; do
4751
6093
                IFS="$save_ifs"
 
6094
                eval cmd=\"$cmd\"
4752
6095
                $show "$cmd"
4753
6096
                $run eval "$cmd"
4754
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6097
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4755
6098
                  exit_status=1
4756
6099
                fi
4757
6100
              done
4760
6103
 
4761
6104
            if test -n "$old_library"; then
4762
6105
              # Do each command in the old_postuninstall commands.
4763
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6106
              cmds=$old_postuninstall_cmds
4764
6107
              save_ifs="$IFS"; IFS='~'
4765
6108
              for cmd in $cmds; do
4766
6109
                IFS="$save_ifs"
 
6110
                eval cmd=\"$cmd\"
4767
6111
                $show "$cmd"
4768
6112
                $run eval "$cmd"
4769
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6113
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4770
6114
                  exit_status=1
4771
6115
                fi
4772
6116
              done
4778
6122
        ;;
4779
6123
 
4780
6124
      *.lo)
4781
 
        if test "$build_old_libs" = yes; then
4782
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4783
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6125
        # Possibly a libtool object, so verify it.
 
6126
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6127
 
 
6128
          # Read the .lo file
 
6129
          . $dir/$name
 
6130
 
 
6131
          # Add PIC object to the list of files to remove.
 
6132
          if test -n "$pic_object" \
 
6133
             && test "$pic_object" != none; then
 
6134
            rmfiles="$rmfiles $dir/$pic_object"
 
6135
          fi
 
6136
 
 
6137
          # Add non-PIC object to the list of files to remove.
 
6138
          if test -n "$non_pic_object" \
 
6139
             && test "$non_pic_object" != none; then
 
6140
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6141
          fi
4784
6142
        fi
4785
6143
        ;;
4786
6144
 
4787
6145
      *)
4788
 
        # Do a test to see if this is a libtool program.
4789
 
        if test $mode = clean &&
4790
 
           (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4791
 
          relink_command=
4792
 
          . $dir/$file
 
6146
        if test "$mode" = clean ; then
 
6147
          noexename=$name
 
6148
          case $file in
 
6149
          *.exe)
 
6150
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6151
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6152
            # $file with .exe has already been added to rmfiles,
 
6153
            # add $file without .exe
 
6154
            rmfiles="$rmfiles $file"
 
6155
            ;;
 
6156
          esac
 
6157
          # Do a test to see if this is a libtool program.
 
6158
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6159
            relink_command=
 
6160
            . $dir/$noexename
4793
6161
 
4794
 
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4795
 
          if test "$fast_install" = yes && test -n "$relink_command"; then
4796
 
            rmfiles="$rmfiles $objdir/lt-$name"
 
6162
            # note $name still contains .exe if it was in $file originally
 
6163
            # as does the version of $file that was added into $rmfiles
 
6164
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6165
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6166
              rmfiles="$rmfiles $objdir/lt-$name"
 
6167
            fi
 
6168
            if test "X$noexename" != "X$name" ; then
 
6169
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6170
            fi
4797
6171
          fi
4798
6172
        fi
4799
6173
        ;;
4801
6175
      $show "$rm $rmfiles"
4802
6176
      $run $rm $rmfiles || exit_status=1
4803
6177
    done
 
6178
    objdir="$origobjdir"
4804
6179
 
4805
6180
    # Try to remove the ${objdir}s in the directories where we deleted files
4806
6181
    for dir in $rmdirs; do
4816
6191
  "")
4817
6192
    $echo "$modename: you must specify a MODE" 1>&2
4818
6193
    $echo "$generic_help" 1>&2
4819
 
    exit 1
 
6194
    exit $EXIT_FAILURE
4820
6195
    ;;
4821
6196
  esac
4822
6197
 
4823
6198
  if test -z "$exec_cmd"; then
4824
6199
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
4825
6200
    $echo "$generic_help" 1>&2
4826
 
    exit 1
 
6201
    exit $EXIT_FAILURE
4827
6202
  fi
4828
6203
fi # test -z "$show_help"
4829
6204
 
4830
6205
if test -n "$exec_cmd"; then
4831
6206
  eval exec $exec_cmd
4832
 
  exit 1
 
6207
  exit $EXIT_FAILURE
4833
6208
fi
4834
6209
 
4835
6210
# We need to display help for each of the modes.
4848
6223
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4849
6224
    --quiet           same as \`--silent'
4850
6225
    --silent          don't print informational messages
 
6226
    --tag=TAG         use configuration variables from tag TAG
4851
6227
    --version         print version information
4852
6228
 
4853
6229
MODE must be one of the following:
4861
6237
      uninstall       remove libraries from an installed directory
4862
6238
 
4863
6239
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4864
 
a more detailed description of MODE."
4865
 
  exit 0
 
6240
a more detailed description of MODE.
 
6241
 
 
6242
Report bugs to <bug-libtool@gnu.org>."
 
6243
  exit $EXIT_SUCCESS
4866
6244
  ;;
4867
6245
 
4868
6246
clean)
4973
6351
  -no-install       link a not-installable executable
4974
6352
  -no-undefined     declare that a library does not refer to external symbols
4975
6353
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6354
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6355
  -precious-files-regex REGEX
 
6356
                    don't remove output files matching REGEX
4976
6357
  -release RELEASE  specify package release information
4977
6358
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
4978
6359
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5014
6395
*)
5015
6396
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5016
6397
  $echo "$help" 1>&2
5017
 
  exit 1
 
6398
  exit $EXIT_FAILURE
5018
6399
  ;;
5019
6400
esac
5020
6401
 
5021
 
echo
 
6402
$echo
5022
6403
$echo "Try \`$modename --help' for more information about other modes."
5023
6404
 
5024
 
exit 0
 
6405
exit $EXIT_SUCCESS
 
6406
 
 
6407
# The TAGs below are defined such that we never get into a situation
 
6408
# in which we disable both kinds of libraries.  Given conflicting
 
6409
# choices, we go for a static library, that is the most portable,
 
6410
# since we can't tell whether shared libraries were disabled because
 
6411
# the user asked for that or because the platform doesn't support
 
6412
# them.  This is particularly important on AIX, because we don't
 
6413
# support having both static and shared libraries enabled at the same
 
6414
# time on that platform, so we default to a shared-only configuration.
 
6415
# If a disable-shared tag is given, we'll fallback to a static-only
 
6416
# configuration.  But we'll never go from static-only to shared-only.
 
6417
 
 
6418
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6419
build_libtool_libs=no
 
6420
build_old_libs=yes
 
6421
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6422
 
 
6423
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6424
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6425
# ### END LIBTOOL TAG CONFIG: disable-static
5025
6426
 
5026
6427
# Local Variables:
5027
6428
# mode:shell-script