~ubuntu-branches/ubuntu/quantal/libbonobo/quantal-201207170711

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-02-18 14:40:51 UTC
  • mto: (3.1.1 etch) (1.1.25 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050218144051-fo4h9qh2gim8x3wt
Tags: upstream-2.8.1
ImportĀ upstreamĀ versionĀ 2.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ltmain.sh - Provide generalized library-building support services.
2
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
3
#
4
 
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
5
5
# Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
24
24
# configuration script generated by Autoconf, you may include it under
25
25
# the same distribution terms that you use for the rest of that program.
26
26
 
 
27
basename="s,^.*/,,g"
 
28
 
 
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
 
30
# is ksh but when the shell is invoked as "sh" and the current value of
 
31
# the _XPG environment variable is not equal to 1 (one), the special
 
32
# positional parameter $0, within a function call, is the name of the
 
33
# function.
 
34
progpath="$0"
 
35
 
 
36
# The name of this program:
 
37
progname=`echo "$progpath" | $SED $basename`
 
38
modename="$progname"
 
39
 
 
40
# Global variables:
 
41
EXIT_SUCCESS=0
 
42
EXIT_FAILURE=1
 
43
 
 
44
PROGRAM=ltmain.sh
 
45
PACKAGE=libtool
 
46
VERSION=1.5.10
 
47
TIMESTAMP=" (1.1220.2.131 2004/09/19 12:46:56)"
 
48
 
 
49
# See if we are running on zsh, and set the options which allow our
 
50
# commands through without removal of \ escapes.
 
51
if test -n "${ZSH_VERSION+set}" ; then
 
52
  setopt NO_GLOB_SUBST
 
53
fi
 
54
 
27
55
# Check that we have a working $echo.
28
56
if test "X$1" = X--no-reexec; then
29
57
  # Discard the --no-reexec flag, and continue.
36
64
  :
37
65
else
38
66
  # Restart under the correct shell, and then maybe $echo will work.
39
 
  exec $SHELL "$0" --no-reexec ${1+"$@"}
 
67
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
40
68
fi
41
69
 
42
70
if test "X$1" = X--fallback-echo; then
45
73
  cat <<EOF
46
74
$*
47
75
EOF
48
 
  exit 0
 
76
  exit $EXIT_SUCCESS
49
77
fi
50
78
 
51
 
# The name of this program.
52
 
progname=`$echo "$0" | sed 's%^.*/%%'`
53
 
modename="$progname"
54
 
 
55
 
# Constants.
56
 
PROGRAM=ltmain.sh
57
 
PACKAGE=libtool
58
 
VERSION=1.4
59
 
TIMESTAMP=" (1.922 2001/04/25 00:05:37)"
60
 
 
61
79
default_mode=
62
80
help="Try \`$progname --help' for more information."
63
81
magic="%%%MAGIC variable%%%"
67
85
 
68
86
# Sed substitution that helps us do robust quoting.  It backslashifies
69
87
# metacharacters that are still active within double-quoted strings.
70
 
Xsed='sed -e 1s/^X//'
 
88
Xsed="${SED}"' -e 1s/^X//'
71
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
SP2NL='tr \040 \012'
73
 
NL2SP='tr \015\012 \040\040'
 
90
# test EBCDIC or ASCII
 
91
case `echo A|tr A '\301'` in
 
92
 A) # EBCDIC based system
 
93
  SP2NL="tr '\100' '\n'"
 
94
  NL2SP="tr '\r\n' '\100\100'"
 
95
  ;;
 
96
 *) # Assume ASCII based system
 
97
  SP2NL="tr '\040' '\012'"
 
98
  NL2SP="tr '\015\012' '\040\040'"
 
99
  ;;
 
100
esac
74
101
 
75
102
# NLS nuisances.
76
103
# Only set LANG and LC_ALL to C if already set.
84
111
  save_LANG="$LANG"; LANG=C; export LANG
85
112
fi
86
113
 
 
114
# Make sure IFS has a sensible default
 
115
: ${IFS="       
 
116
"}
 
117
 
87
118
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
88
 
  echo "$modename: not configured to build any kind of library" 1>&2
89
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
90
 
  exit 1
 
119
  $echo "$modename: not configured to build any kind of library" 1>&2
 
120
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
121
  exit $EXIT_FAILURE
91
122
fi
92
123
 
93
124
# Global variables.
102
133
lo2o="s/\\.lo\$/.${objext}/"
103
134
o2lo="s/\\.${objext}\$/.lo/"
104
135
 
 
136
#####################################
 
137
# Shell function definitions:
 
138
# This seems to be the best place for them
 
139
 
 
140
# func_win32_libid arg
 
141
# return the library type of file 'arg'
 
142
#
 
143
# Need a lot of goo to handle *both* DLLs and import libs
 
144
# Has to be a shell function in order to 'eat' the argument
 
145
# that is supplied when $file_magic_command is called.
 
146
func_win32_libid () {
 
147
  win32_libid_type="unknown"
 
148
  win32_fileres=`file -L $1 2>/dev/null`
 
149
  case $win32_fileres in
 
150
  *ar\ archive\ import\ library*) # definitely import
 
151
    win32_libid_type="x86 archive import"
 
152
    ;;
 
153
  *ar\ archive*) # could be an import, or static
 
154
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
 
155
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
156
      win32_nmres=`eval $NM -f posix -A $1 | \
 
157
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
 
158
      if test "X$win32_nmres" = "Ximport" ; then
 
159
        win32_libid_type="x86 archive import"
 
160
      else
 
161
        win32_libid_type="x86 archive static"
 
162
      fi
 
163
    fi
 
164
    ;;
 
165
  *DLL*)
 
166
    win32_libid_type="x86 DLL"
 
167
    ;;
 
168
  *executable*) # but shell scripts are "executable" too...
 
169
    case $win32_fileres in
 
170
    *MS\ Windows\ PE\ Intel*)
 
171
      win32_libid_type="x86 DLL"
 
172
      ;;
 
173
    esac
 
174
    ;;
 
175
  esac
 
176
  $echo $win32_libid_type
 
177
}
 
178
 
 
179
 
 
180
# func_infer_tag arg
 
181
# Infer tagged configuration to use if any are available and
 
182
# if one wasn't chosen via the "--tag" command line option.
 
183
# Only attempt this if the compiler in the base compile
 
184
# command doesn't match the default compiler.
 
185
# arg is usually of the form 'gcc ...'
 
186
func_infer_tag () {
 
187
    if test -n "$available_tags" && test -z "$tagname"; then
 
188
      CC_quoted=
 
189
      for arg in $CC; do
 
190
        case $arg in
 
191
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
192
          arg="\"$arg\""
 
193
          ;;
 
194
        esac
 
195
        CC_quoted="$CC_quoted $arg"
 
196
      done
 
197
      case $@ in
 
198
      # Blanks in the command may have been stripped by the calling shell,
 
199
      # but not from the CC environment variable when configure was run.
 
200
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
201
      # Blanks at the start of $base_compile will cause this to fail
 
202
      # if we don't check for them as well.
 
203
      *)
 
204
        for z in $available_tags; do
 
205
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
206
            # Evaluate the configuration.
 
207
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
208
            CC_quoted=
 
209
            for arg in $CC; do
 
210
            # Double-quote args containing other shell metacharacters.
 
211
            case $arg in
 
212
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
213
              arg="\"$arg\""
 
214
              ;;
 
215
            esac
 
216
            CC_quoted="$CC_quoted $arg"
 
217
          done
 
218
            case "$@ " in
 
219
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
220
              # The compiler in the base compile command matches
 
221
              # the one in the tagged configuration.
 
222
              # Assume this is the tagged configuration we want.
 
223
              tagname=$z
 
224
              break
 
225
              ;;
 
226
            esac
 
227
          fi
 
228
        done
 
229
        # If $tagname still isn't set, then no tagged configuration
 
230
        # was found and let the user know that the "--tag" command
 
231
        # line option must be used.
 
232
        if test -z "$tagname"; then
 
233
          $echo "$modename: unable to infer tagged configuration"
 
234
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
235
          exit $EXIT_FAILURE
 
236
#        else
 
237
#          $echo "$modename: using $tagname tagged configuration"
 
238
        fi
 
239
        ;;
 
240
      esac
 
241
    fi
 
242
}
 
243
 
 
244
 
 
245
# func_extract_archives gentop oldlib ...
 
246
func_extract_archives () {
 
247
    my_gentop="$1"; shift
 
248
    my_oldlibs=${1+"$@"}
 
249
    my_oldobjs=""
 
250
    my_xlib=""
 
251
    my_xabs=""
 
252
    my_xdir=""
 
253
    my_status=""
 
254
 
 
255
    $show "${rm}r $my_gentop"
 
256
    $run ${rm}r "$my_gentop"
 
257
    $show "$mkdir $my_gentop"
 
258
    $run $mkdir "$my_gentop"
 
259
    my_status=$?
 
260
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
 
261
      exit $my_status
 
262
    fi
 
263
 
 
264
    for my_xlib in $my_oldlibs; do
 
265
      # Extract the objects.
 
266
      case $my_xlib in
 
267
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
268
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
269
      esac
 
270
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
 
271
      my_xdir="$my_gentop/$my_xlib"
 
272
 
 
273
      $show "${rm}r $my_xdir"
 
274
      $run ${rm}r "$my_xdir"
 
275
      $show "$mkdir $my_xdir"
 
276
      $run $mkdir "$my_xdir"
 
277
      status=$?
 
278
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
 
279
        exit $status
 
280
      fi
 
281
      case $host in
 
282
      *-darwin*)
 
283
        $show "Extracting $my_xabs"
 
284
        # Do not bother doing anything if just a dry run
 
285
        if test -z "$run"; then
 
286
          darwin_orig_dir=`pwd`
 
287
          cd $my_xdir || exit $?
 
288
          darwin_archive=$my_xabs
 
289
          darwin_curdir=`pwd`
 
290
          darwin_base_archive=`basename $darwin_archive`
 
291
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
 
292
          if test -n "$darwin_arches"; then 
 
293
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
 
294
            darwin_arch=
 
295
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
 
296
            for darwin_arch in  $darwin_arches ; do
 
297
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
298
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
299
              # Remove the table of contents from the thin files.
 
300
              $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
 
301
              $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
 
302
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
303
              $AR -xo "${darwin_base_archive}"
 
304
              rm "${darwin_base_archive}"
 
305
              cd "$darwin_curdir"
 
306
            done # $darwin_arches
 
307
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
 
308
            darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
 
309
            darwin_file=
 
310
            darwin_files=
 
311
            for darwin_file in $darwin_filelist; do
 
312
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 
313
              lipo -create -output "$darwin_file" $darwin_files
 
314
            done # $darwin_filelist
 
315
            rm -rf unfat-$$
 
316
            cd "$darwin_orig_dir"
 
317
          else
 
318
            cd $darwin_orig_dir
 
319
            (cd $my_xdir && $AR x $my_xabs) || exit $?
 
320
          fi # $darwin_arches
 
321
        fi # $run
 
322
      ;;
 
323
      *)
 
324
        # We will extract separately just the conflicting names and we will
 
325
        # no longer touch any unique names. It is faster to leave these
 
326
        # extract automatically by $AR in one run.
 
327
        $show "(cd $my_xdir && $AR x $my_xabs)"
 
328
        $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
 
329
        if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
 
330
          :
 
331
        else
 
332
          $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
333
          $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
334
          $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
 
335
          do
 
336
            i=1
 
337
            while test "$i" -le "$count"
 
338
            do
 
339
              # Put our $i before any first dot (extension)
 
340
              # Never overwrite any file
 
341
              name_to="$name"
 
342
              while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
 
343
              do
 
344
                name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
345
              done
 
346
              $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
 
347
              $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
348
              i=`expr $i + 1`
 
349
            done
 
350
          done
 
351
        fi
 
352
        ;;
 
353
      esac
 
354
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
355
    done
 
356
 
 
357
    func_extract_archives_result="$my_oldobjs"
 
358
}
 
359
# End of Shell function definitions
 
360
#####################################
 
361
 
 
362
# Darwin sucks
 
363
eval std_shrext=\"$shrext_cmds\"
 
364
 
105
365
# Parse our command line options once, thoroughly.
106
 
while test $# -gt 0
 
366
while test "$#" -gt 0
107
367
do
108
368
  arg="$1"
109
369
  shift
119
379
    execute_dlfiles)
120
380
      execute_dlfiles="$execute_dlfiles $arg"
121
381
      ;;
 
382
    tag)
 
383
      tagname="$arg"
 
384
      preserve_args="${preserve_args}=$arg"
 
385
 
 
386
      # Check whether tagname contains only valid characters
 
387
      case $tagname in
 
388
      *[!-_A-Za-z0-9,/]*)
 
389
        $echo "$progname: invalid tag name: $tagname" 1>&2
 
390
        exit $EXIT_FAILURE
 
391
        ;;
 
392
      esac
 
393
 
 
394
      case $tagname in
 
395
      CC)
 
396
        # Don't test for the "default" C tag, as we know, it's there, but
 
397
        # not specially marked.
 
398
        ;;
 
399
      *)
 
400
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
 
401
          taglist="$taglist $tagname"
 
402
          # Evaluate the configuration.
 
403
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
 
404
        else
 
405
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
 
406
        fi
 
407
        ;;
 
408
      esac
 
409
      ;;
122
410
    *)
123
411
      eval "$prev=\$arg"
124
412
      ;;
136
424
    ;;
137
425
 
138
426
  --version)
139
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
140
 
    exit 0
 
427
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
 
428
    $echo
 
429
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
 
430
    $echo "This is free software; see the source for copying conditions.  There is NO"
 
431
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
432
    exit $EXIT_SUCCESS
141
433
    ;;
142
434
 
143
435
  --config)
144
 
    sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
145
 
    exit 0
 
436
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
 
437
    # Now print the configurations for the tags.
 
438
    for tagname in $taglist; do
 
439
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
 
440
    done
 
441
    exit $EXIT_SUCCESS
146
442
    ;;
147
443
 
148
444
  --debug)
149
 
    echo "$progname: enabling shell trace mode"
 
445
    $echo "$progname: enabling shell trace mode"
150
446
    set -x
 
447
    preserve_args="$preserve_args $arg"
151
448
    ;;
152
449
 
153
450
  --dry-run | -n)
155
452
    ;;
156
453
 
157
454
  --features)
158
 
    echo "host: $host"
 
455
    $echo "host: $host"
159
456
    if test "$build_libtool_libs" = yes; then
160
 
      echo "enable shared libraries"
 
457
      $echo "enable shared libraries"
161
458
    else
162
 
      echo "disable shared libraries"
 
459
      $echo "disable shared libraries"
163
460
    fi
164
461
    if test "$build_old_libs" = yes; then
165
 
      echo "enable static libraries"
 
462
      $echo "enable static libraries"
166
463
    else
167
 
      echo "disable static libraries"
 
464
      $echo "disable static libraries"
168
465
    fi
169
 
    exit 0
 
466
    exit $EXIT_SUCCESS
170
467
    ;;
171
468
 
172
469
  --finish) mode="finish" ;;
174
471
  --mode) prevopt="--mode" prev=mode ;;
175
472
  --mode=*) mode="$optarg" ;;
176
473
 
 
474
  --preserve-dup-deps) duplicate_deps="yes" ;;
 
475
 
177
476
  --quiet | --silent)
178
477
    show=:
 
478
    preserve_args="$preserve_args $arg"
 
479
    ;;
 
480
 
 
481
  --tag) prevopt="--tag" prev=tag ;;
 
482
  --tag=*)
 
483
    set tag "$optarg" ${1+"$@"}
 
484
    shift
 
485
    prev=tag
 
486
    preserve_args="$preserve_args --tag"
179
487
    ;;
180
488
 
181
489
  -dlopen)
186
494
  -*)
187
495
    $echo "$modename: unrecognized option \`$arg'" 1>&2
188
496
    $echo "$help" 1>&2
189
 
    exit 1
 
497
    exit $EXIT_FAILURE
190
498
    ;;
191
499
 
192
500
  *)
199
507
if test -n "$prevopt"; then
200
508
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
201
509
  $echo "$help" 1>&2
202
 
  exit 1
 
510
  exit $EXIT_FAILURE
203
511
fi
204
512
 
 
513
# If this variable is set in any of the actions, the command in it
 
514
# will be execed at the end.  This prevents here-documents from being
 
515
# left over by shells.
 
516
exec_cmd=
 
517
 
205
518
if test -z "$show_help"; then
206
519
 
207
520
  # Infer the operation mode.
208
521
  if test -z "$mode"; then
 
522
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
 
523
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
209
524
    case $nonopt in
210
 
    *cc | *++ | gcc* | *-gcc*)
 
525
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
211
526
      mode=link
212
527
      for arg
213
528
      do
248
563
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
249
564
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
250
565
    $echo "$help" 1>&2
251
 
    exit 1
 
566
    exit $EXIT_FAILURE
252
567
  fi
253
568
 
254
569
  # Change the help message to a mode-specific one.
262
577
    modename="$modename: compile"
263
578
    # Get the compilation command and the source file.
264
579
    base_compile=
265
 
    prev=
266
 
    lastarg=
267
 
    srcfile="$nonopt"
 
580
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
581
    suppress_opt=yes
268
582
    suppress_output=
 
583
    arg_mode=normal
 
584
    libobj=
 
585
    later=
269
586
 
270
 
    user_target=no
271
587
    for arg
272
588
    do
273
 
      case $prev in
274
 
      "") ;;
275
 
      xcompiler)
276
 
        # Aesthetically quote the previous argument.
277
 
        prev=
278
 
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
279
 
 
280
 
        case $arg in
281
 
        # Double-quote args containing other shell metacharacters.
282
 
        # Many Bourne shells cannot handle close brackets correctly
283
 
        # in scan sets, so we specify it separately.
284
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
285
 
          arg="\"$arg\""
286
 
          ;;
287
 
        esac
288
 
 
289
 
        # Add the previous argument to base_compile.
290
 
        if test -z "$base_compile"; then
291
 
          base_compile="$lastarg"
292
 
        else
293
 
          base_compile="$base_compile $lastarg"
294
 
        fi
295
 
        continue
296
 
        ;;
297
 
      esac
298
 
 
299
 
      # Accept any command-line options.
300
 
      case $arg in
301
 
      -o)
302
 
        if test "$user_target" != "no"; then
303
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
304
 
          exit 1
305
 
        fi
306
 
        user_target=next
307
 
        ;;
308
 
 
309
 
      -static)
310
 
        build_old_libs=yes
311
 
        continue
312
 
        ;;
313
 
 
314
 
      -prefer-pic)
315
 
        pic_mode=yes
316
 
        continue
317
 
        ;;
318
 
 
319
 
      -prefer-non-pic)
320
 
        pic_mode=no
321
 
        continue
322
 
        ;;
323
 
 
324
 
      -Xcompiler)
325
 
        prev=xcompiler
326
 
        continue
327
 
        ;;
328
 
 
329
 
      -Wc,*)
330
 
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
331
 
        lastarg=
332
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
333
 
        for arg in $args; do
334
 
          IFS="$save_ifs"
335
 
 
336
 
          # Double-quote args containing other shell metacharacters.
337
 
          # Many Bourne shells cannot handle close brackets correctly
338
 
          # in scan sets, so we specify it separately.
339
 
          case $arg in
340
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
341
 
            arg="\"$arg\""
342
 
            ;;
343
 
          esac
344
 
          lastarg="$lastarg $arg"
345
 
        done
346
 
        IFS="$save_ifs"
347
 
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
348
 
 
349
 
        # Add the arguments to base_compile.
350
 
        if test -z "$base_compile"; then
351
 
          base_compile="$lastarg"
352
 
        else
353
 
          base_compile="$base_compile $lastarg"
354
 
        fi
355
 
        continue
356
 
        ;;
357
 
      esac
358
 
 
359
 
      case $user_target in
360
 
      next)
361
 
        # The next one is the -o target name
362
 
        user_target=yes
363
 
        continue
364
 
        ;;
365
 
      yes)
366
 
        # We got the output file
367
 
        user_target=set
 
589
      case "$arg_mode" in
 
590
      arg  )
 
591
        # do not "continue".  Instead, add this to base_compile
 
592
        lastarg="$arg"
 
593
        arg_mode=normal
 
594
        ;;
 
595
 
 
596
      target )
368
597
        libobj="$arg"
 
598
        arg_mode=normal
369
599
        continue
370
600
        ;;
371
 
      esac
372
 
 
373
 
      # Accept the current argument as the source file.
374
 
      lastarg="$srcfile"
375
 
      srcfile="$arg"
 
601
 
 
602
      normal )
 
603
        # Accept any command-line options.
 
604
        case $arg in
 
605
        -o)
 
606
          if test -n "$libobj" ; then
 
607
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
608
            exit $EXIT_FAILURE
 
609
          fi
 
610
          arg_mode=target
 
611
          continue
 
612
          ;;
 
613
 
 
614
        -static | -prefer-pic | -prefer-non-pic)
 
615
          later="$later $arg"
 
616
          continue
 
617
          ;;
 
618
 
 
619
        -no-suppress)
 
620
          suppress_opt=no
 
621
          continue
 
622
          ;;
 
623
 
 
624
        -Xcompiler)
 
625
          arg_mode=arg  #  the next one goes into the "base_compile" arg list
 
626
          continue      #  The current "srcfile" will either be retained or
 
627
          ;;            #  replaced later.  I would guess that would be a bug.
 
628
 
 
629
        -Wc,*)
 
630
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
631
          lastarg=
 
632
          save_ifs="$IFS"; IFS=','
 
633
          for arg in $args; do
 
634
            IFS="$save_ifs"
 
635
 
 
636
            # Double-quote args containing other shell metacharacters.
 
637
            # Many Bourne shells cannot handle close brackets correctly
 
638
            # in scan sets, so we specify it separately.
 
639
            case $arg in
 
640
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
641
              arg="\"$arg\""
 
642
              ;;
 
643
            esac
 
644
            lastarg="$lastarg $arg"
 
645
          done
 
646
          IFS="$save_ifs"
 
647
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
648
 
 
649
          # Add the arguments to base_compile.
 
650
          base_compile="$base_compile $lastarg"
 
651
          continue
 
652
          ;;
 
653
 
 
654
        * )
 
655
          # Accept the current argument as the source file.
 
656
          # The previous "srcfile" becomes the current argument.
 
657
          #
 
658
          lastarg="$srcfile"
 
659
          srcfile="$arg"
 
660
          ;;
 
661
        esac  #  case $arg
 
662
        ;;
 
663
      esac    #  case $arg_mode
376
664
 
377
665
      # Aesthetically quote the previous argument.
378
 
 
379
 
      # Backslashify any backslashes, double quotes, and dollar signs.
380
 
      # These are the only characters that are still specially
381
 
      # interpreted inside of double-quoted scrings.
382
666
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
383
667
 
 
668
      case $lastarg in
384
669
      # Double-quote args containing other shell metacharacters.
385
670
      # Many Bourne shells cannot handle close brackets correctly
386
671
      # in scan sets, so we specify it separately.
387
 
      case $lastarg in
388
672
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
389
673
        lastarg="\"$lastarg\""
390
674
        ;;
391
675
      esac
392
676
 
393
 
      # Add the previous argument to base_compile.
394
 
      if test -z "$base_compile"; then
395
 
        base_compile="$lastarg"
396
 
      else
397
 
        base_compile="$base_compile $lastarg"
398
 
      fi
399
 
    done
 
677
      base_compile="$base_compile $lastarg"
 
678
    done # for arg
400
679
 
401
 
    case $user_target in
402
 
    set)
403
 
      ;;
404
 
    no)
 
680
    case $arg_mode in
 
681
    arg)
 
682
      $echo "$modename: you must specify an argument for -Xcompile"
 
683
      exit $EXIT_FAILURE
 
684
      ;;
 
685
    target)
 
686
      $echo "$modename: you must specify a target with \`-o'" 1>&2
 
687
      exit $EXIT_FAILURE
 
688
      ;;
 
689
    *)
405
690
      # Get the name of the library object.
406
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
407
 
      ;;
408
 
    *)
409
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
410
 
      exit 1
 
691
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
411
692
      ;;
412
693
    esac
413
694
 
414
695
    # Recognize several different file suffixes.
415
696
    # If the user specifies -o file.o, it is replaced with file.lo
416
 
    xform='[cCFSfmso]'
 
697
    xform='[cCFSifmso]'
417
698
    case $libobj in
418
699
    *.ada) xform=ada ;;
419
700
    *.adb) xform=adb ;;
421
702
    *.asm) xform=asm ;;
422
703
    *.c++) xform=c++ ;;
423
704
    *.cc) xform=cc ;;
 
705
    *.ii) xform=ii ;;
 
706
    *.class) xform=class ;;
424
707
    *.cpp) xform=cpp ;;
425
708
    *.cxx) xform=cxx ;;
426
709
    *.f90) xform=f90 ;;
427
710
    *.for) xform=for ;;
 
711
    *.java) xform=java ;;
428
712
    esac
429
713
 
430
714
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
433
717
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
434
718
    *)
435
719
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
436
 
      exit 1
 
720
      exit $EXIT_FAILURE
437
721
      ;;
438
722
    esac
439
723
 
 
724
    func_infer_tag $base_compile
 
725
 
 
726
    for arg in $later; do
 
727
      case $arg in
 
728
      -static)
 
729
        build_old_libs=yes
 
730
        continue
 
731
        ;;
 
732
 
 
733
      -prefer-pic)
 
734
        pic_mode=yes
 
735
        continue
 
736
        ;;
 
737
 
 
738
      -prefer-non-pic)
 
739
        pic_mode=no
 
740
        continue
 
741
        ;;
 
742
      esac
 
743
    done
 
744
 
 
745
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
746
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
747
    if test "X$xdir" = "X$obj"; then
 
748
      xdir=
 
749
    else
 
750
      xdir=$xdir/
 
751
    fi
 
752
    lobj=${xdir}$objdir/$objname
 
753
 
440
754
    if test -z "$base_compile"; then
441
755
      $echo "$modename: you must specify a compilation command" 1>&2
442
756
      $echo "$help" 1>&2
443
 
      exit 1
 
757
      exit $EXIT_FAILURE
444
758
    fi
445
759
 
446
760
    # Delete any leftover library objects.
447
761
    if test "$build_old_libs" = yes; then
448
 
      removelist="$obj $libobj"
 
762
      removelist="$obj $lobj $libobj ${libobj}T"
449
763
    else
450
 
      removelist="$libobj"
 
764
      removelist="$lobj $libobj ${libobj}T"
451
765
    fi
452
766
 
453
767
    $run $rm $removelist
454
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
768
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
455
769
 
456
770
    # On Cygwin there's no "real" PIC flag so we must build both object types
457
771
    case $host_os in
459
773
      pic_mode=default
460
774
      ;;
461
775
    esac
462
 
    if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
 
776
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
463
777
      # non-PIC code in shared libraries is not supported
464
778
      pic_mode=default
465
779
    fi
470
784
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
471
785
      lockfile="$output_obj.lock"
472
786
      removelist="$removelist $output_obj $lockfile"
473
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
787
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
474
788
    else
 
789
      output_obj=
475
790
      need_locks=no
476
791
      lockfile=
477
792
    fi
479
794
    # Lock this critical section if it is needed
480
795
    # We use this script file to make the link, it avoids creating a new file
481
796
    if test "$need_locks" = yes; then
482
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
797
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
483
798
        $show "Waiting for $lockfile to be removed"
484
799
        sleep 2
485
800
      done
486
801
    elif test "$need_locks" = warn; then
487
802
      if test -f "$lockfile"; then
488
 
        echo "\
 
803
        $echo "\
489
804
*** ERROR, $lockfile exists and contains:
490
805
`cat $lockfile 2>/dev/null`
491
806
 
497
812
compiler."
498
813
 
499
814
        $run $rm $removelist
500
 
        exit 1
 
815
        exit $EXIT_FAILURE
501
816
      fi
502
 
      echo $srcfile > "$lockfile"
 
817
      $echo $srcfile > "$lockfile"
503
818
    fi
504
819
 
505
820
    if test -n "$fix_srcfile_path"; then
506
821
      eval srcfile=\"$fix_srcfile_path\"
507
822
    fi
508
823
 
 
824
    $run $rm "$libobj" "${libobj}T"
 
825
 
 
826
    # Create a libtool object file (analogous to a ".la" file),
 
827
    # but don't create it if we're doing a dry run.
 
828
    test -z "$run" && cat > ${libobj}T <<EOF
 
829
# $libobj - a libtool object file
 
830
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
831
#
 
832
# Please DO NOT delete this file!
 
833
# It is necessary for linking the library.
 
834
 
 
835
# Name of the PIC object.
 
836
EOF
 
837
 
509
838
    # Only build a PIC object if we are building libtool libraries.
510
839
    if test "$build_libtool_libs" = yes; then
511
840
      # Without this assignment, base_compile gets emptied.
512
841
      fbsd_hideous_sh_bug=$base_compile
513
842
 
514
843
      if test "$pic_mode" != no; then
515
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
516
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
844
        command="$base_compile $srcfile $pic_flag"
517
845
      else
518
846
        # Don't build PIC code
519
847
        command="$base_compile $srcfile"
520
848
      fi
521
 
      if test "$build_old_libs" = yes; then
522
 
        lo_libobj="$libobj"
523
 
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
524
 
        if test "X$dir" = "X$libobj"; then
525
 
          dir="$objdir"
526
 
        else
527
 
          dir="$dir/$objdir"
528
 
        fi
529
 
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
530
 
 
531
 
        if test -d "$dir"; then
532
 
          $show "$rm $libobj"
533
 
          $run $rm $libobj
534
 
        else
535
 
          $show "$mkdir $dir"
536
 
          $run $mkdir $dir
537
 
          status=$?
538
 
          if test $status -ne 0 && test ! -d $dir; then
539
 
            exit $status
540
 
          fi
541
 
        fi
542
 
      fi
543
 
      if test "$compiler_o_lo" = yes; then
544
 
        output_obj="$libobj"
545
 
        command="$command -o $output_obj"
546
 
      elif test "$compiler_c_o" = yes; then
547
 
        output_obj="$obj"
548
 
        command="$command -o $output_obj"
549
 
      fi
550
 
 
551
 
      $run $rm "$output_obj"
 
849
 
 
850
      if test ! -d "${xdir}$objdir"; then
 
851
        $show "$mkdir ${xdir}$objdir"
 
852
        $run $mkdir ${xdir}$objdir
 
853
        status=$?
 
854
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
855
          exit $status
 
856
        fi
 
857
      fi
 
858
 
 
859
      if test -z "$output_obj"; then
 
860
        # Place PIC objects in $objdir
 
861
        command="$command -o $lobj"
 
862
      fi
 
863
 
 
864
      $run $rm "$lobj" "$output_obj"
 
865
 
552
866
      $show "$command"
553
867
      if $run eval "$command"; then :
554
868
      else
555
869
        test -n "$output_obj" && $run $rm $removelist
556
 
        exit 1
 
870
        exit $EXIT_FAILURE
557
871
      fi
558
872
 
559
873
      if test "$need_locks" = warn &&
560
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
561
 
        echo "\
 
874
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
875
        $echo "\
562
876
*** ERROR, $lockfile contains:
563
877
`cat $lockfile 2>/dev/null`
564
878
 
573
887
compiler."
574
888
 
575
889
        $run $rm $removelist
576
 
        exit 1
 
890
        exit $EXIT_FAILURE
577
891
      fi
578
892
 
579
893
      # Just move the object if needed, then go on to compile the next one
580
 
      if test x"$output_obj" != x"$libobj"; then
581
 
        $show "$mv $output_obj $libobj"
582
 
        if $run $mv $output_obj $libobj; then :
583
 
        else
584
 
          error=$?
585
 
          $run $rm $removelist
586
 
          exit $error
587
 
        fi
588
 
      fi
589
 
 
590
 
      # If we have no pic_flag, then copy the object into place and finish.
591
 
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
592
 
         test "$build_old_libs" = yes; then
593
 
        # Rename the .lo from within objdir to obj
594
 
        if test -f $obj; then
595
 
          $show $rm $obj
596
 
          $run $rm $obj
597
 
        fi
598
 
 
599
 
        $show "$mv $libobj $obj"
600
 
        if $run $mv $libobj $obj; then :
601
 
        else
602
 
          error=$?
603
 
          $run $rm $removelist
604
 
          exit $error
605
 
        fi
606
 
 
607
 
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
608
 
        if test "X$xdir" = "X$obj"; then
609
 
          xdir="."
610
 
        else
611
 
          xdir="$xdir"
612
 
        fi
613
 
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
614
 
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
615
 
        # Now arrange that obj and lo_libobj become the same file
616
 
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
617
 
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
618
 
          exit 0
619
 
        else
620
 
          error=$?
621
 
          $run $rm $removelist
622
 
          exit $error
623
 
        fi
624
 
      fi
 
894
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 
895
        $show "$mv $output_obj $lobj"
 
896
        if $run $mv $output_obj $lobj; then :
 
897
        else
 
898
          error=$?
 
899
          $run $rm $removelist
 
900
          exit $error
 
901
        fi
 
902
      fi
 
903
 
 
904
      # Append the name of the PIC object to the libtool object file.
 
905
      test -z "$run" && cat >> ${libobj}T <<EOF
 
906
pic_object='$objdir/$objname'
 
907
 
 
908
EOF
625
909
 
626
910
      # Allow error messages only from the first compilation.
627
 
      suppress_output=' >/dev/null 2>&1'
 
911
      if test "$suppress_opt" = yes; then
 
912
        suppress_output=' >/dev/null 2>&1'
 
913
      fi
 
914
    else
 
915
      # No PIC object so indicate it doesn't exist in the libtool
 
916
      # object file.
 
917
      test -z "$run" && cat >> ${libobj}T <<EOF
 
918
pic_object=none
 
919
 
 
920
EOF
628
921
    fi
629
922
 
630
923
    # Only build a position-dependent object if we build old libraries.
633
926
        # Don't build PIC code
634
927
        command="$base_compile $srcfile"
635
928
      else
636
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
637
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
929
        command="$base_compile $srcfile $pic_flag"
638
930
      fi
639
931
      if test "$compiler_c_o" = yes; then
640
932
        command="$command -o $obj"
641
 
        output_obj="$obj"
642
933
      fi
643
934
 
644
935
      # Suppress compiler output if we already did a PIC compilation.
645
936
      command="$command$suppress_output"
646
 
      $run $rm "$output_obj"
 
937
      $run $rm "$obj" "$output_obj"
647
938
      $show "$command"
648
939
      if $run eval "$command"; then :
649
940
      else
650
941
        $run $rm $removelist
651
 
        exit 1
 
942
        exit $EXIT_FAILURE
652
943
      fi
653
944
 
654
945
      if test "$need_locks" = warn &&
655
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
656
 
        echo "\
 
946
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
947
        $echo "\
657
948
*** ERROR, $lockfile contains:
658
949
`cat $lockfile 2>/dev/null`
659
950
 
668
959
compiler."
669
960
 
670
961
        $run $rm $removelist
671
 
        exit 1
 
962
        exit $EXIT_FAILURE
672
963
      fi
673
964
 
674
965
      # Just move the object if needed
675
 
      if test x"$output_obj" != x"$obj"; then
 
966
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
676
967
        $show "$mv $output_obj $obj"
677
968
        if $run $mv $output_obj $obj; then :
678
969
        else
682
973
        fi
683
974
      fi
684
975
 
685
 
      # Create an invalid libtool object if no PIC, so that we do not
686
 
      # accidentally link it into a program.
687
 
      if test "$build_libtool_libs" != yes; then
688
 
        $show "echo timestamp > $libobj"
689
 
        $run eval "echo timestamp > \$libobj" || exit $?
690
 
      else
691
 
        # Move the .lo from within objdir
692
 
        $show "$mv $libobj $lo_libobj"
693
 
        if $run $mv $libobj $lo_libobj; then :
694
 
        else
695
 
          error=$?
696
 
          $run $rm $removelist
697
 
          exit $error
698
 
        fi
699
 
      fi
 
976
      # Append the name of the non-PIC object the libtool object file.
 
977
      # Only append if the libtool object file exists.
 
978
      test -z "$run" && cat >> ${libobj}T <<EOF
 
979
# Name of the non-PIC object.
 
980
non_pic_object='$objname'
 
981
 
 
982
EOF
 
983
    else
 
984
      # Append the name of the non-PIC object the libtool object file.
 
985
      # Only append if the libtool object file exists.
 
986
      test -z "$run" && cat >> ${libobj}T <<EOF
 
987
# Name of the non-PIC object.
 
988
non_pic_object=none
 
989
 
 
990
EOF
700
991
    fi
701
992
 
 
993
    $run $mv "${libobj}T" "${libobj}"
 
994
 
702
995
    # Unlock the critical section if it was locked
703
996
    if test "$need_locks" != no; then
704
997
      $run $rm "$lockfile"
705
998
    fi
706
999
 
707
 
    exit 0
 
1000
    exit $EXIT_SUCCESS
708
1001
    ;;
709
1002
 
710
1003
  # libtool link mode
715
1008
      # It is impossible to link a dll without this setting, and
716
1009
      # we shouldn't force the makefile maintainer to figure out
717
1010
      # which system we are compiling for in order to pass an extra
718
 
      # flag for every libtool invokation.
 
1011
      # flag for every libtool invocation.
719
1012
      # allow_undefined=no
720
1013
 
721
1014
      # FIXME: Unfortunately, there are problems with the above when trying
730
1023
      ;;
731
1024
    esac
732
1025
    libtool_args="$nonopt"
 
1026
    base_compile="$nonopt $@"
733
1027
    compile_command="$nonopt"
734
1028
    finalize_command="$nonopt"
735
1029
 
760
1054
    module=no
761
1055
    no_install=no
762
1056
    objs=
 
1057
    non_pic_objects=
 
1058
    precious_files_regex=
763
1059
    prefer_static_libs=no
764
1060
    preload=no
765
1061
    prev=
771
1067
    temp_rpath=
772
1068
    thread_safe=no
773
1069
    vinfo=
 
1070
    vinfo_number=no
 
1071
 
 
1072
    func_infer_tag $base_compile
774
1073
 
775
1074
    # We need to know -static, to get the right output filenames.
776
1075
    for arg
801
1100
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
802
1101
 
803
1102
    # Go through the arguments, transforming them on the way.
804
 
    while test $# -gt 0; do
 
1103
    while test "$#" -gt 0; do
805
1104
      arg="$1"
806
1105
      shift
807
1106
      case $arg in
866
1165
          export_symbols="$arg"
867
1166
          if test ! -f "$arg"; then
868
1167
            $echo "$modename: symbol file \`$arg' does not exist"
869
 
            exit 1
 
1168
            exit $EXIT_FAILURE
870
1169
          fi
871
1170
          prev=
872
1171
          continue
876
1175
          prev=
877
1176
          continue
878
1177
          ;;
879
 
        inst_prefix)
 
1178
        inst_prefix)
880
1179
          inst_prefix_dir="$arg"
881
1180
          prev=
882
1181
          continue
883
1182
          ;;
 
1183
        precious_regex)
 
1184
          precious_files_regex="$arg"
 
1185
          prev=
 
1186
          continue
 
1187
          ;;
884
1188
        release)
885
1189
          release="-$arg"
886
1190
          prev=
887
1191
          continue
888
1192
          ;;
 
1193
        objectlist)
 
1194
          if test -f "$arg"; then
 
1195
            save_arg=$arg
 
1196
            moreargs=
 
1197
            for fil in `cat $save_arg`
 
1198
            do
 
1199
#             moreargs="$moreargs $fil"
 
1200
              arg=$fil
 
1201
              # A libtool-controlled object.
 
1202
 
 
1203
              # Check to see that this really is a libtool object.
 
1204
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1205
                pic_object=
 
1206
                non_pic_object=
 
1207
 
 
1208
                # Read the .lo file
 
1209
                # If there is no directory component, then add one.
 
1210
                case $arg in
 
1211
                */* | *\\*) . $arg ;;
 
1212
                *) . ./$arg ;;
 
1213
                esac
 
1214
 
 
1215
                if test -z "$pic_object" || \
 
1216
                   test -z "$non_pic_object" ||
 
1217
                   test "$pic_object" = none && \
 
1218
                   test "$non_pic_object" = none; then
 
1219
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1220
                  exit $EXIT_FAILURE
 
1221
                fi
 
1222
 
 
1223
                # Extract subdirectory from the argument.
 
1224
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1225
                if test "X$xdir" = "X$arg"; then
 
1226
                  xdir=
 
1227
                else
 
1228
                  xdir="$xdir/"
 
1229
                fi
 
1230
 
 
1231
                if test "$pic_object" != none; then
 
1232
                  # Prepend the subdirectory the object is found in.
 
1233
                  pic_object="$xdir$pic_object"
 
1234
 
 
1235
                  if test "$prev" = dlfiles; then
 
1236
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1237
                      dlfiles="$dlfiles $pic_object"
 
1238
                      prev=
 
1239
                      continue
 
1240
                    else
 
1241
                      # If libtool objects are unsupported, then we need to preload.
 
1242
                      prev=dlprefiles
 
1243
                    fi
 
1244
                  fi
 
1245
 
 
1246
                  # CHECK ME:  I think I busted this.  -Ossama
 
1247
                  if test "$prev" = dlprefiles; then
 
1248
                    # Preload the old-style object.
 
1249
                    dlprefiles="$dlprefiles $pic_object"
 
1250
                    prev=
 
1251
                  fi
 
1252
 
 
1253
                  # A PIC object.
 
1254
                  libobjs="$libobjs $pic_object"
 
1255
                  arg="$pic_object"
 
1256
                fi
 
1257
 
 
1258
                # Non-PIC object.
 
1259
                if test "$non_pic_object" != none; then
 
1260
                  # Prepend the subdirectory the object is found in.
 
1261
                  non_pic_object="$xdir$non_pic_object"
 
1262
 
 
1263
                  # A standard non-PIC object
 
1264
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1265
                  if test -z "$pic_object" || test "$pic_object" = none ; then
 
1266
                    arg="$non_pic_object"
 
1267
                  fi
 
1268
                fi
 
1269
              else
 
1270
                # Only an error if not doing a dry-run.
 
1271
                if test -z "$run"; then
 
1272
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1273
                  exit $EXIT_FAILURE
 
1274
                else
 
1275
                  # Dry-run case.
 
1276
 
 
1277
                  # Extract subdirectory from the argument.
 
1278
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1279
                  if test "X$xdir" = "X$arg"; then
 
1280
                    xdir=
 
1281
                  else
 
1282
                    xdir="$xdir/"
 
1283
                  fi
 
1284
 
 
1285
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1286
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1287
                  libobjs="$libobjs $pic_object"
 
1288
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1289
                fi
 
1290
              fi
 
1291
            done
 
1292
          else
 
1293
            $echo "$modename: link input file \`$save_arg' does not exist"
 
1294
            exit $EXIT_FAILURE
 
1295
          fi
 
1296
          arg=$save_arg
 
1297
          prev=
 
1298
          continue
 
1299
          ;;
889
1300
        rpath | xrpath)
890
1301
          # We need an absolute path.
891
1302
          case $arg in
892
1303
          [\\/]* | [A-Za-z]:[\\/]*) ;;
893
1304
          *)
894
1305
            $echo "$modename: only absolute run-paths are allowed" 1>&2
895
 
            exit 1
 
1306
            exit $EXIT_FAILURE
896
1307
            ;;
897
1308
          esac
898
1309
          if test "$prev" = rpath; then
924
1335
          finalize_command="$finalize_command $wl$qarg"
925
1336
          continue
926
1337
          ;;
 
1338
        xcclinker)
 
1339
          linker_flags="$linker_flags $qarg"
 
1340
          compiler_flags="$compiler_flags $qarg"
 
1341
          prev=
 
1342
          compile_command="$compile_command $qarg"
 
1343
          finalize_command="$finalize_command $qarg"
 
1344
          continue
 
1345
          ;;
 
1346
        shrext)
 
1347
          shrext_cmds="$arg"
 
1348
          prev=
 
1349
          continue
 
1350
          ;;
927
1351
        *)
928
1352
          eval "$prev=\"\$arg\""
929
1353
          prev=
930
1354
          continue
931
1355
          ;;
932
1356
        esac
933
 
      fi # test -n $prev
 
1357
      fi # test -n "$prev"
934
1358
 
935
1359
      prevarg="$arg"
936
1360
 
972
1396
      -export-symbols | -export-symbols-regex)
973
1397
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
974
1398
          $echo "$modename: more than one -exported-symbols argument is not allowed"
975
 
          exit 1
 
1399
          exit $EXIT_FAILURE
976
1400
        fi
977
1401
        if test "X$arg" = "X-export-symbols"; then
978
1402
          prev=expsyms
991
1415
      # so, if we see these flags be careful not to treat them like -L
992
1416
      -L[A-Z][A-Z]*:*)
993
1417
        case $with_gcc/$host in
994
 
        no/*-*-irix*)
 
1418
        no/*-*-irix* | /*-*-irix*)
995
1419
          compile_command="$compile_command $arg"
996
1420
          finalize_command="$finalize_command $arg"
997
1421
          ;;
1008
1432
          absdir=`cd "$dir" && pwd`
1009
1433
          if test -z "$absdir"; then
1010
1434
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1011
 
            exit 1
 
1435
            exit $EXIT_FAILURE
1012
1436
          fi
1013
1437
          dir="$absdir"
1014
1438
          ;;
1042
1466
            # These systems don't actually have a C library (as such)
1043
1467
            test "X$arg" = "X-lc" && continue
1044
1468
            ;;
 
1469
          *-*-openbsd* | *-*-freebsd*)
 
1470
            # Do not include libc due to us having libc/libc_r.
 
1471
            test "X$arg" = "X-lc" && continue
 
1472
            ;;
 
1473
          *-*-rhapsody* | *-*-darwin1.[012])
 
1474
            # Rhapsody C and math libraries are in the System framework
 
1475
            deplibs="$deplibs -framework System"
 
1476
            continue
1045
1477
          esac
 
1478
        elif test "X$arg" = "X-lc_r"; then
 
1479
         case $host in
 
1480
         *-*-openbsd* | *-*-freebsd*)
 
1481
           # Do not include libc_r directly, use -pthread flag.
 
1482
           continue
 
1483
           ;;
 
1484
         esac
1046
1485
        fi
1047
1486
        deplibs="$deplibs $arg"
1048
1487
        continue
1049
1488
        ;;
1050
1489
 
 
1490
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1491
        deplibs="$deplibs $arg"
 
1492
        continue
 
1493
        ;;
 
1494
 
1051
1495
      -module)
1052
1496
        module=yes
1053
1497
        continue
1054
1498
        ;;
1055
1499
 
 
1500
      # gcc -m* arguments should be passed to the linker via $compiler_flags
 
1501
      # in order to pass architecture information to the linker
 
1502
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
 
1503
      # but this is not reliable with gcc because gcc may use -mfoo to
 
1504
      # select a different linker, different libraries, etc, while
 
1505
      # -Wl,-mfoo simply passes -mfoo to the linker.
 
1506
      -m*)
 
1507
        # Unknown arguments in both finalize_command and compile_command need
 
1508
        # to be aesthetically quoted because they are evaled later.
 
1509
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1510
        case $arg in
 
1511
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1512
          arg="\"$arg\""
 
1513
          ;;
 
1514
        esac
 
1515
        compile_command="$compile_command $arg"
 
1516
        finalize_command="$finalize_command $arg"
 
1517
        if test "$with_gcc" = "yes" ; then
 
1518
          compiler_flags="$compiler_flags $arg"
 
1519
        fi
 
1520
        continue
 
1521
        ;;
 
1522
 
 
1523
      -shrext)
 
1524
        prev=shrext
 
1525
        continue
 
1526
        ;;
 
1527
 
1056
1528
      -no-fast-install)
1057
1529
        fast_install=no
1058
1530
        continue
1077
1549
        continue
1078
1550
        ;;
1079
1551
 
 
1552
      -objectlist)
 
1553
        prev=objectlist
 
1554
        continue
 
1555
        ;;
 
1556
 
1080
1557
      -o) prev=output ;;
1081
1558
 
 
1559
      -precious-files-regex)
 
1560
        prev=precious_regex
 
1561
        continue
 
1562
        ;;
 
1563
 
1082
1564
      -release)
1083
1565
        prev=release
1084
1566
        continue
1101
1583
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1102
1584
        *)
1103
1585
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1104
 
          exit 1
 
1586
          exit $EXIT_FAILURE
1105
1587
          ;;
1106
1588
        esac
1107
1589
        case "$xrpath " in
1129
1611
        prev=vinfo
1130
1612
        continue
1131
1613
        ;;
 
1614
      -version-number)
 
1615
        prev=vinfo
 
1616
        vinfo_number=yes
 
1617
        continue
 
1618
        ;;
1132
1619
 
1133
1620
      -Wc,*)
1134
1621
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1135
1622
        arg=
1136
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
 
1623
        save_ifs="$IFS"; IFS=','
1137
1624
        for flag in $args; do
1138
1625
          IFS="$save_ifs"
1139
1626
          case $flag in
1151
1638
      -Wl,*)
1152
1639
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1153
1640
        arg=
1154
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
 
1641
        save_ifs="$IFS"; IFS=','
1155
1642
        for flag in $args; do
1156
1643
          IFS="$save_ifs"
1157
1644
          case $flag in
1177
1664
        continue
1178
1665
        ;;
1179
1666
 
 
1667
      -XCClinker)
 
1668
        prev=xcclinker
 
1669
        continue
 
1670
        ;;
 
1671
 
1180
1672
      # Some other compiler flag.
1181
1673
      -* | +*)
1182
1674
        # Unknown arguments in both finalize_command and compile_command need
1189
1681
        esac
1190
1682
        ;;
1191
1683
 
1192
 
      *.lo | *.$objext)
1193
 
        # A library or standard object.
1194
 
        if test "$prev" = dlfiles; then
1195
 
          # This file was specified with -dlopen.
1196
 
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1197
 
            dlfiles="$dlfiles $arg"
1198
 
            prev=
1199
 
            continue
1200
 
          else
1201
 
            # If libtool objects are unsupported, then we need to preload.
1202
 
            prev=dlprefiles
1203
 
          fi
1204
 
        fi
1205
 
 
1206
 
        if test "$prev" = dlprefiles; then
1207
 
          # Preload the old-style object.
1208
 
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1209
 
          prev=
1210
 
        else
 
1684
      *.$objext)
 
1685
        # A standard object.
 
1686
        objs="$objs $arg"
 
1687
        ;;
 
1688
 
 
1689
      *.lo)
 
1690
        # A libtool-controlled object.
 
1691
 
 
1692
        # Check to see that this really is a libtool object.
 
1693
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1694
          pic_object=
 
1695
          non_pic_object=
 
1696
 
 
1697
          # Read the .lo file
 
1698
          # If there is no directory component, then add one.
1211
1699
          case $arg in
1212
 
          *.lo) libobjs="$libobjs $arg" ;;
1213
 
          *) objs="$objs $arg" ;;
 
1700
          */* | *\\*) . $arg ;;
 
1701
          *) . ./$arg ;;
1214
1702
          esac
 
1703
 
 
1704
          if test -z "$pic_object" || \
 
1705
             test -z "$non_pic_object" ||
 
1706
             test "$pic_object" = none && \
 
1707
             test "$non_pic_object" = none; then
 
1708
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1709
            exit $EXIT_FAILURE
 
1710
          fi
 
1711
 
 
1712
          # Extract subdirectory from the argument.
 
1713
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1714
          if test "X$xdir" = "X$arg"; then
 
1715
            xdir=
 
1716
          else
 
1717
            xdir="$xdir/"
 
1718
          fi
 
1719
 
 
1720
          if test "$pic_object" != none; then
 
1721
            # Prepend the subdirectory the object is found in.
 
1722
            pic_object="$xdir$pic_object"
 
1723
 
 
1724
            if test "$prev" = dlfiles; then
 
1725
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1726
                dlfiles="$dlfiles $pic_object"
 
1727
                prev=
 
1728
                continue
 
1729
              else
 
1730
                # If libtool objects are unsupported, then we need to preload.
 
1731
                prev=dlprefiles
 
1732
              fi
 
1733
            fi
 
1734
 
 
1735
            # CHECK ME:  I think I busted this.  -Ossama
 
1736
            if test "$prev" = dlprefiles; then
 
1737
              # Preload the old-style object.
 
1738
              dlprefiles="$dlprefiles $pic_object"
 
1739
              prev=
 
1740
            fi
 
1741
 
 
1742
            # A PIC object.
 
1743
            libobjs="$libobjs $pic_object"
 
1744
            arg="$pic_object"
 
1745
          fi
 
1746
 
 
1747
          # Non-PIC object.
 
1748
          if test "$non_pic_object" != none; then
 
1749
            # Prepend the subdirectory the object is found in.
 
1750
            non_pic_object="$xdir$non_pic_object"
 
1751
 
 
1752
            # A standard non-PIC object
 
1753
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1754
            if test -z "$pic_object" || test "$pic_object" = none ; then
 
1755
              arg="$non_pic_object"
 
1756
            fi
 
1757
          fi
 
1758
        else
 
1759
          # Only an error if not doing a dry-run.
 
1760
          if test -z "$run"; then
 
1761
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1762
            exit $EXIT_FAILURE
 
1763
          else
 
1764
            # Dry-run case.
 
1765
 
 
1766
            # Extract subdirectory from the argument.
 
1767
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1768
            if test "X$xdir" = "X$arg"; then
 
1769
              xdir=
 
1770
            else
 
1771
              xdir="$xdir/"
 
1772
            fi
 
1773
 
 
1774
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1775
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1776
            libobjs="$libobjs $pic_object"
 
1777
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1778
          fi
1215
1779
        fi
1216
1780
        ;;
1217
1781
 
1262
1826
    if test -n "$prev"; then
1263
1827
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1264
1828
      $echo "$help" 1>&2
1265
 
      exit 1
 
1829
      exit $EXIT_FAILURE
1266
1830
    fi
1267
1831
 
1268
1832
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1271
1835
      finalize_command="$finalize_command $arg"
1272
1836
    fi
1273
1837
 
 
1838
    oldlibs=
1274
1839
    # calculate the name of the file, without its directory
1275
1840
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1276
1841
    libobjs_save="$libobjs"
1291
1856
      output_objdir="$output_objdir/$objdir"
1292
1857
    fi
1293
1858
    # Create the object directory.
1294
 
    if test ! -d $output_objdir; then
 
1859
    if test ! -d "$output_objdir"; then
1295
1860
      $show "$mkdir $output_objdir"
1296
1861
      $run $mkdir $output_objdir
1297
1862
      status=$?
1298
 
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1863
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1299
1864
        exit $status
1300
1865
      fi
1301
1866
    fi
1305
1870
    "")
1306
1871
      $echo "$modename: you must specify an output file" 1>&2
1307
1872
      $echo "$help" 1>&2
1308
 
      exit 1
 
1873
      exit $EXIT_FAILURE
1309
1874
      ;;
1310
1875
    *.$libext) linkmode=oldlib ;;
1311
1876
    *.lo | *.$objext) linkmode=obj ;;
1313
1878
    *) linkmode=prog ;; # Anything else should be a program.
1314
1879
    esac
1315
1880
 
 
1881
    case $host in
 
1882
    *cygwin* | *mingw* | *pw32*)
 
1883
      # don't eliminate duplications in $postdeps and $predeps
 
1884
      duplicate_compiler_generated_deps=yes
 
1885
      ;;
 
1886
    *)
 
1887
      duplicate_compiler_generated_deps=$duplicate_deps
 
1888
      ;;
 
1889
    esac
1316
1890
    specialdeplibs=
 
1891
 
1317
1892
    libs=
1318
1893
    # Find all interdependent deplibs by searching for libraries
1319
1894
    # that are linked more than once (e.g. -la -lb -la)
1320
1895
    for deplib in $deplibs; do
1321
 
      case "$libs " in
1322
 
      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1323
 
      esac
 
1896
      if test "X$duplicate_deps" = "Xyes" ; then
 
1897
        case "$libs " in
 
1898
        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1899
        esac
 
1900
      fi
1324
1901
      libs="$libs $deplib"
1325
1902
    done
 
1903
 
 
1904
    if test "$linkmode" = lib; then
 
1905
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
1906
 
 
1907
      # Compute libraries that are listed more than once in $predeps
 
1908
      # $postdeps and mark them as special (i.e., whose duplicates are
 
1909
      # not to be eliminated).
 
1910
      pre_post_deps=
 
1911
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
1912
        for pre_post_dep in $predeps $postdeps; do
 
1913
          case "$pre_post_deps " in
 
1914
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
1915
          esac
 
1916
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
1917
        done
 
1918
      fi
 
1919
      pre_post_deps=
 
1920
    fi
 
1921
 
1326
1922
    deplibs=
1327
1923
    newdependency_libs=
1328
1924
    newlib_search_path=
1337
1933
          *.la) ;;
1338
1934
          *)
1339
1935
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1340
 
            exit 1
 
1936
            exit $EXIT_FAILURE
1341
1937
            ;;
1342
1938
          esac
1343
1939
        done
1354
1950
        ;;
1355
1951
    esac
1356
1952
    for pass in $passes; do
1357
 
      if test $linkmode = prog; then
1358
 
        # Determine which files to process
 
1953
      if test "$linkmode,$pass" = "lib,link" ||
 
1954
         test "$linkmode,$pass" = "prog,scan"; then
 
1955
        libs="$deplibs"
 
1956
        deplibs=
 
1957
      fi
 
1958
      if test "$linkmode" = prog; then
1359
1959
        case $pass in
1360
 
        dlopen)
1361
 
          libs="$dlfiles"
1362
 
          save_deplibs="$deplibs" # Collect dlpreopened libraries
1363
 
          deplibs=
1364
 
          ;;
 
1960
        dlopen) libs="$dlfiles" ;;
1365
1961
        dlpreopen) libs="$dlprefiles" ;;
1366
1962
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1367
1963
        esac
1368
1964
      fi
 
1965
      if test "$pass" = dlopen; then
 
1966
        # Collect dlpreopened libraries
 
1967
        save_deplibs="$deplibs"
 
1968
        deplibs=
 
1969
      fi
1369
1970
      for deplib in $libs; do
1370
1971
        lib=
1371
1972
        found=no
1372
1973
        case $deplib in
 
1974
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1975
          if test "$linkmode,$pass" = "prog,link"; then
 
1976
            compile_deplibs="$deplib $compile_deplibs"
 
1977
            finalize_deplibs="$deplib $finalize_deplibs"
 
1978
          else
 
1979
            deplibs="$deplib $deplibs"
 
1980
          fi
 
1981
          continue
 
1982
          ;;
1373
1983
        -l*)
1374
 
          if test $linkmode = oldlib && test $linkmode = obj; then
1375
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1376
 
            continue
1377
 
          fi
1378
 
          if test $pass = conv; then
1379
 
            deplibs="$deplib $deplibs"
 
1984
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
1985
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1380
1986
            continue
1381
1987
          fi
1382
1988
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1383
1989
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1384
 
            # Search the libtool library
1385
 
            lib="$searchdir/lib${name}.la"
1386
 
            if test -f "$lib"; then
1387
 
              found=yes
1388
 
              break
1389
 
            fi
 
1990
            for search_ext in .la $std_shrext .so .a; do
 
1991
              # Search the libtool library
 
1992
              lib="$searchdir/lib${name}${search_ext}"
 
1993
              if test -f "$lib"; then
 
1994
                if test "$search_ext" = ".la"; then
 
1995
                  found=yes
 
1996
                else
 
1997
                  found=no
 
1998
                fi
 
1999
                break 2
 
2000
              fi
 
2001
            done
1390
2002
          done
1391
2003
          if test "$found" != yes; then
1392
2004
            # deplib doesn't seem to be a libtool library
1395
2007
              finalize_deplibs="$deplib $finalize_deplibs"
1396
2008
            else
1397
2009
              deplibs="$deplib $deplibs"
1398
 
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
2010
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1399
2011
            fi
1400
2012
            continue
 
2013
          else # deplib is a libtool library
 
2014
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
2015
            # We need to do some special things here, and not later.
 
2016
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
2017
              case " $predeps $postdeps " in
 
2018
              *" $deplib "*)
 
2019
                if (${SED} -e '2q' $lib |
 
2020
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
2021
                  library_names=
 
2022
                  old_library=
 
2023
                  case $lib in
 
2024
                  */* | *\\*) . $lib ;;
 
2025
                  *) . ./$lib ;;
 
2026
                  esac
 
2027
                  for l in $old_library $library_names; do
 
2028
                    ll="$l"
 
2029
                  done
 
2030
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
2031
                    found=no
 
2032
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
2033
                    test "X$ladir" = "X$lib" && ladir="."
 
2034
                    lib=$ladir/$old_library
 
2035
                    if test "$linkmode,$pass" = "prog,link"; then
 
2036
                      compile_deplibs="$deplib $compile_deplibs"
 
2037
                      finalize_deplibs="$deplib $finalize_deplibs"
 
2038
                    else
 
2039
                      deplibs="$deplib $deplibs"
 
2040
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
2041
                    fi
 
2042
                    continue
 
2043
                  fi
 
2044
                fi
 
2045
                ;;
 
2046
              *) ;;
 
2047
              esac
 
2048
            fi
1401
2049
          fi
1402
2050
          ;; # -l
1403
2051
        -L*)
1404
2052
          case $linkmode in
1405
2053
          lib)
1406
2054
            deplibs="$deplib $deplibs"
1407
 
            test $pass = conv && continue
 
2055
            test "$pass" = conv && continue
1408
2056
            newdependency_libs="$deplib $newdependency_libs"
1409
2057
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1410
2058
            ;;
1411
2059
          prog)
1412
 
            if test $pass = conv; then
 
2060
            if test "$pass" = conv; then
1413
2061
              deplibs="$deplib $deplibs"
1414
2062
              continue
1415
2063
            fi
1416
 
            if test $pass = scan; then
 
2064
            if test "$pass" = scan; then
1417
2065
              deplibs="$deplib $deplibs"
1418
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1419
2066
            else
1420
2067
              compile_deplibs="$deplib $compile_deplibs"
1421
2068
              finalize_deplibs="$deplib $finalize_deplibs"
1422
2069
            fi
 
2070
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1423
2071
            ;;
1424
2072
          *)
1425
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
2073
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1426
2074
            ;;
1427
2075
          esac # linkmode
1428
2076
          continue
1429
2077
          ;; # -L
1430
2078
        -R*)
1431
 
          if test $pass = link; then
 
2079
          if test "$pass" = link; then
1432
2080
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1433
2081
            # Make sure the xrpath contains only unique directories.
1434
2082
            case "$xrpath " in
1441
2089
          ;;
1442
2090
        *.la) lib="$deplib" ;;
1443
2091
        *.$libext)
1444
 
          if test $pass = conv; then
 
2092
          if test "$pass" = conv; then
1445
2093
            deplibs="$deplib $deplibs"
1446
2094
            continue
1447
2095
          fi
1448
2096
          case $linkmode in
1449
2097
          lib)
1450
 
            if test "$deplibs_check_method" != pass_all; then
1451
 
              echo
1452
 
              echo "*** Warning: This library needs some functionality provided by $deplib."
1453
 
              echo "*** I have the capability to make that library automatically link in when"
1454
 
              echo "*** you link to this library.  But I can only do this if you have a"
1455
 
              echo "*** shared version of the library, which you do not appear to have."
 
2098
            valid_a_lib=no
 
2099
            case $deplibs_check_method in
 
2100
              match_pattern*)
 
2101
                set dummy $deplibs_check_method
 
2102
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2103
                if eval $echo \"$deplib\" 2>/dev/null \
 
2104
                    | $SED 10q \
 
2105
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2106
                  valid_a_lib=yes
 
2107
                fi
 
2108
                ;;
 
2109
              pass_all)
 
2110
                valid_a_lib=yes
 
2111
                ;;
 
2112
            esac
 
2113
            if test "$valid_a_lib" != yes; then
 
2114
              $echo
 
2115
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
2116
              $echo "*** I have the capability to make that library automatically link in when"
 
2117
              $echo "*** you link to this library.  But I can only do this if you have a"
 
2118
              $echo "*** shared version of the library, which you do not appear to have"
 
2119
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
2120
              $echo "*** that it is just a static archive that I should not used here."
1456
2121
            else
1457
 
              echo
1458
 
              echo "*** Warning: Linking the shared library $output against the"
1459
 
              echo "*** static library $deplib is not portable!"
 
2122
              $echo
 
2123
              $echo "*** Warning: Linking the shared library $output against the"
 
2124
              $echo "*** static library $deplib is not portable!"
1460
2125
              deplibs="$deplib $deplibs"
1461
2126
            fi
1462
2127
            continue
1463
2128
            ;;
1464
2129
          prog)
1465
 
            if test $pass != link; then
 
2130
            if test "$pass" != link; then
1466
2131
              deplibs="$deplib $deplibs"
1467
2132
            else
1468
2133
              compile_deplibs="$deplib $compile_deplibs"
1473
2138
          esac # linkmode
1474
2139
          ;; # *.$libext
1475
2140
        *.lo | *.$objext)
1476
 
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1477
 
            # If there is no dlopen support or we're linking statically,
1478
 
            # we need to preload.
1479
 
            newdlprefiles="$newdlprefiles $deplib"
1480
 
            compile_deplibs="$deplib $compile_deplibs"
1481
 
            finalize_deplibs="$deplib $finalize_deplibs"
1482
 
          else
1483
 
            newdlfiles="$newdlfiles $deplib"
 
2141
          if test "$pass" = conv; then
 
2142
            deplibs="$deplib $deplibs"
 
2143
          elif test "$linkmode" = prog; then
 
2144
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2145
              # If there is no dlopen support or we're linking statically,
 
2146
              # we need to preload.
 
2147
              newdlprefiles="$newdlprefiles $deplib"
 
2148
              compile_deplibs="$deplib $compile_deplibs"
 
2149
              finalize_deplibs="$deplib $finalize_deplibs"
 
2150
            else
 
2151
              newdlfiles="$newdlfiles $deplib"
 
2152
            fi
1484
2153
          fi
1485
2154
          continue
1486
2155
          ;;
1489
2158
          continue
1490
2159
          ;;
1491
2160
        esac # case $deplib
1492
 
        if test $found = yes || test -f "$lib"; then :
 
2161
        if test "$found" = yes || test -f "$lib"; then :
1493
2162
        else
1494
2163
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1495
 
          exit 1
 
2164
          exit $EXIT_FAILURE
1496
2165
        fi
1497
2166
 
1498
2167
        # Check to see that this really is a libtool archive.
1499
 
        if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2168
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1500
2169
        else
1501
2170
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1502
 
          exit 1
 
2171
          exit $EXIT_FAILURE
1503
2172
        fi
1504
2173
 
1505
2174
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1512
2181
        library_names=
1513
2182
        old_library=
1514
2183
        # If the library was installed with an old release of libtool,
1515
 
        # it will not redefine variable installed.
 
2184
        # it will not redefine variables installed, or shouldnotlink
1516
2185
        installed=yes
 
2186
        shouldnotlink=no
1517
2187
 
1518
2188
        # Read the .la file
1519
2189
        case $lib in
1523
2193
 
1524
2194
        if test "$linkmode,$pass" = "lib,link" ||
1525
2195
           test "$linkmode,$pass" = "prog,scan" ||
1526
 
           { test $linkmode = oldlib && test $linkmode = obj; }; then
1527
 
           # Add dl[pre]opened files of deplib
 
2196
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1528
2197
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1529
2198
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1530
2199
        fi
1531
2200
 
1532
 
        if test $pass = conv; then
 
2201
        if test "$pass" = conv; then
1533
2202
          # Only check for convenience libraries
1534
2203
          deplibs="$lib $deplibs"
1535
2204
          if test -z "$libdir"; then
1536
2205
            if test -z "$old_library"; then
1537
2206
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1538
 
              exit 1
 
2207
              exit $EXIT_FAILURE
1539
2208
            fi
1540
2209
            # It is a libtool convenience library, so add in its objects.
1541
2210
            convenience="$convenience $ladir/$objdir/$old_library"
1543
2212
            tmp_libs=
1544
2213
            for deplib in $dependency_libs; do
1545
2214
              deplibs="$deplib $deplibs"
1546
 
              case "$tmp_libs " in
1547
 
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1548
 
              esac
 
2215
              if test "X$duplicate_deps" = "Xyes" ; then
 
2216
                case "$tmp_libs " in
 
2217
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2218
                esac
 
2219
              fi
1549
2220
              tmp_libs="$tmp_libs $deplib"
1550
2221
            done
1551
 
          elif test $linkmode != prog && test $linkmode != lib; then
 
2222
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1552
2223
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1553
 
            exit 1
 
2224
            exit $EXIT_FAILURE
1554
2225
          fi
1555
2226
          continue
1556
2227
        fi # $pass = conv
1557
2228
 
 
2229
 
1558
2230
        # Get the name of the library we link against.
1559
2231
        linklib=
1560
2232
        for l in $old_library $library_names; do
1562
2234
        done
1563
2235
        if test -z "$linklib"; then
1564
2236
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1565
 
          exit 1
 
2237
          exit $EXIT_FAILURE
1566
2238
        fi
1567
2239
 
1568
2240
        # This library was specified with -dlopen.
1569
 
        if test $pass = dlopen; then
 
2241
        if test "$pass" = dlopen; then
1570
2242
          if test -z "$libdir"; then
1571
2243
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1572
 
            exit 1
 
2244
            exit $EXIT_FAILURE
1573
2245
          fi
1574
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2246
          if test -z "$dlname" ||
 
2247
             test "$dlopen_support" != yes ||
 
2248
             test "$build_libtool_libs" = no; then
1575
2249
            # If there is no dlname, no dlopen support or we're linking
1576
 
            # statically, we need to preload.
1577
 
            dlprefiles="$dlprefiles $lib"
 
2250
            # statically, we need to preload.  We also need to preload any
 
2251
            # dependent libraries so libltdl's deplib preloader doesn't
 
2252
            # bomb out in the load deplibs phase.
 
2253
            dlprefiles="$dlprefiles $lib $dependency_libs"
1578
2254
          else
1579
2255
            newdlfiles="$newdlfiles $lib"
1580
2256
          fi
1607
2283
            absdir="$libdir"
1608
2284
          fi
1609
2285
        else
1610
 
          dir="$ladir/$objdir"
1611
 
          absdir="$abs_ladir/$objdir"
1612
 
          # Remove this search path later
1613
 
          notinst_path="$notinst_path $abs_ladir"
 
2286
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2287
            dir="$ladir"
 
2288
            absdir="$abs_ladir"
 
2289
            # Remove this search path later
 
2290
            notinst_path="$notinst_path $abs_ladir"
 
2291
          else
 
2292
            dir="$ladir/$objdir"
 
2293
            absdir="$abs_ladir/$objdir"
 
2294
            # Remove this search path later
 
2295
            notinst_path="$notinst_path $abs_ladir"
 
2296
          fi
1614
2297
        fi # $installed = yes
1615
2298
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1616
2299
 
1617
2300
        # This library was specified with -dlpreopen.
1618
 
        if test $pass = dlpreopen; then
 
2301
        if test "$pass" = dlpreopen; then
1619
2302
          if test -z "$libdir"; then
1620
2303
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1621
 
            exit 1
 
2304
            exit $EXIT_FAILURE
1622
2305
          fi
1623
2306
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1624
2307
          # are required to link).
1634
2317
 
1635
2318
        if test -z "$libdir"; then
1636
2319
          # Link the convenience library
1637
 
          if test $linkmode = lib; then
 
2320
          if test "$linkmode" = lib; then
1638
2321
            deplibs="$dir/$old_library $deplibs"
1639
2322
          elif test "$linkmode,$pass" = "prog,link"; then
1640
2323
            compile_deplibs="$dir/$old_library $compile_deplibs"
1641
2324
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1642
2325
          else
1643
 
            deplibs="$lib $deplibs"
 
2326
            deplibs="$lib $deplibs" # used for prog,scan pass
1644
2327
          fi
1645
2328
          continue
1646
2329
        fi
1647
2330
 
1648
 
        if test $linkmode = prog && test $pass != link; then
 
2331
 
 
2332
        if test "$linkmode" = prog && test "$pass" != link; then
1649
2333
          newlib_search_path="$newlib_search_path $ladir"
1650
2334
          deplibs="$lib $deplibs"
1651
2335
 
1661
2345
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1662
2346
            esac
1663
2347
            # Need to link against all dependency_libs?
1664
 
            if test $linkalldeplibs = yes; then
 
2348
            if test "$linkalldeplibs" = yes; then
1665
2349
              deplibs="$deplib $deplibs"
1666
2350
            else
1667
2351
              # Need to hardcode shared library paths
1668
2352
              # or/and link against static libraries
1669
2353
              newdependency_libs="$deplib $newdependency_libs"
1670
2354
            fi
1671
 
            case "$tmp_libs " in
1672
 
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1673
 
            esac
 
2355
            if test "X$duplicate_deps" = "Xyes" ; then
 
2356
              case "$tmp_libs " in
 
2357
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2358
              esac
 
2359
            fi
1674
2360
            tmp_libs="$tmp_libs $deplib"
1675
2361
          done # for deplib
1676
2362
          continue
1677
2363
        fi # $linkmode = prog...
1678
2364
 
 
2365
        if test "$linkmode,$pass" = "prog,link"; then
 
2366
          if test -n "$library_names" &&
 
2367
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2368
            # We need to hardcode the library path
 
2369
            if test -n "$shlibpath_var"; then
 
2370
              # Make sure the rpath contains only unique directories.
 
2371
              case "$temp_rpath " in
 
2372
              *" $dir "*) ;;
 
2373
              *" $absdir "*) ;;
 
2374
              *) temp_rpath="$temp_rpath $dir" ;;
 
2375
              esac
 
2376
            fi
 
2377
 
 
2378
            # Hardcode the library path.
 
2379
            # Skip directories that are in the system default run-time
 
2380
            # search path.
 
2381
            case " $sys_lib_dlsearch_path " in
 
2382
            *" $absdir "*) ;;
 
2383
            *)
 
2384
              case "$compile_rpath " in
 
2385
              *" $absdir "*) ;;
 
2386
              *) compile_rpath="$compile_rpath $absdir"
 
2387
              esac
 
2388
              ;;
 
2389
            esac
 
2390
            case " $sys_lib_dlsearch_path " in
 
2391
            *" $libdir "*) ;;
 
2392
            *)
 
2393
              case "$finalize_rpath " in
 
2394
              *" $libdir "*) ;;
 
2395
              *) finalize_rpath="$finalize_rpath $libdir"
 
2396
              esac
 
2397
              ;;
 
2398
            esac
 
2399
          fi # $linkmode,$pass = prog,link...
 
2400
 
 
2401
          if test "$alldeplibs" = yes &&
 
2402
             { test "$deplibs_check_method" = pass_all ||
 
2403
               { test "$build_libtool_libs" = yes &&
 
2404
                 test -n "$library_names"; }; }; then
 
2405
            # We only need to search for static libraries
 
2406
            continue
 
2407
          fi
 
2408
        fi
 
2409
 
1679
2410
        link_static=no # Whether the deplib will be linked statically
1680
2411
        if test -n "$library_names" &&
1681
2412
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1682
 
          # Link against this shared library
1683
 
 
1684
 
          if test "$linkmode,$pass" = "prog,link" ||
1685
 
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1686
 
            # Hardcode the library path.
1687
 
            # Skip directories that are in the system default run-time
1688
 
            # search path.
1689
 
            case " $sys_lib_dlsearch_path " in
1690
 
            *" $absdir "*) ;;
1691
 
            *)
1692
 
              case "$compile_rpath " in
1693
 
              *" $absdir "*) ;;
1694
 
              *) compile_rpath="$compile_rpath $absdir"
1695
 
              esac
1696
 
              ;;
1697
 
            esac
1698
 
            case " $sys_lib_dlsearch_path " in
1699
 
            *" $libdir "*) ;;
1700
 
            *)
1701
 
              case "$finalize_rpath " in
1702
 
              *" $libdir "*) ;;
1703
 
              *) finalize_rpath="$finalize_rpath $libdir"
1704
 
              esac
1705
 
              ;;
1706
 
            esac
1707
 
            if test $linkmode = prog; then
1708
 
              # We need to hardcode the library path
1709
 
              if test -n "$shlibpath_var"; then
1710
 
                # Make sure the rpath contains only unique directories.
1711
 
                case "$temp_rpath " in
1712
 
                *" $dir "*) ;;
1713
 
                *" $absdir "*) ;;
1714
 
                *) temp_rpath="$temp_rpath $dir" ;;
1715
 
                esac
1716
 
              fi
1717
 
            fi
1718
 
          fi # $linkmode,$pass = prog,link...
1719
 
 
1720
 
          if test "$alldeplibs" = yes &&
1721
 
             { test "$deplibs_check_method" = pass_all ||
1722
 
               { test "$build_libtool_libs" = yes &&
1723
 
                 test -n "$library_names"; }; }; then
1724
 
            # We only need to search for static libraries
1725
 
            continue
1726
 
          fi
1727
 
 
1728
2413
          if test "$installed" = no; then
1729
2414
            notinst_deplibs="$notinst_deplibs $lib"
1730
2415
            need_relink=yes
1731
2416
          fi
 
2417
          # This is a shared library
 
2418
 
 
2419
          # Warn about portability, can't link against -module's on
 
2420
          # some systems (darwin)
 
2421
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2422
            $echo
 
2423
            if test "$linkmode" = prog; then
 
2424
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
2425
            else
 
2426
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
2427
            fi
 
2428
            $echo "*** $linklib is not portable!"
 
2429
          fi
 
2430
          if test "$linkmode" = lib &&
 
2431
             test "$hardcode_into_libs" = yes; then
 
2432
            # Hardcode the library path.
 
2433
            # Skip directories that are in the system default run-time
 
2434
            # search path.
 
2435
            case " $sys_lib_dlsearch_path " in
 
2436
            *" $absdir "*) ;;
 
2437
            *)
 
2438
              case "$compile_rpath " in
 
2439
              *" $absdir "*) ;;
 
2440
              *) compile_rpath="$compile_rpath $absdir"
 
2441
              esac
 
2442
              ;;
 
2443
            esac
 
2444
            case " $sys_lib_dlsearch_path " in
 
2445
            *" $libdir "*) ;;
 
2446
            *)
 
2447
              case "$finalize_rpath " in
 
2448
              *" $libdir "*) ;;
 
2449
              *) finalize_rpath="$finalize_rpath $libdir"
 
2450
              esac
 
2451
              ;;
 
2452
            esac
 
2453
          fi
1732
2454
 
1733
2455
          if test -n "$old_archive_from_expsyms_cmds"; then
1734
2456
            # figure out the soname
1742
2464
            elif test -n "$soname_spec"; then
1743
2465
              # bleh windows
1744
2466
              case $host in
1745
 
              *cygwin*)
 
2467
              *cygwin* | mingw*)
1746
2468
                major=`expr $current - $age`
1747
2469
                versuffix="-$major"
1748
2470
                ;;
1754
2476
 
1755
2477
            # Make a new name for the extract_expsyms_cmds to use
1756
2478
            soroot="$soname"
1757
 
            soname=`echo $soroot | sed -e 's/^.*\///'`
1758
 
            newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
 
2479
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2480
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1759
2481
 
1760
2482
            # If the library has no export list, then create one now
1761
2483
            if test -f "$output_objdir/$soname-def"; then :
1762
2484
            else
1763
2485
              $show "extracting exported symbol list from \`$soname'"
1764
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
1765
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2486
              save_ifs="$IFS"; IFS='~'
 
2487
              cmds=$extract_expsyms_cmds
1766
2488
              for cmd in $cmds; do
1767
2489
                IFS="$save_ifs"
 
2490
                eval cmd=\"$cmd\"
1768
2491
                $show "$cmd"
1769
2492
                $run eval "$cmd" || exit $?
1770
2493
              done
1774
2497
            # Create $newlib
1775
2498
            if test -f "$output_objdir/$newlib"; then :; else
1776
2499
              $show "generating import library for \`$soname'"
1777
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
1778
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2500
              save_ifs="$IFS"; IFS='~'
 
2501
              cmds=$old_archive_from_expsyms_cmds
1779
2502
              for cmd in $cmds; do
1780
2503
                IFS="$save_ifs"
 
2504
                eval cmd=\"$cmd\"
1781
2505
                $show "$cmd"
1782
2506
                $run eval "$cmd" || exit $?
1783
2507
              done
1786
2510
            # make sure the library variables are pointing to the new library
1787
2511
            dir=$output_objdir
1788
2512
            linklib=$newlib
1789
 
          fi # test -n $old_archive_from_expsyms_cmds
 
2513
          fi # test -n "$old_archive_from_expsyms_cmds"
1790
2514
 
1791
 
          if test $linkmode = prog || test "$mode" != relink; then
 
2515
          if test "$linkmode" = prog || test "$mode" != relink; then
1792
2516
            add_shlibpath=
1793
2517
            add_dir=
1794
2518
            add=
1797
2521
            immediate | unsupported)
1798
2522
              if test "$hardcode_direct" = no; then
1799
2523
                add="$dir/$linklib"
 
2524
                case $host in
 
2525
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2526
                  *-*-darwin* )
 
2527
                    # if the lib is a module then we can not link against
 
2528
                    # it, someone is ignoring the new warnings I added
 
2529
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2530
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2531
                      if test -z "$old_library" ; then
 
2532
                        $echo
 
2533
                        $echo "** And there doesn't seem to be a static archive available"
 
2534
                        $echo "** The link will probably fail, sorry"
 
2535
                      else
 
2536
                        add="$dir/$old_library"
 
2537
                      fi
 
2538
                    fi
 
2539
                esac
1800
2540
              elif test "$hardcode_minus_L" = no; then
1801
2541
                case $host in
1802
2542
                *-*-sunos*) add_shlibpath="$dir" ;;
1815
2555
                add="$dir/$linklib"
1816
2556
              elif test "$hardcode_minus_L" = yes; then
1817
2557
                add_dir="-L$dir"
 
2558
                # Try looking first in the location we're being installed to.
 
2559
                if test -n "$inst_prefix_dir"; then
 
2560
                  case "$libdir" in
 
2561
                    [\\/]*)
 
2562
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2563
                      ;;
 
2564
                  esac
 
2565
                fi
1818
2566
                add="-l$name"
1819
2567
              elif test "$hardcode_shlibpath_var" = yes; then
1820
2568
                add_shlibpath="$dir"
1828
2576
 
1829
2577
            if test "$lib_linked" != yes; then
1830
2578
              $echo "$modename: configuration error: unsupported hardcode properties"
1831
 
              exit 1
 
2579
              exit $EXIT_FAILURE
1832
2580
            fi
1833
2581
 
1834
2582
            if test -n "$add_shlibpath"; then
1837
2585
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1838
2586
              esac
1839
2587
            fi
1840
 
            if test $linkmode = prog; then
 
2588
            if test "$linkmode" = prog; then
1841
2589
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1842
2590
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1843
2591
            else
1854
2602
            fi
1855
2603
          fi
1856
2604
 
1857
 
          if test $linkmode = prog || test "$mode" = relink; then
 
2605
          if test "$linkmode" = prog || test "$mode" = relink; then
1858
2606
            add_shlibpath=
1859
2607
            add_dir=
1860
2608
            add=
1862
2610
            if test "$hardcode_direct" = yes; then
1863
2611
              add="$libdir/$linklib"
1864
2612
            elif test "$hardcode_minus_L" = yes; then
1865
 
              # Try looking first in the location we're being installed to.
1866
 
              add_dir=
1867
 
              if test -n "$inst_prefix_dir"; then
1868
 
                case "$libdir" in
1869
 
                [\\/]*)
1870
 
                  add_dir="-L$inst_prefix_dir$libdir"
1871
 
                  ;;
1872
 
                esac
1873
 
              fi
1874
 
              add_dir="$add_dir -L$libdir"
 
2613
              add_dir="-L$libdir"
1875
2614
              add="-l$name"
1876
2615
            elif test "$hardcode_shlibpath_var" = yes; then
1877
2616
              case :$finalize_shlibpath: in
1879
2618
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1880
2619
              esac
1881
2620
              add="-l$name"
 
2621
            elif test "$hardcode_automatic" = yes; then
 
2622
              if test -n "$inst_prefix_dir" &&
 
2623
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2624
                add="$inst_prefix_dir$libdir/$linklib"
 
2625
              else
 
2626
                add="$libdir/$linklib"
 
2627
              fi
1882
2628
            else
1883
2629
              # We cannot seem to hardcode it, guess we'll fake it.
1884
 
              # Try looking first in the location we're being installed to.
1885
 
              add_dir=
1886
 
              if test -n "$inst_prefix_dir"; then
1887
 
                case "$libdir" in
1888
 
                [\\/]*)
1889
 
                  add_dir="-L$inst_prefix_dir$libdir"
1890
 
                  ;;
1891
 
                esac
1892
 
              fi
1893
 
              add_dir="$add_dir -L$libdir"
1894
 
 
 
2630
              add_dir="-L$libdir"
 
2631
              # Try looking first in the location we're being installed to.
 
2632
              if test -n "$inst_prefix_dir"; then
 
2633
                case "$libdir" in
 
2634
                  [\\/]*)
 
2635
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2636
                    ;;
 
2637
                esac
 
2638
              fi
1895
2639
              add="-l$name"
1896
2640
            fi
1897
2641
 
1903
2647
              test -n "$add" && deplibs="$add $deplibs"
1904
2648
            fi
1905
2649
          fi
1906
 
        elif test $linkmode = prog; then
1907
 
          if test "$alldeplibs" = yes &&
1908
 
             { test "$deplibs_check_method" = pass_all ||
1909
 
               { test "$build_libtool_libs" = yes &&
1910
 
                 test -n "$library_names"; }; }; then
1911
 
            # We only need to search for static libraries
1912
 
            continue
1913
 
          fi
1914
 
 
1915
 
          # Try to link the static library
 
2650
        elif test "$linkmode" = prog; then
1916
2651
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1917
2652
          # is not unsupported.  This is valid on all known static and
1918
2653
          # shared platforms.
1932
2667
 
1933
2668
            # Just print a warning and add the library to dependency_libs so
1934
2669
            # that the program can be linked against the static library.
1935
 
            echo
1936
 
            echo "*** Warning: This library needs some functionality provided by $lib."
1937
 
            echo "*** I have the capability to make that library automatically link in when"
1938
 
            echo "*** you link to this library.  But I can only do this if you have a"
1939
 
            echo "*** shared version of the library, which you do not appear to have."
 
2670
            $echo
 
2671
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2672
            $echo "*** I have the capability to make that library automatically link in when"
 
2673
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2674
            $echo "*** shared version of the library, which you do not appear to have."
1940
2675
            if test "$module" = yes; then
1941
 
              echo "*** Therefore, libtool will create a static module, that should work "
1942
 
              echo "*** as long as the dlopening application is linked with the -dlopen flag."
 
2676
              $echo "*** But as you try to build a module library, libtool will still create "
 
2677
              $echo "*** a static module, that should work as long as the dlopening application"
 
2678
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1943
2679
              if test -z "$global_symbol_pipe"; then
1944
 
                echo
1945
 
                echo "*** However, this would only work if libtool was able to extract symbol"
1946
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1947
 
                echo "*** not find such a program.  So, this module is probably useless."
1948
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2680
                $echo
 
2681
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2682
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2683
                $echo "*** not find such a program.  So, this module is probably useless."
 
2684
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
1949
2685
              fi
1950
2686
              if test "$build_old_libs" = no; then
1951
 
                build_libtool_libs=module
1952
 
                build_old_libs=yes
 
2687
                build_libtool_libs=module
 
2688
                build_old_libs=yes
1953
2689
              else
1954
 
                build_libtool_libs=no
 
2690
                build_libtool_libs=no
1955
2691
              fi
1956
2692
            fi
1957
2693
          else
1962
2698
          fi
1963
2699
        fi # link shared/static library?
1964
2700
 
1965
 
        if test $linkmode = lib; then
 
2701
        if test "$linkmode" = lib; then
1966
2702
          if test -n "$dependency_libs" &&
1967
 
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1968
 
               test $link_static = yes; }; then
 
2703
             { test "$hardcode_into_libs" != yes ||
 
2704
               test "$build_old_libs" = yes ||
 
2705
               test "$link_static" = yes; }; then
1969
2706
            # Extract -R from dependency_libs
1970
2707
            temp_deplibs=
1971
2708
            for libdir in $dependency_libs; do
1988
2725
          tmp_libs=
1989
2726
          for deplib in $dependency_libs; do
1990
2727
            newdependency_libs="$deplib $newdependency_libs"
1991
 
            case "$tmp_libs " in
1992
 
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1993
 
            esac
 
2728
            if test "X$duplicate_deps" = "Xyes" ; then
 
2729
              case "$tmp_libs " in
 
2730
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2731
              esac
 
2732
            fi
1994
2733
            tmp_libs="$tmp_libs $deplib"
1995
2734
          done
1996
2735
 
1997
 
          if test $link_all_deplibs != no; then
 
2736
          if test "$link_all_deplibs" != no; then
1998
2737
            # Add the search paths of all dependency libraries
1999
2738
            for deplib in $dependency_libs; do
2000
2739
              case $deplib in
2014
2753
                  ;;
2015
2754
                esac
2016
2755
                if grep "^installed=no" $deplib > /dev/null; then
2017
 
                  path="-L$absdir/$objdir"
 
2756
                  path="$absdir/$objdir"
2018
2757
                else
2019
 
                  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
2758
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2020
2759
                  if test -z "$libdir"; then
2021
2760
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2022
 
                    exit 1
 
2761
                    exit $EXIT_FAILURE
2023
2762
                  fi
2024
2763
                  if test "$absdir" != "$libdir"; then
2025
2764
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2026
2765
                  fi
2027
 
                  path="-L$absdir"
 
2766
                  path="$absdir"
2028
2767
                fi
 
2768
                depdepl=
 
2769
                case $host in
 
2770
                *-*-darwin*)
 
2771
                  # we do not want to link against static libs,
 
2772
                  # but need to link against shared
 
2773
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2774
                  if test -n "$deplibrary_names" ; then
 
2775
                    for tmp in $deplibrary_names ; do
 
2776
                      depdepl=$tmp
 
2777
                    done
 
2778
                    if test -f "$path/$depdepl" ; then
 
2779
                      depdepl="$path/$depdepl"
 
2780
                    fi
 
2781
                    # do not add paths which are already there
 
2782
                    case " $newlib_search_path " in
 
2783
                    *" $path "*) ;;
 
2784
                    *) newlib_search_path="$newlib_search_path $path";;
 
2785
                    esac
 
2786
                  fi
 
2787
                  path=""
 
2788
                  ;;
 
2789
                *)
 
2790
                  path="-L$path"
 
2791
                  ;;
 
2792
                esac
 
2793
                ;;
 
2794
              -l*)
 
2795
                case $host in
 
2796
                *-*-darwin*)
 
2797
                  # Again, we only want to link against shared libraries
 
2798
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2799
                  for tmp in $newlib_search_path ; do
 
2800
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2801
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2802
                      break
 
2803
                    fi
 
2804
                  done
 
2805
                  path=""
 
2806
                  ;;
 
2807
                *) continue ;;
 
2808
                esac
2029
2809
                ;;
2030
2810
              *) continue ;;
2031
2811
              esac
2032
2812
              case " $deplibs " in
 
2813
              *" $depdepl "*) ;;
 
2814
              *) deplibs="$depdepl $deplibs" ;;
 
2815
              esac
 
2816
              case " $deplibs " in
2033
2817
              *" $path "*) ;;
2034
2818
              *) deplibs="$deplibs $path" ;;
2035
2819
              esac
2037
2821
          fi # link_all_deplibs != no
2038
2822
        fi # linkmode = lib
2039
2823
      done # for deplib in $libs
2040
 
      if test $pass = dlpreopen; then
 
2824
      dependency_libs="$newdependency_libs"
 
2825
      if test "$pass" = dlpreopen; then
2041
2826
        # Link the dlpreopened libraries before other libraries
2042
2827
        for deplib in $save_deplibs; do
2043
2828
          deplibs="$deplib $deplibs"
2044
2829
        done
2045
2830
      fi
2046
 
      if test $pass != dlopen; then
2047
 
        test $pass != scan && dependency_libs="$newdependency_libs"
2048
 
        if test $pass != conv; then
 
2831
      if test "$pass" != dlopen; then
 
2832
        if test "$pass" != conv; then
2049
2833
          # Make sure lib_search_path contains only unique directories.
2050
2834
          lib_search_path=
2051
2835
          for dir in $newlib_search_path; do
2067
2851
          eval tmp_libs=\"\$$var\"
2068
2852
          new_libs=
2069
2853
          for deplib in $tmp_libs; do
 
2854
            # FIXME: Pedantically, this is the right thing to do, so
 
2855
            #        that some nasty dependency loop isn't accidentally
 
2856
            #        broken:
 
2857
            #new_libs="$deplib $new_libs"
 
2858
            # Pragmatically, this seems to cause very few problems in
 
2859
            # practice:
2070
2860
            case $deplib in
2071
2861
            -L*) new_libs="$deplib $new_libs" ;;
 
2862
            -R*) ;;
2072
2863
            *)
 
2864
              # And here is the reason: when a library appears more
 
2865
              # than once as an explicit dependence of a library, or
 
2866
              # is implicitly linked in more than once by the
 
2867
              # compiler, it is considered special, and multiple
 
2868
              # occurrences thereof are not removed.  Compare this
 
2869
              # with having the same library being listed as a
 
2870
              # dependency of multiple other libraries: in this case,
 
2871
              # we know (pedantically, we assume) the library does not
 
2872
              # need to be listed more than once, so we keep only the
 
2873
              # last copy.  This is not always right, but it is rare
 
2874
              # enough that we require users that really mean to play
 
2875
              # such unportable linking tricks to link the library
 
2876
              # using -Wl,-lname, so that libtool does not consider it
 
2877
              # for duplicate removal.
2073
2878
              case " $specialdeplibs " in
2074
2879
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2075
2880
              *)
2097
2902
          eval $var=\"$tmp_libs\"
2098
2903
        done # for var
2099
2904
      fi
2100
 
      if test "$pass" = "conv" &&
2101
 
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2102
 
        libs="$deplibs" # reset libs
2103
 
        deplibs=
2104
 
      fi
 
2905
      # Last step: remove runtime libs from dependency_libs
 
2906
      # (they stay in deplibs)
 
2907
      tmp_libs=
 
2908
      for i in $dependency_libs ; do
 
2909
        case " $predeps $postdeps $compiler_lib_search_path " in
 
2910
        *" $i "*)
 
2911
          i=""
 
2912
          ;;
 
2913
        esac
 
2914
        if test -n "$i" ; then
 
2915
          tmp_libs="$tmp_libs $i"
 
2916
        fi
 
2917
      done
 
2918
      dependency_libs=$tmp_libs
2105
2919
    done # for pass
2106
 
    if test $linkmode = prog; then
 
2920
    if test "$linkmode" = prog; then
2107
2921
      dlfiles="$newdlfiles"
2108
2922
      dlprefiles="$newdlprefiles"
2109
2923
    fi
2110
2924
 
2111
2925
    case $linkmode in
2112
2926
    oldlib)
 
2927
      if test -n "$deplibs"; then
 
2928
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
 
2929
      fi
 
2930
 
2113
2931
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2114
2932
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2115
2933
      fi
2123
2941
      fi
2124
2942
 
2125
2943
      if test -n "$vinfo"; then
2126
 
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
2944
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2127
2945
      fi
2128
2946
 
2129
2947
      if test -n "$release"; then
2145
2963
      case $outputname in
2146
2964
      lib*)
2147
2965
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
2966
        eval shared_ext=\"$shrext_cmds\"
2148
2967
        eval libname=\"$libname_spec\"
2149
2968
        ;;
2150
2969
      *)
2151
2970
        if test "$module" = no; then
2152
2971
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2153
2972
          $echo "$help" 1>&2
2154
 
          exit 1
 
2973
          exit $EXIT_FAILURE
2155
2974
        fi
2156
2975
        if test "$need_lib_prefix" != no; then
2157
2976
          # Add the "lib" prefix for modules if required
2158
2977
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
2978
          eval shared_ext=\"$shrext_cmds\"
2159
2979
          eval libname=\"$libname_spec\"
2160
2980
        else
2161
2981
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2166
2986
      if test -n "$objs"; then
2167
2987
        if test "$deplibs_check_method" != pass_all; then
2168
2988
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2169
 
          exit 1
 
2989
          exit $EXIT_FAILURE
2170
2990
        else
2171
 
          echo
2172
 
          echo "*** Warning: Linking the shared library $output against the non-libtool"
2173
 
          echo "*** objects $objs is not portable!"
 
2991
          $echo
 
2992
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
2993
          $echo "*** objects $objs is not portable!"
2174
2994
          libobjs="$libobjs $objs"
2175
2995
        fi
2176
2996
      fi
2180
3000
      fi
2181
3001
 
2182
3002
      set dummy $rpath
2183
 
      if test $# -gt 2; then
 
3003
      if test "$#" -gt 2; then
2184
3004
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2185
3005
      fi
2186
3006
      install_libdir="$2"
2189
3009
      if test -z "$rpath"; then
2190
3010
        if test "$build_libtool_libs" = yes; then
2191
3011
          # Building a libtool convenience library.
2192
 
          libext=al
 
3012
          # Some compilers have problems with a `.al' extension so
 
3013
          # convenience libraries should have the same extension an
 
3014
          # archive normally would.
2193
3015
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2194
3016
          build_libtool_libs=convenience
2195
3017
          build_old_libs=yes
2196
3018
        fi
2197
3019
 
2198
3020
        if test -n "$vinfo"; then
2199
 
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
3021
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2200
3022
        fi
2201
3023
 
2202
3024
        if test -n "$release"; then
2205
3027
      else
2206
3028
 
2207
3029
        # Parse the version information argument.
2208
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
 
3030
        save_ifs="$IFS"; IFS=':'
2209
3031
        set dummy $vinfo 0 0 0
2210
3032
        IFS="$save_ifs"
2211
3033
 
2212
3034
        if test -n "$8"; then
2213
3035
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2214
3036
          $echo "$help" 1>&2
2215
 
          exit 1
 
3037
          exit $EXIT_FAILURE
2216
3038
        fi
2217
3039
 
2218
 
        current="$2"
2219
 
        revision="$3"
2220
 
        age="$4"
 
3040
        # convert absolute version numbers to libtool ages
 
3041
        # this retains compatibility with .la files and attempts
 
3042
        # to make the code below a bit more comprehensible
 
3043
 
 
3044
        case $vinfo_number in
 
3045
        yes)
 
3046
          number_major="$2"
 
3047
          number_minor="$3"
 
3048
          number_revision="$4"
 
3049
          #
 
3050
          # There are really only two kinds -- those that
 
3051
          # use the current revision as the major version
 
3052
          # and those that subtract age and use age as
 
3053
          # a minor version.  But, then there is irix
 
3054
          # which has an extra 1 added just for fun
 
3055
          #
 
3056
          case $version_type in
 
3057
          darwin|linux|osf|windows)
 
3058
            current=`expr $number_major + $number_minor`
 
3059
            age="$number_minor"
 
3060
            revision="$number_revision"
 
3061
            ;;
 
3062
          freebsd-aout|freebsd-elf|sunos)
 
3063
            current="$number_major"
 
3064
            revision="$number_minor"
 
3065
            age="0"
 
3066
            ;;
 
3067
          irix|nonstopux)
 
3068
            current=`expr $number_major + $number_minor - 1`
 
3069
            age="$number_minor"
 
3070
            revision="$number_minor"
 
3071
            ;;
 
3072
          esac
 
3073
          ;;
 
3074
        no)
 
3075
          current="$2"
 
3076
          revision="$3"
 
3077
          age="$4"
 
3078
          ;;
 
3079
        esac
2221
3080
 
2222
3081
        # Check that each of the things are valid numbers.
2223
3082
        case $current in
2224
 
        [0-9]*) ;;
 
3083
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2225
3084
        *)
2226
3085
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2227
3086
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2228
 
          exit 1
 
3087
          exit $EXIT_FAILURE
2229
3088
          ;;
2230
3089
        esac
2231
3090
 
2232
3091
        case $revision in
2233
 
        [0-9]*) ;;
 
3092
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2234
3093
        *)
2235
3094
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2236
3095
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2237
 
          exit 1
 
3096
          exit $EXIT_FAILURE
2238
3097
          ;;
2239
3098
        esac
2240
3099
 
2241
3100
        case $age in
2242
 
        [0-9]*) ;;
 
3101
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2243
3102
        *)
2244
3103
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2245
3104
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2246
 
          exit 1
 
3105
          exit $EXIT_FAILURE
2247
3106
          ;;
2248
3107
        esac
2249
3108
 
2250
 
        if test $age -gt $current; then
 
3109
        if test "$age" -gt "$current"; then
2251
3110
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2252
3111
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2253
 
          exit 1
 
3112
          exit $EXIT_FAILURE
2254
3113
        fi
2255
3114
 
2256
3115
        # Calculate the version variables.
2267
3126
          versuffix="$major.$age.$revision"
2268
3127
          # Darwin ld doesn't like 0 for these options...
2269
3128
          minor_current=`expr $current + 1`
2270
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3129
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2271
3130
          ;;
2272
3131
 
2273
3132
        freebsd-aout)
2280
3139
          versuffix=".$current";
2281
3140
          ;;
2282
3141
 
2283
 
        irix)
 
3142
        irix | nonstopux)
2284
3143
          major=`expr $current - $age + 1`
2285
 
          verstring="sgi$major.$revision"
 
3144
 
 
3145
          case $version_type in
 
3146
            nonstopux) verstring_prefix=nonstopux ;;
 
3147
            *)         verstring_prefix=sgi ;;
 
3148
          esac
 
3149
          verstring="$verstring_prefix$major.$revision"
2286
3150
 
2287
3151
          # Add in all the interfaces that we are compatible with.
2288
3152
          loop=$revision
2289
 
          while test $loop != 0; do
 
3153
          while test "$loop" -ne 0; do
2290
3154
            iface=`expr $revision - $loop`
2291
3155
            loop=`expr $loop - 1`
2292
 
            verstring="sgi$major.$iface:$verstring"
 
3156
            verstring="$verstring_prefix$major.$iface:$verstring"
2293
3157
          done
2294
3158
 
2295
3159
          # Before this point, $major must not contain `.'.
2303
3167
          ;;
2304
3168
 
2305
3169
        osf)
2306
 
          major=`expr $current - $age`
 
3170
          major=.`expr $current - $age`
2307
3171
          versuffix=".$current.$age.$revision"
2308
3172
          verstring="$current.$age.$revision"
2309
3173
 
2310
3174
          # Add in all the interfaces that we are compatible with.
2311
3175
          loop=$age
2312
 
          while test $loop != 0; do
 
3176
          while test "$loop" -ne 0; do
2313
3177
            iface=`expr $current - $loop`
2314
3178
            loop=`expr $loop - 1`
2315
3179
            verstring="$verstring:${iface}.0"
2333
3197
 
2334
3198
        *)
2335
3199
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2336
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2337
 
          exit 1
 
3200
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3201
          exit $EXIT_FAILURE
2338
3202
          ;;
2339
3203
        esac
2340
3204
 
2341
3205
        # Clear the version info if we defaulted, and they specified a release.
2342
3206
        if test -z "$vinfo" && test -n "$release"; then
2343
3207
          major=
2344
 
          verstring="0.0"
 
3208
          case $version_type in
 
3209
          darwin)
 
3210
            # we can't check for "0.0" in archive_cmds due to quoting
 
3211
            # problems, so we reset it completely
 
3212
            verstring=
 
3213
            ;;
 
3214
          *)
 
3215
            verstring="0.0"
 
3216
            ;;
 
3217
          esac
2345
3218
          if test "$need_version" = no; then
2346
3219
            versuffix=
2347
3220
          else
2370
3243
      fi
2371
3244
 
2372
3245
      if test "$mode" != relink; then
2373
 
        # Remove our outputs.
2374
 
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2375
 
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
 
3246
        # Remove our outputs, but don't remove object files since they
 
3247
        # may have been created when compiling PIC objects.
 
3248
        removelist=
 
3249
        tempremovelist=`$echo "$output_objdir/*"`
 
3250
        for p in $tempremovelist; do
 
3251
          case $p in
 
3252
            *.$objext)
 
3253
               ;;
 
3254
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3255
               if test "X$precious_files_regex" != "X"; then
 
3256
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3257
                 then
 
3258
                   continue
 
3259
                 fi
 
3260
               fi
 
3261
               removelist="$removelist $p"
 
3262
               ;;
 
3263
            *) ;;
 
3264
          esac
 
3265
        done
 
3266
        if test -n "$removelist"; then
 
3267
          $show "${rm}r $removelist"
 
3268
          $run ${rm}r $removelist
 
3269
        fi
2376
3270
      fi
2377
3271
 
2378
3272
      # Now set the variables for building old libraries.
2385
3279
 
2386
3280
      # Eliminate all temporary directories.
2387
3281
      for path in $notinst_path; do
2388
 
        lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2389
 
        deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2390
 
        dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
 
3282
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3283
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3284
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2391
3285
      done
2392
3286
 
2393
3287
      if test -n "$xrpath"; then
2400
3294
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2401
3295
          esac
2402
3296
        done
2403
 
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
3297
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2404
3298
          dependency_libs="$temp_xrpath $dependency_libs"
2405
3299
        fi
2406
3300
      fi
2438
3332
          *-*-netbsd*)
2439
3333
            # Don't link with libc until the a.out ld.so is fixed.
2440
3334
            ;;
2441
 
          *)
 
3335
          *-*-openbsd* | *-*-freebsd*)
 
3336
            # Do not include libc due to us having libc/libc_r.
 
3337
            test "X$arg" = "X-lc" && continue
 
3338
            ;;
 
3339
          *)
2442
3340
            # Add libc to deplibs on all other systems if necessary.
2443
 
            if test $build_libtool_need_lc = "yes"; then
 
3341
            if test "$build_libtool_need_lc" = "yes"; then
2444
3342
              deplibs="$deplibs -lc"
2445
3343
            fi
2446
3344
            ;;
2467
3365
          # This might be a little naive.  We might want to check
2468
3366
          # whether the library exists or not.  But this is on
2469
3367
          # osf3 & osf4 and I'm not really sure... Just
2470
 
          # implementing what was already the behaviour.
 
3368
          # implementing what was already the behavior.
2471
3369
          newdeplibs=$deplibs
2472
3370
          ;;
2473
3371
        test_compile)
2480
3378
          int main() { return 0; }
2481
3379
EOF
2482
3380
          $rm conftest
2483
 
          $CC -o conftest conftest.c $deplibs
2484
 
          if test $? -eq 0 ; then
 
3381
          $LTCC -o conftest conftest.c $deplibs
 
3382
          if test "$?" -eq 0 ; then
2485
3383
            ldd_output=`ldd conftest`
2486
3384
            for i in $deplibs; do
2487
3385
              name="`expr $i : '-l\(.*\)'`"
2488
3386
              # If $name is empty we are operating on a -L argument.
2489
 
              if test -n "$name" && test "$name" != "0"; then
2490
 
                libname=`eval \\$echo \"$libname_spec\"`
2491
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2492
 
                set dummy $deplib_matches
2493
 
                deplib_match=$2
2494
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2495
 
                  newdeplibs="$newdeplibs $i"
2496
 
                else
2497
 
                  droppeddeps=yes
2498
 
                  echo
2499
 
                  echo "*** Warning: This library needs some functionality provided by $i."
2500
 
                  echo "*** I have the capability to make that library automatically link in when"
2501
 
                  echo "*** you link to this library.  But I can only do this if you have a"
2502
 
                  echo "*** shared version of the library, which you do not appear to have."
2503
 
                fi
2504
 
              else
2505
 
                newdeplibs="$newdeplibs $i"
2506
 
              fi
2507
 
            done
2508
 
          else
2509
 
            # Error occured in the first compile.  Let's try to salvage the situation:
2510
 
            # Compile a seperate program for each library.
2511
 
            for i in $deplibs; do
2512
 
              name="`expr $i : '-l\(.*\)'`"
2513
 
             # If $name is empty we are operating on a -L argument.
2514
 
              if test -n "$name" && test "$name" != "0"; then
2515
 
                $rm conftest
2516
 
                $CC -o conftest conftest.c $i
2517
 
                # Did it work?
2518
 
                if test $? -eq 0 ; then
2519
 
                  ldd_output=`ldd conftest`
 
3387
              if test "$name" != "" && test "$name" -ne "0"; then
 
3388
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3389
                  case " $predeps $postdeps " in
 
3390
                  *" $i "*)
 
3391
                    newdeplibs="$newdeplibs $i"
 
3392
                    i=""
 
3393
                    ;;
 
3394
                  esac
 
3395
                fi
 
3396
                if test -n "$i" ; then
2520
3397
                  libname=`eval \\$echo \"$libname_spec\"`
2521
3398
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2522
3399
                  set dummy $deplib_matches
2525
3402
                    newdeplibs="$newdeplibs $i"
2526
3403
                  else
2527
3404
                    droppeddeps=yes
2528
 
                    echo
2529
 
                    echo "*** Warning: This library needs some functionality provided by $i."
2530
 
                    echo "*** I have the capability to make that library automatically link in when"
2531
 
                    echo "*** you link to this library.  But I can only do this if you have a"
2532
 
                    echo "*** shared version of the library, which you do not appear to have."
 
3405
                    $echo
 
3406
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3407
                    $echo "*** I have the capability to make that library automatically link in when"
 
3408
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3409
                    $echo "*** shared version of the library, which I believe you do not have"
 
3410
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3411
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3412
                  fi
 
3413
                fi
 
3414
              else
 
3415
                newdeplibs="$newdeplibs $i"
 
3416
              fi
 
3417
            done
 
3418
          else
 
3419
            # Error occurred in the first compile.  Let's try to salvage
 
3420
            # the situation: Compile a separate program for each library.
 
3421
            for i in $deplibs; do
 
3422
              name="`expr $i : '-l\(.*\)'`"
 
3423
              # If $name is empty we are operating on a -L argument.
 
3424
              if test "$name" != "" && test "$name" != "0"; then
 
3425
                $rm conftest
 
3426
                $LTCC -o conftest conftest.c $i
 
3427
                # Did it work?
 
3428
                if test "$?" -eq 0 ; then
 
3429
                  ldd_output=`ldd conftest`
 
3430
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3431
                    case " $predeps $postdeps " in
 
3432
                    *" $i "*)
 
3433
                      newdeplibs="$newdeplibs $i"
 
3434
                      i=""
 
3435
                      ;;
 
3436
                    esac
 
3437
                  fi
 
3438
                  if test -n "$i" ; then
 
3439
                    libname=`eval \\$echo \"$libname_spec\"`
 
3440
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3441
                    set dummy $deplib_matches
 
3442
                    deplib_match=$2
 
3443
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3444
                      newdeplibs="$newdeplibs $i"
 
3445
                    else
 
3446
                      droppeddeps=yes
 
3447
                      $echo
 
3448
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3449
                      $echo "*** I have the capability to make that library automatically link in when"
 
3450
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3451
                      $echo "*** shared version of the library, which you do not appear to have"
 
3452
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3453
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3454
                    fi
2533
3455
                  fi
2534
3456
                else
2535
3457
                  droppeddeps=yes
2536
 
                  echo
2537
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2538
 
                  echo "***  make it link in!  You will probably need to install it or some"
2539
 
                  echo "*** library that it depends on before this library will be fully"
2540
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3458
                  $echo
 
3459
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3460
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3461
                  $echo "*** library that it depends on before this library will be fully"
 
3462
                  $echo "*** functional.  Installing it before continuing would be even better."
2541
3463
                fi
2542
3464
              else
2543
3465
                newdeplibs="$newdeplibs $i"
2551
3473
          for a_deplib in $deplibs; do
2552
3474
            name="`expr $a_deplib : '-l\(.*\)'`"
2553
3475
            # If $name is empty we are operating on a -L argument.
2554
 
            if test -n "$name" && test "$name" != "0"; then
2555
 
              libname=`eval \\$echo \"$libname_spec\"`
2556
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2557
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2558
 
                    for potent_lib in $potential_libs; do
 
3476
            if test "$name" != "" && test  "$name" != "0"; then
 
3477
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3478
                case " $predeps $postdeps " in
 
3479
                *" $a_deplib "*)
 
3480
                  newdeplibs="$newdeplibs $a_deplib"
 
3481
                  a_deplib=""
 
3482
                  ;;
 
3483
                esac
 
3484
              fi
 
3485
              if test -n "$a_deplib" ; then
 
3486
                libname=`eval \\$echo \"$libname_spec\"`
 
3487
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3488
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3489
                  for potent_lib in $potential_libs; do
2559
3490
                      # Follow soft links.
2560
3491
                      if ls -lLd "$potent_lib" 2>/dev/null \
2561
3492
                         | grep " -> " >/dev/null; then
2568
3499
                      # but so what?
2569
3500
                      potlib="$potent_lib"
2570
3501
                      while test -h "$potlib" 2>/dev/null; do
2571
 
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
 
3502
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2572
3503
                        case $potliblink in
2573
3504
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2574
3505
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2575
3506
                        esac
2576
3507
                      done
2577
3508
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2578
 
                         | sed 10q \
2579
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3509
                         | ${SED} 10q \
 
3510
                         | $EGREP "$file_magic_regex" > /dev/null; then
2580
3511
                        newdeplibs="$newdeplibs $a_deplib"
2581
3512
                        a_deplib=""
2582
3513
                        break 2
2583
3514
                      fi
2584
 
                    done
2585
 
              done
 
3515
                  done
 
3516
                done
 
3517
              fi
2586
3518
              if test -n "$a_deplib" ; then
2587
3519
                droppeddeps=yes
2588
 
                echo
2589
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
2590
 
                echo "*** I have the capability to make that library automatically link in when"
2591
 
                echo "*** you link to this library.  But I can only do this if you have a"
2592
 
                echo "*** shared version of the library, which you do not appear to have."
 
3520
                $echo
 
3521
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3522
                $echo "*** I have the capability to make that library automatically link in when"
 
3523
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3524
                $echo "*** shared version of the library, which you do not appear to have"
 
3525
                $echo "*** because I did check the linker path looking for a file starting"
 
3526
                if test -z "$potlib" ; then
 
3527
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3528
                else
 
3529
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3530
                  $echo "*** using a file magic. Last file checked: $potlib"
 
3531
                fi
2593
3532
              fi
2594
3533
            else
2595
3534
              # Add a -L argument.
2604
3543
            name="`expr $a_deplib : '-l\(.*\)'`"
2605
3544
            # If $name is empty we are operating on a -L argument.
2606
3545
            if test -n "$name" && test "$name" != "0"; then
2607
 
              libname=`eval \\$echo \"$libname_spec\"`
2608
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2609
 
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2610
 
                for potent_lib in $potential_libs; do
2611
 
                  if eval echo \"$potent_lib\" 2>/dev/null \
2612
 
                      | sed 10q \
2613
 
                      | egrep "$match_pattern_regex" > /dev/null; then
2614
 
                    newdeplibs="$newdeplibs $a_deplib"
2615
 
                    a_deplib=""
2616
 
                    break 2
2617
 
                  fi
 
3546
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3547
                case " $predeps $postdeps " in
 
3548
                *" $a_deplib "*)
 
3549
                  newdeplibs="$newdeplibs $a_deplib"
 
3550
                  a_deplib=""
 
3551
                  ;;
 
3552
                esac
 
3553
              fi
 
3554
              if test -n "$a_deplib" ; then
 
3555
                libname=`eval \\$echo \"$libname_spec\"`
 
3556
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3557
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3558
                  for potent_lib in $potential_libs; do
 
3559
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3560
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3561
                        | ${SED} 10q \
 
3562
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3563
                      newdeplibs="$newdeplibs $a_deplib"
 
3564
                      a_deplib=""
 
3565
                      break 2
 
3566
                    fi
 
3567
                  done
2618
3568
                done
2619
 
              done
 
3569
              fi
2620
3570
              if test -n "$a_deplib" ; then
2621
3571
                droppeddeps=yes
2622
 
                echo
2623
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
2624
 
                echo "*** I have the capability to make that library automatically link in when"
2625
 
                echo "*** you link to this library.  But I can only do this if you have a"
2626
 
                echo "*** shared version of the library, which you do not appear to have."
 
3572
                $echo
 
3573
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3574
                $echo "*** I have the capability to make that library automatically link in when"
 
3575
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3576
                $echo "*** shared version of the library, which you do not appear to have"
 
3577
                $echo "*** because I did check the linker path looking for a file starting"
 
3578
                if test -z "$potlib" ; then
 
3579
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3580
                else
 
3581
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3582
                  $echo "*** using a regex pattern. Last file checked: $potlib"
 
3583
                fi
2627
3584
              fi
2628
3585
            else
2629
3586
              # Add a -L argument.
2633
3590
          ;;
2634
3591
        none | unknown | *)
2635
3592
          newdeplibs=""
2636
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2637
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2638
 
             grep . >/dev/null; then
2639
 
            echo
 
3593
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3594
            -e 's/ -[LR][^ ]*//g'`
 
3595
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3596
            for i in $predeps $postdeps ; do
 
3597
              # can't use Xsed below, because $i might contain '/'
 
3598
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3599
            done
 
3600
          fi
 
3601
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3602
            | grep . >/dev/null; then
 
3603
            $echo
2640
3604
            if test "X$deplibs_check_method" = "Xnone"; then
2641
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3605
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2642
3606
            else
2643
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3607
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2644
3608
            fi
2645
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3609
            $echo "*** All declared inter-library dependencies are being dropped."
2646
3610
            droppeddeps=yes
2647
3611
          fi
2648
3612
          ;;
2662
3626
 
2663
3627
        if test "$droppeddeps" = yes; then
2664
3628
          if test "$module" = yes; then
2665
 
            echo
2666
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2667
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2668
 
            echo "*** a static module, that should work as long as the dlopening"
2669
 
            echo "*** application is linked with the -dlopen flag."
 
3629
            $echo
 
3630
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3631
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3632
            $echo "*** a static module, that should work as long as the dlopening"
 
3633
            $echo "*** application is linked with the -dlopen flag."
2670
3634
            if test -z "$global_symbol_pipe"; then
2671
 
              echo
2672
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2673
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2674
 
              echo "*** not find such a program.  So, this module is probably useless."
2675
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3635
              $echo
 
3636
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3637
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3638
              $echo "*** not find such a program.  So, this module is probably useless."
 
3639
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2676
3640
            fi
2677
3641
            if test "$build_old_libs" = no; then
2678
3642
              oldlibs="$output_objdir/$libname.$libext"
2682
3646
              build_libtool_libs=no
2683
3647
            fi
2684
3648
          else
2685
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2686
 
            echo "*** automatically added whenever a program is linked with this library"
2687
 
            echo "*** or is declared to -dlopen it."
 
3649
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3650
            $echo "*** automatically added whenever a program is linked with this library"
 
3651
            $echo "*** or is declared to -dlopen it."
2688
3652
 
2689
 
            if test $allow_undefined = no; then
2690
 
              echo
2691
 
              echo "*** Since this library must not contain undefined symbols,"
2692
 
              echo "*** because either the platform does not support them or"
2693
 
              echo "*** it was explicitly requested with -no-undefined,"
2694
 
              echo "*** libtool will only create a static version of it."
 
3653
            if test "$allow_undefined" = no; then
 
3654
              $echo
 
3655
              $echo "*** Since this library must not contain undefined symbols,"
 
3656
              $echo "*** because either the platform does not support them or"
 
3657
              $echo "*** it was explicitly requested with -no-undefined,"
 
3658
              $echo "*** libtool will only create a static version of it."
2695
3659
              if test "$build_old_libs" = no; then
2696
3660
                oldlibs="$output_objdir/$libname.$libext"
2697
3661
                build_libtool_libs=module
2713
3677
 
2714
3678
      # Test again, we may have decided not to build it any more
2715
3679
      if test "$build_libtool_libs" = yes; then
2716
 
        if test $hardcode_into_libs = yes; then
 
3680
        if test "$hardcode_into_libs" = yes; then
2717
3681
          # Hardcode the library paths
2718
3682
          hardcode_libdirs=
2719
3683
          dep_rpath=
2749
3713
          if test -n "$hardcode_libdir_separator" &&
2750
3714
             test -n "$hardcode_libdirs"; then
2751
3715
            libdir="$hardcode_libdirs"
2752
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3716
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3717
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3718
            else
 
3719
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3720
            fi
2753
3721
          fi
2754
3722
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2755
3723
            # We should set the runpath_var.
2769
3737
        fi
2770
3738
 
2771
3739
        # Get the real and link names of the library.
 
3740
        eval shared_ext=\"$shrext_cmds\"
2772
3741
        eval library_names=\"$library_names_spec\"
2773
3742
        set dummy $library_names
2774
3743
        realname="$2"
2779
3748
        else
2780
3749
          soname="$realname"
2781
3750
        fi
2782
 
        test -z "$dlname" && dlname=$soname
 
3751
        if test -z "$dlname"; then
 
3752
          dlname=$soname
 
3753
        fi
2783
3754
 
2784
3755
        lib="$output_objdir/$realname"
2785
3756
        for link
2787
3758
          linknames="$linknames $link"
2788
3759
        done
2789
3760
 
2790
 
        # Ensure that we have .o objects for linkers which dislike .lo
2791
 
        # (e.g. aix) in case we are running --disable-static
2792
 
        for obj in $libobjs; do
2793
 
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2794
 
          if test "X$xdir" = "X$obj"; then
2795
 
            xdir="."
2796
 
          else
2797
 
            xdir="$xdir"
2798
 
          fi
2799
 
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2800
 
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2801
 
          if test ! -f $xdir/$oldobj; then
2802
 
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2803
 
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2804
 
          fi
2805
 
        done
2806
 
 
2807
3761
        # Use standard objects if they are pic
2808
3762
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2809
3763
 
2813
3767
            $show "generating symbol list for \`$libname.la'"
2814
3768
            export_symbols="$output_objdir/$libname.exp"
2815
3769
            $run $rm $export_symbols
2816
 
            eval cmds=\"$export_symbols_cmds\"
2817
 
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
 
3770
            cmds=$export_symbols_cmds
 
3771
            save_ifs="$IFS"; IFS='~'
2818
3772
            for cmd in $cmds; do
2819
3773
              IFS="$save_ifs"
2820
 
              $show "$cmd"
2821
 
              $run eval "$cmd" || exit $?
 
3774
              eval cmd=\"$cmd\"
 
3775
              if len=`expr "X$cmd" : ".*"` &&
 
3776
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3777
                $show "$cmd"
 
3778
                $run eval "$cmd" || exit $?
 
3779
                skipped_export=false
 
3780
              else
 
3781
                # The command line is too long to execute in one step.
 
3782
                $show "using reloadable object file for export list..."
 
3783
                skipped_export=:
 
3784
              fi
2822
3785
            done
2823
3786
            IFS="$save_ifs"
2824
3787
            if test -n "$export_symbols_regex"; then
2825
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2826
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
3788
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3789
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2827
3790
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2828
3791
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2829
3792
            fi
2834
3797
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2835
3798
        fi
2836
3799
 
 
3800
        tmp_deplibs=
 
3801
        for test_deplib in $deplibs; do
 
3802
                case " $convenience " in
 
3803
                *" $test_deplib "*) ;;
 
3804
                *)
 
3805
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3806
                        ;;
 
3807
                esac
 
3808
        done
 
3809
        deplibs="$tmp_deplibs"
 
3810
 
2837
3811
        if test -n "$convenience"; then
2838
3812
          if test -n "$whole_archive_flag_spec"; then
 
3813
            save_libobjs=$libobjs
2839
3814
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2840
3815
          else
2841
3816
            gentop="$output_objdir/${outputname}x"
2842
 
            $show "${rm}r $gentop"
2843
 
            $run ${rm}r "$gentop"
2844
 
            $show "mkdir $gentop"
2845
 
            $run mkdir "$gentop"
2846
 
            status=$?
2847
 
            if test $status -ne 0 && test ! -d "$gentop"; then
2848
 
              exit $status
2849
 
            fi
2850
3817
            generated="$generated $gentop"
2851
3818
 
2852
 
            for xlib in $convenience; do
2853
 
              # Extract the objects.
2854
 
              case $xlib in
2855
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2856
 
              *) xabs=`pwd`"/$xlib" ;;
2857
 
              esac
2858
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2859
 
              xdir="$gentop/$xlib"
2860
 
 
2861
 
              $show "${rm}r $xdir"
2862
 
              $run ${rm}r "$xdir"
2863
 
              $show "mkdir $xdir"
2864
 
              $run mkdir "$xdir"
2865
 
              status=$?
2866
 
              if test $status -ne 0 && test ! -d "$xdir"; then
2867
 
                exit $status
2868
 
              fi
2869
 
              $show "(cd $xdir && $AR x $xabs)"
2870
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2871
 
 
2872
 
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2873
 
            done
 
3819
            func_extract_archives $gentop $convenience
 
3820
            libobjs="$libobjs $func_extract_archives_result"
2874
3821
          fi
2875
3822
        fi
2876
 
 
 
3823
        
2877
3824
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2878
3825
          eval flag=\"$thread_safe_flag_spec\"
2879
3826
          linker_flags="$linker_flags $flag"
2885
3832
        fi
2886
3833
 
2887
3834
        # Do each of the archive commands.
 
3835
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3836
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3837
            eval test_cmds=\"$module_expsym_cmds\"
 
3838
            cmds=$module_expsym_cmds
 
3839
          else
 
3840
            eval test_cmds=\"$module_cmds\"
 
3841
            cmds=$module_cmds
 
3842
          fi
 
3843
        else
2888
3844
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2889
 
          eval cmds=\"$archive_expsym_cmds\"
2890
 
        else
2891
 
          eval cmds=\"$archive_cmds\"
2892
 
        fi
2893
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
3845
          eval test_cmds=\"$archive_expsym_cmds\"
 
3846
          cmds=$archive_expsym_cmds
 
3847
        else
 
3848
          eval test_cmds=\"$archive_cmds\"
 
3849
          cmds=$archive_cmds
 
3850
          fi
 
3851
        fi
 
3852
 
 
3853
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
3854
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3855
          :
 
3856
        else
 
3857
          # The command line is too long to link in one step, link piecewise.
 
3858
          $echo "creating reloadable object files..."
 
3859
 
 
3860
          # Save the value of $output and $libobjs because we want to
 
3861
          # use them later.  If we have whole_archive_flag_spec, we
 
3862
          # want to use save_libobjs as it was before
 
3863
          # whole_archive_flag_spec was expanded, because we can't
 
3864
          # assume the linker understands whole_archive_flag_spec.
 
3865
          # This may have to be revisited, in case too many
 
3866
          # convenience libraries get linked in and end up exceeding
 
3867
          # the spec.
 
3868
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
3869
            save_libobjs=$libobjs
 
3870
          fi
 
3871
          save_output=$output
 
3872
 
 
3873
          # Clear the reloadable object creation command queue and
 
3874
          # initialize k to one.
 
3875
          test_cmds=
 
3876
          concat_cmds=
 
3877
          objlist=
 
3878
          delfiles=
 
3879
          last_robj=
 
3880
          k=1
 
3881
          output=$output_objdir/$save_output-${k}.$objext
 
3882
          # Loop over the list of objects to be linked.
 
3883
          for obj in $save_libobjs
 
3884
          do
 
3885
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3886
            if test "X$objlist" = X ||
 
3887
               { len=`expr "X$test_cmds" : ".*"` &&
 
3888
                 test "$len" -le "$max_cmd_len"; }; then
 
3889
              objlist="$objlist $obj"
 
3890
            else
 
3891
              # The command $test_cmds is almost too long, add a
 
3892
              # command to the queue.
 
3893
              if test "$k" -eq 1 ; then
 
3894
                # The first file doesn't have a previous command to add.
 
3895
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3896
              else
 
3897
                # All subsequent reloadable object files will link in
 
3898
                # the last one created.
 
3899
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
 
3900
              fi
 
3901
              last_robj=$output_objdir/$save_output-${k}.$objext
 
3902
              k=`expr $k + 1`
 
3903
              output=$output_objdir/$save_output-${k}.$objext
 
3904
              objlist=$obj
 
3905
              len=1
 
3906
            fi
 
3907
          done
 
3908
          # Handle the remaining objects by creating one last
 
3909
          # reloadable object file.  All subsequent reloadable object
 
3910
          # files will link in the last one created.
 
3911
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
3912
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3913
 
 
3914
          if ${skipped_export-false}; then
 
3915
            $show "generating symbol list for \`$libname.la'"
 
3916
            export_symbols="$output_objdir/$libname.exp"
 
3917
            $run $rm $export_symbols
 
3918
            libobjs=$output
 
3919
            # Append the command to create the export file.
 
3920
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3921
          fi
 
3922
 
 
3923
          # Set up a command to remove the reloadale object files
 
3924
          # after they are used.
 
3925
          i=0
 
3926
          while test "$i" -lt "$k"
 
3927
          do
 
3928
            i=`expr $i + 1`
 
3929
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
3930
          done
 
3931
 
 
3932
          $echo "creating a temporary reloadable object file: $output"
 
3933
 
 
3934
          # Loop through the commands generated above and execute them.
 
3935
          save_ifs="$IFS"; IFS='~'
 
3936
          for cmd in $concat_cmds; do
 
3937
            IFS="$save_ifs"
 
3938
            $show "$cmd"
 
3939
            $run eval "$cmd" || exit $?
 
3940
          done
 
3941
          IFS="$save_ifs"
 
3942
 
 
3943
          libobjs=$output
 
3944
          # Restore the value of output.
 
3945
          output=$save_output
 
3946
 
 
3947
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
3948
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
3949
          fi
 
3950
          # Expand the library linking commands again to reset the
 
3951
          # value of $libobjs for piecewise linking.
 
3952
 
 
3953
          # Do each of the archive commands.
 
3954
          if test "$module" = yes && test -n "$module_cmds" ; then
 
3955
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3956
              cmds=$module_expsym_cmds
 
3957
            else
 
3958
              cmds=$module_cmds
 
3959
            fi
 
3960
          else
 
3961
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
3962
            cmds=$archive_expsym_cmds
 
3963
          else
 
3964
            cmds=$archive_cmds
 
3965
            fi
 
3966
          fi
 
3967
 
 
3968
          # Append the command to remove the reloadable object files
 
3969
          # to the just-reset $cmds.
 
3970
          eval cmds=\"\$cmds~\$rm $delfiles\"
 
3971
        fi
 
3972
        save_ifs="$IFS"; IFS='~'
2894
3973
        for cmd in $cmds; do
2895
3974
          IFS="$save_ifs"
 
3975
          eval cmd=\"$cmd\"
2896
3976
          $show "$cmd"
2897
3977
          $run eval "$cmd" || exit $?
2898
3978
        done
2901
3981
        # Restore the uninstalled library and exit
2902
3982
        if test "$mode" = relink; then
2903
3983
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2904
 
          exit 0
 
3984
          exit $EXIT_SUCCESS
2905
3985
        fi
2906
3986
 
2907
3987
        # Create links to the real library.
2949
4029
      *.lo)
2950
4030
        if test -n "$objs$old_deplibs"; then
2951
4031
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2952
 
          exit 1
 
4032
          exit $EXIT_FAILURE
2953
4033
        fi
2954
4034
        libobj="$output"
2955
4035
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2978
4058
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2979
4059
        else
2980
4060
          gentop="$output_objdir/${obj}x"
2981
 
          $show "${rm}r $gentop"
2982
 
          $run ${rm}r "$gentop"
2983
 
          $show "mkdir $gentop"
2984
 
          $run mkdir "$gentop"
2985
 
          status=$?
2986
 
          if test $status -ne 0 && test ! -d "$gentop"; then
2987
 
            exit $status
2988
 
          fi
2989
4061
          generated="$generated $gentop"
2990
4062
 
2991
 
          for xlib in $convenience; do
2992
 
            # Extract the objects.
2993
 
            case $xlib in
2994
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2995
 
            *) xabs=`pwd`"/$xlib" ;;
2996
 
            esac
2997
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2998
 
            xdir="$gentop/$xlib"
2999
 
 
3000
 
            $show "${rm}r $xdir"
3001
 
            $run ${rm}r "$xdir"
3002
 
            $show "mkdir $xdir"
3003
 
            $run mkdir "$xdir"
3004
 
            status=$?
3005
 
            if test $status -ne 0 && test ! -d "$xdir"; then
3006
 
              exit $status
3007
 
            fi
3008
 
            $show "(cd $xdir && $AR x $xabs)"
3009
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3010
 
 
3011
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3012
 
          done
 
4063
          func_extract_archives $gentop $convenience
 
4064
          reload_conv_objs="$reload_objs $func_extract_archives_result"
3013
4065
        fi
3014
4066
      fi
3015
4067
 
3017
4069
      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
3018
4070
 
3019
4071
      output="$obj"
3020
 
      eval cmds=\"$reload_cmds\"
3021
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
4072
      cmds=$reload_cmds
 
4073
      save_ifs="$IFS"; IFS='~'
3022
4074
      for cmd in $cmds; do
3023
4075
        IFS="$save_ifs"
 
4076
        eval cmd=\"$cmd\"
3024
4077
        $show "$cmd"
3025
4078
        $run eval "$cmd" || exit $?
3026
4079
      done
3033
4086
          $run ${rm}r $gentop
3034
4087
        fi
3035
4088
 
3036
 
        exit 0
 
4089
        exit $EXIT_SUCCESS
3037
4090
      fi
3038
4091
 
3039
4092
      if test "$build_libtool_libs" != yes; then
3044
4097
 
3045
4098
        # Create an invalid libtool object if no PIC, so that we don't
3046
4099
        # accidentally link it into a program.
3047
 
        $show "echo timestamp > $libobj"
3048
 
        $run eval "echo timestamp > $libobj" || exit $?
3049
 
        exit 0
 
4100
        # $show "echo timestamp > $libobj"
 
4101
        # $run eval "echo timestamp > $libobj" || exit $?
 
4102
        exit $EXIT_SUCCESS
3050
4103
      fi
3051
4104
 
3052
4105
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3053
4106
        # Only do commands if we really have different PIC objects.
3054
4107
        reload_objs="$libobjs $reload_conv_objs"
3055
4108
        output="$libobj"
3056
 
        eval cmds=\"$reload_cmds\"
3057
 
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
 
4109
        cmds=$reload_cmds
 
4110
        save_ifs="$IFS"; IFS='~'
3058
4111
        for cmd in $cmds; do
3059
4112
          IFS="$save_ifs"
 
4113
          eval cmd=\"$cmd\"
3060
4114
          $show "$cmd"
3061
4115
          $run eval "$cmd" || exit $?
3062
4116
        done
3063
4117
        IFS="$save_ifs"
3064
 
      else
3065
 
        # Just create a symlink.
3066
 
        $show $rm $libobj
3067
 
        $run $rm $libobj
3068
 
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3069
 
        if test "X$xdir" = "X$libobj"; then
3070
 
          xdir="."
3071
 
        else
3072
 
          xdir="$xdir"
3073
 
        fi
3074
 
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3075
 
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3076
 
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3077
 
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3078
4118
      fi
3079
4119
 
3080
4120
      if test -n "$gentop"; then
3082
4122
        $run ${rm}r $gentop
3083
4123
      fi
3084
4124
 
3085
 
      exit 0
 
4125
      exit $EXIT_SUCCESS
3086
4126
      ;;
3087
4127
 
3088
4128
    prog)
3089
4129
      case $host in
3090
 
        *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
 
4130
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3091
4131
      esac
3092
4132
      if test -n "$vinfo"; then
3093
4133
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3112
4152
        ;;
3113
4153
      esac
3114
4154
 
 
4155
      case $host in
 
4156
      *darwin*)
 
4157
        # Don't allow lazy linking, it breaks C++ global constructors
 
4158
        if test "$tagname" = CXX ; then
 
4159
        compile_command="$compile_command ${wl}-bind_at_load"
 
4160
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4161
        fi
 
4162
        ;;
 
4163
      esac
 
4164
 
3115
4165
      compile_command="$compile_command $compile_deplibs"
3116
4166
      finalize_command="$finalize_command $finalize_deplibs"
3117
4167
 
3262
4312
            done
3263
4313
 
3264
4314
            if test -n "$exclude_expsyms"; then
3265
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4315
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3266
4316
              $run eval '$mv "$nlist"T "$nlist"'
3267
4317
            fi
3268
4318
 
3269
4319
            if test -n "$export_symbols_regex"; then
3270
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4320
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3271
4321
              $run eval '$mv "$nlist"T "$nlist"'
3272
4322
            fi
3273
4323
 
3275
4325
            if test -z "$export_symbols"; then
3276
4326
              export_symbols="$output_objdir/$output.exp"
3277
4327
              $run $rm $export_symbols
3278
 
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4328
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3279
4329
            else
3280
 
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
 
4330
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3281
4331
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3282
4332
              $run eval 'mv "$nlist"T "$nlist"'
3283
4333
            fi
3285
4335
 
3286
4336
          for arg in $dlprefiles; do
3287
4337
            $show "extracting global C symbols from \`$arg'"
3288
 
            name=`echo "$arg" | sed -e 's%^.*/%%'`
3289
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4338
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4339
            $run eval '$echo ": $name " >> "$nlist"'
3290
4340
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3291
4341
          done
3292
4342
 
3295
4345
            test -f "$nlist" || : > "$nlist"
3296
4346
 
3297
4347
            if test -n "$exclude_expsyms"; then
3298
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4348
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3299
4349
              $mv "$nlist"T "$nlist"
3300
4350
            fi
3301
4351
 
3302
4352
            # Try sorting and uniquifying the output.
3303
 
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
4353
            if grep -v "^: " < "$nlist" |
 
4354
                if sort -k 3 </dev/null >/dev/null 2>&1; then
 
4355
                  sort -k 3
 
4356
                else
 
4357
                  sort +2
 
4358
                fi |
 
4359
                uniq > "$nlist"S; then
3304
4360
              :
3305
4361
            else
3306
4362
              grep -v "^: " < "$nlist" > "$nlist"S
3309
4365
            if test -f "$nlist"S; then
3310
4366
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3311
4367
            else
3312
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4368
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3313
4369
            fi
3314
4370
 
3315
4371
            $echo >> "$output_objdir/$dlsyms" "\
3317
4373
#undef lt_preloaded_symbols
3318
4374
 
3319
4375
#if defined (__STDC__) && __STDC__
3320
 
# define lt_ptr_t void *
 
4376
# define lt_ptr void *
3321
4377
#else
3322
 
# define lt_ptr_t char *
 
4378
# define lt_ptr char *
3323
4379
# define const
3324
4380
#endif
3325
4381
 
3326
4382
/* The mapping between symbol names and symbols. */
3327
4383
const struct {
3328
4384
  const char *name;
3329
 
  lt_ptr_t address;
 
4385
  lt_ptr address;
3330
4386
}
3331
4387
lt_preloaded_symbols[] =
3332
4388
{\
3333
4389
"
3334
4390
 
3335
 
            sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
3336
 
                -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
3337
 
                  < "$nlist" >> "$output_objdir/$dlsyms"
 
4391
            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3338
4392
 
3339
4393
            $echo >> "$output_objdir/$dlsyms" "\
3340
 
  {0, (lt_ptr_t) 0}
 
4394
  {0, (lt_ptr) 0}
3341
4395
};
3342
4396
 
3343
4397
/* This works around a problem in FreeBSD linker */
3363
4417
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3364
4418
            case "$compile_command " in
3365
4419
            *" -static "*) ;;
3366
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4420
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3367
4421
            esac;;
3368
4422
          *-*-hpux*)
3369
4423
            case "$compile_command " in
3370
4424
            *" -static "*) ;;
3371
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4425
            *) pic_flag_for_symtable=" $pic_flag";;
3372
4426
            esac
3373
4427
          esac
3374
4428
 
3375
4429
          # Now compile the dynamic symbol file.
3376
 
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3377
 
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4430
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4431
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3378
4432
 
3379
4433
          # Clean up the generated files.
3380
4434
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3386
4440
          ;;
3387
4441
        *)
3388
4442
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3389
 
          exit 1
 
4443
          exit $EXIT_FAILURE
3390
4444
          ;;
3391
4445
        esac
3392
4446
      else
3399
4453
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3400
4454
      fi
3401
4455
 
3402
 
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
4456
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3403
4457
        # Replace the output file specification.
3404
4458
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3405
4459
        link_command="$compile_command$compile_rpath"
3474
4528
        # Link the executable and exit
3475
4529
        $show "$link_command"
3476
4530
        $run eval "$link_command" || exit $?
3477
 
        exit 0
 
4531
        exit $EXIT_SUCCESS
3478
4532
      fi
3479
4533
 
3480
4534
      if test "$hardcode_action" = relink; then
3524
4578
            relink_command="$var=\"$var_value\"; export $var; $relink_command"
3525
4579
          fi
3526
4580
        done
3527
 
        relink_command="cd `pwd`; $relink_command"
 
4581
        relink_command="(cd `pwd`; $relink_command)"
3528
4582
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3529
4583
      fi
3530
4584
 
3531
4585
      # Quote $echo for shipping.
3532
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3533
 
        case $0 in
3534
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3535
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4586
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4587
        case $progpath in
 
4588
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4589
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
3536
4590
        esac
3537
4591
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3538
4592
      else
3544
4598
        # win32 will think the script is a binary if it has
3545
4599
        # a .exe suffix, so we strip it off here.
3546
4600
        case $output in
3547
 
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
4601
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3548
4602
        esac
3549
4603
        # test for cygwin because mv fails w/o .exe extensions
3550
4604
        case $host in
3551
 
          *cygwin*) exeext=.exe ;;
 
4605
          *cygwin*)
 
4606
            exeext=.exe
 
4607
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3552
4608
          *) exeext= ;;
3553
4609
        esac
 
4610
        case $host in
 
4611
          *cygwin* | *mingw* )
 
4612
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
 
4613
            cwrapper=`$echo ${output}.exe`
 
4614
            $rm $cwrappersource $cwrapper
 
4615
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4616
 
 
4617
            cat > $cwrappersource <<EOF
 
4618
 
 
4619
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4620
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4621
 
 
4622
   The $output program cannot be directly executed until all the libtool
 
4623
   libraries that it depends on are installed.
 
4624
 
 
4625
   This wrapper executable should never be moved out of the build directory.
 
4626
   If it is, it will not operate correctly.
 
4627
 
 
4628
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4629
   but could eventually absorb all of the scripts functionality and
 
4630
   exec $objdir/$outputname directly.
 
4631
*/
 
4632
EOF
 
4633
            cat >> $cwrappersource<<"EOF"
 
4634
#include <stdio.h>
 
4635
#include <stdlib.h>
 
4636
#include <unistd.h>
 
4637
#include <malloc.h>
 
4638
#include <stdarg.h>
 
4639
#include <assert.h>
 
4640
 
 
4641
#if defined(PATH_MAX)
 
4642
# define LT_PATHMAX PATH_MAX
 
4643
#elif defined(MAXPATHLEN)
 
4644
# define LT_PATHMAX MAXPATHLEN
 
4645
#else
 
4646
# define LT_PATHMAX 1024
 
4647
#endif
 
4648
 
 
4649
#ifndef DIR_SEPARATOR
 
4650
#define DIR_SEPARATOR '/'
 
4651
#endif
 
4652
 
 
4653
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4654
  defined (__OS2__)
 
4655
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4656
#ifndef DIR_SEPARATOR_2
 
4657
#define DIR_SEPARATOR_2 '\\'
 
4658
#endif
 
4659
#endif
 
4660
 
 
4661
#ifndef DIR_SEPARATOR_2
 
4662
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4663
#else /* DIR_SEPARATOR_2 */
 
4664
# define IS_DIR_SEPARATOR(ch) \
 
4665
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4666
#endif /* DIR_SEPARATOR_2 */
 
4667
 
 
4668
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4669
#define XFREE(stale) do { \
 
4670
  if (stale) { free ((void *) stale); stale = 0; } \
 
4671
} while (0)
 
4672
 
 
4673
const char *program_name = NULL;
 
4674
 
 
4675
void * xmalloc (size_t num);
 
4676
char * xstrdup (const char *string);
 
4677
char * basename (const char *name);
 
4678
char * fnqualify(const char *path);
 
4679
char * strendzap(char *str, const char *pat);
 
4680
void lt_fatal (const char *message, ...);
 
4681
 
 
4682
int
 
4683
main (int argc, char *argv[])
 
4684
{
 
4685
  char **newargz;
 
4686
  int i;
 
4687
 
 
4688
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4689
  newargz = XMALLOC(char *, argc+2);
 
4690
EOF
 
4691
 
 
4692
            cat >> $cwrappersource <<EOF
 
4693
  newargz[0] = "$SHELL";
 
4694
EOF
 
4695
 
 
4696
            cat >> $cwrappersource <<"EOF"
 
4697
  newargz[1] = fnqualify(argv[0]);
 
4698
  /* we know the script has the same name, without the .exe */
 
4699
  /* so make sure newargz[1] doesn't end in .exe */
 
4700
  strendzap(newargz[1],".exe");
 
4701
  for (i = 1; i < argc; i++)
 
4702
    newargz[i+1] = xstrdup(argv[i]);
 
4703
  newargz[argc+1] = NULL;
 
4704
EOF
 
4705
 
 
4706
            cat >> $cwrappersource <<EOF
 
4707
  execv("$SHELL",newargz);
 
4708
EOF
 
4709
 
 
4710
            cat >> $cwrappersource <<"EOF"
 
4711
}
 
4712
 
 
4713
void *
 
4714
xmalloc (size_t num)
 
4715
{
 
4716
  void * p = (void *) malloc (num);
 
4717
  if (!p)
 
4718
    lt_fatal ("Memory exhausted");
 
4719
 
 
4720
  return p;
 
4721
}
 
4722
 
 
4723
char *
 
4724
xstrdup (const char *string)
 
4725
{
 
4726
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4727
;
 
4728
}
 
4729
 
 
4730
char *
 
4731
basename (const char *name)
 
4732
{
 
4733
  const char *base;
 
4734
 
 
4735
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4736
  /* Skip over the disk name in MSDOS pathnames. */
 
4737
  if (isalpha (name[0]) && name[1] == ':')
 
4738
    name += 2;
 
4739
#endif
 
4740
 
 
4741
  for (base = name; *name; name++)
 
4742
    if (IS_DIR_SEPARATOR (*name))
 
4743
      base = name + 1;
 
4744
  return (char *) base;
 
4745
}
 
4746
 
 
4747
char *
 
4748
fnqualify(const char *path)
 
4749
{
 
4750
  size_t size;
 
4751
  char *p;
 
4752
  char tmp[LT_PATHMAX + 1];
 
4753
 
 
4754
  assert(path != NULL);
 
4755
 
 
4756
  /* Is it qualified already? */
 
4757
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4758
  if (isalpha (path[0]) && path[1] == ':')
 
4759
    return xstrdup (path);
 
4760
#endif
 
4761
  if (IS_DIR_SEPARATOR (path[0]))
 
4762
    return xstrdup (path);
 
4763
 
 
4764
  /* prepend the current directory */
 
4765
  /* doesn't handle '~' */
 
4766
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4767
    lt_fatal ("getcwd failed");
 
4768
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4769
  p = XMALLOC(char, size);
 
4770
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4771
  return p;
 
4772
}
 
4773
 
 
4774
char *
 
4775
strendzap(char *str, const char *pat)
 
4776
{
 
4777
  size_t len, patlen;
 
4778
 
 
4779
  assert(str != NULL);
 
4780
  assert(pat != NULL);
 
4781
 
 
4782
  len = strlen(str);
 
4783
  patlen = strlen(pat);
 
4784
 
 
4785
  if (patlen <= len)
 
4786
  {
 
4787
    str += len - patlen;
 
4788
    if (strcmp(str, pat) == 0)
 
4789
      *str = '\0';
 
4790
  }
 
4791
  return str;
 
4792
}
 
4793
 
 
4794
static void
 
4795
lt_error_core (int exit_status, const char * mode,
 
4796
          const char * message, va_list ap)
 
4797
{
 
4798
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4799
  vfprintf (stderr, message, ap);
 
4800
  fprintf (stderr, ".\n");
 
4801
 
 
4802
  if (exit_status >= 0)
 
4803
    exit (exit_status);
 
4804
}
 
4805
 
 
4806
void
 
4807
lt_fatal (const char *message, ...)
 
4808
{
 
4809
  va_list ap;
 
4810
  va_start (ap, message);
 
4811
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4812
  va_end (ap);
 
4813
}
 
4814
EOF
 
4815
          # we should really use a build-platform specific compiler
 
4816
          # here, but OTOH, the wrappers (shell script and this C one)
 
4817
          # are only useful if you want to execute the "real" binary.
 
4818
          # Since the "real" binary is built for $host, then this
 
4819
          # wrapper might as well be built for $host, too.
 
4820
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4821
          ;;
 
4822
        esac
3554
4823
        $rm $output
3555
 
        trap "$rm $output; exit 1" 1 2 15
 
4824
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
3556
4825
 
3557
4826
        $echo > $output "\
3558
4827
#! $SHELL
3568
4837
 
3569
4838
# Sed substitution that helps us do robust quoting.  It backslashifies
3570
4839
# metacharacters that are still active within double-quoted strings.
3571
 
Xsed='sed -e 1s/^X//'
 
4840
Xsed='${SED} -e 1s/^X//'
3572
4841
sed_quote_subst='$sed_quote_subst'
3573
4842
 
3574
4843
# The HP-UX ksh and POSIX shell print the target directory to stdout
3575
4844
# if CDPATH is set.
3576
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
4845
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3577
4846
 
3578
4847
relink_command=\"$relink_command\"
3579
4848
 
3606
4875
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3607
4876
 
3608
4877
  # Follow symbolic links until we get to the real thisdir.
3609
 
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
4878
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3610
4879
  while test -n \"\$file\"; do
3611
4880
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3612
4881
 
3619
4888
    fi
3620
4889
 
3621
4890
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3622
 
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
4891
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3623
4892
  done
3624
4893
 
3625
4894
  # Try to get the absolute directory name.
3628
4897
"
3629
4898
 
3630
4899
        if test "$fast_install" = yes; then
3631
 
          echo >> $output "\
 
4900
          $echo >> $output "\
3632
4901
  program=lt-'$outputname'$exeext
3633
4902
  progdir=\"\$thisdir/$objdir\"
3634
4903
 
3635
4904
  if test ! -f \"\$progdir/\$program\" || \\
3636
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
4905
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3637
4906
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3638
4907
 
3639
4908
    file=\"\$\$-\$program\"
3644
4913
      $rm \"\$progdir/\$file\"
3645
4914
    fi"
3646
4915
 
3647
 
          echo >> $output "\
 
4916
          $echo >> $output "\
3648
4917
 
3649
4918
    # relink executable if necessary
3650
4919
    if test -n \"\$relink_command\"; then
3651
 
      if (eval \$relink_command); then :
 
4920
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3652
4921
      else
 
4922
        $echo \"\$relink_command_output\" >&2
3653
4923
        $rm \"\$progdir/\$file\"
3654
 
        exit 1
 
4924
        exit $EXIT_FAILURE
3655
4925
      fi
3656
4926
    fi
3657
4927
 
3661
4931
    $rm \"\$progdir/\$file\"
3662
4932
  fi"
3663
4933
        else
3664
 
          echo >> $output "\
 
4934
          $echo >> $output "\
3665
4935
  program='$outputname'
3666
4936
  progdir=\"\$thisdir/$objdir\"
3667
4937
"
3668
4938
        fi
3669
4939
 
3670
 
        echo >> $output "\
 
4940
        $echo >> $output "\
3671
4941
 
3672
4942
  if test -f \"\$progdir/\$program\"; then"
3673
4943
 
3698
4968
      # Run the actual program with our arguments.
3699
4969
"
3700
4970
        case $host in
3701
 
        # win32 systems need to use the prog path for dll
3702
 
        # lookup to work
3703
 
        *-*-cygwin* | *-*-pw32*)
3704
 
          $echo >> $output "\
3705
 
      exec \$progdir/\$program \${1+\"\$@\"}
3706
 
"
3707
 
          ;;
3708
 
 
3709
4971
        # Backslashes separate directories on plain windows
3710
4972
        *-*-mingw | *-*-os2*)
3711
4973
          $echo >> $output "\
3715
4977
 
3716
4978
        *)
3717
4979
          $echo >> $output "\
3718
 
      # Export the path to the program.
3719
 
      PATH=\"\$progdir:\$PATH\"
3720
 
      export PATH
3721
 
 
3722
 
      exec \$program \${1+\"\$@\"}
 
4980
      exec \$progdir/\$program \${1+\"\$@\"}
3723
4981
"
3724
4982
          ;;
3725
4983
        esac
3726
4984
        $echo >> $output "\
3727
4985
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3728
 
      exit 1
 
4986
      exit $EXIT_FAILURE
3729
4987
    fi
3730
4988
  else
3731
4989
    # The program doesn't exist.
3732
4990
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3733
4991
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
3734
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
3735
 
    exit 1
 
4992
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
4993
    exit $EXIT_FAILURE
3736
4994
  fi
3737
4995
fi\
3738
4996
"
3739
4997
        chmod +x $output
3740
4998
      fi
3741
 
      exit 0
 
4999
      exit $EXIT_SUCCESS
3742
5000
      ;;
3743
5001
    esac
3744
5002
 
3754
5012
          oldobjs="$libobjs_save"
3755
5013
          build_libtool_libs=no
3756
5014
        else
3757
 
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
5015
          oldobjs="$old_deplibs $non_pic_objects"
3758
5016
        fi
3759
5017
        addlibs="$old_convenience"
3760
5018
      fi
3761
5019
 
3762
5020
      if test -n "$addlibs"; then
3763
5021
        gentop="$output_objdir/${outputname}x"
3764
 
        $show "${rm}r $gentop"
3765
 
        $run ${rm}r "$gentop"
3766
 
        $show "mkdir $gentop"
3767
 
        $run mkdir "$gentop"
3768
 
        status=$?
3769
 
        if test $status -ne 0 && test ! -d "$gentop"; then
3770
 
          exit $status
3771
 
        fi
3772
5022
        generated="$generated $gentop"
3773
5023
 
3774
 
        # Add in members from convenience archives.
3775
 
        for xlib in $addlibs; do
3776
 
          # Extract the objects.
3777
 
          case $xlib in
3778
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3779
 
          *) xabs=`pwd`"/$xlib" ;;
3780
 
          esac
3781
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3782
 
          xdir="$gentop/$xlib"
3783
 
 
3784
 
          $show "${rm}r $xdir"
3785
 
          $run ${rm}r "$xdir"
3786
 
          $show "mkdir $xdir"
3787
 
          $run mkdir "$xdir"
3788
 
          status=$?
3789
 
          if test $status -ne 0 && test ! -d "$xdir"; then
3790
 
            exit $status
3791
 
          fi
3792
 
          $show "(cd $xdir && $AR x $xabs)"
3793
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3794
 
 
3795
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3796
 
        done
 
5024
        func_extract_archives $gentop $addlibs
 
5025
        oldobjs="$oldobjs $func_extract_archives_result"
3797
5026
      fi
3798
5027
 
3799
5028
      # Do each command in the archive commands.
3800
5029
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3801
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5030
       cmds=$old_archive_from_new_cmds
3802
5031
      else
3803
 
        # Ensure that we have .o objects in place in case we decided
3804
 
        # not to build a shared library, and have fallen back to building
3805
 
        # static libs even though --disable-static was passed!
3806
 
        for oldobj in $oldobjs; do
3807
 
          if test ! -f $oldobj; then
3808
 
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3809
 
            if test "X$xdir" = "X$oldobj"; then
3810
 
              xdir="."
3811
 
            else
3812
 
              xdir="$xdir"
3813
 
            fi
3814
 
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3815
 
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3816
 
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3817
 
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3818
 
          fi
3819
 
        done
3820
 
 
3821
5032
        eval cmds=\"$old_archive_cmds\"
 
5033
 
 
5034
        if len=`expr "X$cmds" : ".*"` &&
 
5035
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5036
          cmds=$old_archive_cmds
 
5037
        else
 
5038
          # the command line is too long to link in one step, link in parts
 
5039
          $echo "using piecewise archive linking..."
 
5040
          save_RANLIB=$RANLIB
 
5041
          RANLIB=:
 
5042
          objlist=
 
5043
          concat_cmds=
 
5044
          save_oldobjs=$oldobjs
 
5045
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
 
5046
          # encoded into archives.  This makes 'ar r' malfunction in
 
5047
          # this piecewise linking case whenever conflicting object
 
5048
          # names appear in distinct ar calls; check, warn and compensate.
 
5049
            if (for obj in $save_oldobjs
 
5050
            do
 
5051
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5052
            done | sort | sort -uc >/dev/null 2>&1); then
 
5053
            :
 
5054
          else
 
5055
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
 
5056
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
 
5057
            AR_FLAGS=cq
 
5058
          fi
 
5059
          # Is there a better way of finding the last object in the list?
 
5060
          for obj in $save_oldobjs
 
5061
          do
 
5062
            last_oldobj=$obj
 
5063
          done
 
5064
          for obj in $save_oldobjs
 
5065
          do
 
5066
            oldobjs="$objlist $obj"
 
5067
            objlist="$objlist $obj"
 
5068
            eval test_cmds=\"$old_archive_cmds\"
 
5069
            if len=`expr "X$test_cmds" : ".*"` &&
 
5070
               test "$len" -le "$max_cmd_len"; then
 
5071
              :
 
5072
            else
 
5073
              # the above command should be used before it gets too long
 
5074
              oldobjs=$objlist
 
5075
              if test "$obj" = "$last_oldobj" ; then
 
5076
                RANLIB=$save_RANLIB
 
5077
              fi
 
5078
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5079
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5080
              objlist=
 
5081
            fi
 
5082
          done
 
5083
          RANLIB=$save_RANLIB
 
5084
          oldobjs=$objlist
 
5085
          if test "X$oldobjs" = "X" ; then
 
5086
            eval cmds=\"\$concat_cmds\"
 
5087
          else
 
5088
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5089
          fi
 
5090
        fi
3822
5091
      fi
3823
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
5092
      save_ifs="$IFS"; IFS='~'
3824
5093
      for cmd in $cmds; do
 
5094
        eval cmd=\"$cmd\"
3825
5095
        IFS="$save_ifs"
3826
5096
        $show "$cmd"
3827
5097
        $run eval "$cmd" || exit $?
3853
5123
        fi
3854
5124
      done
3855
5125
      # Quote the link command for shipping.
3856
 
      relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@"
 
5126
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
3857
5127
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5128
      if test "$hardcode_automatic" = yes ; then
 
5129
        relink_command=
 
5130
      fi
 
5131
 
3858
5132
 
3859
5133
      # Only create the output if not a dry run.
3860
5134
      if test -z "$run"; then
3870
5144
              case $deplib in
3871
5145
              *.la)
3872
5146
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3873
 
                eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
5147
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3874
5148
                if test -z "$libdir"; then
3875
5149
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3876
 
                  exit 1
 
5150
                  exit $EXIT_FAILURE
3877
5151
                fi
3878
5152
                newdependency_libs="$newdependency_libs $libdir/$name"
3879
5153
                ;;
3884
5158
            newdlfiles=
3885
5159
            for lib in $dlfiles; do
3886
5160
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3887
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5161
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3888
5162
              if test -z "$libdir"; then
3889
5163
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3890
 
                exit 1
 
5164
                exit $EXIT_FAILURE
3891
5165
              fi
3892
5166
              newdlfiles="$newdlfiles $libdir/$name"
3893
5167
            done
3895
5169
            newdlprefiles=
3896
5170
            for lib in $dlprefiles; do
3897
5171
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3898
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5172
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3899
5173
              if test -z "$libdir"; then
3900
5174
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3901
 
                exit 1
 
5175
                exit $EXIT_FAILURE
3902
5176
              fi
3903
5177
              newdlprefiles="$newdlprefiles $libdir/$name"
3904
5178
            done
3905
5179
            dlprefiles="$newdlprefiles"
 
5180
          else
 
5181
            newdlfiles=
 
5182
            for lib in $dlfiles; do
 
5183
              case $lib in
 
5184
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5185
                *) abs=`pwd`"/$lib" ;;
 
5186
              esac
 
5187
              newdlfiles="$newdlfiles $abs"
 
5188
            done
 
5189
            dlfiles="$newdlfiles"
 
5190
            newdlprefiles=
 
5191
            for lib in $dlprefiles; do
 
5192
              case $lib in
 
5193
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5194
                *) abs=`pwd`"/$lib" ;;
 
5195
              esac
 
5196
              newdlprefiles="$newdlprefiles $abs"
 
5197
            done
 
5198
            dlprefiles="$newdlprefiles"
3906
5199
          fi
3907
5200
          $rm $output
3908
5201
          # place dlname in correct position for cygwin
3909
5202
          tdlname=$dlname
3910
5203
          case $host,$output,$installed,$module,$dlname in
3911
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5204
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3912
5205
          esac
3913
5206
          $echo > $output "\
3914
5207
# $outputname - a libtool library file
3937
5230
# Is this an already installed library?
3938
5231
installed=$installed
3939
5232
 
 
5233
# Should we warn about portability when linking against -modules?
 
5234
shouldnotlink=$module
 
5235
 
3940
5236
# Files to dlopen/dlpreopen
3941
5237
dlopen='$dlfiles'
3942
5238
dlpreopen='$dlprefiles'
3943
5239
 
3944
5240
# Directory that this library needs to be installed in:
3945
5241
libdir='$install_libdir'"
3946
 
          if test "$installed" = no && test $need_relink = yes; then
 
5242
          if test "$installed" = no && test "$need_relink" = yes; then
3947
5243
            $echo >> $output "\
3948
5244
relink_command=\"$relink_command\""
3949
5245
          fi
3956
5252
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3957
5253
      ;;
3958
5254
    esac
3959
 
    exit 0
 
5255
    exit $EXIT_SUCCESS
3960
5256
    ;;
3961
5257
 
3962
5258
  # libtool install mode
4045
5341
    if test -z "$install_prog"; then
4046
5342
      $echo "$modename: you must specify an install program" 1>&2
4047
5343
      $echo "$help" 1>&2
4048
 
      exit 1
 
5344
      exit $EXIT_FAILURE
4049
5345
    fi
4050
5346
 
4051
5347
    if test -n "$prev"; then
4052
5348
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4053
5349
      $echo "$help" 1>&2
4054
 
      exit 1
 
5350
      exit $EXIT_FAILURE
4055
5351
    fi
4056
5352
 
4057
5353
    if test -z "$files"; then
4061
5357
        $echo "$modename: you must specify a destination" 1>&2
4062
5358
      fi
4063
5359
      $echo "$help" 1>&2
4064
 
      exit 1
 
5360
      exit $EXIT_FAILURE
4065
5361
    fi
4066
5362
 
4067
5363
    # Strip any trailing slash from the destination.
4079
5375
 
4080
5376
      # Not a directory, so check to see that there is only one file specified.
4081
5377
      set dummy $files
4082
 
      if test $# -gt 2; then
 
5378
      if test "$#" -gt 2; then
4083
5379
        $echo "$modename: \`$dest' is not a directory" 1>&2
4084
5380
        $echo "$help" 1>&2
4085
 
        exit 1
 
5381
        exit $EXIT_FAILURE
4086
5382
      fi
4087
5383
    fi
4088
5384
    case $destdir in
4094
5390
        *)
4095
5391
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4096
5392
          $echo "$help" 1>&2
4097
 
          exit 1
 
5393
          exit $EXIT_FAILURE
4098
5394
          ;;
4099
5395
        esac
4100
5396
      done
4119
5415
 
4120
5416
      *.la)
4121
5417
        # Check to see that this really is a libtool archive.
4122
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5418
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4123
5419
        else
4124
5420
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4125
5421
          $echo "$help" 1>&2
4126
 
          exit 1
 
5422
          exit $EXIT_FAILURE
4127
5423
        fi
4128
5424
 
4129
5425
        library_names=
4155
5451
 
4156
5452
        if test -n "$relink_command"; then
4157
5453
          # Determine the prefix the user has applied to our future dir.
4158
 
          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
 
5454
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
4159
5455
 
4160
5456
          # Don't allow the user to place us outside of our expected
4161
5457
          # location b/c this prevents finding dependent libraries that
4162
5458
          # are installed to the same prefix.
 
5459
          # At present, this check doesn't affect windows .dll's that
 
5460
          # are installed into $libdir/../bin (currently, that works fine)
 
5461
          # but it's something to keep an eye on.
4163
5462
          if test "$inst_prefix_dir" = "$destdir"; then
4164
5463
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4165
 
            exit 1
 
5464
            exit $EXIT_FAILURE
4166
5465
          fi
4167
5466
 
4168
5467
          if test -n "$inst_prefix_dir"; then
4169
5468
            # Stick the inst_prefix_dir data into the link command.
4170
 
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5469
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4171
5470
          else
4172
 
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
 
5471
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4173
5472
          fi
4174
5473
 
4175
5474
          $echo "$modename: warning: relinking \`$file'" 1>&2
4177
5476
          if $run eval "$relink_command"; then :
4178
5477
          else
4179
5478
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4180
 
            exit 1
 
5479
            exit $EXIT_FAILURE
4181
5480
          fi
4182
5481
        fi
4183
5482
 
4199
5498
            $run eval "$striplib $destdir/$realname" || exit $?
4200
5499
          fi
4201
5500
 
4202
 
          if test $# -gt 0; then
 
5501
          if test "$#" -gt 0; then
4203
5502
            # Delete the old symlinks, and create new ones.
4204
5503
            for linkname
4205
5504
            do
4212
5511
 
4213
5512
          # Do each command in the postinstall commands.
4214
5513
          lib="$destdir/$realname"
4215
 
          eval cmds=\"$postinstall_cmds\"
4216
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
5514
          cmds=$postinstall_cmds
 
5515
          save_ifs="$IFS"; IFS='~'
4217
5516
          for cmd in $cmds; do
4218
5517
            IFS="$save_ifs"
 
5518
            eval cmd=\"$cmd\"
4219
5519
            $show "$cmd"
4220
5520
            $run eval "$cmd" || exit $?
4221
5521
          done
4255
5555
        *)
4256
5556
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4257
5557
          $echo "$help" 1>&2
4258
 
          exit 1
 
5558
          exit $EXIT_FAILURE
4259
5559
          ;;
4260
5560
        esac
4261
5561
 
4273
5573
          $show "$install_prog $staticobj $staticdest"
4274
5574
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4275
5575
        fi
4276
 
        exit 0
 
5576
        exit $EXIT_SUCCESS
4277
5577
        ;;
4278
5578
 
4279
5579
      *)
4285
5585
          destfile="$destdir/$destfile"
4286
5586
        fi
4287
5587
 
 
5588
        # If the file is missing, and there is a .exe on the end, strip it
 
5589
        # because it is most likely a libtool script we actually want to
 
5590
        # install
 
5591
        stripped_ext=""
 
5592
        case $file in
 
5593
          *.exe)
 
5594
            if test ! -f "$file"; then
 
5595
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5596
              stripped_ext=".exe"
 
5597
            fi
 
5598
            ;;
 
5599
        esac
 
5600
 
4288
5601
        # Do a test to see if this is really a libtool program.
4289
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5602
        case $host in
 
5603
        *cygwin*|*mingw*)
 
5604
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
 
5605
            ;;
 
5606
        *)
 
5607
            wrapper=$file
 
5608
            ;;
 
5609
        esac
 
5610
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4290
5611
          notinst_deplibs=
4291
5612
          relink_command=
4292
5613
 
 
5614
          # To insure that "foo" is sourced, and not "foo.exe",
 
5615
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5616
          # which disallows the automatic-append-.exe behavior.
 
5617
          case $build in
 
5618
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5619
          *) wrapperdot=${wrapper} ;;
 
5620
          esac
4293
5621
          # If there is no directory component, then add one.
4294
5622
          case $file in
4295
 
          */* | *\\*) . $file ;;
4296
 
          *) . ./$file ;;
 
5623
          */* | *\\*) . ${wrapperdot} ;;
 
5624
          *) . ./${wrapperdot} ;;
4297
5625
          esac
4298
5626
 
4299
5627
          # Check the variables that should have been set.
4300
5628
          if test -z "$notinst_deplibs"; then
4301
 
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4302
 
            exit 1
 
5629
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
 
5630
            exit $EXIT_FAILURE
4303
5631
          fi
4304
5632
 
4305
5633
          finalize=yes
4321
5649
          done
4322
5650
 
4323
5651
          relink_command=
 
5652
          # To insure that "foo" is sourced, and not "foo.exe",
 
5653
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5654
          # which disallows the automatic-append-.exe behavior.
 
5655
          case $build in
 
5656
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5657
          *) wrapperdot=${wrapper} ;;
 
5658
          esac
4324
5659
          # If there is no directory component, then add one.
4325
5660
          case $file in
4326
 
          */* | *\\*) . $file ;;
4327
 
          *) . ./$file ;;
 
5661
          */* | *\\*) . ${wrapperdot} ;;
 
5662
          *) . ./${wrapperdot} ;;
4328
5663
          esac
4329
5664
 
4330
5665
          outputname=
4332
5667
            if test "$finalize" = yes && test -z "$run"; then
4333
5668
              tmpdir="/tmp"
4334
5669
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4335
 
              tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
4336
 
              if test $? = 0 ; then :
4337
 
              else
4338
 
                tmpdir="$tmpdir/libtool-$$"
4339
 
              fi
4340
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5670
              tmpdir="$tmpdir/libtool-$$"
 
5671
              save_umask=`umask`
 
5672
              umask 0077
 
5673
              if $mkdir "$tmpdir"; then
 
5674
                umask $save_umask
4341
5675
              else
 
5676
                umask $save_umask
4342
5677
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4343
5678
                continue
4344
5679
              fi
4345
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
5680
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4346
5681
              outputname="$tmpdir/$file"
4347
5682
              # Replace the output file specification.
4348
5683
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4360
5695
            fi
4361
5696
          else
4362
5697
            # Install the binary that we compiled earlier.
4363
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5698
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4364
5699
          fi
4365
5700
        fi
4366
5701
 
4367
5702
        # remove .exe since cygwin /usr/bin/install will append another
4368
5703
        # one anyways
4369
5704
        case $install_prog,$host in
4370
 
        /usr/bin/install*,*cygwin*)
 
5705
        */usr/bin/install*,*cygwin*)
4371
5706
          case $file:$destfile in
4372
5707
          *.exe:*.exe)
4373
5708
            # this is ok
4376
5711
            destfile=$destfile.exe
4377
5712
            ;;
4378
5713
          *:*.exe)
4379
 
            destfile=`echo $destfile | sed -e 's,.exe$,,'`
 
5714
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4380
5715
            ;;
4381
5716
          esac
4382
5717
          ;;
4397
5732
      $show "$install_prog $file $oldlib"
4398
5733
      $run eval "$install_prog \$file \$oldlib" || exit $?
4399
5734
 
4400
 
      if test -n "$stripme" && test -n "$striplib"; then
 
5735
      if test -n "$stripme" && test -n "$old_striplib"; then
4401
5736
        $show "$old_striplib $oldlib"
4402
5737
        $run eval "$old_striplib $oldlib" || exit $?
4403
5738
      fi
4404
5739
 
4405
5740
      # Do each command in the postinstall commands.
4406
 
      eval cmds=\"$old_postinstall_cmds\"
4407
 
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
5741
      cmds=$old_postinstall_cmds
 
5742
      save_ifs="$IFS"; IFS='~'
4408
5743
      for cmd in $cmds; do
4409
5744
        IFS="$save_ifs"
 
5745
        eval cmd=\"$cmd\"
4410
5746
        $show "$cmd"
4411
5747
        $run eval "$cmd" || exit $?
4412
5748
      done
4420
5756
    if test -n "$current_libdirs"; then
4421
5757
      # Maybe just do a dry run.
4422
5758
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4423
 
      exec $SHELL $0 --finish$current_libdirs
4424
 
      exit 1
 
5759
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
 
5760
    else
 
5761
      exit $EXIT_SUCCESS
4425
5762
    fi
4426
 
 
4427
 
    exit 0
4428
5763
    ;;
4429
5764
 
4430
5765
  # libtool finish mode
4442
5777
      for libdir in $libdirs; do
4443
5778
        if test -n "$finish_cmds"; then
4444
5779
          # Do each command in the finish commands.
4445
 
          eval cmds=\"$finish_cmds\"
4446
 
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
 
5780
          cmds=$finish_cmds
 
5781
          save_ifs="$IFS"; IFS='~'
4447
5782
          for cmd in $cmds; do
4448
5783
            IFS="$save_ifs"
 
5784
            eval cmd=\"$cmd\"
4449
5785
            $show "$cmd"
4450
5786
            $run eval "$cmd" || admincmds="$admincmds
4451
5787
       $cmd"
4462
5798
    fi
4463
5799
 
4464
5800
    # Exit here if they wanted silent mode.
4465
 
    test "$show" = ":" && exit 0
 
5801
    test "$show" = : && exit $EXIT_SUCCESS
4466
5802
 
4467
 
    echo "----------------------------------------------------------------------"
4468
 
    echo "Libraries have been installed in:"
 
5803
    $echo "----------------------------------------------------------------------"
 
5804
    $echo "Libraries have been installed in:"
4469
5805
    for libdir in $libdirs; do
4470
 
      echo "   $libdir"
 
5806
      $echo "   $libdir"
4471
5807
    done
4472
 
    echo
4473
 
    echo "If you ever happen to want to link against installed libraries"
4474
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4475
 
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4476
 
    echo "flag during linking and do at least one of the following:"
 
5808
    $echo
 
5809
    $echo "If you ever happen to want to link against installed libraries"
 
5810
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5811
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5812
    $echo "flag during linking and do at least one of the following:"
4477
5813
    if test -n "$shlibpath_var"; then
4478
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4479
 
      echo "     during execution"
 
5814
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5815
      $echo "     during execution"
4480
5816
    fi
4481
5817
    if test -n "$runpath_var"; then
4482
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4483
 
      echo "     during linking"
 
5818
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5819
      $echo "     during linking"
4484
5820
    fi
4485
5821
    if test -n "$hardcode_libdir_flag_spec"; then
4486
5822
      libdir=LIBDIR
4487
5823
      eval flag=\"$hardcode_libdir_flag_spec\"
4488
5824
 
4489
 
      echo "   - use the \`$flag' linker flag"
 
5825
      $echo "   - use the \`$flag' linker flag"
4490
5826
    fi
4491
5827
    if test -n "$admincmds"; then
4492
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5828
      $echo "   - have your system administrator run these commands:$admincmds"
4493
5829
    fi
4494
5830
    if test -f /etc/ld.so.conf; then
4495
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5831
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4496
5832
    fi
4497
 
    echo
4498
 
    echo "See any operating system documentation about shared libraries for"
4499
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4500
 
    echo "----------------------------------------------------------------------"
4501
 
    exit 0
 
5833
    $echo
 
5834
    $echo "See any operating system documentation about shared libraries for"
 
5835
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5836
    $echo "----------------------------------------------------------------------"
 
5837
    exit $EXIT_SUCCESS
4502
5838
    ;;
4503
5839
 
4504
5840
  # libtool execute mode
4510
5846
    if test -z "$cmd"; then
4511
5847
      $echo "$modename: you must specify a COMMAND" 1>&2
4512
5848
      $echo "$help"
4513
 
      exit 1
 
5849
      exit $EXIT_FAILURE
4514
5850
    fi
4515
5851
 
4516
5852
    # Handle -dlopen flags immediately.
4518
5854
      if test ! -f "$file"; then
4519
5855
        $echo "$modename: \`$file' is not a file" 1>&2
4520
5856
        $echo "$help" 1>&2
4521
 
        exit 1
 
5857
        exit $EXIT_FAILURE
4522
5858
      fi
4523
5859
 
4524
5860
      dir=
4525
5861
      case $file in
4526
5862
      *.la)
4527
5863
        # Check to see that this really is a libtool archive.
4528
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5864
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4529
5865
        else
4530
5866
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4531
5867
          $echo "$help" 1>&2
4532
 
          exit 1
 
5868
          exit $EXIT_FAILURE
4533
5869
        fi
4534
5870
 
4535
5871
        # Read the libtool library.
4556
5892
          dir="$dir/$objdir"
4557
5893
        else
4558
5894
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4559
 
          exit 1
 
5895
          exit $EXIT_FAILURE
4560
5896
        fi
4561
5897
        ;;
4562
5898
 
4596
5932
      -*) ;;
4597
5933
      *)
4598
5934
        # Do a test to see if this is really a libtool program.
4599
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5935
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4600
5936
          # If there is no directory component, then add one.
4601
5937
          case $file in
4602
5938
          */* | *\\*) . $file ;;
4619
5955
        eval "export $shlibpath_var"
4620
5956
      fi
4621
5957
 
4622
 
      # Restore saved enviroment variables
 
5958
      # Restore saved environment variables
4623
5959
      if test "${save_LC_ALL+set}" = set; then
4624
5960
        LC_ALL="$save_LC_ALL"; export LC_ALL
4625
5961
      fi
4627
5963
        LANG="$save_LANG"; export LANG
4628
5964
      fi
4629
5965
 
4630
 
      # Now actually exec the command.
4631
 
      eval "exec \$cmd$args"
4632
 
 
4633
 
      $echo "$modename: cannot exec \$cmd$args"
4634
 
      exit 1
 
5966
      # Now prepare to actually exec the command.
 
5967
      exec_cmd="\$cmd$args"
4635
5968
    else
4636
5969
      # Display what would be done.
4637
5970
      if test -n "$shlibpath_var"; then
4639
5972
        $echo "export $shlibpath_var"
4640
5973
      fi
4641
5974
      $echo "$cmd$args"
4642
 
      exit 0
 
5975
      exit $EXIT_SUCCESS
4643
5976
    fi
4644
5977
    ;;
4645
5978
 
4667
6000
    if test -z "$rm"; then
4668
6001
      $echo "$modename: you must specify an RM program" 1>&2
4669
6002
      $echo "$help" 1>&2
4670
 
      exit 1
 
6003
      exit $EXIT_FAILURE
4671
6004
    fi
4672
6005
 
4673
6006
    rmdirs=
4674
6007
 
 
6008
    origobjdir="$objdir"
4675
6009
    for file in $files; do
4676
6010
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4677
6011
      if test "X$dir" = "X$file"; then
4678
6012
        dir=.
4679
 
        objdir="$objdir"
 
6013
        objdir="$origobjdir"
4680
6014
      else
4681
 
        objdir="$dir/$objdir"
 
6015
        objdir="$dir/$origobjdir"
4682
6016
      fi
4683
6017
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4684
 
      test $mode = uninstall && objdir="$dir"
 
6018
      test "$mode" = uninstall && objdir="$dir"
4685
6019
 
4686
6020
      # Remember objdir for removal later, being careful to avoid duplicates
4687
 
      if test $mode = clean; then
 
6021
      if test "$mode" = clean; then
4688
6022
        case " $rmdirs " in
4689
6023
          *" $objdir "*) ;;
4690
6024
          *) rmdirs="$rmdirs $objdir" ;;
4693
6027
 
4694
6028
      # Don't error if the file doesn't exist and rm -f was used.
4695
6029
      if (test -L "$file") >/dev/null 2>&1 \
4696
 
        || (test -h "$file") >/dev/null 2>&1 \
 
6030
        || (test -h "$file") >/dev/null 2>&1 \
4697
6031
        || test -f "$file"; then
4698
 
        :
 
6032
        :
4699
6033
      elif test -d "$file"; then
4700
 
        exit_status=1
 
6034
        exit_status=1
4701
6035
        continue
4702
6036
      elif test "$rmforce" = yes; then
4703
 
        continue
 
6037
        continue
4704
6038
      fi
4705
6039
 
4706
6040
      rmfiles="$file"
4708
6042
      case $name in
4709
6043
      *.la)
4710
6044
        # Possibly a libtool archive, so verify it.
4711
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6045
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4712
6046
          . $dir/$name
4713
6047
 
4714
6048
          # Delete the libtool libraries and symlinks.
4716
6050
            rmfiles="$rmfiles $objdir/$n"
4717
6051
          done
4718
6052
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4719
 
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6053
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4720
6054
 
4721
 
          if test $mode = uninstall; then
 
6055
          if test "$mode" = uninstall; then
4722
6056
            if test -n "$library_names"; then
4723
6057
              # Do each command in the postuninstall commands.
4724
 
              eval cmds=\"$postuninstall_cmds\"
4725
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
6058
              cmds=$postuninstall_cmds
 
6059
              save_ifs="$IFS"; IFS='~'
4726
6060
              for cmd in $cmds; do
4727
6061
                IFS="$save_ifs"
 
6062
                eval cmd=\"$cmd\"
4728
6063
                $show "$cmd"
4729
6064
                $run eval "$cmd"
4730
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6065
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4731
6066
                  exit_status=1
4732
6067
                fi
4733
6068
              done
4736
6071
 
4737
6072
            if test -n "$old_library"; then
4738
6073
              # Do each command in the old_postuninstall commands.
4739
 
              eval cmds=\"$old_postuninstall_cmds\"
4740
 
              IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
 
6074
              cmds=$old_postuninstall_cmds
 
6075
              save_ifs="$IFS"; IFS='~'
4741
6076
              for cmd in $cmds; do
4742
6077
                IFS="$save_ifs"
 
6078
                eval cmd=\"$cmd\"
4743
6079
                $show "$cmd"
4744
6080
                $run eval "$cmd"
4745
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6081
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4746
6082
                  exit_status=1
4747
6083
                fi
4748
6084
              done
4754
6090
        ;;
4755
6091
 
4756
6092
      *.lo)
4757
 
        if test "$build_old_libs" = yes; then
4758
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4759
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6093
        # Possibly a libtool object, so verify it.
 
6094
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6095
 
 
6096
          # Read the .lo file
 
6097
          . $dir/$name
 
6098
 
 
6099
          # Add PIC object to the list of files to remove.
 
6100
          if test -n "$pic_object" \
 
6101
             && test "$pic_object" != none; then
 
6102
            rmfiles="$rmfiles $dir/$pic_object"
 
6103
          fi
 
6104
 
 
6105
          # Add non-PIC object to the list of files to remove.
 
6106
          if test -n "$non_pic_object" \
 
6107
             && test "$non_pic_object" != none; then
 
6108
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6109
          fi
4760
6110
        fi
4761
6111
        ;;
4762
6112
 
4763
6113
      *)
4764
 
        # Do a test to see if this is a libtool program.
4765
 
        if test $mode = clean &&
4766
 
           (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4767
 
          relink_command=
4768
 
          . $dir/$file
 
6114
        if test "$mode" = clean ; then
 
6115
          noexename=$name
 
6116
          case $file in
 
6117
          *.exe)
 
6118
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6119
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6120
            # $file with .exe has already been added to rmfiles,
 
6121
            # add $file without .exe
 
6122
            rmfiles="$rmfiles $file"
 
6123
            ;;
 
6124
          esac
 
6125
          # Do a test to see if this is a libtool program.
 
6126
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6127
            relink_command=
 
6128
            . $dir/$noexename
4769
6129
 
4770
 
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4771
 
          if test "$fast_install" = yes && test -n "$relink_command"; then
4772
 
            rmfiles="$rmfiles $objdir/lt-$name"
 
6130
            # note $name still contains .exe if it was in $file originally
 
6131
            # as does the version of $file that was added into $rmfiles
 
6132
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6133
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6134
              rmfiles="$rmfiles $objdir/lt-$name"
 
6135
            fi
 
6136
            if test "X$noexename" != "X$name" ; then
 
6137
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6138
            fi
4773
6139
          fi
4774
6140
        fi
4775
6141
        ;;
4777
6143
      $show "$rm $rmfiles"
4778
6144
      $run $rm $rmfiles || exit_status=1
4779
6145
    done
 
6146
    objdir="$origobjdir"
4780
6147
 
4781
6148
    # Try to remove the ${objdir}s in the directories where we deleted files
4782
6149
    for dir in $rmdirs; do
4792
6159
  "")
4793
6160
    $echo "$modename: you must specify a MODE" 1>&2
4794
6161
    $echo "$generic_help" 1>&2
4795
 
    exit 1
 
6162
    exit $EXIT_FAILURE
4796
6163
    ;;
4797
6164
  esac
4798
6165
 
4799
 
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
4800
 
  $echo "$generic_help" 1>&2
4801
 
  exit 1
 
6166
  if test -z "$exec_cmd"; then
 
6167
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
 
6168
    $echo "$generic_help" 1>&2
 
6169
    exit $EXIT_FAILURE
 
6170
  fi
4802
6171
fi # test -z "$show_help"
4803
6172
 
 
6173
if test -n "$exec_cmd"; then
 
6174
  eval exec $exec_cmd
 
6175
  exit $EXIT_FAILURE
 
6176
fi
 
6177
 
4804
6178
# We need to display help for each of the modes.
4805
6179
case $mode in
4806
6180
"") $echo \
4817
6191
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4818
6192
    --quiet           same as \`--silent'
4819
6193
    --silent          don't print informational messages
 
6194
    --tag=TAG         use configuration variables from tag TAG
4820
6195
    --version         print version information
4821
6196
 
4822
6197
MODE must be one of the following:
4830
6205
      uninstall       remove libraries from an installed directory
4831
6206
 
4832
6207
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4833
 
a more detailed description of MODE."
4834
 
  exit 0
 
6208
a more detailed description of MODE.
 
6209
 
 
6210
Report bugs to <bug-libtool@gnu.org>."
 
6211
  exit $EXIT_SUCCESS
4835
6212
  ;;
4836
6213
 
4837
6214
clean)
4942
6319
  -no-install       link a not-installable executable
4943
6320
  -no-undefined     declare that a library does not refer to external symbols
4944
6321
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6322
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6323
  -precious-files-regex REGEX
 
6324
                    don't remove output files matching REGEX
4945
6325
  -release RELEASE  specify package release information
4946
6326
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
4947
6327
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
4983
6363
*)
4984
6364
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
4985
6365
  $echo "$help" 1>&2
4986
 
  exit 1
 
6366
  exit $EXIT_FAILURE
4987
6367
  ;;
4988
6368
esac
4989
6369
 
4990
 
echo
 
6370
$echo
4991
6371
$echo "Try \`$modename --help' for more information about other modes."
4992
6372
 
4993
 
exit 0
 
6373
exit $EXIT_SUCCESS
 
6374
 
 
6375
# The TAGs below are defined such that we never get into a situation
 
6376
# in which we disable both kinds of libraries.  Given conflicting
 
6377
# choices, we go for a static library, that is the most portable,
 
6378
# since we can't tell whether shared libraries were disabled because
 
6379
# the user asked for that or because the platform doesn't support
 
6380
# them.  This is particularly important on AIX, because we don't
 
6381
# support having both static and shared libraries enabled at the same
 
6382
# time on that platform, so we default to a shared-only configuration.
 
6383
# If a disable-shared tag is given, we'll fallback to a static-only
 
6384
# configuration.  But we'll never go from static-only to shared-only.
 
6385
 
 
6386
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6387
build_libtool_libs=no
 
6388
build_old_libs=yes
 
6389
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6390
 
 
6391
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6392
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6393
# ### END LIBTOOL TAG CONFIG: disable-static
4994
6394
 
4995
6395
# Local Variables:
4996
6396
# mode:shell-script