~ubuntu-branches/ubuntu/precise/devil/precise

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Bradley Smith
  • Date: 2009-01-17 15:01:18 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090117150118-4bwb6nmvbz4srsjl
Tags: 1.7.5-4
Actually fix CVE-2008-5262. Closes: #512122.

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, 2003
5
 
# Free Software Foundation, Inc.
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
 
5
# 2007, 2008  Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
8
8
# This program is free software; you can redistribute it and/or modify
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.26 Debian 1.5.26-1ubuntu1"
 
47
TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
 
48
 
 
49
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
 
50
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
 
51
  emulate sh
 
52
  NULLCMD=:
 
53
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
 
54
  # is contrary to our usage.  Disable this feature.
 
55
  alias -g '${1+"$@"}'='"$@"'
 
56
  setopt NO_GLOB_SUBST
 
57
else
 
58
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 
59
fi
 
60
BIN_SH=xpg4; export BIN_SH # for Tru64
 
61
DUALCASE=1; export DUALCASE # for MKS sh
 
62
 
27
63
# Check that we have a working $echo.
28
64
if test "X$1" = X--no-reexec; then
29
65
  # Discard the --no-reexec flag, and continue.
36
72
  :
37
73
else
38
74
  # Restart under the correct shell, and then maybe $echo will work.
39
 
  exec $SHELL "$0" --no-reexec ${1+"$@"}
 
75
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
40
76
fi
41
77
 
42
78
if test "X$1" = X--fallback-echo; then
45
81
  cat <<EOF
46
82
$*
47
83
EOF
48
 
  exit 0
 
84
  exit $EXIT_SUCCESS
49
85
fi
50
86
 
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.5
59
 
TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)"
60
 
 
61
87
default_mode=
62
88
help="Try \`$progname --help' for more information."
63
89
magic="%%%MAGIC variable%%%"
70
96
Xsed="${SED}"' -e 1s/^X//'
71
97
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
98
# test EBCDIC or ASCII
73
 
case `echo A|od -x` in
74
 
 *[Cc]1*) # EBCDIC based system
75
 
  SP2NL="tr '\100' '\n'"
76
 
  NL2SP="tr '\r\n' '\100\100'"
 
99
case `echo X|tr X '\101'` in
 
100
 A) # ASCII based system
 
101
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
 
102
  SP2NL='tr \040 \012'
 
103
  NL2SP='tr \015\012 \040\040'
77
104
  ;;
78
 
 *) # Assume ASCII based system
79
 
  SP2NL="tr '\040' '\012'"
80
 
  NL2SP="tr '\015\012' '\040\040'"
 
105
 *) # EBCDIC based system
 
106
  SP2NL='tr \100 \n'
 
107
  NL2SP='tr \r\n \100\100'
81
108
  ;;
82
109
esac
83
110
 
86
113
# These must not be set unconditionally because not all systems understand
87
114
# e.g. LANG=C (notably SCO).
88
115
# We save the old values to restore during execute mode.
89
 
if test "${LC_ALL+set}" = set; then
90
 
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
91
 
fi
92
 
if test "${LANG+set}" = set; then
93
 
  save_LANG="$LANG"; LANG=C; export LANG
 
116
lt_env=
 
117
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
118
do
 
119
  eval "if test \"\${$lt_var+set}\" = set; then
 
120
          save_$lt_var=\$$lt_var
 
121
          lt_env=\"$lt_var=\$$lt_var \$lt_env\"
 
122
          $lt_var=C
 
123
          export $lt_var
 
124
        fi"
 
125
done
 
126
 
 
127
if test -n "$lt_env"; then
 
128
  lt_env="env $lt_env"
94
129
fi
95
130
 
96
131
# Make sure IFS has a sensible default
97
 
: ${IFS="       "}
 
132
lt_nl='
 
133
'
 
134
IFS="   $lt_nl"
98
135
 
99
136
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100
137
  $echo "$modename: not configured to build any kind of library" 1>&2
101
138
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
102
 
  exit 1
 
139
  exit $EXIT_FAILURE
103
140
fi
104
141
 
105
142
# Global variables.
111
148
show="$echo"
112
149
show_help=
113
150
execute_dlfiles=
 
151
duplicate_deps=no
 
152
preserve_args=
114
153
lo2o="s/\\.lo\$/.${objext}/"
115
154
o2lo="s/\\.${objext}\$/.lo/"
 
155
extracted_archives=
 
156
extracted_serial=0
116
157
 
117
158
#####################################
118
159
# Shell function definitions:
119
160
# This seems to be the best place for them
120
161
 
 
162
# func_mktempdir [string]
 
163
# Make a temporary directory that won't clash with other running
 
164
# libtool processes, and avoids race conditions if possible.  If
 
165
# given, STRING is the basename for that directory.
 
166
func_mktempdir ()
 
167
{
 
168
    my_template="${TMPDIR-/tmp}/${1-$progname}"
 
169
 
 
170
    if test "$run" = ":"; then
 
171
      # Return a directory name, but don't create it in dry-run mode
 
172
      my_tmpdir="${my_template}-$$"
 
173
    else
 
174
 
 
175
      # If mktemp works, use that first and foremost
 
176
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
177
 
 
178
      if test ! -d "$my_tmpdir"; then
 
179
        # Failing that, at least try and use $RANDOM to avoid a race
 
180
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
181
 
 
182
        save_mktempdir_umask=`umask`
 
183
        umask 0077
 
184
        $mkdir "$my_tmpdir"
 
185
        umask $save_mktempdir_umask
 
186
      fi
 
187
 
 
188
      # If we're not in dry-run mode, bomb out on failure
 
189
      test -d "$my_tmpdir" || {
 
190
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
 
191
        exit $EXIT_FAILURE
 
192
      }
 
193
    fi
 
194
 
 
195
    $echo "X$my_tmpdir" | $Xsed
 
196
}
 
197
 
 
198
 
 
199
# func_win32_libid arg
 
200
# return the library type of file 'arg'
 
201
#
121
202
# Need a lot of goo to handle *both* DLLs and import libs
122
203
# Has to be a shell function in order to 'eat' the argument
123
204
# that is supplied when $file_magic_command is called.
124
 
win32_libid () {
 
205
func_win32_libid ()
 
206
{
125
207
  win32_libid_type="unknown"
126
208
  win32_fileres=`file -L $1 2>/dev/null`
127
209
  case $win32_fileres in
130
212
    ;;
131
213
  *ar\ archive*) # could be an import, or static
132
214
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
133
 
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
215
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
134
216
      win32_nmres=`eval $NM -f posix -A $1 | \
135
 
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
136
 
      if test "X$win32_nmres" = "Ximport" ; then
137
 
        win32_libid_type="x86 archive import"
138
 
      else
139
 
        win32_libid_type="x86 archive static"
140
 
      fi
 
217
        $SED -n -e '1,100{
 
218
                / I /{
 
219
                        s,.*,import,
 
220
                        p
 
221
                        q
 
222
                        }
 
223
                }'`
 
224
      case $win32_nmres in
 
225
      import*)  win32_libid_type="x86 archive import";;
 
226
      *)        win32_libid_type="x86 archive static";;
 
227
      esac
141
228
    fi
142
229
    ;;
143
 
  *DLL*) 
 
230
  *DLL*)
144
231
    win32_libid_type="x86 DLL"
145
232
    ;;
146
233
  *executable*) # but shell scripts are "executable" too...
154
241
  $echo $win32_libid_type
155
242
}
156
243
 
 
244
 
 
245
# func_infer_tag arg
 
246
# Infer tagged configuration to use if any are available and
 
247
# if one wasn't chosen via the "--tag" command line option.
 
248
# Only attempt this if the compiler in the base compile
 
249
# command doesn't match the default compiler.
 
250
# arg is usually of the form 'gcc ...'
 
251
func_infer_tag ()
 
252
{
 
253
    if test -n "$available_tags" && test -z "$tagname"; then
 
254
      CC_quoted=
 
255
      for arg in $CC; do
 
256
        case $arg in
 
257
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
258
          arg="\"$arg\""
 
259
          ;;
 
260
        esac
 
261
        CC_quoted="$CC_quoted $arg"
 
262
      done
 
263
      case $@ in
 
264
      # Blanks in the command may have been stripped by the calling shell,
 
265
      # but not from the CC environment variable when configure was run.
 
266
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
267
      # Blanks at the start of $base_compile will cause this to fail
 
268
      # if we don't check for them as well.
 
269
      *)
 
270
        for z in $available_tags; do
 
271
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
272
            # Evaluate the configuration.
 
273
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
274
            CC_quoted=
 
275
            for arg in $CC; do
 
276
            # Double-quote args containing other shell metacharacters.
 
277
            case $arg in
 
278
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
279
              arg="\"$arg\""
 
280
              ;;
 
281
            esac
 
282
            CC_quoted="$CC_quoted $arg"
 
283
          done
 
284
            case "$@ " in
 
285
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
286
              # The compiler in the base compile command matches
 
287
              # the one in the tagged configuration.
 
288
              # Assume this is the tagged configuration we want.
 
289
              tagname=$z
 
290
              break
 
291
              ;;
 
292
            esac
 
293
          fi
 
294
        done
 
295
        # If $tagname still isn't set, then no tagged configuration
 
296
        # was found and let the user know that the "--tag" command
 
297
        # line option must be used.
 
298
        if test -z "$tagname"; then
 
299
          $echo "$modename: unable to infer tagged configuration"
 
300
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
301
          exit $EXIT_FAILURE
 
302
#        else
 
303
#          $echo "$modename: using $tagname tagged configuration"
 
304
        fi
 
305
        ;;
 
306
      esac
 
307
    fi
 
308
}
 
309
 
 
310
 
 
311
# func_extract_an_archive dir oldlib
 
312
func_extract_an_archive ()
 
313
{
 
314
    f_ex_an_ar_dir="$1"; shift
 
315
    f_ex_an_ar_oldlib="$1"
 
316
 
 
317
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
 
318
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
 
319
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 
320
     :
 
321
    else
 
322
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
 
323
      exit $EXIT_FAILURE
 
324
    fi
 
325
}
 
326
 
 
327
# func_extract_archives gentop oldlib ...
 
328
func_extract_archives ()
 
329
{
 
330
    my_gentop="$1"; shift
 
331
    my_oldlibs=${1+"$@"}
 
332
    my_oldobjs=""
 
333
    my_xlib=""
 
334
    my_xabs=""
 
335
    my_xdir=""
 
336
    my_status=""
 
337
 
 
338
    $show "${rm}r $my_gentop"
 
339
    $run ${rm}r "$my_gentop"
 
340
    $show "$mkdir $my_gentop"
 
341
    $run $mkdir "$my_gentop"
 
342
    my_status=$?
 
343
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
 
344
      exit $my_status
 
345
    fi
 
346
 
 
347
    for my_xlib in $my_oldlibs; do
 
348
      # Extract the objects.
 
349
      case $my_xlib in
 
350
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
351
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
352
      esac
 
353
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
 
354
      my_xlib_u=$my_xlib
 
355
      while :; do
 
356
        case " $extracted_archives " in
 
357
        *" $my_xlib_u "*)
 
358
          extracted_serial=`expr $extracted_serial + 1`
 
359
          my_xlib_u=lt$extracted_serial-$my_xlib ;;
 
360
        *) break ;;
 
361
        esac
 
362
      done
 
363
      extracted_archives="$extracted_archives $my_xlib_u"
 
364
      my_xdir="$my_gentop/$my_xlib_u"
 
365
 
 
366
      $show "${rm}r $my_xdir"
 
367
      $run ${rm}r "$my_xdir"
 
368
      $show "$mkdir $my_xdir"
 
369
      $run $mkdir "$my_xdir"
 
370
      exit_status=$?
 
371
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
 
372
        exit $exit_status
 
373
      fi
 
374
      case $host in
 
375
      *-darwin*)
 
376
        $show "Extracting $my_xabs"
 
377
        # Do not bother doing anything if just a dry run
 
378
        if test -z "$run"; then
 
379
          darwin_orig_dir=`pwd`
 
380
          cd $my_xdir || exit $?
 
381
          darwin_archive=$my_xabs
 
382
          darwin_curdir=`pwd`
 
383
          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
 
384
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
 
385
          if test -n "$darwin_arches"; then 
 
386
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
 
387
            darwin_arch=
 
388
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
 
389
            for darwin_arch in  $darwin_arches ; do
 
390
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
391
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
392
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
393
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
394
              cd "$darwin_curdir"
 
395
              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
396
            done # $darwin_arches
 
397
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
 
398
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
 
399
            darwin_file=
 
400
            darwin_files=
 
401
            for darwin_file in $darwin_filelist; do
 
402
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 
403
              lipo -create -output "$darwin_file" $darwin_files
 
404
            done # $darwin_filelist
 
405
            ${rm}r unfat-$$
 
406
            cd "$darwin_orig_dir"
 
407
          else
 
408
            cd "$darwin_orig_dir"
 
409
            func_extract_an_archive "$my_xdir" "$my_xabs"
 
410
          fi # $darwin_arches
 
411
        fi # $run
 
412
        ;;
 
413
      *)
 
414
        func_extract_an_archive "$my_xdir" "$my_xabs"
 
415
        ;;
 
416
      esac
 
417
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
418
    done
 
419
    func_extract_archives_result="$my_oldobjs"
 
420
}
157
421
# End of Shell function definitions
158
422
#####################################
159
423
 
 
424
# Darwin sucks
 
425
eval std_shrext=\"$shrext_cmds\"
 
426
 
 
427
disable_libs=no
 
428
 
160
429
# Parse our command line options once, thoroughly.
161
430
while test "$#" -gt 0
162
431
do
176
445
      ;;
177
446
    tag)
178
447
      tagname="$arg"
 
448
      preserve_args="${preserve_args}=$arg"
179
449
 
180
450
      # Check whether tagname contains only valid characters
181
451
      case $tagname in
182
452
      *[!-_A-Za-z0-9,/]*)
183
453
        $echo "$progname: invalid tag name: $tagname" 1>&2
184
 
        exit 1
 
454
        exit $EXIT_FAILURE
185
455
        ;;
186
456
      esac
187
457
 
191
461
        # not specially marked.
192
462
        ;;
193
463
      *)
194
 
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
 
464
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
195
465
          taglist="$taglist $tagname"
196
466
          # Evaluate the configuration.
197
 
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
 
467
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
198
468
        else
199
469
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
200
470
        fi
218
488
    ;;
219
489
 
220
490
  --version)
221
 
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
222
 
    $echo
223
 
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
224
 
    $echo "This is free software; see the source for copying conditions.  There is NO"
225
 
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
226
 
    exit 0
 
491
    echo "\
 
492
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
 
493
 
 
494
Copyright (C) 2008  Free Software Foundation, Inc.
 
495
This is free software; see the source for copying conditions.  There is NO
 
496
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
497
    exit $?
227
498
    ;;
228
499
 
229
500
  --config)
230
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
 
501
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
231
502
    # Now print the configurations for the tags.
232
503
    for tagname in $taglist; do
233
 
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
 
504
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
234
505
    done
235
 
    exit 0
 
506
    exit $?
236
507
    ;;
237
508
 
238
509
  --debug)
239
510
    $echo "$progname: enabling shell trace mode"
240
511
    set -x
 
512
    preserve_args="$preserve_args $arg"
241
513
    ;;
242
514
 
243
515
  --dry-run | -n)
256
528
    else
257
529
      $echo "disable static libraries"
258
530
    fi
259
 
    exit 0
 
531
    exit $?
260
532
    ;;
261
533
 
262
534
  --finish) mode="finish" ;;
268
540
 
269
541
  --quiet | --silent)
270
542
    show=:
 
543
    preserve_args="$preserve_args $arg"
271
544
    ;;
272
545
 
273
 
  --tag) prevopt="--tag" prev=tag ;;
 
546
  --tag)
 
547
    prevopt="--tag"
 
548
    prev=tag
 
549
    preserve_args="$preserve_args --tag"
 
550
    ;;
274
551
  --tag=*)
275
552
    set tag "$optarg" ${1+"$@"}
276
553
    shift
277
554
    prev=tag
 
555
    preserve_args="$preserve_args --tag"
278
556
    ;;
279
557
 
280
558
  -dlopen)
285
563
  -*)
286
564
    $echo "$modename: unrecognized option \`$arg'" 1>&2
287
565
    $echo "$help" 1>&2
288
 
    exit 1
 
566
    exit $EXIT_FAILURE
289
567
    ;;
290
568
 
291
569
  *)
298
576
if test -n "$prevopt"; then
299
577
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
300
578
  $echo "$help" 1>&2
301
 
  exit 1
 
579
  exit $EXIT_FAILURE
302
580
fi
303
581
 
 
582
case $disable_libs in
 
583
no) 
 
584
  ;;
 
585
shared)
 
586
  build_libtool_libs=no
 
587
  build_old_libs=yes
 
588
  ;;
 
589
static)
 
590
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 
591
  ;;
 
592
esac
 
593
 
304
594
# If this variable is set in any of the actions, the command in it
305
595
# will be execed at the end.  This prevents here-documents from being
306
596
# left over by shells.
311
601
  # Infer the operation mode.
312
602
  if test -z "$mode"; then
313
603
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
314
 
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
 
604
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
315
605
    case $nonopt in
316
606
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
317
607
      mode=link
354
644
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
355
645
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
356
646
    $echo "$help" 1>&2
357
 
    exit 1
 
647
    exit $EXIT_FAILURE
358
648
  fi
359
649
 
360
650
  # Change the help message to a mode-specific one.
369
659
    # Get the compilation command and the source file.
370
660
    base_compile=
371
661
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
662
    suppress_opt=yes
372
663
    suppress_output=
373
664
    arg_mode=normal
374
665
    libobj=
 
666
    later=
375
667
 
376
668
    for arg
377
669
    do
378
 
      case "$arg_mode" in
 
670
      case $arg_mode in
379
671
      arg  )
380
672
        # do not "continue".  Instead, add this to base_compile
381
673
        lastarg="$arg"
394
686
        -o)
395
687
          if test -n "$libobj" ; then
396
688
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
397
 
            exit 1
 
689
            exit $EXIT_FAILURE
398
690
          fi
399
691
          arg_mode=target
400
692
          continue
401
693
          ;;
402
694
 
403
 
        -static)
404
 
          build_old_libs=yes
405
 
          continue
406
 
          ;;
407
 
 
408
 
        -prefer-pic)
409
 
          pic_mode=yes
410
 
          continue
411
 
          ;;
412
 
 
413
 
        -prefer-non-pic)
414
 
          pic_mode=no
 
695
        -static | -prefer-pic | -prefer-non-pic)
 
696
          later="$later $arg"
 
697
          continue
 
698
          ;;
 
699
 
 
700
        -no-suppress)
 
701
          suppress_opt=no
415
702
          continue
416
703
          ;;
417
704
 
424
711
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
425
712
          lastarg=
426
713
          save_ifs="$IFS"; IFS=','
427
 
          for arg in $args; do
 
714
          for arg in $args; do
428
715
            IFS="$save_ifs"
429
716
 
430
717
            # Double-quote args containing other shell metacharacters.
462
749
      case $lastarg in
463
750
      # Double-quote args containing other shell metacharacters.
464
751
      # Many Bourne shells cannot handle close brackets correctly
465
 
      # in scan sets, so we specify it separately.
 
752
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
 
753
      # in scan sets (worked around with variable expansion),
 
754
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
 
755
      # at all, so we specify them separately.
466
756
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
467
757
        lastarg="\"$lastarg\""
468
758
        ;;
474
764
    case $arg_mode in
475
765
    arg)
476
766
      $echo "$modename: you must specify an argument for -Xcompile"
477
 
      exit 1
 
767
      exit $EXIT_FAILURE
478
768
      ;;
479
769
    target)
480
770
      $echo "$modename: you must specify a target with \`-o'" 1>&2
481
 
      exit 1
 
771
      exit $EXIT_FAILURE
482
772
      ;;
483
773
    *)
484
774
      # Get the name of the library object.
500
790
    *.class) xform=class ;;
501
791
    *.cpp) xform=cpp ;;
502
792
    *.cxx) xform=cxx ;;
503
 
    *.f90) xform=f90 ;;
 
793
    *.[fF][09]?) xform=[fF][09]. ;;
504
794
    *.for) xform=for ;;
505
795
    *.java) xform=java ;;
 
796
    *.obj) xform=obj ;;
 
797
    *.sx) xform=sx ;;
506
798
    esac
507
799
 
508
800
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
511
803
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
512
804
    *)
513
805
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
514
 
      exit 1
 
806
      exit $EXIT_FAILURE
515
807
      ;;
516
808
    esac
517
809
 
518
 
    # Infer tagged configuration to use if any are available and
519
 
    # if one wasn't chosen via the "--tag" command line option.
520
 
    # Only attempt this if the compiler in the base compile
521
 
    # command doesn't match the default compiler.
522
 
    if test -n "$available_tags" && test -z "$tagname"; then
523
 
      case $base_compile in
524
 
      # Blanks in the command may have been stripped by the calling shell,
525
 
      # but not from the CC environment variable when configure was run.
526
 
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
527
 
      # Blanks at the start of $base_compile will cause this to fail
528
 
      # if we don't check for them as well.
529
 
      *)
530
 
        for z in $available_tags; do
531
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
532
 
            # Evaluate the configuration.
533
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
534
 
            case "$base_compile " in
535
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
536
 
              # The compiler in the base compile command matches
537
 
              # the one in the tagged configuration.
538
 
              # Assume this is the tagged configuration we want.
539
 
              tagname=$z
540
 
              break
541
 
              ;;
542
 
            esac
543
 
          fi
544
 
        done
545
 
        # If $tagname still isn't set, then no tagged configuration
546
 
        # was found and let the user know that the "--tag" command
547
 
        # line option must be used.
548
 
        if test -z "$tagname"; then
549
 
          $echo "$modename: unable to infer tagged configuration"
550
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
551
 
          exit 1
552
 
#        else
553
 
#          $echo "$modename: using $tagname tagged configuration"
554
 
        fi
 
810
    func_infer_tag $base_compile
 
811
 
 
812
    for arg in $later; do
 
813
      case $arg in
 
814
      -static)
 
815
        build_old_libs=yes
 
816
        continue
 
817
        ;;
 
818
 
 
819
      -prefer-pic)
 
820
        pic_mode=yes
 
821
        continue
 
822
        ;;
 
823
 
 
824
      -prefer-non-pic)
 
825
        pic_mode=no
 
826
        continue
555
827
        ;;
556
828
      esac
557
 
    fi
 
829
    done
558
830
 
 
831
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
 
832
    case $qlibobj in
 
833
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
834
        qlibobj="\"$qlibobj\"" ;;
 
835
    esac
 
836
    test "X$libobj" != "X$qlibobj" \
 
837
        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
 
838
        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
559
839
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
560
840
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
561
841
    if test "X$xdir" = "X$obj"; then
568
848
    if test -z "$base_compile"; then
569
849
      $echo "$modename: you must specify a compilation command" 1>&2
570
850
      $echo "$help" 1>&2
571
 
      exit 1
 
851
      exit $EXIT_FAILURE
572
852
    fi
573
853
 
574
854
    # Delete any leftover library objects.
579
859
    fi
580
860
 
581
861
    $run $rm $removelist
582
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
862
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
583
863
 
584
864
    # On Cygwin there's no "real" PIC flag so we must build both object types
585
865
    case $host_os in
598
878
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
599
879
      lockfile="$output_obj.lock"
600
880
      removelist="$removelist $output_obj $lockfile"
601
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
881
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
602
882
    else
603
883
      output_obj=
604
884
      need_locks=no
608
888
    # Lock this critical section if it is needed
609
889
    # We use this script file to make the link, it avoids creating a new file
610
890
    if test "$need_locks" = yes; then
611
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
891
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
612
892
        $show "Waiting for $lockfile to be removed"
613
893
        sleep 2
614
894
      done
626
906
compiler."
627
907
 
628
908
        $run $rm $removelist
629
 
        exit 1
 
909
        exit $EXIT_FAILURE
630
910
      fi
631
 
      $echo $srcfile > "$lockfile"
 
911
      $echo "$srcfile" > "$lockfile"
632
912
    fi
633
913
 
634
914
    if test -n "$fix_srcfile_path"; then
635
915
      eval srcfile=\"$fix_srcfile_path\"
636
916
    fi
 
917
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
 
918
    case $qsrcfile in
 
919
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
920
      qsrcfile="\"$qsrcfile\"" ;;
 
921
    esac
637
922
 
638
923
    $run $rm "$libobj" "${libobj}T"
639
924
 
655
940
      fbsd_hideous_sh_bug=$base_compile
656
941
 
657
942
      if test "$pic_mode" != no; then
658
 
        command="$base_compile $srcfile $pic_flag"
 
943
        command="$base_compile $qsrcfile $pic_flag"
659
944
      else
660
945
        # Don't build PIC code
661
 
        command="$base_compile $srcfile"
 
946
        command="$base_compile $qsrcfile"
662
947
      fi
663
948
 
664
949
      if test ! -d "${xdir}$objdir"; then
665
950
        $show "$mkdir ${xdir}$objdir"
666
951
        $run $mkdir ${xdir}$objdir
667
 
        status=$?
668
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
669
 
          exit $status
 
952
        exit_status=$?
 
953
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
954
          exit $exit_status
670
955
        fi
671
956
      fi
672
957
 
678
963
      $run $rm "$lobj" "$output_obj"
679
964
 
680
965
      $show "$command"
681
 
      if $run eval "$command"; then :
 
966
      if $run eval $lt_env "$command"; then :
682
967
      else
683
968
        test -n "$output_obj" && $run $rm $removelist
684
 
        exit 1
 
969
        exit $EXIT_FAILURE
685
970
      fi
686
971
 
687
972
      if test "$need_locks" = warn &&
701
986
compiler."
702
987
 
703
988
        $run $rm $removelist
704
 
        exit 1
 
989
        exit $EXIT_FAILURE
705
990
      fi
706
991
 
707
992
      # Just move the object if needed, then go on to compile the next one
722
1007
EOF
723
1008
 
724
1009
      # Allow error messages only from the first compilation.
725
 
      suppress_output=' >/dev/null 2>&1'
 
1010
      if test "$suppress_opt" = yes; then
 
1011
        suppress_output=' >/dev/null 2>&1'
 
1012
      fi
726
1013
    else
727
1014
      # No PIC object so indicate it doesn't exist in the libtool
728
1015
      # object file.
736
1023
    if test "$build_old_libs" = yes; then
737
1024
      if test "$pic_mode" != yes; then
738
1025
        # Don't build PIC code
739
 
        command="$base_compile $srcfile"
 
1026
        command="$base_compile $qsrcfile"
740
1027
      else
741
 
        command="$base_compile $srcfile $pic_flag"
 
1028
        command="$base_compile $qsrcfile $pic_flag"
742
1029
      fi
743
1030
      if test "$compiler_c_o" = yes; then
744
1031
        command="$command -o $obj"
748
1035
      command="$command$suppress_output"
749
1036
      $run $rm "$obj" "$output_obj"
750
1037
      $show "$command"
751
 
      if $run eval "$command"; then :
 
1038
      if $run eval $lt_env "$command"; then :
752
1039
      else
753
1040
        $run $rm $removelist
754
 
        exit 1
 
1041
        exit $EXIT_FAILURE
755
1042
      fi
756
1043
 
757
1044
      if test "$need_locks" = warn &&
771
1058
compiler."
772
1059
 
773
1060
        $run $rm $removelist
774
 
        exit 1
 
1061
        exit $EXIT_FAILURE
775
1062
      fi
776
1063
 
777
1064
      # Just move the object if needed
809
1096
      $run $rm "$lockfile"
810
1097
    fi
811
1098
 
812
 
    exit 0
 
1099
    exit $EXIT_SUCCESS
813
1100
    ;;
814
1101
 
815
1102
  # libtool link mode
835
1122
      ;;
836
1123
    esac
837
1124
    libtool_args="$nonopt"
838
 
    base_compile="$nonopt"
 
1125
    base_compile="$nonopt $@"
839
1126
    compile_command="$nonopt"
840
1127
    finalize_command="$nonopt"
841
1128
 
867
1154
    no_install=no
868
1155
    objs=
869
1156
    non_pic_objects=
 
1157
    notinst_path= # paths that contain not-installed libtool libraries
 
1158
    precious_files_regex=
870
1159
    prefer_static_libs=no
871
1160
    preload=no
872
1161
    prev=
879
1168
    thread_safe=no
880
1169
    vinfo=
881
1170
    vinfo_number=no
 
1171
    single_module="${wl}-single_module"
 
1172
 
 
1173
    func_infer_tag $base_compile
882
1174
 
883
1175
    # We need to know -static, to get the right output filenames.
884
1176
    for arg
885
1177
    do
886
1178
      case $arg in
887
 
      -all-static | -static)
888
 
        if test "X$arg" = "X-all-static"; then
 
1179
      -all-static | -static | -static-libtool-libs)
 
1180
        case $arg in
 
1181
        -all-static)
889
1182
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
890
1183
            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
891
1184
          fi
892
1185
          if test -n "$link_static_flag"; then
893
1186
            dlopen_self=$dlopen_self_static
894
1187
          fi
895
 
        else
896
 
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
897
 
            dlopen_self=$dlopen_self_static
898
 
          fi
899
 
        fi
 
1188
          prefer_static_libs=yes
 
1189
          ;;
 
1190
        -static)
 
1191
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
1192
            dlopen_self=$dlopen_self_static
 
1193
          fi
 
1194
          prefer_static_libs=built
 
1195
          ;;
 
1196
        -static-libtool-libs)
 
1197
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
1198
            dlopen_self=$dlopen_self_static
 
1199
          fi
 
1200
          prefer_static_libs=yes
 
1201
          ;;
 
1202
        esac
900
1203
        build_libtool_libs=no
901
1204
        build_old_libs=yes
902
 
        prefer_static_libs=yes
903
1205
        break
904
1206
        ;;
905
1207
      esac
911
1213
    # Go through the arguments, transforming them on the way.
912
1214
    while test "$#" -gt 0; do
913
1215
      arg="$1"
914
 
      base_compile="$base_compile $arg"
915
1216
      shift
916
1217
      case $arg in
917
1218
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
975
1276
          export_symbols="$arg"
976
1277
          if test ! -f "$arg"; then
977
1278
            $echo "$modename: symbol file \`$arg' does not exist"
978
 
            exit 1
 
1279
            exit $EXIT_FAILURE
979
1280
          fi
980
1281
          prev=
981
1282
          continue
990
1291
          prev=
991
1292
          continue
992
1293
          ;;
 
1294
        precious_regex)
 
1295
          precious_files_regex="$arg"
 
1296
          prev=
 
1297
          continue
 
1298
          ;;
993
1299
        release)
994
1300
          release="-$arg"
995
1301
          prev=
1022
1328
                   test "$pic_object" = none && \
1023
1329
                   test "$non_pic_object" = none; then
1024
1330
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1025
 
                  exit 1
 
1331
                  exit $EXIT_FAILURE
1026
1332
                fi
1027
1333
 
1028
1334
                # Extract subdirectory from the argument.
1070
1376
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1071
1377
                    arg="$non_pic_object"
1072
1378
                  fi
 
1379
                else
 
1380
                  # If the PIC object exists, use it instead.
 
1381
                  # $xdir was prepended to $pic_object above.
 
1382
                  non_pic_object="$pic_object"
 
1383
                  non_pic_objects="$non_pic_objects $non_pic_object"
1073
1384
                fi
1074
1385
              else
1075
1386
                # Only an error if not doing a dry-run.
1076
1387
                if test -z "$run"; then
1077
1388
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1078
 
                  exit 1
 
1389
                  exit $EXIT_FAILURE
1079
1390
                else
1080
1391
                  # Dry-run case.
1081
1392
 
1096
1407
            done
1097
1408
          else
1098
1409
            $echo "$modename: link input file \`$save_arg' does not exist"
1099
 
            exit 1
 
1410
            exit $EXIT_FAILURE
1100
1411
          fi
1101
1412
          arg=$save_arg
1102
1413
          prev=
1108
1419
          [\\/]* | [A-Za-z]:[\\/]*) ;;
1109
1420
          *)
1110
1421
            $echo "$modename: only absolute run-paths are allowed" 1>&2
1111
 
            exit 1
 
1422
            exit $EXIT_FAILURE
1112
1423
            ;;
1113
1424
          esac
1114
1425
          if test "$prev" = rpath; then
1148
1459
          finalize_command="$finalize_command $qarg"
1149
1460
          continue
1150
1461
          ;;
 
1462
        shrext)
 
1463
          shrext_cmds="$arg"
 
1464
          prev=
 
1465
          continue
 
1466
          ;;
 
1467
        darwin_framework|darwin_framework_skip)
 
1468
          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
 
1469
          compile_command="$compile_command $arg"
 
1470
          finalize_command="$finalize_command $arg"
 
1471
          prev=
 
1472
          continue
 
1473
          ;;
1151
1474
        *)
1152
1475
          eval "$prev=\"\$arg\""
1153
1476
          prev=
1196
1519
      -export-symbols | -export-symbols-regex)
1197
1520
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1198
1521
          $echo "$modename: more than one -exported-symbols argument is not allowed"
1199
 
          exit 1
 
1522
          exit $EXIT_FAILURE
1200
1523
        fi
1201
1524
        if test "X$arg" = "X-export-symbols"; then
1202
1525
          prev=expsyms
1206
1529
        continue
1207
1530
        ;;
1208
1531
 
 
1532
      -framework|-arch|-isysroot)
 
1533
        case " $CC " in
 
1534
          *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
 
1535
                prev=darwin_framework_skip ;;
 
1536
          *) compiler_flags="$compiler_flags $arg"
 
1537
             prev=darwin_framework ;;
 
1538
        esac
 
1539
        compile_command="$compile_command $arg"
 
1540
        finalize_command="$finalize_command $arg"
 
1541
        continue
 
1542
        ;;
 
1543
 
1209
1544
      -inst-prefix-dir)
1210
1545
        prev=inst_prefix
1211
1546
        continue
1232
1567
          absdir=`cd "$dir" && pwd`
1233
1568
          if test -z "$absdir"; then
1234
1569
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1235
 
            exit 1
 
1570
            absdir="$dir"
 
1571
            notinst_path="$notinst_path $dir"
1236
1572
          fi
1237
1573
          dir="$absdir"
1238
1574
          ;;
1246
1582
        esac
1247
1583
        case $host in
1248
1584
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1585
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1249
1586
          case :$dllsearchpath: in
1250
1587
          *":$dir:"*) ;;
1251
1588
          *) dllsearchpath="$dllsearchpath:$dir";;
1252
1589
          esac
 
1590
          case :$dllsearchpath: in
 
1591
          *":$testbindir:"*) ;;
 
1592
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1593
          esac
1253
1594
          ;;
1254
1595
        esac
1255
1596
        continue
1258
1599
      -l*)
1259
1600
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1260
1601
          case $host in
1261
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1602
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1262
1603
            # These systems don't actually have a C or math library (as such)
1263
1604
            continue
1264
1605
            ;;
1265
 
          *-*-mingw* | *-*-os2*)
 
1606
          *-*-os2*)
1266
1607
            # These systems don't actually have a C library (as such)
1267
1608
            test "X$arg" = "X-lc" && continue
1268
1609
            ;;
1269
 
          *-*-openbsd* | *-*-freebsd*)
 
1610
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1270
1611
            # Do not include libc due to us having libc/libc_r.
1271
1612
            test "X$arg" = "X-lc" && continue
1272
1613
            ;;
1274
1615
            # Rhapsody C and math libraries are in the System framework
1275
1616
            deplibs="$deplibs -framework System"
1276
1617
            continue
 
1618
            ;;
 
1619
          *-*-sco3.2v5* | *-*-sco5v6*)
 
1620
            # Causes problems with __ctype
 
1621
            test "X$arg" = "X-lc" && continue
 
1622
            ;;
 
1623
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
1624
            # Compiler inserts libc in the correct place for threads to work
 
1625
            test "X$arg" = "X-lc" && continue
 
1626
            ;;
1277
1627
          esac
1278
1628
        elif test "X$arg" = "X-lc_r"; then
1279
1629
         case $host in
1280
 
         *-*-openbsd* | *-*-freebsd*)
 
1630
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1281
1631
           # Do not include libc_r directly, use -pthread flag.
1282
1632
           continue
1283
1633
           ;;
1287
1637
        continue
1288
1638
        ;;
1289
1639
 
 
1640
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
1641
      # classes, name mangling, and exception handling.
 
1642
      -model)
 
1643
        compile_command="$compile_command $arg"
 
1644
        compiler_flags="$compiler_flags $arg"
 
1645
        finalize_command="$finalize_command $arg"
 
1646
        prev=xcompiler
 
1647
        continue
 
1648
        ;;
 
1649
 
 
1650
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 
1651
        compiler_flags="$compiler_flags $arg"
 
1652
        compile_command="$compile_command $arg"
 
1653
        finalize_command="$finalize_command $arg"
 
1654
        continue
 
1655
        ;;
 
1656
 
 
1657
      -multi_module)
 
1658
        single_module="${wl}-multi_module"
 
1659
        continue
 
1660
        ;;
 
1661
 
1290
1662
      -module)
1291
1663
        module=yes
1292
1664
        continue
1293
1665
        ;;
1294
1666
 
1295
 
      # gcc -m* arguments should be passed to the linker via $compiler_flags
1296
 
      # in order to pass architecture information to the linker
1297
 
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1298
 
      # but this is not reliable with gcc because gcc may use -mfoo to
1299
 
      # select a different linker, different libraries, etc, while
1300
 
      # -Wl,-mfoo simply passes -mfoo to the linker.
1301
 
      -m*)
 
1667
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
 
1668
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
 
1669
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
 
1670
      # +DA*, +DD* enable 64-bit mode on the HP compiler
 
1671
      # -q* pass through compiler args for the IBM compiler
 
1672
      # -m* pass through architecture-specific compiler args for GCC
 
1673
      # -m*, -t[45]*, -txscale* pass through architecture-specific
 
1674
      # compiler args for GCC
 
1675
      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
 
1676
      # -F/path gives path to uninstalled frameworks, gcc on darwin
 
1677
      # @file GCC response files
 
1678
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
 
1679
      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
 
1680
 
1302
1681
        # Unknown arguments in both finalize_command and compile_command need
1303
1682
        # to be aesthetically quoted because they are evaled later.
1304
1683
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1309
1688
        esac
1310
1689
        compile_command="$compile_command $arg"
1311
1690
        finalize_command="$finalize_command $arg"
1312
 
        if test "$with_gcc" = "yes" ; then
1313
 
          compiler_flags="$compiler_flags $arg"
1314
 
        fi
 
1691
        compiler_flags="$compiler_flags $arg"
1315
1692
        continue
1316
1693
        ;;
1317
1694
 
1327
1704
 
1328
1705
      -no-install)
1329
1706
        case $host in
1330
 
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1707
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1331
1708
          # The PATH hackery in wrapper scripts is required on Windows
1332
 
          # in order for the loader to find any dlls it needs.
 
1709
          # and Darwin in order for the loader to find any dlls it needs.
1333
1710
          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1334
1711
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1335
1712
          fast_install=no
1351
1728
 
1352
1729
      -o) prev=output ;;
1353
1730
 
 
1731
      -precious-files-regex)
 
1732
        prev=precious_regex
 
1733
        continue
 
1734
        ;;
 
1735
 
1354
1736
      -release)
1355
1737
        prev=release
1356
1738
        continue
1373
1755
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1374
1756
        *)
1375
1757
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1376
 
          exit 1
 
1758
          exit $EXIT_FAILURE
1377
1759
          ;;
1378
1760
        esac
1379
1761
        case "$xrpath " in
1383
1765
        continue
1384
1766
        ;;
1385
1767
 
1386
 
      -static)
 
1768
      -static | -static-libtool-libs)
1387
1769
        # The effects of -static are defined in a previous loop.
1388
1770
        # We used to do the same as -all-static on platforms that
1389
1771
        # didn't have a PIC flag, but the assumption that the effects
1496
1878
             test "$pic_object" = none && \
1497
1879
             test "$non_pic_object" = none; then
1498
1880
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1499
 
            exit 1
 
1881
            exit $EXIT_FAILURE
1500
1882
          fi
1501
1883
 
1502
1884
          # Extract subdirectory from the argument.
1544
1926
            if test -z "$pic_object" || test "$pic_object" = none ; then
1545
1927
              arg="$non_pic_object"
1546
1928
            fi
 
1929
          else
 
1930
            # If the PIC object exists, use it instead.
 
1931
            # $xdir was prepended to $pic_object above.
 
1932
            non_pic_object="$pic_object"
 
1933
            non_pic_objects="$non_pic_objects $non_pic_object"
1547
1934
          fi
1548
1935
        else
1549
1936
          # Only an error if not doing a dry-run.
1550
1937
          if test -z "$run"; then
1551
1938
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1552
 
            exit 1
 
1939
            exit $EXIT_FAILURE
1553
1940
          else
1554
1941
            # Dry-run case.
1555
1942
 
1616
2003
    if test -n "$prev"; then
1617
2004
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1618
2005
      $echo "$help" 1>&2
1619
 
      exit 1
1620
 
    fi
1621
 
 
1622
 
    # Infer tagged configuration to use if any are available and
1623
 
    # if one wasn't chosen via the "--tag" command line option.
1624
 
    # Only attempt this if the compiler in the base link
1625
 
    # command doesn't match the default compiler.
1626
 
    if test -n "$available_tags" && test -z "$tagname"; then
1627
 
      case $base_compile in
1628
 
      # Blanks in the command may have been stripped by the calling shell,
1629
 
      # but not from the CC environment variable when configure was run.
1630
 
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1631
 
      # Blanks at the start of $base_compile will cause this to fail
1632
 
      # if we don't check for them as well.
1633
 
      *)
1634
 
        for z in $available_tags; do
1635
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1636
 
            # Evaluate the configuration.
1637
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1638
 
            case $base_compile in
1639
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1640
 
              # The compiler in $compile_command matches
1641
 
              # the one in the tagged configuration.
1642
 
              # Assume this is the tagged configuration we want.
1643
 
              tagname=$z
1644
 
              break
1645
 
              ;;
1646
 
            esac
1647
 
          fi
1648
 
        done
1649
 
        # If $tagname still isn't set, then no tagged configuration
1650
 
        # was found and let the user know that the "--tag" command
1651
 
        # line option must be used.
1652
 
        if test -z "$tagname"; then
1653
 
          $echo "$modename: unable to infer tagged configuration"
1654
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
1655
 
          exit 1
1656
 
#       else
1657
 
#         $echo "$modename: using $tagname tagged configuration"
1658
 
        fi
1659
 
        ;;
1660
 
      esac
 
2006
      exit $EXIT_FAILURE
1661
2007
    fi
1662
2008
 
1663
2009
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1690
2036
    if test ! -d "$output_objdir"; then
1691
2037
      $show "$mkdir $output_objdir"
1692
2038
      $run $mkdir $output_objdir
1693
 
      status=$?
1694
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1695
 
        exit $status
 
2039
      exit_status=$?
 
2040
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
2041
        exit $exit_status
1696
2042
      fi
1697
2043
    fi
1698
2044
 
1701
2047
    "")
1702
2048
      $echo "$modename: you must specify an output file" 1>&2
1703
2049
      $echo "$help" 1>&2
1704
 
      exit 1
 
2050
      exit $EXIT_FAILURE
1705
2051
      ;;
1706
2052
    *.$libext) linkmode=oldlib ;;
1707
2053
    *.lo | *.$objext) linkmode=obj ;;
1711
2057
 
1712
2058
    case $host in
1713
2059
    *cygwin* | *mingw* | *pw32*)
1714
 
      # don't eliminate duplcations in $postdeps and $predeps
 
2060
      # don't eliminate duplications in $postdeps and $predeps
1715
2061
      duplicate_compiler_generated_deps=yes
1716
2062
      ;;
1717
2063
    *)
1755
2101
    newlib_search_path=
1756
2102
    need_relink=no # whether we're linking any uninstalled libtool libraries
1757
2103
    notinst_deplibs= # not-installed libtool libraries
1758
 
    notinst_path= # paths that contain not-installed libtool libraries
1759
2104
    case $linkmode in
1760
2105
    lib)
1761
2106
        passes="conv link"
1764
2109
          *.la) ;;
1765
2110
          *)
1766
2111
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1767
 
            exit 1
 
2112
            exit $EXIT_FAILURE
1768
2113
            ;;
1769
2114
          esac
1770
2115
        done
1790
2135
        case $pass in
1791
2136
        dlopen) libs="$dlfiles" ;;
1792
2137
        dlpreopen) libs="$dlprefiles" ;;
1793
 
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
2138
        link)
 
2139
          libs="$deplibs %DEPLIBS%"
 
2140
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
 
2141
          ;;
1794
2142
        esac
1795
2143
      fi
1796
2144
      if test "$pass" = dlopen; then
1802
2150
        lib=
1803
2151
        found=no
1804
2152
        case $deplib in
 
2153
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 
2154
          if test "$linkmode,$pass" = "prog,link"; then
 
2155
            compile_deplibs="$deplib $compile_deplibs"
 
2156
            finalize_deplibs="$deplib $finalize_deplibs"
 
2157
          else
 
2158
            compiler_flags="$compiler_flags $deplib"
 
2159
          fi
 
2160
          continue
 
2161
          ;;
1805
2162
        -l*)
1806
2163
          if test "$linkmode" != lib && test "$linkmode" != prog; then
1807
2164
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1808
2165
            continue
1809
2166
          fi
1810
 
          if test "$pass" = conv; then
1811
 
            deplibs="$deplib $deplibs"
1812
 
            continue
1813
 
          fi
1814
2167
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1815
 
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1816
 
            # Search the libtool library
1817
 
            lib="$searchdir/lib${name}.la"
1818
 
            if test -f "$lib"; then
1819
 
              found=yes
1820
 
              break
1821
 
            fi
 
2168
          if test "$linkmode" = lib; then
 
2169
            searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
 
2170
          else
 
2171
            searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
 
2172
          fi
 
2173
          for searchdir in $searchdirs; do
 
2174
            for search_ext in .la $std_shrext .so .a; do
 
2175
              # Search the libtool library
 
2176
              lib="$searchdir/lib${name}${search_ext}"
 
2177
              if test -f "$lib"; then
 
2178
                if test "$search_ext" = ".la"; then
 
2179
                  found=yes
 
2180
                else
 
2181
                  found=no
 
2182
                fi
 
2183
                break 2
 
2184
              fi
 
2185
            done
1822
2186
          done
1823
2187
          if test "$found" != yes; then
1824
2188
            # deplib doesn't seem to be a libtool library
1883
2247
            fi
1884
2248
            if test "$pass" = scan; then
1885
2249
              deplibs="$deplib $deplibs"
1886
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1887
2250
            else
1888
2251
              compile_deplibs="$deplib $compile_deplibs"
1889
2252
              finalize_deplibs="$deplib $finalize_deplibs"
1890
2253
            fi
 
2254
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1891
2255
            ;;
1892
2256
          *)
1893
2257
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1915
2279
          fi
1916
2280
          case $linkmode in
1917
2281
          lib)
1918
 
            if test "$deplibs_check_method" != pass_all; then
 
2282
            valid_a_lib=no
 
2283
            case $deplibs_check_method in
 
2284
              match_pattern*)
 
2285
                set dummy $deplibs_check_method
 
2286
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2287
                if eval $echo \"$deplib\" 2>/dev/null \
 
2288
                    | $SED 10q \
 
2289
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2290
                  valid_a_lib=yes
 
2291
                fi
 
2292
                ;;
 
2293
              pass_all)
 
2294
                valid_a_lib=yes
 
2295
                ;;
 
2296
            esac
 
2297
            if test "$valid_a_lib" != yes; then
1919
2298
              $echo
1920
2299
              $echo "*** Warning: Trying to link with static lib archive $deplib."
1921
2300
              $echo "*** I have the capability to make that library automatically link in when"
1965
2344
        esac # case $deplib
1966
2345
        if test "$found" = yes || test -f "$lib"; then :
1967
2346
        else
1968
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1969
 
          exit 1
 
2347
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
 
2348
          exit $EXIT_FAILURE
1970
2349
        fi
1971
2350
 
1972
2351
        # Check to see that this really is a libtool archive.
1973
2352
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1974
2353
        else
1975
2354
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1976
 
          exit 1
 
2355
          exit $EXIT_FAILURE
1977
2356
        fi
1978
2357
 
1979
2358
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1989
2368
        # it will not redefine variables installed, or shouldnotlink
1990
2369
        installed=yes
1991
2370
        shouldnotlink=no
 
2371
        avoidtemprpath=
 
2372
 
1992
2373
 
1993
2374
        # Read the .la file
1994
2375
        case $lib in
2009
2390
          if test -z "$libdir"; then
2010
2391
            if test -z "$old_library"; then
2011
2392
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2012
 
              exit 1
 
2393
              exit $EXIT_FAILURE
2013
2394
            fi
2014
2395
            # It is a libtool convenience library, so add in its objects.
2015
2396
            convenience="$convenience $ladir/$objdir/$old_library"
2026
2407
            done
2027
2408
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2028
2409
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2029
 
            exit 1
 
2410
            exit $EXIT_FAILURE
2030
2411
          fi
2031
2412
          continue
2032
2413
        fi # $pass = conv
2033
2414
 
2034
 
    
 
2415
 
2035
2416
        # Get the name of the library we link against.
2036
2417
        linklib=
2037
2418
        for l in $old_library $library_names; do
2039
2420
        done
2040
2421
        if test -z "$linklib"; then
2041
2422
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2042
 
          exit 1
 
2423
          exit $EXIT_FAILURE
2043
2424
        fi
2044
2425
 
2045
2426
        # This library was specified with -dlopen.
2046
2427
        if test "$pass" = dlopen; then
2047
2428
          if test -z "$libdir"; then
2048
2429
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2049
 
            exit 1
 
2430
            exit $EXIT_FAILURE
2050
2431
          fi
2051
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2432
          if test -z "$dlname" ||
 
2433
             test "$dlopen_support" != yes ||
 
2434
             test "$build_libtool_libs" = no; then
2052
2435
            # If there is no dlname, no dlopen support or we're linking
2053
2436
            # statically, we need to preload.  We also need to preload any
2054
2437
            # dependent libraries so libltdl's deplib preloader doesn't
2085
2468
            dir="$libdir"
2086
2469
            absdir="$libdir"
2087
2470
          fi
 
2471
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2088
2472
        else
2089
 
          dir="$ladir/$objdir"
2090
 
          absdir="$abs_ladir/$objdir"
2091
 
          # Remove this search path later
2092
 
          notinst_path="$notinst_path $abs_ladir"
 
2473
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2474
            dir="$ladir"
 
2475
            absdir="$abs_ladir"
 
2476
            # Remove this search path later
 
2477
            notinst_path="$notinst_path $abs_ladir"
 
2478
          else
 
2479
            dir="$ladir/$objdir"
 
2480
            absdir="$abs_ladir/$objdir"
 
2481
            # Remove this search path later
 
2482
            notinst_path="$notinst_path $abs_ladir"
 
2483
          fi
2093
2484
        fi # $installed = yes
2094
2485
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2095
2486
 
2097
2488
        if test "$pass" = dlpreopen; then
2098
2489
          if test -z "$libdir"; then
2099
2490
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2100
 
            exit 1
 
2491
            exit $EXIT_FAILURE
2101
2492
          fi
2102
2493
          # Prefer using a static library (so that no silly _DYNAMIC symbols
2103
2494
          # are required to link).
2124
2515
          continue
2125
2516
        fi
2126
2517
 
2127
 
    
 
2518
 
2128
2519
        if test "$linkmode" = prog && test "$pass" != link; then
2129
2520
          newlib_search_path="$newlib_search_path $ladir"
2130
2521
          deplibs="$lib $deplibs"
2160
2551
 
2161
2552
        if test "$linkmode,$pass" = "prog,link"; then
2162
2553
          if test -n "$library_names" &&
2163
 
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2554
             { { test "$prefer_static_libs" = no ||
 
2555
                 test "$prefer_static_libs,$installed" = "built,yes"; } ||
 
2556
               test -z "$old_library"; }; then
2164
2557
            # We need to hardcode the library path
2165
 
            if test -n "$shlibpath_var"; then
 
2558
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2166
2559
              # Make sure the rpath contains only unique directories.
2167
2560
              case "$temp_rpath " in
2168
2561
              *" $dir "*) ;;
2169
2562
              *" $absdir "*) ;;
2170
 
              *) temp_rpath="$temp_rpath $dir" ;;
 
2563
              *) temp_rpath="$temp_rpath $absdir" ;;
2171
2564
              esac
2172
2565
            fi
2173
2566
 
2204
2597
        fi
2205
2598
 
2206
2599
        link_static=no # Whether the deplib will be linked statically
 
2600
        use_static_libs=$prefer_static_libs
 
2601
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2602
          use_static_libs=no
 
2603
        fi
2207
2604
        if test -n "$library_names" &&
2208
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2605
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2209
2606
          if test "$installed" = no; then
2210
2607
            notinst_deplibs="$notinst_deplibs $lib"
2211
2608
            need_relink=yes
2212
2609
          fi
2213
2610
          # This is a shared library
2214
 
        
2215
 
      # Warn about portability, can't link against -module's on some systems (darwin)
2216
 
      if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2611
 
 
2612
          # Warn about portability, can't link against -module's on
 
2613
          # some systems (darwin)
 
2614
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
2217
2615
            $echo
2218
2616
            if test "$linkmode" = prog; then
2219
2617
              $echo "*** Warning: Linking the executable $output against the loadable module"
2220
2618
            else
2221
2619
              $echo "*** Warning: Linking the shared library $output against the loadable module"
2222
2620
            fi
2223
 
            $echo "*** $linklib is not portable!"    
2224
 
      fi          
 
2621
            $echo "*** $linklib is not portable!"
 
2622
          fi
2225
2623
          if test "$linkmode" = lib &&
2226
2624
             test "$hardcode_into_libs" = yes; then
2227
2625
            # Hardcode the library path.
2279
2677
            else
2280
2678
              $show "extracting exported symbol list from \`$soname'"
2281
2679
              save_ifs="$IFS"; IFS='~'
2282
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2680
              cmds=$extract_expsyms_cmds
2283
2681
              for cmd in $cmds; do
2284
2682
                IFS="$save_ifs"
 
2683
                eval cmd=\"$cmd\"
2285
2684
                $show "$cmd"
2286
2685
                $run eval "$cmd" || exit $?
2287
2686
              done
2292
2691
            if test -f "$output_objdir/$newlib"; then :; else
2293
2692
              $show "generating import library for \`$soname'"
2294
2693
              save_ifs="$IFS"; IFS='~'
2295
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2694
              cmds=$old_archive_from_expsyms_cmds
2296
2695
              for cmd in $cmds; do
2297
2696
                IFS="$save_ifs"
 
2697
                eval cmd=\"$cmd\"
2298
2698
                $show "$cmd"
2299
2699
                $run eval "$cmd" || exit $?
2300
2700
              done
2315
2715
              if test "$hardcode_direct" = no; then
2316
2716
                add="$dir/$linklib"
2317
2717
                case $host in
2318
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2718
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2719
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2720
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2721
                    *-*-unixware7*) add_dir="-L$dir" ;;
2319
2722
                  *-*-darwin* )
2320
 
                    # if the lib is a module then we can not link against it, someone
2321
 
                    # is ignoring the new warnings I added
2322
 
                    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
 
2723
                    # if the lib is a module then we can not link against
 
2724
                    # it, someone is ignoring the new warnings I added
 
2725
                    if /usr/bin/file -L $add 2> /dev/null |
 
2726
                      $EGREP ": [^:]* bundle" >/dev/null ; then
2323
2727
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2324
2728
                      if test -z "$old_library" ; then
2325
2729
                        $echo
2327
2731
                        $echo "** The link will probably fail, sorry"
2328
2732
                      else
2329
2733
                        add="$dir/$old_library"
2330
 
                      fi 
 
2734
                      fi
2331
2735
                    fi
2332
2736
                esac
2333
2737
              elif test "$hardcode_minus_L" = no; then
2350
2754
                add_dir="-L$dir"
2351
2755
                # Try looking first in the location we're being installed to.
2352
2756
                if test -n "$inst_prefix_dir"; then
2353
 
                  case "$libdir" in
 
2757
                  case $libdir in
2354
2758
                    [\\/]*)
2355
 
                      add_dir="-L$inst_prefix_dir$libdir $add_dir"
 
2759
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2356
2760
                      ;;
2357
2761
                  esac
2358
2762
                fi
2369
2773
 
2370
2774
            if test "$lib_linked" != yes; then
2371
2775
              $echo "$modename: configuration error: unsupported hardcode properties"
2372
 
              exit 1
 
2776
              exit $EXIT_FAILURE
2373
2777
            fi
2374
2778
 
2375
2779
            if test -n "$add_shlibpath"; then
2412
2816
              esac
2413
2817
              add="-l$name"
2414
2818
            elif test "$hardcode_automatic" = yes; then
2415
 
              if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2819
              if test -n "$inst_prefix_dir" &&
 
2820
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2416
2821
                add="$inst_prefix_dir$libdir/$linklib"
2417
2822
              else
2418
2823
                add="$libdir/$linklib"
2422
2827
              add_dir="-L$libdir"
2423
2828
              # Try looking first in the location we're being installed to.
2424
2829
              if test -n "$inst_prefix_dir"; then
2425
 
                case "$libdir" in
 
2830
                case $libdir in
2426
2831
                  [\\/]*)
2427
 
                    add_dir="-L$inst_prefix_dir$libdir $add_dir"
 
2832
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2428
2833
                    ;;
2429
2834
                esac
2430
2835
              fi
2483
2888
              fi
2484
2889
            fi
2485
2890
          else
2486
 
            convenience="$convenience $dir/$old_library"
2487
 
            old_convenience="$old_convenience $dir/$old_library"
2488
2891
            deplibs="$dir/$old_library $deplibs"
2489
2892
            link_static=yes
2490
2893
          fi
2492
2895
 
2493
2896
        if test "$linkmode" = lib; then
2494
2897
          if test -n "$dependency_libs" &&
2495
 
             { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
 
2898
             { test "$hardcode_into_libs" != yes ||
 
2899
               test "$build_old_libs" = yes ||
2496
2900
               test "$link_static" = yes; }; then
2497
2901
            # Extract -R from dependency_libs
2498
2902
            temp_deplibs=
2549
2953
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2550
2954
                  if test -z "$libdir"; then
2551
2955
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2552
 
                    exit 1
 
2956
                    exit $EXIT_FAILURE
2553
2957
                  fi
2554
2958
                  if test "$absdir" != "$libdir"; then
2555
2959
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2559
2963
                depdepl=
2560
2964
                case $host in
2561
2965
                *-*-darwin*)
2562
 
                  # we do not want to link against static libs, but need to link against shared
 
2966
                  # we do not want to link against static libs,
 
2967
                  # but need to link against shared
2563
2968
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2969
                  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2564
2970
                  if test -n "$deplibrary_names" ; then
2565
2971
                    for tmp in $deplibrary_names ; do
2566
2972
                      depdepl=$tmp
2567
2973
                    done
2568
 
                    if test -f "$path/$depdepl" ; then
 
2974
                    if test -f "$deplibdir/$depdepl" ; then
 
2975
                      depdepl="$deplibdir/$depdepl"
 
2976
                    elif test -f "$path/$depdepl" ; then
2569
2977
                      depdepl="$path/$depdepl"
2570
 
                   fi
2571
 
                    newlib_search_path="$newlib_search_path $path"
2572
 
                    path=""
 
2978
                    else
 
2979
                      # Can't find it, oh well...
 
2980
                      depdepl=
 
2981
                    fi
 
2982
                    # do not add paths which are already there
 
2983
                    case " $newlib_search_path " in
 
2984
                    *" $path "*) ;;
 
2985
                    *) newlib_search_path="$newlib_search_path $path";;
 
2986
                    esac
2573
2987
                  fi
 
2988
                  path=""
2574
2989
                  ;;
2575
2990
                *)
2576
 
                path="-L$path"
2577
 
                ;;
2578
 
                esac 
2579
 
                
2580
 
                ;;
2581
 
                  -l*)
 
2991
                  path="-L$path"
 
2992
                  ;;
 
2993
                esac
 
2994
                ;;
 
2995
              -l*)
2582
2996
                case $host in
2583
2997
                *-*-darwin*)
2584
 
                 # Again, we only want to link against shared libraries
2585
 
                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2586
 
                 for tmp in $newlib_search_path ; do
2587
 
                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
2588
 
                       eval depdepl="$tmp/lib$tmp_libs.dylib"
2589
 
                       break
2590
 
                     fi  
2591
 
         done
2592
 
         path=""
 
2998
                  # Again, we only want to link against shared libraries
 
2999
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
3000
                  for tmp in $newlib_search_path ; do
 
3001
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
3002
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
3003
                      break
 
3004
                    fi
 
3005
                  done
 
3006
                  path=""
2593
3007
                  ;;
2594
3008
                *) continue ;;
2595
 
                esac              
 
3009
                esac
2596
3010
                ;;
2597
3011
              *) continue ;;
2598
3012
              esac
2599
3013
              case " $deplibs " in
 
3014
              *" $path "*) ;;
 
3015
              *) deplibs="$path $deplibs" ;;
 
3016
              esac
 
3017
              case " $deplibs " in
2600
3018
              *" $depdepl "*) ;;
2601
 
              *) deplibs="$deplibs $depdepl" ;;
2602
 
              esac            
2603
 
              case " $deplibs " in
2604
 
              *" $path "*) ;;
2605
 
              *) deplibs="$deplibs $path" ;;
 
3019
              *) deplibs="$depdepl $deplibs" ;;
2606
3020
              esac
2607
3021
            done
2608
3022
          fi # link_all_deplibs != no
2689
3103
          eval $var=\"$tmp_libs\"
2690
3104
        done # for var
2691
3105
      fi
2692
 
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
 
3106
      # Last step: remove runtime libs from dependency_libs
 
3107
      # (they stay in deplibs)
2693
3108
      tmp_libs=
2694
3109
      for i in $dependency_libs ; do
2695
3110
        case " $predeps $postdeps $compiler_lib_search_path " in
2710
3125
 
2711
3126
    case $linkmode in
2712
3127
    oldlib)
2713
 
      if test -n "$deplibs"; then
2714
 
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2715
 
      fi
 
3128
      case " $deplibs" in
 
3129
      *\ -l* | *\ -L*)
 
3130
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
 
3131
      esac
2716
3132
 
2717
3133
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2718
3134
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2749
3165
      case $outputname in
2750
3166
      lib*)
2751
3167
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2752
 
        eval shared_ext=\"$shrext\"
 
3168
        eval shared_ext=\"$shrext_cmds\"
2753
3169
        eval libname=\"$libname_spec\"
2754
3170
        ;;
2755
3171
      *)
2756
3172
        if test "$module" = no; then
2757
3173
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2758
3174
          $echo "$help" 1>&2
2759
 
          exit 1
 
3175
          exit $EXIT_FAILURE
2760
3176
        fi
2761
3177
        if test "$need_lib_prefix" != no; then
2762
3178
          # Add the "lib" prefix for modules if required
2763
3179
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2764
 
          eval shared_ext=\"$shrext\"
 
3180
          eval shared_ext=\"$shrext_cmds\"
2765
3181
          eval libname=\"$libname_spec\"
2766
3182
        else
2767
3183
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2772
3188
      if test -n "$objs"; then
2773
3189
        if test "$deplibs_check_method" != pass_all; then
2774
3190
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2775
 
          exit 1
 
3191
          exit $EXIT_FAILURE
2776
3192
        else
2777
3193
          $echo
2778
3194
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
2820
3236
        if test -n "$8"; then
2821
3237
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2822
3238
          $echo "$help" 1>&2
2823
 
          exit 1
 
3239
          exit $EXIT_FAILURE
2824
3240
        fi
2825
3241
 
2826
3242
        # convert absolute version numbers to libtool ages
2827
3243
        # this retains compatibility with .la files and attempts
2828
3244
        # to make the code below a bit more comprehensible
2829
 
        
 
3245
 
2830
3246
        case $vinfo_number in
2831
3247
        yes)
2832
3248
          number_major="$2"
2840
3256
          # which has an extra 1 added just for fun
2841
3257
          #
2842
3258
          case $version_type in
2843
 
          darwin|linux|osf|windows)
 
3259
          darwin|linux|osf|windows|none)
2844
3260
            current=`expr $number_major + $number_minor`
2845
3261
            age="$number_minor"
2846
3262
            revision="$number_revision"
2851
3267
            age="0"
2852
3268
            ;;
2853
3269
          irix|nonstopux)
2854
 
            current=`expr $number_major + $number_minor - 1`
 
3270
            current=`expr $number_major + $number_minor`
2855
3271
            age="$number_minor"
2856
3272
            revision="$number_minor"
 
3273
            lt_irix_increment=no
 
3274
            ;;
 
3275
          *)
 
3276
            $echo "$modename: unknown library version type \`$version_type'" 1>&2
 
3277
            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3278
            exit $EXIT_FAILURE
2857
3279
            ;;
2858
3280
          esac
2859
3281
          ;;
2866
3288
 
2867
3289
        # Check that each of the things are valid numbers.
2868
3290
        case $current in
2869
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3291
        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]) ;;
2870
3292
        *)
2871
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3293
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2872
3294
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2873
 
          exit 1
 
3295
          exit $EXIT_FAILURE
2874
3296
          ;;
2875
3297
        esac
2876
3298
 
2877
3299
        case $revision in
2878
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3300
        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]) ;;
2879
3301
        *)
2880
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3302
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2881
3303
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2882
 
          exit 1
 
3304
          exit $EXIT_FAILURE
2883
3305
          ;;
2884
3306
        esac
2885
3307
 
2886
3308
        case $age in
2887
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3309
        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]) ;;
2888
3310
        *)
2889
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3311
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2890
3312
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2891
 
          exit 1
 
3313
          exit $EXIT_FAILURE
2892
3314
          ;;
2893
3315
        esac
2894
3316
 
2895
3317
        if test "$age" -gt "$current"; then
2896
3318
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2897
3319
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2898
 
          exit 1
 
3320
          exit $EXIT_FAILURE
2899
3321
        fi
2900
3322
 
2901
3323
        # Calculate the version variables.
2912
3334
          versuffix="$major.$age.$revision"
2913
3335
          # Darwin ld doesn't like 0 for these options...
2914
3336
          minor_current=`expr $current + 1`
 
3337
          xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2915
3338
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2916
3339
          ;;
2917
3340
 
2926
3349
          ;;
2927
3350
 
2928
3351
        irix | nonstopux)
2929
 
          major=`expr $current - $age + 1`
2930
 
 
 
3352
          if test "X$lt_irix_increment" = "Xno"; then
 
3353
            major=`expr $current - $age`
 
3354
          else
 
3355
            major=`expr $current - $age + 1`
 
3356
          fi
2931
3357
          case $version_type in
2932
3358
            nonstopux) verstring_prefix=nonstopux ;;
2933
3359
            *)         verstring_prefix=sgi ;;
2984
3410
        *)
2985
3411
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2986
3412
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2987
 
          exit 1
 
3413
          exit $EXIT_FAILURE
2988
3414
          ;;
2989
3415
        esac
2990
3416
 
3038
3464
            *.$objext)
3039
3465
               ;;
3040
3466
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3467
               if test "X$precious_files_regex" != "X"; then
 
3468
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3469
                 then
 
3470
                   continue
 
3471
                 fi
 
3472
               fi
3041
3473
               removelist="$removelist $p"
3042
3474
               ;;
3043
3475
            *) ;;
3058
3490
      fi
3059
3491
 
3060
3492
      # Eliminate all temporary directories.
3061
 
      for path in $notinst_path; do
3062
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3063
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3064
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3065
 
      done
 
3493
      #for path in $notinst_path; do
 
3494
      # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3495
      # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3496
      # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
 
3497
      #done
3066
3498
 
3067
3499
      if test -n "$xrpath"; then
3068
3500
        # If the user specified any rpath flags, then add them.
3112
3544
          *-*-netbsd*)
3113
3545
            # Don't link with libc until the a.out ld.so is fixed.
3114
3546
            ;;
3115
 
          *-*-openbsd* | *-*-freebsd*)
 
3547
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3116
3548
            # Do not include libc due to us having libc/libc_r.
3117
 
            test "X$arg" = "X-lc" && continue
 
3549
            ;;
 
3550
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3551
            # Causes problems with __ctype
 
3552
            ;;
 
3553
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3554
            # Compiler inserts libc in the correct place for threads to work
3118
3555
            ;;
3119
3556
          *)
3120
3557
            # Add libc to deplibs on all other systems if necessary.
3158
3595
          int main() { return 0; }
3159
3596
EOF
3160
3597
          $rm conftest
3161
 
          $LTCC -o conftest conftest.c $deplibs
3162
 
          if test "$?" -eq 0 ; then
 
3598
          if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3163
3599
            ldd_output=`ldd conftest`
3164
3600
            for i in $deplibs; do
3165
 
              name="`expr $i : '-l\(.*\)'`"
 
3601
              name=`expr $i : '-l\(.*\)'`
3166
3602
              # If $name is empty we are operating on a -L argument.
3167
 
              if test "$name" != "" && test "$name" -ne "0"; then
 
3603
              if test "$name" != "" && test "$name" != "0"; then
3168
3604
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3169
3605
                  case " $predeps $postdeps " in
3170
3606
                  *" $i "*)
3199
3635
            # Error occurred in the first compile.  Let's try to salvage
3200
3636
            # the situation: Compile a separate program for each library.
3201
3637
            for i in $deplibs; do
3202
 
              name="`expr $i : '-l\(.*\)'`"
 
3638
              name=`expr $i : '-l\(.*\)'`
3203
3639
              # If $name is empty we are operating on a -L argument.
3204
3640
              if test "$name" != "" && test "$name" != "0"; then
3205
3641
                $rm conftest
3206
 
                $LTCC -o conftest conftest.c $i
3207
 
                # Did it work?
3208
 
                if test "$?" -eq 0 ; then
 
3642
                if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3209
3643
                  ldd_output=`ldd conftest`
3210
3644
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3211
3645
                    case " $predeps $postdeps " in
3237
3671
                  droppeddeps=yes
3238
3672
                  $echo
3239
3673
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3240
 
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3674
                  $echo "*** make it link in!  You will probably need to install it or some"
3241
3675
                  $echo "*** library that it depends on before this library will be fully"
3242
3676
                  $echo "*** functional.  Installing it before continuing would be even better."
3243
3677
                fi
3251
3685
          set dummy $deplibs_check_method
3252
3686
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3253
3687
          for a_deplib in $deplibs; do
3254
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3688
            name=`expr $a_deplib : '-l\(.*\)'`
3255
3689
            # If $name is empty we are operating on a -L argument.
3256
3690
            if test "$name" != "" && test  "$name" != "0"; then
3257
3691
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3320
3754
          set dummy $deplibs_check_method
3321
3755
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3322
3756
          for a_deplib in $deplibs; do
3323
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3757
            name=`expr $a_deplib : '-l\(.*\)'`
3324
3758
            # If $name is empty we are operating on a -L argument.
3325
3759
            if test -n "$name" && test "$name" != "0"; then
3326
3760
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3450
3884
        deplibs=$newdeplibs
3451
3885
      fi
3452
3886
 
 
3887
 
 
3888
      # move library search paths that coincide with paths to not yet
 
3889
      # installed libraries to the beginning of the library search list
 
3890
      new_libs=
 
3891
      for path in $notinst_path; do
 
3892
        case " $new_libs " in
 
3893
        *" -L$path/$objdir "*) ;;
 
3894
        *)
 
3895
          case " $deplibs " in
 
3896
          *" -L$path/$objdir "*)
 
3897
            new_libs="$new_libs -L$path/$objdir" ;;
 
3898
          esac
 
3899
          ;;
 
3900
        esac
 
3901
      done
 
3902
      for deplib in $deplibs; do
 
3903
        case $deplib in
 
3904
        -L*)
 
3905
          case " $new_libs " in
 
3906
          *" $deplib "*) ;;
 
3907
          *) new_libs="$new_libs $deplib" ;;
 
3908
          esac
 
3909
          ;;
 
3910
        *) new_libs="$new_libs $deplib" ;;
 
3911
        esac
 
3912
      done
 
3913
      deplibs="$new_libs"
 
3914
 
 
3915
 
3453
3916
      # All the library-specific variables (install_libdir is set above).
3454
3917
      library_names=
3455
3918
      old_library=
3494
3957
             test -n "$hardcode_libdirs"; then
3495
3958
            libdir="$hardcode_libdirs"
3496
3959
            if test -n "$hardcode_libdir_flag_spec_ld"; then
3497
 
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3960
              case $archive_cmds in
 
3961
              *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
 
3962
              *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
 
3963
              esac
3498
3964
            else
3499
3965
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3500
3966
            fi
3517
3983
        fi
3518
3984
 
3519
3985
        # Get the real and link names of the library.
3520
 
        eval shared_ext=\"$shrext\"
 
3986
        eval shared_ext=\"$shrext_cmds\"
3521
3987
        eval library_names=\"$library_names_spec\"
3522
3988
        set dummy $library_names
3523
3989
        realname="$2"
3533
3999
        fi
3534
4000
 
3535
4001
        lib="$output_objdir/$realname"
 
4002
        linknames=
3536
4003
        for link
3537
4004
        do
3538
4005
          linknames="$linknames $link"
3547
4014
            $show "generating symbol list for \`$libname.la'"
3548
4015
            export_symbols="$output_objdir/$libname.exp"
3549
4016
            $run $rm $export_symbols
3550
 
            eval cmds=\"$export_symbols_cmds\"
 
4017
            cmds=$export_symbols_cmds
3551
4018
            save_ifs="$IFS"; IFS='~'
3552
4019
            for cmd in $cmds; do
3553
4020
              IFS="$save_ifs"
 
4021
              eval cmd=\"$cmd\"
3554
4022
              if len=`expr "X$cmd" : ".*"` &&
3555
4023
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3556
4024
                $show "$cmd"
3560
4028
                # The command line is too long to execute in one step.
3561
4029
                $show "using reloadable object file for export list..."
3562
4030
                skipped_export=:
 
4031
                # Break out early, otherwise skipped_export may be
 
4032
                # set to false by a later but shorter cmd.
 
4033
                break
3563
4034
              fi
3564
4035
            done
3565
4036
            IFS="$save_ifs"
3580
4051
        for test_deplib in $deplibs; do
3581
4052
                case " $convenience " in
3582
4053
                *" $test_deplib "*) ;;
3583
 
                *) 
 
4054
                *)
3584
4055
                        tmp_deplibs="$tmp_deplibs $test_deplib"
3585
4056
                        ;;
3586
4057
                esac
3587
4058
        done
3588
 
        deplibs="$tmp_deplibs" 
 
4059
        deplibs="$tmp_deplibs"
3589
4060
 
3590
4061
        if test -n "$convenience"; then
3591
4062
          if test -n "$whole_archive_flag_spec"; then
3593
4064
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3594
4065
          else
3595
4066
            gentop="$output_objdir/${outputname}x"
3596
 
            $show "${rm}r $gentop"
3597
 
            $run ${rm}r "$gentop"
3598
 
            $show "$mkdir $gentop"
3599
 
            $run $mkdir "$gentop"
3600
 
            status=$?
3601
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
3602
 
              exit $status
3603
 
            fi
3604
4067
            generated="$generated $gentop"
3605
4068
 
3606
 
            for xlib in $convenience; do
3607
 
              # Extract the objects.
3608
 
              case $xlib in
3609
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3610
 
              *) xabs=`pwd`"/$xlib" ;;
3611
 
              esac
3612
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3613
 
              xdir="$gentop/$xlib"
3614
 
 
3615
 
              $show "${rm}r $xdir"
3616
 
              $run ${rm}r "$xdir"
3617
 
              $show "$mkdir $xdir"
3618
 
              $run $mkdir "$xdir"
3619
 
              status=$?
3620
 
              if test "$status" -ne 0 && test ! -d "$xdir"; then
3621
 
                exit $status
3622
 
              fi
3623
 
              # We will extract separately just the conflicting names and we will no
3624
 
              # longer touch any unique names. It is faster to leave these extract
3625
 
              # automatically by $AR in one run.
3626
 
              $show "(cd $xdir && $AR x $xabs)"
3627
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3628
 
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3629
 
                :
3630
 
              else
3631
 
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3632
 
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3633
 
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
3634
 
                do
3635
 
                  i=1
3636
 
                  while test "$i" -le "$count"
3637
 
                  do
3638
 
                   # Put our $i before any first dot (extension)
3639
 
                   # Never overwrite any file
3640
 
                   name_to="$name"
3641
 
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3642
 
                   do
3643
 
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3644
 
                   done
3645
 
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3646
 
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3647
 
                   i=`expr $i + 1`
3648
 
                  done
3649
 
                done
3650
 
              fi
3651
 
 
3652
 
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3653
 
            done
 
4069
            func_extract_archives $gentop $convenience
 
4070
            libobjs="$libobjs $func_extract_archives_result"
3654
4071
          fi
3655
4072
        fi
3656
 
 
 
4073
        
3657
4074
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3658
4075
          eval flag=\"$thread_safe_flag_spec\"
3659
4076
          linker_flags="$linker_flags $flag"
3667
4084
        # Do each of the archive commands.
3668
4085
        if test "$module" = yes && test -n "$module_cmds" ; then
3669
4086
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3670
 
            eval cmds=\"$module_expsym_cmds\"
 
4087
            eval test_cmds=\"$module_expsym_cmds\"
 
4088
            cmds=$module_expsym_cmds
3671
4089
          else
3672
 
            eval cmds=\"$module_cmds\"
 
4090
            eval test_cmds=\"$module_cmds\"
 
4091
            cmds=$module_cmds
3673
4092
          fi
3674
4093
        else
3675
4094
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3676
 
          eval cmds=\"$archive_expsym_cmds\"
 
4095
          eval test_cmds=\"$archive_expsym_cmds\"
 
4096
          cmds=$archive_expsym_cmds
3677
4097
        else
3678
 
          eval cmds=\"$archive_cmds\"
 
4098
          eval test_cmds=\"$archive_cmds\"
 
4099
          cmds=$archive_cmds
3679
4100
          fi
3680
4101
        fi
3681
4102
 
3682
 
        if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
 
4103
        if test "X$skipped_export" != "X:" &&
 
4104
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3683
4105
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3684
4106
          :
3685
4107
        else
3698
4120
            save_libobjs=$libobjs
3699
4121
          fi
3700
4122
          save_output=$output
 
4123
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
3701
4124
 
3702
4125
          # Clear the reloadable object creation command queue and
3703
4126
          # initialize k to one.
3707
4130
          delfiles=
3708
4131
          last_robj=
3709
4132
          k=1
3710
 
          output=$output_objdir/$save_output-${k}.$objext
 
4133
          output=$output_objdir/$output_la-${k}.$objext
3711
4134
          # Loop over the list of objects to be linked.
3712
4135
          for obj in $save_libobjs
3713
4136
          do
3714
4137
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3715
4138
            if test "X$objlist" = X ||
3716
 
               { len=`expr "X$test_cmds" : ".*"` &&
 
4139
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3717
4140
                 test "$len" -le "$max_cmd_len"; }; then
3718
4141
              objlist="$objlist $obj"
3719
4142
            else
3727
4150
                # the last one created.
3728
4151
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3729
4152
              fi
3730
 
              last_robj=$output_objdir/$save_output-${k}.$objext
 
4153
              last_robj=$output_objdir/$output_la-${k}.$objext
3731
4154
              k=`expr $k + 1`
3732
 
              output=$output_objdir/$save_output-${k}.$objext
 
4155
              output=$output_objdir/$output_la-${k}.$objext
3733
4156
              objlist=$obj
3734
4157
              len=1
3735
4158
            fi
3749
4172
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3750
4173
          fi
3751
4174
 
3752
 
          # Set up a command to remove the reloadale object files
 
4175
          # Set up a command to remove the reloadable object files
3753
4176
          # after they are used.
3754
4177
          i=0
3755
4178
          while test "$i" -lt "$k"
3756
4179
          do
3757
4180
            i=`expr $i + 1`
3758
 
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
4181
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3759
4182
          done
3760
4183
 
3761
4184
          $echo "creating a temporary reloadable object file: $output"
3780
4203
          # value of $libobjs for piecewise linking.
3781
4204
 
3782
4205
          # Do each of the archive commands.
 
4206
          if test "$module" = yes && test -n "$module_cmds" ; then
 
4207
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
4208
              cmds=$module_expsym_cmds
 
4209
            else
 
4210
              cmds=$module_cmds
 
4211
            fi
 
4212
          else
3783
4213
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3784
 
            eval cmds=\"$archive_expsym_cmds\"
 
4214
            cmds=$archive_expsym_cmds
3785
4215
          else
3786
 
            eval cmds=\"$archive_cmds\"
 
4216
            cmds=$archive_cmds
 
4217
            fi
3787
4218
          fi
3788
4219
 
3789
4220
          # Append the command to remove the reloadable object files
3790
4221
          # to the just-reset $cmds.
3791
 
          eval cmds=\"\$cmds~$rm $delfiles\"
 
4222
          eval cmds=\"\$cmds~\$rm $delfiles\"
3792
4223
        fi
3793
4224
        save_ifs="$IFS"; IFS='~'
3794
4225
        for cmd in $cmds; do
3795
4226
          IFS="$save_ifs"
 
4227
          eval cmd=\"$cmd\"
3796
4228
          $show "$cmd"
3797
 
          $run eval "$cmd" || exit $?
 
4229
          $run eval "$cmd" || {
 
4230
            lt_exit=$?
 
4231
 
 
4232
            # Restore the uninstalled library and exit
 
4233
            if test "$mode" = relink; then
 
4234
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4235
            fi
 
4236
 
 
4237
            exit $lt_exit
 
4238
          }
3798
4239
        done
3799
4240
        IFS="$save_ifs"
3800
4241
 
3801
4242
        # Restore the uninstalled library and exit
3802
4243
        if test "$mode" = relink; then
3803
4244
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3804
 
          exit 0
 
4245
 
 
4246
          if test -n "$convenience"; then
 
4247
            if test -z "$whole_archive_flag_spec"; then
 
4248
              $show "${rm}r $gentop"
 
4249
              $run ${rm}r "$gentop"
 
4250
            fi
 
4251
          fi
 
4252
 
 
4253
          exit $EXIT_SUCCESS
3805
4254
        fi
3806
4255
 
3807
4256
        # Create links to the real library.
3821
4270
      ;;
3822
4271
 
3823
4272
    obj)
3824
 
      if test -n "$deplibs"; then
3825
 
        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3826
 
      fi
 
4273
      case " $deplibs" in
 
4274
      *\ -l* | *\ -L*)
 
4275
        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
 
4276
      esac
3827
4277
 
3828
4278
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3829
4279
        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3849
4299
      *.lo)
3850
4300
        if test -n "$objs$old_deplibs"; then
3851
4301
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3852
 
          exit 1
 
4302
          exit $EXIT_FAILURE
3853
4303
        fi
3854
4304
        libobj="$output"
3855
4305
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3870
4320
      reload_conv_objs=
3871
4321
      gentop=
3872
4322
      # reload_cmds runs $LD directly, so let us get rid of
3873
 
      # -Wl from whole_archive_flag_spec
 
4323
      # -Wl from whole_archive_flag_spec and hope we can get by with
 
4324
      # turning comma into space..
3874
4325
      wl=
3875
4326
 
3876
4327
      if test -n "$convenience"; then
3877
4328
        if test -n "$whole_archive_flag_spec"; then
3878
 
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
 
4329
          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
 
4330
          reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
3879
4331
        else
3880
4332
          gentop="$output_objdir/${obj}x"
3881
 
          $show "${rm}r $gentop"
3882
 
          $run ${rm}r "$gentop"
3883
 
          $show "$mkdir $gentop"
3884
 
          $run $mkdir "$gentop"
3885
 
          status=$?
3886
 
          if test "$status" -ne 0 && test ! -d "$gentop"; then
3887
 
            exit $status
3888
 
          fi
3889
4333
          generated="$generated $gentop"
3890
4334
 
3891
 
          for xlib in $convenience; do
3892
 
            # Extract the objects.
3893
 
            case $xlib in
3894
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3895
 
            *) xabs=`pwd`"/$xlib" ;;
3896
 
            esac
3897
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3898
 
            xdir="$gentop/$xlib"
3899
 
 
3900
 
            $show "${rm}r $xdir"
3901
 
            $run ${rm}r "$xdir"
3902
 
            $show "$mkdir $xdir"
3903
 
            $run $mkdir "$xdir"
3904
 
            status=$?
3905
 
            if test "$status" -ne 0 && test ! -d "$xdir"; then
3906
 
              exit $status
3907
 
            fi
3908
 
            # We will extract separately just the conflicting names and we will no
3909
 
            # longer touch any unique names. It is faster to leave these extract
3910
 
            # automatically by $AR in one run.
3911
 
            $show "(cd $xdir && $AR x $xabs)"
3912
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3913
 
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3914
 
              :
3915
 
            else
3916
 
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3917
 
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3918
 
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
3919
 
              do
3920
 
                i=1
3921
 
                while test "$i" -le "$count"
3922
 
                do
3923
 
                 # Put our $i before any first dot (extension)
3924
 
                 # Never overwrite any file
3925
 
                 name_to="$name"
3926
 
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3927
 
                 do
3928
 
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3929
 
                 done
3930
 
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3931
 
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3932
 
                 i=`expr $i + 1`
3933
 
                done
3934
 
              done
3935
 
            fi
3936
 
 
3937
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3938
 
          done
 
4335
          func_extract_archives $gentop $convenience
 
4336
          reload_conv_objs="$reload_objs $func_extract_archives_result"
3939
4337
        fi
3940
4338
      fi
3941
4339
 
3943
4341
      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
3944
4342
 
3945
4343
      output="$obj"
3946
 
      eval cmds=\"$reload_cmds\"
 
4344
      cmds=$reload_cmds
3947
4345
      save_ifs="$IFS"; IFS='~'
3948
4346
      for cmd in $cmds; do
3949
4347
        IFS="$save_ifs"
 
4348
        eval cmd=\"$cmd\"
3950
4349
        $show "$cmd"
3951
4350
        $run eval "$cmd" || exit $?
3952
4351
      done
3959
4358
          $run ${rm}r $gentop
3960
4359
        fi
3961
4360
 
3962
 
        exit 0
 
4361
        exit $EXIT_SUCCESS
3963
4362
      fi
3964
4363
 
3965
4364
      if test "$build_libtool_libs" != yes; then
3972
4371
        # accidentally link it into a program.
3973
4372
        # $show "echo timestamp > $libobj"
3974
4373
        # $run eval "echo timestamp > $libobj" || exit $?
3975
 
        exit 0
 
4374
        exit $EXIT_SUCCESS
3976
4375
      fi
3977
4376
 
3978
4377
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3979
4378
        # Only do commands if we really have different PIC objects.
3980
4379
        reload_objs="$libobjs $reload_conv_objs"
3981
4380
        output="$libobj"
3982
 
        eval cmds=\"$reload_cmds\"
 
4381
        cmds=$reload_cmds
3983
4382
        save_ifs="$IFS"; IFS='~'
3984
4383
        for cmd in $cmds; do
3985
4384
          IFS="$save_ifs"
 
4385
          eval cmd=\"$cmd\"
3986
4386
          $show "$cmd"
3987
4387
          $run eval "$cmd" || exit $?
3988
4388
        done
3994
4394
        $run ${rm}r $gentop
3995
4395
      fi
3996
4396
 
3997
 
      exit 0
 
4397
      exit $EXIT_SUCCESS
3998
4398
      ;;
3999
4399
 
4000
4400
    prog)
4034
4434
        ;;
4035
4435
      esac
4036
4436
 
 
4437
 
 
4438
      # move library search paths that coincide with paths to not yet
 
4439
      # installed libraries to the beginning of the library search list
 
4440
      new_libs=
 
4441
      for path in $notinst_path; do
 
4442
        case " $new_libs " in
 
4443
        *" -L$path/$objdir "*) ;;
 
4444
        *)
 
4445
          case " $compile_deplibs " in
 
4446
          *" -L$path/$objdir "*)
 
4447
            new_libs="$new_libs -L$path/$objdir" ;;
 
4448
          esac
 
4449
          ;;
 
4450
        esac
 
4451
      done
 
4452
      for deplib in $compile_deplibs; do
 
4453
        case $deplib in
 
4454
        -L*)
 
4455
          case " $new_libs " in
 
4456
          *" $deplib "*) ;;
 
4457
          *) new_libs="$new_libs $deplib" ;;
 
4458
          esac
 
4459
          ;;
 
4460
        *) new_libs="$new_libs $deplib" ;;
 
4461
        esac
 
4462
      done
 
4463
      compile_deplibs="$new_libs"
 
4464
 
 
4465
 
4037
4466
      compile_command="$compile_command $compile_deplibs"
4038
4467
      finalize_command="$finalize_command $finalize_deplibs"
4039
4468
 
4078
4507
        fi
4079
4508
        case $host in
4080
4509
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4510
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4081
4511
          case :$dllsearchpath: in
4082
4512
          *":$libdir:"*) ;;
4083
4513
          *) dllsearchpath="$dllsearchpath:$libdir";;
4084
4514
          esac
 
4515
          case :$dllsearchpath: in
 
4516
          *":$testbindir:"*) ;;
 
4517
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4518
          esac
4085
4519
          ;;
4086
4520
        esac
4087
4521
      done
4195
4629
 
4196
4630
            # Prepare the list of exported symbols
4197
4631
            if test -z "$export_symbols"; then
4198
 
              export_symbols="$output_objdir/$output.exp"
 
4632
              export_symbols="$output_objdir/$outputname.exp"
4199
4633
              $run $rm $export_symbols
4200
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4634
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4635
              case $host in
 
4636
              *cygwin* | *mingw* )
 
4637
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4638
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4639
                ;;
 
4640
              esac
4201
4641
            else
4202
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4203
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4642
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4643
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4204
4644
              $run eval 'mv "$nlist"T "$nlist"'
 
4645
              case $host in
 
4646
              *cygwin* | *mingw* )
 
4647
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4648
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4649
                ;;
 
4650
              esac
4205
4651
            fi
4206
4652
          fi
4207
4653
 
4252
4698
#endif
4253
4699
 
4254
4700
/* The mapping between symbol names and symbols. */
 
4701
"
 
4702
 
 
4703
            case $host in
 
4704
            *cygwin* | *mingw* )
 
4705
          $echo >> "$output_objdir/$dlsyms" "\
 
4706
/* DATA imports from DLLs on WIN32 can't be const, because
 
4707
   runtime relocations are performed -- see ld's documentation
 
4708
   on pseudo-relocs */
 
4709
struct {
 
4710
"
 
4711
              ;;
 
4712
            * )
 
4713
          $echo >> "$output_objdir/$dlsyms" "\
4255
4714
const struct {
 
4715
"
 
4716
              ;;
 
4717
            esac
 
4718
 
 
4719
 
 
4720
          $echo >> "$output_objdir/$dlsyms" "\
4256
4721
  const char *name;
4257
4722
  lt_ptr address;
4258
4723
}
4299
4764
          esac
4300
4765
 
4301
4766
          # Now compile the dynamic symbol file.
4302
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4303
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4767
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4768
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4304
4769
 
4305
4770
          # Clean up the generated files.
4306
4771
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4307
4772
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4308
4773
 
4309
4774
          # Transform the symbol file into the correct name.
4310
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4311
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4775
          case $host in
 
4776
          *cygwin* | *mingw* )
 
4777
            if test -f "$output_objdir/${outputname}.def" ; then
 
4778
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4779
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4780
            else
 
4781
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4782
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4783
             fi
 
4784
            ;;
 
4785
          * )
 
4786
            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4787
            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4788
            ;;
 
4789
          esac
4312
4790
          ;;
4313
4791
        *)
4314
4792
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4315
 
          exit 1
 
4793
          exit $EXIT_FAILURE
4316
4794
          ;;
4317
4795
        esac
4318
4796
      else
4321
4799
        # really was required.
4322
4800
 
4323
4801
        # Nullify the symbol file.
4324
 
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4325
 
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
 
4802
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
 
4803
        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4326
4804
      fi
4327
4805
 
4328
4806
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4329
4807
        # Replace the output file specification.
4330
 
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
4808
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4331
4809
        link_command="$compile_command$compile_rpath"
4332
4810
 
4333
4811
        # We have no uninstalled library dependencies, so finalize right now.
4334
4812
        $show "$link_command"
4335
4813
        $run eval "$link_command"
4336
 
        status=$?
 
4814
        exit_status=$?
4337
4815
 
4338
4816
        # Delete the generated files.
4339
4817
        if test -n "$dlsyms"; then
4341
4819
          $run $rm "$output_objdir/${outputname}S.${objext}"
4342
4820
        fi
4343
4821
 
4344
 
        exit $status
 
4822
        exit $exit_status
4345
4823
      fi
4346
4824
 
4347
4825
      if test -n "$shlibpath_var"; then
4400
4878
        # Link the executable and exit
4401
4879
        $show "$link_command"
4402
4880
        $run eval "$link_command" || exit $?
4403
 
        exit 0
 
4881
        exit $EXIT_SUCCESS
4404
4882
      fi
4405
4883
 
4406
4884
      if test "$hardcode_action" = relink; then
4414
4892
        if test "$fast_install" != no; then
4415
4893
          link_command="$finalize_var$compile_command$finalize_rpath"
4416
4894
          if test "$fast_install" = yes; then
4417
 
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
 
4895
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4418
4896
          else
4419
4897
            # fast_install is set to needless
4420
4898
            relink_command=
4451
4929
          fi
4452
4930
        done
4453
4931
        relink_command="(cd `pwd`; $relink_command)"
4454
 
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
4932
        relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4455
4933
      fi
4456
4934
 
4457
4935
      # Quote $echo for shipping.
4458
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4459
 
        case $0 in
4460
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4461
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4936
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4937
        case $progpath in
 
4938
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4939
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4462
4940
        esac
4463
4941
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4464
4942
      else
4481
4959
        esac
4482
4960
        case $host in
4483
4961
          *cygwin* | *mingw* )
4484
 
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4485
 
            cwrapper=`$echo ${output}.exe`
4486
 
            $rm $cwrappersource $cwrapper
4487
 
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
 
4962
            output_name=`basename $output`
 
4963
            output_path=`dirname $output`
 
4964
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4965
            cwrapper="$output_path/$output_name.exe"
 
4966
            $rm $cwrappersource $cwrapper
 
4967
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4488
4968
 
4489
4969
            cat > $cwrappersource <<EOF
4490
4970
 
4493
4973
 
4494
4974
   The $output program cannot be directly executed until all the libtool
4495
4975
   libraries that it depends on are installed.
4496
 
   
 
4976
 
4497
4977
   This wrapper executable should never be moved out of the build directory.
4498
4978
   If it is, it will not operate correctly.
4499
4979
 
4509
4989
#include <malloc.h>
4510
4990
#include <stdarg.h>
4511
4991
#include <assert.h>
 
4992
#include <string.h>
 
4993
#include <ctype.h>
4512
4994
#include <sys/stat.h>
4513
4995
 
4514
4996
#if defined(PATH_MAX)
4527
5009
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4528
5010
  defined (__OS2__)
4529
5011
# define HAVE_DOS_BASED_FILE_SYSTEM
4530
 
# ifndef DIR_SEPARATOR_2 
 
5012
# ifndef DIR_SEPARATOR_2
4531
5013
#  define DIR_SEPARATOR_2 '\\'
4532
5014
# endif
4533
 
# ifndef PATH_SEPARATOR_2 
 
5015
# ifndef PATH_SEPARATOR_2
4534
5016
#  define PATH_SEPARATOR_2 ';'
4535
5017
# endif
4536
5018
#endif
4553
5035
  if (stale) { free ((void *) stale); stale = 0; } \
4554
5036
} while (0)
4555
5037
 
 
5038
/* -DDEBUG is fairly common in CFLAGS.  */
 
5039
#undef DEBUG
4556
5040
#if defined DEBUGWRAPPER
4557
5041
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4558
5042
#else
4559
 
# define DEBUG(format, ...) 
 
5043
# define DEBUG(format, ...)
4560
5044
#endif
4561
5045
 
4562
5046
const char *program_name = NULL;
4563
5047
 
4564
5048
void * xmalloc (size_t num);
4565
5049
char * xstrdup (const char *string);
4566
 
char * basename (const char *name);
 
5050
const char * base_name (const char *name);
4567
5051
char * find_executable(const char *wrapper);
4568
5052
int    check_executable(const char *path);
4569
5053
char * strendzap(char *str, const char *pat);
4574
5058
{
4575
5059
  char **newargz;
4576
5060
  int i;
4577
 
  
4578
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
5061
 
 
5062
  program_name = (char *) xstrdup (base_name (argv[0]));
4579
5063
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
4580
5064
  DEBUG("(main) program_name : %s\n",program_name);
4581
5065
  newargz = XMALLOC(char *, argc+2);
4582
5066
EOF
4583
5067
 
4584
 
            cat >> $cwrappersource <<EOF
4585
 
  newargz[0] = "$SHELL";
 
5068
            cat >> $cwrappersource <<EOF
 
5069
  newargz[0] = (char *) xstrdup("$SHELL");
4586
5070
EOF
4587
5071
 
4588
 
            cat >> $cwrappersource <<"EOF"
 
5072
            cat >> $cwrappersource <<"EOF"
4589
5073
  newargz[1] = find_executable(argv[0]);
4590
5074
  if (newargz[1] == NULL)
4591
5075
    lt_fatal("Couldn't find %s", argv[0]);
4592
5076
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4593
5077
  /* we know the script has the same name, without the .exe */
4594
5078
  /* so make sure newargz[1] doesn't end in .exe */
4595
 
  strendzap(newargz[1],".exe"); 
 
5079
  strendzap(newargz[1],".exe");
4596
5080
  for (i = 1; i < argc; i++)
4597
5081
    newargz[i+1] = xstrdup(argv[i]);
4598
5082
  newargz[argc+1] = NULL;
4605
5089
 
4606
5090
EOF
4607
5091
 
4608
 
            cat >> $cwrappersource <<EOF
 
5092
            case $host_os in
 
5093
              mingw*)
 
5094
                cat >> $cwrappersource <<EOF
 
5095
  execv("$SHELL",(char const **)newargz);
 
5096
EOF
 
5097
              ;;
 
5098
              *)
 
5099
                cat >> $cwrappersource <<EOF
4609
5100
  execv("$SHELL",newargz);
4610
5101
EOF
 
5102
              ;;
 
5103
            esac
4611
5104
 
4612
 
            cat >> $cwrappersource <<"EOF"
 
5105
            cat >> $cwrappersource <<"EOF"
 
5106
  return 127;
4613
5107
}
4614
5108
 
4615
5109
void *
4622
5116
  return p;
4623
5117
}
4624
5118
 
4625
 
char * 
 
5119
char *
4626
5120
xstrdup (const char *string)
4627
5121
{
4628
5122
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4629
5123
;
4630
5124
}
4631
5125
 
4632
 
char *
4633
 
basename (const char *name)
 
5126
const char *
 
5127
base_name (const char *name)
4634
5128
{
4635
5129
  const char *base;
4636
5130
 
4637
5131
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4638
5132
  /* Skip over the disk name in MSDOS pathnames. */
4639
 
  if (isalpha (name[0]) && name[1] == ':') 
 
5133
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4640
5134
    name += 2;
4641
5135
#endif
4642
5136
 
4643
5137
  for (base = name; *name; name++)
4644
5138
    if (IS_DIR_SEPARATOR (*name))
4645
5139
      base = name + 1;
4646
 
  return (char *) base;
 
5140
  return base;
4647
5141
}
4648
5142
 
4649
5143
int
4657
5151
 
4658
5152
  if ((stat (path, &st) >= 0) &&
4659
5153
      (
4660
 
#ifdef S_IXOTH
 
5154
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5155
#if defined (S_IXOTH)
4661
5156
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
4662
5157
#endif
4663
 
#ifdef S_IXGRP
 
5158
#if defined (S_IXGRP)
4664
5159
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
4665
5160
#endif
4666
 
       ((st.st_mode & S_IXUSR) == S_IXUSR)))
 
5161
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5162
      )
4667
5163
    return 1;
4668
5164
  else
4669
5165
    return 0;
4677
5173
  int has_slash = 0;
4678
5174
  const char* p;
4679
5175
  const char* p_next;
4680
 
  struct stat st;
4681
5176
  /* static buffer for getcwd */
4682
5177
  char tmp[LT_PATHMAX + 1];
4683
5178
  int tmp_len;
4684
5179
  char* concat_name;
4685
5180
 
4686
5181
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
4687
 
  
 
5182
 
4688
5183
  if ((wrapper == NULL) || (*wrapper == '\0'))
4689
5184
    return NULL;
4690
5185
 
4691
5186
  /* Absolute path? */
4692
5187
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4693
 
  if (isalpha (wrapper[0]) && wrapper[1] == ':')
 
5188
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
4694
5189
  {
4695
5190
    concat_name = xstrdup (wrapper);
4696
5191
    if (check_executable(concat_name))
4773
5268
}
4774
5269
 
4775
5270
char *
4776
 
strendzap(char *str, const char *pat) 
 
5271
strendzap(char *str, const char *pat)
4777
5272
{
4778
5273
  size_t len, patlen;
4779
5274
 
4793
5288
}
4794
5289
 
4795
5290
static void
4796
 
lt_error_core (int exit_status, const char * mode, 
 
5291
lt_error_core (int exit_status, const char * mode,
4797
5292
          const char * message, va_list ap)
4798
5293
{
4799
5294
  fprintf (stderr, "%s: %s: ", program_name, mode);
4813
5308
  va_end (ap);
4814
5309
}
4815
5310
EOF
4816
 
          # we should really use a build-platform specific compiler
4817
 
          # here, but OTOH, the wrappers (shell script and this C one)
4818
 
          # are only useful if you want to execute the "real" binary.
4819
 
          # Since the "real" binary is built for $host, then this
4820
 
          # wrapper might as well be built for $host, too.
4821
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4822
 
          ;;
4823
 
        esac
4824
 
        $rm $output
4825
 
        trap "$rm $output; exit 1" 1 2 15
 
5311
          # we should really use a build-platform specific compiler
 
5312
          # here, but OTOH, the wrappers (shell script and this C one)
 
5313
          # are only useful if you want to execute the "real" binary.
 
5314
          # Since the "real" binary is built for $host, then this
 
5315
          # wrapper might as well be built for $host, too.
 
5316
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5317
          ;;
 
5318
        esac
 
5319
        $rm $output
 
5320
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4826
5321
 
4827
5322
        $echo > $output "\
4828
5323
#! $SHELL
4841
5336
Xsed='${SED} -e 1s/^X//'
4842
5337
sed_quote_subst='$sed_quote_subst'
4843
5338
 
 
5339
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
 
5340
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
 
5341
  emulate sh
 
5342
  NULLCMD=:
 
5343
  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
 
5344
  # is contrary to our usage.  Disable this feature.
 
5345
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
 
5346
  setopt NO_GLOB_SUBST
 
5347
else
 
5348
  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
 
5349
fi
 
5350
BIN_SH=xpg4; export BIN_SH # for Tru64
 
5351
DUALCASE=1; export DUALCASE # for MKS sh
 
5352
 
4844
5353
# The HP-UX ksh and POSIX shell print the target directory to stdout
4845
5354
# if CDPATH is set.
4846
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
5355
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4847
5356
 
4848
5357
relink_command=\"$relink_command\"
4849
5358
 
4922
5431
      else
4923
5432
        $echo \"\$relink_command_output\" >&2
4924
5433
        $rm \"\$progdir/\$file\"
4925
 
        exit 1
 
5434
        exit $EXIT_FAILURE
4926
5435
      fi
4927
5436
    fi
4928
5437
 
4972
5481
        # Backslashes separate directories on plain windows
4973
5482
        *-*-mingw | *-*-os2*)
4974
5483
          $echo >> $output "\
4975
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5484
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4976
5485
"
4977
5486
          ;;
4978
5487
 
4979
5488
        *)
4980
5489
          $echo >> $output "\
4981
 
      exec \$progdir/\$program \${1+\"\$@\"}
 
5490
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
4982
5491
"
4983
5492
          ;;
4984
5493
        esac
4985
5494
        $echo >> $output "\
4986
 
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4987
 
      exit 1
 
5495
      \$echo \"\$0: cannot exec \$program \$*\"
 
5496
      exit $EXIT_FAILURE
4988
5497
    fi
4989
5498
  else
4990
5499
    # The program doesn't exist.
4991
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5500
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4992
5501
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4993
5502
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4994
 
    exit 1
 
5503
    exit $EXIT_FAILURE
4995
5504
  fi
4996
5505
fi\
4997
5506
"
4998
5507
        chmod +x $output
4999
5508
      fi
5000
 
      exit 0
 
5509
      exit $EXIT_SUCCESS
5001
5510
      ;;
5002
5511
    esac
5003
5512
 
5020
5529
 
5021
5530
      if test -n "$addlibs"; then
5022
5531
        gentop="$output_objdir/${outputname}x"
5023
 
        $show "${rm}r $gentop"
5024
 
        $run ${rm}r "$gentop"
5025
 
        $show "$mkdir $gentop"
5026
 
        $run $mkdir "$gentop"
5027
 
        status=$?
5028
 
        if test "$status" -ne 0 && test ! -d "$gentop"; then
5029
 
          exit $status
5030
 
        fi
5031
5532
        generated="$generated $gentop"
5032
5533
 
5033
 
        # Add in members from convenience archives.
5034
 
        for xlib in $addlibs; do
5035
 
          # Extract the objects.
5036
 
          case $xlib in
5037
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5038
 
          *) xabs=`pwd`"/$xlib" ;;
5039
 
          esac
5040
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5041
 
          xdir="$gentop/$xlib"
5042
 
 
5043
 
          $show "${rm}r $xdir"
5044
 
          $run ${rm}r "$xdir"
5045
 
          $show "$mkdir $xdir"
5046
 
          $run $mkdir "$xdir"
5047
 
          status=$?
5048
 
          if test "$status" -ne 0 && test ! -d "$xdir"; then
5049
 
            exit $status
5050
 
          fi
5051
 
          # We will extract separately just the conflicting names and we will no
5052
 
          # longer touch any unique names. It is faster to leave these extract
5053
 
          # automatically by $AR in one run.
5054
 
          $show "(cd $xdir && $AR x $xabs)"
5055
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5056
 
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5057
 
            :
5058
 
          else
5059
 
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5060
 
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5061
 
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
5062
 
            do
5063
 
              i=1
5064
 
              while test "$i" -le "$count"
5065
 
              do
5066
 
               # Put our $i before any first dot (extension)
5067
 
               # Never overwrite any file
5068
 
               name_to="$name"
5069
 
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5070
 
               do
5071
 
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5072
 
               done
5073
 
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5074
 
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5075
 
               i=`expr $i + 1`
5076
 
              done
5077
 
            done
5078
 
          fi
5079
 
 
5080
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5081
 
        done
 
5534
        func_extract_archives $gentop $addlibs
 
5535
        oldobjs="$oldobjs $func_extract_archives_result"
5082
5536
      fi
5083
5537
 
5084
5538
      # Do each command in the archive commands.
5085
5539
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5086
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5540
       cmds=$old_archive_from_new_cmds
5087
5541
      else
 
5542
        # POSIX demands no paths to be encoded in archives.  We have
 
5543
        # to avoid creating archives with duplicate basenames if we
 
5544
        # might have to extract them afterwards, e.g., when creating a
 
5545
        # static archive out of a convenience library, or when linking
 
5546
        # the entirety of a libtool archive into another (currently
 
5547
        # not supported by libtool).
 
5548
        if (for obj in $oldobjs
 
5549
            do
 
5550
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5551
            done | sort | sort -uc >/dev/null 2>&1); then
 
5552
          :
 
5553
        else
 
5554
          $echo "copying selected object files to avoid basename conflicts..."
 
5555
 
 
5556
          if test -z "$gentop"; then
 
5557
            gentop="$output_objdir/${outputname}x"
 
5558
            generated="$generated $gentop"
 
5559
 
 
5560
            $show "${rm}r $gentop"
 
5561
            $run ${rm}r "$gentop"
 
5562
            $show "$mkdir $gentop"
 
5563
            $run $mkdir "$gentop"
 
5564
            exit_status=$?
 
5565
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5566
              exit $exit_status
 
5567
            fi
 
5568
          fi
 
5569
 
 
5570
          save_oldobjs=$oldobjs
 
5571
          oldobjs=
 
5572
          counter=1
 
5573
          for obj in $save_oldobjs
 
5574
          do
 
5575
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5576
            case " $oldobjs " in
 
5577
            " ") oldobjs=$obj ;;
 
5578
            *[\ /]"$objbase "*)
 
5579
              while :; do
 
5580
                # Make sure we don't pick an alternate name that also
 
5581
                # overlaps.
 
5582
                newobj=lt$counter-$objbase
 
5583
                counter=`expr $counter + 1`
 
5584
                case " $oldobjs " in
 
5585
                *[\ /]"$newobj "*) ;;
 
5586
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5587
                esac
 
5588
              done
 
5589
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5590
              $run ln "$obj" "$gentop/$newobj" ||
 
5591
              $run cp "$obj" "$gentop/$newobj"
 
5592
              oldobjs="$oldobjs $gentop/$newobj"
 
5593
              ;;
 
5594
            *) oldobjs="$oldobjs $obj" ;;
 
5595
            esac
 
5596
          done
 
5597
        fi
 
5598
 
5088
5599
        eval cmds=\"$old_archive_cmds\"
5089
5600
 
5090
5601
        if len=`expr "X$cmds" : ".*"` &&
5091
5602
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5092
 
          :
 
5603
          cmds=$old_archive_cmds
5093
5604
        else
5094
5605
          # the command line is too long to link in one step, link in parts
5095
5606
          $echo "using piecewise archive linking..."
5098
5609
          objlist=
5099
5610
          concat_cmds=
5100
5611
          save_oldobjs=$oldobjs
5101
 
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5102
 
          # encoded into archives.  This makes 'ar r' malfunction in
5103
 
          # this piecewise linking case whenever conflicting object
5104
 
          # names appear in distinct ar calls; check, warn and compensate.
5105
 
            if (for obj in $save_oldobjs
5106
 
            do
5107
 
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
5108
 
            done | sort | sort -uc >/dev/null 2>&1); then
5109
 
            :
5110
 
          else
5111
 
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5112
 
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5113
 
            AR_FLAGS=cq
5114
 
          fi
 
5612
 
5115
5613
          # Is there a better way of finding the last object in the list?
5116
5614
          for obj in $save_oldobjs
5117
5615
          do
5118
5616
            last_oldobj=$obj
5119
 
          done  
 
5617
          done
5120
5618
          for obj in $save_oldobjs
5121
5619
          do
5122
5620
            oldobjs="$objlist $obj"
5123
5621
            objlist="$objlist $obj"
5124
5622
            eval test_cmds=\"$old_archive_cmds\"
5125
 
            if len=`expr "X$test_cmds" : ".*"` &&
 
5623
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5126
5624
               test "$len" -le "$max_cmd_len"; then
5127
5625
              :
5128
5626
            else
5130
5628
              oldobjs=$objlist
5131
5629
              if test "$obj" = "$last_oldobj" ; then
5132
5630
                RANLIB=$save_RANLIB
5133
 
              fi  
 
5631
              fi
5134
5632
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5135
5633
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5136
5634
              objlist=
5141
5639
          if test "X$oldobjs" = "X" ; then
5142
5640
            eval cmds=\"\$concat_cmds\"
5143
5641
          else
5144
 
            eval cmds=\"\$concat_cmds~$old_archive_cmds\"
 
5642
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5145
5643
          fi
5146
5644
        fi
5147
5645
      fi
5148
5646
      save_ifs="$IFS"; IFS='~'
5149
5647
      for cmd in $cmds; do
 
5648
        eval cmd=\"$cmd\"
5150
5649
        IFS="$save_ifs"
5151
5650
        $show "$cmd"
5152
5651
        $run eval "$cmd" || exit $?
5178
5677
        fi
5179
5678
      done
5180
5679
      # Quote the link command for shipping.
5181
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
5182
 
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5680
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
 
5681
      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
 
5682
      if test "$hardcode_automatic" = yes ; then
 
5683
        relink_command=
 
5684
      fi
 
5685
 
5183
5686
 
5184
5687
      # Only create the output if not a dry run.
5185
5688
      if test -z "$run"; then
5198
5701
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5199
5702
                if test -z "$libdir"; then
5200
5703
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5201
 
                  exit 1
 
5704
                  exit $EXIT_FAILURE
5202
5705
                fi
5203
5706
                newdependency_libs="$newdependency_libs $libdir/$name"
5204
5707
                ;;
5212
5715
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5213
5716
              if test -z "$libdir"; then
5214
5717
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5215
 
                exit 1
 
5718
                exit $EXIT_FAILURE
5216
5719
              fi
5217
5720
              newdlfiles="$newdlfiles $libdir/$name"
5218
5721
            done
5223
5726
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5224
5727
              if test -z "$libdir"; then
5225
5728
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5226
 
                exit 1
 
5729
                exit $EXIT_FAILURE
5227
5730
              fi
5228
5731
              newdlprefiles="$newdlprefiles $libdir/$name"
5229
5732
            done
5230
5733
            dlprefiles="$newdlprefiles"
 
5734
          else
 
5735
            newdlfiles=
 
5736
            for lib in $dlfiles; do
 
5737
              case $lib in
 
5738
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5739
                *) abs=`pwd`"/$lib" ;;
 
5740
              esac
 
5741
              newdlfiles="$newdlfiles $abs"
 
5742
            done
 
5743
            dlfiles="$newdlfiles"
 
5744
            newdlprefiles=
 
5745
            for lib in $dlprefiles; do
 
5746
              case $lib in
 
5747
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5748
                *) abs=`pwd`"/$lib" ;;
 
5749
              esac
 
5750
              newdlprefiles="$newdlprefiles $abs"
 
5751
            done
 
5752
            dlprefiles="$newdlprefiles"
5231
5753
          fi
5232
5754
          $rm $output
5233
5755
          # place dlname in correct position for cygwin
5284
5806
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5285
5807
      ;;
5286
5808
    esac
5287
 
    exit 0
 
5809
    exit $EXIT_SUCCESS
5288
5810
    ;;
5289
5811
 
5290
5812
  # libtool install mode
5295
5817
    # install_prog (especially on Windows NT).
5296
5818
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5297
5819
       # Allow the use of GNU shtool's install command.
5298
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5820
       $echo "X$nonopt" | grep shtool > /dev/null; then
5299
5821
      # Aesthetically quote it.
5300
5822
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5301
5823
      case $arg in
5302
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5824
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5303
5825
        arg="\"$arg\""
5304
5826
        ;;
5305
5827
      esac
5308
5830
      shift
5309
5831
    else
5310
5832
      install_prog=
5311
 
      arg="$nonopt"
 
5833
      arg=$nonopt
5312
5834
    fi
5313
5835
 
5314
5836
    # The real first argument should be the name of the installation program.
5315
5837
    # Aesthetically quote it.
5316
5838
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5317
5839
    case $arg in
5318
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5840
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5319
5841
      arg="\"$arg\""
5320
5842
      ;;
5321
5843
    esac
5333
5855
    do
5334
5856
      if test -n "$dest"; then
5335
5857
        files="$files $dest"
5336
 
        dest="$arg"
 
5858
        dest=$arg
5337
5859
        continue
5338
5860
      fi
5339
5861
 
5340
5862
      case $arg in
5341
5863
      -d) isdir=yes ;;
5342
 
      -f) prev="-f" ;;
5343
 
      -g) prev="-g" ;;
5344
 
      -m) prev="-m" ;;
5345
 
      -o) prev="-o" ;;
 
5864
      -f) 
 
5865
        case " $install_prog " in
 
5866
        *[\\\ /]cp\ *) ;;
 
5867
        *) prev=$arg ;;
 
5868
        esac
 
5869
        ;;
 
5870
      -g | -m | -o) prev=$arg ;;
5346
5871
      -s)
5347
5872
        stripme=" -s"
5348
5873
        continue
5349
5874
        ;;
5350
 
      -*) ;;
5351
 
 
 
5875
      -*)
 
5876
        ;;
5352
5877
      *)
5353
5878
        # If the previous option needed an argument, then skip it.
5354
5879
        if test -n "$prev"; then
5355
5880
          prev=
5356
5881
        else
5357
 
          dest="$arg"
 
5882
          dest=$arg
5358
5883
          continue
5359
5884
        fi
5360
5885
        ;;
5363
5888
      # Aesthetically quote the argument.
5364
5889
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5365
5890
      case $arg in
5366
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5891
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5367
5892
        arg="\"$arg\""
5368
5893
        ;;
5369
5894
      esac
5373
5898
    if test -z "$install_prog"; then
5374
5899
      $echo "$modename: you must specify an install program" 1>&2
5375
5900
      $echo "$help" 1>&2
5376
 
      exit 1
 
5901
      exit $EXIT_FAILURE
5377
5902
    fi
5378
5903
 
5379
5904
    if test -n "$prev"; then
5380
5905
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5381
5906
      $echo "$help" 1>&2
5382
 
      exit 1
 
5907
      exit $EXIT_FAILURE
5383
5908
    fi
5384
5909
 
5385
5910
    if test -z "$files"; then
5389
5914
        $echo "$modename: you must specify a destination" 1>&2
5390
5915
      fi
5391
5916
      $echo "$help" 1>&2
5392
 
      exit 1
 
5917
      exit $EXIT_FAILURE
5393
5918
    fi
5394
5919
 
5395
5920
    # Strip any trailing slash from the destination.
5410
5935
      if test "$#" -gt 2; then
5411
5936
        $echo "$modename: \`$dest' is not a directory" 1>&2
5412
5937
        $echo "$help" 1>&2
5413
 
        exit 1
 
5938
        exit $EXIT_FAILURE
5414
5939
      fi
5415
5940
    fi
5416
5941
    case $destdir in
5422
5947
        *)
5423
5948
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5424
5949
          $echo "$help" 1>&2
5425
 
          exit 1
 
5950
          exit $EXIT_FAILURE
5426
5951
          ;;
5427
5952
        esac
5428
5953
      done
5451
5976
        else
5452
5977
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5453
5978
          $echo "$help" 1>&2
5454
 
          exit 1
 
5979
          exit $EXIT_FAILURE
5455
5980
        fi
5456
5981
 
5457
5982
        library_names=
5493
6018
          # but it's something to keep an eye on.
5494
6019
          if test "$inst_prefix_dir" = "$destdir"; then
5495
6020
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5496
 
            exit 1
 
6021
            exit $EXIT_FAILURE
5497
6022
          fi
5498
6023
 
5499
6024
          if test -n "$inst_prefix_dir"; then
5500
6025
            # Stick the inst_prefix_dir data into the link command.
5501
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
6026
            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
5502
6027
          else
5503
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
6028
            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
5504
6029
          fi
5505
6030
 
5506
6031
          $echo "$modename: warning: relinking \`$file'" 1>&2
5508
6033
          if $run eval "$relink_command"; then :
5509
6034
          else
5510
6035
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5511
 
            exit 1
 
6036
            exit $EXIT_FAILURE
5512
6037
          fi
5513
6038
        fi
5514
6039
 
5532
6057
 
5533
6058
          if test "$#" -gt 0; then
5534
6059
            # Delete the old symlinks, and create new ones.
 
6060
            # Try `ln -sf' first, because the `ln' binary might depend on
 
6061
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
6062
            # so we also need to try rm && ln -s.
5535
6063
            for linkname
5536
6064
            do
5537
6065
              if test "$linkname" != "$realname"; then
5538
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5539
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
6066
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
6067
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5540
6068
              fi
5541
6069
            done
5542
6070
          fi
5543
6071
 
5544
6072
          # Do each command in the postinstall commands.
5545
6073
          lib="$destdir/$realname"
5546
 
          eval cmds=\"$postinstall_cmds\"
 
6074
          cmds=$postinstall_cmds
5547
6075
          save_ifs="$IFS"; IFS='~'
5548
6076
          for cmd in $cmds; do
5549
6077
            IFS="$save_ifs"
 
6078
            eval cmd=\"$cmd\"
5550
6079
            $show "$cmd"
5551
 
            $run eval "$cmd" || exit $?
 
6080
            $run eval "$cmd" || {
 
6081
              lt_exit=$?
 
6082
 
 
6083
              # Restore the uninstalled library and exit
 
6084
              if test "$mode" = relink; then
 
6085
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
6086
              fi
 
6087
 
 
6088
              exit $lt_exit
 
6089
            }
5552
6090
          done
5553
6091
          IFS="$save_ifs"
5554
6092
        fi
5586
6124
        *)
5587
6125
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5588
6126
          $echo "$help" 1>&2
5589
 
          exit 1
 
6127
          exit $EXIT_FAILURE
5590
6128
          ;;
5591
6129
        esac
5592
6130
 
5604
6142
          $show "$install_prog $staticobj $staticdest"
5605
6143
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5606
6144
        fi
5607
 
        exit 0
 
6145
        exit $EXIT_SUCCESS
5608
6146
        ;;
5609
6147
 
5610
6148
      *)
5642
6180
          notinst_deplibs=
5643
6181
          relink_command=
5644
6182
 
5645
 
          # To insure that "foo" is sourced, and not "foo.exe",
5646
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5647
 
          # which disallows the automatic-append-.exe behavior.
5648
 
          case $build in
5649
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5650
 
          *) wrapperdot=${wrapper} ;;
5651
 
          esac
 
6183
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6184
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6185
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6186
          # `FILE.' does not work on cygwin managed mounts.
 
6187
          #
5652
6188
          # If there is no directory component, then add one.
5653
 
          case $file in
5654
 
          */* | *\\*) . ${wrapperdot} ;;
5655
 
          *) . ./${wrapperdot} ;;
 
6189
          case $wrapper in
 
6190
          */* | *\\*) . ${wrapper} ;;
 
6191
          *) . ./${wrapper} ;;
5656
6192
          esac
5657
6193
 
5658
6194
          # Check the variables that should have been set.
5659
6195
          if test -z "$notinst_deplibs"; then
5660
6196
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5661
 
            exit 1
 
6197
            exit $EXIT_FAILURE
5662
6198
          fi
5663
6199
 
5664
6200
          finalize=yes
5680
6216
          done
5681
6217
 
5682
6218
          relink_command=
5683
 
          # To insure that "foo" is sourced, and not "foo.exe",
5684
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5685
 
          # which disallows the automatic-append-.exe behavior.
5686
 
          case $build in
5687
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5688
 
          *) wrapperdot=${wrapper} ;;
5689
 
          esac
 
6219
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6220
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6221
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6222
          # `FILE.' does not work on cygwin managed mounts.
 
6223
          #
5690
6224
          # If there is no directory component, then add one.
5691
 
          case $file in
5692
 
          */* | *\\*) . ${wrapperdot} ;;
5693
 
          *) . ./${wrapperdot} ;;
 
6225
          case $wrapper in
 
6226
          */* | *\\*) . ${wrapper} ;;
 
6227
          *) . ./${wrapper} ;;
5694
6228
          esac
5695
6229
 
5696
6230
          outputname=
5697
6231
          if test "$fast_install" = no && test -n "$relink_command"; then
5698
6232
            if test "$finalize" = yes && test -z "$run"; then
5699
 
              tmpdir="/tmp"
5700
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5701
 
              tmpdir="$tmpdir/libtool-$$"
5702
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
5703
 
              else
5704
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5705
 
                continue
5706
 
              fi
 
6233
              tmpdir=`func_mktempdir`
5707
6234
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5708
6235
              outputname="$tmpdir/$file"
5709
6236
              # Replace the output file specification.
5710
 
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
 
6237
              relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
5711
6238
 
5712
6239
              $show "$relink_command"
5713
6240
              if $run eval "$relink_command"; then :
5727
6254
        fi
5728
6255
 
5729
6256
        # remove .exe since cygwin /usr/bin/install will append another
5730
 
        # one anyways
 
6257
        # one anyway 
5731
6258
        case $install_prog,$host in
5732
6259
        */usr/bin/install*,*cygwin*)
5733
6260
          case $file:$destfile in
5759
6286
      $show "$install_prog $file $oldlib"
5760
6287
      $run eval "$install_prog \$file \$oldlib" || exit $?
5761
6288
 
5762
 
      if test -n "$stripme" && test -n "$striplib"; then
 
6289
      if test -n "$stripme" && test -n "$old_striplib"; then
5763
6290
        $show "$old_striplib $oldlib"
5764
6291
        $run eval "$old_striplib $oldlib" || exit $?
5765
6292
      fi
5766
6293
 
5767
6294
      # Do each command in the postinstall commands.
5768
 
      eval cmds=\"$old_postinstall_cmds\"
 
6295
      cmds=$old_postinstall_cmds
5769
6296
      save_ifs="$IFS"; IFS='~'
5770
6297
      for cmd in $cmds; do
5771
6298
        IFS="$save_ifs"
 
6299
        eval cmd=\"$cmd\"
5772
6300
        $show "$cmd"
5773
6301
        $run eval "$cmd" || exit $?
5774
6302
      done
5782
6310
    if test -n "$current_libdirs"; then
5783
6311
      # Maybe just do a dry run.
5784
6312
      test -n "$run" && current_libdirs=" -n$current_libdirs"
5785
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
6313
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
5786
6314
    else
5787
 
      exit 0
 
6315
      exit $EXIT_SUCCESS
5788
6316
    fi
5789
6317
    ;;
5790
6318
 
5803
6331
      for libdir in $libdirs; do
5804
6332
        if test -n "$finish_cmds"; then
5805
6333
          # Do each command in the finish commands.
5806
 
          eval cmds=\"$finish_cmds\"
 
6334
          cmds=$finish_cmds
5807
6335
          save_ifs="$IFS"; IFS='~'
5808
6336
          for cmd in $cmds; do
5809
6337
            IFS="$save_ifs"
 
6338
            eval cmd=\"$cmd\"
5810
6339
            $show "$cmd"
5811
6340
            $run eval "$cmd" || admincmds="$admincmds
5812
6341
       $cmd"
5823
6352
    fi
5824
6353
 
5825
6354
    # Exit here if they wanted silent mode.
5826
 
    test "$show" = : && exit 0
 
6355
    test "$show" = : && exit $EXIT_SUCCESS
5827
6356
 
5828
 
    $echo "----------------------------------------------------------------------"
 
6357
    $echo "X----------------------------------------------------------------------" | $Xsed
5829
6358
    $echo "Libraries have been installed in:"
5830
6359
    for libdir in $libdirs; do
5831
6360
      $echo "   $libdir"
5858
6387
    $echo
5859
6388
    $echo "See any operating system documentation about shared libraries for"
5860
6389
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5861
 
    $echo "----------------------------------------------------------------------"
5862
 
    exit 0
 
6390
    $echo "X----------------------------------------------------------------------" | $Xsed
 
6391
    exit $EXIT_SUCCESS
5863
6392
    ;;
5864
6393
 
5865
6394
  # libtool execute mode
5871
6400
    if test -z "$cmd"; then
5872
6401
      $echo "$modename: you must specify a COMMAND" 1>&2
5873
6402
      $echo "$help"
5874
 
      exit 1
 
6403
      exit $EXIT_FAILURE
5875
6404
    fi
5876
6405
 
5877
6406
    # Handle -dlopen flags immediately.
5879
6408
      if test ! -f "$file"; then
5880
6409
        $echo "$modename: \`$file' is not a file" 1>&2
5881
6410
        $echo "$help" 1>&2
5882
 
        exit 1
 
6411
        exit $EXIT_FAILURE
5883
6412
      fi
5884
6413
 
5885
6414
      dir=
5890
6419
        else
5891
6420
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5892
6421
          $echo "$help" 1>&2
5893
 
          exit 1
 
6422
          exit $EXIT_FAILURE
5894
6423
        fi
5895
6424
 
5896
6425
        # Read the libtool library.
5916
6445
        if test -f "$dir/$objdir/$dlname"; then
5917
6446
          dir="$dir/$objdir"
5918
6447
        else
5919
 
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5920
 
          exit 1
 
6448
          if test ! -f "$dir/$dlname"; then
 
6449
            $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
 
6450
            exit $EXIT_FAILURE
 
6451
          fi
5921
6452
        fi
5922
6453
        ;;
5923
6454
 
5981
6512
      fi
5982
6513
 
5983
6514
      # Restore saved environment variables
5984
 
      if test "${save_LC_ALL+set}" = set; then
5985
 
        LC_ALL="$save_LC_ALL"; export LC_ALL
5986
 
      fi
5987
 
      if test "${save_LANG+set}" = set; then
5988
 
        LANG="$save_LANG"; export LANG
5989
 
      fi
 
6515
      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
6516
      do
 
6517
        eval "if test \"\${save_$lt_var+set}\" = set; then
 
6518
                $lt_var=\$save_$lt_var; export $lt_var
 
6519
              fi"
 
6520
      done
5990
6521
 
5991
6522
      # Now prepare to actually exec the command.
5992
6523
      exec_cmd="\$cmd$args"
5997
6528
        $echo "export $shlibpath_var"
5998
6529
      fi
5999
6530
      $echo "$cmd$args"
6000
 
      exit 0
 
6531
      exit $EXIT_SUCCESS
6001
6532
    fi
6002
6533
    ;;
6003
6534
 
6025
6556
    if test -z "$rm"; then
6026
6557
      $echo "$modename: you must specify an RM program" 1>&2
6027
6558
      $echo "$help" 1>&2
6028
 
      exit 1
 
6559
      exit $EXIT_FAILURE
6029
6560
    fi
6030
6561
 
6031
6562
    rmdirs=
6075
6606
            rmfiles="$rmfiles $objdir/$n"
6076
6607
          done
6077
6608
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6078
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6079
6609
 
6080
 
          if test "$mode" = uninstall; then
 
6610
          case "$mode" in
 
6611
          clean)
 
6612
            case "  $library_names " in
 
6613
            # "  " in the beginning catches empty $dlname
 
6614
            *" $dlname "*) ;;
 
6615
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6616
            esac
 
6617
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6618
            ;;
 
6619
          uninstall)
6081
6620
            if test -n "$library_names"; then
6082
6621
              # Do each command in the postuninstall commands.
6083
 
              eval cmds=\"$postuninstall_cmds\"
 
6622
              cmds=$postuninstall_cmds
6084
6623
              save_ifs="$IFS"; IFS='~'
6085
6624
              for cmd in $cmds; do
6086
6625
                IFS="$save_ifs"
 
6626
                eval cmd=\"$cmd\"
6087
6627
                $show "$cmd"
6088
6628
                $run eval "$cmd"
6089
6629
                if test "$?" -ne 0 && test "$rmforce" != yes; then
6095
6635
 
6096
6636
            if test -n "$old_library"; then
6097
6637
              # Do each command in the old_postuninstall commands.
6098
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6638
              cmds=$old_postuninstall_cmds
6099
6639
              save_ifs="$IFS"; IFS='~'
6100
6640
              for cmd in $cmds; do
6101
6641
                IFS="$save_ifs"
 
6642
                eval cmd=\"$cmd\"
6102
6643
                $show "$cmd"
6103
6644
                $run eval "$cmd"
6104
6645
                if test "$?" -ne 0 && test "$rmforce" != yes; then
6108
6649
              IFS="$save_ifs"
6109
6650
            fi
6110
6651
            # FIXME: should reinstall the best remaining shared library.
6111
 
          fi
 
6652
            ;;
 
6653
          esac
6112
6654
        fi
6113
6655
        ;;
6114
6656
 
6137
6679
        if test "$mode" = clean ; then
6138
6680
          noexename=$name
6139
6681
          case $file in
6140
 
          *.exe) 
 
6682
          *.exe)
6141
6683
            file=`$echo $file|${SED} 's,.exe$,,'`
6142
6684
            noexename=`$echo $name|${SED} 's,.exe$,,'`
6143
6685
            # $file with .exe has already been added to rmfiles,
6182
6724
  "")
6183
6725
    $echo "$modename: you must specify a MODE" 1>&2
6184
6726
    $echo "$generic_help" 1>&2
6185
 
    exit 1
 
6727
    exit $EXIT_FAILURE
6186
6728
    ;;
6187
6729
  esac
6188
6730
 
6189
6731
  if test -z "$exec_cmd"; then
6190
6732
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6191
6733
    $echo "$generic_help" 1>&2
6192
 
    exit 1
 
6734
    exit $EXIT_FAILURE
6193
6735
  fi
6194
6736
fi # test -z "$show_help"
6195
6737
 
6196
6738
if test -n "$exec_cmd"; then
6197
6739
  eval exec $exec_cmd
6198
 
  exit 1
 
6740
  exit $EXIT_FAILURE
6199
6741
fi
6200
6742
 
6201
6743
# We need to display help for each of the modes.
6231
6773
a more detailed description of MODE.
6232
6774
 
6233
6775
Report bugs to <bug-libtool@gnu.org>."
6234
 
  exit 0
 
6776
  exit $EXIT_SUCCESS
6235
6777
  ;;
6236
6778
 
6237
6779
clean)
6332
6874
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6333
6875
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6334
6876
  -export-symbols SYMFILE
6335
 
                    try to export only the symbols listed in SYMFILE
 
6877
                    try to export only the symbols listed in SYMFILE
6336
6878
  -export-symbols-regex REGEX
6337
 
                    try to export only the symbols matching REGEX
 
6879
                    try to export only the symbols matching REGEX
6338
6880
  -LLIBDIR          search LIBDIR for required installed libraries
6339
6881
  -lNAME            OUTPUT-FILE requires the installed library libNAME
6340
6882
  -module           build a library that can dlopened
6343
6885
  -no-undefined     declare that a library does not refer to external symbols
6344
6886
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6345
6887
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6888
  -precious-files-regex REGEX
 
6889
                    don't remove output files matching REGEX
6346
6890
  -release RELEASE  specify package release information
6347
6891
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6348
6892
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6349
 
  -static           do not do any dynamic linking of libtool libraries
 
6893
  -static           do not do any dynamic linking of uninstalled libtool libraries
 
6894
  -static-libtool-libs
 
6895
                    do not do any dynamic linking of libtool libraries
6350
6896
  -version-info CURRENT[:REVISION[:AGE]]
6351
 
                    specify library version info [each variable defaults to 0]
 
6897
                    specify library version info [each variable defaults to 0]
6352
6898
 
6353
6899
All other options (arguments beginning with \`-') are ignored.
6354
6900
 
6384
6930
*)
6385
6931
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6386
6932
  $echo "$help" 1>&2
6387
 
  exit 1
 
6933
  exit $EXIT_FAILURE
6388
6934
  ;;
6389
6935
esac
6390
6936
 
6391
6937
$echo
6392
6938
$echo "Try \`$modename --help' for more information about other modes."
6393
6939
 
6394
 
exit 0
 
6940
exit $?
6395
6941
 
6396
6942
# The TAGs below are defined such that we never get into a situation
6397
6943
# in which we disable both kinds of libraries.  Given conflicting
6405
6951
# configuration.  But we'll never go from static-only to shared-only.
6406
6952
 
6407
6953
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6408
 
build_libtool_libs=no
6409
 
build_old_libs=yes
 
6954
disable_libs=shared
6410
6955
# ### END LIBTOOL TAG CONFIG: disable-shared
6411
6956
 
6412
6957
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6413
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6958
disable_libs=static
6414
6959
# ### END LIBTOOL TAG CONFIG: disable-static
6415
6960
 
6416
6961
# Local Variables: