~ubuntu-branches/ubuntu/breezy/proj/breezy

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Peter S Galbraith
  • Date: 2004-11-06 19:44:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20041106194453-axnsmkh1zplal8mz
Tags: upstream-4.4.9
ImportĀ upstreamĀ versionĀ 4.4.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ltmain.sh - Provide generalized library-building support services.
2
 
# NOTE: Changing this file will not affect anything until you rerun ltconfig.
 
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
3
#
4
 
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
 
5
# Free Software Foundation, Inc.
5
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6
7
#
7
8
# This program is free software; you can redistribute it and/or modify
23
24
# configuration script generated by Autoconf, you may include it under
24
25
# the same distribution terms that you use for the rest of that program.
25
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
# RH: define SED for historic ltconfig's generated by Libtool 1.3
 
37
[ -z "$SED" ] && SED=sed
 
38
 
 
39
# The name of this program:
 
40
progname=`echo "$progpath" | $SED $basename`
 
41
modename="$progname"
 
42
 
 
43
# Global variables:
 
44
EXIT_SUCCESS=0
 
45
EXIT_FAILURE=1
 
46
 
 
47
PROGRAM=ltmain.sh
 
48
PACKAGE=libtool
 
49
VERSION=1.5.6
 
50
TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
 
51
 
 
52
 
26
53
# Check that we have a working $echo.
27
54
if test "X$1" = X--no-reexec; then
28
55
  # Discard the --no-reexec flag, and continue.
35
62
  :
36
63
else
37
64
  # Restart under the correct shell, and then maybe $echo will work.
38
 
  exec $SHELL "$0" --no-reexec ${1+"$@"}
 
65
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
39
66
fi
40
67
 
41
68
if test "X$1" = X--fallback-echo; then
44
71
  cat <<EOF
45
72
$*
46
73
EOF
47
 
  exit 0
 
74
  exit $EXIT_SUCCESS
48
75
fi
49
76
 
50
 
# The name of this program.
51
 
progname=`$echo "$0" | sed 's%^.*/%%'`
52
 
modename="$progname"
53
 
 
54
 
# Constants.
55
 
PROGRAM=ltmain.sh
56
 
PACKAGE=libtool
57
 
VERSION=1.3.4
58
 
TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
59
 
 
60
77
default_mode=
61
78
help="Try \`$progname --help' for more information."
62
79
magic="%%%MAGIC variable%%%"
66
83
 
67
84
# Sed substitution that helps us do robust quoting.  It backslashifies
68
85
# metacharacters that are still active within double-quoted strings.
69
 
Xsed='sed -e 1s/^X//'
 
86
Xsed="${SED}"' -e 1s/^X//'
70
87
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
71
 
SP2NL='tr \040 \012'
72
 
NL2SP='tr \015\012 \040\040'
 
88
# test EBCDIC or ASCII
 
89
case `echo A|tr A '\301'` in
 
90
 A) # EBCDIC based system
 
91
  SP2NL="tr '\100' '\n'"
 
92
  NL2SP="tr '\r\n' '\100\100'"
 
93
  ;;
 
94
 *) # Assume ASCII based system
 
95
  SP2NL="tr '\040' '\012'"
 
96
  NL2SP="tr '\015\012' '\040\040'"
 
97
  ;;
 
98
esac
73
99
 
74
100
# NLS nuisances.
75
101
# Only set LANG and LC_ALL to C if already set.
83
109
  save_LANG="$LANG"; LANG=C; export LANG
84
110
fi
85
111
 
86
 
if test "$LTCONFIG_VERSION" != "$VERSION"; then
87
 
  echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
88
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
89
 
  exit 1
90
 
fi
 
112
# Make sure IFS has a sensible default
 
113
: ${IFS="       
 
114
"}
91
115
 
92
116
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
93
 
  echo "$modename: not configured to build any kind of library" 1>&2
94
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
95
 
  exit 1
 
117
  $echo "$modename: not configured to build any kind of library" 1>&2
 
118
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
119
  exit $EXIT_FAILURE
96
120
fi
97
121
 
98
122
# Global variables.
107
131
lo2o="s/\\.lo\$/.${objext}/"
108
132
o2lo="s/\\.${objext}\$/.lo/"
109
133
 
 
134
#####################################
 
135
# Shell function definitions:
 
136
# This seems to be the best place for them
 
137
 
 
138
# func_win32_libid arg
 
139
# return the library type of file 'arg'
 
140
#
 
141
# Need a lot of goo to handle *both* DLLs and import libs
 
142
# Has to be a shell function in order to 'eat' the argument
 
143
# that is supplied when $file_magic_command is called.
 
144
func_win32_libid () {
 
145
  win32_libid_type="unknown"
 
146
  win32_fileres=`file -L $1 2>/dev/null`
 
147
  case $win32_fileres in
 
148
  *ar\ archive\ import\ library*) # definitely import
 
149
    win32_libid_type="x86 archive import"
 
150
    ;;
 
151
  *ar\ archive*) # could be an import, or static
 
152
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
 
153
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
154
      win32_nmres=`eval $NM -f posix -A $1 | \
 
155
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
 
156
      if test "X$win32_nmres" = "Ximport" ; then
 
157
        win32_libid_type="x86 archive import"
 
158
      else
 
159
        win32_libid_type="x86 archive static"
 
160
      fi
 
161
    fi
 
162
    ;;
 
163
  *DLL*)
 
164
    win32_libid_type="x86 DLL"
 
165
    ;;
 
166
  *executable*) # but shell scripts are "executable" too...
 
167
    case $win32_fileres in
 
168
    *MS\ Windows\ PE\ Intel*)
 
169
      win32_libid_type="x86 DLL"
 
170
      ;;
 
171
    esac
 
172
    ;;
 
173
  esac
 
174
  $echo $win32_libid_type
 
175
}
 
176
 
 
177
 
 
178
# func_infer_tag arg
 
179
# Infer tagged configuration to use if any are available and
 
180
# if one wasn't chosen via the "--tag" command line option.
 
181
# Only attempt this if the compiler in the base compile
 
182
# command doesn't match the default compiler.
 
183
# arg is usually of the form 'gcc ...'
 
184
func_infer_tag () {
 
185
    if test -n "$available_tags" && test -z "$tagname"; then
 
186
      CC_quoted=
 
187
      for arg in $CC; do
 
188
        case $arg in
 
189
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
190
          arg="\"$arg\""
 
191
          ;;
 
192
        esac
 
193
        CC_quoted="$CC_quoted $arg"
 
194
      done
 
195
      case $@ in
 
196
      # Blanks in the command may have been stripped by the calling shell,
 
197
      # but not from the CC environment variable when configure was run.
 
198
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
199
      # Blanks at the start of $base_compile will cause this to fail
 
200
      # if we don't check for them as well.
 
201
      *)
 
202
        for z in $available_tags; do
 
203
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
204
            # Evaluate the configuration.
 
205
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
206
            CC_quoted=
 
207
            for arg in $CC; do
 
208
            # Double-quote args containing other shell metacharacters.
 
209
            case $arg in
 
210
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
211
              arg="\"$arg\""
 
212
              ;;
 
213
            esac
 
214
            CC_quoted="$CC_quoted $arg"
 
215
          done
 
216
            case "$@ " in
 
217
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
218
              # The compiler in the base compile command matches
 
219
              # the one in the tagged configuration.
 
220
              # Assume this is the tagged configuration we want.
 
221
              tagname=$z
 
222
              break
 
223
              ;;
 
224
            esac
 
225
          fi
 
226
        done
 
227
        # If $tagname still isn't set, then no tagged configuration
 
228
        # was found and let the user know that the "--tag" command
 
229
        # line option must be used.
 
230
        if test -z "$tagname"; then
 
231
          $echo "$modename: unable to infer tagged configuration"
 
232
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
233
          exit $EXIT_FAILURE
 
234
#        else
 
235
#          $echo "$modename: using $tagname tagged configuration"
 
236
        fi
 
237
        ;;
 
238
      esac
 
239
    fi
 
240
}
 
241
# End of Shell function definitions
 
242
#####################################
 
243
 
 
244
# Darwin sucks
 
245
eval std_shrext=\"$shrext_cmds\"
 
246
 
110
247
# Parse our command line options once, thoroughly.
111
 
while test $# -gt 0
 
248
while test "$#" -gt 0
112
249
do
113
250
  arg="$1"
114
251
  shift
115
252
 
116
 
  case "$arg" in
 
253
  case $arg in
117
254
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
118
255
  *) optarg= ;;
119
256
  esac
120
257
 
121
258
  # If the previous option needs an argument, assign it.
122
259
  if test -n "$prev"; then
123
 
    case "$prev" in
 
260
    case $prev in
124
261
    execute_dlfiles)
125
 
      eval "$prev=\"\$$prev \$arg\""
 
262
      execute_dlfiles="$execute_dlfiles $arg"
 
263
      ;;
 
264
    tag)
 
265
      tagname="$arg"
 
266
      preserve_args="${preserve_args}=$arg"
 
267
 
 
268
      # Check whether tagname contains only valid characters
 
269
      case $tagname in
 
270
      *[!-_A-Za-z0-9,/]*)
 
271
        $echo "$progname: invalid tag name: $tagname" 1>&2
 
272
        exit $EXIT_FAILURE
 
273
        ;;
 
274
      esac
 
275
 
 
276
      case $tagname in
 
277
      CC)
 
278
        # Don't test for the "default" C tag, as we know, it's there, but
 
279
        # not specially marked.
 
280
        ;;
 
281
      *)
 
282
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
 
283
          taglist="$taglist $tagname"
 
284
          # Evaluate the configuration.
 
285
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
 
286
        else
 
287
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
 
288
        fi
 
289
        ;;
 
290
      esac
126
291
      ;;
127
292
    *)
128
293
      eval "$prev=\$arg"
135
300
  fi
136
301
 
137
302
  # Have we seen a non-optional argument yet?
138
 
  case "$arg" in
 
303
  case $arg in
139
304
  --help)
140
305
    show_help=yes
141
306
    ;;
142
307
 
143
308
  --version)
144
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
145
 
    exit 0
 
309
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
 
310
    $echo
 
311
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
 
312
    $echo "This is free software; see the source for copying conditions.  There is NO"
 
313
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
314
    exit $EXIT_SUCCESS
146
315
    ;;
147
316
 
148
317
  --config)
149
 
    sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
150
 
    exit 0
 
318
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
 
319
    # Now print the configurations for the tags.
 
320
    for tagname in $taglist; do
 
321
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
 
322
    done
 
323
    exit $EXIT_SUCCESS
151
324
    ;;
152
325
 
153
326
  --debug)
154
 
    echo "$progname: enabling shell trace mode"
 
327
    $echo "$progname: enabling shell trace mode"
155
328
    set -x
 
329
    preserve_args="$preserve_args $arg"
156
330
    ;;
157
331
 
158
332
  --dry-run | -n)
160
334
    ;;
161
335
 
162
336
  --features)
163
 
    echo "host: $host"
 
337
    $echo "host: $host"
164
338
    if test "$build_libtool_libs" = yes; then
165
 
      echo "enable shared libraries"
 
339
      $echo "enable shared libraries"
166
340
    else
167
 
      echo "disable shared libraries"
 
341
      $echo "disable shared libraries"
168
342
    fi
169
343
    if test "$build_old_libs" = yes; then
170
 
      echo "enable static libraries"
 
344
      $echo "enable static libraries"
171
345
    else
172
 
      echo "disable static libraries"
 
346
      $echo "disable static libraries"
173
347
    fi
174
 
    exit 0
 
348
    exit $EXIT_SUCCESS
175
349
    ;;
176
350
 
177
351
  --finish) mode="finish" ;;
179
353
  --mode) prevopt="--mode" prev=mode ;;
180
354
  --mode=*) mode="$optarg" ;;
181
355
 
 
356
  --preserve-dup-deps) duplicate_deps="yes" ;;
 
357
 
182
358
  --quiet | --silent)
183
359
    show=:
 
360
    preserve_args="$preserve_args $arg"
 
361
    ;;
 
362
 
 
363
  --tag) prevopt="--tag" prev=tag ;;
 
364
  --tag=*)
 
365
    set tag "$optarg" ${1+"$@"}
 
366
    shift
 
367
    prev=tag
 
368
    preserve_args="$preserve_args --tag"
184
369
    ;;
185
370
 
186
371
  -dlopen)
191
376
  -*)
192
377
    $echo "$modename: unrecognized option \`$arg'" 1>&2
193
378
    $echo "$help" 1>&2
194
 
    exit 1
 
379
    exit $EXIT_FAILURE
195
380
    ;;
196
381
 
197
382
  *)
204
389
if test -n "$prevopt"; then
205
390
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
206
391
  $echo "$help" 1>&2
207
 
  exit 1
 
392
  exit $EXIT_FAILURE
208
393
fi
209
394
 
 
395
# If this variable is set in any of the actions, the command in it
 
396
# will be execed at the end.  This prevents here-documents from being
 
397
# left over by shells.
 
398
exec_cmd=
 
399
 
210
400
if test -z "$show_help"; then
211
401
 
212
402
  # Infer the operation mode.
213
403
  if test -z "$mode"; then
214
 
    case "$nonopt" in
215
 
    *cc | *++ | gcc* | *-gcc*)
 
404
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
 
405
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
 
406
    case $nonopt in
 
407
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
216
408
      mode=link
217
409
      for arg
218
410
      do
219
 
        case "$arg" in
 
411
        case $arg in
220
412
        -c)
221
413
           mode=compile
222
414
           break
253
445
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
254
446
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
255
447
    $echo "$help" 1>&2
256
 
    exit 1
 
448
    exit $EXIT_FAILURE
257
449
  fi
258
450
 
259
451
  # Change the help message to a mode-specific one.
261
453
  help="Try \`$modename --help --mode=$mode' for more information."
262
454
 
263
455
  # These modes are in order of execution frequency so that they run quickly.
264
 
  case "$mode" in
 
456
  case $mode in
265
457
  # libtool compile mode
266
458
  compile)
267
459
    modename="$modename: compile"
268
460
    # Get the compilation command and the source file.
269
461
    base_compile=
270
 
    lastarg=
271
 
    srcfile="$nonopt"
 
462
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
463
    suppress_opt=yes
272
464
    suppress_output=
 
465
    arg_mode=normal
 
466
    libobj=
 
467
    later=
273
468
 
274
 
    user_target=no
275
469
    for arg
276
470
    do
277
 
      # Accept any command-line options.
278
 
      case "$arg" in
279
 
      -o)
280
 
        if test "$user_target" != "no"; then
281
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
282
 
          exit 1
283
 
        fi
284
 
        user_target=next
285
 
        ;;
286
 
 
287
 
      -static)
288
 
        build_old_libs=yes
289
 
        continue
290
 
        ;;
291
 
      esac
292
 
 
293
 
      case "$user_target" in
294
 
      next)
295
 
        # The next one is the -o target name
296
 
        user_target=yes
297
 
        continue
298
 
        ;;
299
 
      yes)
300
 
        # We got the output file
301
 
        user_target=set
 
471
      case "$arg_mode" in
 
472
      arg  )
 
473
        # do not "continue".  Instead, add this to base_compile
 
474
        lastarg="$arg"
 
475
        arg_mode=normal
 
476
        ;;
 
477
 
 
478
      target )
302
479
        libobj="$arg"
 
480
        arg_mode=normal
303
481
        continue
304
482
        ;;
305
 
      esac
306
 
 
307
 
      # Accept the current argument as the source file.
308
 
      lastarg="$srcfile"
309
 
      srcfile="$arg"
 
483
 
 
484
      normal )
 
485
        # Accept any command-line options.
 
486
        case $arg in
 
487
        -o)
 
488
          if test -n "$libobj" ; then
 
489
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
490
            exit $EXIT_FAILURE
 
491
          fi
 
492
          arg_mode=target
 
493
          continue
 
494
          ;;
 
495
 
 
496
        -static | -prefer-pic | -prefer-non-pic)
 
497
          later="$later $arg"
 
498
          continue
 
499
          ;;
 
500
 
 
501
        -no-suppress)
 
502
          suppress_opt=no
 
503
          continue
 
504
          ;;
 
505
 
 
506
        -Xcompiler)
 
507
          arg_mode=arg  #  the next one goes into the "base_compile" arg list
 
508
          continue      #  The current "srcfile" will either be retained or
 
509
          ;;            #  replaced later.  I would guess that would be a bug.
 
510
 
 
511
        -Wc,*)
 
512
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
513
          lastarg=
 
514
          save_ifs="$IFS"; IFS=','
 
515
          for arg in $args; do
 
516
            IFS="$save_ifs"
 
517
 
 
518
            # Double-quote args containing other shell metacharacters.
 
519
            # Many Bourne shells cannot handle close brackets correctly
 
520
            # in scan sets, so we specify it separately.
 
521
            case $arg in
 
522
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
523
              arg="\"$arg\""
 
524
              ;;
 
525
            esac
 
526
            lastarg="$lastarg $arg"
 
527
          done
 
528
          IFS="$save_ifs"
 
529
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
530
 
 
531
          # Add the arguments to base_compile.
 
532
          base_compile="$base_compile $lastarg"
 
533
          continue
 
534
          ;;
 
535
 
 
536
        * )
 
537
          # Accept the current argument as the source file.
 
538
          # The previous "srcfile" becomes the current argument.
 
539
          #
 
540
          lastarg="$srcfile"
 
541
          srcfile="$arg"
 
542
          ;;
 
543
        esac  #  case $arg
 
544
        ;;
 
545
      esac    #  case $arg_mode
310
546
 
311
547
      # Aesthetically quote the previous argument.
312
 
 
313
 
      # Backslashify any backslashes, double quotes, and dollar signs.
314
 
      # These are the only characters that are still specially
315
 
      # interpreted inside of double-quoted scrings.
316
548
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
317
549
 
 
550
      case $lastarg in
318
551
      # Double-quote args containing other shell metacharacters.
319
 
      # Many Bourne shells cannot handle close brackets correctly in scan
320
 
      # sets, so we specify it separately.
321
 
      case "$lastarg" in
322
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
552
      # Many Bourne shells cannot handle close brackets correctly
 
553
      # in scan sets, so we specify it separately.
 
554
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
323
555
        lastarg="\"$lastarg\""
324
556
        ;;
325
557
      esac
326
558
 
327
 
      # Add the previous argument to base_compile.
328
 
      if test -z "$base_compile"; then
329
 
        base_compile="$lastarg"
330
 
      else
331
 
        base_compile="$base_compile $lastarg"
332
 
      fi
333
 
    done
 
559
      base_compile="$base_compile $lastarg"
 
560
    done # for arg
334
561
 
335
 
    case "$user_target" in
336
 
    set)
337
 
      ;;
338
 
    no)
 
562
    case $arg_mode in
 
563
    arg)
 
564
      $echo "$modename: you must specify an argument for -Xcompile"
 
565
      exit $EXIT_FAILURE
 
566
      ;;
 
567
    target)
 
568
      $echo "$modename: you must specify a target with \`-o'" 1>&2
 
569
      exit $EXIT_FAILURE
 
570
      ;;
 
571
    *)
339
572
      # Get the name of the library object.
340
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
341
 
      ;;
342
 
    *)
343
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
344
 
      exit 1
 
573
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
345
574
      ;;
346
575
    esac
347
576
 
348
577
    # Recognize several different file suffixes.
349
578
    # If the user specifies -o file.o, it is replaced with file.lo
350
 
    xform='[cCFSfmso]'
351
 
    case "$libobj" in
 
579
    xform='[cCFSifmso]'
 
580
    case $libobj in
352
581
    *.ada) xform=ada ;;
353
582
    *.adb) xform=adb ;;
354
583
    *.ads) xform=ads ;;
355
584
    *.asm) xform=asm ;;
356
585
    *.c++) xform=c++ ;;
357
586
    *.cc) xform=cc ;;
 
587
    *.ii) xform=ii ;;
 
588
    *.class) xform=class ;;
358
589
    *.cpp) xform=cpp ;;
359
590
    *.cxx) xform=cxx ;;
360
591
    *.f90) xform=f90 ;;
361
592
    *.for) xform=for ;;
 
593
    *.java) xform=java ;;
362
594
    esac
363
595
 
364
596
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
365
597
 
366
 
    case "$libobj" in
 
598
    case $libobj in
367
599
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
368
600
    *)
369
601
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
370
 
      exit 1
 
602
      exit $EXIT_FAILURE
371
603
      ;;
372
604
    esac
373
605
 
 
606
    func_infer_tag $base_compile
 
607
 
 
608
    for arg in $later; do
 
609
      case $arg in
 
610
      -static)
 
611
        build_old_libs=yes
 
612
        continue
 
613
        ;;
 
614
 
 
615
      -prefer-pic)
 
616
        pic_mode=yes
 
617
        continue
 
618
        ;;
 
619
 
 
620
      -prefer-non-pic)
 
621
        pic_mode=no
 
622
        continue
 
623
        ;;
 
624
      esac
 
625
    done
 
626
 
 
627
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
628
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
629
    if test "X$xdir" = "X$obj"; then
 
630
      xdir=
 
631
    else
 
632
      xdir=$xdir/
 
633
    fi
 
634
    lobj=${xdir}$objdir/$objname
 
635
 
374
636
    if test -z "$base_compile"; then
375
637
      $echo "$modename: you must specify a compilation command" 1>&2
376
638
      $echo "$help" 1>&2
377
 
      exit 1
 
639
      exit $EXIT_FAILURE
378
640
    fi
379
641
 
380
642
    # Delete any leftover library objects.
381
643
    if test "$build_old_libs" = yes; then
382
 
      removelist="$obj $libobj"
 
644
      removelist="$obj $lobj $libobj ${libobj}T"
383
645
    else
384
 
      removelist="$libobj"
 
646
      removelist="$lobj $libobj ${libobj}T"
385
647
    fi
386
648
 
387
649
    $run $rm $removelist
388
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
650
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
 
651
 
 
652
    # On Cygwin there's no "real" PIC flag so we must build both object types
 
653
    case $host_os in
 
654
    cygwin* | mingw* | pw32* | os2*)
 
655
      pic_mode=default
 
656
      ;;
 
657
    esac
 
658
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
 
659
      # non-PIC code in shared libraries is not supported
 
660
      pic_mode=default
 
661
    fi
389
662
 
390
663
    # Calculate the filename of the output object if compiler does
391
664
    # not support -o with -c
392
665
    if test "$compiler_c_o" = no; then
393
 
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
 
666
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
394
667
      lockfile="$output_obj.lock"
395
668
      removelist="$removelist $output_obj $lockfile"
396
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
669
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
397
670
    else
 
671
      output_obj=
398
672
      need_locks=no
399
673
      lockfile=
400
674
    fi
402
676
    # Lock this critical section if it is needed
403
677
    # We use this script file to make the link, it avoids creating a new file
404
678
    if test "$need_locks" = yes; then
405
 
      until ln "$0" "$lockfile" 2>/dev/null; do
 
679
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
406
680
        $show "Waiting for $lockfile to be removed"
407
681
        sleep 2
408
682
      done
409
683
    elif test "$need_locks" = warn; then
410
684
      if test -f "$lockfile"; then
411
 
        echo "\
 
685
        $echo "\
412
686
*** ERROR, $lockfile exists and contains:
413
687
`cat $lockfile 2>/dev/null`
414
688
 
420
694
compiler."
421
695
 
422
696
        $run $rm $removelist
423
 
        exit 1
 
697
        exit $EXIT_FAILURE
424
698
      fi
425
 
      echo $srcfile > "$lockfile"
 
699
      $echo $srcfile > "$lockfile"
426
700
    fi
427
701
 
428
702
    if test -n "$fix_srcfile_path"; then
429
703
      eval srcfile=\"$fix_srcfile_path\"
430
704
    fi
431
705
 
 
706
    $run $rm "$libobj" "${libobj}T"
 
707
 
 
708
    # Create a libtool object file (analogous to a ".la" file),
 
709
    # but don't create it if we're doing a dry run.
 
710
    test -z "$run" && cat > ${libobj}T <<EOF
 
711
# $libobj - a libtool object file
 
712
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
713
#
 
714
# Please DO NOT delete this file!
 
715
# It is necessary for linking the library.
 
716
 
 
717
# Name of the PIC object.
 
718
EOF
 
719
 
432
720
    # Only build a PIC object if we are building libtool libraries.
433
721
    if test "$build_libtool_libs" = yes; then
434
722
      # Without this assignment, base_compile gets emptied.
435
723
      fbsd_hideous_sh_bug=$base_compile
436
724
 
437
 
      # All platforms use -DPIC, to notify preprocessed assembler code.
438
 
      command="$base_compile $srcfile $pic_flag -DPIC"
439
 
      if test "$build_old_libs" = yes; then
440
 
        lo_libobj="$libobj"
441
 
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
442
 
        if test "X$dir" = "X$libobj"; then
443
 
          dir="$objdir"
444
 
        else
445
 
          dir="$dir/$objdir"
446
 
        fi
447
 
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
448
 
 
449
 
        if test -d "$dir"; then
450
 
          $show "$rm $libobj"
451
 
          $run $rm $libobj
452
 
        else
453
 
          $show "$mkdir $dir"
454
 
          $run $mkdir $dir
455
 
          status=$?
456
 
          if test $status -ne 0 && test ! -d $dir; then
457
 
            exit $status
458
 
          fi
459
 
        fi
460
 
      fi
461
 
      if test "$compiler_o_lo" = yes; then
462
 
        output_obj="$libobj"
463
 
        command="$command -o $output_obj"
464
 
      elif test "$compiler_c_o" = yes; then
465
 
        output_obj="$obj"
466
 
        command="$command -o $output_obj"
467
 
      fi
468
 
 
469
 
      $run $rm "$output_obj"
 
725
      if test "$pic_mode" != no; then
 
726
        command="$base_compile $srcfile $pic_flag"
 
727
      else
 
728
        # Don't build PIC code
 
729
        command="$base_compile $srcfile"
 
730
      fi
 
731
 
 
732
      if test ! -d "${xdir}$objdir"; then
 
733
        $show "$mkdir ${xdir}$objdir"
 
734
        $run $mkdir ${xdir}$objdir
 
735
        status=$?
 
736
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
737
          exit $status
 
738
        fi
 
739
      fi
 
740
 
 
741
      if test -z "$output_obj"; then
 
742
        # Place PIC objects in $objdir
 
743
        command="$command -o $lobj"
 
744
      fi
 
745
 
 
746
      $run $rm "$lobj" "$output_obj"
 
747
 
470
748
      $show "$command"
471
749
      if $run eval "$command"; then :
472
750
      else
473
751
        test -n "$output_obj" && $run $rm $removelist
474
 
        exit 1
 
752
        exit $EXIT_FAILURE
475
753
      fi
476
754
 
477
755
      if test "$need_locks" = warn &&
478
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
479
 
        echo "\
 
756
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
757
        $echo "\
480
758
*** ERROR, $lockfile contains:
481
759
`cat $lockfile 2>/dev/null`
482
760
 
491
769
compiler."
492
770
 
493
771
        $run $rm $removelist
494
 
        exit 1
 
772
        exit $EXIT_FAILURE
495
773
      fi
496
774
 
497
775
      # Just move the object if needed, then go on to compile the next one
498
 
      if test x"$output_obj" != x"$libobj"; then
499
 
        $show "$mv $output_obj $libobj"
500
 
        if $run $mv $output_obj $libobj; then :
501
 
        else
502
 
          error=$?
503
 
          $run $rm $removelist
504
 
          exit $error
505
 
        fi
506
 
      fi
507
 
 
508
 
      # If we have no pic_flag, then copy the object into place and finish.
509
 
      if test -z "$pic_flag" && test "$build_old_libs" = yes; then
510
 
        # Rename the .lo from within objdir to obj
511
 
        if test -f $obj; then
512
 
          $show $rm $obj
513
 
          $run $rm $obj
514
 
        fi
515
 
 
516
 
        $show "$mv $libobj $obj"
517
 
        if $run $mv $libobj $obj; then :
518
 
        else
519
 
          error=$?
520
 
          $run $rm $removelist
521
 
          exit $error
522
 
        fi
523
 
 
524
 
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
525
 
        if test "X$xdir" = "X$obj"; then
526
 
          xdir="."
527
 
        else
528
 
          xdir="$xdir"
529
 
        fi
530
 
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
531
 
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
532
 
        # Now arrange that obj and lo_libobj become the same file
533
 
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
534
 
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
535
 
          exit 0
536
 
        else
537
 
          error=$?
538
 
          $run $rm $removelist
539
 
          exit $error
540
 
        fi
541
 
      fi
 
776
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 
777
        $show "$mv $output_obj $lobj"
 
778
        if $run $mv $output_obj $lobj; then :
 
779
        else
 
780
          error=$?
 
781
          $run $rm $removelist
 
782
          exit $error
 
783
        fi
 
784
      fi
 
785
 
 
786
      # Append the name of the PIC object to the libtool object file.
 
787
      test -z "$run" && cat >> ${libobj}T <<EOF
 
788
pic_object='$objdir/$objname'
 
789
 
 
790
EOF
542
791
 
543
792
      # Allow error messages only from the first compilation.
544
 
      suppress_output=' >/dev/null 2>&1'
 
793
      if test "$suppress_opt" = yes; then
 
794
        suppress_output=' >/dev/null 2>&1'
 
795
      fi
 
796
    else
 
797
      # No PIC object so indicate it doesn't exist in the libtool
 
798
      # object file.
 
799
      test -z "$run" && cat >> ${libobj}T <<EOF
 
800
pic_object=none
 
801
 
 
802
EOF
545
803
    fi
546
804
 
547
805
    # Only build a position-dependent object if we build old libraries.
548
806
    if test "$build_old_libs" = yes; then
549
 
      command="$base_compile $srcfile"
 
807
      if test "$pic_mode" != yes; then
 
808
        # Don't build PIC code
 
809
        command="$base_compile $srcfile"
 
810
      else
 
811
        command="$base_compile $srcfile $pic_flag"
 
812
      fi
550
813
      if test "$compiler_c_o" = yes; then
551
814
        command="$command -o $obj"
552
 
        output_obj="$obj"
553
815
      fi
554
816
 
555
817
      # Suppress compiler output if we already did a PIC compilation.
556
818
      command="$command$suppress_output"
557
 
      $run $rm "$output_obj"
 
819
      $run $rm "$obj" "$output_obj"
558
820
      $show "$command"
559
821
      if $run eval "$command"; then :
560
822
      else
561
823
        $run $rm $removelist
562
 
        exit 1
 
824
        exit $EXIT_FAILURE
563
825
      fi
564
826
 
565
827
      if test "$need_locks" = warn &&
566
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
567
 
        echo "\
 
828
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
829
        $echo "\
568
830
*** ERROR, $lockfile contains:
569
831
`cat $lockfile 2>/dev/null`
570
832
 
579
841
compiler."
580
842
 
581
843
        $run $rm $removelist
582
 
        exit 1
 
844
        exit $EXIT_FAILURE
583
845
      fi
584
846
 
585
847
      # Just move the object if needed
586
 
      if test x"$output_obj" != x"$obj"; then
 
848
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
587
849
        $show "$mv $output_obj $obj"
588
850
        if $run $mv $output_obj $obj; then :
589
851
        else
593
855
        fi
594
856
      fi
595
857
 
596
 
      # Create an invalid libtool object if no PIC, so that we do not
597
 
      # accidentally link it into a program.
598
 
      if test "$build_libtool_libs" != yes; then
599
 
        $show "echo timestamp > $libobj"
600
 
        $run eval "echo timestamp > \$libobj" || exit $?
601
 
      else
602
 
        # Move the .lo from within objdir
603
 
        $show "$mv $libobj $lo_libobj"
604
 
        if $run $mv $libobj $lo_libobj; then :
605
 
        else
606
 
          error=$?
607
 
          $run $rm $removelist
608
 
          exit $error
609
 
        fi
610
 
      fi
 
858
      # Append the name of the non-PIC object the libtool object file.
 
859
      # Only append if the libtool object file exists.
 
860
      test -z "$run" && cat >> ${libobj}T <<EOF
 
861
# Name of the non-PIC object.
 
862
non_pic_object='$objname'
 
863
 
 
864
EOF
 
865
    else
 
866
      # Append the name of the non-PIC object the libtool object file.
 
867
      # Only append if the libtool object file exists.
 
868
      test -z "$run" && cat >> ${libobj}T <<EOF
 
869
# Name of the non-PIC object.
 
870
non_pic_object=none
 
871
 
 
872
EOF
611
873
    fi
612
874
 
 
875
    $run $mv "${libobj}T" "${libobj}"
 
876
 
613
877
    # Unlock the critical section if it was locked
614
878
    if test "$need_locks" != no; then
615
 
      $rm "$lockfile"
 
879
      $run $rm "$lockfile"
616
880
    fi
617
881
 
618
 
    exit 0
 
882
    exit $EXIT_SUCCESS
619
883
    ;;
620
884
 
621
885
  # libtool link mode
622
 
  link)
 
886
  link | relink)
623
887
    modename="$modename: link"
624
 
    case "$host" in
625
 
    *-*-cygwin* | *-*-mingw* | *-*-os2*)
 
888
    case $host in
 
889
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
626
890
      # It is impossible to link a dll without this setting, and
627
891
      # we shouldn't force the makefile maintainer to figure out
628
892
      # which system we are compiling for in order to pass an extra
629
 
      # flag for every libtool invokation.
 
893
      # flag for every libtool invocation.
630
894
      # allow_undefined=no
631
895
 
632
896
      # FIXME: Unfortunately, there are problems with the above when trying
635
899
      # -no-undefined on the libtool link line when we can be certain
636
900
      # that all symbols are satisfied, otherwise we get a static library.
637
901
      allow_undefined=yes
638
 
 
639
 
      # This is a source program that is used to create dlls on Windows
640
 
      # Don't remove nor modify the starting and closing comments
641
 
# /* ltdll.c starts here */
642
 
# #define WIN32_LEAN_AND_MEAN
643
 
# #include <windows.h>
644
 
# #undef WIN32_LEAN_AND_MEAN
645
 
# #include <stdio.h>
646
 
#
647
 
# #ifndef __CYGWIN__
648
 
# #  ifdef __CYGWIN32__
649
 
# #    define __CYGWIN__ __CYGWIN32__
650
 
# #  endif
651
 
# #endif
652
 
#
653
 
# #ifdef __cplusplus
654
 
# extern "C" {
655
 
# #endif
656
 
# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
657
 
# #ifdef __cplusplus
658
 
# }
659
 
# #endif
660
 
#
661
 
# #ifdef __CYGWIN__
662
 
# #include <cygwin/cygwin_dll.h>
663
 
# DECLARE_CYGWIN_DLL( DllMain );
664
 
# #endif
665
 
# HINSTANCE __hDllInstance_base;
666
 
#
667
 
# BOOL APIENTRY
668
 
# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
669
 
# {
670
 
#   __hDllInstance_base = hInst;
671
 
#   return TRUE;
672
 
# }
673
 
# /* ltdll.c ends here */
674
 
      # This is a source program that is used to create import libraries
675
 
      # on Windows for dlls which lack them. Don't remove nor modify the
676
 
      # starting and closing comments
677
 
# /* impgen.c starts here */
678
 
# /*   Copyright (C) 1999 Free Software Foundation, Inc.
679
 
680
 
#  This file is part of GNU libtool.
681
 
682
 
#  This program is free software; you can redistribute it and/or modify
683
 
#  it under the terms of the GNU General Public License as published by
684
 
#  the Free Software Foundation; either version 2 of the License, or
685
 
#  (at your option) any later version.
686
 
687
 
#  This program is distributed in the hope that it will be useful,
688
 
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
689
 
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
690
 
#  GNU General Public License for more details.
691
 
692
 
#  You should have received a copy of the GNU General Public License
693
 
#  along with this program; if not, write to the Free Software
694
 
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
695
 
#  */
696
 
697
 
#  #include <stdio.h>           /* for printf() */
698
 
#  #include <unistd.h>          /* for open(), lseek(), read() */
699
 
#  #include <fcntl.h>           /* for O_RDONLY, O_BINARY */
700
 
#  #include <string.h>          /* for strdup() */
701
 
702
 
#  static unsigned int
703
 
#  pe_get16 (fd, offset)
704
 
#       int fd;
705
 
#       int offset;
706
 
#  {
707
 
#    unsigned char b[2];
708
 
#    lseek (fd, offset, SEEK_SET);
709
 
#    read (fd, b, 2);
710
 
#    return b[0] + (b[1]<<8);
711
 
#  }
712
 
713
 
#  static unsigned int
714
 
#  pe_get32 (fd, offset)
715
 
#      int fd;
716
 
#      int offset;
717
 
#  {
718
 
#    unsigned char b[4];
719
 
#    lseek (fd, offset, SEEK_SET);
720
 
#    read (fd, b, 4);
721
 
#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
722
 
#  }
723
 
724
 
#  static unsigned int
725
 
#  pe_as32 (ptr)
726
 
#       void *ptr;
727
 
#  {
728
 
#    unsigned char *b = ptr;
729
 
#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
730
 
#  }
731
 
732
 
#  int
733
 
#  main (argc, argv)
734
 
#      int argc;
735
 
#      char *argv[];
736
 
#  {
737
 
#      int dll;
738
 
#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
739
 
#      unsigned long export_rva, export_size, nsections, secptr, expptr;
740
 
#      unsigned long name_rvas, nexp;
741
 
#      unsigned char *expdata, *erva;
742
 
#      char *filename, *dll_name;
743
 
744
 
#      filename = argv[1];
745
 
746
 
#      dll = open(filename, O_RDONLY|O_BINARY);
747
 
#      if (!dll)
748
 
#       return 1;
749
 
750
 
#      dll_name = filename;
751
 
#    
752
 
#      for (i=0; filename[i]; i++)
753
 
#       if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
754
 
#           dll_name = filename + i +1;
755
 
756
 
#      pe_header_offset = pe_get32 (dll, 0x3c);
757
 
#      opthdr_ofs = pe_header_offset + 4 + 20;
758
 
#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
759
 
760
 
#      if (num_entries < 1) /* no exports */
761
 
#       return 1;
762
 
763
 
#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
764
 
#      export_size = pe_get32 (dll, opthdr_ofs + 100);
765
 
#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
766
 
#      secptr = (pe_header_offset + 4 + 20 +
767
 
#             pe_get16 (dll, pe_header_offset + 4 + 16));
768
 
769
 
#      expptr = 0;
770
 
#      for (i = 0; i < nsections; i++)
771
 
#      {
772
 
#       char sname[8];
773
 
#       unsigned long secptr1 = secptr + 40 * i;
774
 
#       unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
775
 
#       unsigned long vsize = pe_get32 (dll, secptr1 + 16);
776
 
#       unsigned long fptr = pe_get32 (dll, secptr1 + 20);
777
 
#       lseek(dll, secptr1, SEEK_SET);
778
 
#       read(dll, sname, 8);
779
 
#       if (vaddr <= export_rva && vaddr+vsize > export_rva)
780
 
#       {
781
 
#           expptr = fptr + (export_rva - vaddr);
782
 
#           if (export_rva + export_size > vaddr + vsize)
783
 
#               export_size = vsize - (export_rva - vaddr);
784
 
#           break;
785
 
#       }
786
 
#      }
787
 
788
 
#      expdata = (unsigned char*)malloc(export_size);
789
 
#      lseek (dll, expptr, SEEK_SET);
790
 
#      read (dll, expdata, export_size);
791
 
#      erva = expdata - export_rva;
792
 
793
 
#      nexp = pe_as32 (expdata+24);
794
 
#      name_rvas = pe_as32 (expdata+32);
795
 
796
 
#      printf ("EXPORTS\n");
797
 
#      for (i = 0; i<nexp; i++)
798
 
#      {
799
 
#       unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
800
 
#       printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
801
 
#      }
802
 
803
 
#      return 0;
804
 
#  }
805
 
# /* impgen.c ends here */
806
902
      ;;
807
903
    *)
808
904
      allow_undefined=yes
809
905
      ;;
810
906
    esac
 
907
    libtool_args="$nonopt"
 
908
    base_compile="$nonopt $@"
811
909
    compile_command="$nonopt"
812
910
    finalize_command="$nonopt"
813
911
 
818
916
    convenience=
819
917
    old_convenience=
820
918
    deplibs=
821
 
    linkopts=
 
919
    old_deplibs=
 
920
    compiler_flags=
 
921
    linker_flags=
 
922
    dllsearchpath=
 
923
    lib_search_path=`pwd`
 
924
    inst_prefix_dir=
822
925
 
823
 
    if test -n "$shlibpath_var"; then
824
 
      # get the directories listed in $shlibpath_var
825
 
      eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
826
 
    else
827
 
      lib_search_path=
828
 
    fi
829
 
    # now prepend the system-specific ones
830
 
    eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
831
 
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
832
 
    
833
926
    avoid_version=no
834
927
    dlfiles=
835
928
    dlprefiles=
839
932
    export_symbols_regex=
840
933
    generated=
841
934
    libobjs=
842
 
    link_against_libtool_libs=
843
935
    ltlibs=
844
936
    module=no
 
937
    no_install=no
845
938
    objs=
 
939
    non_pic_objects=
 
940
    precious_files_regex=
846
941
    prefer_static_libs=no
847
942
    preload=no
848
943
    prev=
854
949
    temp_rpath=
855
950
    thread_safe=no
856
951
    vinfo=
 
952
    vinfo_number=no
 
953
 
 
954
    func_infer_tag $base_compile
857
955
 
858
956
    # We need to know -static, to get the right output filenames.
859
957
    for arg
860
958
    do
861
 
      case "$arg" in
 
959
      case $arg in
862
960
      -all-static | -static)
863
961
        if test "X$arg" = "X-all-static"; then
864
962
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
884
982
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
885
983
 
886
984
    # Go through the arguments, transforming them on the way.
887
 
    while test $# -gt 0; do
 
985
    while test "$#" -gt 0; do
888
986
      arg="$1"
889
987
      shift
 
988
      case $arg in
 
989
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
990
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
 
991
        ;;
 
992
      *) qarg=$arg ;;
 
993
      esac
 
994
      libtool_args="$libtool_args $qarg"
890
995
 
891
996
      # If the previous option needs an argument, assign it.
892
997
      if test -n "$prev"; then
893
 
        case "$prev" in
 
998
        case $prev in
894
999
        output)
895
1000
          compile_command="$compile_command @OUTPUT@"
896
1001
          finalize_command="$finalize_command @OUTPUT@"
897
1002
          ;;
898
1003
        esac
899
1004
 
900
 
        case "$prev" in
 
1005
        case $prev in
901
1006
        dlfiles|dlprefiles)
902
1007
          if test "$preload" = no; then
903
1008
            # Add the symbol object into the linking commands.
905
1010
            finalize_command="$finalize_command @SYMFILE@"
906
1011
            preload=yes
907
1012
          fi
908
 
          case "$arg" in
 
1013
          case $arg in
909
1014
          *.la | *.lo) ;;  # We handle these cases below.
910
1015
          force)
911
1016
            if test "$dlself" = no; then
934
1039
              dlprefiles="$dlprefiles $arg"
935
1040
            fi
936
1041
            prev=
 
1042
            continue
937
1043
            ;;
938
1044
          esac
939
1045
          ;;
941
1047
          export_symbols="$arg"
942
1048
          if test ! -f "$arg"; then
943
1049
            $echo "$modename: symbol file \`$arg' does not exist"
944
 
            exit 1
 
1050
            exit $EXIT_FAILURE
945
1051
          fi
946
1052
          prev=
947
1053
          continue
951
1057
          prev=
952
1058
          continue
953
1059
          ;;
 
1060
        inst_prefix)
 
1061
          inst_prefix_dir="$arg"
 
1062
          prev=
 
1063
          continue
 
1064
          ;;
 
1065
        precious_regex)
 
1066
          precious_files_regex="$arg"
 
1067
          prev=
 
1068
          continue
 
1069
          ;;
954
1070
        release)
955
1071
          release="-$arg"
956
1072
          prev=
957
1073
          continue
958
1074
          ;;
 
1075
        objectlist)
 
1076
          if test -f "$arg"; then
 
1077
            save_arg=$arg
 
1078
            moreargs=
 
1079
            for fil in `cat $save_arg`
 
1080
            do
 
1081
#             moreargs="$moreargs $fil"
 
1082
              arg=$fil
 
1083
              # A libtool-controlled object.
 
1084
 
 
1085
              # Check to see that this really is a libtool object.
 
1086
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1087
                pic_object=
 
1088
                non_pic_object=
 
1089
 
 
1090
                # Read the .lo file
 
1091
                # If there is no directory component, then add one.
 
1092
                case $arg in
 
1093
                */* | *\\*) . $arg ;;
 
1094
                *) . ./$arg ;;
 
1095
                esac
 
1096
 
 
1097
                if test -z "$pic_object" || \
 
1098
                   test -z "$non_pic_object" ||
 
1099
                   test "$pic_object" = none && \
 
1100
                   test "$non_pic_object" = none; then
 
1101
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1102
                  exit $EXIT_FAILURE
 
1103
                fi
 
1104
 
 
1105
                # Extract subdirectory from the argument.
 
1106
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1107
                if test "X$xdir" = "X$arg"; then
 
1108
                  xdir=
 
1109
                else
 
1110
                  xdir="$xdir/"
 
1111
                fi
 
1112
 
 
1113
                if test "$pic_object" != none; then
 
1114
                  # Prepend the subdirectory the object is found in.
 
1115
                  pic_object="$xdir$pic_object"
 
1116
 
 
1117
                  if test "$prev" = dlfiles; then
 
1118
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1119
                      dlfiles="$dlfiles $pic_object"
 
1120
                      prev=
 
1121
                      continue
 
1122
                    else
 
1123
                      # If libtool objects are unsupported, then we need to preload.
 
1124
                      prev=dlprefiles
 
1125
                    fi
 
1126
                  fi
 
1127
 
 
1128
                  # CHECK ME:  I think I busted this.  -Ossama
 
1129
                  if test "$prev" = dlprefiles; then
 
1130
                    # Preload the old-style object.
 
1131
                    dlprefiles="$dlprefiles $pic_object"
 
1132
                    prev=
 
1133
                  fi
 
1134
 
 
1135
                  # A PIC object.
 
1136
                  libobjs="$libobjs $pic_object"
 
1137
                  arg="$pic_object"
 
1138
                fi
 
1139
 
 
1140
                # Non-PIC object.
 
1141
                if test "$non_pic_object" != none; then
 
1142
                  # Prepend the subdirectory the object is found in.
 
1143
                  non_pic_object="$xdir$non_pic_object"
 
1144
 
 
1145
                  # A standard non-PIC object
 
1146
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1147
                  if test -z "$pic_object" || test "$pic_object" = none ; then
 
1148
                    arg="$non_pic_object"
 
1149
                  fi
 
1150
                fi
 
1151
              else
 
1152
                # Only an error if not doing a dry-run.
 
1153
                if test -z "$run"; then
 
1154
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1155
                  exit $EXIT_FAILURE
 
1156
                else
 
1157
                  # Dry-run case.
 
1158
 
 
1159
                  # Extract subdirectory from the argument.
 
1160
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1161
                  if test "X$xdir" = "X$arg"; then
 
1162
                    xdir=
 
1163
                  else
 
1164
                    xdir="$xdir/"
 
1165
                  fi
 
1166
 
 
1167
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1168
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1169
                  libobjs="$libobjs $pic_object"
 
1170
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1171
                fi
 
1172
              fi
 
1173
            done
 
1174
          else
 
1175
            $echo "$modename: link input file \`$save_arg' does not exist"
 
1176
            exit $EXIT_FAILURE
 
1177
          fi
 
1178
          arg=$save_arg
 
1179
          prev=
 
1180
          continue
 
1181
          ;;
959
1182
        rpath | xrpath)
960
1183
          # We need an absolute path.
961
 
          case "$arg" in
 
1184
          case $arg in
962
1185
          [\\/]* | [A-Za-z]:[\\/]*) ;;
963
1186
          *)
964
1187
            $echo "$modename: only absolute run-paths are allowed" 1>&2
965
 
            exit 1
 
1188
            exit $EXIT_FAILURE
966
1189
            ;;
967
1190
          esac
968
1191
          if test "$prev" = rpath; then
979
1202
          prev=
980
1203
          continue
981
1204
          ;;
 
1205
        xcompiler)
 
1206
          compiler_flags="$compiler_flags $qarg"
 
1207
          prev=
 
1208
          compile_command="$compile_command $qarg"
 
1209
          finalize_command="$finalize_command $qarg"
 
1210
          continue
 
1211
          ;;
 
1212
        xlinker)
 
1213
          linker_flags="$linker_flags $qarg"
 
1214
          compiler_flags="$compiler_flags $wl$qarg"
 
1215
          prev=
 
1216
          compile_command="$compile_command $wl$qarg"
 
1217
          finalize_command="$finalize_command $wl$qarg"
 
1218
          continue
 
1219
          ;;
 
1220
        xcclinker)
 
1221
          linker_flags="$linker_flags $qarg"
 
1222
          compiler_flags="$compiler_flags $qarg"
 
1223
          prev=
 
1224
          compile_command="$compile_command $qarg"
 
1225
          finalize_command="$finalize_command $qarg"
 
1226
          continue
 
1227
          ;;
 
1228
        shrext)
 
1229
          shrext_cmds="$arg"
 
1230
          prev=
 
1231
          continue
 
1232
          ;;
982
1233
        *)
983
1234
          eval "$prev=\"\$arg\""
984
1235
          prev=
985
1236
          continue
986
1237
          ;;
987
1238
        esac
988
 
      fi
 
1239
      fi # test -n "$prev"
989
1240
 
990
1241
      prevarg="$arg"
991
1242
 
992
 
      case "$arg" in
 
1243
      case $arg in
993
1244
      -all-static)
994
1245
        if test -n "$link_static_flag"; then
995
1246
          compile_command="$compile_command $link_static_flag"
1026
1277
 
1027
1278
      -export-symbols | -export-symbols-regex)
1028
1279
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1029
 
          $echo "$modename: not more than one -exported-symbols argument allowed"
1030
 
          exit 1
 
1280
          $echo "$modename: more than one -exported-symbols argument is not allowed"
 
1281
          exit $EXIT_FAILURE
1031
1282
        fi
1032
1283
        if test "X$arg" = "X-export-symbols"; then
1033
1284
          prev=expsyms
1037
1288
        continue
1038
1289
        ;;
1039
1290
 
 
1291
      -inst-prefix-dir)
 
1292
        prev=inst_prefix
 
1293
        continue
 
1294
        ;;
 
1295
 
 
1296
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
 
1297
      # so, if we see these flags be careful not to treat them like -L
 
1298
      -L[A-Z][A-Z]*:*)
 
1299
        case $with_gcc/$host in
 
1300
        no/*-*-irix* | /*-*-irix*)
 
1301
          compile_command="$compile_command $arg"
 
1302
          finalize_command="$finalize_command $arg"
 
1303
          ;;
 
1304
        esac
 
1305
        continue
 
1306
        ;;
 
1307
 
1040
1308
      -L*)
1041
1309
        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1042
1310
        # We need an absolute path.
1043
 
        case "$dir" in
 
1311
        case $dir in
1044
1312
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1045
1313
        *)
1046
1314
          absdir=`cd "$dir" && pwd`
1047
1315
          if test -z "$absdir"; then
1048
 
            $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1049
 
            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1050
 
            absdir="$dir"
 
1316
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
 
1317
            exit $EXIT_FAILURE
1051
1318
          fi
1052
1319
          dir="$absdir"
1053
1320
          ;;
1054
1321
        esac
1055
 
        case " $deplibs " in
1056
 
        *" $arg "*) ;;
1057
 
        *) deplibs="$deplibs $arg";;
1058
 
        esac
1059
 
        case " $lib_search_path " in
1060
 
        *" $dir "*) ;;
1061
 
        *) lib_search_path="$lib_search_path $dir";;
1062
 
        esac
1063
 
        case "$host" in
1064
 
        *-*-cygwin* | *-*-mingw* | *-*-os2*)
1065
 
          dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1066
 
          case ":$dllsearchpath:" in
1067
 
          ::) dllsearchpath="$dllsearchdir";;
1068
 
          *":$dllsearchdir:"*) ;;
1069
 
          *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
 
1322
        case "$deplibs " in
 
1323
        *" -L$dir "*) ;;
 
1324
        *)
 
1325
          deplibs="$deplibs -L$dir"
 
1326
          lib_search_path="$lib_search_path $dir"
 
1327
          ;;
 
1328
        esac
 
1329
        case $host in
 
1330
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1331
          case :$dllsearchpath: in
 
1332
          *":$dir:"*) ;;
 
1333
          *) dllsearchpath="$dllsearchpath:$dir";;
1070
1334
          esac
1071
1335
          ;;
1072
1336
        esac
 
1337
        continue
1073
1338
        ;;
1074
1339
 
1075
1340
      -l*)
1076
 
        if test "$arg" = "-lc"; then
1077
 
          case "$host" in
1078
 
          *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1079
 
            # These systems don't actually have c library (as such)
1080
 
            continue
1081
 
            ;;
1082
 
          esac
1083
 
        elif test "$arg" = "-lm"; then
1084
 
          case "$host" in
1085
 
          *-*-cygwin* | *-*-beos*)
1086
 
            # These systems don't actually have math library (as such)
1087
 
            continue
1088
 
            ;;
1089
 
          esac
 
1341
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 
1342
          case $host in
 
1343
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1344
            # These systems don't actually have a C or math library (as such)
 
1345
            continue
 
1346
            ;;
 
1347
          *-*-mingw* | *-*-os2*)
 
1348
            # These systems don't actually have a C library (as such)
 
1349
            test "X$arg" = "X-lc" && continue
 
1350
            ;;
 
1351
          *-*-openbsd* | *-*-freebsd*)
 
1352
            # Do not include libc due to us having libc/libc_r.
 
1353
            test "X$arg" = "X-lc" && continue
 
1354
            ;;
 
1355
          *-*-rhapsody* | *-*-darwin1.[012])
 
1356
            # Rhapsody C and math libraries are in the System framework
 
1357
            deplibs="$deplibs -framework System"
 
1358
            continue
 
1359
          esac
 
1360
        elif test "X$arg" = "X-lc_r"; then
 
1361
         case $host in
 
1362
         *-*-openbsd* | *-*-freebsd*)
 
1363
           # Do not include libc_r directly, use -pthread flag.
 
1364
           continue
 
1365
           ;;
 
1366
         esac
1090
1367
        fi
1091
1368
        deplibs="$deplibs $arg"
 
1369
        continue
 
1370
        ;;
 
1371
 
 
1372
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1373
        deplibs="$deplibs $arg"
 
1374
        continue
1092
1375
        ;;
1093
1376
 
1094
1377
      -module)
1096
1379
        continue
1097
1380
        ;;
1098
1381
 
 
1382
      # gcc -m* arguments should be passed to the linker via $compiler_flags
 
1383
      # in order to pass architecture information to the linker
 
1384
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
 
1385
      # but this is not reliable with gcc because gcc may use -mfoo to
 
1386
      # select a different linker, different libraries, etc, while
 
1387
      # -Wl,-mfoo simply passes -mfoo to the linker.
 
1388
      -m*)
 
1389
        # Unknown arguments in both finalize_command and compile_command need
 
1390
        # to be aesthetically quoted because they are evaled later.
 
1391
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1392
        case $arg in
 
1393
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1394
          arg="\"$arg\""
 
1395
          ;;
 
1396
        esac
 
1397
        compile_command="$compile_command $arg"
 
1398
        finalize_command="$finalize_command $arg"
 
1399
        if test "$with_gcc" = "yes" ; then
 
1400
          compiler_flags="$compiler_flags $arg"
 
1401
        fi
 
1402
        continue
 
1403
        ;;
 
1404
 
 
1405
      -shrext)
 
1406
        prev=shrext
 
1407
        continue
 
1408
        ;;
 
1409
 
 
1410
      -no-fast-install)
 
1411
        fast_install=no
 
1412
        continue
 
1413
        ;;
 
1414
 
 
1415
      -no-install)
 
1416
        case $host in
 
1417
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1418
          # The PATH hackery in wrapper scripts is required on Windows
 
1419
          # in order for the loader to find any dlls it needs.
 
1420
          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
 
1421
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
 
1422
          fast_install=no
 
1423
          ;;
 
1424
        *) no_install=yes ;;
 
1425
        esac
 
1426
        continue
 
1427
        ;;
 
1428
 
1099
1429
      -no-undefined)
1100
1430
        allow_undefined=no
1101
1431
        continue
1102
1432
        ;;
1103
1433
 
 
1434
      -objectlist)
 
1435
        prev=objectlist
 
1436
        continue
 
1437
        ;;
 
1438
 
1104
1439
      -o) prev=output ;;
1105
1440
 
 
1441
      -precious-files-regex)
 
1442
        prev=precious_regex
 
1443
        continue
 
1444
        ;;
 
1445
 
1106
1446
      -release)
1107
1447
        prev=release
1108
1448
        continue
1121
1461
      -R*)
1122
1462
        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1123
1463
        # We need an absolute path.
1124
 
        case "$dir" in
 
1464
        case $dir in
1125
1465
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1126
1466
        *)
1127
1467
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1128
 
          exit 1
 
1468
          exit $EXIT_FAILURE
1129
1469
          ;;
1130
1470
        esac
1131
1471
        case "$xrpath " in
1136
1476
        ;;
1137
1477
 
1138
1478
      -static)
1139
 
        # If we have no pic_flag, then this is the same as -all-static.
1140
 
        if test -z "$pic_flag" && test -n "$link_static_flag"; then
1141
 
          compile_command="$compile_command $link_static_flag"
1142
 
          finalize_command="$finalize_command $link_static_flag"
1143
 
        fi
 
1479
        # The effects of -static are defined in a previous loop.
 
1480
        # We used to do the same as -all-static on platforms that
 
1481
        # didn't have a PIC flag, but the assumption that the effects
 
1482
        # would be equivalent was wrong.  It would break on at least
 
1483
        # Digital Unix and AIX.
1144
1484
        continue
1145
1485
        ;;
1146
1486
 
1153
1493
        prev=vinfo
1154
1494
        continue
1155
1495
        ;;
 
1496
      -version-number)
 
1497
        prev=vinfo
 
1498
        vinfo_number=yes
 
1499
        continue
 
1500
        ;;
 
1501
 
 
1502
      -Wc,*)
 
1503
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
 
1504
        arg=
 
1505
        save_ifs="$IFS"; IFS=','
 
1506
        for flag in $args; do
 
1507
          IFS="$save_ifs"
 
1508
          case $flag in
 
1509
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1510
            flag="\"$flag\""
 
1511
            ;;
 
1512
          esac
 
1513
          arg="$arg $wl$flag"
 
1514
          compiler_flags="$compiler_flags $flag"
 
1515
        done
 
1516
        IFS="$save_ifs"
 
1517
        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
 
1518
        ;;
 
1519
 
 
1520
      -Wl,*)
 
1521
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
 
1522
        arg=
 
1523
        save_ifs="$IFS"; IFS=','
 
1524
        for flag in $args; do
 
1525
          IFS="$save_ifs"
 
1526
          case $flag in
 
1527
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1528
            flag="\"$flag\""
 
1529
            ;;
 
1530
          esac
 
1531
          arg="$arg $wl$flag"
 
1532
          compiler_flags="$compiler_flags $wl$flag"
 
1533
          linker_flags="$linker_flags $flag"
 
1534
        done
 
1535
        IFS="$save_ifs"
 
1536
        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
 
1537
        ;;
 
1538
 
 
1539
      -Xcompiler)
 
1540
        prev=xcompiler
 
1541
        continue
 
1542
        ;;
 
1543
 
 
1544
      -Xlinker)
 
1545
        prev=xlinker
 
1546
        continue
 
1547
        ;;
 
1548
 
 
1549
      -XCClinker)
 
1550
        prev=xcclinker
 
1551
        continue
 
1552
        ;;
1156
1553
 
1157
1554
      # Some other compiler flag.
1158
1555
      -* | +*)
1159
1556
        # Unknown arguments in both finalize_command and compile_command need
1160
1557
        # to be aesthetically quoted because they are evaled later.
1161
1558
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1162
 
        case "$arg" in
1163
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
 
1559
        case $arg in
 
1560
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1164
1561
          arg="\"$arg\""
1165
1562
          ;;
1166
1563
        esac
1167
1564
        ;;
1168
1565
 
1169
 
      *.o | *.obj | *.a | *.lib)
 
1566
      *.$objext)
1170
1567
        # A standard object.
1171
1568
        objs="$objs $arg"
1172
1569
        ;;
1173
1570
 
1174
1571
      *.lo)
1175
 
        # A library object.
1176
 
        if test "$prev" = dlfiles; then
1177
 
          dlfiles="$dlfiles $arg"
1178
 
          if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1179
 
            prev=
1180
 
            continue
 
1572
        # A libtool-controlled object.
 
1573
 
 
1574
        # Check to see that this really is a libtool object.
 
1575
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1576
          pic_object=
 
1577
          non_pic_object=
 
1578
 
 
1579
          # Read the .lo file
 
1580
          # If there is no directory component, then add one.
 
1581
          case $arg in
 
1582
          */* | *\\*) . $arg ;;
 
1583
          *) . ./$arg ;;
 
1584
          esac
 
1585
 
 
1586
          if test -z "$pic_object" || \
 
1587
             test -z "$non_pic_object" ||
 
1588
             test "$pic_object" = none && \
 
1589
             test "$non_pic_object" = none; then
 
1590
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1591
            exit $EXIT_FAILURE
 
1592
          fi
 
1593
 
 
1594
          # Extract subdirectory from the argument.
 
1595
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1596
          if test "X$xdir" = "X$arg"; then
 
1597
            xdir=
 
1598
          else
 
1599
            xdir="$xdir/"
 
1600
          fi
 
1601
 
 
1602
          if test "$pic_object" != none; then
 
1603
            # Prepend the subdirectory the object is found in.
 
1604
            pic_object="$xdir$pic_object"
 
1605
 
 
1606
            if test "$prev" = dlfiles; then
 
1607
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1608
                dlfiles="$dlfiles $pic_object"
 
1609
                prev=
 
1610
                continue
 
1611
              else
 
1612
                # If libtool objects are unsupported, then we need to preload.
 
1613
                prev=dlprefiles
 
1614
              fi
 
1615
            fi
 
1616
 
 
1617
            # CHECK ME:  I think I busted this.  -Ossama
 
1618
            if test "$prev" = dlprefiles; then
 
1619
              # Preload the old-style object.
 
1620
              dlprefiles="$dlprefiles $pic_object"
 
1621
              prev=
 
1622
            fi
 
1623
 
 
1624
            # A PIC object.
 
1625
            libobjs="$libobjs $pic_object"
 
1626
            arg="$pic_object"
 
1627
          fi
 
1628
 
 
1629
          # Non-PIC object.
 
1630
          if test "$non_pic_object" != none; then
 
1631
            # Prepend the subdirectory the object is found in.
 
1632
            non_pic_object="$xdir$non_pic_object"
 
1633
 
 
1634
            # A standard non-PIC object
 
1635
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1636
            if test -z "$pic_object" || test "$pic_object" = none ; then
 
1637
              arg="$non_pic_object"
 
1638
            fi
 
1639
          fi
 
1640
        else
 
1641
          # Only an error if not doing a dry-run.
 
1642
          if test -z "$run"; then
 
1643
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1644
            exit $EXIT_FAILURE
1181
1645
          else
1182
 
            # If libtool objects are unsupported, then we need to preload.
1183
 
            prev=dlprefiles
 
1646
            # Dry-run case.
 
1647
 
 
1648
            # Extract subdirectory from the argument.
 
1649
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1650
            if test "X$xdir" = "X$arg"; then
 
1651
              xdir=
 
1652
            else
 
1653
              xdir="$xdir/"
 
1654
            fi
 
1655
 
 
1656
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1657
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1658
            libobjs="$libobjs $pic_object"
 
1659
            non_pic_objects="$non_pic_objects $non_pic_object"
1184
1660
          fi
1185
1661
        fi
 
1662
        ;;
1186
1663
 
1187
 
        if test "$prev" = dlprefiles; then
1188
 
          # Preload the old-style object.
1189
 
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1190
 
          prev=
1191
 
        fi
1192
 
        libobjs="$libobjs $arg"
 
1664
      *.$libext)
 
1665
        # An archive.
 
1666
        deplibs="$deplibs $arg"
 
1667
        old_deplibs="$old_deplibs $arg"
 
1668
        continue
1193
1669
        ;;
1194
1670
 
1195
1671
      *.la)
1196
1672
        # A libtool-controlled library.
1197
1673
 
 
1674
        if test "$prev" = dlfiles; then
 
1675
          # This library was specified with -dlopen.
 
1676
          dlfiles="$dlfiles $arg"
 
1677
          prev=
 
1678
        elif test "$prev" = dlprefiles; then
 
1679
          # The library was specified with -dlpreopen.
 
1680
          dlprefiles="$dlprefiles $arg"
 
1681
          prev=
 
1682
        else
 
1683
          deplibs="$deplibs $arg"
 
1684
        fi
 
1685
        continue
 
1686
        ;;
 
1687
 
 
1688
      # Some other compiler argument.
 
1689
      *)
 
1690
        # Unknown arguments in both finalize_command and compile_command need
 
1691
        # to be aesthetically quoted because they are evaled later.
 
1692
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1693
        case $arg in
 
1694
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1695
          arg="\"$arg\""
 
1696
          ;;
 
1697
        esac
 
1698
        ;;
 
1699
      esac # arg
 
1700
 
 
1701
      # Now actually substitute the argument into the commands.
 
1702
      if test -n "$arg"; then
 
1703
        compile_command="$compile_command $arg"
 
1704
        finalize_command="$finalize_command $arg"
 
1705
      fi
 
1706
    done # argument parsing loop
 
1707
 
 
1708
    if test -n "$prev"; then
 
1709
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
 
1710
      $echo "$help" 1>&2
 
1711
      exit $EXIT_FAILURE
 
1712
    fi
 
1713
 
 
1714
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
 
1715
      eval arg=\"$export_dynamic_flag_spec\"
 
1716
      compile_command="$compile_command $arg"
 
1717
      finalize_command="$finalize_command $arg"
 
1718
    fi
 
1719
 
 
1720
    oldlibs=
 
1721
    # calculate the name of the file, without its directory
 
1722
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
 
1723
    libobjs_save="$libobjs"
 
1724
 
 
1725
    if test -n "$shlibpath_var"; then
 
1726
      # get the directories listed in $shlibpath_var
 
1727
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
 
1728
    else
 
1729
      shlib_search_path=
 
1730
    fi
 
1731
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
 
1732
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
 
1733
 
 
1734
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
 
1735
    if test "X$output_objdir" = "X$output"; then
 
1736
      output_objdir="$objdir"
 
1737
    else
 
1738
      output_objdir="$output_objdir/$objdir"
 
1739
    fi
 
1740
    # Create the object directory.
 
1741
    if test ! -d "$output_objdir"; then
 
1742
      $show "$mkdir $output_objdir"
 
1743
      $run $mkdir $output_objdir
 
1744
      status=$?
 
1745
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
 
1746
        exit $status
 
1747
      fi
 
1748
    fi
 
1749
 
 
1750
    # Determine the type of output
 
1751
    case $output in
 
1752
    "")
 
1753
      $echo "$modename: you must specify an output file" 1>&2
 
1754
      $echo "$help" 1>&2
 
1755
      exit $EXIT_FAILURE
 
1756
      ;;
 
1757
    *.$libext) linkmode=oldlib ;;
 
1758
    *.lo | *.$objext) linkmode=obj ;;
 
1759
    *.la) linkmode=lib ;;
 
1760
    *) linkmode=prog ;; # Anything else should be a program.
 
1761
    esac
 
1762
 
 
1763
    case $host in
 
1764
    *cygwin* | *mingw* | *pw32*)
 
1765
      # don't eliminate duplications in $postdeps and $predeps
 
1766
      duplicate_compiler_generated_deps=yes
 
1767
      ;;
 
1768
    *)
 
1769
      duplicate_compiler_generated_deps=$duplicate_deps
 
1770
      ;;
 
1771
    esac
 
1772
    specialdeplibs=
 
1773
 
 
1774
    libs=
 
1775
    # Find all interdependent deplibs by searching for libraries
 
1776
    # that are linked more than once (e.g. -la -lb -la)
 
1777
    for deplib in $deplibs; do
 
1778
      if test "X$duplicate_deps" = "Xyes" ; then
 
1779
        case "$libs " in
 
1780
        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1781
        esac
 
1782
      fi
 
1783
      libs="$libs $deplib"
 
1784
    done
 
1785
 
 
1786
    if test "$linkmode" = lib; then
 
1787
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
1788
 
 
1789
      # Compute libraries that are listed more than once in $predeps
 
1790
      # $postdeps and mark them as special (i.e., whose duplicates are
 
1791
      # not to be eliminated).
 
1792
      pre_post_deps=
 
1793
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
1794
        for pre_post_dep in $predeps $postdeps; do
 
1795
          case "$pre_post_deps " in
 
1796
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
1797
          esac
 
1798
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
1799
        done
 
1800
      fi
 
1801
      pre_post_deps=
 
1802
    fi
 
1803
 
 
1804
    deplibs=
 
1805
    newdependency_libs=
 
1806
    newlib_search_path=
 
1807
    need_relink=no # whether we're linking any uninstalled libtool libraries
 
1808
    notinst_deplibs= # not-installed libtool libraries
 
1809
    notinst_path= # paths that contain not-installed libtool libraries
 
1810
    case $linkmode in
 
1811
    lib)
 
1812
        passes="conv link"
 
1813
        for file in $dlfiles $dlprefiles; do
 
1814
          case $file in
 
1815
          *.la) ;;
 
1816
          *)
 
1817
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
 
1818
            exit $EXIT_FAILURE
 
1819
            ;;
 
1820
          esac
 
1821
        done
 
1822
        ;;
 
1823
    prog)
 
1824
        compile_deplibs=
 
1825
        finalize_deplibs=
 
1826
        alldeplibs=no
 
1827
        newdlfiles=
 
1828
        newdlprefiles=
 
1829
        passes="conv scan dlopen dlpreopen link"
 
1830
        ;;
 
1831
    *)  passes="conv"
 
1832
        ;;
 
1833
    esac
 
1834
    for pass in $passes; do
 
1835
      if test "$linkmode,$pass" = "lib,link" ||
 
1836
         test "$linkmode,$pass" = "prog,scan"; then
 
1837
        libs="$deplibs"
 
1838
        deplibs=
 
1839
      fi
 
1840
      if test "$linkmode" = prog; then
 
1841
        case $pass in
 
1842
        dlopen) libs="$dlfiles" ;;
 
1843
        dlpreopen) libs="$dlprefiles" ;;
 
1844
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
1845
        esac
 
1846
      fi
 
1847
      if test "$pass" = dlopen; then
 
1848
        # Collect dlpreopened libraries
 
1849
        save_deplibs="$deplibs"
 
1850
        deplibs=
 
1851
      fi
 
1852
      for deplib in $libs; do
 
1853
        lib=
 
1854
        found=no
 
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
          ;;
 
1865
        -l*)
 
1866
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
1867
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
 
1868
            continue
 
1869
          fi
 
1870
          if test "$pass" = conv; then
 
1871
            deplibs="$deplib $deplibs"
 
1872
            continue
 
1873
          fi
 
1874
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
 
1875
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
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
 
1888
          done
 
1889
          if test "$found" != yes; then
 
1890
            # deplib doesn't seem to be a libtool library
 
1891
            if test "$linkmode,$pass" = "prog,link"; then
 
1892
              compile_deplibs="$deplib $compile_deplibs"
 
1893
              finalize_deplibs="$deplib $finalize_deplibs"
 
1894
            else
 
1895
              deplibs="$deplib $deplibs"
 
1896
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
1897
            fi
 
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
 
1935
          fi
 
1936
          ;; # -l
 
1937
        -L*)
 
1938
          case $linkmode in
 
1939
          lib)
 
1940
            deplibs="$deplib $deplibs"
 
1941
            test "$pass" = conv && continue
 
1942
            newdependency_libs="$deplib $newdependency_libs"
 
1943
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 
1944
            ;;
 
1945
          prog)
 
1946
            if test "$pass" = conv; then
 
1947
              deplibs="$deplib $deplibs"
 
1948
              continue
 
1949
            fi
 
1950
            if test "$pass" = scan; then
 
1951
              deplibs="$deplib $deplibs"
 
1952
            else
 
1953
              compile_deplibs="$deplib $compile_deplibs"
 
1954
              finalize_deplibs="$deplib $finalize_deplibs"
 
1955
            fi
 
1956
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 
1957
            ;;
 
1958
          *)
 
1959
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
 
1960
            ;;
 
1961
          esac # linkmode
 
1962
          continue
 
1963
          ;; # -L
 
1964
        -R*)
 
1965
          if test "$pass" = link; then
 
1966
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
 
1967
            # Make sure the xrpath contains only unique directories.
 
1968
            case "$xrpath " in
 
1969
            *" $dir "*) ;;
 
1970
            *) xrpath="$xrpath $dir" ;;
 
1971
            esac
 
1972
          fi
 
1973
          deplibs="$deplib $deplibs"
 
1974
          continue
 
1975
          ;;
 
1976
        *.la) lib="$deplib" ;;
 
1977
        *.$libext)
 
1978
          if test "$pass" = conv; then
 
1979
            deplibs="$deplib $deplibs"
 
1980
            continue
 
1981
          fi
 
1982
          case $linkmode in
 
1983
          lib)
 
1984
            if test "$deplibs_check_method" != pass_all; then
 
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."
 
1992
            else
 
1993
              $echo
 
1994
              $echo "*** Warning: Linking the shared library $output against the"
 
1995
              $echo "*** static library $deplib is not portable!"
 
1996
              deplibs="$deplib $deplibs"
 
1997
            fi
 
1998
            continue
 
1999
            ;;
 
2000
          prog)
 
2001
            if test "$pass" != link; then
 
2002
              deplibs="$deplib $deplibs"
 
2003
            else
 
2004
              compile_deplibs="$deplib $compile_deplibs"
 
2005
              finalize_deplibs="$deplib $finalize_deplibs"
 
2006
            fi
 
2007
            continue
 
2008
            ;;
 
2009
          esac # linkmode
 
2010
          ;; # *.$libext
 
2011
        *.lo | *.$objext)
 
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
 
2024
          fi
 
2025
          continue
 
2026
          ;;
 
2027
        %DEPLIBS%)
 
2028
          alldeplibs=yes
 
2029
          continue
 
2030
          ;;
 
2031
        esac # case $deplib
 
2032
        if test "$found" = yes || test -f "$lib"; then :
 
2033
        else
 
2034
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
2035
          exit $EXIT_FAILURE
 
2036
        fi
 
2037
 
 
2038
        # Check to see that this really is a libtool archive.
 
2039
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2040
        else
 
2041
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
2042
          exit $EXIT_FAILURE
 
2043
        fi
 
2044
 
 
2045
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
2046
        test "X$ladir" = "X$lib" && ladir="."
 
2047
 
1198
2048
        dlname=
 
2049
        dlopen=
 
2050
        dlpreopen=
1199
2051
        libdir=
1200
2052
        library_names=
1201
2053
        old_library=
1202
 
 
1203
 
        # Check to see that this really is a libtool archive.
1204
 
        if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1205
 
        else
1206
 
          $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1207
 
          exit 1
1208
 
        fi
1209
 
 
1210
2054
        # If the library was installed with an old release of libtool,
1211
 
        # it will not redefine variable installed.
 
2055
        # it will not redefine variables installed, or shouldnotlink
1212
2056
        installed=yes
 
2057
        shouldnotlink=no
1213
2058
 
1214
2059
        # Read the .la file
1215
 
        # If there is no directory component, then add one.
1216
 
        case "$arg" in
1217
 
        */* | *\\*) . $arg ;;
1218
 
        *) . ./$arg ;;
 
2060
        case $lib in
 
2061
        */* | *\\*) . $lib ;;
 
2062
        *) . ./$lib ;;
1219
2063
        esac
1220
2064
 
 
2065
        if test "$linkmode,$pass" = "lib,link" ||
 
2066
           test "$linkmode,$pass" = "prog,scan" ||
 
2067
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
 
2068
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
 
2069
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
 
2070
        fi
 
2071
 
 
2072
        if test "$pass" = conv; then
 
2073
          # Only check for convenience libraries
 
2074
          deplibs="$lib $deplibs"
 
2075
          if test -z "$libdir"; then
 
2076
            if test -z "$old_library"; then
 
2077
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
 
2078
              exit $EXIT_FAILURE
 
2079
            fi
 
2080
            # It is a libtool convenience library, so add in its objects.
 
2081
            convenience="$convenience $ladir/$objdir/$old_library"
 
2082
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
 
2083
            tmp_libs=
 
2084
            for deplib in $dependency_libs; do
 
2085
              deplibs="$deplib $deplibs"
 
2086
              if test "X$duplicate_deps" = "Xyes" ; then
 
2087
                case "$tmp_libs " in
 
2088
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2089
                esac
 
2090
              fi
 
2091
              tmp_libs="$tmp_libs $deplib"
 
2092
            done
 
2093
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
 
2094
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
 
2095
            exit $EXIT_FAILURE
 
2096
          fi
 
2097
          continue
 
2098
        fi # $pass = conv
 
2099
 
 
2100
 
1221
2101
        # Get the name of the library we link against.
1222
2102
        linklib=
1223
2103
        for l in $old_library $library_names; do
1224
2104
          linklib="$l"
1225
2105
        done
1226
 
 
1227
2106
        if test -z "$linklib"; then
1228
 
          $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1229
 
          exit 1
 
2107
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
 
2108
          exit $EXIT_FAILURE
1230
2109
        fi
1231
2110
 
 
2111
        # This library was specified with -dlopen.
 
2112
        if test "$pass" = dlopen; then
 
2113
          if test -z "$libdir"; then
 
2114
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
 
2115
            exit $EXIT_FAILURE
 
2116
          fi
 
2117
          if test -z "$dlname" ||
 
2118
             test "$dlopen_support" != yes ||
 
2119
             test "$build_libtool_libs" = no; then
 
2120
            # If there is no dlname, no dlopen support or we're linking
 
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"
 
2125
          else
 
2126
            newdlfiles="$newdlfiles $lib"
 
2127
          fi
 
2128
          continue
 
2129
        fi # $pass = dlopen
 
2130
 
 
2131
        # We need an absolute path.
 
2132
        case $ladir in
 
2133
        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
 
2134
        *)
 
2135
          abs_ladir=`cd "$ladir" && pwd`
 
2136
          if test -z "$abs_ladir"; then
 
2137
            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
 
2138
            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
 
2139
            abs_ladir="$ladir"
 
2140
          fi
 
2141
          ;;
 
2142
        esac
 
2143
        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
2144
 
1232
2145
        # Find the relevant object directory and library name.
1233
 
        name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1234
 
 
1235
2146
        if test "X$installed" = Xyes; then
1236
 
          dir="$libdir"
 
2147
          if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2148
            $echo "$modename: warning: library \`$lib' was moved." 1>&2
 
2149
            dir="$ladir"
 
2150
            absdir="$abs_ladir"
 
2151
            libdir="$abs_ladir"
 
2152
          else
 
2153
            dir="$libdir"
 
2154
            absdir="$libdir"
 
2155
          fi
1237
2156
        else
1238
 
          dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1239
 
          if test "X$dir" = "X$arg"; then
1240
 
            dir="$objdir"
1241
 
          else
1242
 
            dir="$dir/$objdir"
1243
 
          fi
1244
 
        fi
1245
 
 
1246
 
        if test -n "$dependency_libs"; then
1247
 
          # Extract -R and -L from dependency_libs
1248
 
          temp_deplibs=
1249
 
          for deplib in $dependency_libs; do
1250
 
            case "$deplib" in
1251
 
            -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1252
 
                 case " $rpath $xrpath " in
1253
 
                 *" $temp_xrpath "*) ;;
1254
 
                 *) xrpath="$xrpath $temp_xrpath";;
1255
 
                 esac;;
1256
 
            -L*) case "$compile_command $temp_deplibs " in
1257
 
                 *" $deplib "*) ;;
1258
 
                 *) temp_deplibs="$temp_deplibs $deplib";;
1259
 
                 esac
1260
 
                 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1261
 
                 case " $lib_search_path " in
1262
 
                 *" $temp_dir "*) ;;
1263
 
                 *) lib_search_path="$lib_search_path $temp_dir";;
1264
 
                 esac
1265
 
                 ;;
1266
 
            *) temp_deplibs="$temp_deplibs $deplib";;
1267
 
            esac
1268
 
          done
1269
 
          dependency_libs="$temp_deplibs"
1270
 
        fi
1271
 
 
1272
 
        if test -z "$libdir"; then
1273
 
          # It is a libtool convenience library, so add in its objects.
1274
 
          convenience="$convenience $dir/$old_library"
1275
 
          old_convenience="$old_convenience $dir/$old_library"
1276
 
          deplibs="$deplibs$dependency_libs"
1277
 
          compile_command="$compile_command $dir/$old_library$dependency_libs"
1278
 
          finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1279
 
          continue
1280
 
        fi
1281
 
 
1282
 
        # This library was specified with -dlopen.
1283
 
        if test "$prev" = dlfiles; then
1284
 
          dlfiles="$dlfiles $arg"
1285
 
          if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1286
 
            # If there is no dlname, no dlopen support or we're linking statically,
1287
 
            # we need to preload.
1288
 
            prev=dlprefiles
1289
 
          else
1290
 
            # We should not create a dependency on this library, but we
1291
 
            # may need any libraries it requires.
1292
 
            compile_command="$compile_command$dependency_libs"
1293
 
            finalize_command="$finalize_command$dependency_libs"
1294
 
            prev=
1295
 
            continue
1296
 
          fi
1297
 
        fi
1298
 
 
1299
 
        # The library was specified with -dlpreopen.
1300
 
        if test "$prev" = dlprefiles; then
 
2157
          dir="$ladir/$objdir"
 
2158
          absdir="$abs_ladir/$objdir"
 
2159
          # Remove this search path later
 
2160
          notinst_path="$notinst_path $abs_ladir"
 
2161
        fi # $installed = yes
 
2162
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
2163
 
 
2164
        # This library was specified with -dlpreopen.
 
2165
        if test "$pass" = dlpreopen; then
 
2166
          if test -z "$libdir"; then
 
2167
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
 
2168
            exit $EXIT_FAILURE
 
2169
          fi
1301
2170
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1302
2171
          # are required to link).
1303
2172
          if test -n "$old_library"; then
1304
 
            dlprefiles="$dlprefiles $dir/$old_library"
1305
 
          else
1306
 
            dlprefiles="$dlprefiles $dir/$linklib"
1307
 
          fi
1308
 
          prev=
1309
 
        fi
1310
 
 
 
2173
            newdlprefiles="$newdlprefiles $dir/$old_library"
 
2174
          # Otherwise, use the dlname, so that lt_dlopen finds it.
 
2175
          elif test -n "$dlname"; then
 
2176
            newdlprefiles="$newdlprefiles $dir/$dlname"
 
2177
          else
 
2178
            newdlprefiles="$newdlprefiles $dir/$linklib"
 
2179
          fi
 
2180
        fi # $pass = dlpreopen
 
2181
 
 
2182
        if test -z "$libdir"; then
 
2183
          # Link the convenience library
 
2184
          if test "$linkmode" = lib; then
 
2185
            deplibs="$dir/$old_library $deplibs"
 
2186
          elif test "$linkmode,$pass" = "prog,link"; then
 
2187
            compile_deplibs="$dir/$old_library $compile_deplibs"
 
2188
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
 
2189
          else
 
2190
            deplibs="$lib $deplibs" # used for prog,scan pass
 
2191
          fi
 
2192
          continue
 
2193
        fi
 
2194
 
 
2195
 
 
2196
        if test "$linkmode" = prog && test "$pass" != link; then
 
2197
          newlib_search_path="$newlib_search_path $ladir"
 
2198
          deplibs="$lib $deplibs"
 
2199
 
 
2200
          linkalldeplibs=no
 
2201
          if test "$link_all_deplibs" != no || test -z "$library_names" ||
 
2202
             test "$build_libtool_libs" = no; then
 
2203
            linkalldeplibs=yes
 
2204
          fi
 
2205
 
 
2206
          tmp_libs=
 
2207
          for deplib in $dependency_libs; do
 
2208
            case $deplib in
 
2209
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
 
2210
            esac
 
2211
            # Need to link against all dependency_libs?
 
2212
            if test "$linkalldeplibs" = yes; then
 
2213
              deplibs="$deplib $deplibs"
 
2214
            else
 
2215
              # Need to hardcode shared library paths
 
2216
              # or/and link against static libraries
 
2217
              newdependency_libs="$deplib $newdependency_libs"
 
2218
            fi
 
2219
            if test "X$duplicate_deps" = "Xyes" ; then
 
2220
              case "$tmp_libs " in
 
2221
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2222
              esac
 
2223
            fi
 
2224
            tmp_libs="$tmp_libs $deplib"
 
2225
          done # for deplib
 
2226
          continue
 
2227
        fi # $linkmode = prog...
 
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
 
 
2274
        link_static=no # Whether the deplib will be linked statically
1311
2275
        if test -n "$library_names" &&
1312
2276
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1313
 
          link_against_libtool_libs="$link_against_libtool_libs $arg"
1314
 
          if test -n "$shlibpath_var"; then
1315
 
            # Make sure the rpath contains only unique directories.
1316
 
            case "$temp_rpath " in
1317
 
            *" $dir "*) ;;
1318
 
            *) temp_rpath="$temp_rpath $dir" ;;
1319
 
            esac
 
2277
          if test "$installed" = no; then
 
2278
            notinst_deplibs="$notinst_deplibs $lib"
 
2279
            need_relink=yes
1320
2280
          fi
 
2281
          # This is a shared library
1321
2282
 
1322
 
          # We need an absolute path.
1323
 
          case "$dir" in
1324
 
          [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1325
 
          *)
1326
 
            absdir=`cd "$dir" && pwd`
1327
 
            if test -z "$absdir"; then
1328
 
              $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1329
 
              $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1330
 
              absdir="$dir"
 
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"
1331
2291
            fi
1332
 
            ;;
1333
 
          esac
1334
 
          
1335
 
          # This is the magic to use -rpath.
1336
 
          # Skip directories that are in the system default run-time
1337
 
          # search path, unless they have been requested with -R.
1338
 
          case " $sys_lib_dlsearch_path " in
1339
 
          *" $absdir "*) ;;
1340
 
          *)
1341
 
            case "$compile_rpath " in
 
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
1342
2300
            *" $absdir "*) ;;
1343
 
            *) compile_rpath="$compile_rpath $absdir" 
 
2301
            *)
 
2302
              case "$compile_rpath " in
 
2303
              *" $absdir "*) ;;
 
2304
              *) compile_rpath="$compile_rpath $absdir"
 
2305
              esac
 
2306
              ;;
1344
2307
            esac
1345
 
            ;;
1346
 
          esac
1347
 
 
1348
 
          case " $sys_lib_dlsearch_path " in
1349
 
          *" $libdir "*) ;;
1350
 
          *)
1351
 
            case "$finalize_rpath " in
 
2308
            case " $sys_lib_dlsearch_path " in
1352
2309
            *" $libdir "*) ;;
1353
 
            *) finalize_rpath="$finalize_rpath $libdir"
 
2310
            *)
 
2311
              case "$finalize_rpath " in
 
2312
              *" $libdir "*) ;;
 
2313
              *) finalize_rpath="$finalize_rpath $libdir"
 
2314
              esac
 
2315
              ;;
1354
2316
            esac
1355
 
            ;;
1356
 
          esac
1357
 
 
1358
 
          lib_linked=yes
1359
 
          case "$hardcode_action" in
1360
 
          immediate | unsupported)
1361
 
            if test "$hardcode_direct" = no; then
1362
 
              compile_command="$compile_command $dir/$linklib"
1363
 
              deplibs="$deplibs $dir/$linklib"
1364
 
              case "$host" in
1365
 
              *-*-cygwin* | *-*-mingw* | *-*-os2*)
1366
 
                dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1367
 
                if test -n "$dllsearchpath"; then
1368
 
                  dllsearchpath="$dllsearchpath:$dllsearchdir"
1369
 
                else
1370
 
                  dllsearchpath="$dllsearchdir"
 
2317
          fi
 
2318
 
 
2319
          if test -n "$old_archive_from_expsyms_cmds"; then
 
2320
            # figure out the soname
 
2321
            set dummy $library_names
 
2322
            realname="$2"
 
2323
            shift; shift
 
2324
            libname=`eval \\$echo \"$libname_spec\"`
 
2325
            # use dlname if we got it. it's perfectly good, no?
 
2326
            if test -n "$dlname"; then
 
2327
              soname="$dlname"
 
2328
            elif test -n "$soname_spec"; then
 
2329
              # bleh windows
 
2330
              case $host in
 
2331
              *cygwin* | mingw*)
 
2332
                major=`expr $current - $age`
 
2333
                versuffix="-$major"
 
2334
                ;;
 
2335
              esac
 
2336
              eval soname=\"$soname_spec\"
 
2337
            else
 
2338
              soname="$realname"
 
2339
            fi
 
2340
 
 
2341
            # Make a new name for the extract_expsyms_cmds to use
 
2342
            soroot="$soname"
 
2343
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2344
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
2345
 
 
2346
            # If the library has no export list, then create one now
 
2347
            if test -f "$output_objdir/$soname-def"; then :
 
2348
            else
 
2349
              $show "extracting exported symbol list from \`$soname'"
 
2350
              save_ifs="$IFS"; IFS='~'
 
2351
              cmds=$extract_expsyms_cmds
 
2352
              for cmd in $cmds; do
 
2353
                IFS="$save_ifs"
 
2354
                eval cmd=\"$cmd\"
 
2355
                $show "$cmd"
 
2356
                $run eval "$cmd" || exit $?
 
2357
              done
 
2358
              IFS="$save_ifs"
 
2359
            fi
 
2360
 
 
2361
            # Create $newlib
 
2362
            if test -f "$output_objdir/$newlib"; then :; else
 
2363
              $show "generating import library for \`$soname'"
 
2364
              save_ifs="$IFS"; IFS='~'
 
2365
              cmds=$old_archive_from_expsyms_cmds
 
2366
              for cmd in $cmds; do
 
2367
                IFS="$save_ifs"
 
2368
                eval cmd=\"$cmd\"
 
2369
                $show "$cmd"
 
2370
                $run eval "$cmd" || exit $?
 
2371
              done
 
2372
              IFS="$save_ifs"
 
2373
            fi
 
2374
            # make sure the library variables are pointing to the new library
 
2375
            dir=$output_objdir
 
2376
            linklib=$newlib
 
2377
          fi # test -n "$old_archive_from_expsyms_cmds"
 
2378
 
 
2379
          if test "$linkmode" = prog || test "$mode" != relink; then
 
2380
            add_shlibpath=
 
2381
            add_dir=
 
2382
            add=
 
2383
            lib_linked=yes
 
2384
            case $hardcode_action in
 
2385
            immediate | unsupported)
 
2386
              if test "$hardcode_direct" = no; then
 
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
 
2404
              elif test "$hardcode_minus_L" = no; then
 
2405
                case $host in
 
2406
                *-*-sunos*) add_shlibpath="$dir" ;;
 
2407
                esac
 
2408
                add_dir="-L$dir"
 
2409
                add="-l$name"
 
2410
              elif test "$hardcode_shlibpath_var" = no; then
 
2411
                add_shlibpath="$dir"
 
2412
                add="-l$name"
 
2413
              else
 
2414
                lib_linked=no
 
2415
              fi
 
2416
              ;;
 
2417
            relink)
 
2418
              if test "$hardcode_direct" = yes; then
 
2419
                add="$dir/$linklib"
 
2420
              elif test "$hardcode_minus_L" = yes; then
 
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
1371
2429
                fi
1372
 
                ;;
1373
 
              esac
1374
 
            elif test "$hardcode_minus_L" = no; then
1375
 
              case "$host" in
1376
 
              *-*-sunos*)
1377
 
                compile_shlibpath="$compile_shlibpath$dir:"
1378
 
                ;;
1379
 
              esac
1380
 
              case "$compile_command " in
1381
 
              *" -L$dir "*) ;;
1382
 
              *) compile_command="$compile_command -L$dir";;
1383
 
              esac
1384
 
              compile_command="$compile_command -l$name"
1385
 
              deplibs="$deplibs -L$dir -l$name"
1386
 
            elif test "$hardcode_shlibpath_var" = no; then
1387
 
              case ":$compile_shlibpath:" in
1388
 
              *":$dir:"*) ;;
1389
 
              *) compile_shlibpath="$compile_shlibpath$dir:";;
1390
 
              esac
1391
 
              compile_command="$compile_command -l$name"
1392
 
              deplibs="$deplibs -l$name"
 
2430
                add="-l$name"
 
2431
              elif test "$hardcode_shlibpath_var" = yes; then
 
2432
                add_shlibpath="$dir"
 
2433
                add="-l$name"
 
2434
              else
 
2435
                lib_linked=no
 
2436
              fi
 
2437
              ;;
 
2438
            *) lib_linked=no ;;
 
2439
            esac
 
2440
 
 
2441
            if test "$lib_linked" != yes; then
 
2442
              $echo "$modename: configuration error: unsupported hardcode properties"
 
2443
              exit $EXIT_FAILURE
 
2444
            fi
 
2445
 
 
2446
            if test -n "$add_shlibpath"; then
 
2447
              case :$compile_shlibpath: in
 
2448
              *":$add_shlibpath:"*) ;;
 
2449
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
 
2450
              esac
 
2451
            fi
 
2452
            if test "$linkmode" = prog; then
 
2453
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
 
2454
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1393
2455
            else
1394
 
              lib_linked=no
 
2456
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
 
2457
              test -n "$add" && deplibs="$add $deplibs"
 
2458
              if test "$hardcode_direct" != yes && \
 
2459
                 test "$hardcode_minus_L" != yes && \
 
2460
                 test "$hardcode_shlibpath_var" = yes; then
 
2461
                case :$finalize_shlibpath: in
 
2462
                *":$libdir:"*) ;;
 
2463
                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 
2464
                esac
 
2465
              fi
1395
2466
            fi
1396
 
            ;;
 
2467
          fi
1397
2468
 
1398
 
          relink)
 
2469
          if test "$linkmode" = prog || test "$mode" = relink; then
 
2470
            add_shlibpath=
 
2471
            add_dir=
 
2472
            add=
 
2473
            # Finalize command for both is simple: just hardcode it.
1399
2474
            if test "$hardcode_direct" = yes; then
1400
 
              compile_command="$compile_command $absdir/$linklib"
1401
 
              deplibs="$deplibs $absdir/$linklib"
 
2475
              add="$libdir/$linklib"
1402
2476
            elif test "$hardcode_minus_L" = yes; then
1403
 
              case "$compile_command " in
1404
 
              *" -L$absdir "*) ;;
1405
 
              *) compile_command="$compile_command -L$absdir";;
1406
 
              esac
1407
 
              compile_command="$compile_command -l$name"
1408
 
              deplibs="$deplibs -L$absdir -l$name"
 
2477
              add_dir="-L$libdir"
 
2478
              add="-l$name"
1409
2479
            elif test "$hardcode_shlibpath_var" = yes; then
1410
 
              case ":$compile_shlibpath:" in
1411
 
              *":$absdir:"*) ;;
1412
 
              *) compile_shlibpath="$compile_shlibpath$absdir:";;
 
2480
              case :$finalize_shlibpath: in
 
2481
              *":$libdir:"*) ;;
 
2482
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1413
2483
              esac
1414
 
              compile_command="$compile_command -l$name"
1415
 
              deplibs="$deplibs -l$name"
1416
 
            else
1417
 
              lib_linked=no
1418
 
            fi
1419
 
            ;;
1420
 
 
1421
 
          *)
1422
 
            lib_linked=no
1423
 
            ;;
1424
 
          esac
1425
 
 
1426
 
          if test "$lib_linked" != yes; then
1427
 
            $echo "$modename: configuration error: unsupported hardcode properties"
1428
 
            exit 1
1429
 
          fi
1430
 
 
1431
 
          # Finalize command for both is simple: just hardcode it.
1432
 
          if test "$hardcode_direct" = yes; then
1433
 
            finalize_command="$finalize_command $libdir/$linklib"
1434
 
          elif test "$hardcode_minus_L" = yes; then
1435
 
            case "$finalize_command " in
1436
 
            *" -L$libdir "*) ;;
1437
 
            *) finalize_command="$finalize_command -L$libdir";;
1438
 
            esac
1439
 
            finalize_command="$finalize_command -l$name"
1440
 
          elif test "$hardcode_shlibpath_var" = yes; then
1441
 
            case ":$finalize_shlibpath:" in
1442
 
            *":$libdir:"*) ;;
1443
 
            *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1444
 
            esac
1445
 
            finalize_command="$finalize_command -l$name"
1446
 
          else
1447
 
            # We cannot seem to hardcode it, guess we'll fake it.
1448
 
            case "$finalize_command " in
1449
 
            *" -L$dir "*) ;;
1450
 
            *) finalize_command="$finalize_command -L$libdir";;
1451
 
            esac
1452
 
            finalize_command="$finalize_command -l$name"
1453
 
          fi
1454
 
        else
1455
 
          # Transform directly to old archives if we don't build new libraries.
1456
 
          if test -n "$pic_flag" && test -z "$old_library"; then
1457
 
            $echo "$modename: cannot find static library for \`$arg'" 1>&2
1458
 
            exit 1
1459
 
          fi
1460
 
 
 
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
 
2492
            else
 
2493
              # We cannot seem to hardcode it, guess we'll fake it.
 
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
 
2503
              add="-l$name"
 
2504
            fi
 
2505
 
 
2506
            if test "$linkmode" = prog; then
 
2507
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
 
2508
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
 
2509
            else
 
2510
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
 
2511
              test -n "$add" && deplibs="$add $deplibs"
 
2512
            fi
 
2513
          fi
 
2514
        elif test "$linkmode" = prog; then
1461
2515
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1462
2516
          # is not unsupported.  This is valid on all known static and
1463
2517
          # shared platforms.
1464
2518
          if test "$hardcode_direct" != unsupported; then
1465
2519
            test -n "$old_library" && linklib="$old_library"
1466
 
            compile_command="$compile_command $dir/$linklib"
1467
 
            finalize_command="$finalize_command $dir/$linklib"
1468
 
          else
1469
 
            case "$compile_command " in
1470
 
            *" -L$dir "*) ;;
1471
 
            *) compile_command="$compile_command -L$dir";;
1472
 
            esac
1473
 
            compile_command="$compile_command -l$name"
1474
 
            case "$finalize_command " in
1475
 
            *" -L$dir "*) ;;
1476
 
            *) finalize_command="$finalize_command -L$dir";;
1477
 
            esac
1478
 
            finalize_command="$finalize_command -l$name"
1479
 
          fi
1480
 
        fi
1481
 
 
1482
 
        # Add in any libraries that this one depends upon.
1483
 
        compile_command="$compile_command$dependency_libs"
1484
 
        finalize_command="$finalize_command$dependency_libs"
1485
 
        continue
1486
 
        ;;
1487
 
 
1488
 
      # Some other compiler argument.
1489
 
      *)
1490
 
        # Unknown arguments in both finalize_command and compile_command need
1491
 
        # to be aesthetically quoted because they are evaled later.
1492
 
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1493
 
        case "$arg" in
1494
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
1495
 
          arg="\"$arg\""
 
2520
            compile_deplibs="$dir/$linklib $compile_deplibs"
 
2521
            finalize_deplibs="$dir/$linklib $finalize_deplibs"
 
2522
          else
 
2523
            compile_deplibs="-l$name -L$dir $compile_deplibs"
 
2524
            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
 
2525
          fi
 
2526
        elif test "$build_libtool_libs" = yes; then
 
2527
          # Not a shared library
 
2528
          if test "$deplibs_check_method" != pass_all; then
 
2529
            # We're trying link a shared library against a static one
 
2530
            # but the system doesn't support it.
 
2531
 
 
2532
            # Just print a warning and add the library to dependency_libs so
 
2533
            # that the program can be linked against the static library.
 
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."
 
2539
            if test "$module" = yes; then
 
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."
 
2543
              if test -z "$global_symbol_pipe"; then
 
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."
 
2549
              fi
 
2550
              if test "$build_old_libs" = no; then
 
2551
                build_libtool_libs=module
 
2552
                build_old_libs=yes
 
2553
              else
 
2554
                build_libtool_libs=no
 
2555
              fi
 
2556
            fi
 
2557
          else
 
2558
            convenience="$convenience $dir/$old_library"
 
2559
            old_convenience="$old_convenience $dir/$old_library"
 
2560
            deplibs="$dir/$old_library $deplibs"
 
2561
            link_static=yes
 
2562
          fi
 
2563
        fi # link shared/static library?
 
2564
 
 
2565
        if test "$linkmode" = lib; then
 
2566
          if test -n "$dependency_libs" &&
 
2567
             { test "$hardcode_into_libs" != yes ||
 
2568
               test "$build_old_libs" = yes ||
 
2569
               test "$link_static" = yes; }; then
 
2570
            # Extract -R from dependency_libs
 
2571
            temp_deplibs=
 
2572
            for libdir in $dependency_libs; do
 
2573
              case $libdir in
 
2574
              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
 
2575
                   case " $xrpath " in
 
2576
                   *" $temp_xrpath "*) ;;
 
2577
                   *) xrpath="$xrpath $temp_xrpath";;
 
2578
                   esac;;
 
2579
              *) temp_deplibs="$temp_deplibs $libdir";;
 
2580
              esac
 
2581
            done
 
2582
            dependency_libs="$temp_deplibs"
 
2583
          fi
 
2584
 
 
2585
          newlib_search_path="$newlib_search_path $absdir"
 
2586
          # Link against this library
 
2587
          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 
2588
          # ... and its dependency_libs
 
2589
          tmp_libs=
 
2590
          for deplib in $dependency_libs; do
 
2591
            newdependency_libs="$deplib $newdependency_libs"
 
2592
            if test "X$duplicate_deps" = "Xyes" ; then
 
2593
              case "$tmp_libs " in
 
2594
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2595
              esac
 
2596
            fi
 
2597
            tmp_libs="$tmp_libs $deplib"
 
2598
          done
 
2599
 
 
2600
          if test "$link_all_deplibs" != no; then
 
2601
            # Add the search paths of all dependency libraries
 
2602
            for deplib in $dependency_libs; do
 
2603
              case $deplib in
 
2604
              -L*) path="$deplib" ;;
 
2605
              *.la)
 
2606
                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
 
2607
                test "X$dir" = "X$deplib" && dir="."
 
2608
                # We need an absolute path.
 
2609
                case $dir in
 
2610
                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
 
2611
                *)
 
2612
                  absdir=`cd "$dir" && pwd`
 
2613
                  if test -z "$absdir"; then
 
2614
                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
 
2615
                    absdir="$dir"
 
2616
                  fi
 
2617
                  ;;
 
2618
                esac
 
2619
                if grep "^installed=no" $deplib > /dev/null; then
 
2620
                  path="$absdir/$objdir"
 
2621
                else
 
2622
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
2623
                  if test -z "$libdir"; then
 
2624
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
 
2625
                    exit $EXIT_FAILURE
 
2626
                  fi
 
2627
                  if test "$absdir" != "$libdir"; then
 
2628
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
 
2629
                  fi
 
2630
                  path="$absdir"
 
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
 
2673
                ;;
 
2674
              *) continue ;;
 
2675
              esac
 
2676
              case " $deplibs " in
 
2677
              *" $depdepl "*) ;;
 
2678
              *) deplibs="$depdepl $deplibs" ;;
 
2679
              esac
 
2680
              case " $deplibs " in
 
2681
              *" $path "*) ;;
 
2682
              *) deplibs="$deplibs $path" ;;
 
2683
              esac
 
2684
            done
 
2685
          fi # link_all_deplibs != no
 
2686
        fi # linkmode = lib
 
2687
      done # for deplib in $libs
 
2688
      dependency_libs="$newdependency_libs"
 
2689
      if test "$pass" = dlpreopen; then
 
2690
        # Link the dlpreopened libraries before other libraries
 
2691
        for deplib in $save_deplibs; do
 
2692
          deplibs="$deplib $deplibs"
 
2693
        done
 
2694
      fi
 
2695
      if test "$pass" != dlopen; then
 
2696
        if test "$pass" != conv; then
 
2697
          # Make sure lib_search_path contains only unique directories.
 
2698
          lib_search_path=
 
2699
          for dir in $newlib_search_path; do
 
2700
            case "$lib_search_path " in
 
2701
            *" $dir "*) ;;
 
2702
            *) lib_search_path="$lib_search_path $dir" ;;
 
2703
            esac
 
2704
          done
 
2705
          newlib_search_path=
 
2706
        fi
 
2707
 
 
2708
        if test "$linkmode,$pass" != "prog,link"; then
 
2709
          vars="deplibs"
 
2710
        else
 
2711
          vars="compile_deplibs finalize_deplibs"
 
2712
        fi
 
2713
        for var in $vars dependency_libs; do
 
2714
          # Add libraries to $var in reverse order
 
2715
          eval tmp_libs=\"\$$var\"
 
2716
          new_libs=
 
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:
 
2724
            case $deplib in
 
2725
            -L*) new_libs="$deplib $new_libs" ;;
 
2726
            -R*) ;;
 
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.
 
2742
              case " $specialdeplibs " in
 
2743
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
 
2744
              *)
 
2745
                case " $new_libs " in
 
2746
                *" $deplib "*) ;;
 
2747
                *) new_libs="$deplib $new_libs" ;;
 
2748
                esac
 
2749
                ;;
 
2750
              esac
 
2751
              ;;
 
2752
            esac
 
2753
          done
 
2754
          tmp_libs=
 
2755
          for deplib in $new_libs; do
 
2756
            case $deplib in
 
2757
            -L*)
 
2758
              case " $tmp_libs " in
 
2759
              *" $deplib "*) ;;
 
2760
              *) tmp_libs="$tmp_libs $deplib" ;;
 
2761
              esac
 
2762
              ;;
 
2763
            *) tmp_libs="$tmp_libs $deplib" ;;
 
2764
            esac
 
2765
          done
 
2766
          eval $var=\"$tmp_libs\"
 
2767
        done # for var
 
2768
      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=""
1496
2776
          ;;
1497
2777
        esac
1498
 
        ;;
1499
 
      esac
1500
 
 
1501
 
      # Now actually substitute the argument into the commands.
1502
 
      if test -n "$arg"; then
1503
 
        compile_command="$compile_command $arg"
1504
 
        finalize_command="$finalize_command $arg"
1505
 
      fi
1506
 
    done
1507
 
 
1508
 
    if test -n "$prev"; then
1509
 
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1510
 
      $echo "$help" 1>&2
1511
 
      exit 1
1512
 
    fi
1513
 
 
1514
 
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1515
 
      eval arg=\"$export_dynamic_flag_spec\"
1516
 
      compile_command="$compile_command $arg"
1517
 
      finalize_command="$finalize_command $arg"
1518
 
    fi
1519
 
 
1520
 
    oldlibs=
1521
 
    # calculate the name of the file, without its directory
1522
 
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1523
 
    libobjs_save="$libobjs"
1524
 
 
1525
 
    case "$output" in
1526
 
    "")
1527
 
      $echo "$modename: you must specify an output file" 1>&2
1528
 
      $echo "$help" 1>&2
1529
 
      exit 1
1530
 
      ;;
1531
 
 
1532
 
    *.a | *.lib)
1533
 
      if test -n "$link_against_libtool_libs"; then
1534
 
        $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1535
 
        exit 1
1536
 
      fi
1537
 
 
 
2778
        if test -n "$i" ; then
 
2779
          tmp_libs="$tmp_libs $i"
 
2780
        fi
 
2781
      done
 
2782
      dependency_libs=$tmp_libs
 
2783
    done # for pass
 
2784
    if test "$linkmode" = prog; then
 
2785
      dlfiles="$newdlfiles"
 
2786
      dlprefiles="$newdlprefiles"
 
2787
    fi
 
2788
 
 
2789
    case $linkmode in
 
2790
    oldlib)
1538
2791
      if test -n "$deplibs"; then
1539
2792
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1540
2793
      fi
1552
2805
      fi
1553
2806
 
1554
2807
      if test -n "$vinfo"; then
1555
 
        $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
1556
2809
      fi
1557
2810
 
1558
2811
      if test -n "$release"; then
1566
2819
      # Now set the variables for building old libraries.
1567
2820
      build_libtool_libs=no
1568
2821
      oldlibs="$output"
 
2822
      objs="$objs$old_deplibs"
1569
2823
      ;;
1570
2824
 
1571
 
    *.la)
 
2825
    lib)
1572
2826
      # Make sure we only generate libraries of the form `libNAME.la'.
1573
 
      case "$outputname" in
 
2827
      case $outputname in
1574
2828
      lib*)
1575
2829
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
2830
        eval shared_ext=\"$shrext_cmds\"
1576
2831
        eval libname=\"$libname_spec\"
1577
2832
        ;;
1578
2833
      *)
1579
2834
        if test "$module" = no; then
1580
2835
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1581
2836
          $echo "$help" 1>&2
1582
 
          exit 1
 
2837
          exit $EXIT_FAILURE
1583
2838
        fi
1584
2839
        if test "$need_lib_prefix" != no; then
1585
2840
          # Add the "lib" prefix for modules if required
1586
2841
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
2842
          eval shared_ext=\"$shrext_cmds\"
1587
2843
          eval libname=\"$libname_spec\"
1588
2844
        else
1589
2845
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1591
2847
        ;;
1592
2848
      esac
1593
2849
 
1594
 
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1595
 
      if test "X$output_objdir" = "X$output"; then
1596
 
        output_objdir="$objdir"
1597
 
      else
1598
 
        output_objdir="$output_objdir/$objdir"
1599
 
      fi
1600
 
 
1601
2850
      if test -n "$objs"; then
1602
 
        $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1603
 
        exit 1
1604
 
      fi
1605
 
 
1606
 
      # How the heck are we supposed to write a wrapper for a shared library?
1607
 
      if test -n "$link_against_libtool_libs"; then
1608
 
         $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1609
 
         exit 1
1610
 
      fi
1611
 
 
1612
 
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1613
 
        $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
 
2851
        if test "$deplibs_check_method" != pass_all; then
 
2852
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
 
2853
          exit $EXIT_FAILURE
 
2854
        else
 
2855
          $echo
 
2856
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
2857
          $echo "*** objects $objs is not portable!"
 
2858
          libobjs="$libobjs $objs"
 
2859
        fi
 
2860
      fi
 
2861
 
 
2862
      if test "$dlself" != no; then
 
2863
        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
1614
2864
      fi
1615
2865
 
1616
2866
      set dummy $rpath
1617
 
      if test $# -gt 2; then
 
2867
      if test "$#" -gt 2; then
1618
2868
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1619
2869
      fi
1620
2870
      install_libdir="$2"
1623
2873
      if test -z "$rpath"; then
1624
2874
        if test "$build_libtool_libs" = yes; then
1625
2875
          # Building a libtool convenience library.
1626
 
          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.
1627
2879
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
1628
2880
          build_libtool_libs=convenience
1629
2881
          build_old_libs=yes
1630
2882
        fi
1631
 
        dependency_libs="$deplibs"
1632
2883
 
1633
2884
        if test -n "$vinfo"; then
1634
 
          $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
1635
2886
        fi
1636
2887
 
1637
2888
        if test -n "$release"; then
1640
2891
      else
1641
2892
 
1642
2893
        # Parse the version information argument.
1643
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
 
2894
        save_ifs="$IFS"; IFS=':'
1644
2895
        set dummy $vinfo 0 0 0
1645
2896
        IFS="$save_ifs"
1646
2897
 
1647
2898
        if test -n "$8"; then
1648
2899
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
1649
2900
          $echo "$help" 1>&2
1650
 
          exit 1
 
2901
          exit $EXIT_FAILURE
1651
2902
        fi
1652
2903
 
1653
 
        current="$2"
1654
 
        revision="$3"
1655
 
        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
          esac
 
2937
          ;;
 
2938
        no)
 
2939
          current="$2"
 
2940
          revision="$3"
 
2941
          age="$4"
 
2942
          ;;
 
2943
        esac
1656
2944
 
1657
2945
        # Check that each of the things are valid numbers.
1658
 
        case "$current" in
1659
 
        0 | [1-9] | [1-9][0-9]*) ;;
 
2946
        case $current in
 
2947
        [0-9]*) ;;
1660
2948
        *)
1661
2949
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1662
2950
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1663
 
          exit 1
 
2951
          exit $EXIT_FAILURE
1664
2952
          ;;
1665
2953
        esac
1666
2954
 
1667
 
        case "$revision" in
1668
 
        0 | [1-9] | [1-9][0-9]*) ;;
 
2955
        case $revision in
 
2956
        [0-9]*) ;;
1669
2957
        *)
1670
2958
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1671
2959
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1672
 
          exit 1
 
2960
          exit $EXIT_FAILURE
1673
2961
          ;;
1674
2962
        esac
1675
2963
 
1676
 
        case "$age" in
1677
 
        0 | [1-9] | [1-9][0-9]*) ;;
 
2964
        case $age in
 
2965
        [0-9]*) ;;
1678
2966
        *)
1679
2967
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1680
2968
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1681
 
          exit 1
 
2969
          exit $EXIT_FAILURE
1682
2970
          ;;
1683
2971
        esac
1684
2972
 
1685
 
        if test $age -gt $current; then
 
2973
        if test "$age" -gt "$current"; then
1686
2974
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1687
2975
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1688
 
          exit 1
 
2976
          exit $EXIT_FAILURE
1689
2977
        fi
1690
2978
 
1691
2979
        # Calculate the version variables.
1692
2980
        major=
1693
2981
        versuffix=
1694
2982
        verstring=
1695
 
        case "$version_type" in
 
2983
        case $version_type in
1696
2984
        none) ;;
1697
2985
 
1698
 
        irix)
 
2986
        darwin)
 
2987
          # Like Linux, but with the current version available in
 
2988
          # verstring for coding it into the library header
 
2989
          major=.`expr $current - $age`
 
2990
          versuffix="$major.$age.$revision"
 
2991
          # Darwin ld doesn't like 0 for these options...
 
2992
          minor_current=`expr $current + 1`
 
2993
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
2994
          ;;
 
2995
 
 
2996
        freebsd-aout)
 
2997
          major=".$current"
 
2998
          versuffix=".$current.$revision";
 
2999
          ;;
 
3000
 
 
3001
        freebsd-elf)
 
3002
          major=".$current"
 
3003
          versuffix=".$current";
 
3004
          ;;
 
3005
 
 
3006
        irix | nonstopux)
1699
3007
          major=`expr $current - $age + 1`
1700
 
          versuffix="$major.$revision"
1701
 
          verstring="sgi$major.$revision"
 
3008
 
 
3009
          case $version_type in
 
3010
            nonstopux) verstring_prefix=nonstopux ;;
 
3011
            *)         verstring_prefix=sgi ;;
 
3012
          esac
 
3013
          verstring="$verstring_prefix$major.$revision"
1702
3014
 
1703
3015
          # Add in all the interfaces that we are compatible with.
1704
3016
          loop=$revision
1705
 
          while test $loop != 0; do
 
3017
          while test "$loop" -ne 0; do
1706
3018
            iface=`expr $revision - $loop`
1707
3019
            loop=`expr $loop - 1`
1708
 
            verstring="sgi$major.$iface:$verstring"
 
3020
            verstring="$verstring_prefix$major.$iface:$verstring"
1709
3021
          done
 
3022
 
 
3023
          # Before this point, $major must not contain `.'.
 
3024
          major=.$major
 
3025
          versuffix="$major.$revision"
1710
3026
          ;;
1711
3027
 
1712
3028
        linux)
1715
3031
          ;;
1716
3032
 
1717
3033
        osf)
1718
 
          major=`expr $current - $age`
 
3034
          major=.`expr $current - $age`
1719
3035
          versuffix=".$current.$age.$revision"
1720
3036
          verstring="$current.$age.$revision"
1721
3037
 
1722
3038
          # Add in all the interfaces that we are compatible with.
1723
3039
          loop=$age
1724
 
          while test $loop != 0; do
 
3040
          while test "$loop" -ne 0; do
1725
3041
            iface=`expr $current - $loop`
1726
3042
            loop=`expr $loop - 1`
1727
3043
            verstring="$verstring:${iface}.0"
1736
3052
          versuffix=".$current.$revision"
1737
3053
          ;;
1738
3054
 
1739
 
        freebsd-aout)
1740
 
          major=".$current"
1741
 
          versuffix=".$current.$revision";
1742
 
          ;;
1743
 
 
1744
 
        freebsd-elf)
1745
 
          major=".$current"
1746
 
          versuffix=".$current";
1747
 
          ;;
1748
 
 
1749
3055
        windows)
1750
 
          # Like Linux, but with '-' rather than '.', since we only
1751
 
          # want one extension on Windows 95.
 
3056
          # Use '-' rather than '.', since we only want one
 
3057
          # extension on DOS 8.3 filesystems.
1752
3058
          major=`expr $current - $age`
1753
 
          versuffix="-$major-$age-$revision"
 
3059
          versuffix="-$major"
1754
3060
          ;;
1755
3061
 
1756
3062
        *)
1757
3063
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
1758
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1759
 
          exit 1
 
3064
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3065
          exit $EXIT_FAILURE
1760
3066
          ;;
1761
3067
        esac
1762
3068
 
1763
3069
        # Clear the version info if we defaulted, and they specified a release.
1764
3070
        if test -z "$vinfo" && test -n "$release"; then
1765
3071
          major=
1766
 
          verstring="0.0"
 
3072
          case $version_type in
 
3073
          darwin)
 
3074
            # we can't check for "0.0" in archive_cmds due to quoting
 
3075
            # problems, so we reset it completely
 
3076
            verstring=
 
3077
            ;;
 
3078
          *)
 
3079
            verstring="0.0"
 
3080
            ;;
 
3081
          esac
1767
3082
          if test "$need_version" = no; then
1768
3083
            versuffix=
1769
3084
          else
1777
3092
          versuffix=
1778
3093
          verstring=""
1779
3094
        fi
1780
 
        
 
3095
 
1781
3096
        # Check to see if the archive will have undefined symbols.
1782
3097
        if test "$allow_undefined" = yes; then
1783
3098
          if test "$allow_undefined_flag" = unsupported; then
1789
3104
          # Don't allow undefined symbols.
1790
3105
          allow_undefined_flag="$no_undefined_flag"
1791
3106
        fi
1792
 
 
1793
 
        dependency_libs="$deplibs"
1794
 
        case "$host" in
1795
 
        *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1796
 
          # these systems don't actually have a c library (as such)!
1797
 
          ;;
1798
 
        *)
1799
 
          # Add libc to deplibs on all other systems.
1800
 
          deplibs="$deplibs -lc"
1801
 
          ;;
1802
 
        esac
1803
3107
      fi
1804
3108
 
1805
 
      # Create the output directory, or remove our outputs if we need to.
1806
 
      if test -d $output_objdir; then
1807
 
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1808
 
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1809
 
      else
1810
 
        $show "$mkdir $output_objdir"
1811
 
        $run $mkdir $output_objdir
1812
 
        status=$?
1813
 
        if test $status -ne 0 && test ! -d $output_objdir; then
1814
 
          exit $status
 
3109
      if test "$mode" != relink; then
 
3110
        # Remove our outputs, but don't remove object files since they
 
3111
        # may have been created when compiling PIC objects.
 
3112
        removelist=
 
3113
        tempremovelist=`$echo "$output_objdir/*"`
 
3114
        for p in $tempremovelist; do
 
3115
          case $p in
 
3116
            *.$objext)
 
3117
               ;;
 
3118
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3119
               if test "X$precious_files_regex" != "X"; then
 
3120
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3121
                 then
 
3122
                   continue
 
3123
                 fi
 
3124
               fi
 
3125
               removelist="$removelist $p"
 
3126
               ;;
 
3127
            *) ;;
 
3128
          esac
 
3129
        done
 
3130
        if test -n "$removelist"; then
 
3131
          $show "${rm}r $removelist"
 
3132
          $run ${rm}r $removelist
1815
3133
        fi
1816
3134
      fi
1817
3135
 
1823
3141
        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1824
3142
      fi
1825
3143
 
 
3144
      # Eliminate all temporary directories.
 
3145
      for path in $notinst_path; do
 
3146
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3147
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3148
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3149
      done
 
3150
 
 
3151
      if test -n "$xrpath"; then
 
3152
        # If the user specified any rpath flags, then add them.
 
3153
        temp_xrpath=
 
3154
        for libdir in $xrpath; do
 
3155
          temp_xrpath="$temp_xrpath -R$libdir"
 
3156
          case "$finalize_rpath " in
 
3157
          *" $libdir "*) ;;
 
3158
          *) finalize_rpath="$finalize_rpath $libdir" ;;
 
3159
          esac
 
3160
        done
 
3161
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
 
3162
          dependency_libs="$temp_xrpath $dependency_libs"
 
3163
        fi
 
3164
      fi
 
3165
 
 
3166
      # Make sure dlfiles contains only unique files that won't be dlpreopened
 
3167
      old_dlfiles="$dlfiles"
 
3168
      dlfiles=
 
3169
      for lib in $old_dlfiles; do
 
3170
        case " $dlprefiles $dlfiles " in
 
3171
        *" $lib "*) ;;
 
3172
        *) dlfiles="$dlfiles $lib" ;;
 
3173
        esac
 
3174
      done
 
3175
 
 
3176
      # Make sure dlprefiles contains only unique files
 
3177
      old_dlprefiles="$dlprefiles"
 
3178
      dlprefiles=
 
3179
      for lib in $old_dlprefiles; do
 
3180
        case "$dlprefiles " in
 
3181
        *" $lib "*) ;;
 
3182
        *) dlprefiles="$dlprefiles $lib" ;;
 
3183
        esac
 
3184
      done
 
3185
 
1826
3186
      if test "$build_libtool_libs" = yes; then
 
3187
        if test -n "$rpath"; then
 
3188
          case $host in
 
3189
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
 
3190
            # these systems don't actually have a c library (as such)!
 
3191
            ;;
 
3192
          *-*-rhapsody* | *-*-darwin1.[012])
 
3193
            # Rhapsody C library is in the System framework
 
3194
            deplibs="$deplibs -framework System"
 
3195
            ;;
 
3196
          *-*-netbsd*)
 
3197
            # Don't link with libc until the a.out ld.so is fixed.
 
3198
            ;;
 
3199
          *-*-openbsd* | *-*-freebsd*)
 
3200
            # Do not include libc due to us having libc/libc_r.
 
3201
            test "X$arg" = "X-lc" && continue
 
3202
            ;;
 
3203
          *)
 
3204
            # Add libc to deplibs on all other systems if necessary.
 
3205
            if test "$build_libtool_need_lc" = "yes"; then
 
3206
              deplibs="$deplibs -lc"
 
3207
            fi
 
3208
            ;;
 
3209
          esac
 
3210
        fi
 
3211
 
1827
3212
        # Transform deplibs into only deplibs that can be linked in shared.
1828
3213
        name_save=$name
1829
3214
        libname_save=$libname
1838
3223
        major=""
1839
3224
        newdeplibs=
1840
3225
        droppeddeps=no
1841
 
        case "$deplibs_check_method" in
 
3226
        case $deplibs_check_method in
1842
3227
        pass_all)
1843
3228
          # Don't check for shared/static.  Everything works.
1844
3229
          # This might be a little naive.  We might want to check
1845
3230
          # whether the library exists or not.  But this is on
1846
3231
          # osf3 & osf4 and I'm not really sure... Just
1847
 
          # implementing what was already the behaviour.
 
3232
          # implementing what was already the behavior.
1848
3233
          newdeplibs=$deplibs
1849
3234
          ;;
1850
3235
        test_compile)
1857
3242
          int main() { return 0; }
1858
3243
EOF
1859
3244
          $rm conftest
1860
 
          $CC -o conftest conftest.c $deplibs
1861
 
          if test $? -eq 0 ; then
 
3245
          $LTCC -o conftest conftest.c $deplibs
 
3246
          if test "$?" -eq 0 ; then
1862
3247
            ldd_output=`ldd conftest`
1863
3248
            for i in $deplibs; do
1864
3249
              name="`expr $i : '-l\(.*\)'`"
1865
3250
              # If $name is empty we are operating on a -L argument.
1866
 
              if test "$name" != "" ; then
1867
 
                libname=`eval \\$echo \"$libname_spec\"`
1868
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
1869
 
                set dummy $deplib_matches
1870
 
                deplib_match=$2
1871
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1872
 
                  newdeplibs="$newdeplibs $i"
1873
 
                else
1874
 
                  droppeddeps=yes
1875
 
                  echo
1876
 
                  echo "*** Warning: This library needs some functionality provided by $i."
1877
 
                  echo "*** I have the capability to make that library automatically link in when"
1878
 
                  echo "*** you link to this library.  But I can only do this if you have a"
1879
 
                  echo "*** shared version of the library, which you do not appear to have."
1880
 
                fi
1881
 
              else
1882
 
                newdeplibs="$newdeplibs $i"
1883
 
              fi
1884
 
            done
1885
 
          else
1886
 
            # Error occured in the first compile.  Let's try to salvage the situation:
1887
 
            # Compile a seperate program for each library.
1888
 
            for i in $deplibs; do
1889
 
              name="`expr $i : '-l\(.*\)'`"
1890
 
             # If $name is empty we are operating on a -L argument.
1891
 
              if test "$name" != "" ; then
1892
 
                $rm conftest
1893
 
                $CC -o conftest conftest.c $i
1894
 
                # Did it work?
1895
 
                if test $? -eq 0 ; then
1896
 
                  ldd_output=`ldd conftest`
 
3251
              if test "$name" != "" && test "$name" -ne "0"; then
 
3252
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3253
                  case " $predeps $postdeps " in
 
3254
                  *" $i "*)
 
3255
                    newdeplibs="$newdeplibs $i"
 
3256
                    i=""
 
3257
                    ;;
 
3258
                  esac
 
3259
                fi
 
3260
                if test -n "$i" ; then
1897
3261
                  libname=`eval \\$echo \"$libname_spec\"`
1898
3262
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
1899
3263
                  set dummy $deplib_matches
1902
3266
                    newdeplibs="$newdeplibs $i"
1903
3267
                  else
1904
3268
                    droppeddeps=yes
1905
 
                    echo
1906
 
                    echo "*** Warning: This library needs some functionality provided by $i."
1907
 
                    echo "*** I have the capability to make that library automatically link in when"
1908
 
                    echo "*** you link to this library.  But I can only do this if you have a"
1909
 
                    echo "*** shared version of the library, which you do not appear to have."
 
3269
                    $echo
 
3270
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3271
                    $echo "*** I have the capability to make that library automatically link in when"
 
3272
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3273
                    $echo "*** shared version of the library, which I believe you do not have"
 
3274
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3275
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3276
                  fi
 
3277
                fi
 
3278
              else
 
3279
                newdeplibs="$newdeplibs $i"
 
3280
              fi
 
3281
            done
 
3282
          else
 
3283
            # Error occurred in the first compile.  Let's try to salvage
 
3284
            # the situation: Compile a separate program for each library.
 
3285
            for i in $deplibs; do
 
3286
              name="`expr $i : '-l\(.*\)'`"
 
3287
              # If $name is empty we are operating on a -L argument.
 
3288
              if test "$name" != "" && test "$name" != "0"; then
 
3289
                $rm conftest
 
3290
                $LTCC -o conftest conftest.c $i
 
3291
                # Did it work?
 
3292
                if test "$?" -eq 0 ; then
 
3293
                  ldd_output=`ldd conftest`
 
3294
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3295
                    case " $predeps $postdeps " in
 
3296
                    *" $i "*)
 
3297
                      newdeplibs="$newdeplibs $i"
 
3298
                      i=""
 
3299
                      ;;
 
3300
                    esac
 
3301
                  fi
 
3302
                  if test -n "$i" ; then
 
3303
                    libname=`eval \\$echo \"$libname_spec\"`
 
3304
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3305
                    set dummy $deplib_matches
 
3306
                    deplib_match=$2
 
3307
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3308
                      newdeplibs="$newdeplibs $i"
 
3309
                    else
 
3310
                      droppeddeps=yes
 
3311
                      $echo
 
3312
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3313
                      $echo "*** I have the capability to make that library automatically link in when"
 
3314
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3315
                      $echo "*** shared version of the library, which you do not appear to have"
 
3316
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3317
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3318
                    fi
1910
3319
                  fi
1911
3320
                else
1912
3321
                  droppeddeps=yes
1913
 
                  echo
1914
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
1915
 
                  echo "***  make it link in!  You will probably need to install it or some"
1916
 
                  echo "*** library that it depends on before this library will be fully"
1917
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3322
                  $echo
 
3323
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3324
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3325
                  $echo "*** library that it depends on before this library will be fully"
 
3326
                  $echo "*** functional.  Installing it before continuing would be even better."
1918
3327
                fi
1919
3328
              else
1920
3329
                newdeplibs="$newdeplibs $i"
1924
3333
          ;;
1925
3334
        file_magic*)
1926
3335
          set dummy $deplibs_check_method
1927
 
          file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
 
3336
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
1928
3337
          for a_deplib in $deplibs; do
1929
3338
            name="`expr $a_deplib : '-l\(.*\)'`"
1930
3339
            # If $name is empty we are operating on a -L argument.
1931
 
            if test "$name" != "" ; then
1932
 
              libname=`eval \\$echo \"$libname_spec\"`
1933
 
              for i in $lib_search_path; do
1934
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1935
 
                    for potent_lib in $potential_libs; do
 
3340
            if test "$name" != "" && test  "$name" != "0"; then
 
3341
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3342
                case " $predeps $postdeps " in
 
3343
                *" $a_deplib "*)
 
3344
                  newdeplibs="$newdeplibs $a_deplib"
 
3345
                  a_deplib=""
 
3346
                  ;;
 
3347
                esac
 
3348
              fi
 
3349
              if test -n "$a_deplib" ; then
 
3350
                libname=`eval \\$echo \"$libname_spec\"`
 
3351
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3352
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3353
                  for potent_lib in $potential_libs; do
1936
3354
                      # Follow soft links.
1937
3355
                      if ls -lLd "$potent_lib" 2>/dev/null \
1938
3356
                         | grep " -> " >/dev/null; then
1939
 
                        continue 
 
3357
                        continue
1940
3358
                      fi
1941
3359
                      # The statement above tries to avoid entering an
1942
3360
                      # endless loop below, in case of cyclic links.
1945
3363
                      # but so what?
1946
3364
                      potlib="$potent_lib"
1947
3365
                      while test -h "$potlib" 2>/dev/null; do
1948
 
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1949
 
                        case "$potliblink" in
 
3366
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
 
3367
                        case $potliblink in
1950
3368
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
1951
3369
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1952
3370
                        esac
1953
3371
                      done
1954
3372
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
1955
 
                         | sed 10q \
1956
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3373
                         | ${SED} 10q \
 
3374
                         | $EGREP "$file_magic_regex" > /dev/null; then
1957
3375
                        newdeplibs="$newdeplibs $a_deplib"
1958
3376
                        a_deplib=""
1959
3377
                        break 2
1960
3378
                      fi
1961
 
                    done
1962
 
              done
1963
 
              if test -n "$a_deplib" ; then
1964
 
                droppeddeps=yes
1965
 
                echo
1966
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
1967
 
                echo "*** I have the capability to make that library automatically link in when"
1968
 
                echo "*** you link to this library.  But I can only do this if you have a"
1969
 
                echo "*** shared version of the library, which you do not appear to have."
 
3379
                  done
 
3380
                done
 
3381
              fi
 
3382
              if test -n "$a_deplib" ; then
 
3383
                droppeddeps=yes
 
3384
                $echo
 
3385
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3386
                $echo "*** I have the capability to make that library automatically link in when"
 
3387
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3388
                $echo "*** shared version of the library, which you do not appear to have"
 
3389
                $echo "*** because I did check the linker path looking for a file starting"
 
3390
                if test -z "$potlib" ; then
 
3391
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3392
                else
 
3393
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3394
                  $echo "*** using a file magic. Last file checked: $potlib"
 
3395
                fi
 
3396
              fi
 
3397
            else
 
3398
              # Add a -L argument.
 
3399
              newdeplibs="$newdeplibs $a_deplib"
 
3400
            fi
 
3401
          done # Gone through all deplibs.
 
3402
          ;;
 
3403
        match_pattern*)
 
3404
          set dummy $deplibs_check_method
 
3405
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
3406
          for a_deplib in $deplibs; do
 
3407
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3408
            # If $name is empty we are operating on a -L argument.
 
3409
            if test -n "$name" && test "$name" != "0"; then
 
3410
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3411
                case " $predeps $postdeps " in
 
3412
                *" $a_deplib "*)
 
3413
                  newdeplibs="$newdeplibs $a_deplib"
 
3414
                  a_deplib=""
 
3415
                  ;;
 
3416
                esac
 
3417
              fi
 
3418
              if test -n "$a_deplib" ; then
 
3419
                libname=`eval \\$echo \"$libname_spec\"`
 
3420
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3421
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3422
                  for potent_lib in $potential_libs; do
 
3423
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3424
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3425
                        | ${SED} 10q \
 
3426
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3427
                      newdeplibs="$newdeplibs $a_deplib"
 
3428
                      a_deplib=""
 
3429
                      break 2
 
3430
                    fi
 
3431
                  done
 
3432
                done
 
3433
              fi
 
3434
              if test -n "$a_deplib" ; then
 
3435
                droppeddeps=yes
 
3436
                $echo
 
3437
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3438
                $echo "*** I have the capability to make that library automatically link in when"
 
3439
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3440
                $echo "*** shared version of the library, which you do not appear to have"
 
3441
                $echo "*** because I did check the linker path looking for a file starting"
 
3442
                if test -z "$potlib" ; then
 
3443
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3444
                else
 
3445
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3446
                  $echo "*** using a regex pattern. Last file checked: $potlib"
 
3447
                fi
1970
3448
              fi
1971
3449
            else
1972
3450
              # Add a -L argument.
1976
3454
          ;;
1977
3455
        none | unknown | *)
1978
3456
          newdeplibs=""
1979
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
1980
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
1981
 
             grep . >/dev/null; then
1982
 
            echo
 
3457
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3458
            -e 's/ -[LR][^ ]*//g'`
 
3459
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3460
            for i in $predeps $postdeps ; do
 
3461
              # can't use Xsed below, because $i might contain '/'
 
3462
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3463
            done
 
3464
          fi
 
3465
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3466
            | grep . >/dev/null; then
 
3467
            $echo
1983
3468
            if test "X$deplibs_check_method" = "Xnone"; then
1984
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3469
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
1985
3470
            else
1986
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3471
              $echo "*** Warning: inter-library dependencies are not known to be supported."
1987
3472
            fi
1988
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3473
            $echo "*** All declared inter-library dependencies are being dropped."
1989
3474
            droppeddeps=yes
1990
3475
          fi
1991
3476
          ;;
1996
3481
        libname=$libname_save
1997
3482
        name=$name_save
1998
3483
 
 
3484
        case $host in
 
3485
        *-*-rhapsody* | *-*-darwin1.[012])
 
3486
          # On Rhapsody replace the C library is the System framework
 
3487
          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
3488
          ;;
 
3489
        esac
 
3490
 
1999
3491
        if test "$droppeddeps" = yes; then
2000
3492
          if test "$module" = yes; then
2001
 
            echo
2002
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2003
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2004
 
            echo "*** a static module, that should work as long as the dlopening"
2005
 
            echo "*** application is linked with the -dlopen flag."
 
3493
            $echo
 
3494
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3495
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3496
            $echo "*** a static module, that should work as long as the dlopening"
 
3497
            $echo "*** application is linked with the -dlopen flag."
2006
3498
            if test -z "$global_symbol_pipe"; then
2007
 
              echo
2008
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2009
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2010
 
              echo "*** not find such a program.  So, this module is probably useless."
2011
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3499
              $echo
 
3500
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3501
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3502
              $echo "*** not find such a program.  So, this module is probably useless."
 
3503
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2012
3504
            fi
2013
3505
            if test "$build_old_libs" = no; then
2014
3506
              oldlibs="$output_objdir/$libname.$libext"
2018
3510
              build_libtool_libs=no
2019
3511
            fi
2020
3512
          else
2021
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2022
 
            echo "*** automatically added whenever a program is linked with this library"
2023
 
            echo "*** or is declared to -dlopen it."
 
3513
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3514
            $echo "*** automatically added whenever a program is linked with this library"
 
3515
            $echo "*** or is declared to -dlopen it."
 
3516
 
 
3517
            if test "$allow_undefined" = no; then
 
3518
              $echo
 
3519
              $echo "*** Since this library must not contain undefined symbols,"
 
3520
              $echo "*** because either the platform does not support them or"
 
3521
              $echo "*** it was explicitly requested with -no-undefined,"
 
3522
              $echo "*** libtool will only create a static version of it."
 
3523
              if test "$build_old_libs" = no; then
 
3524
                oldlibs="$output_objdir/$libname.$libext"
 
3525
                build_libtool_libs=module
 
3526
                build_old_libs=yes
 
3527
              else
 
3528
                build_libtool_libs=no
 
3529
              fi
 
3530
            fi
2024
3531
          fi
2025
3532
        fi
2026
3533
        # Done checking deplibs!
2031
3538
      library_names=
2032
3539
      old_library=
2033
3540
      dlname=
2034
 
      
 
3541
 
2035
3542
      # Test again, we may have decided not to build it any more
2036
3543
      if test "$build_libtool_libs" = yes; then
 
3544
        if test "$hardcode_into_libs" = yes; then
 
3545
          # Hardcode the library paths
 
3546
          hardcode_libdirs=
 
3547
          dep_rpath=
 
3548
          rpath="$finalize_rpath"
 
3549
          test "$mode" != relink && rpath="$compile_rpath$rpath"
 
3550
          for libdir in $rpath; do
 
3551
            if test -n "$hardcode_libdir_flag_spec"; then
 
3552
              if test -n "$hardcode_libdir_separator"; then
 
3553
                if test -z "$hardcode_libdirs"; then
 
3554
                  hardcode_libdirs="$libdir"
 
3555
                else
 
3556
                  # Just accumulate the unique libdirs.
 
3557
                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
 
3558
                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 
3559
                    ;;
 
3560
                  *)
 
3561
                    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 
3562
                    ;;
 
3563
                  esac
 
3564
                fi
 
3565
              else
 
3566
                eval flag=\"$hardcode_libdir_flag_spec\"
 
3567
                dep_rpath="$dep_rpath $flag"
 
3568
              fi
 
3569
            elif test -n "$runpath_var"; then
 
3570
              case "$perm_rpath " in
 
3571
              *" $libdir "*) ;;
 
3572
              *) perm_rpath="$perm_rpath $libdir" ;;
 
3573
              esac
 
3574
            fi
 
3575
          done
 
3576
          # Substitute the hardcoded libdirs into the rpath.
 
3577
          if test -n "$hardcode_libdir_separator" &&
 
3578
             test -n "$hardcode_libdirs"; then
 
3579
            libdir="$hardcode_libdirs"
 
3580
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3581
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3582
            else
 
3583
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3584
            fi
 
3585
          fi
 
3586
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
 
3587
            # We should set the runpath_var.
 
3588
            rpath=
 
3589
            for dir in $perm_rpath; do
 
3590
              rpath="$rpath$dir:"
 
3591
            done
 
3592
            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 
3593
          fi
 
3594
          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
 
3595
        fi
 
3596
 
 
3597
        shlibpath="$finalize_shlibpath"
 
3598
        test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 
3599
        if test -n "$shlibpath"; then
 
3600
          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 
3601
        fi
 
3602
 
2037
3603
        # Get the real and link names of the library.
 
3604
        eval shared_ext=\"$shrext_cmds\"
2038
3605
        eval library_names=\"$library_names_spec\"
2039
3606
        set dummy $library_names
2040
3607
        realname="$2"
2045
3612
        else
2046
3613
          soname="$realname"
2047
3614
        fi
 
3615
        if test -z "$dlname"; then
 
3616
          dlname=$soname
 
3617
        fi
2048
3618
 
2049
3619
        lib="$output_objdir/$realname"
2050
3620
        for link
2052
3622
          linknames="$linknames $link"
2053
3623
        done
2054
3624
 
2055
 
        # Ensure that we have .o objects for linkers which dislike .lo
2056
 
        # (e.g. aix) in case we are running --disable-static
2057
 
        for obj in $libobjs; do
2058
 
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2059
 
          if test "X$xdir" = "X$obj"; then
2060
 
            xdir="."
2061
 
          else
2062
 
            xdir="$xdir"
2063
 
          fi
2064
 
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2065
 
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2066
 
          if test ! -f $xdir/$oldobj; then
2067
 
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2068
 
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2069
 
          fi
2070
 
        done
2071
 
 
2072
3625
        # Use standard objects if they are pic
2073
3626
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2074
3627
 
2078
3631
            $show "generating symbol list for \`$libname.la'"
2079
3632
            export_symbols="$output_objdir/$libname.exp"
2080
3633
            $run $rm $export_symbols
2081
 
            eval cmds=\"$export_symbols_cmds\"
2082
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
 
3634
            cmds=$export_symbols_cmds
 
3635
            save_ifs="$IFS"; IFS='~'
2083
3636
            for cmd in $cmds; do
2084
3637
              IFS="$save_ifs"
2085
 
              $show "$cmd"
2086
 
              $run eval "$cmd" || exit $?
 
3638
              eval cmd=\"$cmd\"
 
3639
              if len=`expr "X$cmd" : ".*"` &&
 
3640
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3641
                $show "$cmd"
 
3642
                $run eval "$cmd" || exit $?
 
3643
                skipped_export=false
 
3644
              else
 
3645
                # The command line is too long to execute in one step.
 
3646
                $show "using reloadable object file for export list..."
 
3647
                skipped_export=:
 
3648
              fi
2087
3649
            done
2088
3650
            IFS="$save_ifs"
2089
3651
            if test -n "$export_symbols_regex"; then
2090
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2091
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
3652
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3653
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2092
3654
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2093
3655
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2094
3656
            fi
2099
3661
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2100
3662
        fi
2101
3663
 
 
3664
        tmp_deplibs=
 
3665
        for test_deplib in $deplibs; do
 
3666
                case " $convenience " in
 
3667
                *" $test_deplib "*) ;;
 
3668
                *)
 
3669
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3670
                        ;;
 
3671
                esac
 
3672
        done
 
3673
        deplibs="$tmp_deplibs"
 
3674
 
2102
3675
        if test -n "$convenience"; then
2103
3676
          if test -n "$whole_archive_flag_spec"; then
 
3677
            save_libobjs=$libobjs
2104
3678
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2105
3679
          else
2106
3680
            gentop="$output_objdir/${outputname}x"
2107
3681
            $show "${rm}r $gentop"
2108
3682
            $run ${rm}r "$gentop"
2109
 
            $show "mkdir $gentop"
2110
 
            $run mkdir "$gentop"
 
3683
            $show "$mkdir $gentop"
 
3684
            $run $mkdir "$gentop"
2111
3685
            status=$?
2112
 
            if test $status -ne 0 && test ! -d "$gentop"; then
 
3686
            if test "$status" -ne 0 && test ! -d "$gentop"; then
2113
3687
              exit $status
2114
3688
            fi
2115
3689
            generated="$generated $gentop"
2116
3690
 
2117
3691
            for xlib in $convenience; do
2118
3692
              # Extract the objects.
2119
 
              case "$xlib" in
 
3693
              case $xlib in
2120
3694
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2121
3695
              *) xabs=`pwd`"/$xlib" ;;
2122
3696
              esac
2125
3699
 
2126
3700
              $show "${rm}r $xdir"
2127
3701
              $run ${rm}r "$xdir"
2128
 
              $show "mkdir $xdir"
2129
 
              $run mkdir "$xdir"
 
3702
              $show "$mkdir $xdir"
 
3703
              $run $mkdir "$xdir"
2130
3704
              status=$?
2131
 
              if test $status -ne 0 && test ! -d "$xdir"; then
 
3705
              if test "$status" -ne 0 && test ! -d "$xdir"; then
2132
3706
                exit $status
2133
3707
              fi
 
3708
              # We will extract separately just the conflicting names and we will no
 
3709
              # longer touch any unique names. It is faster to leave these extract
 
3710
              # automatically by $AR in one run.
2134
3711
              $show "(cd $xdir && $AR x $xabs)"
2135
3712
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
3713
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
3714
                :
 
3715
              else
 
3716
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
3717
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
3718
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
3719
                do
 
3720
                  i=1
 
3721
                  while test "$i" -le "$count"
 
3722
                  do
 
3723
                   # Put our $i before any first dot (extension)
 
3724
                   # Never overwrite any file
 
3725
                   name_to="$name"
 
3726
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
3727
                   do
 
3728
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
3729
                   done
 
3730
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
3731
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
3732
                   i=`expr $i + 1`
 
3733
                  done
 
3734
                done
 
3735
              fi
2136
3736
 
2137
 
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
 
3737
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2138
3738
            done
2139
3739
          fi
2140
3740
        fi
2141
3741
 
2142
3742
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2143
3743
          eval flag=\"$thread_safe_flag_spec\"
2144
 
          linkopts="$linkopts $flag"
 
3744
          linker_flags="$linker_flags $flag"
 
3745
        fi
 
3746
 
 
3747
        # Make a backup of the uninstalled library when relinking
 
3748
        if test "$mode" = relink; then
 
3749
          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2145
3750
        fi
2146
3751
 
2147
3752
        # Do each of the archive commands.
 
3753
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3754
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3755
            eval test_cmds=\"$module_expsym_cmds\"
 
3756
            cmds=$module_expsym_cmds
 
3757
          else
 
3758
            eval test_cmds=\"$module_cmds\"
 
3759
            cmds=$module_cmds
 
3760
          fi
 
3761
        else
2148
3762
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2149
 
          eval cmds=\"$archive_expsym_cmds\"
2150
 
        else
2151
 
          eval cmds=\"$archive_cmds\"
2152
 
        fi
2153
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
3763
          eval test_cmds=\"$archive_expsym_cmds\"
 
3764
          cmds=$archive_expsym_cmds
 
3765
        else
 
3766
          eval test_cmds=\"$archive_cmds\"
 
3767
          cmds=$archive_cmds
 
3768
          fi
 
3769
        fi
 
3770
 
 
3771
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
3772
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3773
          :
 
3774
        else
 
3775
          # The command line is too long to link in one step, link piecewise.
 
3776
          $echo "creating reloadable object files..."
 
3777
 
 
3778
          # Save the value of $output and $libobjs because we want to
 
3779
          # use them later.  If we have whole_archive_flag_spec, we
 
3780
          # want to use save_libobjs as it was before
 
3781
          # whole_archive_flag_spec was expanded, because we can't
 
3782
          # assume the linker understands whole_archive_flag_spec.
 
3783
          # This may have to be revisited, in case too many
 
3784
          # convenience libraries get linked in and end up exceeding
 
3785
          # the spec.
 
3786
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
3787
            save_libobjs=$libobjs
 
3788
          fi
 
3789
          save_output=$output
 
3790
 
 
3791
          # Clear the reloadable object creation command queue and
 
3792
          # initialize k to one.
 
3793
          test_cmds=
 
3794
          concat_cmds=
 
3795
          objlist=
 
3796
          delfiles=
 
3797
          last_robj=
 
3798
          k=1
 
3799
          output=$output_objdir/$save_output-${k}.$objext
 
3800
          # Loop over the list of objects to be linked.
 
3801
          for obj in $save_libobjs
 
3802
          do
 
3803
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3804
            if test "X$objlist" = X ||
 
3805
               { len=`expr "X$test_cmds" : ".*"` &&
 
3806
                 test "$len" -le "$max_cmd_len"; }; then
 
3807
              objlist="$objlist $obj"
 
3808
            else
 
3809
              # The command $test_cmds is almost too long, add a
 
3810
              # command to the queue.
 
3811
              if test "$k" -eq 1 ; then
 
3812
                # The first file doesn't have a previous command to add.
 
3813
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3814
              else
 
3815
                # All subsequent reloadable object files will link in
 
3816
                # the last one created.
 
3817
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
 
3818
              fi
 
3819
              last_robj=$output_objdir/$save_output-${k}.$objext
 
3820
              k=`expr $k + 1`
 
3821
              output=$output_objdir/$save_output-${k}.$objext
 
3822
              objlist=$obj
 
3823
              len=1
 
3824
            fi
 
3825
          done
 
3826
          # Handle the remaining objects by creating one last
 
3827
          # reloadable object file.  All subsequent reloadable object
 
3828
          # files will link in the last one created.
 
3829
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
3830
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3831
 
 
3832
          if ${skipped_export-false}; then
 
3833
            $show "generating symbol list for \`$libname.la'"
 
3834
            export_symbols="$output_objdir/$libname.exp"
 
3835
            $run $rm $export_symbols
 
3836
            libobjs=$output
 
3837
            # Append the command to create the export file.
 
3838
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3839
          fi
 
3840
 
 
3841
          # Set up a command to remove the reloadale object files
 
3842
          # after they are used.
 
3843
          i=0
 
3844
          while test "$i" -lt "$k"
 
3845
          do
 
3846
            i=`expr $i + 1`
 
3847
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
3848
          done
 
3849
 
 
3850
          $echo "creating a temporary reloadable object file: $output"
 
3851
 
 
3852
          # Loop through the commands generated above and execute them.
 
3853
          save_ifs="$IFS"; IFS='~'
 
3854
          for cmd in $concat_cmds; do
 
3855
            IFS="$save_ifs"
 
3856
            $show "$cmd"
 
3857
            $run eval "$cmd" || exit $?
 
3858
          done
 
3859
          IFS="$save_ifs"
 
3860
 
 
3861
          libobjs=$output
 
3862
          # Restore the value of output.
 
3863
          output=$save_output
 
3864
 
 
3865
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
3866
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
3867
          fi
 
3868
          # Expand the library linking commands again to reset the
 
3869
          # value of $libobjs for piecewise linking.
 
3870
 
 
3871
          # Do each of the archive commands.
 
3872
          if test "$module" = yes && test -n "$module_cmds" ; then
 
3873
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3874
              cmds=$module_expsym_cmds
 
3875
            else
 
3876
              cmds=$module_cmds
 
3877
            fi
 
3878
          else
 
3879
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
3880
            cmds=$archive_expsym_cmds
 
3881
          else
 
3882
            cmds=$archive_cmds
 
3883
            fi
 
3884
          fi
 
3885
 
 
3886
          # Append the command to remove the reloadable object files
 
3887
          # to the just-reset $cmds.
 
3888
          eval cmds=\"\$cmds~\$rm $delfiles\"
 
3889
        fi
 
3890
        save_ifs="$IFS"; IFS='~'
2154
3891
        for cmd in $cmds; do
2155
3892
          IFS="$save_ifs"
 
3893
          eval cmd=\"$cmd\"
2156
3894
          $show "$cmd"
2157
3895
          $run eval "$cmd" || exit $?
2158
3896
        done
2159
3897
        IFS="$save_ifs"
2160
3898
 
 
3899
        # Restore the uninstalled library and exit
 
3900
        if test "$mode" = relink; then
 
3901
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
 
3902
          exit $EXIT_SUCCESS
 
3903
        fi
 
3904
 
2161
3905
        # Create links to the real library.
2162
3906
        for linkname in $linknames; do
2163
3907
          if test "$realname" != "$linkname"; then
2174
3918
      fi
2175
3919
      ;;
2176
3920
 
2177
 
    *.lo | *.o | *.obj)
2178
 
      if test -n "$link_against_libtool_libs"; then
2179
 
        $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2180
 
        exit 1
2181
 
      fi
2182
 
 
 
3921
    obj)
2183
3922
      if test -n "$deplibs"; then
2184
3923
        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2185
3924
      fi
2204
3943
        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2205
3944
      fi
2206
3945
 
2207
 
      case "$output" in
 
3946
      case $output in
2208
3947
      *.lo)
2209
 
        if test -n "$objs"; then
 
3948
        if test -n "$objs$old_deplibs"; then
2210
3949
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2211
 
          exit 1
 
3950
          exit $EXIT_FAILURE
2212
3951
        fi
2213
3952
        libobj="$output"
2214
3953
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2230
3969
      gentop=
2231
3970
      # reload_cmds runs $LD directly, so let us get rid of
2232
3971
      # -Wl from whole_archive_flag_spec
2233
 
      wl= 
 
3972
      wl=
2234
3973
 
2235
3974
      if test -n "$convenience"; then
2236
3975
        if test -n "$whole_archive_flag_spec"; then
2239
3978
          gentop="$output_objdir/${obj}x"
2240
3979
          $show "${rm}r $gentop"
2241
3980
          $run ${rm}r "$gentop"
2242
 
          $show "mkdir $gentop"
2243
 
          $run mkdir "$gentop"
 
3981
          $show "$mkdir $gentop"
 
3982
          $run $mkdir "$gentop"
2244
3983
          status=$?
2245
 
          if test $status -ne 0 && test ! -d "$gentop"; then
 
3984
          if test "$status" -ne 0 && test ! -d "$gentop"; then
2246
3985
            exit $status
2247
3986
          fi
2248
3987
          generated="$generated $gentop"
2249
3988
 
2250
3989
          for xlib in $convenience; do
2251
3990
            # Extract the objects.
2252
 
            case "$xlib" in
 
3991
            case $xlib in
2253
3992
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2254
3993
            *) xabs=`pwd`"/$xlib" ;;
2255
3994
            esac
2258
3997
 
2259
3998
            $show "${rm}r $xdir"
2260
3999
            $run ${rm}r "$xdir"
2261
 
            $show "mkdir $xdir"
2262
 
            $run mkdir "$xdir"
 
4000
            $show "$mkdir $xdir"
 
4001
            $run $mkdir "$xdir"
2263
4002
            status=$?
2264
 
            if test $status -ne 0 && test ! -d "$xdir"; then
 
4003
            if test "$status" -ne 0 && test ! -d "$xdir"; then
2265
4004
              exit $status
2266
4005
            fi
 
4006
            # We will extract separately just the conflicting names and we will no
 
4007
            # longer touch any unique names. It is faster to leave these extract
 
4008
            # automatically by $AR in one run.
2267
4009
            $show "(cd $xdir && $AR x $xabs)"
2268
4010
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
4011
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
4012
              :
 
4013
            else
 
4014
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
4015
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
4016
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
4017
              do
 
4018
                i=1
 
4019
                while test "$i" -le "$count"
 
4020
                do
 
4021
                 # Put our $i before any first dot (extension)
 
4022
                 # Never overwrite any file
 
4023
                 name_to="$name"
 
4024
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
4025
                 do
 
4026
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
4027
                 done
 
4028
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
4029
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
4030
                 i=`expr $i + 1`
 
4031
                done
 
4032
              done
 
4033
            fi
2269
4034
 
2270
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
 
4035
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2271
4036
          done
2272
4037
        fi
2273
4038
      fi
2274
4039
 
2275
4040
      # Create the old-style object.
2276
 
      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
 
4041
      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
2277
4042
 
2278
4043
      output="$obj"
2279
 
      eval cmds=\"$reload_cmds\"
2280
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
4044
      cmds=$reload_cmds
 
4045
      save_ifs="$IFS"; IFS='~'
2281
4046
      for cmd in $cmds; do
2282
4047
        IFS="$save_ifs"
 
4048
        eval cmd=\"$cmd\"
2283
4049
        $show "$cmd"
2284
4050
        $run eval "$cmd" || exit $?
2285
4051
      done
2292
4058
          $run ${rm}r $gentop
2293
4059
        fi
2294
4060
 
2295
 
        exit 0
 
4061
        exit $EXIT_SUCCESS
2296
4062
      fi
2297
4063
 
2298
4064
      if test "$build_libtool_libs" != yes; then
2303
4069
 
2304
4070
        # Create an invalid libtool object if no PIC, so that we don't
2305
4071
        # accidentally link it into a program.
2306
 
        $show "echo timestamp > $libobj"
2307
 
        $run eval "echo timestamp > $libobj" || exit $?
2308
 
        exit 0
 
4072
        # $show "echo timestamp > $libobj"
 
4073
        # $run eval "echo timestamp > $libobj" || exit $?
 
4074
        exit $EXIT_SUCCESS
2309
4075
      fi
2310
4076
 
2311
 
      if test -n "$pic_flag"; then
 
4077
      if test -n "$pic_flag" || test "$pic_mode" != default; then
2312
4078
        # Only do commands if we really have different PIC objects.
2313
4079
        reload_objs="$libobjs $reload_conv_objs"
2314
4080
        output="$libobj"
2315
 
        eval cmds=\"$reload_cmds\"
2316
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
4081
        cmds=$reload_cmds
 
4082
        save_ifs="$IFS"; IFS='~'
2317
4083
        for cmd in $cmds; do
2318
4084
          IFS="$save_ifs"
 
4085
          eval cmd=\"$cmd\"
2319
4086
          $show "$cmd"
2320
4087
          $run eval "$cmd" || exit $?
2321
4088
        done
2322
4089
        IFS="$save_ifs"
2323
 
      else
2324
 
        # Just create a symlink.
2325
 
        $show $rm $libobj
2326
 
        $run $rm $libobj
2327
 
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
2328
 
        if test "X$xdir" = "X$libobj"; then
2329
 
          xdir="."
2330
 
        else
2331
 
          xdir="$xdir"
2332
 
        fi
2333
 
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
2334
 
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2335
 
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
2336
 
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
2337
4090
      fi
2338
4091
 
2339
4092
      if test -n "$gentop"; then
2341
4094
        $run ${rm}r $gentop
2342
4095
      fi
2343
4096
 
2344
 
      exit 0
 
4097
      exit $EXIT_SUCCESS
2345
4098
      ;;
2346
4099
 
2347
 
    # Anything else should be a program.
2348
 
    *)
 
4100
    prog)
 
4101
      case $host in
 
4102
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
 
4103
      esac
2349
4104
      if test -n "$vinfo"; then
2350
4105
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2351
4106
      fi
2355
4110
      fi
2356
4111
 
2357
4112
      if test "$preload" = yes; then
2358
 
        if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
 
4113
        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
2359
4114
           test "$dlopen_self_static" = unknown; then
2360
4115
          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2361
 
        fi 
 
4116
        fi
2362
4117
      fi
2363
 
    
 
4118
 
 
4119
      case $host in
 
4120
      *-*-rhapsody* | *-*-darwin1.[012])
 
4121
        # On Rhapsody replace the C library is the System framework
 
4122
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
4123
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
4124
        ;;
 
4125
      esac
 
4126
 
 
4127
      case $host in
 
4128
      *darwin*)
 
4129
        # Don't allow lazy linking, it breaks C++ global constructors
 
4130
        if test "$tagname" = CXX ; then
 
4131
        compile_command="$compile_command ${wl}-bind_at_load"
 
4132
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4133
        fi
 
4134
        ;;
 
4135
      esac
 
4136
 
 
4137
      compile_command="$compile_command $compile_deplibs"
 
4138
      finalize_command="$finalize_command $finalize_deplibs"
 
4139
 
2364
4140
      if test -n "$rpath$xrpath"; then
2365
4141
        # If the user specified any rpath flags, then add them.
2366
4142
        for libdir in $rpath $xrpath; do
2367
4143
          # This is the magic to use -rpath.
2368
 
          case "$compile_rpath " in
2369
 
          *" $libdir "*) ;;
2370
 
          *) compile_rpath="$compile_rpath $libdir" ;;
2371
 
          esac
2372
4144
          case "$finalize_rpath " in
2373
4145
          *" $libdir "*) ;;
2374
4146
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2386
4158
              hardcode_libdirs="$libdir"
2387
4159
            else
2388
4160
              # Just accumulate the unique libdirs.
2389
 
              case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
 
4161
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2390
4162
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2391
4163
                ;;
2392
4164
              *)
2404
4176
          *) perm_rpath="$perm_rpath $libdir" ;;
2405
4177
          esac
2406
4178
        fi
 
4179
        case $host in
 
4180
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4181
          case :$dllsearchpath: in
 
4182
          *":$libdir:"*) ;;
 
4183
          *) dllsearchpath="$dllsearchpath:$libdir";;
 
4184
          esac
 
4185
          ;;
 
4186
        esac
2407
4187
      done
2408
4188
      # Substitute the hardcoded libdirs into the rpath.
2409
4189
      if test -n "$hardcode_libdir_separator" &&
2422
4202
              hardcode_libdirs="$libdir"
2423
4203
            else
2424
4204
              # Just accumulate the unique libdirs.
2425
 
              case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
 
4205
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2426
4206
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2427
4207
                ;;
2428
4208
              *)
2449
4229
      fi
2450
4230
      finalize_rpath="$rpath"
2451
4231
 
2452
 
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2453
 
      if test "X$output_objdir" = "X$output"; then
2454
 
        output_objdir="$objdir"
2455
 
      else
2456
 
        output_objdir="$output_objdir/$objdir"
2457
 
      fi
2458
 
 
2459
 
      # Create the binary in the object directory, then wrap it.
2460
 
      if test ! -d $output_objdir; then
2461
 
        $show "$mkdir $output_objdir"
2462
 
        $run $mkdir $output_objdir
2463
 
        status=$?
2464
 
        if test $status -ne 0 && test ! -d $output_objdir; then
2465
 
          exit $status
2466
 
        fi
2467
 
      fi
2468
 
 
2469
4232
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
2470
4233
        # Transform all the library objects into standard objects.
2471
4234
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2482
4245
      fi
2483
4246
 
2484
4247
      if test -n "$dlsyms"; then
2485
 
        case "$dlsyms" in
 
4248
        case $dlsyms in
2486
4249
        "") ;;
2487
4250
        *.c)
2488
4251
          # Discover the nlist of each of the dlfiles.
2514
4277
            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2515
4278
 
2516
4279
            # Add our own program objects to the symbol list.
2517
 
            progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
4280
            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2518
4281
            for arg in $progfiles; do
2519
4282
              $show "extracting global C symbols from \`$arg'"
2520
4283
              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2521
4284
            done
2522
4285
 
2523
4286
            if test -n "$exclude_expsyms"; then
2524
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4287
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2525
4288
              $run eval '$mv "$nlist"T "$nlist"'
2526
4289
            fi
2527
 
            
 
4290
 
2528
4291
            if test -n "$export_symbols_regex"; then
2529
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4292
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2530
4293
              $run eval '$mv "$nlist"T "$nlist"'
2531
4294
            fi
2532
4295
 
2534
4297
            if test -z "$export_symbols"; then
2535
4298
              export_symbols="$output_objdir/$output.exp"
2536
4299
              $run $rm $export_symbols
2537
 
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4300
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2538
4301
            else
2539
 
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
 
4302
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2540
4303
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2541
4304
              $run eval 'mv "$nlist"T "$nlist"'
2542
4305
            fi
2544
4307
 
2545
4308
          for arg in $dlprefiles; do
2546
4309
            $show "extracting global C symbols from \`$arg'"
2547
 
            name=`echo "$arg" | sed -e 's%^.*/%%'`
2548
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4310
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4311
            $run eval '$echo ": $name " >> "$nlist"'
2549
4312
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2550
4313
          done
2551
4314
 
2554
4317
            test -f "$nlist" || : > "$nlist"
2555
4318
 
2556
4319
            if test -n "$exclude_expsyms"; then
2557
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4320
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2558
4321
              $mv "$nlist"T "$nlist"
2559
4322
            fi
2560
4323
 
2561
4324
            # Try sorting and uniquifying the output.
2562
 
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
4325
            if grep -v "^: " < "$nlist" |
 
4326
                if sort -k 3 </dev/null >/dev/null 2>&1; then
 
4327
                  sort -k 3
 
4328
                else
 
4329
                  sort +2
 
4330
                fi |
 
4331
                uniq > "$nlist"S; then
2563
4332
              :
2564
4333
            else
2565
4334
              grep -v "^: " < "$nlist" > "$nlist"S
2568
4337
            if test -f "$nlist"S; then
2569
4338
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2570
4339
            else
2571
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4340
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
2572
4341
            fi
2573
4342
 
2574
4343
            $echo >> "$output_objdir/$dlsyms" "\
2576
4345
#undef lt_preloaded_symbols
2577
4346
 
2578
4347
#if defined (__STDC__) && __STDC__
2579
 
# define lt_ptr_t void *
 
4348
# define lt_ptr void *
2580
4349
#else
2581
 
# define lt_ptr_t char *
 
4350
# define lt_ptr char *
2582
4351
# define const
2583
4352
#endif
2584
4353
 
2585
4354
/* The mapping between symbol names and symbols. */
2586
4355
const struct {
2587
4356
  const char *name;
2588
 
  lt_ptr_t address;
 
4357
  lt_ptr address;
2589
4358
}
2590
4359
lt_preloaded_symbols[] =
2591
4360
{\
2592
4361
"
2593
4362
 
2594
 
            sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
2595
 
                -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
2596
 
                  < "$nlist" >> "$output_objdir/$dlsyms"
 
4363
            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
2597
4364
 
2598
4365
            $echo >> "$output_objdir/$dlsyms" "\
2599
 
  {0, (lt_ptr_t) 0}
 
4366
  {0, (lt_ptr) 0}
2600
4367
};
2601
4368
 
2602
4369
/* This works around a problem in FreeBSD linker */
2613
4380
          fi
2614
4381
 
2615
4382
          pic_flag_for_symtable=
2616
 
          case "$host" in
 
4383
          case $host in
2617
4384
          # compiling the symbol table file with pic_flag works around
2618
4385
          # a FreeBSD bug that causes programs to crash when -lm is
2619
4386
          # linked before any other PIC object.  But we must not use
2620
4387
          # pic_flag when linking with -static.  The problem exists in
2621
4388
          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2622
 
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 
4389
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2623
4390
            case "$compile_command " in
2624
4391
            *" -static "*) ;;
2625
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4392
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
2626
4393
            esac;;
2627
4394
          *-*-hpux*)
2628
4395
            case "$compile_command " in
2629
4396
            *" -static "*) ;;
2630
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4397
            *) pic_flag_for_symtable=" $pic_flag";;
2631
4398
            esac
2632
4399
          esac
2633
4400
 
2634
4401
          # Now compile the dynamic symbol file.
2635
 
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2636
 
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4402
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4403
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2637
4404
 
2638
4405
          # Clean up the generated files.
2639
4406
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2645
4412
          ;;
2646
4413
        *)
2647
4414
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2648
 
          exit 1
 
4415
          exit $EXIT_FAILURE
2649
4416
          ;;
2650
4417
        esac
2651
4418
      else
2658
4425
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2659
4426
      fi
2660
4427
 
2661
 
      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
 
4428
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
2662
4429
        # Replace the output file specification.
2663
4430
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2664
4431
        link_command="$compile_command$compile_rpath"
2667
4434
        $show "$link_command"
2668
4435
        $run eval "$link_command"
2669
4436
        status=$?
2670
 
        
 
4437
 
2671
4438
        # Delete the generated files.
2672
4439
        if test -n "$dlsyms"; then
2673
4440
          $show "$rm $output_objdir/${outputname}S.${objext}"
2681
4448
        # We should set the shlibpath_var
2682
4449
        rpath=
2683
4450
        for dir in $temp_rpath; do
2684
 
          case "$dir" in
 
4451
          case $dir in
2685
4452
          [\\/]* | [A-Za-z]:[\\/]*)
2686
4453
            # Absolute path.
2687
4454
            rpath="$rpath$dir:"
2723
4490
        fi
2724
4491
      fi
2725
4492
 
 
4493
      if test "$no_install" = yes; then
 
4494
        # We don't need to create a wrapper script.
 
4495
        link_command="$compile_var$compile_command$compile_rpath"
 
4496
        # Replace the output file specification.
 
4497
        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
4498
        # Delete the old output file.
 
4499
        $run $rm $output
 
4500
        # Link the executable and exit
 
4501
        $show "$link_command"
 
4502
        $run eval "$link_command" || exit $?
 
4503
        exit $EXIT_SUCCESS
 
4504
      fi
 
4505
 
2726
4506
      if test "$hardcode_action" = relink; then
2727
4507
        # Fast installation is not supported
2728
4508
        link_command="$compile_var$compile_command$compile_rpath"
2729
4509
        relink_command="$finalize_var$finalize_command$finalize_rpath"
2730
 
        
 
4510
 
2731
4511
        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2732
4512
        $echo "$modename: \`$output' will be relinked during installation" 1>&2
2733
4513
      else
2747
4527
 
2748
4528
      # Replace the output file specification.
2749
4529
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2750
 
      
 
4530
 
2751
4531
      # Delete the old output files.
2752
4532
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2753
4533
 
2759
4539
 
2760
4540
      # Quote the relink command for shipping.
2761
4541
      if test -n "$relink_command"; then
 
4542
        # Preserve any variables that may affect compiler behavior
 
4543
        for var in $variables_saved_for_relink; do
 
4544
          if eval test -z \"\${$var+set}\"; then
 
4545
            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
 
4546
          elif eval var_value=\$$var; test -z "$var_value"; then
 
4547
            relink_command="$var=; export $var; $relink_command"
 
4548
          else
 
4549
            var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
 
4550
            relink_command="$var=\"$var_value\"; export $var; $relink_command"
 
4551
          fi
 
4552
        done
 
4553
        relink_command="(cd `pwd`; $relink_command)"
2762
4554
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2763
4555
      fi
2764
4556
 
2765
4557
      # Quote $echo for shipping.
2766
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2767
 
        case "$0" in
2768
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2769
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4558
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4559
        case $progpath in
 
4560
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4561
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
2770
4562
        esac
2771
4563
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2772
4564
      else
2778
4570
        # win32 will think the script is a binary if it has
2779
4571
        # a .exe suffix, so we strip it off here.
2780
4572
        case $output in
2781
 
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
4573
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
 
4574
        esac
 
4575
        # test for cygwin because mv fails w/o .exe extensions
 
4576
        case $host in
 
4577
          *cygwin*)
 
4578
            exeext=.exe
 
4579
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
 
4580
          *) exeext= ;;
 
4581
        esac
 
4582
        case $host in
 
4583
          *cygwin* | *mingw* )
 
4584
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
 
4585
            cwrapper=`$echo ${output}.exe`
 
4586
            $rm $cwrappersource $cwrapper
 
4587
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4588
 
 
4589
            cat > $cwrappersource <<EOF
 
4590
 
 
4591
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4592
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4593
 
 
4594
   The $output program cannot be directly executed until all the libtool
 
4595
   libraries that it depends on are installed.
 
4596
 
 
4597
   This wrapper executable should never be moved out of the build directory.
 
4598
   If it is, it will not operate correctly.
 
4599
 
 
4600
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4601
   but could eventually absorb all of the scripts functionality and
 
4602
   exec $objdir/$outputname directly.
 
4603
*/
 
4604
EOF
 
4605
            cat >> $cwrappersource<<"EOF"
 
4606
#include <stdio.h>
 
4607
#include <stdlib.h>
 
4608
#include <unistd.h>
 
4609
#include <malloc.h>
 
4610
#include <stdarg.h>
 
4611
#include <assert.h>
 
4612
 
 
4613
#if defined(PATH_MAX)
 
4614
# define LT_PATHMAX PATH_MAX
 
4615
#elif defined(MAXPATHLEN)
 
4616
# define LT_PATHMAX MAXPATHLEN
 
4617
#else
 
4618
# define LT_PATHMAX 1024
 
4619
#endif
 
4620
 
 
4621
#ifndef DIR_SEPARATOR
 
4622
#define DIR_SEPARATOR '/'
 
4623
#endif
 
4624
 
 
4625
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4626
  defined (__OS2__)
 
4627
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4628
#ifndef DIR_SEPARATOR_2
 
4629
#define DIR_SEPARATOR_2 '\\'
 
4630
#endif
 
4631
#endif
 
4632
 
 
4633
#ifndef DIR_SEPARATOR_2
 
4634
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4635
#else /* DIR_SEPARATOR_2 */
 
4636
# define IS_DIR_SEPARATOR(ch) \
 
4637
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4638
#endif /* DIR_SEPARATOR_2 */
 
4639
 
 
4640
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4641
#define XFREE(stale) do { \
 
4642
  if (stale) { free ((void *) stale); stale = 0; } \
 
4643
} while (0)
 
4644
 
 
4645
const char *program_name = NULL;
 
4646
 
 
4647
void * xmalloc (size_t num);
 
4648
char * xstrdup (const char *string);
 
4649
char * basename (const char *name);
 
4650
char * fnqualify(const char *path);
 
4651
char * strendzap(char *str, const char *pat);
 
4652
void lt_fatal (const char *message, ...);
 
4653
 
 
4654
int
 
4655
main (int argc, char *argv[])
 
4656
{
 
4657
  char **newargz;
 
4658
  int i;
 
4659
 
 
4660
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4661
  newargz = XMALLOC(char *, argc+2);
 
4662
EOF
 
4663
 
 
4664
            cat >> $cwrappersource <<EOF
 
4665
  newargz[0] = "$SHELL";
 
4666
EOF
 
4667
 
 
4668
            cat >> $cwrappersource <<"EOF"
 
4669
  newargz[1] = fnqualify(argv[0]);
 
4670
  /* we know the script has the same name, without the .exe */
 
4671
  /* so make sure newargz[1] doesn't end in .exe */
 
4672
  strendzap(newargz[1],".exe");
 
4673
  for (i = 1; i < argc; i++)
 
4674
    newargz[i+1] = xstrdup(argv[i]);
 
4675
  newargz[argc+1] = NULL;
 
4676
EOF
 
4677
 
 
4678
            cat >> $cwrappersource <<EOF
 
4679
  execv("$SHELL",newargz);
 
4680
EOF
 
4681
 
 
4682
            cat >> $cwrappersource <<"EOF"
 
4683
}
 
4684
 
 
4685
void *
 
4686
xmalloc (size_t num)
 
4687
{
 
4688
  void * p = (void *) malloc (num);
 
4689
  if (!p)
 
4690
    lt_fatal ("Memory exhausted");
 
4691
 
 
4692
  return p;
 
4693
}
 
4694
 
 
4695
char *
 
4696
xstrdup (const char *string)
 
4697
{
 
4698
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4699
;
 
4700
}
 
4701
 
 
4702
char *
 
4703
basename (const char *name)
 
4704
{
 
4705
  const char *base;
 
4706
 
 
4707
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4708
  /* Skip over the disk name in MSDOS pathnames. */
 
4709
  if (isalpha (name[0]) && name[1] == ':')
 
4710
    name += 2;
 
4711
#endif
 
4712
 
 
4713
  for (base = name; *name; name++)
 
4714
    if (IS_DIR_SEPARATOR (*name))
 
4715
      base = name + 1;
 
4716
  return (char *) base;
 
4717
}
 
4718
 
 
4719
char *
 
4720
fnqualify(const char *path)
 
4721
{
 
4722
  size_t size;
 
4723
  char *p;
 
4724
  char tmp[LT_PATHMAX + 1];
 
4725
 
 
4726
  assert(path != NULL);
 
4727
 
 
4728
  /* Is it qualified already? */
 
4729
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4730
  if (isalpha (path[0]) && path[1] == ':')
 
4731
    return xstrdup (path);
 
4732
#endif
 
4733
  if (IS_DIR_SEPARATOR (path[0]))
 
4734
    return xstrdup (path);
 
4735
 
 
4736
  /* prepend the current directory */
 
4737
  /* doesn't handle '~' */
 
4738
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4739
    lt_fatal ("getcwd failed");
 
4740
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4741
  p = XMALLOC(char, size);
 
4742
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4743
  return p;
 
4744
}
 
4745
 
 
4746
char *
 
4747
strendzap(char *str, const char *pat)
 
4748
{
 
4749
  size_t len, patlen;
 
4750
 
 
4751
  assert(str != NULL);
 
4752
  assert(pat != NULL);
 
4753
 
 
4754
  len = strlen(str);
 
4755
  patlen = strlen(pat);
 
4756
 
 
4757
  if (patlen <= len)
 
4758
  {
 
4759
    str += len - patlen;
 
4760
    if (strcmp(str, pat) == 0)
 
4761
      *str = '\0';
 
4762
  }
 
4763
  return str;
 
4764
}
 
4765
 
 
4766
static void
 
4767
lt_error_core (int exit_status, const char * mode,
 
4768
          const char * message, va_list ap)
 
4769
{
 
4770
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4771
  vfprintf (stderr, message, ap);
 
4772
  fprintf (stderr, ".\n");
 
4773
 
 
4774
  if (exit_status >= 0)
 
4775
    exit (exit_status);
 
4776
}
 
4777
 
 
4778
void
 
4779
lt_fatal (const char *message, ...)
 
4780
{
 
4781
  va_list ap;
 
4782
  va_start (ap, message);
 
4783
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4784
  va_end (ap);
 
4785
}
 
4786
EOF
 
4787
          # we should really use a build-platform specific compiler
 
4788
          # here, but OTOH, the wrappers (shell script and this C one)
 
4789
          # are only useful if you want to execute the "real" binary.
 
4790
          # Since the "real" binary is built for $host, then this
 
4791
          # wrapper might as well be built for $host, too.
 
4792
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4793
          ;;
2782
4794
        esac
2783
4795
        $rm $output
2784
 
        trap "$rm $output; exit 1" 1 2 15
 
4796
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
2785
4797
 
2786
4798
        $echo > $output "\
2787
4799
#! $SHELL
2797
4809
 
2798
4810
# Sed substitution that helps us do robust quoting.  It backslashifies
2799
4811
# metacharacters that are still active within double-quoted strings.
2800
 
Xsed='sed -e 1s/^X//'
 
4812
Xsed='${SED} -e 1s/^X//'
2801
4813
sed_quote_subst='$sed_quote_subst'
2802
4814
 
2803
4815
# The HP-UX ksh and POSIX shell print the target directory to stdout
2809
4821
# This environment variable determines our operation mode.
2810
4822
if test \"\$libtool_install_magic\" = \"$magic\"; then
2811
4823
  # install mode needs the following variable:
2812
 
  link_against_libtool_libs='$link_against_libtool_libs'
 
4824
  notinst_deplibs='$notinst_deplibs'
2813
4825
else
2814
4826
  # When we are sourced in execute mode, \$file and \$echo are already set.
2815
4827
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
2835
4847
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2836
4848
 
2837
4849
  # Follow symbolic links until we get to the real thisdir.
2838
 
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
4850
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2839
4851
  while test -n \"\$file\"; do
2840
4852
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2841
4853
 
2842
4854
    # If there was a directory component, then change thisdir.
2843
4855
    if test \"x\$destdir\" != \"x\$file\"; then
2844
4856
      case \"\$destdir\" in
2845
 
      [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
 
4857
      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2846
4858
      *) thisdir=\"\$thisdir/\$destdir\" ;;
2847
4859
      esac
2848
4860
    fi
2849
4861
 
2850
4862
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2851
 
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
4863
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2852
4864
  done
2853
4865
 
2854
4866
  # Try to get the absolute directory name.
2857
4869
"
2858
4870
 
2859
4871
        if test "$fast_install" = yes; then
2860
 
          echo >> $output "\
2861
 
  program=lt-'$outputname'
 
4872
          $echo >> $output "\
 
4873
  program=lt-'$outputname'$exeext
2862
4874
  progdir=\"\$thisdir/$objdir\"
2863
 
  
 
4875
 
2864
4876
  if test ! -f \"\$progdir/\$program\" || \\
2865
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
4877
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2866
4878
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2867
4879
 
2868
4880
    file=\"\$\$-\$program\"
2873
4885
      $rm \"\$progdir/\$file\"
2874
4886
    fi"
2875
4887
 
2876
 
          echo >> $output "\
 
4888
          $echo >> $output "\
2877
4889
 
2878
4890
    # relink executable if necessary
2879
4891
    if test -n \"\$relink_command\"; then
2880
 
      if (cd \"\$thisdir\" && eval \$relink_command); then :
 
4892
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2881
4893
      else
 
4894
        $echo \"\$relink_command_output\" >&2
2882
4895
        $rm \"\$progdir/\$file\"
2883
 
        exit 1
 
4896
        exit $EXIT_FAILURE
2884
4897
      fi
2885
4898
    fi
2886
4899
 
2890
4903
    $rm \"\$progdir/\$file\"
2891
4904
  fi"
2892
4905
        else
2893
 
          echo >> $output "\
 
4906
          $echo >> $output "\
2894
4907
  program='$outputname'
2895
4908
  progdir=\"\$thisdir/$objdir\"
2896
4909
"
2897
4910
        fi
2898
4911
 
2899
 
        echo >> $output "\
 
4912
        $echo >> $output "\
2900
4913
 
2901
4914
  if test -f \"\$progdir/\$program\"; then"
2902
4915
 
2927
4940
      # Run the actual program with our arguments.
2928
4941
"
2929
4942
        case $host in
2930
 
        *-*-cygwin* | *-*-mingw | *-*-os2*)
2931
 
          # win32 systems need to use the prog path for dll
2932
 
          # lookup to work
 
4943
        # Backslashes separate directories on plain windows
 
4944
        *-*-mingw | *-*-os2*)
2933
4945
          $echo >> $output "\
2934
4946
      exec \$progdir\\\\\$program \${1+\"\$@\"}
2935
4947
"
2936
4948
          ;;
 
4949
 
2937
4950
        *)
2938
4951
          $echo >> $output "\
2939
 
      # Export the path to the program.
2940
 
      PATH=\"\$progdir:\$PATH\"
2941
 
      export PATH
2942
 
 
2943
 
      exec \$program \${1+\"\$@\"}
 
4952
      exec \$progdir/\$program \${1+\"\$@\"}
2944
4953
"
2945
4954
          ;;
2946
4955
        esac
2947
4956
        $echo >> $output "\
2948
4957
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
2949
 
      exit 1
 
4958
      exit $EXIT_FAILURE
2950
4959
    fi
2951
4960
  else
2952
4961
    # The program doesn't exist.
2953
4962
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
2954
4963
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
2955
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
2956
 
    exit 1
 
4964
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
4965
    exit $EXIT_FAILURE
2957
4966
  fi
2958
4967
fi\
2959
4968
"
2960
4969
        chmod +x $output
2961
4970
      fi
2962
 
      exit 0
 
4971
      exit $EXIT_SUCCESS
2963
4972
      ;;
2964
4973
    esac
2965
4974
 
2975
4984
          oldobjs="$libobjs_save"
2976
4985
          build_libtool_libs=no
2977
4986
        else
2978
 
          oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
4987
          oldobjs="$old_deplibs $non_pic_objects"
2979
4988
        fi
2980
4989
        addlibs="$old_convenience"
2981
4990
      fi
2984
4993
        gentop="$output_objdir/${outputname}x"
2985
4994
        $show "${rm}r $gentop"
2986
4995
        $run ${rm}r "$gentop"
2987
 
        $show "mkdir $gentop"
2988
 
        $run mkdir "$gentop"
 
4996
        $show "$mkdir $gentop"
 
4997
        $run $mkdir "$gentop"
2989
4998
        status=$?
2990
 
        if test $status -ne 0 && test ! -d "$gentop"; then
 
4999
        if test "$status" -ne 0 && test ! -d "$gentop"; then
2991
5000
          exit $status
2992
5001
        fi
2993
5002
        generated="$generated $gentop"
2994
 
          
 
5003
 
2995
5004
        # Add in members from convenience archives.
2996
5005
        for xlib in $addlibs; do
2997
5006
          # Extract the objects.
2998
 
          case "$xlib" in
 
5007
          case $xlib in
2999
5008
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3000
5009
          *) xabs=`pwd`"/$xlib" ;;
3001
5010
          esac
3004
5013
 
3005
5014
          $show "${rm}r $xdir"
3006
5015
          $run ${rm}r "$xdir"
3007
 
          $show "mkdir $xdir"
3008
 
          $run mkdir "$xdir"
 
5016
          $show "$mkdir $xdir"
 
5017
          $run $mkdir "$xdir"
3009
5018
          status=$?
3010
 
          if test $status -ne 0 && test ! -d "$xdir"; then
 
5019
          if test "$status" -ne 0 && test ! -d "$xdir"; then
3011
5020
            exit $status
3012
5021
          fi
 
5022
          # We will extract separately just the conflicting names and we will no
 
5023
          # longer touch any unique names. It is faster to leave these extract
 
5024
          # automatically by $AR in one run.
3013
5025
          $show "(cd $xdir && $AR x $xabs)"
3014
5026
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
5027
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
5028
            :
 
5029
          else
 
5030
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
5031
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
5032
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
5033
            do
 
5034
              i=1
 
5035
              while test "$i" -le "$count"
 
5036
              do
 
5037
               # Put our $i before any first dot (extension)
 
5038
               # Never overwrite any file
 
5039
               name_to="$name"
 
5040
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
5041
               do
 
5042
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
5043
               done
 
5044
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
5045
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
5046
               i=`expr $i + 1`
 
5047
              done
 
5048
            done
 
5049
          fi
3015
5050
 
3016
5051
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3017
5052
        done
3019
5054
 
3020
5055
      # Do each command in the archive commands.
3021
5056
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3022
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5057
       cmds=$old_archive_from_new_cmds
3023
5058
      else
3024
 
        # Ensure that we have .o objects in place in case we decided
3025
 
        # not to build a shared library, and have fallen back to building
3026
 
        # static libs even though --disable-static was passed!
3027
 
        for oldobj in $oldobjs; do
3028
 
          if test ! -f $oldobj; then
3029
 
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3030
 
            if test "X$xdir" = "X$oldobj"; then
3031
 
              xdir="."
3032
 
            else
3033
 
              xdir="$xdir"
3034
 
            fi
3035
 
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3036
 
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3037
 
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3038
 
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3039
 
          fi
3040
 
        done
3041
 
 
3042
5059
        eval cmds=\"$old_archive_cmds\"
 
5060
 
 
5061
        if len=`expr "X$cmds" : ".*"` &&
 
5062
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5063
          cmds=$old_archive_cmds
 
5064
        else
 
5065
          # the command line is too long to link in one step, link in parts
 
5066
          $echo "using piecewise archive linking..."
 
5067
          save_RANLIB=$RANLIB
 
5068
          RANLIB=:
 
5069
          objlist=
 
5070
          concat_cmds=
 
5071
          save_oldobjs=$oldobjs
 
5072
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
 
5073
          # encoded into archives.  This makes 'ar r' malfunction in
 
5074
          # this piecewise linking case whenever conflicting object
 
5075
          # names appear in distinct ar calls; check, warn and compensate.
 
5076
            if (for obj in $save_oldobjs
 
5077
            do
 
5078
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5079
            done | sort | sort -uc >/dev/null 2>&1); then
 
5080
            :
 
5081
          else
 
5082
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
 
5083
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
 
5084
            AR_FLAGS=cq
 
5085
          fi
 
5086
          # Is there a better way of finding the last object in the list?
 
5087
          for obj in $save_oldobjs
 
5088
          do
 
5089
            last_oldobj=$obj
 
5090
          done
 
5091
          for obj in $save_oldobjs
 
5092
          do
 
5093
            oldobjs="$objlist $obj"
 
5094
            objlist="$objlist $obj"
 
5095
            eval test_cmds=\"$old_archive_cmds\"
 
5096
            if len=`expr "X$test_cmds" : ".*"` &&
 
5097
               test "$len" -le "$max_cmd_len"; then
 
5098
              :
 
5099
            else
 
5100
              # the above command should be used before it gets too long
 
5101
              oldobjs=$objlist
 
5102
              if test "$obj" = "$last_oldobj" ; then
 
5103
                RANLIB=$save_RANLIB
 
5104
              fi
 
5105
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5106
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5107
              objlist=
 
5108
            fi
 
5109
          done
 
5110
          RANLIB=$save_RANLIB
 
5111
          oldobjs=$objlist
 
5112
          if test "X$oldobjs" = "X" ; then
 
5113
            eval cmds=\"\$concat_cmds\"
 
5114
          else
 
5115
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5116
          fi
 
5117
        fi
3043
5118
      fi
3044
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
5119
      save_ifs="$IFS"; IFS='~'
3045
5120
      for cmd in $cmds; do
 
5121
        eval cmd=\"$cmd\"
3046
5122
        IFS="$save_ifs"
3047
5123
        $show "$cmd"
3048
5124
        $run eval "$cmd" || exit $?
3056
5132
    fi
3057
5133
 
3058
5134
    # Now create the libtool archive.
3059
 
    case "$output" in
 
5135
    case $output in
3060
5136
    *.la)
3061
5137
      old_library=
3062
5138
      test "$build_old_libs" = yes && old_library="$libname.$libext"
3063
5139
      $show "creating $output"
3064
5140
 
3065
 
      if test -n "$xrpath"; then
3066
 
        temp_xrpath=
3067
 
        for libdir in $xrpath; do
3068
 
          temp_xrpath="$temp_xrpath -R$libdir"
3069
 
        done
3070
 
        dependency_libs="$temp_xrpath $dependency_libs"
 
5141
      # Preserve any variables that may affect compiler behavior
 
5142
      for var in $variables_saved_for_relink; do
 
5143
        if eval test -z \"\${$var+set}\"; then
 
5144
          relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
 
5145
        elif eval var_value=\$$var; test -z "$var_value"; then
 
5146
          relink_command="$var=; export $var; $relink_command"
 
5147
        else
 
5148
          var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
 
5149
          relink_command="$var=\"$var_value\"; export $var; $relink_command"
 
5150
        fi
 
5151
      done
 
5152
      # Quote the link command for shipping.
 
5153
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
 
5154
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5155
      if test "$hardcode_automatic" = yes ; then
 
5156
        relink_command=
3071
5157
      fi
3072
5158
 
 
5159
 
3073
5160
      # Only create the output if not a dry run.
3074
5161
      if test -z "$run"; then
3075
5162
        for installed in no yes; do
3078
5165
              break
3079
5166
            fi
3080
5167
            output="$output_objdir/$outputname"i
 
5168
            # Replace all uninstalled libtool libraries with the installed ones
 
5169
            newdependency_libs=
 
5170
            for deplib in $dependency_libs; do
 
5171
              case $deplib in
 
5172
              *.la)
 
5173
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
 
5174
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
5175
                if test -z "$libdir"; then
 
5176
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
 
5177
                  exit $EXIT_FAILURE
 
5178
                fi
 
5179
                newdependency_libs="$newdependency_libs $libdir/$name"
 
5180
                ;;
 
5181
              *) newdependency_libs="$newdependency_libs $deplib" ;;
 
5182
              esac
 
5183
            done
 
5184
            dependency_libs="$newdependency_libs"
 
5185
            newdlfiles=
 
5186
            for lib in $dlfiles; do
 
5187
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
5188
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5189
              if test -z "$libdir"; then
 
5190
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
5191
                exit $EXIT_FAILURE
 
5192
              fi
 
5193
              newdlfiles="$newdlfiles $libdir/$name"
 
5194
            done
 
5195
            dlfiles="$newdlfiles"
 
5196
            newdlprefiles=
 
5197
            for lib in $dlprefiles; do
 
5198
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
5199
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5200
              if test -z "$libdir"; then
 
5201
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
5202
                exit $EXIT_FAILURE
 
5203
              fi
 
5204
              newdlprefiles="$newdlprefiles $libdir/$name"
 
5205
            done
 
5206
            dlprefiles="$newdlprefiles"
 
5207
          else
 
5208
            newdlfiles=
 
5209
            for lib in $dlfiles; do
 
5210
              case $lib in
 
5211
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5212
                *) abs=`pwd`"/$lib" ;;
 
5213
              esac
 
5214
              newdlfiles="$newdlfiles $abs"
 
5215
            done
 
5216
            dlfiles="$newdlfiles"
 
5217
            newdlprefiles=
 
5218
            for lib in $dlprefiles; do
 
5219
              case $lib in
 
5220
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5221
                *) abs=`pwd`"/$lib" ;;
 
5222
              esac
 
5223
              newdlprefiles="$newdlprefiles $abs"
 
5224
            done
 
5225
            dlprefiles="$newdlprefiles"
3081
5226
          fi
3082
5227
          $rm $output
 
5228
          # place dlname in correct position for cygwin
 
5229
          tdlname=$dlname
 
5230
          case $host,$output,$installed,$module,$dlname in
 
5231
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5232
          esac
3083
5233
          $echo > $output "\
3084
5234
# $outputname - a libtool library file
3085
5235
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3088
5238
# It is necessary for linking the library.
3089
5239
 
3090
5240
# The name that we can dlopen(3).
3091
 
dlname='$dlname'
 
5241
dlname='$tdlname'
3092
5242
 
3093
5243
# Names of this library.
3094
5244
library_names='$library_names'
3107
5257
# Is this an already installed library?
3108
5258
installed=$installed
3109
5259
 
 
5260
# Should we warn about portability when linking against -modules?
 
5261
shouldnotlink=$module
 
5262
 
 
5263
# Files to dlopen/dlpreopen
 
5264
dlopen='$dlfiles'
 
5265
dlpreopen='$dlprefiles'
 
5266
 
3110
5267
# Directory that this library needs to be installed in:
3111
 
libdir='$install_libdir'\
3112
 
"
 
5268
libdir='$install_libdir'"
 
5269
          if test "$installed" = no && test "$need_relink" = yes; then
 
5270
            $echo >> $output "\
 
5271
relink_command=\"$relink_command\""
 
5272
          fi
3113
5273
        done
3114
5274
      fi
3115
5275
 
3116
5276
      # Do a symbolic link so that the libtool archive can be found in
3117
5277
      # LD_LIBRARY_PATH before the program is installed.
3118
5278
      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3119
 
      $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
 
5279
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3120
5280
      ;;
3121
5281
    esac
3122
 
    exit 0
 
5282
    exit $EXIT_SUCCESS
3123
5283
    ;;
3124
5284
 
3125
5285
  # libtool install mode
3128
5288
 
3129
5289
    # There may be an optional sh(1) argument at the beginning of
3130
5290
    # install_prog (especially on Windows NT).
3131
 
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
 
5291
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
 
5292
       # Allow the use of GNU shtool's install command.
 
5293
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3132
5294
      # Aesthetically quote it.
3133
5295
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3134
 
      case "$arg" in
 
5296
      case $arg in
3135
5297
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3136
5298
        arg="\"$arg\""
3137
5299
        ;;
3147
5309
    # The real first argument should be the name of the installation program.
3148
5310
    # Aesthetically quote it.
3149
5311
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3150
 
    case "$arg" in
 
5312
    case $arg in
3151
5313
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
3152
5314
      arg="\"$arg\""
3153
5315
      ;;
3170
5332
        continue
3171
5333
      fi
3172
5334
 
3173
 
      case "$arg" in
 
5335
      case $arg in
3174
5336
      -d) isdir=yes ;;
3175
5337
      -f) prev="-f" ;;
3176
5338
      -g) prev="-g" ;;
3195
5357
 
3196
5358
      # Aesthetically quote the argument.
3197
5359
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3198
 
      case "$arg" in
 
5360
      case $arg in
3199
5361
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3200
5362
        arg="\"$arg\""
3201
5363
        ;;
3206
5368
    if test -z "$install_prog"; then
3207
5369
      $echo "$modename: you must specify an install program" 1>&2
3208
5370
      $echo "$help" 1>&2
3209
 
      exit 1
 
5371
      exit $EXIT_FAILURE
3210
5372
    fi
3211
5373
 
3212
5374
    if test -n "$prev"; then
3213
5375
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
3214
5376
      $echo "$help" 1>&2
3215
 
      exit 1
 
5377
      exit $EXIT_FAILURE
3216
5378
    fi
3217
5379
 
3218
5380
    if test -z "$files"; then
3222
5384
        $echo "$modename: you must specify a destination" 1>&2
3223
5385
      fi
3224
5386
      $echo "$help" 1>&2
3225
 
      exit 1
 
5387
      exit $EXIT_FAILURE
3226
5388
    fi
3227
5389
 
3228
5390
    # Strip any trailing slash from the destination.
3240
5402
 
3241
5403
      # Not a directory, so check to see that there is only one file specified.
3242
5404
      set dummy $files
3243
 
      if test $# -gt 2; then
 
5405
      if test "$#" -gt 2; then
3244
5406
        $echo "$modename: \`$dest' is not a directory" 1>&2
3245
5407
        $echo "$help" 1>&2
3246
 
        exit 1
 
5408
        exit $EXIT_FAILURE
3247
5409
      fi
3248
5410
    fi
3249
 
    case "$destdir" in
 
5411
    case $destdir in
3250
5412
    [\\/]* | [A-Za-z]:[\\/]*) ;;
3251
5413
    *)
3252
5414
      for file in $files; do
3253
 
        case "$file" in
 
5415
        case $file in
3254
5416
        *.lo) ;;
3255
5417
        *)
3256
5418
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3257
5419
          $echo "$help" 1>&2
3258
 
          exit 1
 
5420
          exit $EXIT_FAILURE
3259
5421
          ;;
3260
5422
        esac
3261
5423
      done
3272
5434
    for file in $files; do
3273
5435
 
3274
5436
      # Do each installation.
3275
 
      case "$file" in
3276
 
      *.a | *.lib)
 
5437
      case $file in
 
5438
      *.$libext)
3277
5439
        # Do the static libraries later.
3278
5440
        staticlibs="$staticlibs $file"
3279
5441
        ;;
3280
5442
 
3281
5443
      *.la)
3282
5444
        # Check to see that this really is a libtool archive.
3283
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5445
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3284
5446
        else
3285
5447
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3286
5448
          $echo "$help" 1>&2
3287
 
          exit 1
 
5449
          exit $EXIT_FAILURE
3288
5450
        fi
3289
5451
 
3290
5452
        library_names=
3291
5453
        old_library=
 
5454
        relink_command=
3292
5455
        # If there is no directory component, then add one.
3293
 
        case "$file" in
 
5456
        case $file in
3294
5457
        */* | *\\*) . $file ;;
3295
5458
        *) . ./$file ;;
3296
5459
        esac
3309
5472
          esac
3310
5473
        fi
3311
5474
 
3312
 
        dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
 
5475
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
3313
5476
        test "X$dir" = "X$file/" && dir=
3314
5477
        dir="$dir$objdir"
3315
5478
 
 
5479
        if test -n "$relink_command"; then
 
5480
          # Determine the prefix the user has applied to our future dir.
 
5481
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
 
5482
 
 
5483
          # Don't allow the user to place us outside of our expected
 
5484
          # location b/c this prevents finding dependent libraries that
 
5485
          # are installed to the same prefix.
 
5486
          # At present, this check doesn't affect windows .dll's that
 
5487
          # are installed into $libdir/../bin (currently, that works fine)
 
5488
          # but it's something to keep an eye on.
 
5489
          if test "$inst_prefix_dir" = "$destdir"; then
 
5490
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
 
5491
            exit $EXIT_FAILURE
 
5492
          fi
 
5493
 
 
5494
          if test -n "$inst_prefix_dir"; then
 
5495
            # Stick the inst_prefix_dir data into the link command.
 
5496
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5497
          else
 
5498
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
5499
          fi
 
5500
 
 
5501
          $echo "$modename: warning: relinking \`$file'" 1>&2
 
5502
          $show "$relink_command"
 
5503
          if $run eval "$relink_command"; then :
 
5504
          else
 
5505
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
 
5506
            exit $EXIT_FAILURE
 
5507
          fi
 
5508
        fi
 
5509
 
3316
5510
        # See the names of the shared library.
3317
5511
        set dummy $library_names
3318
5512
        if test -n "$2"; then
3320
5514
          shift
3321
5515
          shift
3322
5516
 
 
5517
          srcname="$realname"
 
5518
          test -n "$relink_command" && srcname="$realname"T
 
5519
 
3323
5520
          # Install the shared library and build the symlinks.
3324
 
          $show "$install_prog $dir/$realname $destdir/$realname"
3325
 
          $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
 
5521
          $show "$install_prog $dir/$srcname $destdir/$realname"
 
5522
          $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
 
5523
          if test -n "$stripme" && test -n "$striplib"; then
 
5524
            $show "$striplib $destdir/$realname"
 
5525
            $run eval "$striplib $destdir/$realname" || exit $?
 
5526
          fi
3326
5527
 
3327
 
          if test $# -gt 0; then
 
5528
          if test "$#" -gt 0; then
3328
5529
            # Delete the old symlinks, and create new ones.
3329
5530
            for linkname
3330
5531
            do
3337
5538
 
3338
5539
          # Do each command in the postinstall commands.
3339
5540
          lib="$destdir/$realname"
3340
 
          eval cmds=\"$postinstall_cmds\"
3341
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
5541
          cmds=$postinstall_cmds
 
5542
          save_ifs="$IFS"; IFS='~'
3342
5543
          for cmd in $cmds; do
3343
5544
            IFS="$save_ifs"
 
5545
            eval cmd=\"$cmd\"
3344
5546
            $show "$cmd"
3345
5547
            $run eval "$cmd" || exit $?
3346
5548
          done
3369
5571
        fi
3370
5572
 
3371
5573
        # Deduce the name of the destination old-style object file.
3372
 
        case "$destfile" in
 
5574
        case $destfile in
3373
5575
        *.lo)
3374
5576
          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3375
5577
          ;;
3376
 
        *.o | *.obj)
 
5578
        *.$objext)
3377
5579
          staticdest="$destfile"
3378
5580
          destfile=
3379
5581
          ;;
3380
5582
        *)
3381
5583
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3382
5584
          $echo "$help" 1>&2
3383
 
          exit 1
 
5585
          exit $EXIT_FAILURE
3384
5586
          ;;
3385
5587
        esac
3386
5588
 
3398
5600
          $show "$install_prog $staticobj $staticdest"
3399
5601
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3400
5602
        fi
3401
 
        exit 0
 
5603
        exit $EXIT_SUCCESS
3402
5604
        ;;
3403
5605
 
3404
5606
      *)
3410
5612
          destfile="$destdir/$destfile"
3411
5613
        fi
3412
5614
 
 
5615
        # If the file is missing, and there is a .exe on the end, strip it
 
5616
        # because it is most likely a libtool script we actually want to
 
5617
        # install
 
5618
        stripped_ext=""
 
5619
        case $file in
 
5620
          *.exe)
 
5621
            if test ! -f "$file"; then
 
5622
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5623
              stripped_ext=".exe"
 
5624
            fi
 
5625
            ;;
 
5626
        esac
 
5627
 
3413
5628
        # Do a test to see if this is really a libtool program.
3414
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3415
 
          link_against_libtool_libs=
 
5629
        case $host in
 
5630
        *cygwin*|*mingw*)
 
5631
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
 
5632
            ;;
 
5633
        *)
 
5634
            wrapper=$file
 
5635
            ;;
 
5636
        esac
 
5637
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
5638
          notinst_deplibs=
3416
5639
          relink_command=
3417
5640
 
 
5641
          # To insure that "foo" is sourced, and not "foo.exe",
 
5642
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5643
          # which disallows the automatic-append-.exe behavior.
 
5644
          case $build in
 
5645
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5646
          *) wrapperdot=${wrapper} ;;
 
5647
          esac
3418
5648
          # If there is no directory component, then add one.
3419
 
          case "$file" in
3420
 
          */* | *\\*) . $file ;;
3421
 
          *) . ./$file ;;
 
5649
          case $file in
 
5650
          */* | *\\*) . ${wrapperdot} ;;
 
5651
          *) . ./${wrapperdot} ;;
3422
5652
          esac
3423
5653
 
3424
5654
          # Check the variables that should have been set.
3425
 
          if test -z "$link_against_libtool_libs"; then
3426
 
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3427
 
            exit 1
 
5655
          if test -z "$notinst_deplibs"; then
 
5656
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
 
5657
            exit $EXIT_FAILURE
3428
5658
          fi
3429
5659
 
3430
5660
          finalize=yes
3431
 
          for lib in $link_against_libtool_libs; do
 
5661
          for lib in $notinst_deplibs; do
3432
5662
            # Check to see that each library is installed.
3433
5663
            libdir=
3434
5664
            if test -f "$lib"; then
3435
5665
              # If there is no directory component, then add one.
3436
 
              case "$lib" in
 
5666
              case $lib in
3437
5667
              */* | *\\*) . $lib ;;
3438
5668
              *) . ./$lib ;;
3439
5669
              esac
3440
5670
            fi
3441
 
            libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
 
5671
            libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
3442
5672
            if test -n "$libdir" && test ! -f "$libfile"; then
3443
5673
              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3444
5674
              finalize=no
3445
5675
            fi
3446
5676
          done
3447
5677
 
 
5678
          relink_command=
 
5679
          # To insure that "foo" is sourced, and not "foo.exe",
 
5680
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5681
          # which disallows the automatic-append-.exe behavior.
 
5682
          case $build in
 
5683
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5684
          *) wrapperdot=${wrapper} ;;
 
5685
          esac
 
5686
          # If there is no directory component, then add one.
 
5687
          case $file in
 
5688
          */* | *\\*) . ${wrapperdot} ;;
 
5689
          *) . ./${wrapperdot} ;;
 
5690
          esac
 
5691
 
3448
5692
          outputname=
3449
5693
          if test "$fast_install" = no && test -n "$relink_command"; then
3450
5694
            if test "$finalize" = yes && test -z "$run"; then
3451
5695
              tmpdir="/tmp"
3452
5696
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
3453
5697
              tmpdir="$tmpdir/libtool-$$"
3454
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5698
              save_umask=`umask`
 
5699
              umask 0077
 
5700
              if $mkdir "$tmpdir"; then
 
5701
                umask $save_umask
3455
5702
              else
 
5703
                umask $save_umask
3456
5704
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3457
5705
                continue
3458
5706
              fi
 
5707
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
3459
5708
              outputname="$tmpdir/$file"
3460
5709
              # Replace the output file specification.
3461
5710
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3473
5722
            fi
3474
5723
          else
3475
5724
            # Install the binary that we compiled earlier.
3476
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5725
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3477
5726
          fi
3478
5727
        fi
3479
5728
 
 
5729
        # remove .exe since cygwin /usr/bin/install will append another
 
5730
        # one anyways
 
5731
        case $install_prog,$host in
 
5732
        */usr/bin/install*,*cygwin*)
 
5733
          case $file:$destfile in
 
5734
          *.exe:*.exe)
 
5735
            # this is ok
 
5736
            ;;
 
5737
          *.exe:*)
 
5738
            destfile=$destfile.exe
 
5739
            ;;
 
5740
          *:*.exe)
 
5741
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
 
5742
            ;;
 
5743
          esac
 
5744
          ;;
 
5745
        esac
3480
5746
        $show "$install_prog$stripme $file $destfile"
3481
5747
        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3482
5748
        test -n "$outputname" && ${rm}r "$tmpdir"
3493
5759
      $show "$install_prog $file $oldlib"
3494
5760
      $run eval "$install_prog \$file \$oldlib" || exit $?
3495
5761
 
 
5762
      if test -n "$stripme" && test -n "$old_striplib"; then
 
5763
        $show "$old_striplib $oldlib"
 
5764
        $run eval "$old_striplib $oldlib" || exit $?
 
5765
      fi
 
5766
 
3496
5767
      # Do each command in the postinstall commands.
3497
 
      eval cmds=\"$old_postinstall_cmds\"
3498
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
5768
      cmds=$old_postinstall_cmds
 
5769
      save_ifs="$IFS"; IFS='~'
3499
5770
      for cmd in $cmds; do
3500
5771
        IFS="$save_ifs"
 
5772
        eval cmd=\"$cmd\"
3501
5773
        $show "$cmd"
3502
5774
        $run eval "$cmd" || exit $?
3503
5775
      done
3511
5783
    if test -n "$current_libdirs"; then
3512
5784
      # Maybe just do a dry run.
3513
5785
      test -n "$run" && current_libdirs=" -n$current_libdirs"
3514
 
      exec $SHELL $0 --finish$current_libdirs
3515
 
      exit 1
 
5786
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
 
5787
    else
 
5788
      exit $EXIT_SUCCESS
3516
5789
    fi
3517
 
 
3518
 
    exit 0
3519
5790
    ;;
3520
5791
 
3521
5792
  # libtool finish mode
3533
5804
      for libdir in $libdirs; do
3534
5805
        if test -n "$finish_cmds"; then
3535
5806
          # Do each command in the finish commands.
3536
 
          eval cmds=\"$finish_cmds\"
3537
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
5807
          cmds=$finish_cmds
 
5808
          save_ifs="$IFS"; IFS='~'
3538
5809
          for cmd in $cmds; do
3539
5810
            IFS="$save_ifs"
 
5811
            eval cmd=\"$cmd\"
3540
5812
            $show "$cmd"
3541
5813
            $run eval "$cmd" || admincmds="$admincmds
3542
5814
       $cmd"
3553
5825
    fi
3554
5826
 
3555
5827
    # Exit here if they wanted silent mode.
3556
 
    test "$show" = : && exit 0
 
5828
    test "$show" = : && exit $EXIT_SUCCESS
3557
5829
 
3558
 
    echo "----------------------------------------------------------------------"
3559
 
    echo "Libraries have been installed in:"
 
5830
    $echo "----------------------------------------------------------------------"
 
5831
    $echo "Libraries have been installed in:"
3560
5832
    for libdir in $libdirs; do
3561
 
      echo "   $libdir"
 
5833
      $echo "   $libdir"
3562
5834
    done
3563
 
    echo
3564
 
    echo "If you ever happen to want to link against installed libraries"
3565
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
3566
 
    echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3567
 
    echo "flag during linking and do at least one of the following:"
 
5835
    $echo
 
5836
    $echo "If you ever happen to want to link against installed libraries"
 
5837
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5838
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5839
    $echo "flag during linking and do at least one of the following:"
3568
5840
    if test -n "$shlibpath_var"; then
3569
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
3570
 
      echo "     during execution"
 
5841
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5842
      $echo "     during execution"
3571
5843
    fi
3572
5844
    if test -n "$runpath_var"; then
3573
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
3574
 
      echo "     during linking"
 
5845
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5846
      $echo "     during linking"
3575
5847
    fi
3576
5848
    if test -n "$hardcode_libdir_flag_spec"; then
3577
5849
      libdir=LIBDIR
3578
5850
      eval flag=\"$hardcode_libdir_flag_spec\"
3579
5851
 
3580
 
      echo "   - use the \`$flag' linker flag"
 
5852
      $echo "   - use the \`$flag' linker flag"
3581
5853
    fi
3582
5854
    if test -n "$admincmds"; then
3583
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5855
      $echo "   - have your system administrator run these commands:$admincmds"
3584
5856
    fi
3585
5857
    if test -f /etc/ld.so.conf; then
3586
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5858
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3587
5859
    fi
3588
 
    echo
3589
 
    echo "See any operating system documentation about shared libraries for"
3590
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
3591
 
    echo "----------------------------------------------------------------------"
3592
 
    exit 0
 
5860
    $echo
 
5861
    $echo "See any operating system documentation about shared libraries for"
 
5862
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5863
    $echo "----------------------------------------------------------------------"
 
5864
    exit $EXIT_SUCCESS
3593
5865
    ;;
3594
5866
 
3595
5867
  # libtool execute mode
3601
5873
    if test -z "$cmd"; then
3602
5874
      $echo "$modename: you must specify a COMMAND" 1>&2
3603
5875
      $echo "$help"
3604
 
      exit 1
 
5876
      exit $EXIT_FAILURE
3605
5877
    fi
3606
5878
 
3607
5879
    # Handle -dlopen flags immediately.
3609
5881
      if test ! -f "$file"; then
3610
5882
        $echo "$modename: \`$file' is not a file" 1>&2
3611
5883
        $echo "$help" 1>&2
3612
 
        exit 1
 
5884
        exit $EXIT_FAILURE
3613
5885
      fi
3614
5886
 
3615
5887
      dir=
3616
 
      case "$file" in
 
5888
      case $file in
3617
5889
      *.la)
3618
5890
        # Check to see that this really is a libtool archive.
3619
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5891
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3620
5892
        else
3621
5893
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3622
5894
          $echo "$help" 1>&2
3623
 
          exit 1
 
5895
          exit $EXIT_FAILURE
3624
5896
        fi
3625
5897
 
3626
5898
        # Read the libtool library.
3628
5900
        library_names=
3629
5901
 
3630
5902
        # If there is no directory component, then add one.
3631
 
        case "$file" in
 
5903
        case $file in
3632
5904
        */* | *\\*) . $file ;;
3633
5905
        *) . ./$file ;;
3634
5906
        esac
3647
5919
          dir="$dir/$objdir"
3648
5920
        else
3649
5921
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3650
 
          exit 1
 
5922
          exit $EXIT_FAILURE
3651
5923
        fi
3652
5924
        ;;
3653
5925
 
3683
5955
    args=
3684
5956
    for file
3685
5957
    do
3686
 
      case "$file" in
 
5958
      case $file in
3687
5959
      -*) ;;
3688
5960
      *)
3689
5961
        # Do a test to see if this is really a libtool program.
3690
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5962
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3691
5963
          # If there is no directory component, then add one.
3692
 
          case "$file" in
 
5964
          case $file in
3693
5965
          */* | *\\*) . $file ;;
3694
5966
          *) . ./$file ;;
3695
5967
          esac
3706
5978
 
3707
5979
    if test -z "$run"; then
3708
5980
      if test -n "$shlibpath_var"; then
3709
 
        # Export the shlibpath_var.
3710
 
        eval "export $shlibpath_var"
 
5981
        # Export the shlibpath_var.
 
5982
        eval "export $shlibpath_var"
3711
5983
      fi
3712
5984
 
3713
 
      # Restore saved enviroment variables
 
5985
      # Restore saved environment variables
3714
5986
      if test "${save_LC_ALL+set}" = set; then
3715
5987
        LC_ALL="$save_LC_ALL"; export LC_ALL
3716
5988
      fi
3718
5990
        LANG="$save_LANG"; export LANG
3719
5991
      fi
3720
5992
 
3721
 
      # Now actually exec the command.
3722
 
      eval "exec \$cmd$args"
3723
 
 
3724
 
      $echo "$modename: cannot exec \$cmd$args"
3725
 
      exit 1
 
5993
      # Now prepare to actually exec the command.
 
5994
      exec_cmd="\$cmd$args"
3726
5995
    else
3727
5996
      # Display what would be done.
3728
5997
      if test -n "$shlibpath_var"; then
3729
 
        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3730
 
        $echo "export $shlibpath_var"
 
5998
        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
 
5999
        $echo "export $shlibpath_var"
3731
6000
      fi
3732
6001
      $echo "$cmd$args"
3733
 
      exit 0
 
6002
      exit $EXIT_SUCCESS
3734
6003
    fi
3735
6004
    ;;
3736
6005
 
3737
 
  # libtool uninstall mode
3738
 
  uninstall)
3739
 
    modename="$modename: uninstall"
 
6006
  # libtool clean and uninstall mode
 
6007
  clean | uninstall)
 
6008
    modename="$modename: $mode"
3740
6009
    rm="$nonopt"
3741
6010
    files=
 
6011
    rmforce=
 
6012
    exit_status=0
 
6013
 
 
6014
    # This variable tells wrapper scripts just to set variables rather
 
6015
    # than running their programs.
 
6016
    libtool_install_magic="$magic"
3742
6017
 
3743
6018
    for arg
3744
6019
    do
3745
 
      case "$arg" in
 
6020
      case $arg in
 
6021
      -f) rm="$rm $arg"; rmforce=yes ;;
3746
6022
      -*) rm="$rm $arg" ;;
3747
6023
      *) files="$files $arg" ;;
3748
6024
      esac
3751
6027
    if test -z "$rm"; then
3752
6028
      $echo "$modename: you must specify an RM program" 1>&2
3753
6029
      $echo "$help" 1>&2
3754
 
      exit 1
 
6030
      exit $EXIT_FAILURE
3755
6031
    fi
3756
6032
 
 
6033
    rmdirs=
 
6034
 
 
6035
    origobjdir="$objdir"
3757
6036
    for file in $files; do
3758
6037
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3759
 
      test "X$dir" = "X$file" && dir=.
 
6038
      if test "X$dir" = "X$file"; then
 
6039
        dir=.
 
6040
        objdir="$origobjdir"
 
6041
      else
 
6042
        objdir="$dir/$origobjdir"
 
6043
      fi
3760
6044
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
6045
      test "$mode" = uninstall && objdir="$dir"
 
6046
 
 
6047
      # Remember objdir for removal later, being careful to avoid duplicates
 
6048
      if test "$mode" = clean; then
 
6049
        case " $rmdirs " in
 
6050
          *" $objdir "*) ;;
 
6051
          *) rmdirs="$rmdirs $objdir" ;;
 
6052
        esac
 
6053
      fi
 
6054
 
 
6055
      # Don't error if the file doesn't exist and rm -f was used.
 
6056
      if (test -L "$file") >/dev/null 2>&1 \
 
6057
        || (test -h "$file") >/dev/null 2>&1 \
 
6058
        || test -f "$file"; then
 
6059
        :
 
6060
      elif test -d "$file"; then
 
6061
        exit_status=1
 
6062
        continue
 
6063
      elif test "$rmforce" = yes; then
 
6064
        continue
 
6065
      fi
3761
6066
 
3762
6067
      rmfiles="$file"
3763
6068
 
3764
 
      case "$name" in
 
6069
      case $name in
3765
6070
      *.la)
3766
6071
        # Possibly a libtool archive, so verify it.
3767
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6072
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3768
6073
          . $dir/$name
3769
6074
 
3770
6075
          # Delete the libtool libraries and symlinks.
3771
6076
          for n in $library_names; do
3772
 
            rmfiles="$rmfiles $dir/$n"
 
6077
            rmfiles="$rmfiles $objdir/$n"
3773
6078
          done
3774
 
          test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3775
 
 
3776
 
          $show "$rm $rmfiles"
3777
 
          $run $rm $rmfiles
3778
 
 
3779
 
          if test -n "$library_names"; then
3780
 
            # Do each command in the postuninstall commands.
3781
 
            eval cmds=\"$postuninstall_cmds\"
3782
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3783
 
            for cmd in $cmds; do
3784
 
              IFS="$save_ifs"
3785
 
              $show "$cmd"
3786
 
              $run eval "$cmd"
3787
 
            done
3788
 
            IFS="$save_ifs"
3789
 
          fi
3790
 
 
3791
 
          if test -n "$old_library"; then
3792
 
            # Do each command in the old_postuninstall commands.
3793
 
            eval cmds=\"$old_postuninstall_cmds\"
3794
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3795
 
            for cmd in $cmds; do
3796
 
              IFS="$save_ifs"
3797
 
              $show "$cmd"
3798
 
              $run eval "$cmd"
3799
 
            done
3800
 
            IFS="$save_ifs"
3801
 
          fi
3802
 
 
3803
 
          # FIXME: should reinstall the best remaining shared library.
 
6079
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
 
6080
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6081
 
 
6082
          if test "$mode" = uninstall; then
 
6083
            if test -n "$library_names"; then
 
6084
              # Do each command in the postuninstall commands.
 
6085
              cmds=$postuninstall_cmds
 
6086
              save_ifs="$IFS"; IFS='~'
 
6087
              for cmd in $cmds; do
 
6088
                IFS="$save_ifs"
 
6089
                eval cmd=\"$cmd\"
 
6090
                $show "$cmd"
 
6091
                $run eval "$cmd"
 
6092
                if test "$?" -ne 0 && test "$rmforce" != yes; then
 
6093
                  exit_status=1
 
6094
                fi
 
6095
              done
 
6096
              IFS="$save_ifs"
 
6097
            fi
 
6098
 
 
6099
            if test -n "$old_library"; then
 
6100
              # Do each command in the old_postuninstall commands.
 
6101
              cmds=$old_postuninstall_cmds
 
6102
              save_ifs="$IFS"; IFS='~'
 
6103
              for cmd in $cmds; do
 
6104
                IFS="$save_ifs"
 
6105
                eval cmd=\"$cmd\"
 
6106
                $show "$cmd"
 
6107
                $run eval "$cmd"
 
6108
                if test "$?" -ne 0 && test "$rmforce" != yes; then
 
6109
                  exit_status=1
 
6110
                fi
 
6111
              done
 
6112
              IFS="$save_ifs"
 
6113
            fi
 
6114
            # FIXME: should reinstall the best remaining shared library.
 
6115
          fi
3804
6116
        fi
3805
6117
        ;;
3806
6118
 
3807
6119
      *.lo)
3808
 
        if test "$build_old_libs" = yes; then
3809
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3810
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6120
        # Possibly a libtool object, so verify it.
 
6121
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6122
 
 
6123
          # Read the .lo file
 
6124
          . $dir/$name
 
6125
 
 
6126
          # Add PIC object to the list of files to remove.
 
6127
          if test -n "$pic_object" \
 
6128
             && test "$pic_object" != none; then
 
6129
            rmfiles="$rmfiles $dir/$pic_object"
 
6130
          fi
 
6131
 
 
6132
          # Add non-PIC object to the list of files to remove.
 
6133
          if test -n "$non_pic_object" \
 
6134
             && test "$non_pic_object" != none; then
 
6135
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6136
          fi
3811
6137
        fi
3812
 
        $show "$rm $rmfiles"
3813
 
        $run $rm $rmfiles
3814
6138
        ;;
3815
6139
 
3816
6140
      *)
3817
 
        $show "$rm $rmfiles"
3818
 
        $run $rm $rmfiles
 
6141
        if test "$mode" = clean ; then
 
6142
          noexename=$name
 
6143
          case $file in
 
6144
          *.exe)
 
6145
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6146
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6147
            # $file with .exe has already been added to rmfiles,
 
6148
            # add $file without .exe
 
6149
            rmfiles="$rmfiles $file"
 
6150
            ;;
 
6151
          esac
 
6152
          # Do a test to see if this is a libtool program.
 
6153
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6154
            relink_command=
 
6155
            . $dir/$noexename
 
6156
 
 
6157
            # note $name still contains .exe if it was in $file originally
 
6158
            # as does the version of $file that was added into $rmfiles
 
6159
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6160
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6161
              rmfiles="$rmfiles $objdir/lt-$name"
 
6162
            fi
 
6163
            if test "X$noexename" != "X$name" ; then
 
6164
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6165
            fi
 
6166
          fi
 
6167
        fi
3819
6168
        ;;
3820
6169
      esac
3821
 
    done
3822
 
    exit 0
 
6170
      $show "$rm $rmfiles"
 
6171
      $run $rm $rmfiles || exit_status=1
 
6172
    done
 
6173
    objdir="$origobjdir"
 
6174
 
 
6175
    # Try to remove the ${objdir}s in the directories where we deleted files
 
6176
    for dir in $rmdirs; do
 
6177
      if test -d "$dir"; then
 
6178
        $show "rmdir $dir"
 
6179
        $run rmdir $dir >/dev/null 2>&1
 
6180
      fi
 
6181
    done
 
6182
 
 
6183
    exit $exit_status
3823
6184
    ;;
3824
6185
 
3825
6186
  "")
3826
6187
    $echo "$modename: you must specify a MODE" 1>&2
3827
6188
    $echo "$generic_help" 1>&2
3828
 
    exit 1
 
6189
    exit $EXIT_FAILURE
3829
6190
    ;;
3830
6191
  esac
3831
6192
 
3832
 
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
3833
 
  $echo "$generic_help" 1>&2
3834
 
  exit 1
 
6193
  if test -z "$exec_cmd"; then
 
6194
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
 
6195
    $echo "$generic_help" 1>&2
 
6196
    exit $EXIT_FAILURE
 
6197
  fi
3835
6198
fi # test -z "$show_help"
3836
6199
 
 
6200
if test -n "$exec_cmd"; then
 
6201
  eval exec $exec_cmd
 
6202
  exit $EXIT_FAILURE
 
6203
fi
 
6204
 
3837
6205
# We need to display help for each of the modes.
3838
 
case "$mode" in
 
6206
case $mode in
3839
6207
"") $echo \
3840
6208
"Usage: $modename [OPTION]... [MODE-ARG]...
3841
6209
 
3850
6218
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
3851
6219
    --quiet           same as \`--silent'
3852
6220
    --silent          don't print informational messages
 
6221
    --tag=TAG         use configuration variables from tag TAG
3853
6222
    --version         print version information
3854
6223
 
3855
6224
MODE must be one of the following:
3856
6225
 
 
6226
      clean           remove files from the build directory
3857
6227
      compile         compile a source file into a libtool object
3858
6228
      execute         automatically set library path, then run a program
3859
6229
      finish          complete the installation of libtool libraries
3862
6232
      uninstall       remove libraries from an installed directory
3863
6233
 
3864
6234
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
3865
 
a more detailed description of MODE."
3866
 
  exit 0
 
6235
a more detailed description of MODE.
 
6236
 
 
6237
Report bugs to <bug-libtool@gnu.org>."
 
6238
  exit $EXIT_SUCCESS
 
6239
  ;;
 
6240
 
 
6241
clean)
 
6242
  $echo \
 
6243
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
 
6244
 
 
6245
Remove files from the build directory.
 
6246
 
 
6247
RM is the name of the program to use to delete files associated with each FILE
 
6248
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
 
6249
to RM.
 
6250
 
 
6251
If FILE is a libtool library, object or program, all the files associated
 
6252
with it are deleted. Otherwise, only FILE itself is deleted using RM."
3867
6253
  ;;
3868
6254
 
3869
6255
compile)
3875
6261
This mode accepts the following additional options:
3876
6262
 
3877
6263
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
 
6264
  -prefer-pic       try to building PIC objects only
 
6265
  -prefer-non-pic   try to building non-PIC objects only
3878
6266
  -static           always build a \`.o' file suitable for static linking
3879
6267
 
3880
6268
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3954
6342
  -LLIBDIR          search LIBDIR for required installed libraries
3955
6343
  -lNAME            OUTPUT-FILE requires the installed library libNAME
3956
6344
  -module           build a library that can dlopened
 
6345
  -no-fast-install  disable the fast-install mode
 
6346
  -no-install       link a not-installable executable
3957
6347
  -no-undefined     declare that a library does not refer to external symbols
3958
6348
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6349
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6350
  -precious-files-regex REGEX
 
6351
                    don't remove output files matching REGEX
3959
6352
  -release RELEASE  specify package release information
3960
6353
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
3961
6354
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
3997
6390
*)
3998
6391
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
3999
6392
  $echo "$help" 1>&2
4000
 
  exit 1
 
6393
  exit $EXIT_FAILURE
4001
6394
  ;;
4002
6395
esac
4003
6396
 
4004
 
echo
 
6397
$echo
4005
6398
$echo "Try \`$modename --help' for more information about other modes."
4006
6399
 
4007
 
exit 0
 
6400
exit $EXIT_SUCCESS
 
6401
 
 
6402
# The TAGs below are defined such that we never get into a situation
 
6403
# in which we disable both kinds of libraries.  Given conflicting
 
6404
# choices, we go for a static library, that is the most portable,
 
6405
# since we can't tell whether shared libraries were disabled because
 
6406
# the user asked for that or because the platform doesn't support
 
6407
# them.  This is particularly important on AIX, because we don't
 
6408
# support having both static and shared libraries enabled at the same
 
6409
# time on that platform, so we default to a shared-only configuration.
 
6410
# If a disable-shared tag is given, we'll fallback to a static-only
 
6411
# configuration.  But we'll never go from static-only to shared-only.
 
6412
 
 
6413
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6414
build_libtool_libs=no
 
6415
build_old_libs=yes
 
6416
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6417
 
 
6418
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6419
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6420
# ### END LIBTOOL TAG CONFIG: disable-static
4008
6421
 
4009
6422
# Local Variables:
4010
6423
# mode:shell-script