~ubuntu-branches/ubuntu/breezy/orbit2/breezy

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-09-06 16:37:02 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050906163702-hrqi0ctymth53bnn
Tags: 1:2.12.4-0ubuntu1
* New upstream version.
* debian/patches/100-compile-name-server.patch:
  - updated.

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
#
17
17
#
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program; if not, write to the Free Software
20
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
21
#
22
22
# As a special exception to the GNU General Public License, if you
23
23
# distribute this file as part of a program that contains a
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.18
 
47
TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)"
 
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.2
59
 
TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)"
60
 
 
61
79
default_mode=
62
80
help="Try \`$progname --help' for more information."
63
81
magic="%%%MAGIC variable%%%"
67
85
 
68
86
# Sed substitution that helps us do robust quoting.  It backslashifies
69
87
# metacharacters that are still active within double-quoted strings.
70
 
Xsed='sed -e 1s/^X//'
 
88
Xsed="${SED}"' -e 1s/^X//'
71
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
SP2NL='tr \040 \012'
73
 
NL2SP='tr \015\012 \040\040'
 
90
# test EBCDIC or ASCII
 
91
case `echo A|tr A '\301'` in
 
92
 A) # EBCDIC based system
 
93
  SP2NL="tr '\100' '\n'"
 
94
  NL2SP="tr '\r\n' '\100\100'"
 
95
  ;;
 
96
 *) # Assume ASCII based system
 
97
  SP2NL="tr '\040' '\012'"
 
98
  NL2SP="tr '\015\012' '\040\040'"
 
99
  ;;
 
100
esac
74
101
 
75
102
# NLS nuisances.
76
103
# Only set LANG and LC_ALL to C if already set.
85
112
fi
86
113
 
87
114
# Make sure IFS has a sensible default
88
 
: ${IFS="       "}
 
115
lt_nl='
 
116
'
 
117
IFS="   $lt_nl"
89
118
 
90
119
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91
 
  echo "$modename: not configured to build any kind of library" 1>&2
92
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
93
 
  exit 1
 
120
  $echo "$modename: not configured to build any kind of library" 1>&2
 
121
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
122
  exit $EXIT_FAILURE
94
123
fi
95
124
 
96
125
# Global variables.
104
133
execute_dlfiles=
105
134
lo2o="s/\\.lo\$/.${objext}/"
106
135
o2lo="s/\\.${objext}\$/.lo/"
 
136
quote_scanset='[[~#^*{};<>?'"'"'        ]'
 
137
 
 
138
#####################################
 
139
# Shell function definitions:
 
140
# This seems to be the best place for them
 
141
 
 
142
# func_win32_libid arg
 
143
# return the library type of file 'arg'
 
144
#
 
145
# Need a lot of goo to handle *both* DLLs and import libs
 
146
# Has to be a shell function in order to 'eat' the argument
 
147
# that is supplied when $file_magic_command is called.
 
148
func_win32_libid ()
 
149
{
 
150
  win32_libid_type="unknown"
 
151
  win32_fileres=`file -L $1 2>/dev/null`
 
152
  case $win32_fileres in
 
153
  *ar\ archive\ import\ library*) # definitely import
 
154
    win32_libid_type="x86 archive import"
 
155
    ;;
 
156
  *ar\ archive*) # could be an import, or static
 
157
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
 
158
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
159
      win32_nmres=`eval $NM -f posix -A $1 | \
 
160
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
 
161
      if test "X$win32_nmres" = "Ximport" ; then
 
162
        win32_libid_type="x86 archive import"
 
163
      else
 
164
        win32_libid_type="x86 archive static"
 
165
      fi
 
166
    fi
 
167
    ;;
 
168
  *DLL*)
 
169
    win32_libid_type="x86 DLL"
 
170
    ;;
 
171
  *executable*) # but shell scripts are "executable" too...
 
172
    case $win32_fileres in
 
173
    *MS\ Windows\ PE\ Intel*)
 
174
      win32_libid_type="x86 DLL"
 
175
      ;;
 
176
    esac
 
177
    ;;
 
178
  esac
 
179
  $echo $win32_libid_type
 
180
}
 
181
 
 
182
 
 
183
# func_infer_tag arg
 
184
# Infer tagged configuration to use if any are available and
 
185
# if one wasn't chosen via the "--tag" command line option.
 
186
# Only attempt this if the compiler in the base compile
 
187
# command doesn't match the default compiler.
 
188
# arg is usually of the form 'gcc ...'
 
189
func_infer_tag ()
 
190
{
 
191
    if test -n "$available_tags" && test -z "$tagname"; then
 
192
      CC_quoted=
 
193
      for arg in $CC; do
 
194
        case $arg in
 
195
          *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
196
          arg="\"$arg\""
 
197
          ;;
 
198
        esac
 
199
        CC_quoted="$CC_quoted $arg"
 
200
      done
 
201
      case $@ in
 
202
      # Blanks in the command may have been stripped by the calling shell,
 
203
      # but not from the CC environment variable when configure was run.
 
204
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
205
      # Blanks at the start of $base_compile will cause this to fail
 
206
      # if we don't check for them as well.
 
207
      *)
 
208
        for z in $available_tags; do
 
209
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
210
            # Evaluate the configuration.
 
211
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
212
            CC_quoted=
 
213
            for arg in $CC; do
 
214
            # Double-quote args containing other shell metacharacters.
 
215
            case $arg in
 
216
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
217
              arg="\"$arg\""
 
218
              ;;
 
219
            esac
 
220
            CC_quoted="$CC_quoted $arg"
 
221
          done
 
222
            case "$@ " in
 
223
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
224
              # The compiler in the base compile command matches
 
225
              # the one in the tagged configuration.
 
226
              # Assume this is the tagged configuration we want.
 
227
              tagname=$z
 
228
              break
 
229
              ;;
 
230
            esac
 
231
          fi
 
232
        done
 
233
        # If $tagname still isn't set, then no tagged configuration
 
234
        # was found and let the user know that the "--tag" command
 
235
        # line option must be used.
 
236
        if test -z "$tagname"; then
 
237
          $echo "$modename: unable to infer tagged configuration"
 
238
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
239
          exit $EXIT_FAILURE
 
240
#        else
 
241
#          $echo "$modename: using $tagname tagged configuration"
 
242
        fi
 
243
        ;;
 
244
      esac
 
245
    fi
 
246
}
 
247
 
 
248
 
 
249
# func_extract_an_archive dir oldlib
 
250
func_extract_an_archive ()
 
251
{
 
252
    f_ex_an_ar_dir="$1"; shift
 
253
    f_ex_an_ar_oldlib="$1"
 
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: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
 
261
      exit $EXIT_FAILURE
 
262
    fi
 
263
}
 
264
 
 
265
# func_extract_archives gentop oldlib ...
 
266
func_extract_archives ()
 
267
{
 
268
    my_gentop="$1"; shift
 
269
    my_oldlibs=${1+"$@"}
 
270
    my_oldobjs=""
 
271
    my_xlib=""
 
272
    my_xabs=""
 
273
    my_xdir=""
 
274
    my_status=""
 
275
 
 
276
    $show "${rm}r $my_gentop"
 
277
    $run ${rm}r "$my_gentop"
 
278
    $show "$mkdir $my_gentop"
 
279
    $run $mkdir "$my_gentop"
 
280
    my_status=$?
 
281
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
 
282
      exit $my_status
 
283
    fi
 
284
 
 
285
    for my_xlib in $my_oldlibs; do
 
286
      # Extract the objects.
 
287
      case $my_xlib in
 
288
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
289
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
290
      esac
 
291
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
 
292
      my_xdir="$my_gentop/$my_xlib"
 
293
 
 
294
      $show "${rm}r $my_xdir"
 
295
      $run ${rm}r "$my_xdir"
 
296
      $show "$mkdir $my_xdir"
 
297
      $run $mkdir "$my_xdir"
 
298
      status=$?
 
299
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
 
300
        exit $status
 
301
      fi
 
302
      case $host in
 
303
      *-darwin*)
 
304
        $show "Extracting $my_xabs"
 
305
        # Do not bother doing anything if just a dry run
 
306
        if test -z "$run"; then
 
307
          darwin_orig_dir=`pwd`
 
308
          cd $my_xdir || exit $?
 
309
          darwin_archive=$my_xabs
 
310
          darwin_curdir=`pwd`
 
311
          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
 
312
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
 
313
          if test -n "$darwin_arches"; then 
 
314
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
 
315
            darwin_arch=
 
316
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
 
317
            for darwin_arch in  $darwin_arches ; do
 
318
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
319
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
320
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
321
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
322
              cd "$darwin_curdir"
 
323
              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
324
            done # $darwin_arches
 
325
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
 
326
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
 
327
            darwin_file=
 
328
            darwin_files=
 
329
            for darwin_file in $darwin_filelist; do
 
330
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 
331
              lipo -create -output "$darwin_file" $darwin_files
 
332
            done # $darwin_filelist
 
333
            ${rm}r unfat-$$
 
334
            cd "$darwin_orig_dir"
 
335
          else
 
336
            cd "$darwin_orig_dir"
 
337
            func_extract_an_archive "$my_xdir" "$my_xabs"
 
338
          fi # $darwin_arches
 
339
        fi # $run
 
340
      ;;
 
341
      *)
 
342
        func_extract_an_archive "$my_xdir" "$my_xabs"
 
343
        ;;
 
344
      esac
 
345
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
346
    done
 
347
    func_extract_archives_result="$my_oldobjs"
 
348
}
 
349
# End of Shell function definitions
 
350
#####################################
 
351
 
 
352
# Darwin sucks
 
353
eval std_shrext=\"$shrext_cmds\"
107
354
 
108
355
# Parse our command line options once, thoroughly.
109
 
while test $# -gt 0
 
356
while test "$#" -gt 0
110
357
do
111
358
  arg="$1"
112
359
  shift
122
369
    execute_dlfiles)
123
370
      execute_dlfiles="$execute_dlfiles $arg"
124
371
      ;;
 
372
    tag)
 
373
      tagname="$arg"
 
374
      preserve_args="${preserve_args}=$arg"
 
375
 
 
376
      # Check whether tagname contains only valid characters
 
377
      case $tagname in
 
378
      *[!-_A-Za-z0-9,/]*)
 
379
        $echo "$progname: invalid tag name: $tagname" 1>&2
 
380
        exit $EXIT_FAILURE
 
381
        ;;
 
382
      esac
 
383
 
 
384
      case $tagname in
 
385
      CC)
 
386
        # Don't test for the "default" C tag, as we know, it's there, but
 
387
        # not specially marked.
 
388
        ;;
 
389
      *)
 
390
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
 
391
          taglist="$taglist $tagname"
 
392
          # Evaluate the configuration.
 
393
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
 
394
        else
 
395
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
 
396
        fi
 
397
        ;;
 
398
      esac
 
399
      ;;
125
400
    *)
126
401
      eval "$prev=\$arg"
127
402
      ;;
139
414
    ;;
140
415
 
141
416
  --version)
142
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
143
 
    exit 0
 
417
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
 
418
    $echo
 
419
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
 
420
    $echo "This is free software; see the source for copying conditions.  There is NO"
 
421
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
422
    exit $?
144
423
    ;;
145
424
 
146
425
  --config)
147
 
    sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
148
 
    exit 0
 
426
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
 
427
    # Now print the configurations for the tags.
 
428
    for tagname in $taglist; do
 
429
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
 
430
    done
 
431
    exit $?
149
432
    ;;
150
433
 
151
434
  --debug)
152
 
    echo "$progname: enabling shell trace mode"
 
435
    $echo "$progname: enabling shell trace mode"
153
436
    set -x
 
437
    preserve_args="$preserve_args $arg"
154
438
    ;;
155
439
 
156
440
  --dry-run | -n)
158
442
    ;;
159
443
 
160
444
  --features)
161
 
    echo "host: $host"
 
445
    $echo "host: $host"
162
446
    if test "$build_libtool_libs" = yes; then
163
 
      echo "enable shared libraries"
 
447
      $echo "enable shared libraries"
164
448
    else
165
 
      echo "disable shared libraries"
 
449
      $echo "disable shared libraries"
166
450
    fi
167
451
    if test "$build_old_libs" = yes; then
168
 
      echo "enable static libraries"
 
452
      $echo "enable static libraries"
169
453
    else
170
 
      echo "disable static libraries"
 
454
      $echo "disable static libraries"
171
455
    fi
172
 
    exit 0
 
456
    exit $?
173
457
    ;;
174
458
 
175
459
  --finish) mode="finish" ;;
177
461
  --mode) prevopt="--mode" prev=mode ;;
178
462
  --mode=*) mode="$optarg" ;;
179
463
 
 
464
  --preserve-dup-deps) duplicate_deps="yes" ;;
 
465
 
180
466
  --quiet | --silent)
181
467
    show=:
 
468
    preserve_args="$preserve_args $arg"
 
469
    ;;
 
470
 
 
471
  --tag) prevopt="--tag" prev=tag ;;
 
472
  --tag=*)
 
473
    set tag "$optarg" ${1+"$@"}
 
474
    shift
 
475
    prev=tag
 
476
    preserve_args="$preserve_args --tag"
182
477
    ;;
183
478
 
184
479
  -dlopen)
189
484
  -*)
190
485
    $echo "$modename: unrecognized option \`$arg'" 1>&2
191
486
    $echo "$help" 1>&2
192
 
    exit 1
 
487
    exit $EXIT_FAILURE
193
488
    ;;
194
489
 
195
490
  *)
202
497
if test -n "$prevopt"; then
203
498
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
204
499
  $echo "$help" 1>&2
205
 
  exit 1
 
500
  exit $EXIT_FAILURE
206
501
fi
207
502
 
208
503
# If this variable is set in any of the actions, the command in it
214
509
 
215
510
  # Infer the operation mode.
216
511
  if test -z "$mode"; then
 
512
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
 
513
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
217
514
    case $nonopt in
218
 
    *cc | *++ | gcc* | *-gcc*)
 
515
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
219
516
      mode=link
220
517
      for arg
221
518
      do
256
553
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
257
554
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
258
555
    $echo "$help" 1>&2
259
 
    exit 1
 
556
    exit $EXIT_FAILURE
260
557
  fi
261
558
 
262
559
  # Change the help message to a mode-specific one.
270
567
    modename="$modename: compile"
271
568
    # Get the compilation command and the source file.
272
569
    base_compile=
273
 
    prev=
274
 
    lastarg=
275
 
    srcfile="$nonopt"
 
570
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
571
    suppress_opt=yes
276
572
    suppress_output=
 
573
    arg_mode=normal
 
574
    libobj=
 
575
    later=
277
576
 
278
 
    user_target=no
279
577
    for arg
280
578
    do
281
 
      case $prev in
282
 
      "") ;;
283
 
      xcompiler)
284
 
        # Aesthetically quote the previous argument.
285
 
        prev=
286
 
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
287
 
 
288
 
        case $arg in
289
 
        # Double-quote args containing other shell metacharacters.
290
 
        # Many Bourne shells cannot handle close brackets correctly
291
 
        # in scan sets, so we specify it separately.
292
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
293
 
          arg="\"$arg\""
294
 
          ;;
295
 
        esac
296
 
 
297
 
        # Add the previous argument to base_compile.
298
 
        if test -z "$base_compile"; then
299
 
          base_compile="$lastarg"
300
 
        else
301
 
          base_compile="$base_compile $lastarg"
302
 
        fi
303
 
        continue
304
 
        ;;
305
 
      esac
306
 
 
307
 
      # Accept any command-line options.
308
 
      case $arg in
309
 
      -o)
310
 
        if test "$user_target" != "no"; then
311
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
312
 
          exit 1
313
 
        fi
314
 
        user_target=next
315
 
        ;;
316
 
 
317
 
      -static)
318
 
        build_old_libs=yes
319
 
        continue
320
 
        ;;
321
 
 
322
 
      -prefer-pic)
323
 
        pic_mode=yes
324
 
        continue
325
 
        ;;
326
 
 
327
 
      -prefer-non-pic)
328
 
        pic_mode=no
329
 
        continue
330
 
        ;;
331
 
 
332
 
      -Xcompiler)
333
 
        prev=xcompiler
334
 
        continue
335
 
        ;;
336
 
 
337
 
      -Wc,*)
338
 
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
339
 
        lastarg=
340
 
        save_ifs="$IFS"; IFS=','
341
 
        for arg in $args; do
342
 
          IFS="$save_ifs"
343
 
 
344
 
          # Double-quote args containing other shell metacharacters.
345
 
          # Many Bourne shells cannot handle close brackets correctly
346
 
          # in scan sets, so we specify it separately.
347
 
          case $arg in
348
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
349
 
            arg="\"$arg\""
350
 
            ;;
351
 
          esac
352
 
          lastarg="$lastarg $arg"
353
 
        done
354
 
        IFS="$save_ifs"
355
 
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
356
 
 
357
 
        # Add the arguments to base_compile.
358
 
        if test -z "$base_compile"; then
359
 
          base_compile="$lastarg"
360
 
        else
361
 
          base_compile="$base_compile $lastarg"
362
 
        fi
363
 
        continue
364
 
        ;;
365
 
      esac
366
 
 
367
 
      case $user_target in
368
 
      next)
369
 
        # The next one is the -o target name
370
 
        user_target=yes
371
 
        continue
372
 
        ;;
373
 
      yes)
374
 
        # We got the output file
375
 
        user_target=set
 
579
      case "$arg_mode" in
 
580
      arg  )
 
581
        # do not "continue".  Instead, add this to base_compile
 
582
        lastarg="$arg"
 
583
        arg_mode=normal
 
584
        ;;
 
585
 
 
586
      target )
376
587
        libobj="$arg"
 
588
        arg_mode=normal
377
589
        continue
378
590
        ;;
379
 
      esac
380
 
 
381
 
      # Accept the current argument as the source file.
382
 
      lastarg="$srcfile"
383
 
      srcfile="$arg"
 
591
 
 
592
      normal )
 
593
        # Accept any command-line options.
 
594
        case $arg in
 
595
        -o)
 
596
          if test -n "$libobj" ; then
 
597
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
598
            exit $EXIT_FAILURE
 
599
          fi
 
600
          arg_mode=target
 
601
          continue
 
602
          ;;
 
603
 
 
604
        -static | -prefer-pic | -prefer-non-pic)
 
605
          later="$later $arg"
 
606
          continue
 
607
          ;;
 
608
 
 
609
        -no-suppress)
 
610
          suppress_opt=no
 
611
          continue
 
612
          ;;
 
613
 
 
614
        -Xcompiler)
 
615
          arg_mode=arg  #  the next one goes into the "base_compile" arg list
 
616
          continue      #  The current "srcfile" will either be retained or
 
617
          ;;            #  replaced later.  I would guess that would be a bug.
 
618
 
 
619
        -Wc,*)
 
620
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
621
          lastarg=
 
622
          save_ifs="$IFS"; IFS=','
 
623
          for arg in $args; do
 
624
            IFS="$save_ifs"
 
625
 
 
626
            # Double-quote args containing other shell metacharacters.
 
627
            # Many Bourne shells cannot handle close brackets correctly
 
628
            # in scan sets, so we specify it separately.
 
629
            case $arg in
 
630
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
631
              arg="\"$arg\""
 
632
              ;;
 
633
            esac
 
634
            lastarg="$lastarg $arg"
 
635
          done
 
636
          IFS="$save_ifs"
 
637
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
638
 
 
639
          # Add the arguments to base_compile.
 
640
          base_compile="$base_compile $lastarg"
 
641
          continue
 
642
          ;;
 
643
 
 
644
        * )
 
645
          # Accept the current argument as the source file.
 
646
          # The previous "srcfile" becomes the current argument.
 
647
          #
 
648
          lastarg="$srcfile"
 
649
          srcfile="$arg"
 
650
          ;;
 
651
        esac  #  case $arg
 
652
        ;;
 
653
      esac    #  case $arg_mode
384
654
 
385
655
      # Aesthetically quote the previous argument.
386
 
 
387
 
      # Backslashify any backslashes, double quotes, and dollar signs.
388
 
      # These are the only characters that are still specially
389
 
      # interpreted inside of double-quoted scrings.
390
656
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
391
657
 
 
658
      case $lastarg in
392
659
      # Double-quote args containing other shell metacharacters.
393
660
      # Many Bourne shells cannot handle close brackets correctly
394
 
      # in scan sets, so we specify it separately.
395
 
      case $lastarg in
396
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
661
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
 
662
      # in scan sets (worked around with variable expansion),
 
663
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
 
664
      # at all, so we specify them separately.
 
665
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
397
666
        lastarg="\"$lastarg\""
398
667
        ;;
399
668
      esac
400
669
 
401
 
      # Add the previous argument to base_compile.
402
 
      if test -z "$base_compile"; then
403
 
        base_compile="$lastarg"
404
 
      else
405
 
        base_compile="$base_compile $lastarg"
406
 
      fi
407
 
    done
 
670
      base_compile="$base_compile $lastarg"
 
671
    done # for arg
408
672
 
409
 
    case $user_target in
410
 
    set)
411
 
      ;;
412
 
    no)
 
673
    case $arg_mode in
 
674
    arg)
 
675
      $echo "$modename: you must specify an argument for -Xcompile"
 
676
      exit $EXIT_FAILURE
 
677
      ;;
 
678
    target)
 
679
      $echo "$modename: you must specify a target with \`-o'" 1>&2
 
680
      exit $EXIT_FAILURE
 
681
      ;;
 
682
    *)
413
683
      # Get the name of the library object.
414
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
415
 
      ;;
416
 
    *)
417
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
418
 
      exit 1
 
684
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
419
685
      ;;
420
686
    esac
421
687
 
422
688
    # Recognize several different file suffixes.
423
689
    # If the user specifies -o file.o, it is replaced with file.lo
424
 
    xform='[cCFSfmso]'
 
690
    xform='[cCFSifmso]'
425
691
    case $libobj in
426
692
    *.ada) xform=ada ;;
427
693
    *.adb) xform=adb ;;
429
695
    *.asm) xform=asm ;;
430
696
    *.c++) xform=c++ ;;
431
697
    *.cc) xform=cc ;;
 
698
    *.ii) xform=ii ;;
 
699
    *.class) xform=class ;;
432
700
    *.cpp) xform=cpp ;;
433
701
    *.cxx) xform=cxx ;;
434
702
    *.f90) xform=f90 ;;
435
703
    *.for) xform=for ;;
 
704
    *.java) xform=java ;;
436
705
    esac
437
706
 
438
707
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
441
710
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
442
711
    *)
443
712
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
444
 
      exit 1
 
713
      exit $EXIT_FAILURE
445
714
      ;;
446
715
    esac
447
716
 
 
717
    func_infer_tag $base_compile
 
718
 
 
719
    for arg in $later; do
 
720
      case $arg in
 
721
      -static)
 
722
        build_old_libs=yes
 
723
        continue
 
724
        ;;
 
725
 
 
726
      -prefer-pic)
 
727
        pic_mode=yes
 
728
        continue
 
729
        ;;
 
730
 
 
731
      -prefer-non-pic)
 
732
        pic_mode=no
 
733
        continue
 
734
        ;;
 
735
      esac
 
736
    done
 
737
 
 
738
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
 
739
    case $qlibobj in
 
740
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
741
        qlibobj="\"$qlibobj\"" ;;
 
742
    esac
 
743
    if test "X$libobj" != "X$qlibobj"; then
 
744
        $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
 
745
        exit $EXIT_FAILURE
 
746
    fi
 
747
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
748
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
749
    if test "X$xdir" = "X$obj"; then
 
750
      xdir=
 
751
    else
 
752
      xdir=$xdir/
 
753
    fi
 
754
    lobj=${xdir}$objdir/$objname
 
755
 
448
756
    if test -z "$base_compile"; then
449
757
      $echo "$modename: you must specify a compilation command" 1>&2
450
758
      $echo "$help" 1>&2
451
 
      exit 1
 
759
      exit $EXIT_FAILURE
452
760
    fi
453
761
 
454
762
    # Delete any leftover library objects.
455
763
    if test "$build_old_libs" = yes; then
456
 
      removelist="$obj $libobj"
 
764
      removelist="$obj $lobj $libobj ${libobj}T"
457
765
    else
458
 
      removelist="$libobj"
 
766
      removelist="$lobj $libobj ${libobj}T"
459
767
    fi
460
768
 
461
769
    $run $rm $removelist
462
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
770
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
463
771
 
464
772
    # On Cygwin there's no "real" PIC flag so we must build both object types
465
773
    case $host_os in
467
775
      pic_mode=default
468
776
      ;;
469
777
    esac
470
 
    if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
 
778
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
471
779
      # non-PIC code in shared libraries is not supported
472
780
      pic_mode=default
473
781
    fi
478
786
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
479
787
      lockfile="$output_obj.lock"
480
788
      removelist="$removelist $output_obj $lockfile"
481
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
789
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
482
790
    else
 
791
      output_obj=
483
792
      need_locks=no
484
793
      lockfile=
485
794
    fi
487
796
    # Lock this critical section if it is needed
488
797
    # We use this script file to make the link, it avoids creating a new file
489
798
    if test "$need_locks" = yes; then
490
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
799
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
491
800
        $show "Waiting for $lockfile to be removed"
492
801
        sleep 2
493
802
      done
494
803
    elif test "$need_locks" = warn; then
495
804
      if test -f "$lockfile"; then
496
 
        echo "\
 
805
        $echo "\
497
806
*** ERROR, $lockfile exists and contains:
498
807
`cat $lockfile 2>/dev/null`
499
808
 
505
814
compiler."
506
815
 
507
816
        $run $rm $removelist
508
 
        exit 1
 
817
        exit $EXIT_FAILURE
509
818
      fi
510
 
      echo $srcfile > "$lockfile"
 
819
      $echo "$srcfile" > "$lockfile"
511
820
    fi
512
821
 
513
822
    if test -n "$fix_srcfile_path"; then
514
823
      eval srcfile=\"$fix_srcfile_path\"
515
824
    fi
 
825
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
 
826
    case $qsrcfile in
 
827
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
828
      qsrcfile="\"$qsrcfile\"" ;;
 
829
    esac
 
830
 
 
831
    $run $rm "$libobj" "${libobj}T"
 
832
 
 
833
    # Create a libtool object file (analogous to a ".la" file),
 
834
    # but don't create it if we're doing a dry run.
 
835
    test -z "$run" && cat > ${libobj}T <<EOF
 
836
# $libobj - a libtool object file
 
837
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
838
#
 
839
# Please DO NOT delete this file!
 
840
# It is necessary for linking the library.
 
841
 
 
842
# Name of the PIC object.
 
843
EOF
516
844
 
517
845
    # Only build a PIC object if we are building libtool libraries.
518
846
    if test "$build_libtool_libs" = yes; then
520
848
      fbsd_hideous_sh_bug=$base_compile
521
849
 
522
850
      if test "$pic_mode" != no; then
523
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
524
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
851
        command="$base_compile $qsrcfile $pic_flag"
525
852
      else
526
853
        # Don't build PIC code
527
 
        command="$base_compile $srcfile"
528
 
      fi
529
 
      if test "$build_old_libs" = yes; then
530
 
        lo_libobj="$libobj"
531
 
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
532
 
        if test "X$dir" = "X$libobj"; then
533
 
          dir="$objdir"
534
 
        else
535
 
          dir="$dir/$objdir"
536
 
        fi
537
 
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
538
 
 
539
 
        if test -d "$dir"; then
540
 
          $show "$rm $libobj"
541
 
          $run $rm $libobj
542
 
        else
543
 
          $show "$mkdir $dir"
544
 
          $run $mkdir $dir
545
 
          status=$?
546
 
          if test $status -ne 0 && test ! -d $dir; then
547
 
            exit $status
548
 
          fi
549
 
        fi
550
 
      fi
551
 
      if test "$compiler_o_lo" = yes; then
552
 
        output_obj="$libobj"
553
 
        command="$command -o $output_obj"
554
 
      elif test "$compiler_c_o" = yes; then
555
 
        output_obj="$obj"
556
 
        command="$command -o $output_obj"
557
 
      fi
558
 
 
559
 
      $run $rm "$output_obj"
 
854
        command="$base_compile $qsrcfile"
 
855
      fi
 
856
 
 
857
      if test ! -d "${xdir}$objdir"; then
 
858
        $show "$mkdir ${xdir}$objdir"
 
859
        $run $mkdir ${xdir}$objdir
 
860
        status=$?
 
861
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
862
          exit $status
 
863
        fi
 
864
      fi
 
865
 
 
866
      if test -z "$output_obj"; then
 
867
        # Place PIC objects in $objdir
 
868
        command="$command -o $lobj"
 
869
      fi
 
870
 
 
871
      $run $rm "$lobj" "$output_obj"
 
872
 
560
873
      $show "$command"
561
874
      if $run eval "$command"; then :
562
875
      else
563
876
        test -n "$output_obj" && $run $rm $removelist
564
 
        exit 1
 
877
        exit $EXIT_FAILURE
565
878
      fi
566
879
 
567
880
      if test "$need_locks" = warn &&
568
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
569
 
        echo "\
 
881
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
882
        $echo "\
570
883
*** ERROR, $lockfile contains:
571
884
`cat $lockfile 2>/dev/null`
572
885
 
581
894
compiler."
582
895
 
583
896
        $run $rm $removelist
584
 
        exit 1
 
897
        exit $EXIT_FAILURE
585
898
      fi
586
899
 
587
900
      # Just move the object if needed, then go on to compile the next one
588
 
      if test x"$output_obj" != x"$libobj"; then
589
 
        $show "$mv $output_obj $libobj"
590
 
        if $run $mv $output_obj $libobj; then :
591
 
        else
592
 
          error=$?
593
 
          $run $rm $removelist
594
 
          exit $error
595
 
        fi
596
 
      fi
597
 
 
598
 
      # If we have no pic_flag, then copy the object into place and finish.
599
 
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
600
 
         test "$build_old_libs" = yes; then
601
 
        # Rename the .lo from within objdir to obj
602
 
        if test -f $obj; then
603
 
          $show $rm $obj
604
 
          $run $rm $obj
605
 
        fi
606
 
 
607
 
        $show "$mv $libobj $obj"
608
 
        if $run $mv $libobj $obj; then :
609
 
        else
610
 
          error=$?
611
 
          $run $rm $removelist
612
 
          exit $error
613
 
        fi
614
 
 
615
 
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
616
 
        if test "X$xdir" = "X$obj"; then
617
 
          xdir="."
618
 
        else
619
 
          xdir="$xdir"
620
 
        fi
621
 
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
622
 
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
623
 
        # Now arrange that obj and lo_libobj become the same file
624
 
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
625
 
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
626
 
          # Unlock the critical section if it was locked
627
 
          if test "$need_locks" != no; then
628
 
            $run $rm "$lockfile"
629
 
          fi
630
 
          exit 0
631
 
        else
632
 
          error=$?
633
 
          $run $rm $removelist
634
 
          exit $error
635
 
        fi
636
 
      fi
 
901
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 
902
        $show "$mv $output_obj $lobj"
 
903
        if $run $mv $output_obj $lobj; then :
 
904
        else
 
905
          error=$?
 
906
          $run $rm $removelist
 
907
          exit $error
 
908
        fi
 
909
      fi
 
910
 
 
911
      # Append the name of the PIC object to the libtool object file.
 
912
      test -z "$run" && cat >> ${libobj}T <<EOF
 
913
pic_object='$objdir/$objname'
 
914
 
 
915
EOF
637
916
 
638
917
      # Allow error messages only from the first compilation.
639
 
      suppress_output=' >/dev/null 2>&1'
 
918
      if test "$suppress_opt" = yes; then
 
919
        suppress_output=' >/dev/null 2>&1'
 
920
      fi
 
921
    else
 
922
      # No PIC object so indicate it doesn't exist in the libtool
 
923
      # object file.
 
924
      test -z "$run" && cat >> ${libobj}T <<EOF
 
925
pic_object=none
 
926
 
 
927
EOF
640
928
    fi
641
929
 
642
930
    # Only build a position-dependent object if we build old libraries.
643
931
    if test "$build_old_libs" = yes; then
644
932
      if test "$pic_mode" != yes; then
645
933
        # Don't build PIC code
646
 
        command="$base_compile $srcfile"
 
934
        command="$base_compile $qsrcfile"
647
935
      else
648
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
649
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
936
        command="$base_compile $qsrcfile $pic_flag"
650
937
      fi
651
938
      if test "$compiler_c_o" = yes; then
652
939
        command="$command -o $obj"
653
 
        output_obj="$obj"
654
940
      fi
655
941
 
656
942
      # Suppress compiler output if we already did a PIC compilation.
657
943
      command="$command$suppress_output"
658
 
      $run $rm "$output_obj"
 
944
      $run $rm "$obj" "$output_obj"
659
945
      $show "$command"
660
946
      if $run eval "$command"; then :
661
947
      else
662
948
        $run $rm $removelist
663
 
        exit 1
 
949
        exit $EXIT_FAILURE
664
950
      fi
665
951
 
666
952
      if test "$need_locks" = warn &&
667
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
668
 
        echo "\
 
953
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
954
        $echo "\
669
955
*** ERROR, $lockfile contains:
670
956
`cat $lockfile 2>/dev/null`
671
957
 
680
966
compiler."
681
967
 
682
968
        $run $rm $removelist
683
 
        exit 1
 
969
        exit $EXIT_FAILURE
684
970
      fi
685
971
 
686
972
      # Just move the object if needed
687
 
      if test x"$output_obj" != x"$obj"; then
 
973
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
688
974
        $show "$mv $output_obj $obj"
689
975
        if $run $mv $output_obj $obj; then :
690
976
        else
694
980
        fi
695
981
      fi
696
982
 
697
 
      # Create an invalid libtool object if no PIC, so that we do not
698
 
      # accidentally link it into a program.
699
 
      if test "$build_libtool_libs" != yes; then
700
 
        $show "echo timestamp > $libobj"
701
 
        $run eval "echo timestamp > \$libobj" || exit $?
702
 
      else
703
 
        # Move the .lo from within objdir
704
 
        $show "$mv $libobj $lo_libobj"
705
 
        if $run $mv $libobj $lo_libobj; then :
706
 
        else
707
 
          error=$?
708
 
          $run $rm $removelist
709
 
          exit $error
710
 
        fi
711
 
      fi
 
983
      # Append the name of the non-PIC object the libtool object file.
 
984
      # Only append if the libtool object file exists.
 
985
      test -z "$run" && cat >> ${libobj}T <<EOF
 
986
# Name of the non-PIC object.
 
987
non_pic_object='$objname'
 
988
 
 
989
EOF
 
990
    else
 
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=none
 
996
 
 
997
EOF
712
998
    fi
713
999
 
 
1000
    $run $mv "${libobj}T" "${libobj}"
 
1001
 
714
1002
    # Unlock the critical section if it was locked
715
1003
    if test "$need_locks" != no; then
716
1004
      $run $rm "$lockfile"
717
1005
    fi
718
1006
 
719
 
    exit 0
 
1007
    exit $EXIT_SUCCESS
720
1008
    ;;
721
1009
 
722
1010
  # libtool link mode
727
1015
      # It is impossible to link a dll without this setting, and
728
1016
      # we shouldn't force the makefile maintainer to figure out
729
1017
      # which system we are compiling for in order to pass an extra
730
 
      # flag for every libtool invokation.
 
1018
      # flag for every libtool invocation.
731
1019
      # allow_undefined=no
732
1020
 
733
1021
      # FIXME: Unfortunately, there are problems with the above when trying
742
1030
      ;;
743
1031
    esac
744
1032
    libtool_args="$nonopt"
 
1033
    base_compile="$nonopt $@"
745
1034
    compile_command="$nonopt"
746
1035
    finalize_command="$nonopt"
747
1036
 
772
1061
    module=no
773
1062
    no_install=no
774
1063
    objs=
 
1064
    non_pic_objects=
 
1065
    precious_files_regex=
775
1066
    prefer_static_libs=no
776
1067
    preload=no
777
1068
    prev=
783
1074
    temp_rpath=
784
1075
    thread_safe=no
785
1076
    vinfo=
 
1077
    vinfo_number=no
 
1078
 
 
1079
    func_infer_tag $base_compile
786
1080
 
787
1081
    # We need to know -static, to get the right output filenames.
788
1082
    for arg
813
1107
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
814
1108
 
815
1109
    # Go through the arguments, transforming them on the way.
816
 
    while test $# -gt 0; do
 
1110
    while test "$#" -gt 0; do
817
1111
      arg="$1"
818
1112
      shift
819
1113
      case $arg in
820
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
1114
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
821
1115
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
822
1116
        ;;
823
1117
      *) qarg=$arg ;;
878
1172
          export_symbols="$arg"
879
1173
          if test ! -f "$arg"; then
880
1174
            $echo "$modename: symbol file \`$arg' does not exist"
881
 
            exit 1
 
1175
            exit $EXIT_FAILURE
882
1176
          fi
883
1177
          prev=
884
1178
          continue
888
1182
          prev=
889
1183
          continue
890
1184
          ;;
891
 
        inst_prefix)
 
1185
        inst_prefix)
892
1186
          inst_prefix_dir="$arg"
893
1187
          prev=
894
1188
          continue
895
1189
          ;;
 
1190
        precious_regex)
 
1191
          precious_files_regex="$arg"
 
1192
          prev=
 
1193
          continue
 
1194
          ;;
896
1195
        release)
897
1196
          release="-$arg"
898
1197
          prev=
899
1198
          continue
900
1199
          ;;
 
1200
        objectlist)
 
1201
          if test -f "$arg"; then
 
1202
            save_arg=$arg
 
1203
            moreargs=
 
1204
            for fil in `cat $save_arg`
 
1205
            do
 
1206
#             moreargs="$moreargs $fil"
 
1207
              arg=$fil
 
1208
              # A libtool-controlled object.
 
1209
 
 
1210
              # Check to see that this really is a libtool object.
 
1211
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1212
                pic_object=
 
1213
                non_pic_object=
 
1214
 
 
1215
                # Read the .lo file
 
1216
                # If there is no directory component, then add one.
 
1217
                case $arg in
 
1218
                */* | *\\*) . $arg ;;
 
1219
                *) . ./$arg ;;
 
1220
                esac
 
1221
 
 
1222
                if test -z "$pic_object" || \
 
1223
                   test -z "$non_pic_object" ||
 
1224
                   test "$pic_object" = none && \
 
1225
                   test "$non_pic_object" = none; then
 
1226
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1227
                  exit $EXIT_FAILURE
 
1228
                fi
 
1229
 
 
1230
                # Extract subdirectory from the argument.
 
1231
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1232
                if test "X$xdir" = "X$arg"; then
 
1233
                  xdir=
 
1234
                else
 
1235
                  xdir="$xdir/"
 
1236
                fi
 
1237
 
 
1238
                if test "$pic_object" != none; then
 
1239
                  # Prepend the subdirectory the object is found in.
 
1240
                  pic_object="$xdir$pic_object"
 
1241
 
 
1242
                  if test "$prev" = dlfiles; then
 
1243
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1244
                      dlfiles="$dlfiles $pic_object"
 
1245
                      prev=
 
1246
                      continue
 
1247
                    else
 
1248
                      # If libtool objects are unsupported, then we need to preload.
 
1249
                      prev=dlprefiles
 
1250
                    fi
 
1251
                  fi
 
1252
 
 
1253
                  # CHECK ME:  I think I busted this.  -Ossama
 
1254
                  if test "$prev" = dlprefiles; then
 
1255
                    # Preload the old-style object.
 
1256
                    dlprefiles="$dlprefiles $pic_object"
 
1257
                    prev=
 
1258
                  fi
 
1259
 
 
1260
                  # A PIC object.
 
1261
                  libobjs="$libobjs $pic_object"
 
1262
                  arg="$pic_object"
 
1263
                fi
 
1264
 
 
1265
                # Non-PIC object.
 
1266
                if test "$non_pic_object" != none; then
 
1267
                  # Prepend the subdirectory the object is found in.
 
1268
                  non_pic_object="$xdir$non_pic_object"
 
1269
 
 
1270
                  # A standard non-PIC object
 
1271
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1272
                  if test -z "$pic_object" || test "$pic_object" = none ; then
 
1273
                    arg="$non_pic_object"
 
1274
                  fi
 
1275
                fi
 
1276
              else
 
1277
                # Only an error if not doing a dry-run.
 
1278
                if test -z "$run"; then
 
1279
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1280
                  exit $EXIT_FAILURE
 
1281
                else
 
1282
                  # Dry-run case.
 
1283
 
 
1284
                  # Extract subdirectory from the argument.
 
1285
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1286
                  if test "X$xdir" = "X$arg"; then
 
1287
                    xdir=
 
1288
                  else
 
1289
                    xdir="$xdir/"
 
1290
                  fi
 
1291
 
 
1292
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1293
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1294
                  libobjs="$libobjs $pic_object"
 
1295
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1296
                fi
 
1297
              fi
 
1298
            done
 
1299
          else
 
1300
            $echo "$modename: link input file \`$save_arg' does not exist"
 
1301
            exit $EXIT_FAILURE
 
1302
          fi
 
1303
          arg=$save_arg
 
1304
          prev=
 
1305
          continue
 
1306
          ;;
901
1307
        rpath | xrpath)
902
1308
          # We need an absolute path.
903
1309
          case $arg in
904
1310
          [\\/]* | [A-Za-z]:[\\/]*) ;;
905
1311
          *)
906
1312
            $echo "$modename: only absolute run-paths are allowed" 1>&2
907
 
            exit 1
 
1313
            exit $EXIT_FAILURE
908
1314
            ;;
909
1315
          esac
910
1316
          if test "$prev" = rpath; then
936
1342
          finalize_command="$finalize_command $wl$qarg"
937
1343
          continue
938
1344
          ;;
 
1345
        xcclinker)
 
1346
          linker_flags="$linker_flags $qarg"
 
1347
          compiler_flags="$compiler_flags $qarg"
 
1348
          prev=
 
1349
          compile_command="$compile_command $qarg"
 
1350
          finalize_command="$finalize_command $qarg"
 
1351
          continue
 
1352
          ;;
 
1353
        shrext)
 
1354
          shrext_cmds="$arg"
 
1355
          prev=
 
1356
          continue
 
1357
          ;;
 
1358
        darwin_framework)
 
1359
          compiler_flags="$compiler_flags $arg"
 
1360
          compile_command="$compile_command $arg"
 
1361
          finalize_command="$finalize_command $arg"
 
1362
          prev=
 
1363
          continue
 
1364
          ;;
939
1365
        *)
940
1366
          eval "$prev=\"\$arg\""
941
1367
          prev=
942
1368
          continue
943
1369
          ;;
944
1370
        esac
945
 
      fi # test -n $prev
 
1371
      fi # test -n "$prev"
946
1372
 
947
1373
      prevarg="$arg"
948
1374
 
984
1410
      -export-symbols | -export-symbols-regex)
985
1411
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
986
1412
          $echo "$modename: more than one -exported-symbols argument is not allowed"
987
 
          exit 1
 
1413
          exit $EXIT_FAILURE
988
1414
        fi
989
1415
        if test "X$arg" = "X-export-symbols"; then
990
1416
          prev=expsyms
994
1420
        continue
995
1421
        ;;
996
1422
 
 
1423
      -framework)
 
1424
        prev=darwin_framework
 
1425
        compiler_flags="$compiler_flags $arg"
 
1426
        compile_command="$compile_command $arg"
 
1427
        finalize_command="$finalize_command $arg"
 
1428
        continue
 
1429
        ;;
 
1430
 
997
1431
      -inst-prefix-dir)
998
1432
        prev=inst_prefix
999
1433
        continue
1003
1437
      # so, if we see these flags be careful not to treat them like -L
1004
1438
      -L[A-Z][A-Z]*:*)
1005
1439
        case $with_gcc/$host in
1006
 
        no/*-*-irix*)
 
1440
        no/*-*-irix* | /*-*-irix*)
1007
1441
          compile_command="$compile_command $arg"
1008
1442
          finalize_command="$finalize_command $arg"
1009
1443
          ;;
1020
1454
          absdir=`cd "$dir" && pwd`
1021
1455
          if test -z "$absdir"; then
1022
1456
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1023
 
            exit 1
 
1457
            exit $EXIT_FAILURE
1024
1458
          fi
1025
1459
          dir="$absdir"
1026
1460
          ;;
1054
1488
            # These systems don't actually have a C library (as such)
1055
1489
            test "X$arg" = "X-lc" && continue
1056
1490
            ;;
1057
 
          *-*-openbsd*)
 
1491
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1058
1492
            # Do not include libc due to us having libc/libc_r.
1059
1493
            test "X$arg" = "X-lc" && continue
1060
1494
            ;;
1061
 
          esac
1062
 
         elif test "X$arg" = "X-lc_r"; then
1063
 
          case $host in
1064
 
          *-*-openbsd*)
1065
 
            # Do not include libc_r directly, use -pthread flag.
 
1495
          *-*-rhapsody* | *-*-darwin1.[012])
 
1496
            # Rhapsody C and math libraries are in the System framework
 
1497
            deplibs="$deplibs -framework System"
1066
1498
            continue
1067
 
            ;;
1068
1499
          esac
 
1500
        elif test "X$arg" = "X-lc_r"; then
 
1501
         case $host in
 
1502
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
1503
           # Do not include libc_r directly, use -pthread flag.
 
1504
           continue
 
1505
           ;;
 
1506
         esac
1069
1507
        fi
1070
1508
        deplibs="$deplibs $arg"
1071
1509
        continue
1072
1510
        ;;
1073
1511
 
 
1512
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
1513
      # classes, name mangling, and exception handling.
 
1514
      -model)
 
1515
        compile_command="$compile_command $arg"
 
1516
        compiler_flags="$compiler_flags $arg"
 
1517
        finalize_command="$finalize_command $arg"
 
1518
        prev=xcompiler
 
1519
        continue
 
1520
        ;;
 
1521
 
 
1522
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1523
        compiler_flags="$compiler_flags $arg"
 
1524
        compile_command="$compile_command $arg"
 
1525
        finalize_command="$finalize_command $arg"
 
1526
        continue
 
1527
        ;;
 
1528
 
1074
1529
      -module)
1075
1530
        module=yes
1076
1531
        continue
1077
1532
        ;;
1078
1533
 
 
1534
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
 
1535
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
 
1536
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
 
1537
      # +DA*, +DD* enable 64-bit mode on the HP compiler
 
1538
      # -q* pass through compiler args for the IBM compiler
 
1539
      # -m* pass through architecture-specific compiler args for GCC
 
1540
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
 
1541
 
 
1542
        # Unknown arguments in both finalize_command and compile_command need
 
1543
        # to be aesthetically quoted because they are evaled later.
 
1544
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1545
        case $arg in
 
1546
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1547
          arg="\"$arg\""
 
1548
          ;;
 
1549
        esac
 
1550
        compile_command="$compile_command $arg"
 
1551
        finalize_command="$finalize_command $arg"
 
1552
        if test "$with_gcc" = "yes" ; then
 
1553
          compiler_flags="$compiler_flags $arg"
 
1554
        fi
 
1555
        continue
 
1556
        ;;
 
1557
 
 
1558
      -shrext)
 
1559
        prev=shrext
 
1560
        continue
 
1561
        ;;
 
1562
 
1079
1563
      -no-fast-install)
1080
1564
        fast_install=no
1081
1565
        continue
1100
1584
        continue
1101
1585
        ;;
1102
1586
 
 
1587
      -objectlist)
 
1588
        prev=objectlist
 
1589
        continue
 
1590
        ;;
 
1591
 
1103
1592
      -o) prev=output ;;
1104
1593
 
 
1594
      -precious-files-regex)
 
1595
        prev=precious_regex
 
1596
        continue
 
1597
        ;;
 
1598
 
1105
1599
      -release)
1106
1600
        prev=release
1107
1601
        continue
1124
1618
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1125
1619
        *)
1126
1620
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1127
 
          exit 1
 
1621
          exit $EXIT_FAILURE
1128
1622
          ;;
1129
1623
        esac
1130
1624
        case "$xrpath " in
1152
1646
        prev=vinfo
1153
1647
        continue
1154
1648
        ;;
 
1649
      -version-number)
 
1650
        prev=vinfo
 
1651
        vinfo_number=yes
 
1652
        continue
 
1653
        ;;
1155
1654
 
1156
1655
      -Wc,*)
1157
1656
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1160
1659
        for flag in $args; do
1161
1660
          IFS="$save_ifs"
1162
1661
          case $flag in
1163
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1662
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1164
1663
            flag="\"$flag\""
1165
1664
            ;;
1166
1665
          esac
1178
1677
        for flag in $args; do
1179
1678
          IFS="$save_ifs"
1180
1679
          case $flag in
1181
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1680
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1182
1681
            flag="\"$flag\""
1183
1682
            ;;
1184
1683
          esac
1200
1699
        continue
1201
1700
        ;;
1202
1701
 
 
1702
      -XCClinker)
 
1703
        prev=xcclinker
 
1704
        continue
 
1705
        ;;
 
1706
 
1203
1707
      # Some other compiler flag.
1204
1708
      -* | +*)
1205
1709
        # Unknown arguments in both finalize_command and compile_command need
1206
1710
        # to be aesthetically quoted because they are evaled later.
1207
1711
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1208
1712
        case $arg in
1209
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1713
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1210
1714
          arg="\"$arg\""
1211
1715
          ;;
1212
1716
        esac
1213
1717
        ;;
1214
1718
 
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
 
1719
      *.$objext)
 
1720
        # A standard object.
 
1721
        objs="$objs $arg"
 
1722
        ;;
 
1723
 
 
1724
      *.lo)
 
1725
        # A libtool-controlled object.
 
1726
 
 
1727
        # Check to see that this really is a libtool object.
 
1728
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1729
          pic_object=
 
1730
          non_pic_object=
 
1731
 
 
1732
          # Read the .lo file
 
1733
          # If there is no directory component, then add one.
1234
1734
          case $arg in
1235
 
          *.lo) libobjs="$libobjs $arg" ;;
1236
 
          *) objs="$objs $arg" ;;
 
1735
          */* | *\\*) . $arg ;;
 
1736
          *) . ./$arg ;;
1237
1737
          esac
 
1738
 
 
1739
          if test -z "$pic_object" || \
 
1740
             test -z "$non_pic_object" ||
 
1741
             test "$pic_object" = none && \
 
1742
             test "$non_pic_object" = none; then
 
1743
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1744
            exit $EXIT_FAILURE
 
1745
          fi
 
1746
 
 
1747
          # Extract subdirectory from the argument.
 
1748
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1749
          if test "X$xdir" = "X$arg"; then
 
1750
            xdir=
 
1751
          else
 
1752
            xdir="$xdir/"
 
1753
          fi
 
1754
 
 
1755
          if test "$pic_object" != none; then
 
1756
            # Prepend the subdirectory the object is found in.
 
1757
            pic_object="$xdir$pic_object"
 
1758
 
 
1759
            if test "$prev" = dlfiles; then
 
1760
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1761
                dlfiles="$dlfiles $pic_object"
 
1762
                prev=
 
1763
                continue
 
1764
              else
 
1765
                # If libtool objects are unsupported, then we need to preload.
 
1766
                prev=dlprefiles
 
1767
              fi
 
1768
            fi
 
1769
 
 
1770
            # CHECK ME:  I think I busted this.  -Ossama
 
1771
            if test "$prev" = dlprefiles; then
 
1772
              # Preload the old-style object.
 
1773
              dlprefiles="$dlprefiles $pic_object"
 
1774
              prev=
 
1775
            fi
 
1776
 
 
1777
            # A PIC object.
 
1778
            libobjs="$libobjs $pic_object"
 
1779
            arg="$pic_object"
 
1780
          fi
 
1781
 
 
1782
          # Non-PIC object.
 
1783
          if test "$non_pic_object" != none; then
 
1784
            # Prepend the subdirectory the object is found in.
 
1785
            non_pic_object="$xdir$non_pic_object"
 
1786
 
 
1787
            # A standard non-PIC object
 
1788
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1789
            if test -z "$pic_object" || test "$pic_object" = none ; then
 
1790
              arg="$non_pic_object"
 
1791
            fi
 
1792
          fi
 
1793
        else
 
1794
          # Only an error if not doing a dry-run.
 
1795
          if test -z "$run"; then
 
1796
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1797
            exit $EXIT_FAILURE
 
1798
          else
 
1799
            # Dry-run case.
 
1800
 
 
1801
            # Extract subdirectory from the argument.
 
1802
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1803
            if test "X$xdir" = "X$arg"; then
 
1804
              xdir=
 
1805
            else
 
1806
              xdir="$xdir/"
 
1807
            fi
 
1808
 
 
1809
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1810
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1811
            libobjs="$libobjs $pic_object"
 
1812
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1813
          fi
1238
1814
        fi
1239
1815
        ;;
1240
1816
 
1268
1844
        # to be aesthetically quoted because they are evaled later.
1269
1845
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1270
1846
        case $arg in
1271
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1847
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1272
1848
          arg="\"$arg\""
1273
1849
          ;;
1274
1850
        esac
1285
1861
    if test -n "$prev"; then
1286
1862
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1287
1863
      $echo "$help" 1>&2
1288
 
      exit 1
 
1864
      exit $EXIT_FAILURE
1289
1865
    fi
1290
1866
 
1291
1867
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1294
1870
      finalize_command="$finalize_command $arg"
1295
1871
    fi
1296
1872
 
 
1873
    oldlibs=
1297
1874
    # calculate the name of the file, without its directory
1298
1875
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1299
1876
    libobjs_save="$libobjs"
1314
1891
      output_objdir="$output_objdir/$objdir"
1315
1892
    fi
1316
1893
    # Create the object directory.
1317
 
    if test ! -d $output_objdir; then
 
1894
    if test ! -d "$output_objdir"; then
1318
1895
      $show "$mkdir $output_objdir"
1319
1896
      $run $mkdir $output_objdir
1320
1897
      status=$?
1321
 
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1898
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1322
1899
        exit $status
1323
1900
      fi
1324
1901
    fi
1328
1905
    "")
1329
1906
      $echo "$modename: you must specify an output file" 1>&2
1330
1907
      $echo "$help" 1>&2
1331
 
      exit 1
 
1908
      exit $EXIT_FAILURE
1332
1909
      ;;
1333
1910
    *.$libext) linkmode=oldlib ;;
1334
1911
    *.lo | *.$objext) linkmode=obj ;;
1336
1913
    *) linkmode=prog ;; # Anything else should be a program.
1337
1914
    esac
1338
1915
 
 
1916
    case $host in
 
1917
    *cygwin* | *mingw* | *pw32*)
 
1918
      # don't eliminate duplications in $postdeps and $predeps
 
1919
      duplicate_compiler_generated_deps=yes
 
1920
      ;;
 
1921
    *)
 
1922
      duplicate_compiler_generated_deps=$duplicate_deps
 
1923
      ;;
 
1924
    esac
1339
1925
    specialdeplibs=
 
1926
 
1340
1927
    libs=
1341
1928
    # Find all interdependent deplibs by searching for libraries
1342
1929
    # that are linked more than once (e.g. -la -lb -la)
1343
1930
    for deplib in $deplibs; do
1344
 
      case "$libs " in
1345
 
      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1346
 
      esac
 
1931
      if test "X$duplicate_deps" = "Xyes" ; then
 
1932
        case "$libs " in
 
1933
        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1934
        esac
 
1935
      fi
1347
1936
      libs="$libs $deplib"
1348
1937
    done
 
1938
 
 
1939
    if test "$linkmode" = lib; then
 
1940
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
1941
 
 
1942
      # Compute libraries that are listed more than once in $predeps
 
1943
      # $postdeps and mark them as special (i.e., whose duplicates are
 
1944
      # not to be eliminated).
 
1945
      pre_post_deps=
 
1946
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
1947
        for pre_post_dep in $predeps $postdeps; do
 
1948
          case "$pre_post_deps " in
 
1949
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
1950
          esac
 
1951
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
1952
        done
 
1953
      fi
 
1954
      pre_post_deps=
 
1955
    fi
 
1956
 
1349
1957
    deplibs=
1350
1958
    newdependency_libs=
1351
1959
    newlib_search_path=
1360
1968
          *.la) ;;
1361
1969
          *)
1362
1970
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1363
 
            exit 1
 
1971
            exit $EXIT_FAILURE
1364
1972
            ;;
1365
1973
          esac
1366
1974
        done
1377
1985
        ;;
1378
1986
    esac
1379
1987
    for pass in $passes; do
1380
 
      if test $linkmode = prog; then
1381
 
        # Determine which files to process
 
1988
      if test "$linkmode,$pass" = "lib,link" ||
 
1989
         test "$linkmode,$pass" = "prog,scan"; then
 
1990
        libs="$deplibs"
 
1991
        deplibs=
 
1992
      fi
 
1993
      if test "$linkmode" = prog; then
1382
1994
        case $pass in
1383
 
        dlopen)
1384
 
          libs="$dlfiles"
1385
 
          save_deplibs="$deplibs" # Collect dlpreopened libraries
1386
 
          deplibs=
1387
 
          ;;
 
1995
        dlopen) libs="$dlfiles" ;;
1388
1996
        dlpreopen) libs="$dlprefiles" ;;
1389
1997
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1390
1998
        esac
1391
1999
      fi
 
2000
      if test "$pass" = dlopen; then
 
2001
        # Collect dlpreopened libraries
 
2002
        save_deplibs="$deplibs"
 
2003
        deplibs=
 
2004
      fi
1392
2005
      for deplib in $libs; do
1393
2006
        lib=
1394
2007
        found=no
1395
2008
        case $deplib in
 
2009
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
2010
          if test "$linkmode,$pass" = "prog,link"; then
 
2011
            compile_deplibs="$deplib $compile_deplibs"
 
2012
            finalize_deplibs="$deplib $finalize_deplibs"
 
2013
          else
 
2014
            compiler_flags="$compiler_flags $deplib"
 
2015
          fi
 
2016
          continue
 
2017
          ;;
1396
2018
        -l*)
1397
 
          if test $linkmode = oldlib && test $linkmode = obj; then
1398
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1399
 
            continue
1400
 
          fi
1401
 
          if test $pass = conv; then
1402
 
            deplibs="$deplib $deplibs"
 
2019
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
2020
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1403
2021
            continue
1404
2022
          fi
1405
2023
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1406
2024
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1407
 
            # Search the libtool library
1408
 
            lib="$searchdir/lib${name}.la"
1409
 
            if test -f "$lib"; then
1410
 
              found=yes
1411
 
              break
1412
 
            fi
 
2025
            for search_ext in .la $std_shrext .so .a; do
 
2026
              # Search the libtool library
 
2027
              lib="$searchdir/lib${name}${search_ext}"
 
2028
              if test -f "$lib"; then
 
2029
                if test "$search_ext" = ".la"; then
 
2030
                  found=yes
 
2031
                else
 
2032
                  found=no
 
2033
                fi
 
2034
                break 2
 
2035
              fi
 
2036
            done
1413
2037
          done
1414
2038
          if test "$found" != yes; then
1415
2039
            # deplib doesn't seem to be a libtool library
1418
2042
              finalize_deplibs="$deplib $finalize_deplibs"
1419
2043
            else
1420
2044
              deplibs="$deplib $deplibs"
1421
 
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
2045
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1422
2046
            fi
1423
2047
            continue
 
2048
          else # deplib is a libtool library
 
2049
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
2050
            # We need to do some special things here, and not later.
 
2051
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
2052
              case " $predeps $postdeps " in
 
2053
              *" $deplib "*)
 
2054
                if (${SED} -e '2q' $lib |
 
2055
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
2056
                  library_names=
 
2057
                  old_library=
 
2058
                  case $lib in
 
2059
                  */* | *\\*) . $lib ;;
 
2060
                  *) . ./$lib ;;
 
2061
                  esac
 
2062
                  for l in $old_library $library_names; do
 
2063
                    ll="$l"
 
2064
                  done
 
2065
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
2066
                    found=no
 
2067
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
2068
                    test "X$ladir" = "X$lib" && ladir="."
 
2069
                    lib=$ladir/$old_library
 
2070
                    if test "$linkmode,$pass" = "prog,link"; then
 
2071
                      compile_deplibs="$deplib $compile_deplibs"
 
2072
                      finalize_deplibs="$deplib $finalize_deplibs"
 
2073
                    else
 
2074
                      deplibs="$deplib $deplibs"
 
2075
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
2076
                    fi
 
2077
                    continue
 
2078
                  fi
 
2079
                fi
 
2080
                ;;
 
2081
              *) ;;
 
2082
              esac
 
2083
            fi
1424
2084
          fi
1425
2085
          ;; # -l
1426
2086
        -L*)
1427
2087
          case $linkmode in
1428
2088
          lib)
1429
2089
            deplibs="$deplib $deplibs"
1430
 
            test $pass = conv && continue
 
2090
            test "$pass" = conv && continue
1431
2091
            newdependency_libs="$deplib $newdependency_libs"
1432
2092
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1433
2093
            ;;
1434
2094
          prog)
1435
 
            if test $pass = conv; then
 
2095
            if test "$pass" = conv; then
1436
2096
              deplibs="$deplib $deplibs"
1437
2097
              continue
1438
2098
            fi
1439
 
            if test $pass = scan; then
 
2099
            if test "$pass" = scan; then
1440
2100
              deplibs="$deplib $deplibs"
1441
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1442
2101
            else
1443
2102
              compile_deplibs="$deplib $compile_deplibs"
1444
2103
              finalize_deplibs="$deplib $finalize_deplibs"
1445
2104
            fi
 
2105
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1446
2106
            ;;
1447
2107
          *)
1448
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
2108
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1449
2109
            ;;
1450
2110
          esac # linkmode
1451
2111
          continue
1452
2112
          ;; # -L
1453
2113
        -R*)
1454
 
          if test $pass = link; then
 
2114
          if test "$pass" = link; then
1455
2115
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1456
2116
            # Make sure the xrpath contains only unique directories.
1457
2117
            case "$xrpath " in
1464
2124
          ;;
1465
2125
        *.la) lib="$deplib" ;;
1466
2126
        *.$libext)
1467
 
          if test $pass = conv; then
 
2127
          if test "$pass" = conv; then
1468
2128
            deplibs="$deplib $deplibs"
1469
2129
            continue
1470
2130
          fi
1471
2131
          case $linkmode in
1472
2132
          lib)
1473
 
            if test "$deplibs_check_method" != pass_all; then
1474
 
              echo
1475
 
              echo "*** Warning: This library needs some functionality provided by $deplib."
1476
 
              echo "*** I have the capability to make that library automatically link in when"
1477
 
              echo "*** you link to this library.  But I can only do this if you have a"
1478
 
              echo "*** shared version of the library, which you do not appear to have."
 
2133
            valid_a_lib=no
 
2134
            case $deplibs_check_method in
 
2135
              match_pattern*)
 
2136
                set dummy $deplibs_check_method
 
2137
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2138
                if eval $echo \"$deplib\" 2>/dev/null \
 
2139
                    | $SED 10q \
 
2140
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2141
                  valid_a_lib=yes
 
2142
                fi
 
2143
                ;;
 
2144
              pass_all)
 
2145
                valid_a_lib=yes
 
2146
                ;;
 
2147
            esac
 
2148
            if test "$valid_a_lib" != yes; then
 
2149
              $echo
 
2150
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
2151
              $echo "*** I have the capability to make that library automatically link in when"
 
2152
              $echo "*** you link to this library.  But I can only do this if you have a"
 
2153
              $echo "*** shared version of the library, which you do not appear to have"
 
2154
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
2155
              $echo "*** that it is just a static archive that I should not used here."
1479
2156
            else
1480
 
              echo
1481
 
              echo "*** Warning: Linking the shared library $output against the"
1482
 
              echo "*** static library $deplib is not portable!"
 
2157
              $echo
 
2158
              $echo "*** Warning: Linking the shared library $output against the"
 
2159
              $echo "*** static library $deplib is not portable!"
1483
2160
              deplibs="$deplib $deplibs"
1484
2161
            fi
1485
2162
            continue
1486
2163
            ;;
1487
2164
          prog)
1488
 
            if test $pass != link; then
 
2165
            if test "$pass" != link; then
1489
2166
              deplibs="$deplib $deplibs"
1490
2167
            else
1491
2168
              compile_deplibs="$deplib $compile_deplibs"
1496
2173
          esac # linkmode
1497
2174
          ;; # *.$libext
1498
2175
        *.lo | *.$objext)
1499
 
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1500
 
            # If there is no dlopen support or we're linking statically,
1501
 
            # we need to preload.
1502
 
            newdlprefiles="$newdlprefiles $deplib"
1503
 
            compile_deplibs="$deplib $compile_deplibs"
1504
 
            finalize_deplibs="$deplib $finalize_deplibs"
1505
 
          else
1506
 
            newdlfiles="$newdlfiles $deplib"
 
2176
          if test "$pass" = conv; then
 
2177
            deplibs="$deplib $deplibs"
 
2178
          elif test "$linkmode" = prog; then
 
2179
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2180
              # If there is no dlopen support or we're linking statically,
 
2181
              # we need to preload.
 
2182
              newdlprefiles="$newdlprefiles $deplib"
 
2183
              compile_deplibs="$deplib $compile_deplibs"
 
2184
              finalize_deplibs="$deplib $finalize_deplibs"
 
2185
            else
 
2186
              newdlfiles="$newdlfiles $deplib"
 
2187
            fi
1507
2188
          fi
1508
2189
          continue
1509
2190
          ;;
1512
2193
          continue
1513
2194
          ;;
1514
2195
        esac # case $deplib
1515
 
        if test $found = yes || test -f "$lib"; then :
 
2196
        if test "$found" = yes || test -f "$lib"; then :
1516
2197
        else
1517
2198
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1518
 
          exit 1
 
2199
          exit $EXIT_FAILURE
1519
2200
        fi
1520
2201
 
1521
2202
        # Check to see that this really is a libtool archive.
1522
 
        if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2203
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1523
2204
        else
1524
2205
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1525
 
          exit 1
 
2206
          exit $EXIT_FAILURE
1526
2207
        fi
1527
2208
 
1528
2209
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1535
2216
        library_names=
1536
2217
        old_library=
1537
2218
        # If the library was installed with an old release of libtool,
1538
 
        # it will not redefine variable installed.
 
2219
        # it will not redefine variables installed, or shouldnotlink
1539
2220
        installed=yes
 
2221
        shouldnotlink=no
 
2222
        avoidtemprpath=
 
2223
 
1540
2224
 
1541
2225
        # Read the .la file
1542
2226
        case $lib in
1546
2230
 
1547
2231
        if test "$linkmode,$pass" = "lib,link" ||
1548
2232
           test "$linkmode,$pass" = "prog,scan" ||
1549
 
           { test $linkmode = oldlib && test $linkmode = obj; }; then
1550
 
           # Add dl[pre]opened files of deplib
 
2233
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1551
2234
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1552
2235
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1553
2236
        fi
1554
2237
 
1555
 
        if test $pass = conv; then
 
2238
        if test "$pass" = conv; then
1556
2239
          # Only check for convenience libraries
1557
2240
          deplibs="$lib $deplibs"
1558
2241
          if test -z "$libdir"; then
1559
2242
            if test -z "$old_library"; then
1560
2243
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1561
 
              exit 1
 
2244
              exit $EXIT_FAILURE
1562
2245
            fi
1563
2246
            # It is a libtool convenience library, so add in its objects.
1564
2247
            convenience="$convenience $ladir/$objdir/$old_library"
1566
2249
            tmp_libs=
1567
2250
            for deplib in $dependency_libs; do
1568
2251
              deplibs="$deplib $deplibs"
1569
 
              case "$tmp_libs " in
1570
 
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1571
 
              esac
 
2252
              if test "X$duplicate_deps" = "Xyes" ; then
 
2253
                case "$tmp_libs " in
 
2254
                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2255
                esac
 
2256
              fi
1572
2257
              tmp_libs="$tmp_libs $deplib"
1573
2258
            done
1574
 
          elif test $linkmode != prog && test $linkmode != lib; then
 
2259
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1575
2260
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1576
 
            exit 1
 
2261
            exit $EXIT_FAILURE
1577
2262
          fi
1578
2263
          continue
1579
2264
        fi # $pass = conv
1580
2265
 
 
2266
 
1581
2267
        # Get the name of the library we link against.
1582
2268
        linklib=
1583
2269
        for l in $old_library $library_names; do
1585
2271
        done
1586
2272
        if test -z "$linklib"; then
1587
2273
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1588
 
          exit 1
 
2274
          exit $EXIT_FAILURE
1589
2275
        fi
1590
2276
 
1591
2277
        # This library was specified with -dlopen.
1592
 
        if test $pass = dlopen; then
 
2278
        if test "$pass" = dlopen; then
1593
2279
          if test -z "$libdir"; then
1594
2280
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1595
 
            exit 1
 
2281
            exit $EXIT_FAILURE
1596
2282
          fi
1597
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2283
          if test -z "$dlname" ||
 
2284
             test "$dlopen_support" != yes ||
 
2285
             test "$build_libtool_libs" = no; then
1598
2286
            # If there is no dlname, no dlopen support or we're linking
1599
 
            # statically, we need to preload.
1600
 
            dlprefiles="$dlprefiles $lib"
 
2287
            # statically, we need to preload.  We also need to preload any
 
2288
            # dependent libraries so libltdl's deplib preloader doesn't
 
2289
            # bomb out in the load deplibs phase.
 
2290
            dlprefiles="$dlprefiles $lib $dependency_libs"
1601
2291
          else
1602
2292
            newdlfiles="$newdlfiles $lib"
1603
2293
          fi
1629
2319
            dir="$libdir"
1630
2320
            absdir="$libdir"
1631
2321
          fi
 
2322
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
1632
2323
        else
1633
 
          dir="$ladir/$objdir"
1634
 
          absdir="$abs_ladir/$objdir"
1635
 
          # Remove this search path later
1636
 
          notinst_path="$notinst_path $abs_ladir"
 
2324
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2325
            dir="$ladir"
 
2326
            absdir="$abs_ladir"
 
2327
            # Remove this search path later
 
2328
            notinst_path="$notinst_path $abs_ladir"
 
2329
          else
 
2330
            dir="$ladir/$objdir"
 
2331
            absdir="$abs_ladir/$objdir"
 
2332
            # Remove this search path later
 
2333
            notinst_path="$notinst_path $abs_ladir"
 
2334
          fi
1637
2335
        fi # $installed = yes
1638
2336
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1639
2337
 
1640
2338
        # This library was specified with -dlpreopen.
1641
 
        if test $pass = dlpreopen; then
 
2339
        if test "$pass" = dlpreopen; then
1642
2340
          if test -z "$libdir"; then
1643
2341
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1644
 
            exit 1
 
2342
            exit $EXIT_FAILURE
1645
2343
          fi
1646
2344
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1647
2345
          # are required to link).
1657
2355
 
1658
2356
        if test -z "$libdir"; then
1659
2357
          # Link the convenience library
1660
 
          if test $linkmode = lib; then
 
2358
          if test "$linkmode" = lib; then
1661
2359
            deplibs="$dir/$old_library $deplibs"
1662
2360
          elif test "$linkmode,$pass" = "prog,link"; then
1663
2361
            compile_deplibs="$dir/$old_library $compile_deplibs"
1664
2362
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1665
2363
          else
1666
 
            deplibs="$lib $deplibs"
 
2364
            deplibs="$lib $deplibs" # used for prog,scan pass
1667
2365
          fi
1668
2366
          continue
1669
2367
        fi
1670
2368
 
1671
 
        if test $linkmode = prog && test $pass != link; then
 
2369
 
 
2370
        if test "$linkmode" = prog && test "$pass" != link; then
1672
2371
          newlib_search_path="$newlib_search_path $ladir"
1673
2372
          deplibs="$lib $deplibs"
1674
2373
 
1684
2383
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1685
2384
            esac
1686
2385
            # Need to link against all dependency_libs?
1687
 
            if test $linkalldeplibs = yes; then
 
2386
            if test "$linkalldeplibs" = yes; then
1688
2387
              deplibs="$deplib $deplibs"
1689
2388
            else
1690
2389
              # Need to hardcode shared library paths
1691
2390
              # or/and link against static libraries
1692
2391
              newdependency_libs="$deplib $newdependency_libs"
1693
2392
            fi
1694
 
            case "$tmp_libs " in
1695
 
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1696
 
            esac
 
2393
            if test "X$duplicate_deps" = "Xyes" ; then
 
2394
              case "$tmp_libs " in
 
2395
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2396
              esac
 
2397
            fi
1697
2398
            tmp_libs="$tmp_libs $deplib"
1698
2399
          done # for deplib
1699
2400
          continue
1700
2401
        fi # $linkmode = prog...
1701
2402
 
 
2403
        if test "$linkmode,$pass" = "prog,link"; then
 
2404
          if test -n "$library_names" &&
 
2405
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2406
            # We need to hardcode the library path
 
2407
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 
2408
              # Make sure the rpath contains only unique directories.
 
2409
              case "$temp_rpath " in
 
2410
              *" $dir "*) ;;
 
2411
              *" $absdir "*) ;;
 
2412
              *) temp_rpath="$temp_rpath $dir" ;;
 
2413
              esac
 
2414
            fi
 
2415
 
 
2416
            # Hardcode the library path.
 
2417
            # Skip directories that are in the system default run-time
 
2418
            # search path.
 
2419
            case " $sys_lib_dlsearch_path " in
 
2420
            *" $absdir "*) ;;
 
2421
            *)
 
2422
              case "$compile_rpath " in
 
2423
              *" $absdir "*) ;;
 
2424
              *) compile_rpath="$compile_rpath $absdir"
 
2425
              esac
 
2426
              ;;
 
2427
            esac
 
2428
            case " $sys_lib_dlsearch_path " in
 
2429
            *" $libdir "*) ;;
 
2430
            *)
 
2431
              case "$finalize_rpath " in
 
2432
              *" $libdir "*) ;;
 
2433
              *) finalize_rpath="$finalize_rpath $libdir"
 
2434
              esac
 
2435
              ;;
 
2436
            esac
 
2437
          fi # $linkmode,$pass = prog,link...
 
2438
 
 
2439
          if test "$alldeplibs" = yes &&
 
2440
             { test "$deplibs_check_method" = pass_all ||
 
2441
               { test "$build_libtool_libs" = yes &&
 
2442
                 test -n "$library_names"; }; }; then
 
2443
            # We only need to search for static libraries
 
2444
            continue
 
2445
          fi
 
2446
        fi
 
2447
 
1702
2448
        link_static=no # Whether the deplib will be linked statically
1703
2449
        if test -n "$library_names" &&
1704
2450
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1705
 
          # Link against this shared library
1706
 
 
1707
 
          if test "$linkmode,$pass" = "prog,link" ||
1708
 
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1709
 
            # Hardcode the library path.
1710
 
            # Skip directories that are in the system default run-time
1711
 
            # search path.
1712
 
            case " $sys_lib_dlsearch_path " in
1713
 
            *" $absdir "*) ;;
1714
 
            *)
1715
 
              case "$compile_rpath " in
1716
 
              *" $absdir "*) ;;
1717
 
              *) compile_rpath="$compile_rpath $absdir"
1718
 
              esac
1719
 
              ;;
1720
 
            esac
1721
 
            case " $sys_lib_dlsearch_path " in
1722
 
            *" $libdir "*) ;;
1723
 
            *)
1724
 
              case "$finalize_rpath " in
1725
 
              *" $libdir "*) ;;
1726
 
              *) finalize_rpath="$finalize_rpath $libdir"
1727
 
              esac
1728
 
              ;;
1729
 
            esac
1730
 
            if test $linkmode = prog; then
1731
 
              # We need to hardcode the library path
1732
 
              if test -n "$shlibpath_var"; then
1733
 
                # Make sure the rpath contains only unique directories.
1734
 
                case "$temp_rpath " in
1735
 
                *" $dir "*) ;;
1736
 
                *" $absdir "*) ;;
1737
 
                *) temp_rpath="$temp_rpath $dir" ;;
1738
 
                esac
1739
 
              fi
1740
 
            fi
1741
 
          fi # $linkmode,$pass = prog,link...
1742
 
 
1743
 
          if test "$alldeplibs" = yes &&
1744
 
             { test "$deplibs_check_method" = pass_all ||
1745
 
               { test "$build_libtool_libs" = yes &&
1746
 
                 test -n "$library_names"; }; }; then
1747
 
            # We only need to search for static libraries
1748
 
            continue
1749
 
          fi
1750
 
 
1751
2451
          if test "$installed" = no; then
1752
2452
            notinst_deplibs="$notinst_deplibs $lib"
1753
2453
            need_relink=yes
1754
2454
          fi
 
2455
          # This is a shared library
 
2456
 
 
2457
          # Warn about portability, can't link against -module's on
 
2458
          # some systems (darwin)
 
2459
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2460
            $echo
 
2461
            if test "$linkmode" = prog; then
 
2462
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
2463
            else
 
2464
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
2465
            fi
 
2466
            $echo "*** $linklib is not portable!"
 
2467
          fi
 
2468
          if test "$linkmode" = lib &&
 
2469
             test "$hardcode_into_libs" = yes; then
 
2470
            # Hardcode the library path.
 
2471
            # Skip directories that are in the system default run-time
 
2472
            # search path.
 
2473
            case " $sys_lib_dlsearch_path " in
 
2474
            *" $absdir "*) ;;
 
2475
            *)
 
2476
              case "$compile_rpath " in
 
2477
              *" $absdir "*) ;;
 
2478
              *) compile_rpath="$compile_rpath $absdir"
 
2479
              esac
 
2480
              ;;
 
2481
            esac
 
2482
            case " $sys_lib_dlsearch_path " in
 
2483
            *" $libdir "*) ;;
 
2484
            *)
 
2485
              case "$finalize_rpath " in
 
2486
              *" $libdir "*) ;;
 
2487
              *) finalize_rpath="$finalize_rpath $libdir"
 
2488
              esac
 
2489
              ;;
 
2490
            esac
 
2491
          fi
1755
2492
 
1756
2493
          if test -n "$old_archive_from_expsyms_cmds"; then
1757
2494
            # figure out the soname
1765
2502
            elif test -n "$soname_spec"; then
1766
2503
              # bleh windows
1767
2504
              case $host in
1768
 
              *cygwin*)
 
2505
              *cygwin* | mingw*)
1769
2506
                major=`expr $current - $age`
1770
2507
                versuffix="-$major"
1771
2508
                ;;
1777
2514
 
1778
2515
            # Make a new name for the extract_expsyms_cmds to use
1779
2516
            soroot="$soname"
1780
 
            soname=`echo $soroot | sed -e 's/^.*\///'`
1781
 
            newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
 
2517
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2518
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1782
2519
 
1783
2520
            # If the library has no export list, then create one now
1784
2521
            if test -f "$output_objdir/$soname-def"; then :
1785
2522
            else
1786
2523
              $show "extracting exported symbol list from \`$soname'"
1787
2524
              save_ifs="$IFS"; IFS='~'
1788
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2525
              cmds=$extract_expsyms_cmds
1789
2526
              for cmd in $cmds; do
1790
2527
                IFS="$save_ifs"
 
2528
                eval cmd=\"$cmd\"
1791
2529
                $show "$cmd"
1792
2530
                $run eval "$cmd" || exit $?
1793
2531
              done
1798
2536
            if test -f "$output_objdir/$newlib"; then :; else
1799
2537
              $show "generating import library for \`$soname'"
1800
2538
              save_ifs="$IFS"; IFS='~'
1801
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2539
              cmds=$old_archive_from_expsyms_cmds
1802
2540
              for cmd in $cmds; do
1803
2541
                IFS="$save_ifs"
 
2542
                eval cmd=\"$cmd\"
1804
2543
                $show "$cmd"
1805
2544
                $run eval "$cmd" || exit $?
1806
2545
              done
1809
2548
            # make sure the library variables are pointing to the new library
1810
2549
            dir=$output_objdir
1811
2550
            linklib=$newlib
1812
 
          fi # test -n $old_archive_from_expsyms_cmds
 
2551
          fi # test -n "$old_archive_from_expsyms_cmds"
1813
2552
 
1814
 
          if test $linkmode = prog || test "$mode" != relink; then
 
2553
          if test "$linkmode" = prog || test "$mode" != relink; then
1815
2554
            add_shlibpath=
1816
2555
            add_dir=
1817
2556
            add=
1820
2559
            immediate | unsupported)
1821
2560
              if test "$hardcode_direct" = no; then
1822
2561
                add="$dir/$linklib"
 
2562
                case $host in
 
2563
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2564
                  *-*-darwin* )
 
2565
                    # if the lib is a module then we can not link against
 
2566
                    # it, someone is ignoring the new warnings I added
 
2567
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2568
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2569
                      if test -z "$old_library" ; then
 
2570
                        $echo
 
2571
                        $echo "** And there doesn't seem to be a static archive available"
 
2572
                        $echo "** The link will probably fail, sorry"
 
2573
                      else
 
2574
                        add="$dir/$old_library"
 
2575
                      fi
 
2576
                    fi
 
2577
                esac
1823
2578
              elif test "$hardcode_minus_L" = no; then
1824
2579
                case $host in
1825
2580
                *-*-sunos*) add_shlibpath="$dir" ;;
1838
2593
                add="$dir/$linklib"
1839
2594
              elif test "$hardcode_minus_L" = yes; then
1840
2595
                add_dir="-L$dir"
 
2596
                # Try looking first in the location we're being installed to.
 
2597
                if test -n "$inst_prefix_dir"; then
 
2598
                  case "$libdir" in
 
2599
                    [\\/]*)
 
2600
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2601
                      ;;
 
2602
                  esac
 
2603
                fi
1841
2604
                add="-l$name"
1842
2605
              elif test "$hardcode_shlibpath_var" = yes; then
1843
2606
                add_shlibpath="$dir"
1851
2614
 
1852
2615
            if test "$lib_linked" != yes; then
1853
2616
              $echo "$modename: configuration error: unsupported hardcode properties"
1854
 
              exit 1
 
2617
              exit $EXIT_FAILURE
1855
2618
            fi
1856
2619
 
1857
2620
            if test -n "$add_shlibpath"; then
1860
2623
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1861
2624
              esac
1862
2625
            fi
1863
 
            if test $linkmode = prog; then
 
2626
            if test "$linkmode" = prog; then
1864
2627
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1865
2628
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1866
2629
            else
1877
2640
            fi
1878
2641
          fi
1879
2642
 
1880
 
          if test $linkmode = prog || test "$mode" = relink; then
 
2643
          if test "$linkmode" = prog || test "$mode" = relink; then
1881
2644
            add_shlibpath=
1882
2645
            add_dir=
1883
2646
            add=
1885
2648
            if test "$hardcode_direct" = yes; then
1886
2649
              add="$libdir/$linklib"
1887
2650
            elif test "$hardcode_minus_L" = yes; then
1888
 
              # Try looking first in the location we're being installed to.
1889
 
              add_dir=
1890
 
              if test -n "$inst_prefix_dir"; then
1891
 
                case "$libdir" in
1892
 
                [\\/]*)
1893
 
                  add_dir="-L$inst_prefix_dir$libdir"
1894
 
                  ;;
1895
 
                esac
1896
 
              fi
1897
 
              add_dir="$add_dir -L$libdir"
 
2651
              add_dir="-L$libdir"
1898
2652
              add="-l$name"
1899
2653
            elif test "$hardcode_shlibpath_var" = yes; then
1900
2654
              case :$finalize_shlibpath: in
1902
2656
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1903
2657
              esac
1904
2658
              add="-l$name"
 
2659
            elif test "$hardcode_automatic" = yes; then
 
2660
              if test -n "$inst_prefix_dir" &&
 
2661
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2662
                add="$inst_prefix_dir$libdir/$linklib"
 
2663
              else
 
2664
                add="$libdir/$linklib"
 
2665
              fi
1905
2666
            else
1906
2667
              # We cannot seem to hardcode it, guess we'll fake it.
1907
 
              # Try looking first in the location we're being installed to.
1908
 
              add_dir=
1909
 
              if test -n "$inst_prefix_dir"; then
1910
 
                case "$libdir" in
1911
 
                [\\/]*)
1912
 
                  add_dir="-L$inst_prefix_dir$libdir"
1913
 
                  ;;
1914
 
                esac
1915
 
              fi
1916
 
              add_dir="$add_dir -L$libdir"
1917
 
 
 
2668
              add_dir="-L$libdir"
 
2669
              # Try looking first in the location we're being installed to.
 
2670
              if test -n "$inst_prefix_dir"; then
 
2671
                case "$libdir" in
 
2672
                  [\\/]*)
 
2673
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2674
                    ;;
 
2675
                esac
 
2676
              fi
1918
2677
              add="-l$name"
1919
2678
            fi
1920
2679
 
1921
 
            if test $linkmode = prog; then
 
2680
            if test "$linkmode" = prog; then
1922
2681
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1923
2682
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1924
2683
            else
1926
2685
              test -n "$add" && deplibs="$add $deplibs"
1927
2686
            fi
1928
2687
          fi
1929
 
        elif test $linkmode = prog; then
1930
 
          if test "$alldeplibs" = yes &&
1931
 
             { test "$deplibs_check_method" = pass_all ||
1932
 
               { test "$build_libtool_libs" = yes &&
1933
 
                 test -n "$library_names"; }; }; then
1934
 
            # We only need to search for static libraries
1935
 
            continue
1936
 
          fi
1937
 
 
1938
 
          # Try to link the static library
 
2688
        elif test "$linkmode" = prog; then
1939
2689
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1940
2690
          # is not unsupported.  This is valid on all known static and
1941
2691
          # shared platforms.
1955
2705
 
1956
2706
            # Just print a warning and add the library to dependency_libs so
1957
2707
            # that the program can be linked against the static library.
1958
 
            echo
1959
 
            echo "*** Warning: This library needs some functionality provided by $lib."
1960
 
            echo "*** I have the capability to make that library automatically link in when"
1961
 
            echo "*** you link to this library.  But I can only do this if you have a"
1962
 
            echo "*** shared version of the library, which you do not appear to have."
 
2708
            $echo
 
2709
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2710
            $echo "*** I have the capability to make that library automatically link in when"
 
2711
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2712
            $echo "*** shared version of the library, which you do not appear to have."
1963
2713
            if test "$module" = yes; then
1964
 
              echo "*** Therefore, libtool will create a static module, that should work "
1965
 
              echo "*** as long as the dlopening application is linked with the -dlopen flag."
 
2714
              $echo "*** But as you try to build a module library, libtool will still create "
 
2715
              $echo "*** a static module, that should work as long as the dlopening application"
 
2716
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1966
2717
              if test -z "$global_symbol_pipe"; then
1967
 
                echo
1968
 
                echo "*** However, this would only work if libtool was able to extract symbol"
1969
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1970
 
                echo "*** not find such a program.  So, this module is probably useless."
1971
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2718
                $echo
 
2719
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2720
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2721
                $echo "*** not find such a program.  So, this module is probably useless."
 
2722
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
1972
2723
              fi
1973
2724
              if test "$build_old_libs" = no; then
1974
2725
                build_libtool_libs=module
1985
2736
          fi
1986
2737
        fi # link shared/static library?
1987
2738
 
1988
 
        if test $linkmode = lib; then
 
2739
        if test "$linkmode" = lib; then
1989
2740
          if test -n "$dependency_libs" &&
1990
 
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1991
 
               test $link_static = yes; }; then
 
2741
             { test "$hardcode_into_libs" != yes ||
 
2742
               test "$build_old_libs" = yes ||
 
2743
               test "$link_static" = yes; }; then
1992
2744
            # Extract -R from dependency_libs
1993
2745
            temp_deplibs=
1994
2746
            for libdir in $dependency_libs; do
2011
2763
          tmp_libs=
2012
2764
          for deplib in $dependency_libs; do
2013
2765
            newdependency_libs="$deplib $newdependency_libs"
2014
 
            case "$tmp_libs " in
2015
 
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2016
 
            esac
 
2766
            if test "X$duplicate_deps" = "Xyes" ; then
 
2767
              case "$tmp_libs " in
 
2768
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
2769
              esac
 
2770
            fi
2017
2771
            tmp_libs="$tmp_libs $deplib"
2018
2772
          done
2019
2773
 
2020
 
          if test $link_all_deplibs != no; then
 
2774
          if test "$link_all_deplibs" != no; then
2021
2775
            # Add the search paths of all dependency libraries
2022
2776
            for deplib in $dependency_libs; do
2023
2777
              case $deplib in
2037
2791
                  ;;
2038
2792
                esac
2039
2793
                if grep "^installed=no" $deplib > /dev/null; then
2040
 
                  path="-L$absdir/$objdir"
 
2794
                  path="$absdir/$objdir"
2041
2795
                else
2042
 
                  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
2796
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2043
2797
                  if test -z "$libdir"; then
2044
2798
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2045
 
                    exit 1
 
2799
                    exit $EXIT_FAILURE
2046
2800
                  fi
2047
2801
                  if test "$absdir" != "$libdir"; then
2048
2802
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2049
2803
                  fi
2050
 
                  path="-L$absdir"
 
2804
                  path="$absdir"
2051
2805
                fi
 
2806
                depdepl=
 
2807
                case $host in
 
2808
                *-*-darwin*)
 
2809
                  # we do not want to link against static libs,
 
2810
                  # but need to link against shared
 
2811
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2812
                  if test -n "$deplibrary_names" ; then
 
2813
                    for tmp in $deplibrary_names ; do
 
2814
                      depdepl=$tmp
 
2815
                    done
 
2816
                    if test -f "$path/$depdepl" ; then
 
2817
                      depdepl="$path/$depdepl"
 
2818
                    fi
 
2819
                    # do not add paths which are already there
 
2820
                    case " $newlib_search_path " in
 
2821
                    *" $path "*) ;;
 
2822
                    *) newlib_search_path="$newlib_search_path $path";;
 
2823
                    esac
 
2824
                  fi
 
2825
                  path=""
 
2826
                  ;;
 
2827
                *)
 
2828
                  path="-L$path"
 
2829
                  ;;
 
2830
                esac
 
2831
                ;;
 
2832
              -l*)
 
2833
                case $host in
 
2834
                *-*-darwin*)
 
2835
                  # Again, we only want to link against shared libraries
 
2836
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2837
                  for tmp in $newlib_search_path ; do
 
2838
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2839
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2840
                      break
 
2841
                    fi
 
2842
                  done
 
2843
                  path=""
 
2844
                  ;;
 
2845
                *) continue ;;
 
2846
                esac
2052
2847
                ;;
2053
2848
              *) continue ;;
2054
2849
              esac
2055
2850
              case " $deplibs " in
2056
2851
              *" $path "*) ;;
2057
 
              *) deplibs="$deplibs $path" ;;
 
2852
              *) deplibs="$path $deplibs" ;;
 
2853
              esac
 
2854
              case " $deplibs " in
 
2855
              *" $depdepl "*) ;;
 
2856
              *) deplibs="$depdepl $deplibs" ;;
2058
2857
              esac
2059
2858
            done
2060
2859
          fi # link_all_deplibs != no
2061
2860
        fi # linkmode = lib
2062
2861
      done # for deplib in $libs
2063
 
      if test $pass = dlpreopen; then
 
2862
      dependency_libs="$newdependency_libs"
 
2863
      if test "$pass" = dlpreopen; then
2064
2864
        # Link the dlpreopened libraries before other libraries
2065
2865
        for deplib in $save_deplibs; do
2066
2866
          deplibs="$deplib $deplibs"
2067
2867
        done
2068
2868
      fi
2069
 
      if test $pass != dlopen; then
2070
 
        test $pass != scan && dependency_libs="$newdependency_libs"
2071
 
        if test $pass != conv; then
 
2869
      if test "$pass" != dlopen; then
 
2870
        if test "$pass" != conv; then
2072
2871
          # Make sure lib_search_path contains only unique directories.
2073
2872
          lib_search_path=
2074
2873
          for dir in $newlib_search_path; do
2090
2889
          eval tmp_libs=\"\$$var\"
2091
2890
          new_libs=
2092
2891
          for deplib in $tmp_libs; do
 
2892
            # FIXME: Pedantically, this is the right thing to do, so
 
2893
            #        that some nasty dependency loop isn't accidentally
 
2894
            #        broken:
 
2895
            #new_libs="$deplib $new_libs"
 
2896
            # Pragmatically, this seems to cause very few problems in
 
2897
            # practice:
2093
2898
            case $deplib in
2094
2899
            -L*) new_libs="$deplib $new_libs" ;;
 
2900
            -R*) ;;
2095
2901
            *)
 
2902
              # And here is the reason: when a library appears more
 
2903
              # than once as an explicit dependence of a library, or
 
2904
              # is implicitly linked in more than once by the
 
2905
              # compiler, it is considered special, and multiple
 
2906
              # occurrences thereof are not removed.  Compare this
 
2907
              # with having the same library being listed as a
 
2908
              # dependency of multiple other libraries: in this case,
 
2909
              # we know (pedantically, we assume) the library does not
 
2910
              # need to be listed more than once, so we keep only the
 
2911
              # last copy.  This is not always right, but it is rare
 
2912
              # enough that we require users that really mean to play
 
2913
              # such unportable linking tricks to link the library
 
2914
              # using -Wl,-lname, so that libtool does not consider it
 
2915
              # for duplicate removal.
2096
2916
              case " $specialdeplibs " in
2097
2917
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2098
2918
              *)
2120
2940
          eval $var=\"$tmp_libs\"
2121
2941
        done # for var
2122
2942
      fi
2123
 
      if test "$pass" = "conv" &&
2124
 
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2125
 
        libs="$deplibs" # reset libs
2126
 
        deplibs=
2127
 
      fi
 
2943
      # Last step: remove runtime libs from dependency_libs
 
2944
      # (they stay in deplibs)
 
2945
      tmp_libs=
 
2946
      for i in $dependency_libs ; do
 
2947
        case " $predeps $postdeps $compiler_lib_search_path " in
 
2948
        *" $i "*)
 
2949
          i=""
 
2950
          ;;
 
2951
        esac
 
2952
        if test -n "$i" ; then
 
2953
          tmp_libs="$tmp_libs $i"
 
2954
        fi
 
2955
      done
 
2956
      dependency_libs=$tmp_libs
2128
2957
    done # for pass
2129
 
    if test $linkmode = prog; then
 
2958
    if test "$linkmode" = prog; then
2130
2959
      dlfiles="$newdlfiles"
2131
2960
      dlprefiles="$newdlprefiles"
2132
2961
    fi
2133
2962
 
2134
2963
    case $linkmode in
2135
2964
    oldlib)
 
2965
      if test -n "$deplibs"; then
 
2966
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
 
2967
      fi
 
2968
 
2136
2969
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2137
2970
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2138
2971
      fi
2146
2979
      fi
2147
2980
 
2148
2981
      if test -n "$vinfo"; then
2149
 
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
2982
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2150
2983
      fi
2151
2984
 
2152
2985
      if test -n "$release"; then
2168
3001
      case $outputname in
2169
3002
      lib*)
2170
3003
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
3004
        eval shared_ext=\"$shrext_cmds\"
2171
3005
        eval libname=\"$libname_spec\"
2172
3006
        ;;
2173
3007
      *)
2174
3008
        if test "$module" = no; then
2175
3009
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2176
3010
          $echo "$help" 1>&2
2177
 
          exit 1
 
3011
          exit $EXIT_FAILURE
2178
3012
        fi
2179
3013
        if test "$need_lib_prefix" != no; then
2180
3014
          # Add the "lib" prefix for modules if required
2181
3015
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
3016
          eval shared_ext=\"$shrext_cmds\"
2182
3017
          eval libname=\"$libname_spec\"
2183
3018
        else
2184
3019
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2189
3024
      if test -n "$objs"; then
2190
3025
        if test "$deplibs_check_method" != pass_all; then
2191
3026
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2192
 
          exit 1
 
3027
          exit $EXIT_FAILURE
2193
3028
        else
2194
 
          echo
2195
 
          echo "*** Warning: Linking the shared library $output against the non-libtool"
2196
 
          echo "*** objects $objs is not portable!"
 
3029
          $echo
 
3030
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
3031
          $echo "*** objects $objs is not portable!"
2197
3032
          libobjs="$libobjs $objs"
2198
3033
        fi
2199
3034
      fi
2203
3038
      fi
2204
3039
 
2205
3040
      set dummy $rpath
2206
 
      if test $# -gt 2; then
 
3041
      if test "$#" -gt 2; then
2207
3042
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2208
3043
      fi
2209
3044
      install_libdir="$2"
2212
3047
      if test -z "$rpath"; then
2213
3048
        if test "$build_libtool_libs" = yes; then
2214
3049
          # Building a libtool convenience library.
2215
 
          libext=al
 
3050
          # Some compilers have problems with a `.al' extension so
 
3051
          # convenience libraries should have the same extension an
 
3052
          # archive normally would.
2216
3053
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2217
3054
          build_libtool_libs=convenience
2218
3055
          build_old_libs=yes
2219
3056
        fi
2220
3057
 
2221
3058
        if test -n "$vinfo"; then
2222
 
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
3059
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2223
3060
        fi
2224
3061
 
2225
3062
        if test -n "$release"; then
2235
3072
        if test -n "$8"; then
2236
3073
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2237
3074
          $echo "$help" 1>&2
2238
 
          exit 1
 
3075
          exit $EXIT_FAILURE
2239
3076
        fi
2240
3077
 
2241
 
        current="$2"
2242
 
        revision="$3"
2243
 
        age="$4"
 
3078
        # convert absolute version numbers to libtool ages
 
3079
        # this retains compatibility with .la files and attempts
 
3080
        # to make the code below a bit more comprehensible
 
3081
 
 
3082
        case $vinfo_number in
 
3083
        yes)
 
3084
          number_major="$2"
 
3085
          number_minor="$3"
 
3086
          number_revision="$4"
 
3087
          #
 
3088
          # There are really only two kinds -- those that
 
3089
          # use the current revision as the major version
 
3090
          # and those that subtract age and use age as
 
3091
          # a minor version.  But, then there is irix
 
3092
          # which has an extra 1 added just for fun
 
3093
          #
 
3094
          case $version_type in
 
3095
          darwin|linux|osf|windows)
 
3096
            current=`expr $number_major + $number_minor`
 
3097
            age="$number_minor"
 
3098
            revision="$number_revision"
 
3099
            ;;
 
3100
          freebsd-aout|freebsd-elf|sunos)
 
3101
            current="$number_major"
 
3102
            revision="$number_minor"
 
3103
            age="0"
 
3104
            ;;
 
3105
          irix|nonstopux)
 
3106
            current=`expr $number_major + $number_minor - 1`
 
3107
            age="$number_minor"
 
3108
            revision="$number_minor"
 
3109
            ;;
 
3110
          esac
 
3111
          ;;
 
3112
        no)
 
3113
          current="$2"
 
3114
          revision="$3"
 
3115
          age="$4"
 
3116
          ;;
 
3117
        esac
2244
3118
 
2245
3119
        # Check that each of the things are valid numbers.
2246
3120
        case $current in
2247
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3121
        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]) ;;
2248
3122
        *)
2249
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3123
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2250
3124
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2251
 
          exit 1
 
3125
          exit $EXIT_FAILURE
2252
3126
          ;;
2253
3127
        esac
2254
3128
 
2255
3129
        case $revision in
2256
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3130
        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]) ;;
2257
3131
        *)
2258
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3132
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2259
3133
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2260
 
          exit 1
 
3134
          exit $EXIT_FAILURE
2261
3135
          ;;
2262
3136
        esac
2263
3137
 
2264
3138
        case $age in
2265
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3139
        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]) ;;
2266
3140
        *)
2267
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3141
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2268
3142
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2269
 
          exit 1
 
3143
          exit $EXIT_FAILURE
2270
3144
          ;;
2271
3145
        esac
2272
3146
 
2273
 
        if test $age -gt $current; then
 
3147
        if test "$age" -gt "$current"; then
2274
3148
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2275
3149
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2276
 
          exit 1
 
3150
          exit $EXIT_FAILURE
2277
3151
        fi
2278
3152
 
2279
3153
        # Calculate the version variables.
2290
3164
          versuffix="$major.$age.$revision"
2291
3165
          # Darwin ld doesn't like 0 for these options...
2292
3166
          minor_current=`expr $current + 1`
2293
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3167
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2294
3168
          ;;
2295
3169
 
2296
3170
        freebsd-aout)
2303
3177
          versuffix=".$current";
2304
3178
          ;;
2305
3179
 
2306
 
        irix)
 
3180
        irix | nonstopux)
2307
3181
          major=`expr $current - $age + 1`
2308
 
          verstring="sgi$major.$revision"
 
3182
 
 
3183
          case $version_type in
 
3184
            nonstopux) verstring_prefix=nonstopux ;;
 
3185
            *)         verstring_prefix=sgi ;;
 
3186
          esac
 
3187
          verstring="$verstring_prefix$major.$revision"
2309
3188
 
2310
3189
          # Add in all the interfaces that we are compatible with.
2311
3190
          loop=$revision
2312
 
          while test $loop != 0; do
 
3191
          while test "$loop" -ne 0; do
2313
3192
            iface=`expr $revision - $loop`
2314
3193
            loop=`expr $loop - 1`
2315
 
            verstring="sgi$major.$iface:$verstring"
 
3194
            verstring="$verstring_prefix$major.$iface:$verstring"
2316
3195
          done
2317
3196
 
2318
3197
          # Before this point, $major must not contain `.'.
2326
3205
          ;;
2327
3206
 
2328
3207
        osf)
2329
 
          major=`expr $current - $age`
 
3208
          major=.`expr $current - $age`
2330
3209
          versuffix=".$current.$age.$revision"
2331
3210
          verstring="$current.$age.$revision"
2332
3211
 
2333
3212
          # Add in all the interfaces that we are compatible with.
2334
3213
          loop=$age
2335
 
          while test $loop != 0; do
 
3214
          while test "$loop" -ne 0; do
2336
3215
            iface=`expr $current - $loop`
2337
3216
            loop=`expr $loop - 1`
2338
3217
            verstring="$verstring:${iface}.0"
2356
3235
 
2357
3236
        *)
2358
3237
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2359
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2360
 
          exit 1
 
3238
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3239
          exit $EXIT_FAILURE
2361
3240
          ;;
2362
3241
        esac
2363
3242
 
2364
3243
        # Clear the version info if we defaulted, and they specified a release.
2365
3244
        if test -z "$vinfo" && test -n "$release"; then
2366
3245
          major=
2367
 
          verstring="0.0"
2368
3246
          case $version_type in
2369
3247
          darwin)
2370
3248
            # we can't check for "0.0" in archive_cmds due to quoting
2371
3249
            # problems, so we reset it completely
2372
 
            verstring=""
 
3250
            verstring=
2373
3251
            ;;
2374
3252
          *)
2375
3253
            verstring="0.0"
2403
3281
      fi
2404
3282
 
2405
3283
      if test "$mode" != relink; then
2406
 
        # Remove our outputs.
2407
 
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2408
 
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
 
3284
        # Remove our outputs, but don't remove object files since they
 
3285
        # may have been created when compiling PIC objects.
 
3286
        removelist=
 
3287
        tempremovelist=`$echo "$output_objdir/*"`
 
3288
        for p in $tempremovelist; do
 
3289
          case $p in
 
3290
            *.$objext)
 
3291
               ;;
 
3292
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3293
               if test "X$precious_files_regex" != "X"; then
 
3294
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3295
                 then
 
3296
                   continue
 
3297
                 fi
 
3298
               fi
 
3299
               removelist="$removelist $p"
 
3300
               ;;
 
3301
            *) ;;
 
3302
          esac
 
3303
        done
 
3304
        if test -n "$removelist"; then
 
3305
          $show "${rm}r $removelist"
 
3306
          $run ${rm}r $removelist
 
3307
        fi
2409
3308
      fi
2410
3309
 
2411
3310
      # Now set the variables for building old libraries.
2418
3317
 
2419
3318
      # Eliminate all temporary directories.
2420
3319
      for path in $notinst_path; do
2421
 
        lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2422
 
        deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2423
 
        dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
 
3320
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3321
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3322
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2424
3323
      done
2425
3324
 
2426
3325
      if test -n "$xrpath"; then
2433
3332
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2434
3333
          esac
2435
3334
        done
2436
 
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
3335
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2437
3336
          dependency_libs="$temp_xrpath $dependency_libs"
2438
3337
        fi
2439
3338
      fi
2471
3370
          *-*-netbsd*)
2472
3371
            # Don't link with libc until the a.out ld.so is fixed.
2473
3372
            ;;
2474
 
          *-*-openbsd*)
 
3373
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
2475
3374
            # Do not include libc due to us having libc/libc_r.
 
3375
            test "X$arg" = "X-lc" && continue
2476
3376
            ;;
2477
 
          *)
 
3377
          *)
2478
3378
            # Add libc to deplibs on all other systems if necessary.
2479
 
            if test $build_libtool_need_lc = "yes"; then
 
3379
            if test "$build_libtool_need_lc" = "yes"; then
2480
3380
              deplibs="$deplibs -lc"
2481
3381
            fi
2482
3382
            ;;
2503
3403
          # This might be a little naive.  We might want to check
2504
3404
          # whether the library exists or not.  But this is on
2505
3405
          # osf3 & osf4 and I'm not really sure... Just
2506
 
          # implementing what was already the behaviour.
 
3406
          # implementing what was already the behavior.
2507
3407
          newdeplibs=$deplibs
2508
3408
          ;;
2509
3409
        test_compile)
2516
3416
          int main() { return 0; }
2517
3417
EOF
2518
3418
          $rm conftest
2519
 
          $CC -o conftest conftest.c $deplibs
2520
 
          if test $? -eq 0 ; then
 
3419
          $LTCC -o conftest conftest.c $deplibs
 
3420
          if test "$?" -eq 0 ; then
2521
3421
            ldd_output=`ldd conftest`
2522
3422
            for i in $deplibs; do
2523
3423
              name="`expr $i : '-l\(.*\)'`"
2524
3424
              # If $name is empty we are operating on a -L argument.
2525
 
              if test -n "$name" && test "$name" != "0"; then
2526
 
                libname=`eval \\$echo \"$libname_spec\"`
2527
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2528
 
                set dummy $deplib_matches
2529
 
                deplib_match=$2
2530
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2531
 
                  newdeplibs="$newdeplibs $i"
2532
 
                else
2533
 
                  droppeddeps=yes
2534
 
                  echo
2535
 
                  echo "*** Warning: This library needs some functionality provided by $i."
2536
 
                  echo "*** I have the capability to make that library automatically link in when"
2537
 
                  echo "*** you link to this library.  But I can only do this if you have a"
2538
 
                  echo "*** shared version of the library, which you do not appear to have."
2539
 
                fi
2540
 
              else
2541
 
                newdeplibs="$newdeplibs $i"
2542
 
              fi
2543
 
            done
2544
 
          else
2545
 
            # Error occured in the first compile.  Let's try to salvage the situation:
2546
 
            # Compile a seperate program for each library.
2547
 
            for i in $deplibs; do
2548
 
              name="`expr $i : '-l\(.*\)'`"
2549
 
             # If $name is empty we are operating on a -L argument.
2550
 
              if test -n "$name" && test "$name" != "0"; then
2551
 
                $rm conftest
2552
 
                $CC -o conftest conftest.c $i
2553
 
                # Did it work?
2554
 
                if test $? -eq 0 ; then
2555
 
                  ldd_output=`ldd conftest`
 
3425
              if test "$name" != "" && test "$name" -ne "0"; then
 
3426
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3427
                  case " $predeps $postdeps " in
 
3428
                  *" $i "*)
 
3429
                    newdeplibs="$newdeplibs $i"
 
3430
                    i=""
 
3431
                    ;;
 
3432
                  esac
 
3433
                fi
 
3434
                if test -n "$i" ; then
2556
3435
                  libname=`eval \\$echo \"$libname_spec\"`
2557
3436
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2558
3437
                  set dummy $deplib_matches
2561
3440
                    newdeplibs="$newdeplibs $i"
2562
3441
                  else
2563
3442
                    droppeddeps=yes
2564
 
                    echo
2565
 
                    echo "*** Warning: This library needs some functionality provided by $i."
2566
 
                    echo "*** I have the capability to make that library automatically link in when"
2567
 
                    echo "*** you link to this library.  But I can only do this if you have a"
2568
 
                    echo "*** shared version of the library, which you do not appear to have."
 
3443
                    $echo
 
3444
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3445
                    $echo "*** I have the capability to make that library automatically link in when"
 
3446
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3447
                    $echo "*** shared version of the library, which I believe you do not have"
 
3448
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3449
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3450
                  fi
 
3451
                fi
 
3452
              else
 
3453
                newdeplibs="$newdeplibs $i"
 
3454
              fi
 
3455
            done
 
3456
          else
 
3457
            # Error occurred in the first compile.  Let's try to salvage
 
3458
            # the situation: Compile a separate program for each library.
 
3459
            for i in $deplibs; do
 
3460
              name="`expr $i : '-l\(.*\)'`"
 
3461
              # If $name is empty we are operating on a -L argument.
 
3462
              if test "$name" != "" && test "$name" != "0"; then
 
3463
                $rm conftest
 
3464
                $LTCC -o conftest conftest.c $i
 
3465
                # Did it work?
 
3466
                if test "$?" -eq 0 ; then
 
3467
                  ldd_output=`ldd conftest`
 
3468
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3469
                    case " $predeps $postdeps " in
 
3470
                    *" $i "*)
 
3471
                      newdeplibs="$newdeplibs $i"
 
3472
                      i=""
 
3473
                      ;;
 
3474
                    esac
 
3475
                  fi
 
3476
                  if test -n "$i" ; then
 
3477
                    libname=`eval \\$echo \"$libname_spec\"`
 
3478
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3479
                    set dummy $deplib_matches
 
3480
                    deplib_match=$2
 
3481
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3482
                      newdeplibs="$newdeplibs $i"
 
3483
                    else
 
3484
                      droppeddeps=yes
 
3485
                      $echo
 
3486
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3487
                      $echo "*** I have the capability to make that library automatically link in when"
 
3488
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3489
                      $echo "*** shared version of the library, which you do not appear to have"
 
3490
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3491
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3492
                    fi
2569
3493
                  fi
2570
3494
                else
2571
3495
                  droppeddeps=yes
2572
 
                  echo
2573
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2574
 
                  echo "***  make it link in!  You will probably need to install it or some"
2575
 
                  echo "*** library that it depends on before this library will be fully"
2576
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3496
                  $echo
 
3497
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3498
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3499
                  $echo "*** library that it depends on before this library will be fully"
 
3500
                  $echo "*** functional.  Installing it before continuing would be even better."
2577
3501
                fi
2578
3502
              else
2579
3503
                newdeplibs="$newdeplibs $i"
2587
3511
          for a_deplib in $deplibs; do
2588
3512
            name="`expr $a_deplib : '-l\(.*\)'`"
2589
3513
            # If $name is empty we are operating on a -L argument.
2590
 
            if test -n "$name" && test "$name" != "0"; then
2591
 
              libname=`eval \\$echo \"$libname_spec\"`
2592
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2593
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2594
 
                    for potent_lib in $potential_libs; do
 
3514
            if test "$name" != "" && test  "$name" != "0"; then
 
3515
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3516
                case " $predeps $postdeps " in
 
3517
                *" $a_deplib "*)
 
3518
                  newdeplibs="$newdeplibs $a_deplib"
 
3519
                  a_deplib=""
 
3520
                  ;;
 
3521
                esac
 
3522
              fi
 
3523
              if test -n "$a_deplib" ; then
 
3524
                libname=`eval \\$echo \"$libname_spec\"`
 
3525
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3526
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3527
                  for potent_lib in $potential_libs; do
2595
3528
                      # Follow soft links.
2596
3529
                      if ls -lLd "$potent_lib" 2>/dev/null \
2597
3530
                         | grep " -> " >/dev/null; then
2604
3537
                      # but so what?
2605
3538
                      potlib="$potent_lib"
2606
3539
                      while test -h "$potlib" 2>/dev/null; do
2607
 
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
 
3540
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2608
3541
                        case $potliblink in
2609
3542
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2610
3543
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2611
3544
                        esac
2612
3545
                      done
2613
3546
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2614
 
                         | sed 10q \
2615
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3547
                         | ${SED} 10q \
 
3548
                         | $EGREP "$file_magic_regex" > /dev/null; then
2616
3549
                        newdeplibs="$newdeplibs $a_deplib"
2617
3550
                        a_deplib=""
2618
3551
                        break 2
2619
3552
                      fi
2620
 
                    done
2621
 
              done
 
3553
                  done
 
3554
                done
 
3555
              fi
2622
3556
              if test -n "$a_deplib" ; then
2623
3557
                droppeddeps=yes
2624
 
                echo
2625
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
2626
 
                echo "*** I have the capability to make that library automatically link in when"
2627
 
                echo "*** you link to this library.  But I can only do this if you have a"
2628
 
                echo "*** shared version of the library, which you do not appear to have."
 
3558
                $echo
 
3559
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3560
                $echo "*** I have the capability to make that library automatically link in when"
 
3561
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3562
                $echo "*** shared version of the library, which you do not appear to have"
 
3563
                $echo "*** because I did check the linker path looking for a file starting"
 
3564
                if test -z "$potlib" ; then
 
3565
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3566
                else
 
3567
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3568
                  $echo "*** using a file magic. Last file checked: $potlib"
 
3569
                fi
2629
3570
              fi
2630
3571
            else
2631
3572
              # Add a -L argument.
2640
3581
            name="`expr $a_deplib : '-l\(.*\)'`"
2641
3582
            # If $name is empty we are operating on a -L argument.
2642
3583
            if test -n "$name" && test "$name" != "0"; then
2643
 
              libname=`eval \\$echo \"$libname_spec\"`
2644
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2645
 
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2646
 
                for potent_lib in $potential_libs; do
2647
 
                  if eval echo \"$potent_lib\" 2>/dev/null \
2648
 
                      | sed 10q \
2649
 
                      | egrep "$match_pattern_regex" > /dev/null; then
2650
 
                    newdeplibs="$newdeplibs $a_deplib"
2651
 
                    a_deplib=""
2652
 
                    break 2
2653
 
                  fi
 
3584
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3585
                case " $predeps $postdeps " in
 
3586
                *" $a_deplib "*)
 
3587
                  newdeplibs="$newdeplibs $a_deplib"
 
3588
                  a_deplib=""
 
3589
                  ;;
 
3590
                esac
 
3591
              fi
 
3592
              if test -n "$a_deplib" ; then
 
3593
                libname=`eval \\$echo \"$libname_spec\"`
 
3594
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3595
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3596
                  for potent_lib in $potential_libs; do
 
3597
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3598
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3599
                        | ${SED} 10q \
 
3600
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3601
                      newdeplibs="$newdeplibs $a_deplib"
 
3602
                      a_deplib=""
 
3603
                      break 2
 
3604
                    fi
 
3605
                  done
2654
3606
                done
2655
 
              done
 
3607
              fi
2656
3608
              if test -n "$a_deplib" ; then
2657
3609
                droppeddeps=yes
2658
 
                echo
2659
 
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
2660
 
                echo "*** I have the capability to make that library automatically link in when"
2661
 
                echo "*** you link to this library.  But I can only do this if you have a"
2662
 
                echo "*** shared version of the library, which you do not appear to have."
 
3610
                $echo
 
3611
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3612
                $echo "*** I have the capability to make that library automatically link in when"
 
3613
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3614
                $echo "*** shared version of the library, which you do not appear to have"
 
3615
                $echo "*** because I did check the linker path looking for a file starting"
 
3616
                if test -z "$potlib" ; then
 
3617
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3618
                else
 
3619
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3620
                  $echo "*** using a regex pattern. Last file checked: $potlib"
 
3621
                fi
2663
3622
              fi
2664
3623
            else
2665
3624
              # Add a -L argument.
2669
3628
          ;;
2670
3629
        none | unknown | *)
2671
3630
          newdeplibs=""
2672
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2673
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2674
 
             grep . >/dev/null; then
2675
 
            echo
 
3631
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3632
            -e 's/ -[LR][^ ]*//g'`
 
3633
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3634
            for i in $predeps $postdeps ; do
 
3635
              # can't use Xsed below, because $i might contain '/'
 
3636
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3637
            done
 
3638
          fi
 
3639
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3640
            | grep . >/dev/null; then
 
3641
            $echo
2676
3642
            if test "X$deplibs_check_method" = "Xnone"; then
2677
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3643
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2678
3644
            else
2679
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3645
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2680
3646
            fi
2681
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3647
            $echo "*** All declared inter-library dependencies are being dropped."
2682
3648
            droppeddeps=yes
2683
3649
          fi
2684
3650
          ;;
2698
3664
 
2699
3665
        if test "$droppeddeps" = yes; then
2700
3666
          if test "$module" = yes; then
2701
 
            echo
2702
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2703
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2704
 
            echo "*** a static module, that should work as long as the dlopening"
2705
 
            echo "*** application is linked with the -dlopen flag."
 
3667
            $echo
 
3668
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3669
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3670
            $echo "*** a static module, that should work as long as the dlopening"
 
3671
            $echo "*** application is linked with the -dlopen flag."
2706
3672
            if test -z "$global_symbol_pipe"; then
2707
 
              echo
2708
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2709
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2710
 
              echo "*** not find such a program.  So, this module is probably useless."
2711
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3673
              $echo
 
3674
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3675
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3676
              $echo "*** not find such a program.  So, this module is probably useless."
 
3677
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2712
3678
            fi
2713
3679
            if test "$build_old_libs" = no; then
2714
3680
              oldlibs="$output_objdir/$libname.$libext"
2718
3684
              build_libtool_libs=no
2719
3685
            fi
2720
3686
          else
2721
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2722
 
            echo "*** automatically added whenever a program is linked with this library"
2723
 
            echo "*** or is declared to -dlopen it."
 
3687
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3688
            $echo "*** automatically added whenever a program is linked with this library"
 
3689
            $echo "*** or is declared to -dlopen it."
2724
3690
 
2725
 
            if test $allow_undefined = no; then
2726
 
              echo
2727
 
              echo "*** Since this library must not contain undefined symbols,"
2728
 
              echo "*** because either the platform does not support them or"
2729
 
              echo "*** it was explicitly requested with -no-undefined,"
2730
 
              echo "*** libtool will only create a static version of it."
 
3691
            if test "$allow_undefined" = no; then
 
3692
              $echo
 
3693
              $echo "*** Since this library must not contain undefined symbols,"
 
3694
              $echo "*** because either the platform does not support them or"
 
3695
              $echo "*** it was explicitly requested with -no-undefined,"
 
3696
              $echo "*** libtool will only create a static version of it."
2731
3697
              if test "$build_old_libs" = no; then
2732
3698
                oldlibs="$output_objdir/$libname.$libext"
2733
3699
                build_libtool_libs=module
2749
3715
 
2750
3716
      # Test again, we may have decided not to build it any more
2751
3717
      if test "$build_libtool_libs" = yes; then
2752
 
        if test $hardcode_into_libs = yes; then
 
3718
        if test "$hardcode_into_libs" = yes; then
2753
3719
          # Hardcode the library paths
2754
3720
          hardcode_libdirs=
2755
3721
          dep_rpath=
2785
3751
          if test -n "$hardcode_libdir_separator" &&
2786
3752
             test -n "$hardcode_libdirs"; then
2787
3753
            libdir="$hardcode_libdirs"
2788
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3754
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3755
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3756
            else
 
3757
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3758
            fi
2789
3759
          fi
2790
3760
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2791
3761
            # We should set the runpath_var.
2805
3775
        fi
2806
3776
 
2807
3777
        # Get the real and link names of the library.
 
3778
        eval shared_ext=\"$shrext_cmds\"
2808
3779
        eval library_names=\"$library_names_spec\"
2809
3780
        set dummy $library_names
2810
3781
        realname="$2"
2815
3786
        else
2816
3787
          soname="$realname"
2817
3788
        fi
2818
 
        test -z "$dlname" && dlname=$soname
 
3789
        if test -z "$dlname"; then
 
3790
          dlname=$soname
 
3791
        fi
2819
3792
 
2820
3793
        lib="$output_objdir/$realname"
2821
3794
        for link
2823
3796
          linknames="$linknames $link"
2824
3797
        done
2825
3798
 
2826
 
        # Ensure that we have .o objects for linkers which dislike .lo
2827
 
        # (e.g. aix) in case we are running --disable-static
2828
 
        for obj in $libobjs; do
2829
 
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2830
 
          if test "X$xdir" = "X$obj"; then
2831
 
            xdir="."
2832
 
          else
2833
 
            xdir="$xdir"
2834
 
          fi
2835
 
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2836
 
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2837
 
          if test ! -f $xdir/$oldobj; then
2838
 
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2839
 
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2840
 
          fi
2841
 
        done
2842
 
 
2843
3799
        # Use standard objects if they are pic
2844
3800
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2845
3801
 
2849
3805
            $show "generating symbol list for \`$libname.la'"
2850
3806
            export_symbols="$output_objdir/$libname.exp"
2851
3807
            $run $rm $export_symbols
2852
 
            eval cmds=\"$export_symbols_cmds\"
 
3808
            cmds=$export_symbols_cmds
2853
3809
            save_ifs="$IFS"; IFS='~'
2854
3810
            for cmd in $cmds; do
2855
3811
              IFS="$save_ifs"
2856
 
              $show "$cmd"
2857
 
              $run eval "$cmd" || exit $?
 
3812
              eval cmd=\"$cmd\"
 
3813
              if len=`expr "X$cmd" : ".*"` &&
 
3814
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3815
                $show "$cmd"
 
3816
                $run eval "$cmd" || exit $?
 
3817
                skipped_export=false
 
3818
              else
 
3819
                # The command line is too long to execute in one step.
 
3820
                $show "using reloadable object file for export list..."
 
3821
                skipped_export=:
 
3822
              fi
2858
3823
            done
2859
3824
            IFS="$save_ifs"
2860
3825
            if test -n "$export_symbols_regex"; then
2861
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2862
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
3826
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3827
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2863
3828
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2864
3829
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2865
3830
            fi
2870
3835
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2871
3836
        fi
2872
3837
 
 
3838
        tmp_deplibs=
 
3839
        for test_deplib in $deplibs; do
 
3840
                case " $convenience " in
 
3841
                *" $test_deplib "*) ;;
 
3842
                *)
 
3843
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3844
                        ;;
 
3845
                esac
 
3846
        done
 
3847
        deplibs="$tmp_deplibs"
 
3848
 
2873
3849
        if test -n "$convenience"; then
2874
3850
          if test -n "$whole_archive_flag_spec"; then
 
3851
            save_libobjs=$libobjs
2875
3852
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2876
3853
          else
2877
3854
            gentop="$output_objdir/${outputname}x"
2878
 
            $show "${rm}r $gentop"
2879
 
            $run ${rm}r "$gentop"
2880
 
            $show "mkdir $gentop"
2881
 
            $run mkdir "$gentop"
2882
 
            status=$?
2883
 
            if test $status -ne 0 && test ! -d "$gentop"; then
2884
 
              exit $status
2885
 
            fi
2886
3855
            generated="$generated $gentop"
2887
3856
 
2888
 
            for xlib in $convenience; do
2889
 
              # Extract the objects.
2890
 
              case $xlib in
2891
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2892
 
              *) xabs=`pwd`"/$xlib" ;;
2893
 
              esac
2894
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2895
 
              xdir="$gentop/$xlib"
2896
 
 
2897
 
              $show "${rm}r $xdir"
2898
 
              $run ${rm}r "$xdir"
2899
 
              $show "mkdir $xdir"
2900
 
              $run mkdir "$xdir"
2901
 
              status=$?
2902
 
              if test $status -ne 0 && test ! -d "$xdir"; then
2903
 
                exit $status
2904
 
              fi
2905
 
              $show "(cd $xdir && $AR x $xabs)"
2906
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2907
 
 
2908
 
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2909
 
            done
 
3857
            func_extract_archives $gentop $convenience
 
3858
            libobjs="$libobjs $func_extract_archives_result"
2910
3859
          fi
2911
3860
        fi
2912
 
 
 
3861
        
2913
3862
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2914
3863
          eval flag=\"$thread_safe_flag_spec\"
2915
3864
          linker_flags="$linker_flags $flag"
2921
3870
        fi
2922
3871
 
2923
3872
        # Do each of the archive commands.
 
3873
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3874
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3875
            eval test_cmds=\"$module_expsym_cmds\"
 
3876
            cmds=$module_expsym_cmds
 
3877
          else
 
3878
            eval test_cmds=\"$module_cmds\"
 
3879
            cmds=$module_cmds
 
3880
          fi
 
3881
        else
2924
3882
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2925
 
          eval cmds=\"$archive_expsym_cmds\"
2926
 
        else
2927
 
          eval cmds=\"$archive_cmds\"
 
3883
          eval test_cmds=\"$archive_expsym_cmds\"
 
3884
          cmds=$archive_expsym_cmds
 
3885
        else
 
3886
          eval test_cmds=\"$archive_cmds\"
 
3887
          cmds=$archive_cmds
 
3888
          fi
 
3889
        fi
 
3890
 
 
3891
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
3892
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3893
          :
 
3894
        else
 
3895
          # The command line is too long to link in one step, link piecewise.
 
3896
          $echo "creating reloadable object files..."
 
3897
 
 
3898
          # Save the value of $output and $libobjs because we want to
 
3899
          # use them later.  If we have whole_archive_flag_spec, we
 
3900
          # want to use save_libobjs as it was before
 
3901
          # whole_archive_flag_spec was expanded, because we can't
 
3902
          # assume the linker understands whole_archive_flag_spec.
 
3903
          # This may have to be revisited, in case too many
 
3904
          # convenience libraries get linked in and end up exceeding
 
3905
          # the spec.
 
3906
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
3907
            save_libobjs=$libobjs
 
3908
          fi
 
3909
          save_output=$output
 
3910
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
 
3911
 
 
3912
          # Clear the reloadable object creation command queue and
 
3913
          # initialize k to one.
 
3914
          test_cmds=
 
3915
          concat_cmds=
 
3916
          objlist=
 
3917
          delfiles=
 
3918
          last_robj=
 
3919
          k=1
 
3920
          output=$output_objdir/$output_la-${k}.$objext
 
3921
          # Loop over the list of objects to be linked.
 
3922
          for obj in $save_libobjs
 
3923
          do
 
3924
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3925
            if test "X$objlist" = X ||
 
3926
               { len=`expr "X$test_cmds" : ".*"` &&
 
3927
                 test "$len" -le "$max_cmd_len"; }; then
 
3928
              objlist="$objlist $obj"
 
3929
            else
 
3930
              # The command $test_cmds is almost too long, add a
 
3931
              # command to the queue.
 
3932
              if test "$k" -eq 1 ; then
 
3933
                # The first file doesn't have a previous command to add.
 
3934
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3935
              else
 
3936
                # All subsequent reloadable object files will link in
 
3937
                # the last one created.
 
3938
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
 
3939
              fi
 
3940
              last_robj=$output_objdir/$output_la-${k}.$objext
 
3941
              k=`expr $k + 1`
 
3942
              output=$output_objdir/$output_la-${k}.$objext
 
3943
              objlist=$obj
 
3944
              len=1
 
3945
            fi
 
3946
          done
 
3947
          # Handle the remaining objects by creating one last
 
3948
          # reloadable object file.  All subsequent reloadable object
 
3949
          # files will link in the last one created.
 
3950
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
3951
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3952
 
 
3953
          if ${skipped_export-false}; then
 
3954
            $show "generating symbol list for \`$libname.la'"
 
3955
            export_symbols="$output_objdir/$libname.exp"
 
3956
            $run $rm $export_symbols
 
3957
            libobjs=$output
 
3958
            # Append the command to create the export file.
 
3959
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3960
          fi
 
3961
 
 
3962
          # Set up a command to remove the reloadable object files
 
3963
          # after they are used.
 
3964
          i=0
 
3965
          while test "$i" -lt "$k"
 
3966
          do
 
3967
            i=`expr $i + 1`
 
3968
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
 
3969
          done
 
3970
 
 
3971
          $echo "creating a temporary reloadable object file: $output"
 
3972
 
 
3973
          # Loop through the commands generated above and execute them.
 
3974
          save_ifs="$IFS"; IFS='~'
 
3975
          for cmd in $concat_cmds; do
 
3976
            IFS="$save_ifs"
 
3977
            $show "$cmd"
 
3978
            $run eval "$cmd" || exit $?
 
3979
          done
 
3980
          IFS="$save_ifs"
 
3981
 
 
3982
          libobjs=$output
 
3983
          # Restore the value of output.
 
3984
          output=$save_output
 
3985
 
 
3986
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
3987
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
3988
          fi
 
3989
          # Expand the library linking commands again to reset the
 
3990
          # value of $libobjs for piecewise linking.
 
3991
 
 
3992
          # Do each of the archive commands.
 
3993
          if test "$module" = yes && test -n "$module_cmds" ; then
 
3994
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3995
              cmds=$module_expsym_cmds
 
3996
            else
 
3997
              cmds=$module_cmds
 
3998
            fi
 
3999
          else
 
4000
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
4001
            cmds=$archive_expsym_cmds
 
4002
          else
 
4003
            cmds=$archive_cmds
 
4004
            fi
 
4005
          fi
 
4006
 
 
4007
          # Append the command to remove the reloadable object files
 
4008
          # to the just-reset $cmds.
 
4009
          eval cmds=\"\$cmds~\$rm $delfiles\"
2928
4010
        fi
2929
4011
        save_ifs="$IFS"; IFS='~'
2930
4012
        for cmd in $cmds; do
2931
4013
          IFS="$save_ifs"
 
4014
          eval cmd=\"$cmd\"
2932
4015
          $show "$cmd"
2933
4016
          $run eval "$cmd" || exit $?
2934
4017
        done
2937
4020
        # Restore the uninstalled library and exit
2938
4021
        if test "$mode" = relink; then
2939
4022
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2940
 
          exit 0
 
4023
          exit $EXIT_SUCCESS
2941
4024
        fi
2942
4025
 
2943
4026
        # Create links to the real library.
2985
4068
      *.lo)
2986
4069
        if test -n "$objs$old_deplibs"; then
2987
4070
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2988
 
          exit 1
 
4071
          exit $EXIT_FAILURE
2989
4072
        fi
2990
4073
        libobj="$output"
2991
4074
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3014
4097
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3015
4098
        else
3016
4099
          gentop="$output_objdir/${obj}x"
3017
 
          $show "${rm}r $gentop"
3018
 
          $run ${rm}r "$gentop"
3019
 
          $show "mkdir $gentop"
3020
 
          $run mkdir "$gentop"
3021
 
          status=$?
3022
 
          if test $status -ne 0 && test ! -d "$gentop"; then
3023
 
            exit $status
3024
 
          fi
3025
4100
          generated="$generated $gentop"
3026
4101
 
3027
 
          for xlib in $convenience; do
3028
 
            # Extract the objects.
3029
 
            case $xlib in
3030
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3031
 
            *) xabs=`pwd`"/$xlib" ;;
3032
 
            esac
3033
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3034
 
            xdir="$gentop/$xlib"
3035
 
 
3036
 
            $show "${rm}r $xdir"
3037
 
            $run ${rm}r "$xdir"
3038
 
            $show "mkdir $xdir"
3039
 
            $run mkdir "$xdir"
3040
 
            status=$?
3041
 
            if test $status -ne 0 && test ! -d "$xdir"; then
3042
 
              exit $status
3043
 
            fi
3044
 
            $show "(cd $xdir && $AR x $xabs)"
3045
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3046
 
 
3047
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3048
 
          done
 
4102
          func_extract_archives $gentop $convenience
 
4103
          reload_conv_objs="$reload_objs $func_extract_archives_result"
3049
4104
        fi
3050
4105
      fi
3051
4106
 
3053
4108
      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
3054
4109
 
3055
4110
      output="$obj"
3056
 
      eval cmds=\"$reload_cmds\"
 
4111
      cmds=$reload_cmds
3057
4112
      save_ifs="$IFS"; IFS='~'
3058
4113
      for cmd in $cmds; do
3059
4114
        IFS="$save_ifs"
 
4115
        eval cmd=\"$cmd\"
3060
4116
        $show "$cmd"
3061
4117
        $run eval "$cmd" || exit $?
3062
4118
      done
3069
4125
          $run ${rm}r $gentop
3070
4126
        fi
3071
4127
 
3072
 
        exit 0
 
4128
        exit $EXIT_SUCCESS
3073
4129
      fi
3074
4130
 
3075
4131
      if test "$build_libtool_libs" != yes; then
3080
4136
 
3081
4137
        # Create an invalid libtool object if no PIC, so that we don't
3082
4138
        # accidentally link it into a program.
3083
 
        $show "echo timestamp > $libobj"
3084
 
        $run eval "echo timestamp > $libobj" || exit $?
3085
 
        exit 0
 
4139
        # $show "echo timestamp > $libobj"
 
4140
        # $run eval "echo timestamp > $libobj" || exit $?
 
4141
        exit $EXIT_SUCCESS
3086
4142
      fi
3087
4143
 
3088
4144
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3089
4145
        # Only do commands if we really have different PIC objects.
3090
4146
        reload_objs="$libobjs $reload_conv_objs"
3091
4147
        output="$libobj"
3092
 
        eval cmds=\"$reload_cmds\"
 
4148
        cmds=$reload_cmds
3093
4149
        save_ifs="$IFS"; IFS='~'
3094
4150
        for cmd in $cmds; do
3095
4151
          IFS="$save_ifs"
 
4152
          eval cmd=\"$cmd\"
3096
4153
          $show "$cmd"
3097
4154
          $run eval "$cmd" || exit $?
3098
4155
        done
3099
4156
        IFS="$save_ifs"
3100
 
      else
3101
 
        # Just create a symlink.
3102
 
        $show $rm $libobj
3103
 
        $run $rm $libobj
3104
 
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3105
 
        if test "X$xdir" = "X$libobj"; then
3106
 
          xdir="."
3107
 
        else
3108
 
          xdir="$xdir"
3109
 
        fi
3110
 
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3111
 
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3112
 
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3113
 
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3114
4157
      fi
3115
4158
 
3116
4159
      if test -n "$gentop"; then
3118
4161
        $run ${rm}r $gentop
3119
4162
      fi
3120
4163
 
3121
 
      exit 0
 
4164
      exit $EXIT_SUCCESS
3122
4165
      ;;
3123
4166
 
3124
4167
    prog)
3125
4168
      case $host in
3126
 
        *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
 
4169
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3127
4170
      esac
3128
4171
      if test -n "$vinfo"; then
3129
4172
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3148
4191
        ;;
3149
4192
      esac
3150
4193
 
 
4194
      case $host in
 
4195
      *darwin*)
 
4196
        # Don't allow lazy linking, it breaks C++ global constructors
 
4197
        if test "$tagname" = CXX ; then
 
4198
        compile_command="$compile_command ${wl}-bind_at_load"
 
4199
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4200
        fi
 
4201
        ;;
 
4202
      esac
 
4203
 
3151
4204
      compile_command="$compile_command $compile_deplibs"
3152
4205
      finalize_command="$finalize_command $finalize_deplibs"
3153
4206
 
3298
4351
            done
3299
4352
 
3300
4353
            if test -n "$exclude_expsyms"; then
3301
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4354
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3302
4355
              $run eval '$mv "$nlist"T "$nlist"'
3303
4356
            fi
3304
4357
 
3305
4358
            if test -n "$export_symbols_regex"; then
3306
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4359
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3307
4360
              $run eval '$mv "$nlist"T "$nlist"'
3308
4361
            fi
3309
4362
 
3310
4363
            # Prepare the list of exported symbols
3311
4364
            if test -z "$export_symbols"; then
3312
 
              export_symbols="$output_objdir/$output.exp"
 
4365
              export_symbols="$output_objdir/$outputname.exp"
3313
4366
              $run $rm $export_symbols
3314
 
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4367
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3315
4368
            else
3316
 
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3317
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4369
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4370
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3318
4371
              $run eval 'mv "$nlist"T "$nlist"'
3319
4372
            fi
3320
4373
          fi
3321
4374
 
3322
4375
          for arg in $dlprefiles; do
3323
4376
            $show "extracting global C symbols from \`$arg'"
3324
 
            name=`echo "$arg" | sed -e 's%^.*/%%'`
3325
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4377
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4378
            $run eval '$echo ": $name " >> "$nlist"'
3326
4379
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3327
4380
          done
3328
4381
 
3331
4384
            test -f "$nlist" || : > "$nlist"
3332
4385
 
3333
4386
            if test -n "$exclude_expsyms"; then
3334
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4387
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3335
4388
              $mv "$nlist"T "$nlist"
3336
4389
            fi
3337
4390
 
3338
4391
            # Try sorting and uniquifying the output.
3339
 
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
4392
            if grep -v "^: " < "$nlist" |
 
4393
                if sort -k 3 </dev/null >/dev/null 2>&1; then
 
4394
                  sort -k 3
 
4395
                else
 
4396
                  sort +2
 
4397
                fi |
 
4398
                uniq > "$nlist"S; then
3340
4399
              :
3341
4400
            else
3342
4401
              grep -v "^: " < "$nlist" > "$nlist"S
3345
4404
            if test -f "$nlist"S; then
3346
4405
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3347
4406
            else
3348
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4407
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3349
4408
            fi
3350
4409
 
3351
4410
            $echo >> "$output_objdir/$dlsyms" "\
3360
4419
#endif
3361
4420
 
3362
4421
/* The mapping between symbol names and symbols. */
 
4422
"
 
4423
 
 
4424
            case $host in
 
4425
            *cygwin* | *mingw* )
 
4426
          $echo >> "$output_objdir/$dlsyms" "\
 
4427
/* DATA imports from DLLs on WIN32 can't be const, because
 
4428
   runtime relocations are performed -- see ld's documentation
 
4429
   on pseudo-relocs */
 
4430
struct {
 
4431
"
 
4432
              ;;
 
4433
            * )
 
4434
          $echo >> "$output_objdir/$dlsyms" "\
3363
4435
const struct {
 
4436
"
 
4437
              ;;
 
4438
            esac
 
4439
 
 
4440
 
 
4441
          $echo >> "$output_objdir/$dlsyms" "\
3364
4442
  const char *name;
3365
4443
  lt_ptr address;
3366
4444
}
3397
4475
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3398
4476
            case "$compile_command " in
3399
4477
            *" -static "*) ;;
3400
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4478
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3401
4479
            esac;;
3402
4480
          *-*-hpux*)
3403
4481
            case "$compile_command " in
3404
4482
            *" -static "*) ;;
3405
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4483
            *) pic_flag_for_symtable=" $pic_flag";;
3406
4484
            esac
3407
4485
          esac
3408
4486
 
3409
4487
          # Now compile the dynamic symbol file.
3410
 
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3411
 
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4488
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4489
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3412
4490
 
3413
4491
          # Clean up the generated files.
3414
4492
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3420
4498
          ;;
3421
4499
        *)
3422
4500
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3423
 
          exit 1
 
4501
          exit $EXIT_FAILURE
3424
4502
          ;;
3425
4503
        esac
3426
4504
      else
3433
4511
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3434
4512
      fi
3435
4513
 
3436
 
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
4514
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3437
4515
        # Replace the output file specification.
3438
4516
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3439
4517
        link_command="$compile_command$compile_rpath"
3508
4586
        # Link the executable and exit
3509
4587
        $show "$link_command"
3510
4588
        $run eval "$link_command" || exit $?
3511
 
        exit 0
 
4589
        exit $EXIT_SUCCESS
3512
4590
      fi
3513
4591
 
3514
4592
      if test "$hardcode_action" = relink; then
3558
4636
            relink_command="$var=\"$var_value\"; export $var; $relink_command"
3559
4637
          fi
3560
4638
        done
3561
 
        relink_command="cd `pwd`; $relink_command"
 
4639
        relink_command="(cd `pwd`; $relink_command)"
3562
4640
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3563
4641
      fi
3564
4642
 
3565
4643
      # Quote $echo for shipping.
3566
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3567
 
        case $0 in
3568
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3569
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4644
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4645
        case $progpath in
 
4646
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4647
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
3570
4648
        esac
3571
4649
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3572
4650
      else
3578
4656
        # win32 will think the script is a binary if it has
3579
4657
        # a .exe suffix, so we strip it off here.
3580
4658
        case $output in
3581
 
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
4659
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3582
4660
        esac
3583
4661
        # test for cygwin because mv fails w/o .exe extensions
3584
4662
        case $host in
3585
 
          *cygwin*) exeext=.exe ;;
 
4663
          *cygwin*)
 
4664
            exeext=.exe
 
4665
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3586
4666
          *) exeext= ;;
3587
4667
        esac
 
4668
        case $host in
 
4669
          *cygwin* | *mingw* )
 
4670
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
 
4671
            cwrapper=`$echo ${output}.exe`
 
4672
            $rm $cwrappersource $cwrapper
 
4673
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4674
 
 
4675
            cat > $cwrappersource <<EOF
 
4676
 
 
4677
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4678
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4679
 
 
4680
   The $output program cannot be directly executed until all the libtool
 
4681
   libraries that it depends on are installed.
 
4682
 
 
4683
   This wrapper executable should never be moved out of the build directory.
 
4684
   If it is, it will not operate correctly.
 
4685
 
 
4686
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4687
   but could eventually absorb all of the scripts functionality and
 
4688
   exec $objdir/$outputname directly.
 
4689
*/
 
4690
EOF
 
4691
            cat >> $cwrappersource<<"EOF"
 
4692
#include <stdio.h>
 
4693
#include <stdlib.h>
 
4694
#include <unistd.h>
 
4695
#include <malloc.h>
 
4696
#include <stdarg.h>
 
4697
#include <assert.h>
 
4698
 
 
4699
#if defined(PATH_MAX)
 
4700
# define LT_PATHMAX PATH_MAX
 
4701
#elif defined(MAXPATHLEN)
 
4702
# define LT_PATHMAX MAXPATHLEN
 
4703
#else
 
4704
# define LT_PATHMAX 1024
 
4705
#endif
 
4706
 
 
4707
#ifndef DIR_SEPARATOR
 
4708
#define DIR_SEPARATOR '/'
 
4709
#endif
 
4710
 
 
4711
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4712
  defined (__OS2__)
 
4713
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4714
#ifndef DIR_SEPARATOR_2
 
4715
#define DIR_SEPARATOR_2 '\\'
 
4716
#endif
 
4717
#endif
 
4718
 
 
4719
#ifndef DIR_SEPARATOR_2
 
4720
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4721
#else /* DIR_SEPARATOR_2 */
 
4722
# define IS_DIR_SEPARATOR(ch) \
 
4723
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4724
#endif /* DIR_SEPARATOR_2 */
 
4725
 
 
4726
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4727
#define XFREE(stale) do { \
 
4728
  if (stale) { free ((void *) stale); stale = 0; } \
 
4729
} while (0)
 
4730
 
 
4731
const char *program_name = NULL;
 
4732
 
 
4733
void * xmalloc (size_t num);
 
4734
char * xstrdup (const char *string);
 
4735
char * basename (const char *name);
 
4736
char * fnqualify(const char *path);
 
4737
char * strendzap(char *str, const char *pat);
 
4738
void lt_fatal (const char *message, ...);
 
4739
 
 
4740
int
 
4741
main (int argc, char *argv[])
 
4742
{
 
4743
  char **newargz;
 
4744
  int i;
 
4745
 
 
4746
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4747
  newargz = XMALLOC(char *, argc+2);
 
4748
EOF
 
4749
 
 
4750
            cat >> $cwrappersource <<EOF
 
4751
  newargz[0] = "$SHELL";
 
4752
EOF
 
4753
 
 
4754
            cat >> $cwrappersource <<"EOF"
 
4755
  newargz[1] = fnqualify(argv[0]);
 
4756
  /* we know the script has the same name, without the .exe */
 
4757
  /* so make sure newargz[1] doesn't end in .exe */
 
4758
  strendzap(newargz[1],".exe");
 
4759
  for (i = 1; i < argc; i++)
 
4760
    newargz[i+1] = xstrdup(argv[i]);
 
4761
  newargz[argc+1] = NULL;
 
4762
EOF
 
4763
 
 
4764
            cat >> $cwrappersource <<EOF
 
4765
  execv("$SHELL",newargz);
 
4766
EOF
 
4767
 
 
4768
            cat >> $cwrappersource <<"EOF"
 
4769
}
 
4770
 
 
4771
void *
 
4772
xmalloc (size_t num)
 
4773
{
 
4774
  void * p = (void *) malloc (num);
 
4775
  if (!p)
 
4776
    lt_fatal ("Memory exhausted");
 
4777
 
 
4778
  return p;
 
4779
}
 
4780
 
 
4781
char *
 
4782
xstrdup (const char *string)
 
4783
{
 
4784
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4785
;
 
4786
}
 
4787
 
 
4788
char *
 
4789
basename (const char *name)
 
4790
{
 
4791
  const char *base;
 
4792
 
 
4793
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4794
  /* Skip over the disk name in MSDOS pathnames. */
 
4795
  if (isalpha (name[0]) && name[1] == ':')
 
4796
    name += 2;
 
4797
#endif
 
4798
 
 
4799
  for (base = name; *name; name++)
 
4800
    if (IS_DIR_SEPARATOR (*name))
 
4801
      base = name + 1;
 
4802
  return (char *) base;
 
4803
}
 
4804
 
 
4805
char *
 
4806
fnqualify(const char *path)
 
4807
{
 
4808
  size_t size;
 
4809
  char *p;
 
4810
  char tmp[LT_PATHMAX + 1];
 
4811
 
 
4812
  assert(path != NULL);
 
4813
 
 
4814
  /* Is it qualified already? */
 
4815
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4816
  if (isalpha (path[0]) && path[1] == ':')
 
4817
    return xstrdup (path);
 
4818
#endif
 
4819
  if (IS_DIR_SEPARATOR (path[0]))
 
4820
    return xstrdup (path);
 
4821
 
 
4822
  /* prepend the current directory */
 
4823
  /* doesn't handle '~' */
 
4824
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4825
    lt_fatal ("getcwd failed");
 
4826
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4827
  p = XMALLOC(char, size);
 
4828
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4829
  return p;
 
4830
}
 
4831
 
 
4832
char *
 
4833
strendzap(char *str, const char *pat)
 
4834
{
 
4835
  size_t len, patlen;
 
4836
 
 
4837
  assert(str != NULL);
 
4838
  assert(pat != NULL);
 
4839
 
 
4840
  len = strlen(str);
 
4841
  patlen = strlen(pat);
 
4842
 
 
4843
  if (patlen <= len)
 
4844
  {
 
4845
    str += len - patlen;
 
4846
    if (strcmp(str, pat) == 0)
 
4847
      *str = '\0';
 
4848
  }
 
4849
  return str;
 
4850
}
 
4851
 
 
4852
static void
 
4853
lt_error_core (int exit_status, const char * mode,
 
4854
          const char * message, va_list ap)
 
4855
{
 
4856
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4857
  vfprintf (stderr, message, ap);
 
4858
  fprintf (stderr, ".\n");
 
4859
 
 
4860
  if (exit_status >= 0)
 
4861
    exit (exit_status);
 
4862
}
 
4863
 
 
4864
void
 
4865
lt_fatal (const char *message, ...)
 
4866
{
 
4867
  va_list ap;
 
4868
  va_start (ap, message);
 
4869
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4870
  va_end (ap);
 
4871
}
 
4872
EOF
 
4873
          # we should really use a build-platform specific compiler
 
4874
          # here, but OTOH, the wrappers (shell script and this C one)
 
4875
          # are only useful if you want to execute the "real" binary.
 
4876
          # Since the "real" binary is built for $host, then this
 
4877
          # wrapper might as well be built for $host, too.
 
4878
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4879
          ;;
 
4880
        esac
3588
4881
        $rm $output
3589
 
        trap "$rm $output; exit 1" 1 2 15
 
4882
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
3590
4883
 
3591
4884
        $echo > $output "\
3592
4885
#! $SHELL
3602
4895
 
3603
4896
# Sed substitution that helps us do robust quoting.  It backslashifies
3604
4897
# metacharacters that are still active within double-quoted strings.
3605
 
Xsed='sed -e 1s/^X//'
 
4898
Xsed='${SED} -e 1s/^X//'
3606
4899
sed_quote_subst='$sed_quote_subst'
3607
4900
 
3608
4901
# The HP-UX ksh and POSIX shell print the target directory to stdout
3609
4902
# if CDPATH is set.
3610
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
4903
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3611
4904
 
3612
4905
relink_command=\"$relink_command\"
3613
4906
 
3640
4933
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3641
4934
 
3642
4935
  # Follow symbolic links until we get to the real thisdir.
3643
 
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
4936
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3644
4937
  while test -n \"\$file\"; do
3645
4938
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3646
4939
 
3653
4946
    fi
3654
4947
 
3655
4948
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3656
 
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
4949
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3657
4950
  done
3658
4951
 
3659
4952
  # Try to get the absolute directory name.
3662
4955
"
3663
4956
 
3664
4957
        if test "$fast_install" = yes; then
3665
 
          echo >> $output "\
 
4958
          $echo >> $output "\
3666
4959
  program=lt-'$outputname'$exeext
3667
4960
  progdir=\"\$thisdir/$objdir\"
3668
4961
 
3669
4962
  if test ! -f \"\$progdir/\$program\" || \\
3670
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
4963
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3671
4964
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3672
4965
 
3673
4966
    file=\"\$\$-\$program\"
3678
4971
      $rm \"\$progdir/\$file\"
3679
4972
    fi"
3680
4973
 
3681
 
          echo >> $output "\
 
4974
          $echo >> $output "\
3682
4975
 
3683
4976
    # relink executable if necessary
3684
4977
    if test -n \"\$relink_command\"; then
3686
4979
      else
3687
4980
        $echo \"\$relink_command_output\" >&2
3688
4981
        $rm \"\$progdir/\$file\"
3689
 
        exit 1
 
4982
        exit $EXIT_FAILURE
3690
4983
      fi
3691
4984
    fi
3692
4985
 
3696
4989
    $rm \"\$progdir/\$file\"
3697
4990
  fi"
3698
4991
        else
3699
 
          echo >> $output "\
 
4992
          $echo >> $output "\
3700
4993
  program='$outputname'
3701
4994
  progdir=\"\$thisdir/$objdir\"
3702
4995
"
3703
4996
        fi
3704
4997
 
3705
 
        echo >> $output "\
 
4998
        $echo >> $output "\
3706
4999
 
3707
5000
  if test -f \"\$progdir/\$program\"; then"
3708
5001
 
3733
5026
      # Run the actual program with our arguments.
3734
5027
"
3735
5028
        case $host in
3736
 
        # win32 systems need to use the prog path for dll
3737
 
        # lookup to work
3738
 
        *-*-cygwin* | *-*-pw32*)
3739
 
          $echo >> $output "\
3740
 
      exec \$progdir/\$program \${1+\"\$@\"}
3741
 
"
3742
 
          ;;
3743
 
 
3744
5029
        # Backslashes separate directories on plain windows
3745
5030
        *-*-mingw | *-*-os2*)
3746
5031
          $echo >> $output "\
3750
5035
 
3751
5036
        *)
3752
5037
          $echo >> $output "\
3753
 
      # Export the path to the program.
3754
 
      PATH=\"\$progdir:\$PATH\"
3755
 
      export PATH
3756
 
 
3757
 
      exec \$program \${1+\"\$@\"}
 
5038
      exec \$progdir/\$program \${1+\"\$@\"}
3758
5039
"
3759
5040
          ;;
3760
5041
        esac
3761
5042
        $echo >> $output "\
3762
5043
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3763
 
      exit 1
 
5044
      exit $EXIT_FAILURE
3764
5045
    fi
3765
5046
  else
3766
5047
    # The program doesn't exist.
3767
5048
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3768
5049
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
3769
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
3770
 
    exit 1
 
5050
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
5051
    exit $EXIT_FAILURE
3771
5052
  fi
3772
5053
fi\
3773
5054
"
3774
5055
        chmod +x $output
3775
5056
      fi
3776
 
      exit 0
 
5057
      exit $EXIT_SUCCESS
3777
5058
      ;;
3778
5059
    esac
3779
5060
 
3789
5070
          oldobjs="$libobjs_save"
3790
5071
          build_libtool_libs=no
3791
5072
        else
3792
 
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
5073
          oldobjs="$old_deplibs $non_pic_objects"
3793
5074
        fi
3794
5075
        addlibs="$old_convenience"
3795
5076
      fi
3796
5077
 
3797
5078
      if test -n "$addlibs"; then
3798
5079
        gentop="$output_objdir/${outputname}x"
3799
 
        $show "${rm}r $gentop"
3800
 
        $run ${rm}r "$gentop"
3801
 
        $show "mkdir $gentop"
3802
 
        $run mkdir "$gentop"
3803
 
        status=$?
3804
 
        if test $status -ne 0 && test ! -d "$gentop"; then
3805
 
          exit $status
3806
 
        fi
3807
5080
        generated="$generated $gentop"
3808
5081
 
3809
 
        # Add in members from convenience archives.
3810
 
        for xlib in $addlibs; do
3811
 
          # Extract the objects.
3812
 
          case $xlib in
3813
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3814
 
          *) xabs=`pwd`"/$xlib" ;;
3815
 
          esac
3816
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3817
 
          xdir="$gentop/$xlib"
3818
 
 
3819
 
          $show "${rm}r $xdir"
3820
 
          $run ${rm}r "$xdir"
3821
 
          $show "mkdir $xdir"
3822
 
          $run mkdir "$xdir"
3823
 
          status=$?
3824
 
          if test $status -ne 0 && test ! -d "$xdir"; then
3825
 
            exit $status
3826
 
          fi
3827
 
          $show "(cd $xdir && $AR x $xabs)"
3828
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3829
 
 
3830
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3831
 
        done
 
5082
        func_extract_archives $gentop $addlibs
 
5083
        oldobjs="$oldobjs $func_extract_archives_result"
3832
5084
      fi
3833
5085
 
3834
5086
      # Do each command in the archive commands.
3835
5087
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3836
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5088
       cmds=$old_archive_from_new_cmds
3837
5089
      else
3838
 
        # Ensure that we have .o objects in place in case we decided
3839
 
        # not to build a shared library, and have fallen back to building
3840
 
        # static libs even though --disable-static was passed!
3841
 
        for oldobj in $oldobjs; do
3842
 
          if test ! -f $oldobj; then
3843
 
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3844
 
            if test "X$xdir" = "X$oldobj"; then
3845
 
              xdir="."
3846
 
            else
3847
 
              xdir="$xdir"
 
5090
        # POSIX demands no paths to be encoded in archives.  We have
 
5091
        # to avoid creating archives with duplicate basenames if we
 
5092
        # might have to extract them afterwards, e.g., when creating a
 
5093
        # static archive out of a convenience library, or when linking
 
5094
        # the entirety of a libtool archive into another (currently
 
5095
        # not supported by libtool).
 
5096
        if (for obj in $oldobjs
 
5097
            do
 
5098
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5099
            done | sort | sort -uc >/dev/null 2>&1); then
 
5100
          :
 
5101
        else
 
5102
          $echo "copying selected object files to avoid basename conflicts..."
 
5103
 
 
5104
          if test -z "$gentop"; then
 
5105
            gentop="$output_objdir/${outputname}x"
 
5106
            generated="$generated $gentop"
 
5107
 
 
5108
            $show "${rm}r $gentop"
 
5109
            $run ${rm}r "$gentop"
 
5110
            $show "$mkdir $gentop"
 
5111
            $run $mkdir "$gentop"
 
5112
            status=$?
 
5113
            if test "$status" -ne 0 && test ! -d "$gentop"; then
 
5114
              exit $status
3848
5115
            fi
3849
 
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3850
 
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3851
 
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3852
 
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3853
5116
          fi
3854
 
        done
 
5117
 
 
5118
          save_oldobjs=$oldobjs
 
5119
          oldobjs=
 
5120
          counter=1
 
5121
          for obj in $save_oldobjs
 
5122
          do
 
5123
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5124
            case " $oldobjs " in
 
5125
            " ") oldobjs=$obj ;;
 
5126
            *[\ /]"$objbase "*)
 
5127
              while :; do
 
5128
                # Make sure we don't pick an alternate name that also
 
5129
                # overlaps.
 
5130
                newobj=lt$counter-$objbase
 
5131
                counter=`expr $counter + 1`
 
5132
                case " $oldobjs " in
 
5133
                *[\ /]"$newobj "*) ;;
 
5134
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5135
                esac
 
5136
              done
 
5137
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5138
              $run ln "$obj" "$gentop/$newobj" ||
 
5139
              $run cp "$obj" "$gentop/$newobj"
 
5140
              oldobjs="$oldobjs $gentop/$newobj"
 
5141
              ;;
 
5142
            *) oldobjs="$oldobjs $obj" ;;
 
5143
            esac
 
5144
          done
 
5145
        fi
3855
5146
 
3856
5147
        eval cmds=\"$old_archive_cmds\"
 
5148
 
 
5149
        if len=`expr "X$cmds" : ".*"` &&
 
5150
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5151
          cmds=$old_archive_cmds
 
5152
        else
 
5153
          # the command line is too long to link in one step, link in parts
 
5154
          $echo "using piecewise archive linking..."
 
5155
          save_RANLIB=$RANLIB
 
5156
          RANLIB=:
 
5157
          objlist=
 
5158
          concat_cmds=
 
5159
          save_oldobjs=$oldobjs
 
5160
 
 
5161
          # Is there a better way of finding the last object in the list?
 
5162
          for obj in $save_oldobjs
 
5163
          do
 
5164
            last_oldobj=$obj
 
5165
          done
 
5166
          for obj in $save_oldobjs
 
5167
          do
 
5168
            oldobjs="$objlist $obj"
 
5169
            objlist="$objlist $obj"
 
5170
            eval test_cmds=\"$old_archive_cmds\"
 
5171
            if len=`expr "X$test_cmds" : ".*"` &&
 
5172
               test "$len" -le "$max_cmd_len"; then
 
5173
              :
 
5174
            else
 
5175
              # the above command should be used before it gets too long
 
5176
              oldobjs=$objlist
 
5177
              if test "$obj" = "$last_oldobj" ; then
 
5178
                RANLIB=$save_RANLIB
 
5179
              fi
 
5180
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5181
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5182
              objlist=
 
5183
            fi
 
5184
          done
 
5185
          RANLIB=$save_RANLIB
 
5186
          oldobjs=$objlist
 
5187
          if test "X$oldobjs" = "X" ; then
 
5188
            eval cmds=\"\$concat_cmds\"
 
5189
          else
 
5190
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5191
          fi
 
5192
        fi
3857
5193
      fi
3858
5194
      save_ifs="$IFS"; IFS='~'
3859
5195
      for cmd in $cmds; do
 
5196
        eval cmd=\"$cmd\"
3860
5197
        IFS="$save_ifs"
3861
5198
        $show "$cmd"
3862
5199
        $run eval "$cmd" || exit $?
3888
5225
        fi
3889
5226
      done
3890
5227
      # Quote the link command for shipping.
3891
 
      relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@"
 
5228
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
3892
5229
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5230
      if test "$hardcode_automatic" = yes ; then
 
5231
        relink_command=
 
5232
      fi
 
5233
 
3893
5234
 
3894
5235
      # Only create the output if not a dry run.
3895
5236
      if test -z "$run"; then
3905
5246
              case $deplib in
3906
5247
              *.la)
3907
5248
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3908
 
                eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
5249
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3909
5250
                if test -z "$libdir"; then
3910
5251
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3911
 
                  exit 1
 
5252
                  exit $EXIT_FAILURE
3912
5253
                fi
3913
5254
                newdependency_libs="$newdependency_libs $libdir/$name"
3914
5255
                ;;
3919
5260
            newdlfiles=
3920
5261
            for lib in $dlfiles; do
3921
5262
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3922
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5263
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3923
5264
              if test -z "$libdir"; then
3924
5265
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3925
 
                exit 1
 
5266
                exit $EXIT_FAILURE
3926
5267
              fi
3927
5268
              newdlfiles="$newdlfiles $libdir/$name"
3928
5269
            done
3930
5271
            newdlprefiles=
3931
5272
            for lib in $dlprefiles; do
3932
5273
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3933
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5274
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3934
5275
              if test -z "$libdir"; then
3935
5276
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3936
 
                exit 1
 
5277
                exit $EXIT_FAILURE
3937
5278
              fi
3938
5279
              newdlprefiles="$newdlprefiles $libdir/$name"
3939
5280
            done
3940
5281
            dlprefiles="$newdlprefiles"
 
5282
          else
 
5283
            newdlfiles=
 
5284
            for lib in $dlfiles; do
 
5285
              case $lib in
 
5286
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5287
                *) abs=`pwd`"/$lib" ;;
 
5288
              esac
 
5289
              newdlfiles="$newdlfiles $abs"
 
5290
            done
 
5291
            dlfiles="$newdlfiles"
 
5292
            newdlprefiles=
 
5293
            for lib in $dlprefiles; do
 
5294
              case $lib in
 
5295
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5296
                *) abs=`pwd`"/$lib" ;;
 
5297
              esac
 
5298
              newdlprefiles="$newdlprefiles $abs"
 
5299
            done
 
5300
            dlprefiles="$newdlprefiles"
3941
5301
          fi
3942
5302
          $rm $output
3943
5303
          # place dlname in correct position for cygwin
3944
5304
          tdlname=$dlname
3945
5305
          case $host,$output,$installed,$module,$dlname in
3946
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5306
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3947
5307
          esac
3948
5308
          $echo > $output "\
3949
5309
# $outputname - a libtool library file
3972
5332
# Is this an already installed library?
3973
5333
installed=$installed
3974
5334
 
 
5335
# Should we warn about portability when linking against -modules?
 
5336
shouldnotlink=$module
 
5337
 
3975
5338
# Files to dlopen/dlpreopen
3976
5339
dlopen='$dlfiles'
3977
5340
dlpreopen='$dlprefiles'
3978
5341
 
3979
5342
# Directory that this library needs to be installed in:
3980
5343
libdir='$install_libdir'"
3981
 
          if test "$installed" = no && test $need_relink = yes; then
 
5344
          if test "$installed" = no && test "$need_relink" = yes; then
3982
5345
            $echo >> $output "\
3983
5346
relink_command=\"$relink_command\""
3984
5347
          fi
3991
5354
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3992
5355
      ;;
3993
5356
    esac
3994
 
    exit 0
 
5357
    exit $EXIT_SUCCESS
3995
5358
    ;;
3996
5359
 
3997
5360
  # libtool install mode
4006
5369
      # Aesthetically quote it.
4007
5370
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4008
5371
      case $arg in
4009
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5372
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
4010
5373
        arg="\"$arg\""
4011
5374
        ;;
4012
5375
      esac
4022
5385
    # Aesthetically quote it.
4023
5386
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4024
5387
    case $arg in
4025
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5388
    *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
4026
5389
      arg="\"$arg\""
4027
5390
      ;;
4028
5391
    esac
4070
5433
      # Aesthetically quote the argument.
4071
5434
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4072
5435
      case $arg in
4073
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5436
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
4074
5437
        arg="\"$arg\""
4075
5438
        ;;
4076
5439
      esac
4080
5443
    if test -z "$install_prog"; then
4081
5444
      $echo "$modename: you must specify an install program" 1>&2
4082
5445
      $echo "$help" 1>&2
4083
 
      exit 1
 
5446
      exit $EXIT_FAILURE
4084
5447
    fi
4085
5448
 
4086
5449
    if test -n "$prev"; then
4087
5450
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4088
5451
      $echo "$help" 1>&2
4089
 
      exit 1
 
5452
      exit $EXIT_FAILURE
4090
5453
    fi
4091
5454
 
4092
5455
    if test -z "$files"; then
4096
5459
        $echo "$modename: you must specify a destination" 1>&2
4097
5460
      fi
4098
5461
      $echo "$help" 1>&2
4099
 
      exit 1
 
5462
      exit $EXIT_FAILURE
4100
5463
    fi
4101
5464
 
4102
5465
    # Strip any trailing slash from the destination.
4114
5477
 
4115
5478
      # Not a directory, so check to see that there is only one file specified.
4116
5479
      set dummy $files
4117
 
      if test $# -gt 2; then
 
5480
      if test "$#" -gt 2; then
4118
5481
        $echo "$modename: \`$dest' is not a directory" 1>&2
4119
5482
        $echo "$help" 1>&2
4120
 
        exit 1
 
5483
        exit $EXIT_FAILURE
4121
5484
      fi
4122
5485
    fi
4123
5486
    case $destdir in
4129
5492
        *)
4130
5493
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4131
5494
          $echo "$help" 1>&2
4132
 
          exit 1
 
5495
          exit $EXIT_FAILURE
4133
5496
          ;;
4134
5497
        esac
4135
5498
      done
4154
5517
 
4155
5518
      *.la)
4156
5519
        # Check to see that this really is a libtool archive.
4157
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5520
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4158
5521
        else
4159
5522
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4160
5523
          $echo "$help" 1>&2
4161
 
          exit 1
 
5524
          exit $EXIT_FAILURE
4162
5525
        fi
4163
5526
 
4164
5527
        library_names=
4190
5553
 
4191
5554
        if test -n "$relink_command"; then
4192
5555
          # Determine the prefix the user has applied to our future dir.
4193
 
          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
 
5556
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
4194
5557
 
4195
5558
          # Don't allow the user to place us outside of our expected
4196
5559
          # location b/c this prevents finding dependent libraries that
4197
5560
          # are installed to the same prefix.
 
5561
          # At present, this check doesn't affect windows .dll's that
 
5562
          # are installed into $libdir/../bin (currently, that works fine)
 
5563
          # but it's something to keep an eye on.
4198
5564
          if test "$inst_prefix_dir" = "$destdir"; then
4199
5565
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4200
 
            exit 1
 
5566
            exit $EXIT_FAILURE
4201
5567
          fi
4202
5568
 
4203
5569
          if test -n "$inst_prefix_dir"; then
4204
5570
            # Stick the inst_prefix_dir data into the link command.
4205
 
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5571
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4206
5572
          else
4207
 
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
 
5573
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4208
5574
          fi
4209
5575
 
4210
5576
          $echo "$modename: warning: relinking \`$file'" 1>&2
4212
5578
          if $run eval "$relink_command"; then :
4213
5579
          else
4214
5580
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4215
 
            continue
 
5581
            exit $EXIT_FAILURE
4216
5582
          fi
4217
5583
        fi
4218
5584
 
4234
5600
            $run eval "$striplib $destdir/$realname" || exit $?
4235
5601
          fi
4236
5602
 
4237
 
          if test $# -gt 0; then
 
5603
          if test "$#" -gt 0; then
4238
5604
            # Delete the old symlinks, and create new ones.
4239
5605
            for linkname
4240
5606
            do
4247
5613
 
4248
5614
          # Do each command in the postinstall commands.
4249
5615
          lib="$destdir/$realname"
4250
 
          eval cmds=\"$postinstall_cmds\"
 
5616
          cmds=$postinstall_cmds
4251
5617
          save_ifs="$IFS"; IFS='~'
4252
5618
          for cmd in $cmds; do
4253
5619
            IFS="$save_ifs"
 
5620
            eval cmd=\"$cmd\"
4254
5621
            $show "$cmd"
4255
5622
            $run eval "$cmd" || exit $?
4256
5623
          done
4290
5657
        *)
4291
5658
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4292
5659
          $echo "$help" 1>&2
4293
 
          exit 1
 
5660
          exit $EXIT_FAILURE
4294
5661
          ;;
4295
5662
        esac
4296
5663
 
4308
5675
          $show "$install_prog $staticobj $staticdest"
4309
5676
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4310
5677
        fi
4311
 
        exit 0
 
5678
        exit $EXIT_SUCCESS
4312
5679
        ;;
4313
5680
 
4314
5681
      *)
4320
5687
          destfile="$destdir/$destfile"
4321
5688
        fi
4322
5689
 
 
5690
        # If the file is missing, and there is a .exe on the end, strip it
 
5691
        # because it is most likely a libtool script we actually want to
 
5692
        # install
 
5693
        stripped_ext=""
 
5694
        case $file in
 
5695
          *.exe)
 
5696
            if test ! -f "$file"; then
 
5697
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5698
              stripped_ext=".exe"
 
5699
            fi
 
5700
            ;;
 
5701
        esac
 
5702
 
4323
5703
        # Do a test to see if this is really a libtool program.
4324
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
5704
        case $host in
 
5705
        *cygwin*|*mingw*)
 
5706
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
 
5707
            ;;
 
5708
        *)
 
5709
            wrapper=$file
 
5710
            ;;
 
5711
        esac
 
5712
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4325
5713
          notinst_deplibs=
4326
5714
          relink_command=
4327
5715
 
 
5716
          # To insure that "foo" is sourced, and not "foo.exe",
 
5717
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5718
          # which disallows the automatic-append-.exe behavior.
 
5719
          case $build in
 
5720
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5721
          *) wrapperdot=${wrapper} ;;
 
5722
          esac
4328
5723
          # If there is no directory component, then add one.
4329
5724
          case $file in
4330
 
          */* | *\\*) . $file ;;
4331
 
          *) . ./$file ;;
 
5725
          */* | *\\*) . ${wrapperdot} ;;
 
5726
          *) . ./${wrapperdot} ;;
4332
5727
          esac
4333
5728
 
4334
5729
          # Check the variables that should have been set.
4335
5730
          if test -z "$notinst_deplibs"; then
4336
 
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4337
 
            exit 1
 
5731
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
 
5732
            exit $EXIT_FAILURE
4338
5733
          fi
4339
5734
 
4340
5735
          finalize=yes
4356
5751
          done
4357
5752
 
4358
5753
          relink_command=
 
5754
          # To insure that "foo" is sourced, and not "foo.exe",
 
5755
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
 
5756
          # which disallows the automatic-append-.exe behavior.
 
5757
          case $build in
 
5758
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
 
5759
          *) wrapperdot=${wrapper} ;;
 
5760
          esac
4359
5761
          # If there is no directory component, then add one.
4360
5762
          case $file in
4361
 
          */* | *\\*) . $file ;;
4362
 
          *) . ./$file ;;
 
5763
          */* | *\\*) . ${wrapperdot} ;;
 
5764
          *) . ./${wrapperdot} ;;
4363
5765
          esac
4364
5766
 
4365
5767
          outputname=
4368
5770
              tmpdir="/tmp"
4369
5771
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4370
5772
              tmpdir="$tmpdir/libtool-$$"
4371
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5773
              save_umask=`umask`
 
5774
              umask 0077
 
5775
              if $mkdir "$tmpdir"; then
 
5776
                umask $save_umask
4372
5777
              else
 
5778
                umask $save_umask
4373
5779
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4374
5780
                continue
4375
5781
              fi
4376
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
5782
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4377
5783
              outputname="$tmpdir/$file"
4378
5784
              # Replace the output file specification.
4379
5785
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4391
5797
            fi
4392
5798
          else
4393
5799
            # Install the binary that we compiled earlier.
4394
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5800
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4395
5801
          fi
4396
5802
        fi
4397
5803
 
4398
5804
        # remove .exe since cygwin /usr/bin/install will append another
4399
5805
        # one anyways
4400
5806
        case $install_prog,$host in
4401
 
        /usr/bin/install*,*cygwin*)
 
5807
        */usr/bin/install*,*cygwin*)
4402
5808
          case $file:$destfile in
4403
5809
          *.exe:*.exe)
4404
5810
            # this is ok
4407
5813
            destfile=$destfile.exe
4408
5814
            ;;
4409
5815
          *:*.exe)
4410
 
            destfile=`echo $destfile | sed -e 's,.exe$,,'`
 
5816
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4411
5817
            ;;
4412
5818
          esac
4413
5819
          ;;
4428
5834
      $show "$install_prog $file $oldlib"
4429
5835
      $run eval "$install_prog \$file \$oldlib" || exit $?
4430
5836
 
4431
 
      if test -n "$stripme" && test -n "$striplib"; then
 
5837
      if test -n "$stripme" && test -n "$old_striplib"; then
4432
5838
        $show "$old_striplib $oldlib"
4433
5839
        $run eval "$old_striplib $oldlib" || exit $?
4434
5840
      fi
4435
5841
 
4436
5842
      # Do each command in the postinstall commands.
4437
 
      eval cmds=\"$old_postinstall_cmds\"
 
5843
      cmds=$old_postinstall_cmds
4438
5844
      save_ifs="$IFS"; IFS='~'
4439
5845
      for cmd in $cmds; do
4440
5846
        IFS="$save_ifs"
 
5847
        eval cmd=\"$cmd\"
4441
5848
        $show "$cmd"
4442
5849
        $run eval "$cmd" || exit $?
4443
5850
      done
4451
5858
    if test -n "$current_libdirs"; then
4452
5859
      # Maybe just do a dry run.
4453
5860
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4454
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
5861
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
4455
5862
    else
4456
 
      exit 0
 
5863
      exit $EXIT_SUCCESS
4457
5864
    fi
4458
5865
    ;;
4459
5866
 
4472
5879
      for libdir in $libdirs; do
4473
5880
        if test -n "$finish_cmds"; then
4474
5881
          # Do each command in the finish commands.
4475
 
          eval cmds=\"$finish_cmds\"
 
5882
          cmds=$finish_cmds
4476
5883
          save_ifs="$IFS"; IFS='~'
4477
5884
          for cmd in $cmds; do
4478
5885
            IFS="$save_ifs"
 
5886
            eval cmd=\"$cmd\"
4479
5887
            $show "$cmd"
4480
5888
            $run eval "$cmd" || admincmds="$admincmds
4481
5889
       $cmd"
4492
5900
    fi
4493
5901
 
4494
5902
    # Exit here if they wanted silent mode.
4495
 
    test "$show" = ":" && exit 0
 
5903
    test "$show" = : && exit $EXIT_SUCCESS
4496
5904
 
4497
 
    echo "----------------------------------------------------------------------"
4498
 
    echo "Libraries have been installed in:"
 
5905
    $echo "----------------------------------------------------------------------"
 
5906
    $echo "Libraries have been installed in:"
4499
5907
    for libdir in $libdirs; do
4500
 
      echo "   $libdir"
 
5908
      $echo "   $libdir"
4501
5909
    done
4502
 
    echo
4503
 
    echo "If you ever happen to want to link against installed libraries"
4504
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4505
 
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4506
 
    echo "flag during linking and do at least one of the following:"
 
5910
    $echo
 
5911
    $echo "If you ever happen to want to link against installed libraries"
 
5912
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5913
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5914
    $echo "flag during linking and do at least one of the following:"
4507
5915
    if test -n "$shlibpath_var"; then
4508
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4509
 
      echo "     during execution"
 
5916
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5917
      $echo "     during execution"
4510
5918
    fi
4511
5919
    if test -n "$runpath_var"; then
4512
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4513
 
      echo "     during linking"
 
5920
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5921
      $echo "     during linking"
4514
5922
    fi
4515
5923
    if test -n "$hardcode_libdir_flag_spec"; then
4516
5924
      libdir=LIBDIR
4517
5925
      eval flag=\"$hardcode_libdir_flag_spec\"
4518
5926
 
4519
 
      echo "   - use the \`$flag' linker flag"
 
5927
      $echo "   - use the \`$flag' linker flag"
4520
5928
    fi
4521
5929
    if test -n "$admincmds"; then
4522
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5930
      $echo "   - have your system administrator run these commands:$admincmds"
4523
5931
    fi
4524
5932
    if test -f /etc/ld.so.conf; then
4525
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5933
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4526
5934
    fi
4527
 
    echo
4528
 
    echo "See any operating system documentation about shared libraries for"
4529
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4530
 
    echo "----------------------------------------------------------------------"
4531
 
    exit 0
 
5935
    $echo
 
5936
    $echo "See any operating system documentation about shared libraries for"
 
5937
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5938
    $echo "----------------------------------------------------------------------"
 
5939
    exit $EXIT_SUCCESS
4532
5940
    ;;
4533
5941
 
4534
5942
  # libtool execute mode
4540
5948
    if test -z "$cmd"; then
4541
5949
      $echo "$modename: you must specify a COMMAND" 1>&2
4542
5950
      $echo "$help"
4543
 
      exit 1
 
5951
      exit $EXIT_FAILURE
4544
5952
    fi
4545
5953
 
4546
5954
    # Handle -dlopen flags immediately.
4548
5956
      if test ! -f "$file"; then
4549
5957
        $echo "$modename: \`$file' is not a file" 1>&2
4550
5958
        $echo "$help" 1>&2
4551
 
        exit 1
 
5959
        exit $EXIT_FAILURE
4552
5960
      fi
4553
5961
 
4554
5962
      dir=
4555
5963
      case $file in
4556
5964
      *.la)
4557
5965
        # Check to see that this really is a libtool archive.
4558
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5966
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4559
5967
        else
4560
5968
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4561
5969
          $echo "$help" 1>&2
4562
 
          exit 1
 
5970
          exit $EXIT_FAILURE
4563
5971
        fi
4564
5972
 
4565
5973
        # Read the libtool library.
4586
5994
          dir="$dir/$objdir"
4587
5995
        else
4588
5996
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4589
 
          exit 1
 
5997
          exit $EXIT_FAILURE
4590
5998
        fi
4591
5999
        ;;
4592
6000
 
4626
6034
      -*) ;;
4627
6035
      *)
4628
6036
        # Do a test to see if this is really a libtool program.
4629
 
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6037
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4630
6038
          # If there is no directory component, then add one.
4631
6039
          case $file in
4632
6040
          */* | *\\*) . $file ;;
4649
6057
        eval "export $shlibpath_var"
4650
6058
      fi
4651
6059
 
4652
 
      # Restore saved enviroment variables
 
6060
      # Restore saved environment variables
4653
6061
      if test "${save_LC_ALL+set}" = set; then
4654
6062
        LC_ALL="$save_LC_ALL"; export LC_ALL
4655
6063
      fi
4658
6066
      fi
4659
6067
 
4660
6068
      # Now prepare to actually exec the command.
4661
 
      exec_cmd='"$cmd"$args'
 
6069
      exec_cmd="\$cmd$args"
4662
6070
    else
4663
6071
      # Display what would be done.
4664
6072
      if test -n "$shlibpath_var"; then
4666
6074
        $echo "export $shlibpath_var"
4667
6075
      fi
4668
6076
      $echo "$cmd$args"
4669
 
      exit 0
 
6077
      exit $EXIT_SUCCESS
4670
6078
    fi
4671
6079
    ;;
4672
6080
 
4694
6102
    if test -z "$rm"; then
4695
6103
      $echo "$modename: you must specify an RM program" 1>&2
4696
6104
      $echo "$help" 1>&2
4697
 
      exit 1
 
6105
      exit $EXIT_FAILURE
4698
6106
    fi
4699
6107
 
4700
6108
    rmdirs=
4701
6109
 
 
6110
    origobjdir="$objdir"
4702
6111
    for file in $files; do
4703
6112
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4704
6113
      if test "X$dir" = "X$file"; then
4705
6114
        dir=.
4706
 
        objdir="$objdir"
 
6115
        objdir="$origobjdir"
4707
6116
      else
4708
 
        objdir="$dir/$objdir"
 
6117
        objdir="$dir/$origobjdir"
4709
6118
      fi
4710
6119
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4711
 
      test $mode = uninstall && objdir="$dir"
 
6120
      test "$mode" = uninstall && objdir="$dir"
4712
6121
 
4713
6122
      # Remember objdir for removal later, being careful to avoid duplicates
4714
 
      if test $mode = clean; then
 
6123
      if test "$mode" = clean; then
4715
6124
        case " $rmdirs " in
4716
6125
          *" $objdir "*) ;;
4717
6126
          *) rmdirs="$rmdirs $objdir" ;;
4735
6144
      case $name in
4736
6145
      *.la)
4737
6146
        # Possibly a libtool archive, so verify it.
4738
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6147
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4739
6148
          . $dir/$name
4740
6149
 
4741
6150
          # Delete the libtool libraries and symlinks.
4743
6152
            rmfiles="$rmfiles $objdir/$n"
4744
6153
          done
4745
6154
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4746
 
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6155
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4747
6156
 
4748
 
          if test $mode = uninstall; then
 
6157
          if test "$mode" = uninstall; then
4749
6158
            if test -n "$library_names"; then
4750
6159
              # Do each command in the postuninstall commands.
4751
 
              eval cmds=\"$postuninstall_cmds\"
 
6160
              cmds=$postuninstall_cmds
4752
6161
              save_ifs="$IFS"; IFS='~'
4753
6162
              for cmd in $cmds; do
4754
6163
                IFS="$save_ifs"
 
6164
                eval cmd=\"$cmd\"
4755
6165
                $show "$cmd"
4756
6166
                $run eval "$cmd"
4757
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6167
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4758
6168
                  exit_status=1
4759
6169
                fi
4760
6170
              done
4763
6173
 
4764
6174
            if test -n "$old_library"; then
4765
6175
              # Do each command in the old_postuninstall commands.
4766
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6176
              cmds=$old_postuninstall_cmds
4767
6177
              save_ifs="$IFS"; IFS='~'
4768
6178
              for cmd in $cmds; do
4769
6179
                IFS="$save_ifs"
 
6180
                eval cmd=\"$cmd\"
4770
6181
                $show "$cmd"
4771
6182
                $run eval "$cmd"
4772
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6183
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4773
6184
                  exit_status=1
4774
6185
                fi
4775
6186
              done
4781
6192
        ;;
4782
6193
 
4783
6194
      *.lo)
4784
 
        if test "$build_old_libs" = yes; then
4785
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4786
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6195
        # Possibly a libtool object, so verify it.
 
6196
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6197
 
 
6198
          # Read the .lo file
 
6199
          . $dir/$name
 
6200
 
 
6201
          # Add PIC object to the list of files to remove.
 
6202
          if test -n "$pic_object" \
 
6203
             && test "$pic_object" != none; then
 
6204
            rmfiles="$rmfiles $dir/$pic_object"
 
6205
          fi
 
6206
 
 
6207
          # Add non-PIC object to the list of files to remove.
 
6208
          if test -n "$non_pic_object" \
 
6209
             && test "$non_pic_object" != none; then
 
6210
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6211
          fi
4787
6212
        fi
4788
6213
        ;;
4789
6214
 
4790
6215
      *)
4791
 
        # Do a test to see if this is a libtool program.
4792
 
        if test $mode = clean &&
4793
 
           (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4794
 
          relink_command=
4795
 
          . $dir/$file
 
6216
        if test "$mode" = clean ; then
 
6217
          noexename=$name
 
6218
          case $file in
 
6219
          *.exe)
 
6220
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6221
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6222
            # $file with .exe has already been added to rmfiles,
 
6223
            # add $file without .exe
 
6224
            rmfiles="$rmfiles $file"
 
6225
            ;;
 
6226
          esac
 
6227
          # Do a test to see if this is a libtool program.
 
6228
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6229
            relink_command=
 
6230
            . $dir/$noexename
4796
6231
 
4797
 
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4798
 
          if test "$fast_install" = yes && test -n "$relink_command"; then
4799
 
            rmfiles="$rmfiles $objdir/lt-$name"
 
6232
            # note $name still contains .exe if it was in $file originally
 
6233
            # as does the version of $file that was added into $rmfiles
 
6234
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6235
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6236
              rmfiles="$rmfiles $objdir/lt-$name"
 
6237
            fi
 
6238
            if test "X$noexename" != "X$name" ; then
 
6239
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6240
            fi
4800
6241
          fi
4801
6242
        fi
4802
6243
        ;;
4804
6245
      $show "$rm $rmfiles"
4805
6246
      $run $rm $rmfiles || exit_status=1
4806
6247
    done
 
6248
    objdir="$origobjdir"
4807
6249
 
4808
6250
    # Try to remove the ${objdir}s in the directories where we deleted files
4809
6251
    for dir in $rmdirs; do
4819
6261
  "")
4820
6262
    $echo "$modename: you must specify a MODE" 1>&2
4821
6263
    $echo "$generic_help" 1>&2
4822
 
    exit 1
 
6264
    exit $EXIT_FAILURE
4823
6265
    ;;
4824
6266
  esac
4825
6267
 
4826
6268
  if test -z "$exec_cmd"; then
4827
6269
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
4828
6270
    $echo "$generic_help" 1>&2
4829
 
    exit 1
 
6271
    exit $EXIT_FAILURE
4830
6272
  fi
4831
6273
fi # test -z "$show_help"
4832
6274
 
4833
6275
if test -n "$exec_cmd"; then
4834
6276
  eval exec $exec_cmd
4835
 
  exit 1
 
6277
  exit $EXIT_FAILURE
4836
6278
fi
4837
6279
 
4838
6280
# We need to display help for each of the modes.
4851
6293
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4852
6294
    --quiet           same as \`--silent'
4853
6295
    --silent          don't print informational messages
 
6296
    --tag=TAG         use configuration variables from tag TAG
4854
6297
    --version         print version information
4855
6298
 
4856
6299
MODE must be one of the following:
4864
6307
      uninstall       remove libraries from an installed directory
4865
6308
 
4866
6309
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4867
 
a more detailed description of MODE."
4868
 
  exit 0
 
6310
a more detailed description of MODE.
 
6311
 
 
6312
Report bugs to <bug-libtool@gnu.org>."
 
6313
  exit $EXIT_SUCCESS
4869
6314
  ;;
4870
6315
 
4871
6316
clean)
4976
6421
  -no-install       link a not-installable executable
4977
6422
  -no-undefined     declare that a library does not refer to external symbols
4978
6423
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6424
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6425
  -precious-files-regex REGEX
 
6426
                    don't remove output files matching REGEX
4979
6427
  -release RELEASE  specify package release information
4980
6428
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
4981
6429
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5017
6465
*)
5018
6466
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5019
6467
  $echo "$help" 1>&2
5020
 
  exit 1
 
6468
  exit $EXIT_FAILURE
5021
6469
  ;;
5022
6470
esac
5023
6471
 
5024
 
echo
 
6472
$echo
5025
6473
$echo "Try \`$modename --help' for more information about other modes."
5026
6474
 
5027
 
exit 0
 
6475
exit $?
 
6476
 
 
6477
# The TAGs below are defined such that we never get into a situation
 
6478
# in which we disable both kinds of libraries.  Given conflicting
 
6479
# choices, we go for a static library, that is the most portable,
 
6480
# since we can't tell whether shared libraries were disabled because
 
6481
# the user asked for that or because the platform doesn't support
 
6482
# them.  This is particularly important on AIX, because we don't
 
6483
# support having both static and shared libraries enabled at the same
 
6484
# time on that platform, so we default to a shared-only configuration.
 
6485
# If a disable-shared tag is given, we'll fallback to a static-only
 
6486
# configuration.  But we'll never go from static-only to shared-only.
 
6487
 
 
6488
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6489
build_libtool_libs=no
 
6490
build_old_libs=yes
 
6491
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6492
 
 
6493
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6494
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6495
# ### END LIBTOOL TAG CONFIG: disable-static
5028
6496
 
5029
6497
# Local Variables:
5030
6498
# mode:shell-script