~ubuntu-branches/ubuntu/precise/wget/precise-proposed

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Noèl Köthe
  • Date: 2005-06-26 16:46:25 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050626164625-jjcde8hyztx7xq7o
Tags: 1.10-2
* wget-fix_error--save-headers patch from upstream
  (closes: Bug#314728)
* don't pattern-match server redirects patch from upstream
  (closes: Bug#163243)
* correct de.po typos
  (closes: Bug#313883)
* wget-E_html_behind_file_counting fix problem with adding the
  numbers after the html extension
* updated Standards-Version: to 3.6.2

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, 2005
5
5
# Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
24
24
# configuration script generated by Autoconf, you may include it under
25
25
# the same distribution terms that you use for the rest of that program.
26
26
 
 
27
basename="s,^.*/,,g"
 
28
 
 
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
 
30
# is ksh but when the shell is invoked as "sh" and the current value of
 
31
# the _XPG environment variable is not equal to 1 (one), the special
 
32
# positional parameter $0, within a function call, is the name of the
 
33
# function.
 
34
progpath="$0"
 
35
 
 
36
# The name of this program:
 
37
progname=`echo "$progpath" | $SED $basename`
 
38
modename="$progname"
 
39
 
 
40
# Global variables:
 
41
EXIT_SUCCESS=0
 
42
EXIT_FAILURE=1
 
43
 
 
44
PROGRAM=ltmain.sh
 
45
PACKAGE=libtool
 
46
VERSION=1.5.14
 
47
TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)"
 
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.3
59
 
TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
60
 
 
61
79
default_mode=
62
80
help="Try \`$progname --help' for more information."
63
81
magic="%%%MAGIC variable%%%"
69
87
# metacharacters that are still active within double-quoted strings.
70
88
Xsed="${SED}"' -e 1s/^X//'
71
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
# test EBCDIC or ASCII                                                         
73
 
case `echo A|od -x` in                                                         
74
 
 *[Cc]1*) # EBCDIC based system                                                
75
 
  SP2NL="tr '\100' '\n'"                                                       
76
 
  NL2SP="tr '\r\n' '\100\100'"                                                 
77
 
  ;;                                                                           
78
 
 *) # Assume ASCII based system                                                
79
 
  SP2NL="tr '\040' '\012'"                                                     
80
 
  NL2SP="tr '\015\012' '\040\040'"                                             
81
 
  ;;                                                                           
82
 
esac                                                                           
 
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
83
101
 
84
102
# NLS nuisances.
85
103
# Only set LANG and LC_ALL to C if already set.
94
112
fi
95
113
 
96
114
# Make sure IFS has a sensible default
97
 
: ${IFS="       "}
 
115
: ${IFS="       
 
116
"}
98
117
 
99
118
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100
 
  echo "$modename: not configured to build any kind of library" 1>&2
101
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
102
 
  exit 1
 
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
103
122
fi
104
123
 
105
124
# Global variables.
113
132
execute_dlfiles=
114
133
lo2o="s/\\.lo\$/.${objext}/"
115
134
o2lo="s/\\.${objext}\$/.lo/"
 
135
quote_scanset='[[~#^*{};<>?'"'"'        ]'
 
136
 
 
137
#####################################
 
138
# Shell function definitions:
 
139
# This seems to be the best place for them
 
140
 
 
141
# func_win32_libid arg
 
142
# return the library type of file 'arg'
 
143
#
 
144
# Need a lot of goo to handle *both* DLLs and import libs
 
145
# Has to be a shell function in order to 'eat' the argument
 
146
# that is supplied when $file_magic_command is called.
 
147
func_win32_libid ()
 
148
{
 
149
  win32_libid_type="unknown"
 
150
  win32_fileres=`file -L $1 2>/dev/null`
 
151
  case $win32_fileres in
 
152
  *ar\ archive\ import\ library*) # definitely import
 
153
    win32_libid_type="x86 archive import"
 
154
    ;;
 
155
  *ar\ archive*) # could be an import, or static
 
156
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
 
157
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
158
      win32_nmres=`eval $NM -f posix -A $1 | \
 
159
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
 
160
      if test "X$win32_nmres" = "Ximport" ; then
 
161
        win32_libid_type="x86 archive import"
 
162
      else
 
163
        win32_libid_type="x86 archive static"
 
164
      fi
 
165
    fi
 
166
    ;;
 
167
  *DLL*)
 
168
    win32_libid_type="x86 DLL"
 
169
    ;;
 
170
  *executable*) # but shell scripts are "executable" too...
 
171
    case $win32_fileres in
 
172
    *MS\ Windows\ PE\ Intel*)
 
173
      win32_libid_type="x86 DLL"
 
174
      ;;
 
175
    esac
 
176
    ;;
 
177
  esac
 
178
  $echo $win32_libid_type
 
179
}
 
180
 
 
181
 
 
182
# func_infer_tag arg
 
183
# Infer tagged configuration to use if any are available and
 
184
# if one wasn't chosen via the "--tag" command line option.
 
185
# Only attempt this if the compiler in the base compile
 
186
# command doesn't match the default compiler.
 
187
# arg is usually of the form 'gcc ...'
 
188
func_infer_tag ()
 
189
{
 
190
    if test -n "$available_tags" && test -z "$tagname"; then
 
191
      CC_quoted=
 
192
      for arg in $CC; do
 
193
        case $arg in
 
194
          *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
195
          arg="\"$arg\""
 
196
          ;;
 
197
        esac
 
198
        CC_quoted="$CC_quoted $arg"
 
199
      done
 
200
      case $@ in
 
201
      # Blanks in the command may have been stripped by the calling shell,
 
202
      # but not from the CC environment variable when configure was run.
 
203
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
204
      # Blanks at the start of $base_compile will cause this to fail
 
205
      # if we don't check for them as well.
 
206
      *)
 
207
        for z in $available_tags; do
 
208
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
209
            # Evaluate the configuration.
 
210
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
211
            CC_quoted=
 
212
            for arg in $CC; do
 
213
            # Double-quote args containing other shell metacharacters.
 
214
            case $arg in
 
215
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
216
              arg="\"$arg\""
 
217
              ;;
 
218
            esac
 
219
            CC_quoted="$CC_quoted $arg"
 
220
          done
 
221
            case "$@ " in
 
222
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
223
              # The compiler in the base compile command matches
 
224
              # the one in the tagged configuration.
 
225
              # Assume this is the tagged configuration we want.
 
226
              tagname=$z
 
227
              break
 
228
              ;;
 
229
            esac
 
230
          fi
 
231
        done
 
232
        # If $tagname still isn't set, then no tagged configuration
 
233
        # was found and let the user know that the "--tag" command
 
234
        # line option must be used.
 
235
        if test -z "$tagname"; then
 
236
          $echo "$modename: unable to infer tagged configuration"
 
237
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
238
          exit $EXIT_FAILURE
 
239
#        else
 
240
#          $echo "$modename: using $tagname tagged configuration"
 
241
        fi
 
242
        ;;
 
243
      esac
 
244
    fi
 
245
}
 
246
 
 
247
 
 
248
# func_extract_an_archive dir oldlib
 
249
func_extract_an_archive ()
 
250
{
 
251
    f_ex_an_ar_dir="$1"; shift
 
252
    f_ex_an_ar_oldlib="$1"
 
253
    f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'`
 
254
 
 
255
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
 
256
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
 
257
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 
258
     :
 
259
    else
 
260
      $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
261
      $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
262
      $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib"
 
263
      $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"
 
264
      $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \
 
265
        | $EGREP -v '^[         ]*1[    ]' | while read count name
 
266
      do
 
267
        i=1
 
268
        while test "$i" -le "$count"
 
269
          do
 
270
          # Put our $i before any first dot (extension)
 
271
          # Never overwrite any file
 
272
          name_to="$name"
 
273
          while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to"
 
274
            do
 
275
            name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
276
          done
 
277
          $show "(cd $f_ex_an_ar_dir && $AR x  $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')"
 
278
          $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $?
 
279
          i=`expr $i + 1`
 
280
        done
 
281
      done
 
282
      $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib"
 
283
      $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"
 
284
    fi
 
285
}
 
286
 
 
287
# func_extract_archives gentop oldlib ...
 
288
func_extract_archives ()
 
289
{
 
290
    my_gentop="$1"; shift
 
291
    my_oldlibs=${1+"$@"}
 
292
    my_oldobjs=""
 
293
    my_xlib=""
 
294
    my_xabs=""
 
295
    my_xdir=""
 
296
    my_status=""
 
297
 
 
298
    $show "${rm}r $my_gentop"
 
299
    $run ${rm}r "$my_gentop"
 
300
    $show "$mkdir $my_gentop"
 
301
    $run $mkdir "$my_gentop"
 
302
    my_status=$?
 
303
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
 
304
      exit $my_status
 
305
    fi
 
306
 
 
307
    for my_xlib in $my_oldlibs; do
 
308
      # Extract the objects.
 
309
      case $my_xlib in
 
310
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
311
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
312
      esac
 
313
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
 
314
      my_xdir="$my_gentop/$my_xlib"
 
315
 
 
316
      $show "${rm}r $my_xdir"
 
317
      $run ${rm}r "$my_xdir"
 
318
      $show "$mkdir $my_xdir"
 
319
      $run $mkdir "$my_xdir"
 
320
      status=$?
 
321
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
 
322
        exit $status
 
323
      fi
 
324
      case $host in
 
325
      *-darwin*)
 
326
        $show "Extracting $my_xabs"
 
327
        # Do not bother doing anything if just a dry run
 
328
        if test -z "$run"; then
 
329
          darwin_orig_dir=`pwd`
 
330
          cd $my_xdir || exit $?
 
331
          darwin_archive=$my_xabs
 
332
          darwin_curdir=`pwd`
 
333
          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
 
334
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
 
335
          if test -n "$darwin_arches"; then 
 
336
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
 
337
            darwin_arch=
 
338
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
 
339
            for darwin_arch in  $darwin_arches ; do
 
340
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
341
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
342
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
343
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
344
              cd "$darwin_curdir"
 
345
              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
346
            done # $darwin_arches
 
347
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
 
348
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
 
349
            darwin_file=
 
350
            darwin_files=
 
351
            for darwin_file in $darwin_filelist; do
 
352
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 
353
              lipo -create -output "$darwin_file" $darwin_files
 
354
            done # $darwin_filelist
 
355
            ${rm}r unfat-$$
 
356
            cd "$darwin_orig_dir"
 
357
          else
 
358
            cd "$darwin_orig_dir"
 
359
            func_extract_an_archive "$my_xdir" "$my_xabs"
 
360
          fi # $darwin_arches
 
361
        fi # $run
 
362
      ;;
 
363
      *)
 
364
        func_extract_an_archive "$my_xdir" "$my_xabs"
 
365
        ;;
 
366
      esac
 
367
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
368
    done
 
369
    func_extract_archives_result="$my_oldobjs"
 
370
}
 
371
# End of Shell function definitions
 
372
#####################################
 
373
 
 
374
# Darwin sucks
 
375
eval std_shrext=\"$shrext_cmds\"
116
376
 
117
377
# Parse our command line options once, thoroughly.
118
 
while test $# -gt 0
 
378
while test "$#" -gt 0
119
379
do
120
380
  arg="$1"
121
381
  shift
131
391
    execute_dlfiles)
132
392
      execute_dlfiles="$execute_dlfiles $arg"
133
393
      ;;
 
394
    tag)
 
395
      tagname="$arg"
 
396
      preserve_args="${preserve_args}=$arg"
 
397
 
 
398
      # Check whether tagname contains only valid characters
 
399
      case $tagname in
 
400
      *[!-_A-Za-z0-9,/]*)
 
401
        $echo "$progname: invalid tag name: $tagname" 1>&2
 
402
        exit $EXIT_FAILURE
 
403
        ;;
 
404
      esac
 
405
 
 
406
      case $tagname in
 
407
      CC)
 
408
        # Don't test for the "default" C tag, as we know, it's there, but
 
409
        # not specially marked.
 
410
        ;;
 
411
      *)
 
412
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
 
413
          taglist="$taglist $tagname"
 
414
          # Evaluate the configuration.
 
415
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
 
416
        else
 
417
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
 
418
        fi
 
419
        ;;
 
420
      esac
 
421
      ;;
134
422
    *)
135
423
      eval "$prev=\$arg"
136
424
      ;;
148
436
    ;;
149
437
 
150
438
  --version)
151
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
152
 
    exit 0
 
439
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
 
440
    $echo
 
441
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
 
442
    $echo "This is free software; see the source for copying conditions.  There is NO"
 
443
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
444
    exit $?
153
445
    ;;
154
446
 
155
447
  --config)
156
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
157
 
    exit 0
 
448
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
 
449
    # Now print the configurations for the tags.
 
450
    for tagname in $taglist; do
 
451
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
 
452
    done
 
453
    exit $?
158
454
    ;;
159
455
 
160
456
  --debug)
161
 
    echo "$progname: enabling shell trace mode"
 
457
    $echo "$progname: enabling shell trace mode"
162
458
    set -x
 
459
    preserve_args="$preserve_args $arg"
163
460
    ;;
164
461
 
165
462
  --dry-run | -n)
167
464
    ;;
168
465
 
169
466
  --features)
170
 
    echo "host: $host"
 
467
    $echo "host: $host"
171
468
    if test "$build_libtool_libs" = yes; then
172
 
      echo "enable shared libraries"
 
469
      $echo "enable shared libraries"
173
470
    else
174
 
      echo "disable shared libraries"
 
471
      $echo "disable shared libraries"
175
472
    fi
176
473
    if test "$build_old_libs" = yes; then
177
 
      echo "enable static libraries"
 
474
      $echo "enable static libraries"
178
475
    else
179
 
      echo "disable static libraries"
 
476
      $echo "disable static libraries"
180
477
    fi
181
 
    exit 0
 
478
    exit $?
182
479
    ;;
183
480
 
184
481
  --finish) mode="finish" ;;
190
487
 
191
488
  --quiet | --silent)
192
489
    show=:
 
490
    preserve_args="$preserve_args $arg"
 
491
    ;;
 
492
 
 
493
  --tag) prevopt="--tag" prev=tag ;;
 
494
  --tag=*)
 
495
    set tag "$optarg" ${1+"$@"}
 
496
    shift
 
497
    prev=tag
 
498
    preserve_args="$preserve_args --tag"
193
499
    ;;
194
500
 
195
501
  -dlopen)
200
506
  -*)
201
507
    $echo "$modename: unrecognized option \`$arg'" 1>&2
202
508
    $echo "$help" 1>&2
203
 
    exit 1
 
509
    exit $EXIT_FAILURE
204
510
    ;;
205
511
 
206
512
  *)
213
519
if test -n "$prevopt"; then
214
520
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
215
521
  $echo "$help" 1>&2
216
 
  exit 1
 
522
  exit $EXIT_FAILURE
217
523
fi
218
524
 
219
525
# If this variable is set in any of the actions, the command in it
225
531
 
226
532
  # Infer the operation mode.
227
533
  if test -z "$mode"; then
 
534
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
 
535
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
228
536
    case $nonopt in
229
 
    *cc | *++ | gcc* | *-gcc* | xlc*)
 
537
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
230
538
      mode=link
231
539
      for arg
232
540
      do
267
575
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
268
576
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
269
577
    $echo "$help" 1>&2
270
 
    exit 1
 
578
    exit $EXIT_FAILURE
271
579
  fi
272
580
 
273
581
  # Change the help message to a mode-specific one.
281
589
    modename="$modename: compile"
282
590
    # Get the compilation command and the source file.
283
591
    base_compile=
284
 
    prev=
285
 
    lastarg=
286
 
    srcfile="$nonopt"
 
592
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
593
    suppress_opt=yes
287
594
    suppress_output=
 
595
    arg_mode=normal
 
596
    libobj=
 
597
    later=
288
598
 
289
 
    user_target=no
290
599
    for arg
291
600
    do
292
 
      case $prev in
293
 
      "") ;;
294
 
      xcompiler)
295
 
        # Aesthetically quote the previous argument.
296
 
        prev=
297
 
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
298
 
 
299
 
        case $arg in
300
 
        # Double-quote args containing other shell metacharacters.
301
 
        # Many Bourne shells cannot handle close brackets correctly
302
 
        # in scan sets, so we specify it separately.
303
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
304
 
          arg="\"$arg\""
305
 
          ;;
306
 
        esac
307
 
 
308
 
        # Add the previous argument to base_compile.
309
 
        if test -z "$base_compile"; then
310
 
          base_compile="$lastarg"
311
 
        else
312
 
          base_compile="$base_compile $lastarg"
313
 
        fi
314
 
        continue
315
 
        ;;
316
 
      esac
317
 
 
318
 
      # Accept any command-line options.
319
 
      case $arg in
320
 
      -o)
321
 
        if test "$user_target" != "no"; then
322
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
323
 
          exit 1
324
 
        fi
325
 
        user_target=next
326
 
        ;;
327
 
 
328
 
      -static)
329
 
        build_old_libs=yes
330
 
        continue
331
 
        ;;
332
 
 
333
 
      -prefer-pic)
334
 
        pic_mode=yes
335
 
        continue
336
 
        ;;
337
 
 
338
 
      -prefer-non-pic)
339
 
        pic_mode=no
340
 
        continue
341
 
        ;;
342
 
 
343
 
      -Xcompiler)
344
 
        prev=xcompiler
345
 
        continue
346
 
        ;;
347
 
 
348
 
      -Wc,*)
349
 
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
350
 
        lastarg=
351
 
        save_ifs="$IFS"; IFS=','
352
 
        for arg in $args; do
353
 
          IFS="$save_ifs"
354
 
 
355
 
          # Double-quote args containing other shell metacharacters.
356
 
          # Many Bourne shells cannot handle close brackets correctly
357
 
          # in scan sets, so we specify it separately.
358
 
          case $arg in
359
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
360
 
            arg="\"$arg\""
361
 
            ;;
362
 
          esac
363
 
          lastarg="$lastarg $arg"
364
 
        done
365
 
        IFS="$save_ifs"
366
 
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
367
 
 
368
 
        # Add the arguments to base_compile.
369
 
        if test -z "$base_compile"; then
370
 
          base_compile="$lastarg"
371
 
        else
372
 
          base_compile="$base_compile $lastarg"
373
 
        fi
374
 
        continue
375
 
        ;;
376
 
      esac
377
 
 
378
 
      case $user_target in
379
 
      next)
380
 
        # The next one is the -o target name
381
 
        user_target=yes
382
 
        continue
383
 
        ;;
384
 
      yes)
385
 
        # We got the output file
386
 
        user_target=set
 
601
      case "$arg_mode" in
 
602
      arg  )
 
603
        # do not "continue".  Instead, add this to base_compile
 
604
        lastarg="$arg"
 
605
        arg_mode=normal
 
606
        ;;
 
607
 
 
608
      target )
387
609
        libobj="$arg"
 
610
        arg_mode=normal
388
611
        continue
389
612
        ;;
390
 
      esac
391
 
 
392
 
      # Accept the current argument as the source file.
393
 
      lastarg="$srcfile"
394
 
      srcfile="$arg"
 
613
 
 
614
      normal )
 
615
        # Accept any command-line options.
 
616
        case $arg in
 
617
        -o)
 
618
          if test -n "$libobj" ; then
 
619
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
620
            exit $EXIT_FAILURE
 
621
          fi
 
622
          arg_mode=target
 
623
          continue
 
624
          ;;
 
625
 
 
626
        -static | -prefer-pic | -prefer-non-pic)
 
627
          later="$later $arg"
 
628
          continue
 
629
          ;;
 
630
 
 
631
        -no-suppress)
 
632
          suppress_opt=no
 
633
          continue
 
634
          ;;
 
635
 
 
636
        -Xcompiler)
 
637
          arg_mode=arg  #  the next one goes into the "base_compile" arg list
 
638
          continue      #  The current "srcfile" will either be retained or
 
639
          ;;            #  replaced later.  I would guess that would be a bug.
 
640
 
 
641
        -Wc,*)
 
642
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
643
          lastarg=
 
644
          save_ifs="$IFS"; IFS=','
 
645
          for arg in $args; do
 
646
            IFS="$save_ifs"
 
647
 
 
648
            # Double-quote args containing other shell metacharacters.
 
649
            # Many Bourne shells cannot handle close brackets correctly
 
650
            # in scan sets, so we specify it separately.
 
651
            case $arg in
 
652
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
653
              arg="\"$arg\""
 
654
              ;;
 
655
            esac
 
656
            lastarg="$lastarg $arg"
 
657
          done
 
658
          IFS="$save_ifs"
 
659
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
660
 
 
661
          # Add the arguments to base_compile.
 
662
          base_compile="$base_compile $lastarg"
 
663
          continue
 
664
          ;;
 
665
 
 
666
        * )
 
667
          # Accept the current argument as the source file.
 
668
          # The previous "srcfile" becomes the current argument.
 
669
          #
 
670
          lastarg="$srcfile"
 
671
          srcfile="$arg"
 
672
          ;;
 
673
        esac  #  case $arg
 
674
        ;;
 
675
      esac    #  case $arg_mode
395
676
 
396
677
      # Aesthetically quote the previous argument.
397
 
 
398
 
      # Backslashify any backslashes, double quotes, and dollar signs.
399
 
      # These are the only characters that are still specially
400
 
      # interpreted inside of double-quoted scrings.
401
678
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
402
679
 
 
680
      case $lastarg in
403
681
      # Double-quote args containing other shell metacharacters.
404
682
      # Many Bourne shells cannot handle close brackets correctly
405
 
      # in scan sets, so we specify it separately.
406
 
      case $lastarg in
407
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
683
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
 
684
      # in scan sets (worked around with variable expansion),
 
685
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
 
686
      # at all, so we specify them separately.
 
687
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
408
688
        lastarg="\"$lastarg\""
409
689
        ;;
410
690
      esac
411
691
 
412
 
      # Add the previous argument to base_compile.
413
 
      if test -z "$base_compile"; then
414
 
        base_compile="$lastarg"
415
 
      else
416
 
        base_compile="$base_compile $lastarg"
417
 
      fi
418
 
    done
 
692
      base_compile="$base_compile $lastarg"
 
693
    done # for arg
419
694
 
420
 
    case $user_target in
421
 
    set)
422
 
      ;;
423
 
    no)
 
695
    case $arg_mode in
 
696
    arg)
 
697
      $echo "$modename: you must specify an argument for -Xcompile"
 
698
      exit $EXIT_FAILURE
 
699
      ;;
 
700
    target)
 
701
      $echo "$modename: you must specify a target with \`-o'" 1>&2
 
702
      exit $EXIT_FAILURE
 
703
      ;;
 
704
    *)
424
705
      # Get the name of the library object.
425
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
426
 
      ;;
427
 
    *)
428
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
429
 
      exit 1
 
706
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
430
707
      ;;
431
708
    esac
432
709
 
433
710
    # Recognize several different file suffixes.
434
711
    # If the user specifies -o file.o, it is replaced with file.lo
435
 
    xform='[cCFSfmso]'
 
712
    xform='[cCFSifmso]'
436
713
    case $libobj in
437
714
    *.ada) xform=ada ;;
438
715
    *.adb) xform=adb ;;
440
717
    *.asm) xform=asm ;;
441
718
    *.c++) xform=c++ ;;
442
719
    *.cc) xform=cc ;;
 
720
    *.ii) xform=ii ;;
 
721
    *.class) xform=class ;;
443
722
    *.cpp) xform=cpp ;;
444
723
    *.cxx) xform=cxx ;;
445
724
    *.f90) xform=f90 ;;
446
725
    *.for) xform=for ;;
 
726
    *.java) xform=java ;;
447
727
    esac
448
728
 
449
729
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
452
732
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
453
733
    *)
454
734
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
455
 
      exit 1
 
735
      exit $EXIT_FAILURE
456
736
      ;;
457
737
    esac
458
738
 
 
739
    func_infer_tag $base_compile
 
740
 
 
741
    for arg in $later; do
 
742
      case $arg in
 
743
      -static)
 
744
        build_old_libs=yes
 
745
        continue
 
746
        ;;
 
747
 
 
748
      -prefer-pic)
 
749
        pic_mode=yes
 
750
        continue
 
751
        ;;
 
752
 
 
753
      -prefer-non-pic)
 
754
        pic_mode=no
 
755
        continue
 
756
        ;;
 
757
      esac
 
758
    done
 
759
 
 
760
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
761
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
762
    if test "X$xdir" = "X$obj"; then
 
763
      xdir=
 
764
    else
 
765
      xdir=$xdir/
 
766
    fi
 
767
    lobj=${xdir}$objdir/$objname
 
768
 
459
769
    if test -z "$base_compile"; then
460
770
      $echo "$modename: you must specify a compilation command" 1>&2
461
771
      $echo "$help" 1>&2
462
 
      exit 1
 
772
      exit $EXIT_FAILURE
463
773
    fi
464
774
 
465
775
    # Delete any leftover library objects.
466
776
    if test "$build_old_libs" = yes; then
467
 
      removelist="$obj $libobj"
 
777
      removelist="$obj $lobj $libobj ${libobj}T"
468
778
    else
469
 
      removelist="$libobj"
 
779
      removelist="$lobj $libobj ${libobj}T"
470
780
    fi
471
781
 
472
782
    $run $rm $removelist
473
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
783
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
474
784
 
475
785
    # On Cygwin there's no "real" PIC flag so we must build both object types
476
786
    case $host_os in
489
799
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
490
800
      lockfile="$output_obj.lock"
491
801
      removelist="$removelist $output_obj $lockfile"
492
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
802
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
493
803
    else
 
804
      output_obj=
494
805
      need_locks=no
495
806
      lockfile=
496
807
    fi
498
809
    # Lock this critical section if it is needed
499
810
    # We use this script file to make the link, it avoids creating a new file
500
811
    if test "$need_locks" = yes; then
501
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
812
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
502
813
        $show "Waiting for $lockfile to be removed"
503
814
        sleep 2
504
815
      done
505
816
    elif test "$need_locks" = warn; then
506
817
      if test -f "$lockfile"; then
507
 
        echo "\
 
818
        $echo "\
508
819
*** ERROR, $lockfile exists and contains:
509
820
`cat $lockfile 2>/dev/null`
510
821
 
516
827
compiler."
517
828
 
518
829
        $run $rm $removelist
519
 
        exit 1
 
830
        exit $EXIT_FAILURE
520
831
      fi
521
 
      echo $srcfile > "$lockfile"
 
832
      $echo $srcfile > "$lockfile"
522
833
    fi
523
834
 
524
835
    if test -n "$fix_srcfile_path"; then
525
836
      eval srcfile=\"$fix_srcfile_path\"
526
837
    fi
527
838
 
 
839
    $run $rm "$libobj" "${libobj}T"
 
840
 
 
841
    # Create a libtool object file (analogous to a ".la" file),
 
842
    # but don't create it if we're doing a dry run.
 
843
    test -z "$run" && cat > ${libobj}T <<EOF
 
844
# $libobj - a libtool object file
 
845
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
846
#
 
847
# Please DO NOT delete this file!
 
848
# It is necessary for linking the library.
 
849
 
 
850
# Name of the PIC object.
 
851
EOF
 
852
 
528
853
    # Only build a PIC object if we are building libtool libraries.
529
854
    if test "$build_libtool_libs" = yes; then
530
855
      # Without this assignment, base_compile gets emptied.
531
856
      fbsd_hideous_sh_bug=$base_compile
532
857
 
533
858
      if test "$pic_mode" != no; then
534
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
535
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
859
        command="$base_compile $srcfile $pic_flag"
536
860
      else
537
861
        # Don't build PIC code
538
862
        command="$base_compile $srcfile"
539
863
      fi
540
 
      if test "$build_old_libs" = yes; then
541
 
        lo_libobj="$libobj"
542
 
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
543
 
        if test "X$dir" = "X$libobj"; then
544
 
          dir="$objdir"
545
 
        else
546
 
          dir="$dir/$objdir"
547
 
        fi
548
 
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
549
 
 
550
 
        if test -d "$dir"; then
551
 
          $show "$rm $libobj"
552
 
          $run $rm $libobj
553
 
        else
554
 
          $show "$mkdir $dir"
555
 
          $run $mkdir $dir
556
 
          status=$?
557
 
          if test $status -ne 0 && test ! -d $dir; then
558
 
            exit $status
559
 
          fi
560
 
        fi
561
 
      fi
562
 
      if test "$compiler_o_lo" = yes; then
563
 
        output_obj="$libobj"
564
 
        command="$command -o $output_obj"
565
 
      elif test "$compiler_c_o" = yes; then
566
 
        output_obj="$obj"
567
 
        command="$command -o $output_obj"
568
 
      fi
569
 
 
570
 
      $run $rm "$output_obj"
 
864
 
 
865
      if test ! -d "${xdir}$objdir"; then
 
866
        $show "$mkdir ${xdir}$objdir"
 
867
        $run $mkdir ${xdir}$objdir
 
868
        status=$?
 
869
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
870
          exit $status
 
871
        fi
 
872
      fi
 
873
 
 
874
      if test -z "$output_obj"; then
 
875
        # Place PIC objects in $objdir
 
876
        command="$command -o $lobj"
 
877
      fi
 
878
 
 
879
      $run $rm "$lobj" "$output_obj"
 
880
 
571
881
      $show "$command"
572
882
      if $run eval "$command"; then :
573
883
      else
574
884
        test -n "$output_obj" && $run $rm $removelist
575
 
        exit 1
 
885
        exit $EXIT_FAILURE
576
886
      fi
577
887
 
578
888
      if test "$need_locks" = warn &&
579
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
580
 
        echo "\
 
889
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
890
        $echo "\
581
891
*** ERROR, $lockfile contains:
582
892
`cat $lockfile 2>/dev/null`
583
893
 
592
902
compiler."
593
903
 
594
904
        $run $rm $removelist
595
 
        exit 1
 
905
        exit $EXIT_FAILURE
596
906
      fi
597
907
 
598
908
      # Just move the object if needed, then go on to compile the next one
599
 
      if test x"$output_obj" != x"$libobj"; then
600
 
        $show "$mv $output_obj $libobj"
601
 
        if $run $mv $output_obj $libobj; then :
602
 
        else
603
 
          error=$?
604
 
          $run $rm $removelist
605
 
          exit $error
606
 
        fi
607
 
      fi
608
 
 
609
 
      # If we have no pic_flag, then copy the object into place and finish.
610
 
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
611
 
         test "$build_old_libs" = yes; then
612
 
        # Rename the .lo from within objdir to obj
613
 
        if test -f $obj; then
614
 
          $show $rm $obj
615
 
          $run $rm $obj
616
 
        fi
617
 
 
618
 
        $show "$mv $libobj $obj"
619
 
        if $run $mv $libobj $obj; then :
620
 
        else
621
 
          error=$?
622
 
          $run $rm $removelist
623
 
          exit $error
624
 
        fi
625
 
 
626
 
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
627
 
        if test "X$xdir" = "X$obj"; then
628
 
          xdir="."
629
 
        else
630
 
          xdir="$xdir"
631
 
        fi
632
 
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
633
 
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
634
 
        # Now arrange that obj and lo_libobj become the same file
635
 
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
636
 
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
637
 
          # Unlock the critical section if it was locked
638
 
          if test "$need_locks" != no; then
639
 
            $run $rm "$lockfile"
640
 
          fi
641
 
          exit 0
642
 
        else
643
 
          error=$?
644
 
          $run $rm $removelist
645
 
          exit $error
646
 
        fi
647
 
      fi
 
909
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 
910
        $show "$mv $output_obj $lobj"
 
911
        if $run $mv $output_obj $lobj; then :
 
912
        else
 
913
          error=$?
 
914
          $run $rm $removelist
 
915
          exit $error
 
916
        fi
 
917
      fi
 
918
 
 
919
      # Append the name of the PIC object to the libtool object file.
 
920
      test -z "$run" && cat >> ${libobj}T <<EOF
 
921
pic_object='$objdir/$objname'
 
922
 
 
923
EOF
648
924
 
649
925
      # Allow error messages only from the first compilation.
650
 
      suppress_output=' >/dev/null 2>&1'
 
926
      if test "$suppress_opt" = yes; then
 
927
        suppress_output=' >/dev/null 2>&1'
 
928
      fi
 
929
    else
 
930
      # No PIC object so indicate it doesn't exist in the libtool
 
931
      # object file.
 
932
      test -z "$run" && cat >> ${libobj}T <<EOF
 
933
pic_object=none
 
934
 
 
935
EOF
651
936
    fi
652
937
 
653
938
    # Only build a position-dependent object if we build old libraries.
656
941
        # Don't build PIC code
657
942
        command="$base_compile $srcfile"
658
943
      else
659
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
660
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
944
        command="$base_compile $srcfile $pic_flag"
661
945
      fi
662
946
      if test "$compiler_c_o" = yes; then
663
947
        command="$command -o $obj"
664
 
        output_obj="$obj"
665
948
      fi
666
949
 
667
950
      # Suppress compiler output if we already did a PIC compilation.
668
951
      command="$command$suppress_output"
669
 
      $run $rm "$output_obj"
 
952
      $run $rm "$obj" "$output_obj"
670
953
      $show "$command"
671
954
      if $run eval "$command"; then :
672
955
      else
673
956
        $run $rm $removelist
674
 
        exit 1
 
957
        exit $EXIT_FAILURE
675
958
      fi
676
959
 
677
960
      if test "$need_locks" = warn &&
678
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
679
 
        echo "\
 
961
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
962
        $echo "\
680
963
*** ERROR, $lockfile contains:
681
964
`cat $lockfile 2>/dev/null`
682
965
 
691
974
compiler."
692
975
 
693
976
        $run $rm $removelist
694
 
        exit 1
 
977
        exit $EXIT_FAILURE
695
978
      fi
696
979
 
697
980
      # Just move the object if needed
698
 
      if test x"$output_obj" != x"$obj"; then
 
981
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
699
982
        $show "$mv $output_obj $obj"
700
983
        if $run $mv $output_obj $obj; then :
701
984
        else
705
988
        fi
706
989
      fi
707
990
 
708
 
      # Create an invalid libtool object if no PIC, so that we do not
709
 
      # accidentally link it into a program.
710
 
      if test "$build_libtool_libs" != yes; then
711
 
        $show "echo timestamp > $libobj"
712
 
        $run eval "echo timestamp > \$libobj" || exit $?
713
 
      else
714
 
        # Move the .lo from within objdir
715
 
        $show "$mv $libobj $lo_libobj"
716
 
        if $run $mv $libobj $lo_libobj; then :
717
 
        else
718
 
          error=$?
719
 
          $run $rm $removelist
720
 
          exit $error
721
 
        fi
722
 
      fi
 
991
      # Append the name of the non-PIC object the libtool object file.
 
992
      # Only append if the libtool object file exists.
 
993
      test -z "$run" && cat >> ${libobj}T <<EOF
 
994
# Name of the non-PIC object.
 
995
non_pic_object='$objname'
 
996
 
 
997
EOF
 
998
    else
 
999
      # Append the name of the non-PIC object the libtool object file.
 
1000
      # Only append if the libtool object file exists.
 
1001
      test -z "$run" && cat >> ${libobj}T <<EOF
 
1002
# Name of the non-PIC object.
 
1003
non_pic_object=none
 
1004
 
 
1005
EOF
723
1006
    fi
724
1007
 
 
1008
    $run $mv "${libobj}T" "${libobj}"
 
1009
 
725
1010
    # Unlock the critical section if it was locked
726
1011
    if test "$need_locks" != no; then
727
1012
      $run $rm "$lockfile"
728
1013
    fi
729
1014
 
730
 
    exit 0
 
1015
    exit $EXIT_SUCCESS
731
1016
    ;;
732
1017
 
733
1018
  # libtool link mode
738
1023
      # It is impossible to link a dll without this setting, and
739
1024
      # we shouldn't force the makefile maintainer to figure out
740
1025
      # which system we are compiling for in order to pass an extra
741
 
      # flag for every libtool invokation.
 
1026
      # flag for every libtool invocation.
742
1027
      # allow_undefined=no
743
1028
 
744
1029
      # FIXME: Unfortunately, there are problems with the above when trying
753
1038
      ;;
754
1039
    esac
755
1040
    libtool_args="$nonopt"
 
1041
    base_compile="$nonopt $@"
756
1042
    compile_command="$nonopt"
757
1043
    finalize_command="$nonopt"
758
1044
 
768
1054
    linker_flags=
769
1055
    dllsearchpath=
770
1056
    lib_search_path=`pwd`
 
1057
    inst_prefix_dir=
771
1058
 
772
1059
    avoid_version=no
773
1060
    dlfiles=
782
1069
    module=no
783
1070
    no_install=no
784
1071
    objs=
 
1072
    non_pic_objects=
 
1073
    precious_files_regex=
785
1074
    prefer_static_libs=no
786
1075
    preload=no
787
1076
    prev=
793
1082
    temp_rpath=
794
1083
    thread_safe=no
795
1084
    vinfo=
 
1085
    vinfo_number=no
 
1086
 
 
1087
    func_infer_tag $base_compile
796
1088
 
797
1089
    # We need to know -static, to get the right output filenames.
798
1090
    for arg
823
1115
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
824
1116
 
825
1117
    # Go through the arguments, transforming them on the way.
826
 
    while test $# -gt 0; do
 
1118
    while test "$#" -gt 0; do
827
1119
      arg="$1"
828
1120
      shift
829
1121
      case $arg in
830
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
1122
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
831
1123
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
832
1124
        ;;
833
1125
      *) qarg=$arg ;;
888
1180
          export_symbols="$arg"
889
1181
          if test ! -f "$arg"; then
890
1182
            $echo "$modename: symbol file \`$arg' does not exist"
891
 
            exit 1
 
1183
            exit $EXIT_FAILURE
892
1184
          fi
893
1185
          prev=
894
1186
          continue
898
1190
          prev=
899
1191
          continue
900
1192
          ;;
 
1193
        inst_prefix)
 
1194
          inst_prefix_dir="$arg"
 
1195
          prev=
 
1196
          continue
 
1197
          ;;
 
1198
        precious_regex)
 
1199
          precious_files_regex="$arg"
 
1200
          prev=
 
1201
          continue
 
1202
          ;;
901
1203
        release)
902
1204
          release="-$arg"
903
1205
          prev=
904
1206
          continue
905
1207
          ;;
 
1208
        objectlist)
 
1209
          if test -f "$arg"; then
 
1210
            save_arg=$arg
 
1211
            moreargs=
 
1212
            for fil in `cat $save_arg`
 
1213
            do
 
1214
#             moreargs="$moreargs $fil"
 
1215
              arg=$fil
 
1216
              # A libtool-controlled object.
 
1217
 
 
1218
              # Check to see that this really is a libtool object.
 
1219
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1220
                pic_object=
 
1221
                non_pic_object=
 
1222
 
 
1223
                # Read the .lo file
 
1224
                # If there is no directory component, then add one.
 
1225
                case $arg in
 
1226
                */* | *\\*) . $arg ;;
 
1227
                *) . ./$arg ;;
 
1228
                esac
 
1229
 
 
1230
                if test -z "$pic_object" || \
 
1231
                   test -z "$non_pic_object" ||
 
1232
                   test "$pic_object" = none && \
 
1233
                   test "$non_pic_object" = none; then
 
1234
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1235
                  exit $EXIT_FAILURE
 
1236
                fi
 
1237
 
 
1238
                # Extract subdirectory from the argument.
 
1239
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1240
                if test "X$xdir" = "X$arg"; then
 
1241
                  xdir=
 
1242
                else
 
1243
                  xdir="$xdir/"
 
1244
                fi
 
1245
 
 
1246
                if test "$pic_object" != none; then
 
1247
                  # Prepend the subdirectory the object is found in.
 
1248
                  pic_object="$xdir$pic_object"
 
1249
 
 
1250
                  if test "$prev" = dlfiles; then
 
1251
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1252
                      dlfiles="$dlfiles $pic_object"
 
1253
                      prev=
 
1254
                      continue
 
1255
                    else
 
1256
                      # If libtool objects are unsupported, then we need to preload.
 
1257
                      prev=dlprefiles
 
1258
                    fi
 
1259
                  fi
 
1260
 
 
1261
                  # CHECK ME:  I think I busted this.  -Ossama
 
1262
                  if test "$prev" = dlprefiles; then
 
1263
                    # Preload the old-style object.
 
1264
                    dlprefiles="$dlprefiles $pic_object"
 
1265
                    prev=
 
1266
                  fi
 
1267
 
 
1268
                  # A PIC object.
 
1269
                  libobjs="$libobjs $pic_object"
 
1270
                  arg="$pic_object"
 
1271
                fi
 
1272
 
 
1273
                # Non-PIC object.
 
1274
                if test "$non_pic_object" != none; then
 
1275
                  # Prepend the subdirectory the object is found in.
 
1276
                  non_pic_object="$xdir$non_pic_object"
 
1277
 
 
1278
                  # A standard non-PIC object
 
1279
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1280
                  if test -z "$pic_object" || test "$pic_object" = none ; then
 
1281
                    arg="$non_pic_object"
 
1282
                  fi
 
1283
                fi
 
1284
              else
 
1285
                # Only an error if not doing a dry-run.
 
1286
                if test -z "$run"; then
 
1287
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1288
                  exit $EXIT_FAILURE
 
1289
                else
 
1290
                  # Dry-run case.
 
1291
 
 
1292
                  # Extract subdirectory from the argument.
 
1293
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1294
                  if test "X$xdir" = "X$arg"; then
 
1295
                    xdir=
 
1296
                  else
 
1297
                    xdir="$xdir/"
 
1298
                  fi
 
1299
 
 
1300
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1301
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1302
                  libobjs="$libobjs $pic_object"
 
1303
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1304
                fi
 
1305
              fi
 
1306
            done
 
1307
          else
 
1308
            $echo "$modename: link input file \`$save_arg' does not exist"
 
1309
            exit $EXIT_FAILURE
 
1310
          fi
 
1311
          arg=$save_arg
 
1312
          prev=
 
1313
          continue
 
1314
          ;;
906
1315
        rpath | xrpath)
907
1316
          # We need an absolute path.
908
1317
          case $arg in
909
1318
          [\\/]* | [A-Za-z]:[\\/]*) ;;
910
1319
          *)
911
1320
            $echo "$modename: only absolute run-paths are allowed" 1>&2
912
 
            exit 1
 
1321
            exit $EXIT_FAILURE
913
1322
            ;;
914
1323
          esac
915
1324
          if test "$prev" = rpath; then
941
1350
          finalize_command="$finalize_command $wl$qarg"
942
1351
          continue
943
1352
          ;;
 
1353
        xcclinker)
 
1354
          linker_flags="$linker_flags $qarg"
 
1355
          compiler_flags="$compiler_flags $qarg"
 
1356
          prev=
 
1357
          compile_command="$compile_command $qarg"
 
1358
          finalize_command="$finalize_command $qarg"
 
1359
          continue
 
1360
          ;;
 
1361
        shrext)
 
1362
          shrext_cmds="$arg"
 
1363
          prev=
 
1364
          continue
 
1365
          ;;
 
1366
        darwin_framework)
 
1367
          compiler_flags="$compiler_flags $arg"
 
1368
          prev=
 
1369
          continue
 
1370
          ;;
944
1371
        *)
945
1372
          eval "$prev=\"\$arg\""
946
1373
          prev=
947
1374
          continue
948
1375
          ;;
949
1376
        esac
950
 
      fi # test -n $prev
 
1377
      fi # test -n "$prev"
951
1378
 
952
1379
      prevarg="$arg"
953
1380
 
989
1416
      -export-symbols | -export-symbols-regex)
990
1417
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
991
1418
          $echo "$modename: more than one -exported-symbols argument is not allowed"
992
 
          exit 1
 
1419
          exit $EXIT_FAILURE
993
1420
        fi
994
1421
        if test "X$arg" = "X-export-symbols"; then
995
1422
          prev=expsyms
999
1426
        continue
1000
1427
        ;;
1001
1428
 
 
1429
      -framework)
 
1430
        prev=darwin_framework
 
1431
        compiler_flags="$compiler_flags $arg"
 
1432
        continue
 
1433
        ;;
 
1434
 
 
1435
      -inst-prefix-dir)
 
1436
        prev=inst_prefix
 
1437
        continue
 
1438
        ;;
 
1439
 
1002
1440
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1003
1441
      # so, if we see these flags be careful not to treat them like -L
1004
1442
      -L[A-Z][A-Z]*:*)
1005
1443
        case $with_gcc/$host in
1006
 
        no/*-*-irix* | no/*-*-nonstopux*)
 
1444
        no/*-*-irix* | /*-*-irix*)
1007
1445
          compile_command="$compile_command $arg"
1008
1446
          finalize_command="$finalize_command $arg"
1009
1447
          ;;
1020
1458
          absdir=`cd "$dir" && pwd`
1021
1459
          if test -z "$absdir"; then
1022
1460
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1023
 
            exit 1
 
1461
            exit $EXIT_FAILURE
1024
1462
          fi
1025
1463
          dir="$absdir"
1026
1464
          ;;
1054
1492
            # These systems don't actually have a C library (as such)
1055
1493
            test "X$arg" = "X-lc" && continue
1056
1494
            ;;
1057
 
          *-*-openbsd* | *-*-freebsd*)
 
1495
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1058
1496
            # Do not include libc due to us having libc/libc_r.
1059
1497
            test "X$arg" = "X-lc" && continue
1060
1498
            ;;
1061
 
          esac
1062
 
         elif test "X$arg" = "X-lc_r"; then
1063
 
          case $host in
1064
 
         *-*-openbsd* | *-*-freebsd*)
1065
 
            # Do not include libc_r directly, use -pthread flag.
 
1499
          *-*-rhapsody* | *-*-darwin1.[012])
 
1500
            # Rhapsody C and math libraries are in the System framework
 
1501
            deplibs="$deplibs -framework System"
1066
1502
            continue
1067
 
            ;;
1068
1503
          esac
 
1504
        elif test "X$arg" = "X-lc_r"; then
 
1505
         case $host in
 
1506
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
1507
           # Do not include libc_r directly, use -pthread flag.
 
1508
           continue
 
1509
           ;;
 
1510
         esac
1069
1511
        fi
1070
1512
        deplibs="$deplibs $arg"
1071
1513
        continue
1072
1514
        ;;
1073
1515
 
 
1516
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
1517
      # classes, name mangling, and exception handling.
 
1518
      -model)
 
1519
        compile_command="$compile_command $arg"
 
1520
        compiler_flags="$compiler_flags $arg"
 
1521
        finalize_command="$finalize_command $arg"
 
1522
        prev=xcompiler
 
1523
        continue
 
1524
        ;;
 
1525
 
 
1526
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1527
        compiler_flags="$compiler_flags $arg"
 
1528
        compile_command="$compile_command $arg"
 
1529
        finalize_command="$finalize_command $arg"
 
1530
        continue
 
1531
        ;;
 
1532
 
1074
1533
      -module)
1075
1534
        module=yes
1076
1535
        continue
1077
1536
        ;;
1078
1537
 
 
1538
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
 
1539
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
 
1540
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
 
1541
      # +DA*, +DD* enable 64-bit mode on the HP compiler
 
1542
      # -q* pass through compiler args for the IBM compiler
 
1543
      # -m* pass through architecture-specific compiler args for GCC
 
1544
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
 
1545
 
 
1546
        # Unknown arguments in both finalize_command and compile_command need
 
1547
        # to be aesthetically quoted because they are evaled later.
 
1548
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1549
        case $arg in
 
1550
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1551
          arg="\"$arg\""
 
1552
          ;;
 
1553
        esac
 
1554
        compile_command="$compile_command $arg"
 
1555
        finalize_command="$finalize_command $arg"
 
1556
        if test "$with_gcc" = "yes" ; then
 
1557
          compiler_flags="$compiler_flags $arg"
 
1558
        fi
 
1559
        continue
 
1560
        ;;
 
1561
 
 
1562
      -shrext)
 
1563
        prev=shrext
 
1564
        continue
 
1565
        ;;
 
1566
 
1079
1567
      -no-fast-install)
1080
1568
        fast_install=no
1081
1569
        continue
1100
1588
        continue
1101
1589
        ;;
1102
1590
 
 
1591
      -objectlist)
 
1592
        prev=objectlist
 
1593
        continue
 
1594
        ;;
 
1595
 
1103
1596
      -o) prev=output ;;
1104
1597
 
 
1598
      -precious-files-regex)
 
1599
        prev=precious_regex
 
1600
        continue
 
1601
        ;;
 
1602
 
1105
1603
      -release)
1106
1604
        prev=release
1107
1605
        continue
1124
1622
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1125
1623
        *)
1126
1624
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1127
 
          exit 1
 
1625
          exit $EXIT_FAILURE
1128
1626
          ;;
1129
1627
        esac
1130
1628
        case "$xrpath " in
1152
1650
        prev=vinfo
1153
1651
        continue
1154
1652
        ;;
 
1653
      -version-number)
 
1654
        prev=vinfo
 
1655
        vinfo_number=yes
 
1656
        continue
 
1657
        ;;
1155
1658
 
1156
1659
      -Wc,*)
1157
1660
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1160
1663
        for flag in $args; do
1161
1664
          IFS="$save_ifs"
1162
1665
          case $flag in
1163
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1666
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1164
1667
            flag="\"$flag\""
1165
1668
            ;;
1166
1669
          esac
1178
1681
        for flag in $args; do
1179
1682
          IFS="$save_ifs"
1180
1683
          case $flag in
1181
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1684
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1182
1685
            flag="\"$flag\""
1183
1686
            ;;
1184
1687
          esac
1200
1703
        continue
1201
1704
        ;;
1202
1705
 
 
1706
      -XCClinker)
 
1707
        prev=xcclinker
 
1708
        continue
 
1709
        ;;
 
1710
 
1203
1711
      # Some other compiler flag.
1204
1712
      -* | +*)
1205
1713
        # Unknown arguments in both finalize_command and compile_command need
1206
1714
        # to be aesthetically quoted because they are evaled later.
1207
1715
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1208
1716
        case $arg in
1209
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1717
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1210
1718
          arg="\"$arg\""
1211
1719
          ;;
1212
1720
        esac
1213
1721
        ;;
1214
1722
 
1215
 
      *.lo | *.$objext)
1216
 
        # A library or standard object.
1217
 
        if test "$prev" = dlfiles; then
1218
 
          # This file was specified with -dlopen.
1219
 
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1220
 
            dlfiles="$dlfiles $arg"
1221
 
            prev=
1222
 
            continue
1223
 
          else
1224
 
            # If libtool objects are unsupported, then we need to preload.
1225
 
            prev=dlprefiles
1226
 
          fi
1227
 
        fi
1228
 
 
1229
 
        if test "$prev" = dlprefiles; then
1230
 
          # Preload the old-style object.
1231
 
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1232
 
          prev=
1233
 
        else
 
1723
      *.$objext)
 
1724
        # A standard object.
 
1725
        objs="$objs $arg"
 
1726
        ;;
 
1727
 
 
1728
      *.lo)
 
1729
        # A libtool-controlled object.
 
1730
 
 
1731
        # Check to see that this really is a libtool object.
 
1732
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1733
          pic_object=
 
1734
          non_pic_object=
 
1735
 
 
1736
          # Read the .lo file
 
1737
          # If there is no directory component, then add one.
1234
1738
          case $arg in
1235
 
          *.lo) libobjs="$libobjs $arg" ;;
1236
 
          *) objs="$objs $arg" ;;
 
1739
          */* | *\\*) . $arg ;;
 
1740
          *) . ./$arg ;;
1237
1741
          esac
 
1742
 
 
1743
          if test -z "$pic_object" || \
 
1744
             test -z "$non_pic_object" ||
 
1745
             test "$pic_object" = none && \
 
1746
             test "$non_pic_object" = none; then
 
1747
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1748
            exit $EXIT_FAILURE
 
1749
          fi
 
1750
 
 
1751
          # Extract subdirectory from the argument.
 
1752
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1753
          if test "X$xdir" = "X$arg"; then
 
1754
            xdir=
 
1755
          else
 
1756
            xdir="$xdir/"
 
1757
          fi
 
1758
 
 
1759
          if test "$pic_object" != none; then
 
1760
            # Prepend the subdirectory the object is found in.
 
1761
            pic_object="$xdir$pic_object"
 
1762
 
 
1763
            if test "$prev" = dlfiles; then
 
1764
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1765
                dlfiles="$dlfiles $pic_object"
 
1766
                prev=
 
1767
                continue
 
1768
              else
 
1769
                # If libtool objects are unsupported, then we need to preload.
 
1770
                prev=dlprefiles
 
1771
              fi
 
1772
            fi
 
1773
 
 
1774
            # CHECK ME:  I think I busted this.  -Ossama
 
1775
            if test "$prev" = dlprefiles; then
 
1776
              # Preload the old-style object.
 
1777
              dlprefiles="$dlprefiles $pic_object"
 
1778
              prev=
 
1779
            fi
 
1780
 
 
1781
            # A PIC object.
 
1782
            libobjs="$libobjs $pic_object"
 
1783
            arg="$pic_object"
 
1784
          fi
 
1785
 
 
1786
          # Non-PIC object.
 
1787
          if test "$non_pic_object" != none; then
 
1788
            # Prepend the subdirectory the object is found in.
 
1789
            non_pic_object="$xdir$non_pic_object"
 
1790
 
 
1791
            # A standard non-PIC object
 
1792
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1793
            if test -z "$pic_object" || test "$pic_object" = none ; then
 
1794
              arg="$non_pic_object"
 
1795
            fi
 
1796
          fi
 
1797
        else
 
1798
          # Only an error if not doing a dry-run.
 
1799
          if test -z "$run"; then
 
1800
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1801
            exit $EXIT_FAILURE
 
1802
          else
 
1803
            # Dry-run case.
 
1804
 
 
1805
            # Extract subdirectory from the argument.
 
1806
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1807
            if test "X$xdir" = "X$arg"; then
 
1808
              xdir=
 
1809
            else
 
1810
              xdir="$xdir/"
 
1811
            fi
 
1812
 
 
1813
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1814
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1815
            libobjs="$libobjs $pic_object"
 
1816
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1817
          fi
1238
1818
        fi
1239
1819
        ;;
1240
1820
 
1268
1848
        # to be aesthetically quoted because they are evaled later.
1269
1849
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1270
1850
        case $arg in
1271
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1851
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1272
1852
          arg="\"$arg\""
1273
1853
          ;;
1274
1854
        esac
1285
1865
    if test -n "$prev"; then
1286
1866
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1287
1867
      $echo "$help" 1>&2
1288
 
      exit 1
 
1868
      exit $EXIT_FAILURE
1289
1869
    fi
1290
1870
 
1291
1871
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1294
1874
      finalize_command="$finalize_command $arg"
1295
1875
    fi
1296
1876
 
 
1877
    oldlibs=
1297
1878
    # calculate the name of the file, without its directory
1298
1879
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1299
1880
    libobjs_save="$libobjs"
1314
1895
      output_objdir="$output_objdir/$objdir"
1315
1896
    fi
1316
1897
    # Create the object directory.
1317
 
    if test ! -d $output_objdir; then
 
1898
    if test ! -d "$output_objdir"; then
1318
1899
      $show "$mkdir $output_objdir"
1319
1900
      $run $mkdir $output_objdir
1320
1901
      status=$?
1321
 
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1902
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1322
1903
        exit $status
1323
1904
      fi
1324
1905
    fi
1328
1909
    "")
1329
1910
      $echo "$modename: you must specify an output file" 1>&2
1330
1911
      $echo "$help" 1>&2
1331
 
      exit 1
 
1912
      exit $EXIT_FAILURE
1332
1913
      ;;
1333
1914
    *.$libext) linkmode=oldlib ;;
1334
1915
    *.lo | *.$objext) linkmode=obj ;;
1336
1917
    *) linkmode=prog ;; # Anything else should be a program.
1337
1918
    esac
1338
1919
 
 
1920
    case $host in
 
1921
    *cygwin* | *mingw* | *pw32*)
 
1922
      # don't eliminate duplications in $postdeps and $predeps
 
1923
      duplicate_compiler_generated_deps=yes
 
1924
      ;;
 
1925
    *)
 
1926
      duplicate_compiler_generated_deps=$duplicate_deps
 
1927
      ;;
 
1928
    esac
1339
1929
    specialdeplibs=
 
1930
 
1340
1931
    libs=
1341
1932
    # Find all interdependent deplibs by searching for libraries
1342
1933
    # that are linked more than once (e.g. -la -lb -la)
1348
1939
      fi
1349
1940
      libs="$libs $deplib"
1350
1941
    done
 
1942
 
 
1943
    if test "$linkmode" = lib; then
 
1944
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
1945
 
 
1946
      # Compute libraries that are listed more than once in $predeps
 
1947
      # $postdeps and mark them as special (i.e., whose duplicates are
 
1948
      # not to be eliminated).
 
1949
      pre_post_deps=
 
1950
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
1951
        for pre_post_dep in $predeps $postdeps; do
 
1952
          case "$pre_post_deps " in
 
1953
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
1954
          esac
 
1955
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
1956
        done
 
1957
      fi
 
1958
      pre_post_deps=
 
1959
    fi
 
1960
 
1351
1961
    deplibs=
1352
1962
    newdependency_libs=
1353
1963
    newlib_search_path=
1362
1972
          *.la) ;;
1363
1973
          *)
1364
1974
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1365
 
            exit 1
 
1975
            exit $EXIT_FAILURE
1366
1976
            ;;
1367
1977
          esac
1368
1978
        done
1379
1989
        ;;
1380
1990
    esac
1381
1991
    for pass in $passes; do
1382
 
      if test $linkmode = prog; then
1383
 
        # Determine which files to process
 
1992
      if test "$linkmode,$pass" = "lib,link" ||
 
1993
         test "$linkmode,$pass" = "prog,scan"; then
 
1994
        libs="$deplibs"
 
1995
        deplibs=
 
1996
      fi
 
1997
      if test "$linkmode" = prog; then
1384
1998
        case $pass in
1385
 
        dlopen)
1386
 
          libs="$dlfiles"
1387
 
          save_deplibs="$deplibs" # Collect dlpreopened libraries
1388
 
          deplibs=
1389
 
          ;;
 
1999
        dlopen) libs="$dlfiles" ;;
1390
2000
        dlpreopen) libs="$dlprefiles" ;;
1391
2001
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1392
2002
        esac
1393
2003
      fi
 
2004
      if test "$pass" = dlopen; then
 
2005
        # Collect dlpreopened libraries
 
2006
        save_deplibs="$deplibs"
 
2007
        deplibs=
 
2008
      fi
1394
2009
      for deplib in $libs; do
1395
2010
        lib=
1396
2011
        found=no
1397
2012
        case $deplib in
 
2013
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
2014
          if test "$linkmode,$pass" = "prog,link"; then
 
2015
            compile_deplibs="$deplib $compile_deplibs"
 
2016
            finalize_deplibs="$deplib $finalize_deplibs"
 
2017
          else
 
2018
            compiler_flags="$compiler_flags $deplib"
 
2019
          fi
 
2020
          continue
 
2021
          ;;
1398
2022
        -l*)
1399
 
          if test $linkmode = oldlib && test $linkmode = obj; then
1400
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1401
 
            continue
1402
 
          fi
1403
 
          if test $pass = conv; then
1404
 
            deplibs="$deplib $deplibs"
 
2023
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
2024
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1405
2025
            continue
1406
2026
          fi
1407
2027
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1408
2028
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1409
 
            # Search the libtool library
1410
 
            lib="$searchdir/lib${name}.la"
1411
 
            if test -f "$lib"; then
1412
 
              found=yes
1413
 
              break
1414
 
            fi
 
2029
            for search_ext in .la $std_shrext .so .a; do
 
2030
              # Search the libtool library
 
2031
              lib="$searchdir/lib${name}${search_ext}"
 
2032
              if test -f "$lib"; then
 
2033
                if test "$search_ext" = ".la"; then
 
2034
                  found=yes
 
2035
                else
 
2036
                  found=no
 
2037
                fi
 
2038
                break 2
 
2039
              fi
 
2040
            done
1415
2041
          done
1416
2042
          if test "$found" != yes; then
1417
2043
            # deplib doesn't seem to be a libtool library
1420
2046
              finalize_deplibs="$deplib $finalize_deplibs"
1421
2047
            else
1422
2048
              deplibs="$deplib $deplibs"
1423
 
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
2049
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1424
2050
            fi
1425
2051
            continue
 
2052
          else # deplib is a libtool library
 
2053
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
2054
            # We need to do some special things here, and not later.
 
2055
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
2056
              case " $predeps $postdeps " in
 
2057
              *" $deplib "*)
 
2058
                if (${SED} -e '2q' $lib |
 
2059
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
2060
                  library_names=
 
2061
                  old_library=
 
2062
                  case $lib in
 
2063
                  */* | *\\*) . $lib ;;
 
2064
                  *) . ./$lib ;;
 
2065
                  esac
 
2066
                  for l in $old_library $library_names; do
 
2067
                    ll="$l"
 
2068
                  done
 
2069
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
2070
                    found=no
 
2071
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
2072
                    test "X$ladir" = "X$lib" && ladir="."
 
2073
                    lib=$ladir/$old_library
 
2074
                    if test "$linkmode,$pass" = "prog,link"; then
 
2075
                      compile_deplibs="$deplib $compile_deplibs"
 
2076
                      finalize_deplibs="$deplib $finalize_deplibs"
 
2077
                    else
 
2078
                      deplibs="$deplib $deplibs"
 
2079
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
2080
                    fi
 
2081
                    continue
 
2082
                  fi
 
2083
                fi
 
2084
                ;;
 
2085
              *) ;;
 
2086
              esac
 
2087
            fi
1426
2088
          fi
1427
2089
          ;; # -l
1428
2090
        -L*)
1429
2091
          case $linkmode in
1430
2092
          lib)
1431
2093
            deplibs="$deplib $deplibs"
1432
 
            test $pass = conv && continue
 
2094
            test "$pass" = conv && continue
1433
2095
            newdependency_libs="$deplib $newdependency_libs"
1434
2096
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1435
2097
            ;;
1436
2098
          prog)
1437
 
            if test $pass = conv; then
 
2099
            if test "$pass" = conv; then
1438
2100
              deplibs="$deplib $deplibs"
1439
2101
              continue
1440
2102
            fi
1441
 
            if test $pass = scan; then
 
2103
            if test "$pass" = scan; then
1442
2104
              deplibs="$deplib $deplibs"
1443
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1444
2105
            else
1445
2106
              compile_deplibs="$deplib $compile_deplibs"
1446
2107
              finalize_deplibs="$deplib $finalize_deplibs"
1447
2108
            fi
 
2109
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1448
2110
            ;;
1449
2111
          *)
1450
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
2112
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1451
2113
            ;;
1452
2114
          esac # linkmode
1453
2115
          continue
1454
2116
          ;; # -L
1455
2117
        -R*)
1456
 
          if test $pass = link; then
 
2118
          if test "$pass" = link; then
1457
2119
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1458
2120
            # Make sure the xrpath contains only unique directories.
1459
2121
            case "$xrpath " in
1466
2128
          ;;
1467
2129
        *.la) lib="$deplib" ;;
1468
2130
        *.$libext)
1469
 
          if test $pass = conv; then
 
2131
          if test "$pass" = conv; then
1470
2132
            deplibs="$deplib $deplibs"
1471
2133
            continue
1472
2134
          fi
1473
2135
          case $linkmode in
1474
2136
          lib)
1475
 
            if test "$deplibs_check_method" != pass_all; then
1476
 
              echo
1477
 
              echo "*** Warning: Trying to link with static lib archive $deplib."
1478
 
              echo "*** I have the capability to make that library automatically link in when"
1479
 
              echo "*** you link to this library.  But I can only do this if you have a"
1480
 
              echo "*** shared version of the library, which you do not appear to have"
1481
 
              echo "*** because the file extensions .$libext of this argument makes me believe"
1482
 
              echo "*** that it is just a static archive that I should not used here."
 
2137
            valid_a_lib=no
 
2138
            case $deplibs_check_method in
 
2139
              match_pattern*)
 
2140
                set dummy $deplibs_check_method
 
2141
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2142
                if eval $echo \"$deplib\" 2>/dev/null \
 
2143
                    | $SED 10q \
 
2144
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2145
                  valid_a_lib=yes
 
2146
                fi
 
2147
                ;;
 
2148
              pass_all)
 
2149
                valid_a_lib=yes
 
2150
                ;;
 
2151
            esac
 
2152
            if test "$valid_a_lib" != yes; then
 
2153
              $echo
 
2154
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
2155
              $echo "*** I have the capability to make that library automatically link in when"
 
2156
              $echo "*** you link to this library.  But I can only do this if you have a"
 
2157
              $echo "*** shared version of the library, which you do not appear to have"
 
2158
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
2159
              $echo "*** that it is just a static archive that I should not used here."
1483
2160
            else
1484
 
              echo
1485
 
              echo "*** Warning: Linking the shared library $output against the"
1486
 
              echo "*** static library $deplib is not portable!"
 
2161
              $echo
 
2162
              $echo "*** Warning: Linking the shared library $output against the"
 
2163
              $echo "*** static library $deplib is not portable!"
1487
2164
              deplibs="$deplib $deplibs"
1488
2165
            fi
1489
2166
            continue
1490
2167
            ;;
1491
2168
          prog)
1492
 
            if test $pass != link; then
 
2169
            if test "$pass" != link; then
1493
2170
              deplibs="$deplib $deplibs"
1494
2171
            else
1495
2172
              compile_deplibs="$deplib $compile_deplibs"
1500
2177
          esac # linkmode
1501
2178
          ;; # *.$libext
1502
2179
        *.lo | *.$objext)
1503
 
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1504
 
            # If there is no dlopen support or we're linking statically,
1505
 
            # we need to preload.
1506
 
            newdlprefiles="$newdlprefiles $deplib"
1507
 
            compile_deplibs="$deplib $compile_deplibs"
1508
 
            finalize_deplibs="$deplib $finalize_deplibs"
1509
 
          else
1510
 
            newdlfiles="$newdlfiles $deplib"
 
2180
          if test "$pass" = conv; then
 
2181
            deplibs="$deplib $deplibs"
 
2182
          elif test "$linkmode" = prog; then
 
2183
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2184
              # If there is no dlopen support or we're linking statically,
 
2185
              # we need to preload.
 
2186
              newdlprefiles="$newdlprefiles $deplib"
 
2187
              compile_deplibs="$deplib $compile_deplibs"
 
2188
              finalize_deplibs="$deplib $finalize_deplibs"
 
2189
            else
 
2190
              newdlfiles="$newdlfiles $deplib"
 
2191
            fi
1511
2192
          fi
1512
2193
          continue
1513
2194
          ;;
1516
2197
          continue
1517
2198
          ;;
1518
2199
        esac # case $deplib
1519
 
        if test $found = yes || test -f "$lib"; then :
 
2200
        if test "$found" = yes || test -f "$lib"; then :
1520
2201
        else
1521
2202
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1522
 
          exit 1
 
2203
          exit $EXIT_FAILURE
1523
2204
        fi
1524
2205
 
1525
2206
        # Check to see that this really is a libtool archive.
1526
 
        if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2207
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1527
2208
        else
1528
2209
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1529
 
          exit 1
 
2210
          exit $EXIT_FAILURE
1530
2211
        fi
1531
2212
 
1532
2213
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1539
2220
        library_names=
1540
2221
        old_library=
1541
2222
        # If the library was installed with an old release of libtool,
1542
 
        # it will not redefine variable installed.
 
2223
        # it will not redefine variables installed, or shouldnotlink
1543
2224
        installed=yes
 
2225
        shouldnotlink=no
 
2226
        avoidtemprpath=
 
2227
 
1544
2228
 
1545
2229
        # Read the .la file
1546
2230
        case $lib in
1550
2234
 
1551
2235
        if test "$linkmode,$pass" = "lib,link" ||
1552
2236
           test "$linkmode,$pass" = "prog,scan" ||
1553
 
           { test $linkmode = oldlib && test $linkmode = obj; }; then
1554
 
           # Add dl[pre]opened files of deplib
 
2237
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1555
2238
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1556
2239
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1557
2240
        fi
1558
2241
 
1559
 
        if test $pass = conv; then
 
2242
        if test "$pass" = conv; then
1560
2243
          # Only check for convenience libraries
1561
2244
          deplibs="$lib $deplibs"
1562
2245
          if test -z "$libdir"; then
1563
2246
            if test -z "$old_library"; then
1564
2247
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1565
 
              exit 1
 
2248
              exit $EXIT_FAILURE
1566
2249
            fi
1567
2250
            # It is a libtool convenience library, so add in its objects.
1568
2251
            convenience="$convenience $ladir/$objdir/$old_library"
1577
2260
              fi
1578
2261
              tmp_libs="$tmp_libs $deplib"
1579
2262
            done
1580
 
          elif test $linkmode != prog && test $linkmode != lib; then
 
2263
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1581
2264
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1582
 
            exit 1
 
2265
            exit $EXIT_FAILURE
1583
2266
          fi
1584
2267
          continue
1585
2268
        fi # $pass = conv
1586
2269
 
 
2270
 
1587
2271
        # Get the name of the library we link against.
1588
2272
        linklib=
1589
2273
        for l in $old_library $library_names; do
1591
2275
        done
1592
2276
        if test -z "$linklib"; then
1593
2277
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1594
 
          exit 1
 
2278
          exit $EXIT_FAILURE
1595
2279
        fi
1596
2280
 
1597
2281
        # This library was specified with -dlopen.
1598
 
        if test $pass = dlopen; then
 
2282
        if test "$pass" = dlopen; then
1599
2283
          if test -z "$libdir"; then
1600
2284
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1601
 
            exit 1
 
2285
            exit $EXIT_FAILURE
1602
2286
          fi
1603
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2287
          if test -z "$dlname" ||
 
2288
             test "$dlopen_support" != yes ||
 
2289
             test "$build_libtool_libs" = no; then
1604
2290
            # If there is no dlname, no dlopen support or we're linking
1605
 
            # statically, we need to preload.
1606
 
            dlprefiles="$dlprefiles $lib"
 
2291
            # statically, we need to preload.  We also need to preload any
 
2292
            # dependent libraries so libltdl's deplib preloader doesn't
 
2293
            # bomb out in the load deplibs phase.
 
2294
            dlprefiles="$dlprefiles $lib $dependency_libs"
1607
2295
          else
1608
2296
            newdlfiles="$newdlfiles $lib"
1609
2297
          fi
1635
2323
            dir="$libdir"
1636
2324
            absdir="$libdir"
1637
2325
          fi
 
2326
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
1638
2327
        else
1639
 
          dir="$ladir/$objdir"
1640
 
          absdir="$abs_ladir/$objdir"
1641
 
          # Remove this search path later
1642
 
          notinst_path="$notinst_path $abs_ladir"
 
2328
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2329
            dir="$ladir"
 
2330
            absdir="$abs_ladir"
 
2331
            # Remove this search path later
 
2332
            notinst_path="$notinst_path $abs_ladir"
 
2333
          else
 
2334
            dir="$ladir/$objdir"
 
2335
            absdir="$abs_ladir/$objdir"
 
2336
            # Remove this search path later
 
2337
            notinst_path="$notinst_path $abs_ladir"
 
2338
          fi
1643
2339
        fi # $installed = yes
1644
2340
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1645
2341
 
1646
2342
        # This library was specified with -dlpreopen.
1647
 
        if test $pass = dlpreopen; then
 
2343
        if test "$pass" = dlpreopen; then
1648
2344
          if test -z "$libdir"; then
1649
2345
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1650
 
            exit 1
 
2346
            exit $EXIT_FAILURE
1651
2347
          fi
1652
2348
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1653
2349
          # are required to link).
1663
2359
 
1664
2360
        if test -z "$libdir"; then
1665
2361
          # Link the convenience library
1666
 
          if test $linkmode = lib; then
 
2362
          if test "$linkmode" = lib; then
1667
2363
            deplibs="$dir/$old_library $deplibs"
1668
2364
          elif test "$linkmode,$pass" = "prog,link"; then
1669
2365
            compile_deplibs="$dir/$old_library $compile_deplibs"
1670
2366
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1671
2367
          else
1672
 
            deplibs="$lib $deplibs"
 
2368
            deplibs="$lib $deplibs" # used for prog,scan pass
1673
2369
          fi
1674
2370
          continue
1675
2371
        fi
1676
2372
 
1677
 
        if test $linkmode = prog && test $pass != link; then
 
2373
 
 
2374
        if test "$linkmode" = prog && test "$pass" != link; then
1678
2375
          newlib_search_path="$newlib_search_path $ladir"
1679
2376
          deplibs="$lib $deplibs"
1680
2377
 
1690
2387
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1691
2388
            esac
1692
2389
            # Need to link against all dependency_libs?
1693
 
            if test $linkalldeplibs = yes; then
 
2390
            if test "$linkalldeplibs" = yes; then
1694
2391
              deplibs="$deplib $deplibs"
1695
2392
            else
1696
2393
              # Need to hardcode shared library paths
1707
2404
          continue
1708
2405
        fi # $linkmode = prog...
1709
2406
 
 
2407
        if test "$linkmode,$pass" = "prog,link"; then
 
2408
          if test -n "$library_names" &&
 
2409
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2410
            # We need to hardcode the library path
 
2411
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 
2412
              # Make sure the rpath contains only unique directories.
 
2413
              case "$temp_rpath " in
 
2414
              *" $dir "*) ;;
 
2415
              *" $absdir "*) ;;
 
2416
              *) temp_rpath="$temp_rpath $dir" ;;
 
2417
              esac
 
2418
            fi
 
2419
 
 
2420
            # Hardcode the library path.
 
2421
            # Skip directories that are in the system default run-time
 
2422
            # search path.
 
2423
            case " $sys_lib_dlsearch_path " in
 
2424
            *" $absdir "*) ;;
 
2425
            *)
 
2426
              case "$compile_rpath " in
 
2427
              *" $absdir "*) ;;
 
2428
              *) compile_rpath="$compile_rpath $absdir"
 
2429
              esac
 
2430
              ;;
 
2431
            esac
 
2432
            case " $sys_lib_dlsearch_path " in
 
2433
            *" $libdir "*) ;;
 
2434
            *)
 
2435
              case "$finalize_rpath " in
 
2436
              *" $libdir "*) ;;
 
2437
              *) finalize_rpath="$finalize_rpath $libdir"
 
2438
              esac
 
2439
              ;;
 
2440
            esac
 
2441
          fi # $linkmode,$pass = prog,link...
 
2442
 
 
2443
          if test "$alldeplibs" = yes &&
 
2444
             { test "$deplibs_check_method" = pass_all ||
 
2445
               { test "$build_libtool_libs" = yes &&
 
2446
                 test -n "$library_names"; }; }; then
 
2447
            # We only need to search for static libraries
 
2448
            continue
 
2449
          fi
 
2450
        fi
 
2451
 
1710
2452
        link_static=no # Whether the deplib will be linked statically
1711
2453
        if test -n "$library_names" &&
1712
2454
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1713
 
          # Link against this shared library
1714
 
 
1715
 
          if test "$linkmode,$pass" = "prog,link" ||
1716
 
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1717
 
            # Hardcode the library path.
1718
 
            # Skip directories that are in the system default run-time
1719
 
            # search path.
1720
 
            case " $sys_lib_dlsearch_path " in
1721
 
            *" $absdir "*) ;;
1722
 
            *)
1723
 
              case "$compile_rpath " in
1724
 
              *" $absdir "*) ;;
1725
 
              *) compile_rpath="$compile_rpath $absdir"
1726
 
              esac
1727
 
              ;;
1728
 
            esac
1729
 
            case " $sys_lib_dlsearch_path " in
1730
 
            *" $libdir "*) ;;
1731
 
            *)
1732
 
              case "$finalize_rpath " in
1733
 
              *" $libdir "*) ;;
1734
 
              *) finalize_rpath="$finalize_rpath $libdir"
1735
 
              esac
1736
 
              ;;
1737
 
            esac
1738
 
            if test $linkmode = prog; then
1739
 
              # We need to hardcode the library path
1740
 
              if test -n "$shlibpath_var"; then
1741
 
                # Make sure the rpath contains only unique directories.
1742
 
                case "$temp_rpath " in
1743
 
                *" $dir "*) ;;
1744
 
                *" $absdir "*) ;;
1745
 
                *) temp_rpath="$temp_rpath $dir" ;;
1746
 
                esac
1747
 
              fi
1748
 
            fi
1749
 
          fi # $linkmode,$pass = prog,link...
1750
 
 
1751
 
          if test "$alldeplibs" = yes &&
1752
 
             { test "$deplibs_check_method" = pass_all ||
1753
 
               { test "$build_libtool_libs" = yes &&
1754
 
                 test -n "$library_names"; }; }; then
1755
 
            # We only need to search for static libraries
1756
 
            continue
1757
 
          fi
1758
 
 
1759
2455
          if test "$installed" = no; then
1760
2456
            notinst_deplibs="$notinst_deplibs $lib"
1761
2457
            need_relink=yes
1762
2458
          fi
 
2459
          # This is a shared library
 
2460
 
 
2461
          # Warn about portability, can't link against -module's on
 
2462
          # some systems (darwin)
 
2463
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2464
            $echo
 
2465
            if test "$linkmode" = prog; then
 
2466
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
2467
            else
 
2468
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
2469
            fi
 
2470
            $echo "*** $linklib is not portable!"
 
2471
          fi
 
2472
          if test "$linkmode" = lib &&
 
2473
             test "$hardcode_into_libs" = yes; then
 
2474
            # Hardcode the library path.
 
2475
            # Skip directories that are in the system default run-time
 
2476
            # search path.
 
2477
            case " $sys_lib_dlsearch_path " in
 
2478
            *" $absdir "*) ;;
 
2479
            *)
 
2480
              case "$compile_rpath " in
 
2481
              *" $absdir "*) ;;
 
2482
              *) compile_rpath="$compile_rpath $absdir"
 
2483
              esac
 
2484
              ;;
 
2485
            esac
 
2486
            case " $sys_lib_dlsearch_path " in
 
2487
            *" $libdir "*) ;;
 
2488
            *)
 
2489
              case "$finalize_rpath " in
 
2490
              *" $libdir "*) ;;
 
2491
              *) finalize_rpath="$finalize_rpath $libdir"
 
2492
              esac
 
2493
              ;;
 
2494
            esac
 
2495
          fi
1763
2496
 
1764
2497
          if test -n "$old_archive_from_expsyms_cmds"; then
1765
2498
            # figure out the soname
1773
2506
            elif test -n "$soname_spec"; then
1774
2507
              # bleh windows
1775
2508
              case $host in
1776
 
              *cygwin*)
 
2509
              *cygwin* | mingw*)
1777
2510
                major=`expr $current - $age`
1778
2511
                versuffix="-$major"
1779
2512
                ;;
1785
2518
 
1786
2519
            # Make a new name for the extract_expsyms_cmds to use
1787
2520
            soroot="$soname"
1788
 
            soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1789
 
            newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
2521
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2522
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1790
2523
 
1791
2524
            # If the library has no export list, then create one now
1792
2525
            if test -f "$output_objdir/$soname-def"; then :
1793
2526
            else
1794
2527
              $show "extracting exported symbol list from \`$soname'"
1795
2528
              save_ifs="$IFS"; IFS='~'
1796
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2529
              cmds=$extract_expsyms_cmds
1797
2530
              for cmd in $cmds; do
1798
2531
                IFS="$save_ifs"
 
2532
                eval cmd=\"$cmd\"
1799
2533
                $show "$cmd"
1800
2534
                $run eval "$cmd" || exit $?
1801
2535
              done
1806
2540
            if test -f "$output_objdir/$newlib"; then :; else
1807
2541
              $show "generating import library for \`$soname'"
1808
2542
              save_ifs="$IFS"; IFS='~'
1809
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2543
              cmds=$old_archive_from_expsyms_cmds
1810
2544
              for cmd in $cmds; do
1811
2545
                IFS="$save_ifs"
 
2546
                eval cmd=\"$cmd\"
1812
2547
                $show "$cmd"
1813
2548
                $run eval "$cmd" || exit $?
1814
2549
              done
1817
2552
            # make sure the library variables are pointing to the new library
1818
2553
            dir=$output_objdir
1819
2554
            linklib=$newlib
1820
 
          fi # test -n $old_archive_from_expsyms_cmds
 
2555
          fi # test -n "$old_archive_from_expsyms_cmds"
1821
2556
 
1822
 
          if test $linkmode = prog || test "$mode" != relink; then
 
2557
          if test "$linkmode" = prog || test "$mode" != relink; then
1823
2558
            add_shlibpath=
1824
2559
            add_dir=
1825
2560
            add=
1828
2563
            immediate | unsupported)
1829
2564
              if test "$hardcode_direct" = no; then
1830
2565
                add="$dir/$linklib"
 
2566
                case $host in
 
2567
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2568
                  *-*-darwin* )
 
2569
                    # if the lib is a module then we can not link against
 
2570
                    # it, someone is ignoring the new warnings I added
 
2571
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2572
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2573
                      if test -z "$old_library" ; then
 
2574
                        $echo
 
2575
                        $echo "** And there doesn't seem to be a static archive available"
 
2576
                        $echo "** The link will probably fail, sorry"
 
2577
                      else
 
2578
                        add="$dir/$old_library"
 
2579
                      fi
 
2580
                    fi
 
2581
                esac
1831
2582
              elif test "$hardcode_minus_L" = no; then
1832
2583
                case $host in
1833
2584
                *-*-sunos*) add_shlibpath="$dir" ;;
1846
2597
                add="$dir/$linklib"
1847
2598
              elif test "$hardcode_minus_L" = yes; then
1848
2599
                add_dir="-L$dir"
 
2600
                # Try looking first in the location we're being installed to.
 
2601
                if test -n "$inst_prefix_dir"; then
 
2602
                  case "$libdir" in
 
2603
                    [\\/]*)
 
2604
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2605
                      ;;
 
2606
                  esac
 
2607
                fi
1849
2608
                add="-l$name"
1850
2609
              elif test "$hardcode_shlibpath_var" = yes; then
1851
2610
                add_shlibpath="$dir"
1859
2618
 
1860
2619
            if test "$lib_linked" != yes; then
1861
2620
              $echo "$modename: configuration error: unsupported hardcode properties"
1862
 
              exit 1
 
2621
              exit $EXIT_FAILURE
1863
2622
            fi
1864
2623
 
1865
2624
            if test -n "$add_shlibpath"; then
1868
2627
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1869
2628
              esac
1870
2629
            fi
1871
 
            if test $linkmode = prog; then
 
2630
            if test "$linkmode" = prog; then
1872
2631
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1873
2632
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1874
2633
            else
1885
2644
            fi
1886
2645
          fi
1887
2646
 
1888
 
          if test $linkmode = prog || test "$mode" = relink; then
 
2647
          if test "$linkmode" = prog || test "$mode" = relink; then
1889
2648
            add_shlibpath=
1890
2649
            add_dir=
1891
2650
            add=
1901
2660
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1902
2661
              esac
1903
2662
              add="-l$name"
 
2663
            elif test "$hardcode_automatic" = yes; then
 
2664
              if test -n "$inst_prefix_dir" &&
 
2665
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2666
                add="$inst_prefix_dir$libdir/$linklib"
 
2667
              else
 
2668
                add="$libdir/$linklib"
 
2669
              fi
1904
2670
            else
1905
2671
              # We cannot seem to hardcode it, guess we'll fake it.
1906
2672
              add_dir="-L$libdir"
 
2673
              # Try looking first in the location we're being installed to.
 
2674
              if test -n "$inst_prefix_dir"; then
 
2675
                case "$libdir" in
 
2676
                  [\\/]*)
 
2677
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2678
                    ;;
 
2679
                esac
 
2680
              fi
1907
2681
              add="-l$name"
1908
2682
            fi
1909
2683
 
1910
 
            if test $linkmode = prog; then
 
2684
            if test "$linkmode" = prog; then
1911
2685
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1912
2686
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1913
2687
            else
1915
2689
              test -n "$add" && deplibs="$add $deplibs"
1916
2690
            fi
1917
2691
          fi
1918
 
        elif test $linkmode = prog; then
1919
 
          if test "$alldeplibs" = yes &&
1920
 
             { test "$deplibs_check_method" = pass_all ||
1921
 
               { test "$build_libtool_libs" = yes &&
1922
 
                 test -n "$library_names"; }; }; then
1923
 
            # We only need to search for static libraries
1924
 
            continue
1925
 
          fi
1926
 
 
1927
 
          # Try to link the static library
 
2692
        elif test "$linkmode" = prog; then
1928
2693
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1929
2694
          # is not unsupported.  This is valid on all known static and
1930
2695
          # shared platforms.
1944
2709
 
1945
2710
            # Just print a warning and add the library to dependency_libs so
1946
2711
            # that the program can be linked against the static library.
1947
 
            echo
1948
 
            echo "*** Warning: This system can not link to static lib archive $lib."
1949
 
            echo "*** I have the capability to make that library automatically link in when"
1950
 
            echo "*** you link to this library.  But I can only do this if you have a"
1951
 
            echo "*** shared version of the library, which you do not appear to have."
 
2712
            $echo
 
2713
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2714
            $echo "*** I have the capability to make that library automatically link in when"
 
2715
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2716
            $echo "*** shared version of the library, which you do not appear to have."
1952
2717
            if test "$module" = yes; then
1953
 
              echo "*** But as you try to build a module library, libtool will still create "
1954
 
              echo "*** a static module, that should work as long as the dlopening application"
1955
 
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
2718
              $echo "*** But as you try to build a module library, libtool will still create "
 
2719
              $echo "*** a static module, that should work as long as the dlopening application"
 
2720
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1956
2721
              if test -z "$global_symbol_pipe"; then
1957
 
                echo
1958
 
                echo "*** However, this would only work if libtool was able to extract symbol"
1959
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1960
 
                echo "*** not find such a program.  So, this module is probably useless."
1961
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2722
                $echo
 
2723
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2724
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2725
                $echo "*** not find such a program.  So, this module is probably useless."
 
2726
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
1962
2727
              fi
1963
2728
              if test "$build_old_libs" = no; then
1964
2729
                build_libtool_libs=module
1975
2740
          fi
1976
2741
        fi # link shared/static library?
1977
2742
 
1978
 
        if test $linkmode = lib; then
 
2743
        if test "$linkmode" = lib; then
1979
2744
          if test -n "$dependency_libs" &&
1980
 
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1981
 
               test $link_static = yes; }; then
 
2745
             { test "$hardcode_into_libs" != yes ||
 
2746
               test "$build_old_libs" = yes ||
 
2747
               test "$link_static" = yes; }; then
1982
2748
            # Extract -R from dependency_libs
1983
2749
            temp_deplibs=
1984
2750
            for libdir in $dependency_libs; do
2009
2775
            tmp_libs="$tmp_libs $deplib"
2010
2776
          done
2011
2777
 
2012
 
          if test $link_all_deplibs != no; then
 
2778
          if test "$link_all_deplibs" != no; then
2013
2779
            # Add the search paths of all dependency libraries
2014
2780
            for deplib in $dependency_libs; do
2015
2781
              case $deplib in
2029
2795
                  ;;
2030
2796
                esac
2031
2797
                if grep "^installed=no" $deplib > /dev/null; then
2032
 
                  path="-L$absdir/$objdir"
 
2798
                  path="$absdir/$objdir"
2033
2799
                else
2034
2800
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2035
2801
                  if test -z "$libdir"; then
2036
2802
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2037
 
                    exit 1
 
2803
                    exit $EXIT_FAILURE
2038
2804
                  fi
2039
2805
                  if test "$absdir" != "$libdir"; then
2040
2806
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2041
2807
                  fi
2042
 
                  path="-L$absdir"
 
2808
                  path="$absdir"
2043
2809
                fi
 
2810
                depdepl=
 
2811
                case $host in
 
2812
                *-*-darwin*)
 
2813
                  # we do not want to link against static libs,
 
2814
                  # but need to link against shared
 
2815
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2816
                  if test -n "$deplibrary_names" ; then
 
2817
                    for tmp in $deplibrary_names ; do
 
2818
                      depdepl=$tmp
 
2819
                    done
 
2820
                    if test -f "$path/$depdepl" ; then
 
2821
                      depdepl="$path/$depdepl"
 
2822
                    fi
 
2823
                    # do not add paths which are already there
 
2824
                    case " $newlib_search_path " in
 
2825
                    *" $path "*) ;;
 
2826
                    *) newlib_search_path="$newlib_search_path $path";;
 
2827
                    esac
 
2828
                  fi
 
2829
                  path=""
 
2830
                  ;;
 
2831
                *)
 
2832
                  path="-L$path"
 
2833
                  ;;
 
2834
                esac
 
2835
                ;;
 
2836
              -l*)
 
2837
                case $host in
 
2838
                *-*-darwin*)
 
2839
                  # Again, we only want to link against shared libraries
 
2840
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2841
                  for tmp in $newlib_search_path ; do
 
2842
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2843
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2844
                      break
 
2845
                    fi
 
2846
                  done
 
2847
                  path=""
 
2848
                  ;;
 
2849
                *) continue ;;
 
2850
                esac
2044
2851
                ;;
2045
2852
              *) continue ;;
2046
2853
              esac
2047
2854
              case " $deplibs " in
 
2855
              *" $depdepl "*) ;;
 
2856
              *) deplibs="$depdepl $deplibs" ;;
 
2857
              esac
 
2858
              case " $deplibs " in
2048
2859
              *" $path "*) ;;
2049
2860
              *) deplibs="$deplibs $path" ;;
2050
2861
              esac
2052
2863
          fi # link_all_deplibs != no
2053
2864
        fi # linkmode = lib
2054
2865
      done # for deplib in $libs
2055
 
      if test $pass = dlpreopen; then
 
2866
      dependency_libs="$newdependency_libs"
 
2867
      if test "$pass" = dlpreopen; then
2056
2868
        # Link the dlpreopened libraries before other libraries
2057
2869
        for deplib in $save_deplibs; do
2058
2870
          deplibs="$deplib $deplibs"
2059
2871
        done
2060
2872
      fi
2061
 
      if test $pass != dlopen; then
2062
 
        test $pass != scan && dependency_libs="$newdependency_libs"
2063
 
        if test $pass != conv; then
 
2873
      if test "$pass" != dlopen; then
 
2874
        if test "$pass" != conv; then
2064
2875
          # Make sure lib_search_path contains only unique directories.
2065
2876
          lib_search_path=
2066
2877
          for dir in $newlib_search_path; do
2082
2893
          eval tmp_libs=\"\$$var\"
2083
2894
          new_libs=
2084
2895
          for deplib in $tmp_libs; do
 
2896
            # FIXME: Pedantically, this is the right thing to do, so
 
2897
            #        that some nasty dependency loop isn't accidentally
 
2898
            #        broken:
 
2899
            #new_libs="$deplib $new_libs"
 
2900
            # Pragmatically, this seems to cause very few problems in
 
2901
            # practice:
2085
2902
            case $deplib in
2086
2903
            -L*) new_libs="$deplib $new_libs" ;;
 
2904
            -R*) ;;
2087
2905
            *)
 
2906
              # And here is the reason: when a library appears more
 
2907
              # than once as an explicit dependence of a library, or
 
2908
              # is implicitly linked in more than once by the
 
2909
              # compiler, it is considered special, and multiple
 
2910
              # occurrences thereof are not removed.  Compare this
 
2911
              # with having the same library being listed as a
 
2912
              # dependency of multiple other libraries: in this case,
 
2913
              # we know (pedantically, we assume) the library does not
 
2914
              # need to be listed more than once, so we keep only the
 
2915
              # last copy.  This is not always right, but it is rare
 
2916
              # enough that we require users that really mean to play
 
2917
              # such unportable linking tricks to link the library
 
2918
              # using -Wl,-lname, so that libtool does not consider it
 
2919
              # for duplicate removal.
2088
2920
              case " $specialdeplibs " in
2089
2921
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2090
2922
              *)
2112
2944
          eval $var=\"$tmp_libs\"
2113
2945
        done # for var
2114
2946
      fi
2115
 
      if test "$pass" = "conv" &&
2116
 
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2117
 
        libs="$deplibs" # reset libs
2118
 
        deplibs=
2119
 
      fi
 
2947
      # Last step: remove runtime libs from dependency_libs
 
2948
      # (they stay in deplibs)
 
2949
      tmp_libs=
 
2950
      for i in $dependency_libs ; do
 
2951
        case " $predeps $postdeps $compiler_lib_search_path " in
 
2952
        *" $i "*)
 
2953
          i=""
 
2954
          ;;
 
2955
        esac
 
2956
        if test -n "$i" ; then
 
2957
          tmp_libs="$tmp_libs $i"
 
2958
        fi
 
2959
      done
 
2960
      dependency_libs=$tmp_libs
2120
2961
    done # for pass
2121
 
    if test $linkmode = prog; then
 
2962
    if test "$linkmode" = prog; then
2122
2963
      dlfiles="$newdlfiles"
2123
2964
      dlprefiles="$newdlprefiles"
2124
2965
    fi
2125
2966
 
2126
2967
    case $linkmode in
2127
2968
    oldlib)
 
2969
      if test -n "$deplibs"; then
 
2970
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
 
2971
      fi
 
2972
 
2128
2973
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2129
2974
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2130
2975
      fi
2138
2983
      fi
2139
2984
 
2140
2985
      if test -n "$vinfo"; then
2141
 
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
2986
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2142
2987
      fi
2143
2988
 
2144
2989
      if test -n "$release"; then
2160
3005
      case $outputname in
2161
3006
      lib*)
2162
3007
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
3008
        eval shared_ext=\"$shrext_cmds\"
2163
3009
        eval libname=\"$libname_spec\"
2164
3010
        ;;
2165
3011
      *)
2166
3012
        if test "$module" = no; then
2167
3013
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2168
3014
          $echo "$help" 1>&2
2169
 
          exit 1
 
3015
          exit $EXIT_FAILURE
2170
3016
        fi
2171
3017
        if test "$need_lib_prefix" != no; then
2172
3018
          # Add the "lib" prefix for modules if required
2173
3019
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
3020
          eval shared_ext=\"$shrext_cmds\"
2174
3021
          eval libname=\"$libname_spec\"
2175
3022
        else
2176
3023
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2181
3028
      if test -n "$objs"; then
2182
3029
        if test "$deplibs_check_method" != pass_all; then
2183
3030
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2184
 
          exit 1
 
3031
          exit $EXIT_FAILURE
2185
3032
        else
2186
 
          echo
2187
 
          echo "*** Warning: Linking the shared library $output against the non-libtool"
2188
 
          echo "*** objects $objs is not portable!"
 
3033
          $echo
 
3034
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
3035
          $echo "*** objects $objs is not portable!"
2189
3036
          libobjs="$libobjs $objs"
2190
3037
        fi
2191
3038
      fi
2195
3042
      fi
2196
3043
 
2197
3044
      set dummy $rpath
2198
 
      if test $# -gt 2; then
 
3045
      if test "$#" -gt 2; then
2199
3046
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2200
3047
      fi
2201
3048
      install_libdir="$2"
2204
3051
      if test -z "$rpath"; then
2205
3052
        if test "$build_libtool_libs" = yes; then
2206
3053
          # Building a libtool convenience library.
2207
 
          libext=al
 
3054
          # Some compilers have problems with a `.al' extension so
 
3055
          # convenience libraries should have the same extension an
 
3056
          # archive normally would.
2208
3057
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2209
3058
          build_libtool_libs=convenience
2210
3059
          build_old_libs=yes
2211
3060
        fi
2212
3061
 
2213
3062
        if test -n "$vinfo"; then
2214
 
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
3063
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2215
3064
        fi
2216
3065
 
2217
3066
        if test -n "$release"; then
2227
3076
        if test -n "$8"; then
2228
3077
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2229
3078
          $echo "$help" 1>&2
2230
 
          exit 1
 
3079
          exit $EXIT_FAILURE
2231
3080
        fi
2232
3081
 
2233
 
        current="$2"
2234
 
        revision="$3"
2235
 
        age="$4"
 
3082
        # convert absolute version numbers to libtool ages
 
3083
        # this retains compatibility with .la files and attempts
 
3084
        # to make the code below a bit more comprehensible
 
3085
 
 
3086
        case $vinfo_number in
 
3087
        yes)
 
3088
          number_major="$2"
 
3089
          number_minor="$3"
 
3090
          number_revision="$4"
 
3091
          #
 
3092
          # There are really only two kinds -- those that
 
3093
          # use the current revision as the major version
 
3094
          # and those that subtract age and use age as
 
3095
          # a minor version.  But, then there is irix
 
3096
          # which has an extra 1 added just for fun
 
3097
          #
 
3098
          case $version_type in
 
3099
          darwin|linux|osf|windows)
 
3100
            current=`expr $number_major + $number_minor`
 
3101
            age="$number_minor"
 
3102
            revision="$number_revision"
 
3103
            ;;
 
3104
          freebsd-aout|freebsd-elf|sunos)
 
3105
            current="$number_major"
 
3106
            revision="$number_minor"
 
3107
            age="0"
 
3108
            ;;
 
3109
          irix|nonstopux)
 
3110
            current=`expr $number_major + $number_minor - 1`
 
3111
            age="$number_minor"
 
3112
            revision="$number_minor"
 
3113
            ;;
 
3114
          esac
 
3115
          ;;
 
3116
        no)
 
3117
          current="$2"
 
3118
          revision="$3"
 
3119
          age="$4"
 
3120
          ;;
 
3121
        esac
2236
3122
 
2237
3123
        # Check that each of the things are valid numbers.
2238
3124
        case $current in
2239
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3125
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2240
3126
        *)
2241
3127
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2242
3128
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2243
 
          exit 1
 
3129
          exit $EXIT_FAILURE
2244
3130
          ;;
2245
3131
        esac
2246
3132
 
2247
3133
        case $revision in
2248
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3134
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2249
3135
        *)
2250
3136
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2251
3137
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2252
 
          exit 1
 
3138
          exit $EXIT_FAILURE
2253
3139
          ;;
2254
3140
        esac
2255
3141
 
2256
3142
        case $age in
2257
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3143
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2258
3144
        *)
2259
3145
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2260
3146
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2261
 
          exit 1
 
3147
          exit $EXIT_FAILURE
2262
3148
          ;;
2263
3149
        esac
2264
3150
 
2265
 
        if test $age -gt $current; then
 
3151
        if test "$age" -gt "$current"; then
2266
3152
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2267
3153
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2268
 
          exit 1
 
3154
          exit $EXIT_FAILURE
2269
3155
        fi
2270
3156
 
2271
3157
        # Calculate the version variables.
2282
3168
          versuffix="$major.$age.$revision"
2283
3169
          # Darwin ld doesn't like 0 for these options...
2284
3170
          minor_current=`expr $current + 1`
2285
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3171
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2286
3172
          ;;
2287
3173
 
2288
3174
        freebsd-aout)
2306
3192
 
2307
3193
          # Add in all the interfaces that we are compatible with.
2308
3194
          loop=$revision
2309
 
          while test $loop != 0; do
 
3195
          while test "$loop" -ne 0; do
2310
3196
            iface=`expr $revision - $loop`
2311
3197
            loop=`expr $loop - 1`
2312
3198
            verstring="$verstring_prefix$major.$iface:$verstring"
2329
3215
 
2330
3216
          # Add in all the interfaces that we are compatible with.
2331
3217
          loop=$age
2332
 
          while test $loop != 0; do
 
3218
          while test "$loop" -ne 0; do
2333
3219
            iface=`expr $current - $loop`
2334
3220
            loop=`expr $loop - 1`
2335
3221
            verstring="$verstring:${iface}.0"
2353
3239
 
2354
3240
        *)
2355
3241
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2356
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2357
 
          exit 1
 
3242
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3243
          exit $EXIT_FAILURE
2358
3244
          ;;
2359
3245
        esac
2360
3246
 
2361
3247
        # Clear the version info if we defaulted, and they specified a release.
2362
3248
        if test -z "$vinfo" && test -n "$release"; then
2363
3249
          major=
2364
 
          verstring="0.0"
2365
3250
          case $version_type in
2366
3251
          darwin)
2367
3252
            # we can't check for "0.0" in archive_cmds due to quoting
2368
3253
            # problems, so we reset it completely
2369
 
            verstring=""
 
3254
            verstring=
2370
3255
            ;;
2371
3256
          *)
2372
3257
            verstring="0.0"
2400
3285
      fi
2401
3286
 
2402
3287
      if test "$mode" != relink; then
2403
 
        # Remove our outputs.
2404
 
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2405
 
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
 
3288
        # Remove our outputs, but don't remove object files since they
 
3289
        # may have been created when compiling PIC objects.
 
3290
        removelist=
 
3291
        tempremovelist=`$echo "$output_objdir/*"`
 
3292
        for p in $tempremovelist; do
 
3293
          case $p in
 
3294
            *.$objext)
 
3295
               ;;
 
3296
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3297
               if test "X$precious_files_regex" != "X"; then
 
3298
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3299
                 then
 
3300
                   continue
 
3301
                 fi
 
3302
               fi
 
3303
               removelist="$removelist $p"
 
3304
               ;;
 
3305
            *) ;;
 
3306
          esac
 
3307
        done
 
3308
        if test -n "$removelist"; then
 
3309
          $show "${rm}r $removelist"
 
3310
          $run ${rm}r $removelist
 
3311
        fi
2406
3312
      fi
2407
3313
 
2408
3314
      # Now set the variables for building old libraries.
2415
3321
 
2416
3322
      # Eliminate all temporary directories.
2417
3323
      for path in $notinst_path; do
2418
 
        lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2419
 
        deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2420
 
        dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3324
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3325
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3326
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2421
3327
      done
2422
3328
 
2423
3329
      if test -n "$xrpath"; then
2430
3336
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2431
3337
          esac
2432
3338
        done
2433
 
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
3339
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2434
3340
          dependency_libs="$temp_xrpath $dependency_libs"
2435
3341
        fi
2436
3342
      fi
2468
3374
          *-*-netbsd*)
2469
3375
            # Don't link with libc until the a.out ld.so is fixed.
2470
3376
            ;;
2471
 
          *-*-openbsd* | *-*-freebsd*)
 
3377
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
2472
3378
            # Do not include libc due to us having libc/libc_r.
 
3379
            test "X$arg" = "X-lc" && continue
2473
3380
            ;;
2474
 
          *)
 
3381
          *)
2475
3382
            # Add libc to deplibs on all other systems if necessary.
2476
 
            if test $build_libtool_need_lc = "yes"; then
 
3383
            if test "$build_libtool_need_lc" = "yes"; then
2477
3384
              deplibs="$deplibs -lc"
2478
3385
            fi
2479
3386
            ;;
2500
3407
          # This might be a little naive.  We might want to check
2501
3408
          # whether the library exists or not.  But this is on
2502
3409
          # osf3 & osf4 and I'm not really sure... Just
2503
 
          # implementing what was already the behaviour.
 
3410
          # implementing what was already the behavior.
2504
3411
          newdeplibs=$deplibs
2505
3412
          ;;
2506
3413
        test_compile)
2513
3420
          int main() { return 0; }
2514
3421
EOF
2515
3422
          $rm conftest
2516
 
          $CC -o conftest conftest.c $deplibs
2517
 
          if test $? -eq 0 ; then
 
3423
          $LTCC -o conftest conftest.c $deplibs
 
3424
          if test "$?" -eq 0 ; then
2518
3425
            ldd_output=`ldd conftest`
2519
3426
            for i in $deplibs; do
2520
3427
              name="`expr $i : '-l\(.*\)'`"
2521
3428
              # If $name is empty we are operating on a -L argument.
2522
 
              if test -n "$name" && test "$name" != "0"; then
2523
 
                libname=`eval \\$echo \"$libname_spec\"`
2524
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2525
 
                set dummy $deplib_matches
2526
 
                deplib_match=$2
2527
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2528
 
                  newdeplibs="$newdeplibs $i"
2529
 
                else
2530
 
                  droppeddeps=yes
2531
 
                  echo
2532
 
                  echo "*** Warning: dynamic linker does not accept needed library $i."
2533
 
                  echo "*** I have the capability to make that library automatically link in when"
2534
 
                  echo "*** you link to this library.  But I can only do this if you have a"
2535
 
                  echo "*** shared version of the library, which I believe you do not have"
2536
 
                  echo "*** because a test_compile did reveal that the linker did not use it for"
2537
 
                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
2538
 
                fi
2539
 
              else
2540
 
                newdeplibs="$newdeplibs $i"
2541
 
              fi
2542
 
            done
2543
 
          else
2544
 
            # Error occured in the first compile.  Let's try to salvage
2545
 
            # the situation: Compile a separate program for each library.
2546
 
            for i in $deplibs; do
2547
 
              name="`expr $i : '-l\(.*\)'`"
2548
 
             # If $name is empty we are operating on a -L argument.
2549
 
              if test -n "$name" && test "$name" != "0"; then
2550
 
                $rm conftest
2551
 
                $CC -o conftest conftest.c $i
2552
 
                # Did it work?
2553
 
                if test $? -eq 0 ; then
2554
 
                  ldd_output=`ldd conftest`
 
3429
              if test "$name" != "" && test "$name" -ne "0"; then
 
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
2555
3439
                  libname=`eval \\$echo \"$libname_spec\"`
2556
3440
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2557
3441
                  set dummy $deplib_matches
2560
3444
                    newdeplibs="$newdeplibs $i"
2561
3445
                  else
2562
3446
                    droppeddeps=yes
2563
 
                    echo
2564
 
                    echo "*** Warning: dynamic linker does not accept needed library $i."
2565
 
                    echo "*** I have the capability to make that library automatically link in when"
2566
 
                    echo "*** you link to this library.  But I can only do this if you have a"
2567
 
                    echo "*** shared version of the library, which you do not appear to have"
2568
 
                    echo "*** because a test_compile did reveal that the linker did not use this one"
2569
 
                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
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 I believe you do not have"
 
3452
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3453
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3454
                  fi
 
3455
                fi
 
3456
              else
 
3457
                newdeplibs="$newdeplibs $i"
 
3458
              fi
 
3459
            done
 
3460
          else
 
3461
            # Error occurred in the first compile.  Let's try to salvage
 
3462
            # the situation: Compile a separate program for each library.
 
3463
            for i in $deplibs; do
 
3464
              name="`expr $i : '-l\(.*\)'`"
 
3465
              # If $name is empty we are operating on a -L argument.
 
3466
              if test "$name" != "" && test "$name" != "0"; then
 
3467
                $rm conftest
 
3468
                $LTCC -o conftest conftest.c $i
 
3469
                # Did it work?
 
3470
                if test "$?" -eq 0 ; then
 
3471
                  ldd_output=`ldd conftest`
 
3472
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3473
                    case " $predeps $postdeps " in
 
3474
                    *" $i "*)
 
3475
                      newdeplibs="$newdeplibs $i"
 
3476
                      i=""
 
3477
                      ;;
 
3478
                    esac
 
3479
                  fi
 
3480
                  if test -n "$i" ; then
 
3481
                    libname=`eval \\$echo \"$libname_spec\"`
 
3482
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3483
                    set dummy $deplib_matches
 
3484
                    deplib_match=$2
 
3485
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3486
                      newdeplibs="$newdeplibs $i"
 
3487
                    else
 
3488
                      droppeddeps=yes
 
3489
                      $echo
 
3490
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3491
                      $echo "*** I have the capability to make that library automatically link in when"
 
3492
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3493
                      $echo "*** shared version of the library, which you do not appear to have"
 
3494
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3495
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3496
                    fi
2570
3497
                  fi
2571
3498
                else
2572
3499
                  droppeddeps=yes
2573
 
                  echo
2574
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2575
 
                  echo "***  make it link in!  You will probably need to install it or some"
2576
 
                  echo "*** library that it depends on before this library will be fully"
2577
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3500
                  $echo
 
3501
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3502
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3503
                  $echo "*** library that it depends on before this library will be fully"
 
3504
                  $echo "*** functional.  Installing it before continuing would be even better."
2578
3505
                fi
2579
3506
              else
2580
3507
                newdeplibs="$newdeplibs $i"
2588
3515
          for a_deplib in $deplibs; do
2589
3516
            name="`expr $a_deplib : '-l\(.*\)'`"
2590
3517
            # If $name is empty we are operating on a -L argument.
2591
 
            if test -n "$name" && test "$name" != "0"; then
2592
 
              libname=`eval \\$echo \"$libname_spec\"`
2593
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2594
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2595
 
                    for potent_lib in $potential_libs; do
 
3518
            if test "$name" != "" && test  "$name" != "0"; then
 
3519
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3520
                case " $predeps $postdeps " in
 
3521
                *" $a_deplib "*)
 
3522
                  newdeplibs="$newdeplibs $a_deplib"
 
3523
                  a_deplib=""
 
3524
                  ;;
 
3525
                esac
 
3526
              fi
 
3527
              if test -n "$a_deplib" ; then
 
3528
                libname=`eval \\$echo \"$libname_spec\"`
 
3529
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3530
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3531
                  for potent_lib in $potential_libs; do
2596
3532
                      # Follow soft links.
2597
3533
                      if ls -lLd "$potent_lib" 2>/dev/null \
2598
3534
                         | grep " -> " >/dev/null; then
2613
3549
                      done
2614
3550
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2615
3551
                         | ${SED} 10q \
2616
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3552
                         | $EGREP "$file_magic_regex" > /dev/null; then
2617
3553
                        newdeplibs="$newdeplibs $a_deplib"
2618
3554
                        a_deplib=""
2619
3555
                        break 2
2620
3556
                      fi
2621
 
                    done
2622
 
              done
 
3557
                  done
 
3558
                done
 
3559
              fi
2623
3560
              if test -n "$a_deplib" ; then
2624
3561
                droppeddeps=yes
2625
 
                echo
2626
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2627
 
                echo "*** I have the capability to make that library automatically link in when"
2628
 
                echo "*** you link to this library.  But I can only do this if you have a"
2629
 
                echo "*** shared version of the library, which you do not appear to have"
2630
 
                echo "*** because I did check the linker path looking for a file starting"
 
3562
                $echo
 
3563
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3564
                $echo "*** I have the capability to make that library automatically link in when"
 
3565
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3566
                $echo "*** shared version of the library, which you do not appear to have"
 
3567
                $echo "*** because I did check the linker path looking for a file starting"
2631
3568
                if test -z "$potlib" ; then
2632
 
                  echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3569
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
2633
3570
                else
2634
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2635
 
                  echo "*** using a file magic. Last file checked: $potlib"
 
3571
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3572
                  $echo "*** using a file magic. Last file checked: $potlib"
2636
3573
                fi
2637
3574
              fi
2638
3575
            else
2648
3585
            name="`expr $a_deplib : '-l\(.*\)'`"
2649
3586
            # If $name is empty we are operating on a -L argument.
2650
3587
            if test -n "$name" && test "$name" != "0"; then
2651
 
              libname=`eval \\$echo \"$libname_spec\"`
2652
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2653
 
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2654
 
                for potent_lib in $potential_libs; do
2655
 
                  potlib="$potent_lib" # see symlink-check below in file_magic test
2656
 
                  if eval echo \"$potent_lib\" 2>/dev/null \
2657
 
                      | ${SED} 10q \
2658
 
                      | egrep "$match_pattern_regex" > /dev/null; then
2659
 
                    newdeplibs="$newdeplibs $a_deplib"
2660
 
                    a_deplib=""
2661
 
                    break 2
2662
 
                  fi
 
3588
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3589
                case " $predeps $postdeps " in
 
3590
                *" $a_deplib "*)
 
3591
                  newdeplibs="$newdeplibs $a_deplib"
 
3592
                  a_deplib=""
 
3593
                  ;;
 
3594
                esac
 
3595
              fi
 
3596
              if test -n "$a_deplib" ; then
 
3597
                libname=`eval \\$echo \"$libname_spec\"`
 
3598
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3599
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3600
                  for potent_lib in $potential_libs; do
 
3601
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3602
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3603
                        | ${SED} 10q \
 
3604
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3605
                      newdeplibs="$newdeplibs $a_deplib"
 
3606
                      a_deplib=""
 
3607
                      break 2
 
3608
                    fi
 
3609
                  done
2663
3610
                done
2664
 
              done
 
3611
              fi
2665
3612
              if test -n "$a_deplib" ; then
2666
3613
                droppeddeps=yes
2667
 
                echo
2668
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2669
 
                echo "*** I have the capability to make that library automatically link in when"
2670
 
                echo "*** you link to this library.  But I can only do this if you have a"
2671
 
                echo "*** shared version of the library, which you do not appear to have"
2672
 
                echo "*** because I did check the linker path looking for a file starting"
 
3614
                $echo
 
3615
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3616
                $echo "*** I have the capability to make that library automatically link in when"
 
3617
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3618
                $echo "*** shared version of the library, which you do not appear to have"
 
3619
                $echo "*** because I did check the linker path looking for a file starting"
2673
3620
                if test -z "$potlib" ; then
2674
 
                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3621
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2675
3622
                else
2676
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2677
 
                  echo "*** using a regex pattern. Last file checked: $potlib"
 
3623
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3624
                  $echo "*** using a regex pattern. Last file checked: $potlib"
2678
3625
                fi
2679
3626
              fi
2680
3627
            else
2685
3632
          ;;
2686
3633
        none | unknown | *)
2687
3634
          newdeplibs=""
2688
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2689
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2690
 
             grep . >/dev/null; then
2691
 
            echo
 
3635
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3636
            -e 's/ -[LR][^ ]*//g'`
 
3637
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3638
            for i in $predeps $postdeps ; do
 
3639
              # can't use Xsed below, because $i might contain '/'
 
3640
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3641
            done
 
3642
          fi
 
3643
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3644
            | grep . >/dev/null; then
 
3645
            $echo
2692
3646
            if test "X$deplibs_check_method" = "Xnone"; then
2693
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3647
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2694
3648
            else
2695
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3649
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2696
3650
            fi
2697
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3651
            $echo "*** All declared inter-library dependencies are being dropped."
2698
3652
            droppeddeps=yes
2699
3653
          fi
2700
3654
          ;;
2714
3668
 
2715
3669
        if test "$droppeddeps" = yes; then
2716
3670
          if test "$module" = yes; then
2717
 
            echo
2718
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2719
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2720
 
            echo "*** a static module, that should work as long as the dlopening"
2721
 
            echo "*** application is linked with the -dlopen flag."
 
3671
            $echo
 
3672
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3673
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3674
            $echo "*** a static module, that should work as long as the dlopening"
 
3675
            $echo "*** application is linked with the -dlopen flag."
2722
3676
            if test -z "$global_symbol_pipe"; then
2723
 
              echo
2724
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2725
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2726
 
              echo "*** not find such a program.  So, this module is probably useless."
2727
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3677
              $echo
 
3678
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3679
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3680
              $echo "*** not find such a program.  So, this module is probably useless."
 
3681
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2728
3682
            fi
2729
3683
            if test "$build_old_libs" = no; then
2730
3684
              oldlibs="$output_objdir/$libname.$libext"
2734
3688
              build_libtool_libs=no
2735
3689
            fi
2736
3690
          else
2737
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2738
 
            echo "*** automatically added whenever a program is linked with this library"
2739
 
            echo "*** or is declared to -dlopen it."
 
3691
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3692
            $echo "*** automatically added whenever a program is linked with this library"
 
3693
            $echo "*** or is declared to -dlopen it."
2740
3694
 
2741
 
            if test $allow_undefined = no; then
2742
 
              echo
2743
 
              echo "*** Since this library must not contain undefined symbols,"
2744
 
              echo "*** because either the platform does not support them or"
2745
 
              echo "*** it was explicitly requested with -no-undefined,"
2746
 
              echo "*** libtool will only create a static version of it."
 
3695
            if test "$allow_undefined" = no; then
 
3696
              $echo
 
3697
              $echo "*** Since this library must not contain undefined symbols,"
 
3698
              $echo "*** because either the platform does not support them or"
 
3699
              $echo "*** it was explicitly requested with -no-undefined,"
 
3700
              $echo "*** libtool will only create a static version of it."
2747
3701
              if test "$build_old_libs" = no; then
2748
3702
                oldlibs="$output_objdir/$libname.$libext"
2749
3703
                build_libtool_libs=module
2765
3719
 
2766
3720
      # Test again, we may have decided not to build it any more
2767
3721
      if test "$build_libtool_libs" = yes; then
2768
 
        if test $hardcode_into_libs = yes; then
 
3722
        if test "$hardcode_into_libs" = yes; then
2769
3723
          # Hardcode the library paths
2770
3724
          hardcode_libdirs=
2771
3725
          dep_rpath=
2801
3755
          if test -n "$hardcode_libdir_separator" &&
2802
3756
             test -n "$hardcode_libdirs"; then
2803
3757
            libdir="$hardcode_libdirs"
2804
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3758
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3759
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3760
            else
 
3761
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3762
            fi
2805
3763
          fi
2806
3764
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2807
3765
            # We should set the runpath_var.
2821
3779
        fi
2822
3780
 
2823
3781
        # Get the real and link names of the library.
 
3782
        eval shared_ext=\"$shrext_cmds\"
2824
3783
        eval library_names=\"$library_names_spec\"
2825
3784
        set dummy $library_names
2826
3785
        realname="$2"
2831
3790
        else
2832
3791
          soname="$realname"
2833
3792
        fi
2834
 
        test -z "$dlname" && dlname=$soname
 
3793
        if test -z "$dlname"; then
 
3794
          dlname=$soname
 
3795
        fi
2835
3796
 
2836
3797
        lib="$output_objdir/$realname"
2837
3798
        for link
2839
3800
          linknames="$linknames $link"
2840
3801
        done
2841
3802
 
2842
 
        # Ensure that we have .o objects for linkers which dislike .lo
2843
 
        # (e.g. aix) in case we are running --disable-static
2844
 
        for obj in $libobjs; do
2845
 
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2846
 
          if test "X$xdir" = "X$obj"; then
2847
 
            xdir="."
2848
 
          else
2849
 
            xdir="$xdir"
2850
 
          fi
2851
 
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2852
 
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2853
 
          if test ! -f $xdir/$oldobj; then
2854
 
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2855
 
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2856
 
          fi
2857
 
        done
2858
 
 
2859
3803
        # Use standard objects if they are pic
2860
3804
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2861
3805
 
2865
3809
            $show "generating symbol list for \`$libname.la'"
2866
3810
            export_symbols="$output_objdir/$libname.exp"
2867
3811
            $run $rm $export_symbols
2868
 
            eval cmds=\"$export_symbols_cmds\"
 
3812
            cmds=$export_symbols_cmds
2869
3813
            save_ifs="$IFS"; IFS='~'
2870
3814
            for cmd in $cmds; do
2871
3815
              IFS="$save_ifs"
2872
 
              $show "$cmd"
2873
 
              $run eval "$cmd" || exit $?
 
3816
              eval cmd=\"$cmd\"
 
3817
              if len=`expr "X$cmd" : ".*"` &&
 
3818
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3819
                $show "$cmd"
 
3820
                $run eval "$cmd" || exit $?
 
3821
                skipped_export=false
 
3822
              else
 
3823
                # The command line is too long to execute in one step.
 
3824
                $show "using reloadable object file for export list..."
 
3825
                skipped_export=:
 
3826
              fi
2874
3827
            done
2875
3828
            IFS="$save_ifs"
2876
3829
            if test -n "$export_symbols_regex"; then
2877
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2878
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
3830
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3831
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2879
3832
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2880
3833
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2881
3834
            fi
2886
3839
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2887
3840
        fi
2888
3841
 
 
3842
        tmp_deplibs=
 
3843
        for test_deplib in $deplibs; do
 
3844
                case " $convenience " in
 
3845
                *" $test_deplib "*) ;;
 
3846
                *)
 
3847
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3848
                        ;;
 
3849
                esac
 
3850
        done
 
3851
        deplibs="$tmp_deplibs"
 
3852
 
2889
3853
        if test -n "$convenience"; then
2890
3854
          if test -n "$whole_archive_flag_spec"; then
 
3855
            save_libobjs=$libobjs
2891
3856
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2892
3857
          else
2893
3858
            gentop="$output_objdir/${outputname}x"
2894
 
            $show "${rm}r $gentop"
2895
 
            $run ${rm}r "$gentop"
2896
 
            $show "mkdir $gentop"
2897
 
            $run mkdir "$gentop"
2898
 
            status=$?
2899
 
            if test $status -ne 0 && test ! -d "$gentop"; then
2900
 
              exit $status
2901
 
            fi
2902
3859
            generated="$generated $gentop"
2903
3860
 
2904
 
            for xlib in $convenience; do
2905
 
              # Extract the objects.
2906
 
              case $xlib in
2907
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2908
 
              *) xabs=`pwd`"/$xlib" ;;
2909
 
              esac
2910
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2911
 
              xdir="$gentop/$xlib"
2912
 
 
2913
 
              $show "${rm}r $xdir"
2914
 
              $run ${rm}r "$xdir"
2915
 
              $show "mkdir $xdir"
2916
 
              $run mkdir "$xdir"
2917
 
              status=$?
2918
 
              if test $status -ne 0 && test ! -d "$xdir"; then
2919
 
                exit $status
2920
 
              fi
2921
 
              $show "(cd $xdir && $AR x $xabs)"
2922
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2923
 
 
2924
 
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2925
 
            done
 
3861
            func_extract_archives $gentop $convenience
 
3862
            libobjs="$libobjs $func_extract_archives_result"
2926
3863
          fi
2927
3864
        fi
2928
 
 
 
3865
        
2929
3866
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2930
3867
          eval flag=\"$thread_safe_flag_spec\"
2931
3868
          linker_flags="$linker_flags $flag"
2937
3874
        fi
2938
3875
 
2939
3876
        # Do each of the archive commands.
 
3877
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3878
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3879
            eval test_cmds=\"$module_expsym_cmds\"
 
3880
            cmds=$module_expsym_cmds
 
3881
          else
 
3882
            eval test_cmds=\"$module_cmds\"
 
3883
            cmds=$module_cmds
 
3884
          fi
 
3885
        else
2940
3886
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2941
 
          eval cmds=\"$archive_expsym_cmds\"
2942
 
        else
2943
 
          save_deplibs="$deplibs"
2944
 
          for conv in $convenience; do
2945
 
            tmp_deplibs=
2946
 
            for test_deplib in $deplibs; do
2947
 
              if test "$test_deplib" != "$conv"; then
2948
 
                tmp_deplibs="$tmp_deplibs $test_deplib"
 
3887
          eval test_cmds=\"$archive_expsym_cmds\"
 
3888
          cmds=$archive_expsym_cmds
 
3889
        else
 
3890
          eval test_cmds=\"$archive_cmds\"
 
3891
          cmds=$archive_cmds
 
3892
          fi
 
3893
        fi
 
3894
 
 
3895
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
3896
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3897
          :
 
3898
        else
 
3899
          # The command line is too long to link in one step, link piecewise.
 
3900
          $echo "creating reloadable object files..."
 
3901
 
 
3902
          # Save the value of $output and $libobjs because we want to
 
3903
          # use them later.  If we have whole_archive_flag_spec, we
 
3904
          # want to use save_libobjs as it was before
 
3905
          # whole_archive_flag_spec was expanded, because we can't
 
3906
          # assume the linker understands whole_archive_flag_spec.
 
3907
          # This may have to be revisited, in case too many
 
3908
          # convenience libraries get linked in and end up exceeding
 
3909
          # the spec.
 
3910
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
3911
            save_libobjs=$libobjs
 
3912
          fi
 
3913
          save_output=$output
 
3914
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
 
3915
 
 
3916
          # Clear the reloadable object creation command queue and
 
3917
          # initialize k to one.
 
3918
          test_cmds=
 
3919
          concat_cmds=
 
3920
          objlist=
 
3921
          delfiles=
 
3922
          last_robj=
 
3923
          k=1
 
3924
          output=$output_objdir/$output_la-${k}.$objext
 
3925
          # Loop over the list of objects to be linked.
 
3926
          for obj in $save_libobjs
 
3927
          do
 
3928
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3929
            if test "X$objlist" = X ||
 
3930
               { len=`expr "X$test_cmds" : ".*"` &&
 
3931
                 test "$len" -le "$max_cmd_len"; }; then
 
3932
              objlist="$objlist $obj"
 
3933
            else
 
3934
              # The command $test_cmds is almost too long, add a
 
3935
              # command to the queue.
 
3936
              if test "$k" -eq 1 ; then
 
3937
                # The first file doesn't have a previous command to add.
 
3938
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3939
              else
 
3940
                # All subsequent reloadable object files will link in
 
3941
                # the last one created.
 
3942
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
2949
3943
              fi
2950
 
            done
2951
 
            deplibs="$tmp_deplibs"
2952
 
          done
2953
 
          eval cmds=\"$archive_cmds\"
2954
 
          deplibs="$save_deplibs"
 
3944
              last_robj=$output_objdir/$output_la-${k}.$objext
 
3945
              k=`expr $k + 1`
 
3946
              output=$output_objdir/$output_la-${k}.$objext
 
3947
              objlist=$obj
 
3948
              len=1
 
3949
            fi
 
3950
          done
 
3951
          # Handle the remaining objects by creating one last
 
3952
          # reloadable object file.  All subsequent reloadable object
 
3953
          # files will link in the last one created.
 
3954
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
3955
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3956
 
 
3957
          if ${skipped_export-false}; then
 
3958
            $show "generating symbol list for \`$libname.la'"
 
3959
            export_symbols="$output_objdir/$libname.exp"
 
3960
            $run $rm $export_symbols
 
3961
            libobjs=$output
 
3962
            # Append the command to create the export file.
 
3963
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3964
          fi
 
3965
 
 
3966
          # Set up a command to remove the reloadable object files
 
3967
          # after they are used.
 
3968
          i=0
 
3969
          while test "$i" -lt "$k"
 
3970
          do
 
3971
            i=`expr $i + 1`
 
3972
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
 
3973
          done
 
3974
 
 
3975
          $echo "creating a temporary reloadable object file: $output"
 
3976
 
 
3977
          # Loop through the commands generated above and execute them.
 
3978
          save_ifs="$IFS"; IFS='~'
 
3979
          for cmd in $concat_cmds; do
 
3980
            IFS="$save_ifs"
 
3981
            $show "$cmd"
 
3982
            $run eval "$cmd" || exit $?
 
3983
          done
 
3984
          IFS="$save_ifs"
 
3985
 
 
3986
          libobjs=$output
 
3987
          # Restore the value of output.
 
3988
          output=$save_output
 
3989
 
 
3990
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
3991
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
3992
          fi
 
3993
          # Expand the library linking commands again to reset the
 
3994
          # value of $libobjs for piecewise linking.
 
3995
 
 
3996
          # Do each of the archive commands.
 
3997
          if test "$module" = yes && test -n "$module_cmds" ; then
 
3998
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3999
              cmds=$module_expsym_cmds
 
4000
            else
 
4001
              cmds=$module_cmds
 
4002
            fi
 
4003
          else
 
4004
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
4005
            cmds=$archive_expsym_cmds
 
4006
          else
 
4007
            cmds=$archive_cmds
 
4008
            fi
 
4009
          fi
 
4010
 
 
4011
          # Append the command to remove the reloadable object files
 
4012
          # to the just-reset $cmds.
 
4013
          eval cmds=\"\$cmds~\$rm $delfiles\"
2955
4014
        fi
2956
4015
        save_ifs="$IFS"; IFS='~'
2957
4016
        for cmd in $cmds; do
2958
4017
          IFS="$save_ifs"
 
4018
          eval cmd=\"$cmd\"
2959
4019
          $show "$cmd"
2960
4020
          $run eval "$cmd" || exit $?
2961
4021
        done
2964
4024
        # Restore the uninstalled library and exit
2965
4025
        if test "$mode" = relink; then
2966
4026
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2967
 
          exit 0
 
4027
          exit $EXIT_SUCCESS
2968
4028
        fi
2969
4029
 
2970
4030
        # Create links to the real library.
3012
4072
      *.lo)
3013
4073
        if test -n "$objs$old_deplibs"; then
3014
4074
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3015
 
          exit 1
 
4075
          exit $EXIT_FAILURE
3016
4076
        fi
3017
4077
        libobj="$output"
3018
4078
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3041
4101
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3042
4102
        else
3043
4103
          gentop="$output_objdir/${obj}x"
3044
 
          $show "${rm}r $gentop"
3045
 
          $run ${rm}r "$gentop"
3046
 
          $show "mkdir $gentop"
3047
 
          $run mkdir "$gentop"
3048
 
          status=$?
3049
 
          if test $status -ne 0 && test ! -d "$gentop"; then
3050
 
            exit $status
3051
 
          fi
3052
4104
          generated="$generated $gentop"
3053
4105
 
3054
 
          for xlib in $convenience; do
3055
 
            # Extract the objects.
3056
 
            case $xlib in
3057
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3058
 
            *) xabs=`pwd`"/$xlib" ;;
3059
 
            esac
3060
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3061
 
            xdir="$gentop/$xlib"
3062
 
 
3063
 
            $show "${rm}r $xdir"
3064
 
            $run ${rm}r "$xdir"
3065
 
            $show "mkdir $xdir"
3066
 
            $run mkdir "$xdir"
3067
 
            status=$?
3068
 
            if test $status -ne 0 && test ! -d "$xdir"; then
3069
 
              exit $status
3070
 
            fi
3071
 
            $show "(cd $xdir && $AR x $xabs)"
3072
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3073
 
 
3074
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3075
 
          done
 
4106
          func_extract_archives $gentop $convenience
 
4107
          reload_conv_objs="$reload_objs $func_extract_archives_result"
3076
4108
        fi
3077
4109
      fi
3078
4110
 
3080
4112
      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
3081
4113
 
3082
4114
      output="$obj"
3083
 
      eval cmds=\"$reload_cmds\"
 
4115
      cmds=$reload_cmds
3084
4116
      save_ifs="$IFS"; IFS='~'
3085
4117
      for cmd in $cmds; do
3086
4118
        IFS="$save_ifs"
 
4119
        eval cmd=\"$cmd\"
3087
4120
        $show "$cmd"
3088
4121
        $run eval "$cmd" || exit $?
3089
4122
      done
3096
4129
          $run ${rm}r $gentop
3097
4130
        fi
3098
4131
 
3099
 
        exit 0
 
4132
        exit $EXIT_SUCCESS
3100
4133
      fi
3101
4134
 
3102
4135
      if test "$build_libtool_libs" != yes; then
3107
4140
 
3108
4141
        # Create an invalid libtool object if no PIC, so that we don't
3109
4142
        # accidentally link it into a program.
3110
 
        $show "echo timestamp > $libobj"
3111
 
        $run eval "echo timestamp > $libobj" || exit $?
3112
 
        exit 0
 
4143
        # $show "echo timestamp > $libobj"
 
4144
        # $run eval "echo timestamp > $libobj" || exit $?
 
4145
        exit $EXIT_SUCCESS
3113
4146
      fi
3114
4147
 
3115
4148
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3116
4149
        # Only do commands if we really have different PIC objects.
3117
4150
        reload_objs="$libobjs $reload_conv_objs"
3118
4151
        output="$libobj"
3119
 
        eval cmds=\"$reload_cmds\"
 
4152
        cmds=$reload_cmds
3120
4153
        save_ifs="$IFS"; IFS='~'
3121
4154
        for cmd in $cmds; do
3122
4155
          IFS="$save_ifs"
 
4156
          eval cmd=\"$cmd\"
3123
4157
          $show "$cmd"
3124
4158
          $run eval "$cmd" || exit $?
3125
4159
        done
3126
4160
        IFS="$save_ifs"
3127
 
      else
3128
 
        # Just create a symlink.
3129
 
        $show $rm $libobj
3130
 
        $run $rm $libobj
3131
 
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3132
 
        if test "X$xdir" = "X$libobj"; then
3133
 
          xdir="."
3134
 
        else
3135
 
          xdir="$xdir"
3136
 
        fi
3137
 
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3138
 
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3139
 
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3140
 
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3141
4161
      fi
3142
4162
 
3143
4163
      if test -n "$gentop"; then
3145
4165
        $run ${rm}r $gentop
3146
4166
      fi
3147
4167
 
3148
 
      exit 0
 
4168
      exit $EXIT_SUCCESS
3149
4169
      ;;
3150
4170
 
3151
4171
    prog)
3152
4172
      case $host in
3153
 
        *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
 
4173
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3154
4174
      esac
3155
4175
      if test -n "$vinfo"; then
3156
4176
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3172
4192
        # On Rhapsody replace the C library is the System framework
3173
4193
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3174
4194
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3175
 
        case $host in
3176
 
        *darwin*)
3177
 
          # Don't allow lazy linking, it breaks C++ global constructors
3178
 
          compile_command="$compile_command ${wl}-bind_at_load"
3179
 
          finalize_command="$finalize_command ${wl}-bind_at_load"
3180
 
          ;;
3181
 
        esac
3182
4195
        ;;
3183
4196
      esac
3184
4197
 
 
4198
      case $host in
 
4199
      *darwin*)
 
4200
        # Don't allow lazy linking, it breaks C++ global constructors
 
4201
        if test "$tagname" = CXX ; then
 
4202
        compile_command="$compile_command ${wl}-bind_at_load"
 
4203
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4204
        fi
 
4205
        ;;
 
4206
      esac
 
4207
 
3185
4208
      compile_command="$compile_command $compile_deplibs"
3186
4209
      finalize_command="$finalize_command $finalize_deplibs"
3187
4210
 
3332
4355
            done
3333
4356
 
3334
4357
            if test -n "$exclude_expsyms"; then
3335
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4358
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3336
4359
              $run eval '$mv "$nlist"T "$nlist"'
3337
4360
            fi
3338
4361
 
3339
4362
            if test -n "$export_symbols_regex"; then
3340
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4363
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3341
4364
              $run eval '$mv "$nlist"T "$nlist"'
3342
4365
            fi
3343
4366
 
3344
4367
            # Prepare the list of exported symbols
3345
4368
            if test -z "$export_symbols"; then
3346
 
              export_symbols="$output_objdir/$output.exp"
 
4369
              export_symbols="$output_objdir/$outputname.exp"
3347
4370
              $run $rm $export_symbols
3348
4371
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3349
4372
            else
3350
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3351
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4373
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4374
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3352
4375
              $run eval 'mv "$nlist"T "$nlist"'
3353
4376
            fi
3354
4377
          fi
3355
4378
 
3356
4379
          for arg in $dlprefiles; do
3357
4380
            $show "extracting global C symbols from \`$arg'"
3358
 
            name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3359
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4381
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4382
            $run eval '$echo ": $name " >> "$nlist"'
3360
4383
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3361
4384
          done
3362
4385
 
3365
4388
            test -f "$nlist" || : > "$nlist"
3366
4389
 
3367
4390
            if test -n "$exclude_expsyms"; then
3368
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4391
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3369
4392
              $mv "$nlist"T "$nlist"
3370
4393
            fi
3371
4394
 
3385
4408
            if test -f "$nlist"S; then
3386
4409
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3387
4410
            else
3388
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4411
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3389
4412
            fi
3390
4413
 
3391
4414
            $echo >> "$output_objdir/$dlsyms" "\
3400
4423
#endif
3401
4424
 
3402
4425
/* The mapping between symbol names and symbols. */
 
4426
"
 
4427
 
 
4428
            case $host in
 
4429
            *cygwin* | *mingw* )
 
4430
          $echo >> "$output_objdir/$dlsyms" "\
 
4431
/* DATA imports from DLLs on WIN32 can't be const, because
 
4432
   runtime relocations are performed -- see ld's documentation
 
4433
   on pseudo-relocs */
 
4434
struct {
 
4435
"
 
4436
              ;;
 
4437
            * )
 
4438
          $echo >> "$output_objdir/$dlsyms" "\
3403
4439
const struct {
 
4440
"
 
4441
              ;;
 
4442
            esac
 
4443
 
 
4444
 
 
4445
          $echo >> "$output_objdir/$dlsyms" "\
3404
4446
  const char *name;
3405
4447
  lt_ptr address;
3406
4448
}
3437
4479
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3438
4480
            case "$compile_command " in
3439
4481
            *" -static "*) ;;
3440
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4482
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3441
4483
            esac;;
3442
4484
          *-*-hpux*)
3443
4485
            case "$compile_command " in
3444
4486
            *" -static "*) ;;
3445
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4487
            *) pic_flag_for_symtable=" $pic_flag";;
3446
4488
            esac
3447
4489
          esac
3448
4490
 
3449
4491
          # Now compile the dynamic symbol file.
3450
 
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3451
 
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4492
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4493
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3452
4494
 
3453
4495
          # Clean up the generated files.
3454
4496
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3460
4502
          ;;
3461
4503
        *)
3462
4504
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3463
 
          exit 1
 
4505
          exit $EXIT_FAILURE
3464
4506
          ;;
3465
4507
        esac
3466
4508
      else
3473
4515
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3474
4516
      fi
3475
4517
 
3476
 
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
4518
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3477
4519
        # Replace the output file specification.
3478
4520
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3479
4521
        link_command="$compile_command$compile_rpath"
3548
4590
        # Link the executable and exit
3549
4591
        $show "$link_command"
3550
4592
        $run eval "$link_command" || exit $?
3551
 
        exit 0
 
4593
        exit $EXIT_SUCCESS
3552
4594
      fi
3553
4595
 
3554
4596
      if test "$hardcode_action" = relink; then
3603
4645
      fi
3604
4646
 
3605
4647
      # Quote $echo for shipping.
3606
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3607
 
        case $0 in
3608
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3609
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4648
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4649
        case $progpath in
 
4650
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4651
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
3610
4652
        esac
3611
4653
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3612
4654
      else
3618
4660
        # win32 will think the script is a binary if it has
3619
4661
        # a .exe suffix, so we strip it off here.
3620
4662
        case $output in
3621
 
          *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
 
4663
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3622
4664
        esac
3623
4665
        # test for cygwin because mv fails w/o .exe extensions
3624
4666
        case $host in
3625
 
          *cygwin*) exeext=.exe ;;
 
4667
          *cygwin*)
 
4668
            exeext=.exe
 
4669
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3626
4670
          *) exeext= ;;
3627
4671
        esac
 
4672
        case $host in
 
4673
          *cygwin* | *mingw* )
 
4674
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
 
4675
            cwrapper=`$echo ${output}.exe`
 
4676
            $rm $cwrappersource $cwrapper
 
4677
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4678
 
 
4679
            cat > $cwrappersource <<EOF
 
4680
 
 
4681
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4682
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4683
 
 
4684
   The $output program cannot be directly executed until all the libtool
 
4685
   libraries that it depends on are installed.
 
4686
 
 
4687
   This wrapper executable should never be moved out of the build directory.
 
4688
   If it is, it will not operate correctly.
 
4689
 
 
4690
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4691
   but could eventually absorb all of the scripts functionality and
 
4692
   exec $objdir/$outputname directly.
 
4693
*/
 
4694
EOF
 
4695
            cat >> $cwrappersource<<"EOF"
 
4696
#include <stdio.h>
 
4697
#include <stdlib.h>
 
4698
#include <unistd.h>
 
4699
#include <malloc.h>
 
4700
#include <stdarg.h>
 
4701
#include <assert.h>
 
4702
 
 
4703
#if defined(PATH_MAX)
 
4704
# define LT_PATHMAX PATH_MAX
 
4705
#elif defined(MAXPATHLEN)
 
4706
# define LT_PATHMAX MAXPATHLEN
 
4707
#else
 
4708
# define LT_PATHMAX 1024
 
4709
#endif
 
4710
 
 
4711
#ifndef DIR_SEPARATOR
 
4712
#define DIR_SEPARATOR '/'
 
4713
#endif
 
4714
 
 
4715
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4716
  defined (__OS2__)
 
4717
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4718
#ifndef DIR_SEPARATOR_2
 
4719
#define DIR_SEPARATOR_2 '\\'
 
4720
#endif
 
4721
#endif
 
4722
 
 
4723
#ifndef DIR_SEPARATOR_2
 
4724
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4725
#else /* DIR_SEPARATOR_2 */
 
4726
# define IS_DIR_SEPARATOR(ch) \
 
4727
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4728
#endif /* DIR_SEPARATOR_2 */
 
4729
 
 
4730
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4731
#define XFREE(stale) do { \
 
4732
  if (stale) { free ((void *) stale); stale = 0; } \
 
4733
} while (0)
 
4734
 
 
4735
const char *program_name = NULL;
 
4736
 
 
4737
void * xmalloc (size_t num);
 
4738
char * xstrdup (const char *string);
 
4739
char * basename (const char *name);
 
4740
char * fnqualify(const char *path);
 
4741
char * strendzap(char *str, const char *pat);
 
4742
void lt_fatal (const char *message, ...);
 
4743
 
 
4744
int
 
4745
main (int argc, char *argv[])
 
4746
{
 
4747
  char **newargz;
 
4748
  int i;
 
4749
 
 
4750
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4751
  newargz = XMALLOC(char *, argc+2);
 
4752
EOF
 
4753
 
 
4754
            cat >> $cwrappersource <<EOF
 
4755
  newargz[0] = "$SHELL";
 
4756
EOF
 
4757
 
 
4758
            cat >> $cwrappersource <<"EOF"
 
4759
  newargz[1] = fnqualify(argv[0]);
 
4760
  /* we know the script has the same name, without the .exe */
 
4761
  /* so make sure newargz[1] doesn't end in .exe */
 
4762
  strendzap(newargz[1],".exe");
 
4763
  for (i = 1; i < argc; i++)
 
4764
    newargz[i+1] = xstrdup(argv[i]);
 
4765
  newargz[argc+1] = NULL;
 
4766
EOF
 
4767
 
 
4768
            cat >> $cwrappersource <<EOF
 
4769
  execv("$SHELL",newargz);
 
4770
EOF
 
4771
 
 
4772
            cat >> $cwrappersource <<"EOF"
 
4773
}
 
4774
 
 
4775
void *
 
4776
xmalloc (size_t num)
 
4777
{
 
4778
  void * p = (void *) malloc (num);
 
4779
  if (!p)
 
4780
    lt_fatal ("Memory exhausted");
 
4781
 
 
4782
  return p;
 
4783
}
 
4784
 
 
4785
char *
 
4786
xstrdup (const char *string)
 
4787
{
 
4788
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4789
;
 
4790
}
 
4791
 
 
4792
char *
 
4793
basename (const char *name)
 
4794
{
 
4795
  const char *base;
 
4796
 
 
4797
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4798
  /* Skip over the disk name in MSDOS pathnames. */
 
4799
  if (isalpha (name[0]) && name[1] == ':')
 
4800
    name += 2;
 
4801
#endif
 
4802
 
 
4803
  for (base = name; *name; name++)
 
4804
    if (IS_DIR_SEPARATOR (*name))
 
4805
      base = name + 1;
 
4806
  return (char *) base;
 
4807
}
 
4808
 
 
4809
char *
 
4810
fnqualify(const char *path)
 
4811
{
 
4812
  size_t size;
 
4813
  char *p;
 
4814
  char tmp[LT_PATHMAX + 1];
 
4815
 
 
4816
  assert(path != NULL);
 
4817
 
 
4818
  /* Is it qualified already? */
 
4819
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4820
  if (isalpha (path[0]) && path[1] == ':')
 
4821
    return xstrdup (path);
 
4822
#endif
 
4823
  if (IS_DIR_SEPARATOR (path[0]))
 
4824
    return xstrdup (path);
 
4825
 
 
4826
  /* prepend the current directory */
 
4827
  /* doesn't handle '~' */
 
4828
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4829
    lt_fatal ("getcwd failed");
 
4830
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4831
  p = XMALLOC(char, size);
 
4832
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4833
  return p;
 
4834
}
 
4835
 
 
4836
char *
 
4837
strendzap(char *str, const char *pat)
 
4838
{
 
4839
  size_t len, patlen;
 
4840
 
 
4841
  assert(str != NULL);
 
4842
  assert(pat != NULL);
 
4843
 
 
4844
  len = strlen(str);
 
4845
  patlen = strlen(pat);
 
4846
 
 
4847
  if (patlen <= len)
 
4848
  {
 
4849
    str += len - patlen;
 
4850
    if (strcmp(str, pat) == 0)
 
4851
      *str = '\0';
 
4852
  }
 
4853
  return str;
 
4854
}
 
4855
 
 
4856
static void
 
4857
lt_error_core (int exit_status, const char * mode,
 
4858
          const char * message, va_list ap)
 
4859
{
 
4860
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4861
  vfprintf (stderr, message, ap);
 
4862
  fprintf (stderr, ".\n");
 
4863
 
 
4864
  if (exit_status >= 0)
 
4865
    exit (exit_status);
 
4866
}
 
4867
 
 
4868
void
 
4869
lt_fatal (const char *message, ...)
 
4870
{
 
4871
  va_list ap;
 
4872
  va_start (ap, message);
 
4873
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4874
  va_end (ap);
 
4875
}
 
4876
EOF
 
4877
          # we should really use a build-platform specific compiler
 
4878
          # here, but OTOH, the wrappers (shell script and this C one)
 
4879
          # are only useful if you want to execute the "real" binary.
 
4880
          # Since the "real" binary is built for $host, then this
 
4881
          # wrapper might as well be built for $host, too.
 
4882
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4883
          ;;
 
4884
        esac
3628
4885
        $rm $output
3629
 
        trap "$rm $output; exit 1" 1 2 15
 
4886
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
3630
4887
 
3631
4888
        $echo > $output "\
3632
4889
#! $SHELL
3642
4899
 
3643
4900
# Sed substitution that helps us do robust quoting.  It backslashifies
3644
4901
# metacharacters that are still active within double-quoted strings.
3645
 
Xsed="${SED}"' -e 1s/^X//'
 
4902
Xsed='${SED} -e 1s/^X//'
3646
4903
sed_quote_subst='$sed_quote_subst'
3647
4904
 
3648
4905
# The HP-UX ksh and POSIX shell print the target directory to stdout
3649
4906
# if CDPATH is set.
3650
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
4907
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3651
4908
 
3652
4909
relink_command=\"$relink_command\"
3653
4910
 
3702
4959
"
3703
4960
 
3704
4961
        if test "$fast_install" = yes; then
3705
 
          echo >> $output "\
 
4962
          $echo >> $output "\
3706
4963
  program=lt-'$outputname'$exeext
3707
4964
  progdir=\"\$thisdir/$objdir\"
3708
4965
 
3718
4975
      $rm \"\$progdir/\$file\"
3719
4976
    fi"
3720
4977
 
3721
 
          echo >> $output "\
 
4978
          $echo >> $output "\
3722
4979
 
3723
4980
    # relink executable if necessary
3724
4981
    if test -n \"\$relink_command\"; then
3726
4983
      else
3727
4984
        $echo \"\$relink_command_output\" >&2
3728
4985
        $rm \"\$progdir/\$file\"
3729
 
        exit 1
 
4986
        exit $EXIT_FAILURE
3730
4987
      fi
3731
4988
    fi
3732
4989
 
3736
4993
    $rm \"\$progdir/\$file\"
3737
4994
  fi"
3738
4995
        else
3739
 
          echo >> $output "\
 
4996
          $echo >> $output "\
3740
4997
  program='$outputname'
3741
4998
  progdir=\"\$thisdir/$objdir\"
3742
4999
"
3743
5000
        fi
3744
5001
 
3745
 
        echo >> $output "\
 
5002
        $echo >> $output "\
3746
5003
 
3747
5004
  if test -f \"\$progdir/\$program\"; then"
3748
5005
 
3753
5010
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3754
5011
 
3755
5012
    # Some systems cannot cope with colon-terminated $shlibpath_var
3756
 
    # The second colon is a workaround for a bug in BeOS R4 ${SED}
 
5013
    # The second colon is a workaround for a bug in BeOS R4 sed
3757
5014
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3758
5015
 
3759
5016
    export $shlibpath_var
3773
5030
      # Run the actual program with our arguments.
3774
5031
"
3775
5032
        case $host in
3776
 
        # win32 systems need to use the prog path for dll
3777
 
        # lookup to work
3778
 
        *-*-cygwin* | *-*-pw32*)
3779
 
          $echo >> $output "\
3780
 
      exec \$progdir/\$program \${1+\"\$@\"}
3781
 
"
3782
 
          ;;
3783
 
 
3784
5033
        # Backslashes separate directories on plain windows
3785
5034
        *-*-mingw | *-*-os2*)
3786
5035
          $echo >> $output "\
3790
5039
 
3791
5040
        *)
3792
5041
          $echo >> $output "\
3793
 
      # Export the path to the program.
3794
 
      PATH=\"\$progdir:\$PATH\"
3795
 
      export PATH
3796
 
 
3797
 
      exec \$program \${1+\"\$@\"}
 
5042
      exec \$progdir/\$program \${1+\"\$@\"}
3798
5043
"
3799
5044
          ;;
3800
5045
        esac
3801
5046
        $echo >> $output "\
3802
5047
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3803
 
      exit 1
 
5048
      exit $EXIT_FAILURE
3804
5049
    fi
3805
5050
  else
3806
5051
    # The program doesn't exist.
3807
5052
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3808
5053
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
3809
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
3810
 
    exit 1
 
5054
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
5055
    exit $EXIT_FAILURE
3811
5056
  fi
3812
5057
fi\
3813
5058
"
3814
5059
        chmod +x $output
3815
5060
      fi
3816
 
      exit 0
 
5061
      exit $EXIT_SUCCESS
3817
5062
      ;;
3818
5063
    esac
3819
5064
 
3829
5074
          oldobjs="$libobjs_save"
3830
5075
          build_libtool_libs=no
3831
5076
        else
3832
 
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
5077
          oldobjs="$old_deplibs $non_pic_objects"
3833
5078
        fi
3834
5079
        addlibs="$old_convenience"
3835
5080
      fi
3836
5081
 
3837
5082
      if test -n "$addlibs"; then
3838
5083
        gentop="$output_objdir/${outputname}x"
3839
 
        $show "${rm}r $gentop"
3840
 
        $run ${rm}r "$gentop"
3841
 
        $show "mkdir $gentop"
3842
 
        $run mkdir "$gentop"
3843
 
        status=$?
3844
 
        if test $status -ne 0 && test ! -d "$gentop"; then
3845
 
          exit $status
3846
 
        fi
3847
5084
        generated="$generated $gentop"
3848
5085
 
3849
 
        # Add in members from convenience archives.
3850
 
        for xlib in $addlibs; do
3851
 
          # Extract the objects.
3852
 
          case $xlib in
3853
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3854
 
          *) xabs=`pwd`"/$xlib" ;;
3855
 
          esac
3856
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3857
 
          xdir="$gentop/$xlib"
3858
 
 
3859
 
          $show "${rm}r $xdir"
3860
 
          $run ${rm}r "$xdir"
3861
 
          $show "mkdir $xdir"
3862
 
          $run mkdir "$xdir"
3863
 
          status=$?
3864
 
          if test $status -ne 0 && test ! -d "$xdir"; then
3865
 
            exit $status
3866
 
          fi
3867
 
          $show "(cd $xdir && $AR x $xabs)"
3868
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3869
 
 
3870
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3871
 
        done
 
5086
        func_extract_archives $gentop $addlibs
 
5087
        oldobjs="$oldobjs $func_extract_archives_result"
3872
5088
      fi
3873
5089
 
3874
5090
      # Do each command in the archive commands.
3875
5091
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3876
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5092
       cmds=$old_archive_from_new_cmds
3877
5093
      else
3878
 
        # Ensure that we have .o objects in place in case we decided
3879
 
        # not to build a shared library, and have fallen back to building
3880
 
        # static libs even though --disable-static was passed!
3881
 
        for oldobj in $oldobjs; do
3882
 
          if test ! -f $oldobj; then
3883
 
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3884
 
            if test "X$xdir" = "X$oldobj"; then
3885
 
              xdir="."
3886
 
            else
3887
 
              xdir="$xdir"
3888
 
            fi
3889
 
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3890
 
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3891
 
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3892
 
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3893
 
          fi
3894
 
        done
3895
 
 
3896
5094
        eval cmds=\"$old_archive_cmds\"
 
5095
 
 
5096
        if len=`expr "X$cmds" : ".*"` &&
 
5097
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5098
          cmds=$old_archive_cmds
 
5099
        else
 
5100
          # the command line is too long to link in one step, link in parts
 
5101
          $echo "using piecewise archive linking..."
 
5102
          save_RANLIB=$RANLIB
 
5103
          RANLIB=:
 
5104
          objlist=
 
5105
          concat_cmds=
 
5106
          save_oldobjs=$oldobjs
 
5107
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
 
5108
          # encoded into archives.  This makes 'ar r' malfunction in
 
5109
          # this piecewise linking case whenever conflicting object
 
5110
          # names appear in distinct ar calls; check, warn and compensate.
 
5111
            if (for obj in $save_oldobjs
 
5112
            do
 
5113
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5114
            done | sort | sort -uc >/dev/null 2>&1); then
 
5115
            :
 
5116
          else
 
5117
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
 
5118
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
 
5119
            AR_FLAGS=cq
 
5120
          fi
 
5121
          # Is there a better way of finding the last object in the list?
 
5122
          for obj in $save_oldobjs
 
5123
          do
 
5124
            last_oldobj=$obj
 
5125
          done
 
5126
          for obj in $save_oldobjs
 
5127
          do
 
5128
            oldobjs="$objlist $obj"
 
5129
            objlist="$objlist $obj"
 
5130
            eval test_cmds=\"$old_archive_cmds\"
 
5131
            if len=`expr "X$test_cmds" : ".*"` &&
 
5132
               test "$len" -le "$max_cmd_len"; then
 
5133
              :
 
5134
            else
 
5135
              # the above command should be used before it gets too long
 
5136
              oldobjs=$objlist
 
5137
              if test "$obj" = "$last_oldobj" ; then
 
5138
                RANLIB=$save_RANLIB
 
5139
              fi
 
5140
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5141
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5142
              objlist=
 
5143
            fi
 
5144
          done
 
5145
          RANLIB=$save_RANLIB
 
5146
          oldobjs=$objlist
 
5147
          if test "X$oldobjs" = "X" ; then
 
5148
            eval cmds=\"\$concat_cmds\"
 
5149
          else
 
5150
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5151
          fi
 
5152
        fi
3897
5153
      fi
3898
5154
      save_ifs="$IFS"; IFS='~'
3899
5155
      for cmd in $cmds; do
 
5156
        eval cmd=\"$cmd\"
3900
5157
        IFS="$save_ifs"
3901
5158
        $show "$cmd"
3902
5159
        $run eval "$cmd" || exit $?
3928
5185
        fi
3929
5186
      done
3930
5187
      # Quote the link command for shipping.
3931
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
 
5188
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
3932
5189
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5190
      if test "$hardcode_automatic" = yes ; then
 
5191
        relink_command=
 
5192
      fi
 
5193
 
3933
5194
 
3934
5195
      # Only create the output if not a dry run.
3935
5196
      if test -z "$run"; then
3948
5209
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3949
5210
                if test -z "$libdir"; then
3950
5211
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3951
 
                  exit 1
 
5212
                  exit $EXIT_FAILURE
3952
5213
                fi
3953
5214
                newdependency_libs="$newdependency_libs $libdir/$name"
3954
5215
                ;;
3962
5223
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3963
5224
              if test -z "$libdir"; then
3964
5225
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3965
 
                exit 1
 
5226
                exit $EXIT_FAILURE
3966
5227
              fi
3967
5228
              newdlfiles="$newdlfiles $libdir/$name"
3968
5229
            done
3973
5234
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3974
5235
              if test -z "$libdir"; then
3975
5236
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3976
 
                exit 1
 
5237
                exit $EXIT_FAILURE
3977
5238
              fi
3978
5239
              newdlprefiles="$newdlprefiles $libdir/$name"
3979
5240
            done
3980
5241
            dlprefiles="$newdlprefiles"
 
5242
          else
 
5243
            newdlfiles=
 
5244
            for lib in $dlfiles; do
 
5245
              case $lib in
 
5246
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5247
                *) abs=`pwd`"/$lib" ;;
 
5248
              esac
 
5249
              newdlfiles="$newdlfiles $abs"
 
5250
            done
 
5251
            dlfiles="$newdlfiles"
 
5252
            newdlprefiles=
 
5253
            for lib in $dlprefiles; do
 
5254
              case $lib in
 
5255
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5256
                *) abs=`pwd`"/$lib" ;;
 
5257
              esac
 
5258
              newdlprefiles="$newdlprefiles $abs"
 
5259
            done
 
5260
            dlprefiles="$newdlprefiles"
3981
5261
          fi
3982
5262
          $rm $output
3983
5263
          # place dlname in correct position for cygwin
3984
5264
          tdlname=$dlname
3985
5265
          case $host,$output,$installed,$module,$dlname in
3986
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5266
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3987
5267
          esac
3988
5268
          $echo > $output "\
3989
5269
# $outputname - a libtool library file
4012
5292
# Is this an already installed library?
4013
5293
installed=$installed
4014
5294
 
 
5295
# Should we warn about portability when linking against -modules?
 
5296
shouldnotlink=$module
 
5297
 
4015
5298
# Files to dlopen/dlpreopen
4016
5299
dlopen='$dlfiles'
4017
5300
dlpreopen='$dlprefiles'
4018
5301
 
4019
5302
# Directory that this library needs to be installed in:
4020
5303
libdir='$install_libdir'"
4021
 
          if test "$installed" = no && test $need_relink = yes; then
 
5304
          if test "$installed" = no && test "$need_relink" = yes; then
4022
5305
            $echo >> $output "\
4023
5306
relink_command=\"$relink_command\""
4024
5307
          fi
4031
5314
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4032
5315
      ;;
4033
5316
    esac
4034
 
    exit 0
 
5317
    exit $EXIT_SUCCESS
4035
5318
    ;;
4036
5319
 
4037
5320
  # libtool install mode
4046
5329
      # Aesthetically quote it.
4047
5330
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4048
5331
      case $arg in
4049
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5332
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
4050
5333
        arg="\"$arg\""
4051
5334
        ;;
4052
5335
      esac
4062
5345
    # Aesthetically quote it.
4063
5346
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4064
5347
    case $arg in
4065
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5348
    *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
4066
5349
      arg="\"$arg\""
4067
5350
      ;;
4068
5351
    esac
4110
5393
      # Aesthetically quote the argument.
4111
5394
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4112
5395
      case $arg in
4113
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5396
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
4114
5397
        arg="\"$arg\""
4115
5398
        ;;
4116
5399
      esac
4120
5403
    if test -z "$install_prog"; then
4121
5404
      $echo "$modename: you must specify an install program" 1>&2
4122
5405
      $echo "$help" 1>&2
4123
 
      exit 1
 
5406
      exit $EXIT_FAILURE
4124
5407
    fi
4125
5408
 
4126
5409
    if test -n "$prev"; then
4127
5410
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4128
5411
      $echo "$help" 1>&2
4129
 
      exit 1
 
5412
      exit $EXIT_FAILURE
4130
5413
    fi
4131
5414
 
4132
5415
    if test -z "$files"; then
4136
5419
        $echo "$modename: you must specify a destination" 1>&2
4137
5420
      fi
4138
5421
      $echo "$help" 1>&2
4139
 
      exit 1
 
5422
      exit $EXIT_FAILURE
4140
5423
    fi
4141
5424
 
4142
5425
    # Strip any trailing slash from the destination.
4154
5437
 
4155
5438
      # Not a directory, so check to see that there is only one file specified.
4156
5439
      set dummy $files
4157
 
      if test $# -gt 2; then
 
5440
      if test "$#" -gt 2; then
4158
5441
        $echo "$modename: \`$dest' is not a directory" 1>&2
4159
5442
        $echo "$help" 1>&2
4160
 
        exit 1
 
5443
        exit $EXIT_FAILURE
4161
5444
      fi
4162
5445
    fi
4163
5446
    case $destdir in
4169
5452
        *)
4170
5453
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4171
5454
          $echo "$help" 1>&2
4172
 
          exit 1
 
5455
          exit $EXIT_FAILURE
4173
5456
          ;;
4174
5457
        esac
4175
5458
      done
4194
5477
 
4195
5478
      *.la)
4196
5479
        # Check to see that this really is a libtool archive.
4197
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5480
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4198
5481
        else
4199
5482
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4200
5483
          $echo "$help" 1>&2
4201
 
          exit 1
 
5484
          exit $EXIT_FAILURE
4202
5485
        fi
4203
5486
 
4204
5487
        library_names=
4229
5512
        dir="$dir$objdir"
4230
5513
 
4231
5514
        if test -n "$relink_command"; then
 
5515
          # Determine the prefix the user has applied to our future dir.
 
5516
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
 
5517
 
 
5518
          # Don't allow the user to place us outside of our expected
 
5519
          # location b/c this prevents finding dependent libraries that
 
5520
          # are installed to the same prefix.
 
5521
          # At present, this check doesn't affect windows .dll's that
 
5522
          # are installed into $libdir/../bin (currently, that works fine)
 
5523
          # but it's something to keep an eye on.
 
5524
          if test "$inst_prefix_dir" = "$destdir"; then
 
5525
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
 
5526
            exit $EXIT_FAILURE
 
5527
          fi
 
5528
 
 
5529
          if test -n "$inst_prefix_dir"; then
 
5530
            # Stick the inst_prefix_dir data into the link command.
 
5531
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5532
          else
 
5533
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
5534
          fi
 
5535
 
4232
5536
          $echo "$modename: warning: relinking \`$file'" 1>&2
4233
5537
          $show "$relink_command"
4234
5538
          if $run eval "$relink_command"; then :
4235
5539
          else
4236
5540
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4237
 
            continue
 
5541
            exit $EXIT_FAILURE
4238
5542
          fi
4239
5543
        fi
4240
5544
 
4256
5560
            $run eval "$striplib $destdir/$realname" || exit $?
4257
5561
          fi
4258
5562
 
4259
 
          if test $# -gt 0; then
 
5563
          if test "$#" -gt 0; then
4260
5564
            # Delete the old symlinks, and create new ones.
4261
5565
            for linkname
4262
5566
            do
4269
5573
 
4270
5574
          # Do each command in the postinstall commands.
4271
5575
          lib="$destdir/$realname"
4272
 
          eval cmds=\"$postinstall_cmds\"
 
5576
          cmds=$postinstall_cmds
4273
5577
          save_ifs="$IFS"; IFS='~'
4274
5578
          for cmd in $cmds; do
4275
5579
            IFS="$save_ifs"
 
5580
            eval cmd=\"$cmd\"
4276
5581
            $show "$cmd"
4277
5582
            $run eval "$cmd" || exit $?
4278
5583
          done
4312
5617
        *)
4313
5618
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4314
5619
          $echo "$help" 1>&2
4315
 
          exit 1
 
5620
          exit $EXIT_FAILURE
4316
5621
          ;;
4317
5622
        esac
4318
5623
 
4330
5635
          $show "$install_prog $staticobj $staticdest"
4331
5636
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4332
5637
        fi
4333
 
        exit 0
 
5638
        exit $EXIT_SUCCESS
4334
5639
        ;;
4335
5640
 
4336
5641
      *)
4342
5647
          destfile="$destdir/$destfile"
4343
5648
        fi
4344
5649
 
 
5650
        # If the file is missing, and there is a .exe on the end, strip it
 
5651
        # because it is most likely a libtool script we actually want to
 
5652
        # install
 
5653
        stripped_ext=""
 
5654
        case $file in
 
5655
          *.exe)
 
5656
            if test ! -f "$file"; then
 
5657
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5658
              stripped_ext=".exe"
 
5659
            fi
 
5660
            ;;
 
5661
        esac
 
5662
 
4345
5663
        # Do a test to see if this is really a libtool program.
4346
5664
        case $host in
4347
5665
        *cygwin*|*mingw*)
4348
 
            wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
 
5666
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
4349
5667
            ;;
4350
5668
        *)
4351
5669
            wrapper=$file
4352
5670
            ;;
4353
5671
        esac
4354
 
        if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
5672
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4355
5673
          notinst_deplibs=
4356
5674
          relink_command=
4357
5675
 
 
5676
          # To insure that "foo" is sourced, and not "foo.exe",
 
5677
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5678
          # which disallows the automatic-append-.exe behavior.
 
5679
          case $build in
 
5680
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5681
          *) wrapperdot=${wrapper} ;;
 
5682
          esac
4358
5683
          # If there is no directory component, then add one.
4359
5684
          case $file in
4360
 
          */* | *\\*) . $wrapper ;;
4361
 
          *) . ./$wrapper ;;
 
5685
          */* | *\\*) . ${wrapperdot} ;;
 
5686
          *) . ./${wrapperdot} ;;
4362
5687
          esac
4363
5688
 
4364
5689
          # Check the variables that should have been set.
4365
5690
          if test -z "$notinst_deplibs"; then
4366
5691
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4367
 
            exit 1
 
5692
            exit $EXIT_FAILURE
4368
5693
          fi
4369
5694
 
4370
5695
          finalize=yes
4386
5711
          done
4387
5712
 
4388
5713
          relink_command=
 
5714
          # To insure that "foo" is sourced, and not "foo.exe",
 
5715
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5716
          # which disallows the automatic-append-.exe behavior.
 
5717
          case $build in
 
5718
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5719
          *) wrapperdot=${wrapper} ;;
 
5720
          esac
4389
5721
          # If there is no directory component, then add one.
4390
5722
          case $file in
4391
 
          */* | *\\*) . $wrapper ;;
4392
 
          *) . ./$wrapper ;;
 
5723
          */* | *\\*) . ${wrapperdot} ;;
 
5724
          *) . ./${wrapperdot} ;;
4393
5725
          esac
4394
5726
 
4395
5727
          outputname=
4398
5730
              tmpdir="/tmp"
4399
5731
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4400
5732
              tmpdir="$tmpdir/libtool-$$"
4401
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5733
              save_umask=`umask`
 
5734
              umask 0077
 
5735
              if $mkdir "$tmpdir"; then
 
5736
                umask $save_umask
4402
5737
              else
 
5738
                umask $save_umask
4403
5739
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4404
5740
                continue
4405
5741
              fi
4406
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
5742
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4407
5743
              outputname="$tmpdir/$file"
4408
5744
              # Replace the output file specification.
4409
5745
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4421
5757
            fi
4422
5758
          else
4423
5759
            # Install the binary that we compiled earlier.
4424
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5760
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4425
5761
          fi
4426
5762
        fi
4427
5763
 
4428
5764
        # remove .exe since cygwin /usr/bin/install will append another
4429
5765
        # one anyways
4430
5766
        case $install_prog,$host in
4431
 
        /usr/bin/install*,*cygwin*)
 
5767
        */usr/bin/install*,*cygwin*)
4432
5768
          case $file:$destfile in
4433
5769
          *.exe:*.exe)
4434
5770
            # this is ok
4437
5773
            destfile=$destfile.exe
4438
5774
            ;;
4439
5775
          *:*.exe)
4440
 
            destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
 
5776
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4441
5777
            ;;
4442
5778
          esac
4443
5779
          ;;
4458
5794
      $show "$install_prog $file $oldlib"
4459
5795
      $run eval "$install_prog \$file \$oldlib" || exit $?
4460
5796
 
4461
 
      if test -n "$stripme" && test -n "$striplib"; then
 
5797
      if test -n "$stripme" && test -n "$old_striplib"; then
4462
5798
        $show "$old_striplib $oldlib"
4463
5799
        $run eval "$old_striplib $oldlib" || exit $?
4464
5800
      fi
4465
5801
 
4466
5802
      # Do each command in the postinstall commands.
4467
 
      eval cmds=\"$old_postinstall_cmds\"
 
5803
      cmds=$old_postinstall_cmds
4468
5804
      save_ifs="$IFS"; IFS='~'
4469
5805
      for cmd in $cmds; do
4470
5806
        IFS="$save_ifs"
 
5807
        eval cmd=\"$cmd\"
4471
5808
        $show "$cmd"
4472
5809
        $run eval "$cmd" || exit $?
4473
5810
      done
4481
5818
    if test -n "$current_libdirs"; then
4482
5819
      # Maybe just do a dry run.
4483
5820
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4484
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
5821
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
4485
5822
    else
4486
 
      exit 0
 
5823
      exit $EXIT_SUCCESS
4487
5824
    fi
4488
5825
    ;;
4489
5826
 
4502
5839
      for libdir in $libdirs; do
4503
5840
        if test -n "$finish_cmds"; then
4504
5841
          # Do each command in the finish commands.
4505
 
          eval cmds=\"$finish_cmds\"
 
5842
          cmds=$finish_cmds
4506
5843
          save_ifs="$IFS"; IFS='~'
4507
5844
          for cmd in $cmds; do
4508
5845
            IFS="$save_ifs"
 
5846
            eval cmd=\"$cmd\"
4509
5847
            $show "$cmd"
4510
5848
            $run eval "$cmd" || admincmds="$admincmds
4511
5849
       $cmd"
4522
5860
    fi
4523
5861
 
4524
5862
    # Exit here if they wanted silent mode.
4525
 
    test "$show" = ":" && exit 0
 
5863
    test "$show" = : && exit $EXIT_SUCCESS
4526
5864
 
4527
 
    echo "----------------------------------------------------------------------"
4528
 
    echo "Libraries have been installed in:"
 
5865
    $echo "----------------------------------------------------------------------"
 
5866
    $echo "Libraries have been installed in:"
4529
5867
    for libdir in $libdirs; do
4530
 
      echo "   $libdir"
 
5868
      $echo "   $libdir"
4531
5869
    done
4532
 
    echo
4533
 
    echo "If you ever happen to want to link against installed libraries"
4534
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4535
 
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4536
 
    echo "flag during linking and do at least one of the following:"
 
5870
    $echo
 
5871
    $echo "If you ever happen to want to link against installed libraries"
 
5872
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5873
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5874
    $echo "flag during linking and do at least one of the following:"
4537
5875
    if test -n "$shlibpath_var"; then
4538
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4539
 
      echo "     during execution"
 
5876
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5877
      $echo "     during execution"
4540
5878
    fi
4541
5879
    if test -n "$runpath_var"; then
4542
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4543
 
      echo "     during linking"
 
5880
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5881
      $echo "     during linking"
4544
5882
    fi
4545
5883
    if test -n "$hardcode_libdir_flag_spec"; then
4546
5884
      libdir=LIBDIR
4547
5885
      eval flag=\"$hardcode_libdir_flag_spec\"
4548
5886
 
4549
 
      echo "   - use the \`$flag' linker flag"
 
5887
      $echo "   - use the \`$flag' linker flag"
4550
5888
    fi
4551
5889
    if test -n "$admincmds"; then
4552
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5890
      $echo "   - have your system administrator run these commands:$admincmds"
4553
5891
    fi
4554
5892
    if test -f /etc/ld.so.conf; then
4555
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5893
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4556
5894
    fi
4557
 
    echo
4558
 
    echo "See any operating system documentation about shared libraries for"
4559
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4560
 
    echo "----------------------------------------------------------------------"
4561
 
    exit 0
 
5895
    $echo
 
5896
    $echo "See any operating system documentation about shared libraries for"
 
5897
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5898
    $echo "----------------------------------------------------------------------"
 
5899
    exit $EXIT_SUCCESS
4562
5900
    ;;
4563
5901
 
4564
5902
  # libtool execute mode
4570
5908
    if test -z "$cmd"; then
4571
5909
      $echo "$modename: you must specify a COMMAND" 1>&2
4572
5910
      $echo "$help"
4573
 
      exit 1
 
5911
      exit $EXIT_FAILURE
4574
5912
    fi
4575
5913
 
4576
5914
    # Handle -dlopen flags immediately.
4578
5916
      if test ! -f "$file"; then
4579
5917
        $echo "$modename: \`$file' is not a file" 1>&2
4580
5918
        $echo "$help" 1>&2
4581
 
        exit 1
 
5919
        exit $EXIT_FAILURE
4582
5920
      fi
4583
5921
 
4584
5922
      dir=
4585
5923
      case $file in
4586
5924
      *.la)
4587
5925
        # Check to see that this really is a libtool archive.
4588
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5926
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4589
5927
        else
4590
5928
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4591
5929
          $echo "$help" 1>&2
4592
 
          exit 1
 
5930
          exit $EXIT_FAILURE
4593
5931
        fi
4594
5932
 
4595
5933
        # Read the libtool library.
4616
5954
          dir="$dir/$objdir"
4617
5955
        else
4618
5956
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4619
 
          exit 1
 
5957
          exit $EXIT_FAILURE
4620
5958
        fi
4621
5959
        ;;
4622
5960
 
4656
5994
      -*) ;;
4657
5995
      *)
4658
5996
        # Do a test to see if this is really a libtool program.
4659
 
        if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5997
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4660
5998
          # If there is no directory component, then add one.
4661
5999
          case $file in
4662
6000
          */* | *\\*) . $file ;;
4679
6017
        eval "export $shlibpath_var"
4680
6018
      fi
4681
6019
 
4682
 
      # Restore saved enviroment variables
 
6020
      # Restore saved environment variables
4683
6021
      if test "${save_LC_ALL+set}" = set; then
4684
6022
        LC_ALL="$save_LC_ALL"; export LC_ALL
4685
6023
      fi
4696
6034
        $echo "export $shlibpath_var"
4697
6035
      fi
4698
6036
      $echo "$cmd$args"
4699
 
      exit 0
 
6037
      exit $EXIT_SUCCESS
4700
6038
    fi
4701
6039
    ;;
4702
6040
 
4724
6062
    if test -z "$rm"; then
4725
6063
      $echo "$modename: you must specify an RM program" 1>&2
4726
6064
      $echo "$help" 1>&2
4727
 
      exit 1
 
6065
      exit $EXIT_FAILURE
4728
6066
    fi
4729
6067
 
4730
6068
    rmdirs=
4731
6069
 
 
6070
    origobjdir="$objdir"
4732
6071
    for file in $files; do
4733
6072
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4734
6073
      if test "X$dir" = "X$file"; then
4735
6074
        dir=.
4736
 
        objdir="$objdir"
 
6075
        objdir="$origobjdir"
4737
6076
      else
4738
 
        objdir="$dir/$objdir"
 
6077
        objdir="$dir/$origobjdir"
4739
6078
      fi
4740
6079
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4741
 
      test $mode = uninstall && objdir="$dir"
 
6080
      test "$mode" = uninstall && objdir="$dir"
4742
6081
 
4743
6082
      # Remember objdir for removal later, being careful to avoid duplicates
4744
 
      if test $mode = clean; then
 
6083
      if test "$mode" = clean; then
4745
6084
        case " $rmdirs " in
4746
6085
          *" $objdir "*) ;;
4747
6086
          *) rmdirs="$rmdirs $objdir" ;;
4765
6104
      case $name in
4766
6105
      *.la)
4767
6106
        # Possibly a libtool archive, so verify it.
4768
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6107
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4769
6108
          . $dir/$name
4770
6109
 
4771
6110
          # Delete the libtool libraries and symlinks.
4773
6112
            rmfiles="$rmfiles $objdir/$n"
4774
6113
          done
4775
6114
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4776
 
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6115
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4777
6116
 
4778
 
          if test $mode = uninstall; then
 
6117
          if test "$mode" = uninstall; then
4779
6118
            if test -n "$library_names"; then
4780
6119
              # Do each command in the postuninstall commands.
4781
 
              eval cmds=\"$postuninstall_cmds\"
 
6120
              cmds=$postuninstall_cmds
4782
6121
              save_ifs="$IFS"; IFS='~'
4783
6122
              for cmd in $cmds; do
4784
6123
                IFS="$save_ifs"
 
6124
                eval cmd=\"$cmd\"
4785
6125
                $show "$cmd"
4786
6126
                $run eval "$cmd"
4787
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6127
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4788
6128
                  exit_status=1
4789
6129
                fi
4790
6130
              done
4793
6133
 
4794
6134
            if test -n "$old_library"; then
4795
6135
              # Do each command in the old_postuninstall commands.
4796
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6136
              cmds=$old_postuninstall_cmds
4797
6137
              save_ifs="$IFS"; IFS='~'
4798
6138
              for cmd in $cmds; do
4799
6139
                IFS="$save_ifs"
 
6140
                eval cmd=\"$cmd\"
4800
6141
                $show "$cmd"
4801
6142
                $run eval "$cmd"
4802
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6143
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4803
6144
                  exit_status=1
4804
6145
                fi
4805
6146
              done
4811
6152
        ;;
4812
6153
 
4813
6154
      *.lo)
4814
 
        if test "$build_old_libs" = yes; then
4815
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4816
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6155
        # Possibly a libtool object, so verify it.
 
6156
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6157
 
 
6158
          # Read the .lo file
 
6159
          . $dir/$name
 
6160
 
 
6161
          # Add PIC object to the list of files to remove.
 
6162
          if test -n "$pic_object" \
 
6163
             && test "$pic_object" != none; then
 
6164
            rmfiles="$rmfiles $dir/$pic_object"
 
6165
          fi
 
6166
 
 
6167
          # Add non-PIC object to the list of files to remove.
 
6168
          if test -n "$non_pic_object" \
 
6169
             && test "$non_pic_object" != none; then
 
6170
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6171
          fi
4817
6172
        fi
4818
6173
        ;;
4819
6174
 
4820
6175
      *)
4821
 
        # Do a test to see if this is a libtool program.
4822
 
        if test $mode = clean &&
4823
 
           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4824
 
          relink_command=
4825
 
          . $dir/$file
 
6176
        if test "$mode" = clean ; then
 
6177
          noexename=$name
 
6178
          case $file in
 
6179
          *.exe)
 
6180
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6181
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6182
            # $file with .exe has already been added to rmfiles,
 
6183
            # add $file without .exe
 
6184
            rmfiles="$rmfiles $file"
 
6185
            ;;
 
6186
          esac
 
6187
          # Do a test to see if this is a libtool program.
 
6188
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6189
            relink_command=
 
6190
            . $dir/$noexename
4826
6191
 
4827
 
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4828
 
          if test "$fast_install" = yes && test -n "$relink_command"; then
4829
 
            rmfiles="$rmfiles $objdir/lt-$name"
 
6192
            # note $name still contains .exe if it was in $file originally
 
6193
            # as does the version of $file that was added into $rmfiles
 
6194
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6195
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6196
              rmfiles="$rmfiles $objdir/lt-$name"
 
6197
            fi
 
6198
            if test "X$noexename" != "X$name" ; then
 
6199
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6200
            fi
4830
6201
          fi
4831
6202
        fi
4832
6203
        ;;
4834
6205
      $show "$rm $rmfiles"
4835
6206
      $run $rm $rmfiles || exit_status=1
4836
6207
    done
 
6208
    objdir="$origobjdir"
4837
6209
 
4838
6210
    # Try to remove the ${objdir}s in the directories where we deleted files
4839
6211
    for dir in $rmdirs; do
4849
6221
  "")
4850
6222
    $echo "$modename: you must specify a MODE" 1>&2
4851
6223
    $echo "$generic_help" 1>&2
4852
 
    exit 1
 
6224
    exit $EXIT_FAILURE
4853
6225
    ;;
4854
6226
  esac
4855
6227
 
4856
6228
  if test -z "$exec_cmd"; then
4857
6229
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
4858
6230
    $echo "$generic_help" 1>&2
4859
 
    exit 1
 
6231
    exit $EXIT_FAILURE
4860
6232
  fi
4861
6233
fi # test -z "$show_help"
4862
6234
 
4863
6235
if test -n "$exec_cmd"; then
4864
6236
  eval exec $exec_cmd
4865
 
  exit 1
 
6237
  exit $EXIT_FAILURE
4866
6238
fi
4867
6239
 
4868
6240
# We need to display help for each of the modes.
4881
6253
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4882
6254
    --quiet           same as \`--silent'
4883
6255
    --silent          don't print informational messages
 
6256
    --tag=TAG         use configuration variables from tag TAG
4884
6257
    --version         print version information
4885
6258
 
4886
6259
MODE must be one of the following:
4894
6267
      uninstall       remove libraries from an installed directory
4895
6268
 
4896
6269
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4897
 
a more detailed description of MODE."
4898
 
  exit 0
 
6270
a more detailed description of MODE.
 
6271
 
 
6272
Report bugs to <bug-libtool@gnu.org>."
 
6273
  exit $EXIT_SUCCESS
4899
6274
  ;;
4900
6275
 
4901
6276
clean)
5006
6381
  -no-install       link a not-installable executable
5007
6382
  -no-undefined     declare that a library does not refer to external symbols
5008
6383
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6384
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6385
  -precious-files-regex REGEX
 
6386
                    don't remove output files matching REGEX
5009
6387
  -release RELEASE  specify package release information
5010
6388
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5011
6389
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5047
6425
*)
5048
6426
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5049
6427
  $echo "$help" 1>&2
5050
 
  exit 1
 
6428
  exit $EXIT_FAILURE
5051
6429
  ;;
5052
6430
esac
5053
6431
 
5054
 
echo
 
6432
$echo
5055
6433
$echo "Try \`$modename --help' for more information about other modes."
5056
6434
 
5057
 
exit 0
 
6435
exit $?
 
6436
 
 
6437
# The TAGs below are defined such that we never get into a situation
 
6438
# in which we disable both kinds of libraries.  Given conflicting
 
6439
# choices, we go for a static library, that is the most portable,
 
6440
# since we can't tell whether shared libraries were disabled because
 
6441
# the user asked for that or because the platform doesn't support
 
6442
# them.  This is particularly important on AIX, because we don't
 
6443
# support having both static and shared libraries enabled at the same
 
6444
# time on that platform, so we default to a shared-only configuration.
 
6445
# If a disable-shared tag is given, we'll fallback to a static-only
 
6446
# configuration.  But we'll never go from static-only to shared-only.
 
6447
 
 
6448
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6449
build_libtool_libs=no
 
6450
build_old_libs=yes
 
6451
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6452
 
 
6453
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6454
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6455
# ### END LIBTOOL TAG CONFIG: disable-static
5058
6456
 
5059
6457
# Local Variables:
5060
6458
# mode:shell-script