~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-12-08 14:59:50 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071208145950-u1tykhpw56nyzqik
Tags: 5.4.1~dfsg-4ubuntu1
* Merge from debian unstable.
* Remaining Ubuntu changes:
  - Remove stop links from rc0 and rc6
  - Munge Maintainer field as per spec.
* Ubuntu changes dropped:
  - Symlink common files between the packages, CDBS ought to handle that
    for us automatically.
* The latest Debian changes has dropped history from the changelog. Slot in
  the Ubuntu changes as best I can. 

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
5
 
# Free Software Foundation, Inc.
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
 
5
# 2007  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.24
 
47
TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)"
 
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.4.3
59
 
TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
60
 
 
61
87
default_mode=
62
88
help="Try \`$progname --help' for more information."
63
89
magic="%%%MAGIC variable%%%"
69
95
# metacharacters that are still active within double-quoted strings.
70
96
Xsed="${SED}"' -e 1s/^X//'
71
97
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
# test EBCDIC or ASCII                                                         
73
 
case `echo A|od -x` in                                                         
74
 
 *[Cc]1*) # EBCDIC based system                                                
75
 
  SP2NL="tr '\100' '\n'"                                                       
76
 
  NL2SP="tr '\r\n' '\100\100'"                                                 
77
 
  ;;                                                                           
78
 
 *) # Assume ASCII based system                                                
79
 
  SP2NL="tr '\040' '\012'"                                                     
80
 
  NL2SP="tr '\015\012' '\040\040'"                                             
81
 
  ;;                                                                           
82
 
esac                                                                           
 
98
# test EBCDIC or ASCII
 
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'
 
104
  ;;
 
105
 *) # EBCDIC based system
 
106
  SP2NL='tr \100 \n'
 
107
  NL2SP='tr \r\n \100\100'
 
108
  ;;
 
109
esac
83
110
 
84
111
# NLS nuisances.
85
112
# Only set LANG and LC_ALL to C if already set.
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
94
 
fi
 
116
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
117
do
 
118
  eval "if test \"\${$lt_var+set}\" = set; then
 
119
          save_$lt_var=\$$lt_var
 
120
          $lt_var=C
 
121
          export $lt_var
 
122
        fi"
 
123
done
95
124
 
96
125
# Make sure IFS has a sensible default
97
 
: ${IFS="       "}
 
126
lt_nl='
 
127
'
 
128
IFS="   $lt_nl"
98
129
 
99
130
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100
 
  echo "$modename: not configured to build any kind of library" 1>&2
101
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
102
 
  exit 1
 
131
  $echo "$modename: not configured to build any kind of library" 1>&2
 
132
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
133
  exit $EXIT_FAILURE
103
134
fi
104
135
 
105
136
# Global variables.
111
142
show="$echo"
112
143
show_help=
113
144
execute_dlfiles=
 
145
duplicate_deps=no
 
146
preserve_args=
114
147
lo2o="s/\\.lo\$/.${objext}/"
115
148
o2lo="s/\\.${objext}\$/.lo/"
 
149
extracted_archives=
 
150
extracted_serial=0
 
151
 
 
152
#####################################
 
153
# Shell function definitions:
 
154
# This seems to be the best place for them
 
155
 
 
156
# func_mktempdir [string]
 
157
# Make a temporary directory that won't clash with other running
 
158
# libtool processes, and avoids race conditions if possible.  If
 
159
# given, STRING is the basename for that directory.
 
160
func_mktempdir ()
 
161
{
 
162
    my_template="${TMPDIR-/tmp}/${1-$progname}"
 
163
 
 
164
    if test "$run" = ":"; then
 
165
      # Return a directory name, but don't create it in dry-run mode
 
166
      my_tmpdir="${my_template}-$$"
 
167
    else
 
168
 
 
169
      # If mktemp works, use that first and foremost
 
170
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
171
 
 
172
      if test ! -d "$my_tmpdir"; then
 
173
        # Failing that, at least try and use $RANDOM to avoid a race
 
174
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
175
 
 
176
        save_mktempdir_umask=`umask`
 
177
        umask 0077
 
178
        $mkdir "$my_tmpdir"
 
179
        umask $save_mktempdir_umask
 
180
      fi
 
181
 
 
182
      # If we're not in dry-run mode, bomb out on failure
 
183
      test -d "$my_tmpdir" || {
 
184
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
 
185
        exit $EXIT_FAILURE
 
186
      }
 
187
    fi
 
188
 
 
189
    $echo "X$my_tmpdir" | $Xsed
 
190
}
 
191
 
 
192
 
 
193
# func_win32_libid arg
 
194
# return the library type of file 'arg'
 
195
#
 
196
# Need a lot of goo to handle *both* DLLs and import libs
 
197
# Has to be a shell function in order to 'eat' the argument
 
198
# that is supplied when $file_magic_command is called.
 
199
func_win32_libid ()
 
200
{
 
201
  win32_libid_type="unknown"
 
202
  win32_fileres=`file -L $1 2>/dev/null`
 
203
  case $win32_fileres in
 
204
  *ar\ archive\ import\ library*) # definitely import
 
205
    win32_libid_type="x86 archive import"
 
206
    ;;
 
207
  *ar\ archive*) # could be an import, or static
 
208
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
 
209
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
210
      win32_nmres=`eval $NM -f posix -A $1 | \
 
211
        $SED -n -e '1,100{
 
212
                / I /{
 
213
                        s,.*,import,
 
214
                        p
 
215
                        q
 
216
                        }
 
217
                }'`
 
218
      case $win32_nmres in
 
219
      import*)  win32_libid_type="x86 archive import";;
 
220
      *)        win32_libid_type="x86 archive static";;
 
221
      esac
 
222
    fi
 
223
    ;;
 
224
  *DLL*)
 
225
    win32_libid_type="x86 DLL"
 
226
    ;;
 
227
  *executable*) # but shell scripts are "executable" too...
 
228
    case $win32_fileres in
 
229
    *MS\ Windows\ PE\ Intel*)
 
230
      win32_libid_type="x86 DLL"
 
231
      ;;
 
232
    esac
 
233
    ;;
 
234
  esac
 
235
  $echo $win32_libid_type
 
236
}
 
237
 
 
238
 
 
239
# func_infer_tag arg
 
240
# Infer tagged configuration to use if any are available and
 
241
# if one wasn't chosen via the "--tag" command line option.
 
242
# Only attempt this if the compiler in the base compile
 
243
# command doesn't match the default compiler.
 
244
# arg is usually of the form 'gcc ...'
 
245
func_infer_tag ()
 
246
{
 
247
    if test -n "$available_tags" && test -z "$tagname"; then
 
248
      CC_quoted=
 
249
      for arg in $CC; do
 
250
        case $arg in
 
251
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
252
          arg="\"$arg\""
 
253
          ;;
 
254
        esac
 
255
        CC_quoted="$CC_quoted $arg"
 
256
      done
 
257
      case $@ in
 
258
      # Blanks in the command may have been stripped by the calling shell,
 
259
      # but not from the CC environment variable when configure was run.
 
260
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
261
      # Blanks at the start of $base_compile will cause this to fail
 
262
      # if we don't check for them as well.
 
263
      *)
 
264
        for z in $available_tags; do
 
265
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
266
            # Evaluate the configuration.
 
267
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
268
            CC_quoted=
 
269
            for arg in $CC; do
 
270
            # Double-quote args containing other shell metacharacters.
 
271
            case $arg in
 
272
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
273
              arg="\"$arg\""
 
274
              ;;
 
275
            esac
 
276
            CC_quoted="$CC_quoted $arg"
 
277
          done
 
278
            case "$@ " in
 
279
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
280
              # The compiler in the base compile command matches
 
281
              # the one in the tagged configuration.
 
282
              # Assume this is the tagged configuration we want.
 
283
              tagname=$z
 
284
              break
 
285
              ;;
 
286
            esac
 
287
          fi
 
288
        done
 
289
        # If $tagname still isn't set, then no tagged configuration
 
290
        # was found and let the user know that the "--tag" command
 
291
        # line option must be used.
 
292
        if test -z "$tagname"; then
 
293
          $echo "$modename: unable to infer tagged configuration"
 
294
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
295
          exit $EXIT_FAILURE
 
296
#        else
 
297
#          $echo "$modename: using $tagname tagged configuration"
 
298
        fi
 
299
        ;;
 
300
      esac
 
301
    fi
 
302
}
 
303
 
 
304
 
 
305
# func_extract_an_archive dir oldlib
 
306
func_extract_an_archive ()
 
307
{
 
308
    f_ex_an_ar_dir="$1"; shift
 
309
    f_ex_an_ar_oldlib="$1"
 
310
 
 
311
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
 
312
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
 
313
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 
314
     :
 
315
    else
 
316
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
 
317
      exit $EXIT_FAILURE
 
318
    fi
 
319
}
 
320
 
 
321
# func_extract_archives gentop oldlib ...
 
322
func_extract_archives ()
 
323
{
 
324
    my_gentop="$1"; shift
 
325
    my_oldlibs=${1+"$@"}
 
326
    my_oldobjs=""
 
327
    my_xlib=""
 
328
    my_xabs=""
 
329
    my_xdir=""
 
330
    my_status=""
 
331
 
 
332
    $show "${rm}r $my_gentop"
 
333
    $run ${rm}r "$my_gentop"
 
334
    $show "$mkdir $my_gentop"
 
335
    $run $mkdir "$my_gentop"
 
336
    my_status=$?
 
337
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
 
338
      exit $my_status
 
339
    fi
 
340
 
 
341
    for my_xlib in $my_oldlibs; do
 
342
      # Extract the objects.
 
343
      case $my_xlib in
 
344
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
345
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
346
      esac
 
347
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
 
348
      my_xlib_u=$my_xlib
 
349
      while :; do
 
350
        case " $extracted_archives " in
 
351
        *" $my_xlib_u "*)
 
352
          extracted_serial=`expr $extracted_serial + 1`
 
353
          my_xlib_u=lt$extracted_serial-$my_xlib ;;
 
354
        *) break ;;
 
355
        esac
 
356
      done
 
357
      extracted_archives="$extracted_archives $my_xlib_u"
 
358
      my_xdir="$my_gentop/$my_xlib_u"
 
359
 
 
360
      $show "${rm}r $my_xdir"
 
361
      $run ${rm}r "$my_xdir"
 
362
      $show "$mkdir $my_xdir"
 
363
      $run $mkdir "$my_xdir"
 
364
      exit_status=$?
 
365
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
 
366
        exit $exit_status
 
367
      fi
 
368
      case $host in
 
369
      *-darwin*)
 
370
        $show "Extracting $my_xabs"
 
371
        # Do not bother doing anything if just a dry run
 
372
        if test -z "$run"; then
 
373
          darwin_orig_dir=`pwd`
 
374
          cd $my_xdir || exit $?
 
375
          darwin_archive=$my_xabs
 
376
          darwin_curdir=`pwd`
 
377
          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
 
378
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
 
379
          if test -n "$darwin_arches"; then 
 
380
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
 
381
            darwin_arch=
 
382
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
 
383
            for darwin_arch in  $darwin_arches ; do
 
384
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
385
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
386
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
387
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
388
              cd "$darwin_curdir"
 
389
              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
390
            done # $darwin_arches
 
391
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
 
392
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
 
393
            darwin_file=
 
394
            darwin_files=
 
395
            for darwin_file in $darwin_filelist; do
 
396
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 
397
              lipo -create -output "$darwin_file" $darwin_files
 
398
            done # $darwin_filelist
 
399
            ${rm}r unfat-$$
 
400
            cd "$darwin_orig_dir"
 
401
          else
 
402
            cd "$darwin_orig_dir"
 
403
            func_extract_an_archive "$my_xdir" "$my_xabs"
 
404
          fi # $darwin_arches
 
405
        fi # $run
 
406
        ;;
 
407
      *)
 
408
        func_extract_an_archive "$my_xdir" "$my_xabs"
 
409
        ;;
 
410
      esac
 
411
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
412
    done
 
413
    func_extract_archives_result="$my_oldobjs"
 
414
}
 
415
# End of Shell function definitions
 
416
#####################################
 
417
 
 
418
# Darwin sucks
 
419
eval std_shrext=\"$shrext_cmds\"
 
420
 
 
421
disable_libs=no
116
422
 
117
423
# Parse our command line options once, thoroughly.
118
 
while test $# -gt 0
 
424
while test "$#" -gt 0
119
425
do
120
426
  arg="$1"
121
427
  shift
131
437
    execute_dlfiles)
132
438
      execute_dlfiles="$execute_dlfiles $arg"
133
439
      ;;
 
440
    tag)
 
441
      tagname="$arg"
 
442
      preserve_args="${preserve_args}=$arg"
 
443
 
 
444
      # Check whether tagname contains only valid characters
 
445
      case $tagname in
 
446
      *[!-_A-Za-z0-9,/]*)
 
447
        $echo "$progname: invalid tag name: $tagname" 1>&2
 
448
        exit $EXIT_FAILURE
 
449
        ;;
 
450
      esac
 
451
 
 
452
      case $tagname in
 
453
      CC)
 
454
        # Don't test for the "default" C tag, as we know, it's there, but
 
455
        # not specially marked.
 
456
        ;;
 
457
      *)
 
458
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
 
459
          taglist="$taglist $tagname"
 
460
          # Evaluate the configuration.
 
461
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
 
462
        else
 
463
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
 
464
        fi
 
465
        ;;
 
466
      esac
 
467
      ;;
134
468
    *)
135
469
      eval "$prev=\$arg"
136
470
      ;;
148
482
    ;;
149
483
 
150
484
  --version)
151
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
152
 
    exit 0
 
485
    echo "\
 
486
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
 
487
 
 
488
Copyright (C) 2007  Free Software Foundation, Inc.
 
489
This is free software; see the source for copying conditions.  There is NO
 
490
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
491
    exit $?
153
492
    ;;
154
493
 
155
494
  --config)
156
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
157
 
    exit 0
 
495
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
 
496
    # Now print the configurations for the tags.
 
497
    for tagname in $taglist; do
 
498
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
 
499
    done
 
500
    exit $?
158
501
    ;;
159
502
 
160
503
  --debug)
161
 
    echo "$progname: enabling shell trace mode"
 
504
    $echo "$progname: enabling shell trace mode"
162
505
    set -x
 
506
    preserve_args="$preserve_args $arg"
163
507
    ;;
164
508
 
165
509
  --dry-run | -n)
167
511
    ;;
168
512
 
169
513
  --features)
170
 
    echo "host: $host"
 
514
    $echo "host: $host"
171
515
    if test "$build_libtool_libs" = yes; then
172
 
      echo "enable shared libraries"
 
516
      $echo "enable shared libraries"
173
517
    else
174
 
      echo "disable shared libraries"
 
518
      $echo "disable shared libraries"
175
519
    fi
176
520
    if test "$build_old_libs" = yes; then
177
 
      echo "enable static libraries"
 
521
      $echo "enable static libraries"
178
522
    else
179
 
      echo "disable static libraries"
 
523
      $echo "disable static libraries"
180
524
    fi
181
 
    exit 0
 
525
    exit $?
182
526
    ;;
183
527
 
184
528
  --finish) mode="finish" ;;
190
534
 
191
535
  --quiet | --silent)
192
536
    show=:
 
537
    preserve_args="$preserve_args $arg"
 
538
    ;;
 
539
 
 
540
  --tag)
 
541
    prevopt="--tag"
 
542
    prev=tag
 
543
    preserve_args="$preserve_args --tag"
 
544
    ;;
 
545
  --tag=*)
 
546
    set tag "$optarg" ${1+"$@"}
 
547
    shift
 
548
    prev=tag
 
549
    preserve_args="$preserve_args --tag"
193
550
    ;;
194
551
 
195
552
  -dlopen)
200
557
  -*)
201
558
    $echo "$modename: unrecognized option \`$arg'" 1>&2
202
559
    $echo "$help" 1>&2
203
 
    exit 1
 
560
    exit $EXIT_FAILURE
204
561
    ;;
205
562
 
206
563
  *)
213
570
if test -n "$prevopt"; then
214
571
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
215
572
  $echo "$help" 1>&2
216
 
  exit 1
 
573
  exit $EXIT_FAILURE
217
574
fi
218
575
 
 
576
case $disable_libs in
 
577
no) 
 
578
  ;;
 
579
shared)
 
580
  build_libtool_libs=no
 
581
  build_old_libs=yes
 
582
  ;;
 
583
static)
 
584
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 
585
  ;;
 
586
esac
 
587
 
219
588
# If this variable is set in any of the actions, the command in it
220
589
# will be execed at the end.  This prevents here-documents from being
221
590
# left over by shells.
225
594
 
226
595
  # Infer the operation mode.
227
596
  if test -z "$mode"; then
 
597
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
 
598
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
228
599
    case $nonopt in
229
 
    *cc | *++ | gcc* | *-gcc* | xlc*)
 
600
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
230
601
      mode=link
231
602
      for arg
232
603
      do
267
638
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
268
639
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
269
640
    $echo "$help" 1>&2
270
 
    exit 1
 
641
    exit $EXIT_FAILURE
271
642
  fi
272
643
 
273
644
  # Change the help message to a mode-specific one.
281
652
    modename="$modename: compile"
282
653
    # Get the compilation command and the source file.
283
654
    base_compile=
284
 
    prev=
285
 
    lastarg=
286
 
    srcfile="$nonopt"
 
655
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
656
    suppress_opt=yes
287
657
    suppress_output=
 
658
    arg_mode=normal
 
659
    libobj=
 
660
    later=
288
661
 
289
 
    user_target=no
290
662
    for arg
291
663
    do
292
 
      case $prev in
293
 
      "") ;;
294
 
      xcompiler)
295
 
        # Aesthetically quote the previous argument.
296
 
        prev=
297
 
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
298
 
 
299
 
        case $arg in
300
 
        # Double-quote args containing other shell metacharacters.
301
 
        # Many Bourne shells cannot handle close brackets correctly
302
 
        # in scan sets, so we specify it separately.
303
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
304
 
          arg="\"$arg\""
305
 
          ;;
306
 
        esac
307
 
 
308
 
        # Add the previous argument to base_compile.
309
 
        if test -z "$base_compile"; then
310
 
          base_compile="$lastarg"
311
 
        else
312
 
          base_compile="$base_compile $lastarg"
313
 
        fi
314
 
        continue
315
 
        ;;
316
 
      esac
317
 
 
318
 
      # Accept any command-line options.
319
 
      case $arg in
320
 
      -o)
321
 
        if test "$user_target" != "no"; then
322
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
323
 
          exit 1
324
 
        fi
325
 
        user_target=next
326
 
        ;;
327
 
 
328
 
      -static)
329
 
        build_old_libs=yes
330
 
        continue
331
 
        ;;
332
 
 
333
 
      -prefer-pic)
334
 
        pic_mode=yes
335
 
        continue
336
 
        ;;
337
 
 
338
 
      -prefer-non-pic)
339
 
        pic_mode=no
340
 
        continue
341
 
        ;;
342
 
 
343
 
      -Xcompiler)
344
 
        prev=xcompiler
345
 
        continue
346
 
        ;;
347
 
 
348
 
      -Wc,*)
349
 
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
350
 
        lastarg=
351
 
        save_ifs="$IFS"; IFS=','
352
 
        for arg in $args; do
353
 
          IFS="$save_ifs"
354
 
 
355
 
          # Double-quote args containing other shell metacharacters.
356
 
          # Many Bourne shells cannot handle close brackets correctly
357
 
          # in scan sets, so we specify it separately.
358
 
          case $arg in
359
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
360
 
            arg="\"$arg\""
361
 
            ;;
362
 
          esac
363
 
          lastarg="$lastarg $arg"
364
 
        done
365
 
        IFS="$save_ifs"
366
 
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
367
 
 
368
 
        # Add the arguments to base_compile.
369
 
        if test -z "$base_compile"; then
370
 
          base_compile="$lastarg"
371
 
        else
372
 
          base_compile="$base_compile $lastarg"
373
 
        fi
374
 
        continue
375
 
        ;;
376
 
      esac
377
 
 
378
 
      case $user_target in
379
 
      next)
380
 
        # The next one is the -o target name
381
 
        user_target=yes
382
 
        continue
383
 
        ;;
384
 
      yes)
385
 
        # We got the output file
386
 
        user_target=set
 
664
      case $arg_mode in
 
665
      arg  )
 
666
        # do not "continue".  Instead, add this to base_compile
 
667
        lastarg="$arg"
 
668
        arg_mode=normal
 
669
        ;;
 
670
 
 
671
      target )
387
672
        libobj="$arg"
 
673
        arg_mode=normal
388
674
        continue
389
675
        ;;
390
 
      esac
391
 
 
392
 
      # Accept the current argument as the source file.
393
 
      lastarg="$srcfile"
394
 
      srcfile="$arg"
 
676
 
 
677
      normal )
 
678
        # Accept any command-line options.
 
679
        case $arg in
 
680
        -o)
 
681
          if test -n "$libobj" ; then
 
682
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
683
            exit $EXIT_FAILURE
 
684
          fi
 
685
          arg_mode=target
 
686
          continue
 
687
          ;;
 
688
 
 
689
        -static | -prefer-pic | -prefer-non-pic)
 
690
          later="$later $arg"
 
691
          continue
 
692
          ;;
 
693
 
 
694
        -no-suppress)
 
695
          suppress_opt=no
 
696
          continue
 
697
          ;;
 
698
 
 
699
        -Xcompiler)
 
700
          arg_mode=arg  #  the next one goes into the "base_compile" arg list
 
701
          continue      #  The current "srcfile" will either be retained or
 
702
          ;;            #  replaced later.  I would guess that would be a bug.
 
703
 
 
704
        -Wc,*)
 
705
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
706
          lastarg=
 
707
          save_ifs="$IFS"; IFS=','
 
708
          for arg in $args; do
 
709
            IFS="$save_ifs"
 
710
 
 
711
            # Double-quote args containing other shell metacharacters.
 
712
            # Many Bourne shells cannot handle close brackets correctly
 
713
            # in scan sets, so we specify it separately.
 
714
            case $arg in
 
715
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
716
              arg="\"$arg\""
 
717
              ;;
 
718
            esac
 
719
            lastarg="$lastarg $arg"
 
720
          done
 
721
          IFS="$save_ifs"
 
722
          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
723
 
 
724
          # Add the arguments to base_compile.
 
725
          base_compile="$base_compile $lastarg"
 
726
          continue
 
727
          ;;
 
728
 
 
729
        * )
 
730
          # Accept the current argument as the source file.
 
731
          # The previous "srcfile" becomes the current argument.
 
732
          #
 
733
          lastarg="$srcfile"
 
734
          srcfile="$arg"
 
735
          ;;
 
736
        esac  #  case $arg
 
737
        ;;
 
738
      esac    #  case $arg_mode
395
739
 
396
740
      # Aesthetically quote the previous argument.
397
 
 
398
 
      # Backslashify any backslashes, double quotes, and dollar signs.
399
 
      # These are the only characters that are still specially
400
 
      # interpreted inside of double-quoted scrings.
401
741
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
402
742
 
 
743
      case $lastarg in
403
744
      # Double-quote args containing other shell metacharacters.
404
745
      # Many Bourne shells cannot handle close brackets correctly
405
 
      # in scan sets, so we specify it separately.
406
 
      case $lastarg in
 
746
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
 
747
      # in scan sets (worked around with variable expansion),
 
748
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
 
749
      # at all, so we specify them separately.
407
750
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
408
751
        lastarg="\"$lastarg\""
409
752
        ;;
410
753
      esac
411
754
 
412
 
      # Add the previous argument to base_compile.
413
 
      if test -z "$base_compile"; then
414
 
        base_compile="$lastarg"
415
 
      else
416
 
        base_compile="$base_compile $lastarg"
417
 
      fi
418
 
    done
 
755
      base_compile="$base_compile $lastarg"
 
756
    done # for arg
419
757
 
420
 
    case $user_target in
421
 
    set)
422
 
      ;;
423
 
    no)
 
758
    case $arg_mode in
 
759
    arg)
 
760
      $echo "$modename: you must specify an argument for -Xcompile"
 
761
      exit $EXIT_FAILURE
 
762
      ;;
 
763
    target)
 
764
      $echo "$modename: you must specify a target with \`-o'" 1>&2
 
765
      exit $EXIT_FAILURE
 
766
      ;;
 
767
    *)
424
768
      # Get the name of the library object.
425
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
426
 
      ;;
427
 
    *)
428
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
429
 
      exit 1
 
769
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
430
770
      ;;
431
771
    esac
432
772
 
433
773
    # Recognize several different file suffixes.
434
774
    # If the user specifies -o file.o, it is replaced with file.lo
435
 
    xform='[cCFSfmso]'
 
775
    xform='[cCFSifmso]'
436
776
    case $libobj in
437
777
    *.ada) xform=ada ;;
438
778
    *.adb) xform=adb ;;
440
780
    *.asm) xform=asm ;;
441
781
    *.c++) xform=c++ ;;
442
782
    *.cc) xform=cc ;;
 
783
    *.ii) xform=ii ;;
 
784
    *.class) xform=class ;;
443
785
    *.cpp) xform=cpp ;;
444
786
    *.cxx) xform=cxx ;;
445
 
    *.f90) xform=f90 ;;
 
787
    *.[fF][09]?) xform=[fF][09]. ;;
446
788
    *.for) xform=for ;;
 
789
    *.java) xform=java ;;
 
790
    *.obj) xform=obj ;;
447
791
    esac
448
792
 
449
793
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
452
796
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
453
797
    *)
454
798
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
455
 
      exit 1
 
799
      exit $EXIT_FAILURE
456
800
      ;;
457
801
    esac
458
802
 
 
803
    func_infer_tag $base_compile
 
804
 
 
805
    for arg in $later; do
 
806
      case $arg in
 
807
      -static)
 
808
        build_old_libs=yes
 
809
        continue
 
810
        ;;
 
811
 
 
812
      -prefer-pic)
 
813
        pic_mode=yes
 
814
        continue
 
815
        ;;
 
816
 
 
817
      -prefer-non-pic)
 
818
        pic_mode=no
 
819
        continue
 
820
        ;;
 
821
      esac
 
822
    done
 
823
 
 
824
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
 
825
    case $qlibobj in
 
826
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
827
        qlibobj="\"$qlibobj\"" ;;
 
828
    esac
 
829
    test "X$libobj" != "X$qlibobj" \
 
830
        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
 
831
        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
 
832
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
833
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
834
    if test "X$xdir" = "X$obj"; then
 
835
      xdir=
 
836
    else
 
837
      xdir=$xdir/
 
838
    fi
 
839
    lobj=${xdir}$objdir/$objname
 
840
 
459
841
    if test -z "$base_compile"; then
460
842
      $echo "$modename: you must specify a compilation command" 1>&2
461
843
      $echo "$help" 1>&2
462
 
      exit 1
 
844
      exit $EXIT_FAILURE
463
845
    fi
464
846
 
465
847
    # Delete any leftover library objects.
466
848
    if test "$build_old_libs" = yes; then
467
 
      removelist="$obj $libobj"
 
849
      removelist="$obj $lobj $libobj ${libobj}T"
468
850
    else
469
 
      removelist="$libobj"
 
851
      removelist="$lobj $libobj ${libobj}T"
470
852
    fi
471
853
 
472
854
    $run $rm $removelist
473
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
855
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
474
856
 
475
857
    # On Cygwin there's no "real" PIC flag so we must build both object types
476
858
    case $host_os in
489
871
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
490
872
      lockfile="$output_obj.lock"
491
873
      removelist="$removelist $output_obj $lockfile"
492
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
874
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
493
875
    else
 
876
      output_obj=
494
877
      need_locks=no
495
878
      lockfile=
496
879
    fi
498
881
    # Lock this critical section if it is needed
499
882
    # We use this script file to make the link, it avoids creating a new file
500
883
    if test "$need_locks" = yes; then
501
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
884
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
502
885
        $show "Waiting for $lockfile to be removed"
503
886
        sleep 2
504
887
      done
505
888
    elif test "$need_locks" = warn; then
506
889
      if test -f "$lockfile"; then
507
 
        echo "\
 
890
        $echo "\
508
891
*** ERROR, $lockfile exists and contains:
509
892
`cat $lockfile 2>/dev/null`
510
893
 
516
899
compiler."
517
900
 
518
901
        $run $rm $removelist
519
 
        exit 1
 
902
        exit $EXIT_FAILURE
520
903
      fi
521
 
      echo $srcfile > "$lockfile"
 
904
      $echo "$srcfile" > "$lockfile"
522
905
    fi
523
906
 
524
907
    if test -n "$fix_srcfile_path"; then
525
908
      eval srcfile=\"$fix_srcfile_path\"
526
909
    fi
 
910
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
 
911
    case $qsrcfile in
 
912
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
913
      qsrcfile="\"$qsrcfile\"" ;;
 
914
    esac
 
915
 
 
916
    $run $rm "$libobj" "${libobj}T"
 
917
 
 
918
    # Create a libtool object file (analogous to a ".la" file),
 
919
    # but don't create it if we're doing a dry run.
 
920
    test -z "$run" && cat > ${libobj}T <<EOF
 
921
# $libobj - a libtool object file
 
922
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
923
#
 
924
# Please DO NOT delete this file!
 
925
# It is necessary for linking the library.
 
926
 
 
927
# Name of the PIC object.
 
928
EOF
527
929
 
528
930
    # Only build a PIC object if we are building libtool libraries.
529
931
    if test "$build_libtool_libs" = yes; then
531
933
      fbsd_hideous_sh_bug=$base_compile
532
934
 
533
935
      if test "$pic_mode" != no; then
534
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
535
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
936
        command="$base_compile $qsrcfile $pic_flag"
536
937
      else
537
938
        # Don't build PIC code
538
 
        command="$base_compile $srcfile"
539
 
      fi
540
 
      if test "$build_old_libs" = yes; then
541
 
        lo_libobj="$libobj"
542
 
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
543
 
        if test "X$dir" = "X$libobj"; then
544
 
          dir="$objdir"
545
 
        else
546
 
          dir="$dir/$objdir"
547
 
        fi
548
 
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
549
 
 
550
 
        if test -d "$dir"; then
551
 
          $show "$rm $libobj"
552
 
          $run $rm $libobj
553
 
        else
554
 
          $show "$mkdir $dir"
555
 
          $run $mkdir $dir
556
 
          status=$?
557
 
          if test $status -ne 0 && test ! -d $dir; then
558
 
            exit $status
559
 
          fi
560
 
        fi
561
 
      fi
562
 
      if test "$compiler_o_lo" = yes; then
563
 
        output_obj="$libobj"
564
 
        command="$command -o $output_obj"
565
 
      elif test "$compiler_c_o" = yes; then
566
 
        output_obj="$obj"
567
 
        command="$command -o $output_obj"
568
 
      fi
569
 
 
570
 
      $run $rm "$output_obj"
 
939
        command="$base_compile $qsrcfile"
 
940
      fi
 
941
 
 
942
      if test ! -d "${xdir}$objdir"; then
 
943
        $show "$mkdir ${xdir}$objdir"
 
944
        $run $mkdir ${xdir}$objdir
 
945
        exit_status=$?
 
946
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
947
          exit $exit_status
 
948
        fi
 
949
      fi
 
950
 
 
951
      if test -z "$output_obj"; then
 
952
        # Place PIC objects in $objdir
 
953
        command="$command -o $lobj"
 
954
      fi
 
955
 
 
956
      $run $rm "$lobj" "$output_obj"
 
957
 
571
958
      $show "$command"
572
959
      if $run eval "$command"; then :
573
960
      else
574
961
        test -n "$output_obj" && $run $rm $removelist
575
 
        exit 1
 
962
        exit $EXIT_FAILURE
576
963
      fi
577
964
 
578
965
      if test "$need_locks" = warn &&
579
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
580
 
        echo "\
 
966
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
967
        $echo "\
581
968
*** ERROR, $lockfile contains:
582
969
`cat $lockfile 2>/dev/null`
583
970
 
592
979
compiler."
593
980
 
594
981
        $run $rm $removelist
595
 
        exit 1
 
982
        exit $EXIT_FAILURE
596
983
      fi
597
984
 
598
985
      # Just move the object if needed, then go on to compile the next one
599
 
      if test x"$output_obj" != x"$libobj"; then
600
 
        $show "$mv $output_obj $libobj"
601
 
        if $run $mv $output_obj $libobj; then :
602
 
        else
603
 
          error=$?
604
 
          $run $rm $removelist
605
 
          exit $error
606
 
        fi
607
 
      fi
608
 
 
609
 
      # If we have no pic_flag, then copy the object into place and finish.
610
 
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
611
 
         test "$build_old_libs" = yes; then
612
 
        # Rename the .lo from within objdir to obj
613
 
        if test -f $obj; then
614
 
          $show $rm $obj
615
 
          $run $rm $obj
616
 
        fi
617
 
 
618
 
        $show "$mv $libobj $obj"
619
 
        if $run $mv $libobj $obj; then :
620
 
        else
621
 
          error=$?
622
 
          $run $rm $removelist
623
 
          exit $error
624
 
        fi
625
 
 
626
 
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
627
 
        if test "X$xdir" = "X$obj"; then
628
 
          xdir="."
629
 
        else
630
 
          xdir="$xdir"
631
 
        fi
632
 
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
633
 
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
634
 
        # Now arrange that obj and lo_libobj become the same file
635
 
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
636
 
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
637
 
          # Unlock the critical section if it was locked
638
 
          if test "$need_locks" != no; then
639
 
            $run $rm "$lockfile"
640
 
          fi
641
 
          exit 0
642
 
        else
643
 
          error=$?
644
 
          $run $rm $removelist
645
 
          exit $error
646
 
        fi
647
 
      fi
 
986
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 
987
        $show "$mv $output_obj $lobj"
 
988
        if $run $mv $output_obj $lobj; then :
 
989
        else
 
990
          error=$?
 
991
          $run $rm $removelist
 
992
          exit $error
 
993
        fi
 
994
      fi
 
995
 
 
996
      # Append the name of the PIC object to the libtool object file.
 
997
      test -z "$run" && cat >> ${libobj}T <<EOF
 
998
pic_object='$objdir/$objname'
 
999
 
 
1000
EOF
648
1001
 
649
1002
      # Allow error messages only from the first compilation.
650
 
      suppress_output=' >/dev/null 2>&1'
 
1003
      if test "$suppress_opt" = yes; then
 
1004
        suppress_output=' >/dev/null 2>&1'
 
1005
      fi
 
1006
    else
 
1007
      # No PIC object so indicate it doesn't exist in the libtool
 
1008
      # object file.
 
1009
      test -z "$run" && cat >> ${libobj}T <<EOF
 
1010
pic_object=none
 
1011
 
 
1012
EOF
651
1013
    fi
652
1014
 
653
1015
    # Only build a position-dependent object if we build old libraries.
654
1016
    if test "$build_old_libs" = yes; then
655
1017
      if test "$pic_mode" != yes; then
656
1018
        # Don't build PIC code
657
 
        command="$base_compile $srcfile"
 
1019
        command="$base_compile $qsrcfile"
658
1020
      else
659
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
660
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
1021
        command="$base_compile $qsrcfile $pic_flag"
661
1022
      fi
662
1023
      if test "$compiler_c_o" = yes; then
663
1024
        command="$command -o $obj"
664
 
        output_obj="$obj"
665
1025
      fi
666
1026
 
667
1027
      # Suppress compiler output if we already did a PIC compilation.
668
1028
      command="$command$suppress_output"
669
 
      $run $rm "$output_obj"
 
1029
      $run $rm "$obj" "$output_obj"
670
1030
      $show "$command"
671
1031
      if $run eval "$command"; then :
672
1032
      else
673
1033
        $run $rm $removelist
674
 
        exit 1
 
1034
        exit $EXIT_FAILURE
675
1035
      fi
676
1036
 
677
1037
      if test "$need_locks" = warn &&
678
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
679
 
        echo "\
 
1038
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
1039
        $echo "\
680
1040
*** ERROR, $lockfile contains:
681
1041
`cat $lockfile 2>/dev/null`
682
1042
 
691
1051
compiler."
692
1052
 
693
1053
        $run $rm $removelist
694
 
        exit 1
 
1054
        exit $EXIT_FAILURE
695
1055
      fi
696
1056
 
697
1057
      # Just move the object if needed
698
 
      if test x"$output_obj" != x"$obj"; then
 
1058
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
699
1059
        $show "$mv $output_obj $obj"
700
1060
        if $run $mv $output_obj $obj; then :
701
1061
        else
705
1065
        fi
706
1066
      fi
707
1067
 
708
 
      # Create an invalid libtool object if no PIC, so that we do not
709
 
      # accidentally link it into a program.
710
 
      if test "$build_libtool_libs" != yes; then
711
 
        $show "echo timestamp > $libobj"
712
 
        $run eval "echo timestamp > \$libobj" || exit $?
713
 
      else
714
 
        # Move the .lo from within objdir
715
 
        $show "$mv $libobj $lo_libobj"
716
 
        if $run $mv $libobj $lo_libobj; then :
717
 
        else
718
 
          error=$?
719
 
          $run $rm $removelist
720
 
          exit $error
721
 
        fi
722
 
      fi
 
1068
      # Append the name of the non-PIC object the libtool object file.
 
1069
      # Only append if the libtool object file exists.
 
1070
      test -z "$run" && cat >> ${libobj}T <<EOF
 
1071
# Name of the non-PIC object.
 
1072
non_pic_object='$objname'
 
1073
 
 
1074
EOF
 
1075
    else
 
1076
      # Append the name of the non-PIC object the libtool object file.
 
1077
      # Only append if the libtool object file exists.
 
1078
      test -z "$run" && cat >> ${libobj}T <<EOF
 
1079
# Name of the non-PIC object.
 
1080
non_pic_object=none
 
1081
 
 
1082
EOF
723
1083
    fi
724
1084
 
 
1085
    $run $mv "${libobj}T" "${libobj}"
 
1086
 
725
1087
    # Unlock the critical section if it was locked
726
1088
    if test "$need_locks" != no; then
727
1089
      $run $rm "$lockfile"
728
1090
    fi
729
1091
 
730
 
    exit 0
 
1092
    exit $EXIT_SUCCESS
731
1093
    ;;
732
1094
 
733
1095
  # libtool link mode
738
1100
      # It is impossible to link a dll without this setting, and
739
1101
      # we shouldn't force the makefile maintainer to figure out
740
1102
      # which system we are compiling for in order to pass an extra
741
 
      # flag for every libtool invokation.
 
1103
      # flag for every libtool invocation.
742
1104
      # allow_undefined=no
743
1105
 
744
1106
      # FIXME: Unfortunately, there are problems with the above when trying
753
1115
      ;;
754
1116
    esac
755
1117
    libtool_args="$nonopt"
 
1118
    base_compile="$nonopt $@"
756
1119
    compile_command="$nonopt"
757
1120
    finalize_command="$nonopt"
758
1121
 
768
1131
    linker_flags=
769
1132
    dllsearchpath=
770
1133
    lib_search_path=`pwd`
 
1134
    inst_prefix_dir=
771
1135
 
772
1136
    avoid_version=no
773
1137
    dlfiles=
782
1146
    module=no
783
1147
    no_install=no
784
1148
    objs=
 
1149
    non_pic_objects=
 
1150
    notinst_path= # paths that contain not-installed libtool libraries
 
1151
    precious_files_regex=
785
1152
    prefer_static_libs=no
786
1153
    preload=no
787
1154
    prev=
793
1160
    temp_rpath=
794
1161
    thread_safe=no
795
1162
    vinfo=
 
1163
    vinfo_number=no
 
1164
 
 
1165
    func_infer_tag $base_compile
796
1166
 
797
1167
    # We need to know -static, to get the right output filenames.
798
1168
    for arg
799
1169
    do
800
1170
      case $arg in
801
 
      -all-static | -static)
802
 
        if test "X$arg" = "X-all-static"; then
 
1171
      -all-static | -static | -static-libtool-libs)
 
1172
        case $arg in
 
1173
        -all-static)
803
1174
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
804
1175
            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
805
1176
          fi
806
1177
          if test -n "$link_static_flag"; then
807
1178
            dlopen_self=$dlopen_self_static
808
1179
          fi
809
 
        else
810
 
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
811
 
            dlopen_self=$dlopen_self_static
812
 
          fi
813
 
        fi
 
1180
          prefer_static_libs=yes
 
1181
          ;;
 
1182
        -static)
 
1183
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
1184
            dlopen_self=$dlopen_self_static
 
1185
          fi
 
1186
          prefer_static_libs=built
 
1187
          ;;
 
1188
        -static-libtool-libs)
 
1189
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
1190
            dlopen_self=$dlopen_self_static
 
1191
          fi
 
1192
          prefer_static_libs=yes
 
1193
          ;;
 
1194
        esac
814
1195
        build_libtool_libs=no
815
1196
        build_old_libs=yes
816
 
        prefer_static_libs=yes
817
1197
        break
818
1198
        ;;
819
1199
      esac
823
1203
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
824
1204
 
825
1205
    # Go through the arguments, transforming them on the way.
826
 
    while test $# -gt 0; do
 
1206
    while test "$#" -gt 0; do
827
1207
      arg="$1"
828
1208
      shift
829
1209
      case $arg in
888
1268
          export_symbols="$arg"
889
1269
          if test ! -f "$arg"; then
890
1270
            $echo "$modename: symbol file \`$arg' does not exist"
891
 
            exit 1
 
1271
            exit $EXIT_FAILURE
892
1272
          fi
893
1273
          prev=
894
1274
          continue
898
1278
          prev=
899
1279
          continue
900
1280
          ;;
 
1281
        inst_prefix)
 
1282
          inst_prefix_dir="$arg"
 
1283
          prev=
 
1284
          continue
 
1285
          ;;
 
1286
        precious_regex)
 
1287
          precious_files_regex="$arg"
 
1288
          prev=
 
1289
          continue
 
1290
          ;;
901
1291
        release)
902
1292
          release="-$arg"
903
1293
          prev=
904
1294
          continue
905
1295
          ;;
 
1296
        objectlist)
 
1297
          if test -f "$arg"; then
 
1298
            save_arg=$arg
 
1299
            moreargs=
 
1300
            for fil in `cat $save_arg`
 
1301
            do
 
1302
#             moreargs="$moreargs $fil"
 
1303
              arg=$fil
 
1304
              # A libtool-controlled object.
 
1305
 
 
1306
              # Check to see that this really is a libtool object.
 
1307
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1308
                pic_object=
 
1309
                non_pic_object=
 
1310
 
 
1311
                # Read the .lo file
 
1312
                # If there is no directory component, then add one.
 
1313
                case $arg in
 
1314
                */* | *\\*) . $arg ;;
 
1315
                *) . ./$arg ;;
 
1316
                esac
 
1317
 
 
1318
                if test -z "$pic_object" || \
 
1319
                   test -z "$non_pic_object" ||
 
1320
                   test "$pic_object" = none && \
 
1321
                   test "$non_pic_object" = none; then
 
1322
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1323
                  exit $EXIT_FAILURE
 
1324
                fi
 
1325
 
 
1326
                # Extract subdirectory from the argument.
 
1327
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1328
                if test "X$xdir" = "X$arg"; then
 
1329
                  xdir=
 
1330
                else
 
1331
                  xdir="$xdir/"
 
1332
                fi
 
1333
 
 
1334
                if test "$pic_object" != none; then
 
1335
                  # Prepend the subdirectory the object is found in.
 
1336
                  pic_object="$xdir$pic_object"
 
1337
 
 
1338
                  if test "$prev" = dlfiles; then
 
1339
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1340
                      dlfiles="$dlfiles $pic_object"
 
1341
                      prev=
 
1342
                      continue
 
1343
                    else
 
1344
                      # If libtool objects are unsupported, then we need to preload.
 
1345
                      prev=dlprefiles
 
1346
                    fi
 
1347
                  fi
 
1348
 
 
1349
                  # CHECK ME:  I think I busted this.  -Ossama
 
1350
                  if test "$prev" = dlprefiles; then
 
1351
                    # Preload the old-style object.
 
1352
                    dlprefiles="$dlprefiles $pic_object"
 
1353
                    prev=
 
1354
                  fi
 
1355
 
 
1356
                  # A PIC object.
 
1357
                  libobjs="$libobjs $pic_object"
 
1358
                  arg="$pic_object"
 
1359
                fi
 
1360
 
 
1361
                # Non-PIC object.
 
1362
                if test "$non_pic_object" != none; then
 
1363
                  # Prepend the subdirectory the object is found in.
 
1364
                  non_pic_object="$xdir$non_pic_object"
 
1365
 
 
1366
                  # A standard non-PIC object
 
1367
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1368
                  if test -z "$pic_object" || test "$pic_object" = none ; then
 
1369
                    arg="$non_pic_object"
 
1370
                  fi
 
1371
                else
 
1372
                  # If the PIC object exists, use it instead.
 
1373
                  # $xdir was prepended to $pic_object above.
 
1374
                  non_pic_object="$pic_object"
 
1375
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1376
                fi
 
1377
              else
 
1378
                # Only an error if not doing a dry-run.
 
1379
                if test -z "$run"; then
 
1380
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1381
                  exit $EXIT_FAILURE
 
1382
                else
 
1383
                  # Dry-run case.
 
1384
 
 
1385
                  # Extract subdirectory from the argument.
 
1386
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1387
                  if test "X$xdir" = "X$arg"; then
 
1388
                    xdir=
 
1389
                  else
 
1390
                    xdir="$xdir/"
 
1391
                  fi
 
1392
 
 
1393
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1394
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1395
                  libobjs="$libobjs $pic_object"
 
1396
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1397
                fi
 
1398
              fi
 
1399
            done
 
1400
          else
 
1401
            $echo "$modename: link input file \`$save_arg' does not exist"
 
1402
            exit $EXIT_FAILURE
 
1403
          fi
 
1404
          arg=$save_arg
 
1405
          prev=
 
1406
          continue
 
1407
          ;;
906
1408
        rpath | xrpath)
907
1409
          # We need an absolute path.
908
1410
          case $arg in
909
1411
          [\\/]* | [A-Za-z]:[\\/]*) ;;
910
1412
          *)
911
1413
            $echo "$modename: only absolute run-paths are allowed" 1>&2
912
 
            exit 1
 
1414
            exit $EXIT_FAILURE
913
1415
            ;;
914
1416
          esac
915
1417
          if test "$prev" = rpath; then
941
1443
          finalize_command="$finalize_command $wl$qarg"
942
1444
          continue
943
1445
          ;;
 
1446
        xcclinker)
 
1447
          linker_flags="$linker_flags $qarg"
 
1448
          compiler_flags="$compiler_flags $qarg"
 
1449
          prev=
 
1450
          compile_command="$compile_command $qarg"
 
1451
          finalize_command="$finalize_command $qarg"
 
1452
          continue
 
1453
          ;;
 
1454
        shrext)
 
1455
          shrext_cmds="$arg"
 
1456
          prev=
 
1457
          continue
 
1458
          ;;
 
1459
        darwin_framework|darwin_framework_skip)
 
1460
          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
 
1461
          compile_command="$compile_command $arg"
 
1462
          finalize_command="$finalize_command $arg"
 
1463
          prev=
 
1464
          continue
 
1465
          ;;
944
1466
        *)
945
1467
          eval "$prev=\"\$arg\""
946
1468
          prev=
947
1469
          continue
948
1470
          ;;
949
1471
        esac
950
 
      fi # test -n $prev
 
1472
      fi # test -n "$prev"
951
1473
 
952
1474
      prevarg="$arg"
953
1475
 
989
1511
      -export-symbols | -export-symbols-regex)
990
1512
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
991
1513
          $echo "$modename: more than one -exported-symbols argument is not allowed"
992
 
          exit 1
 
1514
          exit $EXIT_FAILURE
993
1515
        fi
994
1516
        if test "X$arg" = "X-export-symbols"; then
995
1517
          prev=expsyms
999
1521
        continue
1000
1522
        ;;
1001
1523
 
 
1524
      -framework|-arch|-isysroot)
 
1525
        case " $CC " in
 
1526
          *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
 
1527
                prev=darwin_framework_skip ;;
 
1528
          *) compiler_flags="$compiler_flags $arg"
 
1529
             prev=darwin_framework ;;
 
1530
        esac
 
1531
        compile_command="$compile_command $arg"
 
1532
        finalize_command="$finalize_command $arg"
 
1533
        continue
 
1534
        ;;
 
1535
 
 
1536
      -inst-prefix-dir)
 
1537
        prev=inst_prefix
 
1538
        continue
 
1539
        ;;
 
1540
 
1002
1541
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1003
1542
      # so, if we see these flags be careful not to treat them like -L
1004
1543
      -L[A-Z][A-Z]*:*)
1005
1544
        case $with_gcc/$host in
1006
 
        no/*-*-irix* | no/*-*-nonstopux*)
 
1545
        no/*-*-irix* | /*-*-irix*)
1007
1546
          compile_command="$compile_command $arg"
1008
1547
          finalize_command="$finalize_command $arg"
1009
1548
          ;;
1020
1559
          absdir=`cd "$dir" && pwd`
1021
1560
          if test -z "$absdir"; then
1022
1561
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1023
 
            exit 1
 
1562
            absdir="$dir"
 
1563
            notinst_path="$notinst_path $dir"
1024
1564
          fi
1025
1565
          dir="$absdir"
1026
1566
          ;;
1034
1574
        esac
1035
1575
        case $host in
1036
1576
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1577
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1037
1578
          case :$dllsearchpath: in
1038
1579
          *":$dir:"*) ;;
1039
1580
          *) dllsearchpath="$dllsearchpath:$dir";;
1040
1581
          esac
 
1582
          case :$dllsearchpath: in
 
1583
          *":$testbindir:"*) ;;
 
1584
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1585
          esac
1041
1586
          ;;
1042
1587
        esac
1043
1588
        continue
1046
1591
      -l*)
1047
1592
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1048
1593
          case $host in
1049
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1594
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1050
1595
            # These systems don't actually have a C or math library (as such)
1051
1596
            continue
1052
1597
            ;;
1053
 
          *-*-mingw* | *-*-os2*)
 
1598
          *-*-os2*)
1054
1599
            # These systems don't actually have a C library (as such)
1055
1600
            test "X$arg" = "X-lc" && continue
1056
1601
            ;;
1057
 
          *-*-openbsd* | *-*-freebsd*)
 
1602
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1058
1603
            # Do not include libc due to us having libc/libc_r.
1059
1604
            test "X$arg" = "X-lc" && continue
1060
1605
            ;;
1061
 
          esac
1062
 
         elif test "X$arg" = "X-lc_r"; then
1063
 
          case $host in
1064
 
         *-*-openbsd* | *-*-freebsd*)
1065
 
            # Do not include libc_r directly, use -pthread flag.
 
1606
          *-*-rhapsody* | *-*-darwin1.[012])
 
1607
            # Rhapsody C and math libraries are in the System framework
 
1608
            deplibs="$deplibs -framework System"
1066
1609
            continue
1067
1610
            ;;
 
1611
          *-*-sco3.2v5* | *-*-sco5v6*)
 
1612
            # Causes problems with __ctype
 
1613
            test "X$arg" = "X-lc" && continue
 
1614
            ;;
 
1615
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
1616
            # Compiler inserts libc in the correct place for threads to work
 
1617
            test "X$arg" = "X-lc" && continue
 
1618
            ;;
1068
1619
          esac
 
1620
        elif test "X$arg" = "X-lc_r"; then
 
1621
         case $host in
 
1622
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
1623
           # Do not include libc_r directly, use -pthread flag.
 
1624
           continue
 
1625
           ;;
 
1626
         esac
1069
1627
        fi
1070
1628
        deplibs="$deplibs $arg"
1071
1629
        continue
1072
1630
        ;;
1073
1631
 
 
1632
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
1633
      # classes, name mangling, and exception handling.
 
1634
      -model)
 
1635
        compile_command="$compile_command $arg"
 
1636
        compiler_flags="$compiler_flags $arg"
 
1637
        finalize_command="$finalize_command $arg"
 
1638
        prev=xcompiler
 
1639
        continue
 
1640
        ;;
 
1641
 
 
1642
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 
1643
        compiler_flags="$compiler_flags $arg"
 
1644
        compile_command="$compile_command $arg"
 
1645
        finalize_command="$finalize_command $arg"
 
1646
        continue
 
1647
        ;;
 
1648
 
1074
1649
      -module)
1075
1650
        module=yes
1076
1651
        continue
1077
1652
        ;;
1078
1653
 
 
1654
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
 
1655
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
 
1656
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
 
1657
      # +DA*, +DD* enable 64-bit mode on the HP compiler
 
1658
      # -q* pass through compiler args for the IBM compiler
 
1659
      # -m* pass through architecture-specific compiler args for GCC
 
1660
      # -m*, -t[45]*, -txscale* pass through architecture-specific
 
1661
      # compiler args for GCC
 
1662
      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
 
1663
      # -F/path gives path to uninstalled frameworks, gcc on darwin
 
1664
      # @file GCC response files
 
1665
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
 
1666
      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
 
1667
 
 
1668
        # Unknown arguments in both finalize_command and compile_command need
 
1669
        # to be aesthetically quoted because they are evaled later.
 
1670
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1671
        case $arg in
 
1672
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1673
          arg="\"$arg\""
 
1674
          ;;
 
1675
        esac
 
1676
        compile_command="$compile_command $arg"
 
1677
        finalize_command="$finalize_command $arg"
 
1678
        compiler_flags="$compiler_flags $arg"
 
1679
        continue
 
1680
        ;;
 
1681
 
 
1682
      -shrext)
 
1683
        prev=shrext
 
1684
        continue
 
1685
        ;;
 
1686
 
1079
1687
      -no-fast-install)
1080
1688
        fast_install=no
1081
1689
        continue
1083
1691
 
1084
1692
      -no-install)
1085
1693
        case $host in
1086
 
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1694
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1087
1695
          # The PATH hackery in wrapper scripts is required on Windows
1088
 
          # in order for the loader to find any dlls it needs.
 
1696
          # and Darwin in order for the loader to find any dlls it needs.
1089
1697
          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1090
1698
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1091
1699
          fast_install=no
1100
1708
        continue
1101
1709
        ;;
1102
1710
 
 
1711
      -objectlist)
 
1712
        prev=objectlist
 
1713
        continue
 
1714
        ;;
 
1715
 
1103
1716
      -o) prev=output ;;
1104
1717
 
 
1718
      -precious-files-regex)
 
1719
        prev=precious_regex
 
1720
        continue
 
1721
        ;;
 
1722
 
1105
1723
      -release)
1106
1724
        prev=release
1107
1725
        continue
1124
1742
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1125
1743
        *)
1126
1744
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1127
 
          exit 1
 
1745
          exit $EXIT_FAILURE
1128
1746
          ;;
1129
1747
        esac
1130
1748
        case "$xrpath " in
1134
1752
        continue
1135
1753
        ;;
1136
1754
 
1137
 
      -static)
 
1755
      -static | -static-libtool-libs)
1138
1756
        # The effects of -static are defined in a previous loop.
1139
1757
        # We used to do the same as -all-static on platforms that
1140
1758
        # didn't have a PIC flag, but the assumption that the effects
1152
1770
        prev=vinfo
1153
1771
        continue
1154
1772
        ;;
 
1773
      -version-number)
 
1774
        prev=vinfo
 
1775
        vinfo_number=yes
 
1776
        continue
 
1777
        ;;
1155
1778
 
1156
1779
      -Wc,*)
1157
1780
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1200
1823
        continue
1201
1824
        ;;
1202
1825
 
 
1826
      -XCClinker)
 
1827
        prev=xcclinker
 
1828
        continue
 
1829
        ;;
 
1830
 
1203
1831
      # Some other compiler flag.
1204
1832
      -* | +*)
1205
1833
        # Unknown arguments in both finalize_command and compile_command need
1212
1840
        esac
1213
1841
        ;;
1214
1842
 
1215
 
      *.lo | *.$objext)
1216
 
        # A library or standard object.
1217
 
        if test "$prev" = dlfiles; then
1218
 
          # This file was specified with -dlopen.
1219
 
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1220
 
            dlfiles="$dlfiles $arg"
1221
 
            prev=
1222
 
            continue
1223
 
          else
1224
 
            # If libtool objects are unsupported, then we need to preload.
1225
 
            prev=dlprefiles
1226
 
          fi
1227
 
        fi
1228
 
 
1229
 
        if test "$prev" = dlprefiles; then
1230
 
          # Preload the old-style object.
1231
 
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1232
 
          prev=
1233
 
        else
 
1843
      *.$objext)
 
1844
        # A standard object.
 
1845
        objs="$objs $arg"
 
1846
        ;;
 
1847
 
 
1848
      *.lo)
 
1849
        # A libtool-controlled object.
 
1850
 
 
1851
        # Check to see that this really is a libtool object.
 
1852
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1853
          pic_object=
 
1854
          non_pic_object=
 
1855
 
 
1856
          # Read the .lo file
 
1857
          # If there is no directory component, then add one.
1234
1858
          case $arg in
1235
 
          *.lo) libobjs="$libobjs $arg" ;;
1236
 
          *) objs="$objs $arg" ;;
 
1859
          */* | *\\*) . $arg ;;
 
1860
          *) . ./$arg ;;
1237
1861
          esac
 
1862
 
 
1863
          if test -z "$pic_object" || \
 
1864
             test -z "$non_pic_object" ||
 
1865
             test "$pic_object" = none && \
 
1866
             test "$non_pic_object" = none; then
 
1867
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1868
            exit $EXIT_FAILURE
 
1869
          fi
 
1870
 
 
1871
          # Extract subdirectory from the argument.
 
1872
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1873
          if test "X$xdir" = "X$arg"; then
 
1874
            xdir=
 
1875
          else
 
1876
            xdir="$xdir/"
 
1877
          fi
 
1878
 
 
1879
          if test "$pic_object" != none; then
 
1880
            # Prepend the subdirectory the object is found in.
 
1881
            pic_object="$xdir$pic_object"
 
1882
 
 
1883
            if test "$prev" = dlfiles; then
 
1884
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1885
                dlfiles="$dlfiles $pic_object"
 
1886
                prev=
 
1887
                continue
 
1888
              else
 
1889
                # If libtool objects are unsupported, then we need to preload.
 
1890
                prev=dlprefiles
 
1891
              fi
 
1892
            fi
 
1893
 
 
1894
            # CHECK ME:  I think I busted this.  -Ossama
 
1895
            if test "$prev" = dlprefiles; then
 
1896
              # Preload the old-style object.
 
1897
              dlprefiles="$dlprefiles $pic_object"
 
1898
              prev=
 
1899
            fi
 
1900
 
 
1901
            # A PIC object.
 
1902
            libobjs="$libobjs $pic_object"
 
1903
            arg="$pic_object"
 
1904
          fi
 
1905
 
 
1906
          # Non-PIC object.
 
1907
          if test "$non_pic_object" != none; then
 
1908
            # Prepend the subdirectory the object is found in.
 
1909
            non_pic_object="$xdir$non_pic_object"
 
1910
 
 
1911
            # A standard non-PIC object
 
1912
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1913
            if test -z "$pic_object" || test "$pic_object" = none ; then
 
1914
              arg="$non_pic_object"
 
1915
            fi
 
1916
          else
 
1917
            # If the PIC object exists, use it instead.
 
1918
            # $xdir was prepended to $pic_object above.
 
1919
            non_pic_object="$pic_object"
 
1920
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1921
          fi
 
1922
        else
 
1923
          # Only an error if not doing a dry-run.
 
1924
          if test -z "$run"; then
 
1925
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1926
            exit $EXIT_FAILURE
 
1927
          else
 
1928
            # Dry-run case.
 
1929
 
 
1930
            # Extract subdirectory from the argument.
 
1931
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1932
            if test "X$xdir" = "X$arg"; then
 
1933
              xdir=
 
1934
            else
 
1935
              xdir="$xdir/"
 
1936
            fi
 
1937
 
 
1938
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1939
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1940
            libobjs="$libobjs $pic_object"
 
1941
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1942
          fi
1238
1943
        fi
1239
1944
        ;;
1240
1945
 
1285
1990
    if test -n "$prev"; then
1286
1991
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1287
1992
      $echo "$help" 1>&2
1288
 
      exit 1
 
1993
      exit $EXIT_FAILURE
1289
1994
    fi
1290
1995
 
1291
1996
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1294
1999
      finalize_command="$finalize_command $arg"
1295
2000
    fi
1296
2001
 
 
2002
    oldlibs=
1297
2003
    # calculate the name of the file, without its directory
1298
2004
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1299
2005
    libobjs_save="$libobjs"
1314
2020
      output_objdir="$output_objdir/$objdir"
1315
2021
    fi
1316
2022
    # Create the object directory.
1317
 
    if test ! -d $output_objdir; then
 
2023
    if test ! -d "$output_objdir"; then
1318
2024
      $show "$mkdir $output_objdir"
1319
2025
      $run $mkdir $output_objdir
1320
 
      status=$?
1321
 
      if test $status -ne 0 && test ! -d $output_objdir; then
1322
 
        exit $status
 
2026
      exit_status=$?
 
2027
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
2028
        exit $exit_status
1323
2029
      fi
1324
2030
    fi
1325
2031
 
1328
2034
    "")
1329
2035
      $echo "$modename: you must specify an output file" 1>&2
1330
2036
      $echo "$help" 1>&2
1331
 
      exit 1
 
2037
      exit $EXIT_FAILURE
1332
2038
      ;;
1333
2039
    *.$libext) linkmode=oldlib ;;
1334
2040
    *.lo | *.$objext) linkmode=obj ;;
1336
2042
    *) linkmode=prog ;; # Anything else should be a program.
1337
2043
    esac
1338
2044
 
 
2045
    case $host in
 
2046
    *cygwin* | *mingw* | *pw32*)
 
2047
      # don't eliminate duplications in $postdeps and $predeps
 
2048
      duplicate_compiler_generated_deps=yes
 
2049
      ;;
 
2050
    *)
 
2051
      duplicate_compiler_generated_deps=$duplicate_deps
 
2052
      ;;
 
2053
    esac
1339
2054
    specialdeplibs=
 
2055
 
1340
2056
    libs=
1341
2057
    # Find all interdependent deplibs by searching for libraries
1342
2058
    # that are linked more than once (e.g. -la -lb -la)
1348
2064
      fi
1349
2065
      libs="$libs $deplib"
1350
2066
    done
 
2067
 
 
2068
    if test "$linkmode" = lib; then
 
2069
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
2070
 
 
2071
      # Compute libraries that are listed more than once in $predeps
 
2072
      # $postdeps and mark them as special (i.e., whose duplicates are
 
2073
      # not to be eliminated).
 
2074
      pre_post_deps=
 
2075
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
2076
        for pre_post_dep in $predeps $postdeps; do
 
2077
          case "$pre_post_deps " in
 
2078
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
2079
          esac
 
2080
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
2081
        done
 
2082
      fi
 
2083
      pre_post_deps=
 
2084
    fi
 
2085
 
1351
2086
    deplibs=
1352
2087
    newdependency_libs=
1353
2088
    newlib_search_path=
1354
2089
    need_relink=no # whether we're linking any uninstalled libtool libraries
1355
2090
    notinst_deplibs= # not-installed libtool libraries
1356
 
    notinst_path= # paths that contain not-installed libtool libraries
1357
2091
    case $linkmode in
1358
2092
    lib)
1359
2093
        passes="conv link"
1362
2096
          *.la) ;;
1363
2097
          *)
1364
2098
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1365
 
            exit 1
 
2099
            exit $EXIT_FAILURE
1366
2100
            ;;
1367
2101
          esac
1368
2102
        done
1379
2113
        ;;
1380
2114
    esac
1381
2115
    for pass in $passes; do
1382
 
      if test $linkmode = prog; then
1383
 
        # Determine which files to process
 
2116
      if test "$linkmode,$pass" = "lib,link" ||
 
2117
         test "$linkmode,$pass" = "prog,scan"; then
 
2118
        libs="$deplibs"
 
2119
        deplibs=
 
2120
      fi
 
2121
      if test "$linkmode" = prog; then
1384
2122
        case $pass in
1385
 
        dlopen)
1386
 
          libs="$dlfiles"
1387
 
          save_deplibs="$deplibs" # Collect dlpreopened libraries
1388
 
          deplibs=
1389
 
          ;;
 
2123
        dlopen) libs="$dlfiles" ;;
1390
2124
        dlpreopen) libs="$dlprefiles" ;;
1391
2125
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1392
2126
        esac
1393
2127
      fi
 
2128
      if test "$pass" = dlopen; then
 
2129
        # Collect dlpreopened libraries
 
2130
        save_deplibs="$deplibs"
 
2131
        deplibs=
 
2132
      fi
1394
2133
      for deplib in $libs; do
1395
2134
        lib=
1396
2135
        found=no
1397
2136
        case $deplib in
 
2137
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 
2138
          if test "$linkmode,$pass" = "prog,link"; then
 
2139
            compile_deplibs="$deplib $compile_deplibs"
 
2140
            finalize_deplibs="$deplib $finalize_deplibs"
 
2141
          else
 
2142
            compiler_flags="$compiler_flags $deplib"
 
2143
          fi
 
2144
          continue
 
2145
          ;;
1398
2146
        -l*)
1399
 
          if test $linkmode = oldlib && test $linkmode = obj; then
1400
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1401
 
            continue
1402
 
          fi
1403
 
          if test $pass = conv; then
1404
 
            deplibs="$deplib $deplibs"
 
2147
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
2148
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1405
2149
            continue
1406
2150
          fi
1407
2151
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1408
2152
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1409
 
            # Search the libtool library
1410
 
            lib="$searchdir/lib${name}.la"
1411
 
            if test -f "$lib"; then
1412
 
              found=yes
1413
 
              break
1414
 
            fi
 
2153
            for search_ext in .la $std_shrext .so .a; do
 
2154
              # Search the libtool library
 
2155
              lib="$searchdir/lib${name}${search_ext}"
 
2156
              if test -f "$lib"; then
 
2157
                if test "$search_ext" = ".la"; then
 
2158
                  found=yes
 
2159
                else
 
2160
                  found=no
 
2161
                fi
 
2162
                break 2
 
2163
              fi
 
2164
            done
1415
2165
          done
1416
2166
          if test "$found" != yes; then
1417
2167
            # deplib doesn't seem to be a libtool library
1420
2170
              finalize_deplibs="$deplib $finalize_deplibs"
1421
2171
            else
1422
2172
              deplibs="$deplib $deplibs"
1423
 
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
2173
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1424
2174
            fi
1425
2175
            continue
 
2176
          else # deplib is a libtool library
 
2177
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
2178
            # We need to do some special things here, and not later.
 
2179
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
2180
              case " $predeps $postdeps " in
 
2181
              *" $deplib "*)
 
2182
                if (${SED} -e '2q' $lib |
 
2183
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
2184
                  library_names=
 
2185
                  old_library=
 
2186
                  case $lib in
 
2187
                  */* | *\\*) . $lib ;;
 
2188
                  *) . ./$lib ;;
 
2189
                  esac
 
2190
                  for l in $old_library $library_names; do
 
2191
                    ll="$l"
 
2192
                  done
 
2193
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
2194
                    found=no
 
2195
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
2196
                    test "X$ladir" = "X$lib" && ladir="."
 
2197
                    lib=$ladir/$old_library
 
2198
                    if test "$linkmode,$pass" = "prog,link"; then
 
2199
                      compile_deplibs="$deplib $compile_deplibs"
 
2200
                      finalize_deplibs="$deplib $finalize_deplibs"
 
2201
                    else
 
2202
                      deplibs="$deplib $deplibs"
 
2203
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
2204
                    fi
 
2205
                    continue
 
2206
                  fi
 
2207
                fi
 
2208
                ;;
 
2209
              *) ;;
 
2210
              esac
 
2211
            fi
1426
2212
          fi
1427
2213
          ;; # -l
1428
2214
        -L*)
1429
2215
          case $linkmode in
1430
2216
          lib)
1431
2217
            deplibs="$deplib $deplibs"
1432
 
            test $pass = conv && continue
 
2218
            test "$pass" = conv && continue
1433
2219
            newdependency_libs="$deplib $newdependency_libs"
1434
2220
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1435
2221
            ;;
1436
2222
          prog)
1437
 
            if test $pass = conv; then
 
2223
            if test "$pass" = conv; then
1438
2224
              deplibs="$deplib $deplibs"
1439
2225
              continue
1440
2226
            fi
1441
 
            if test $pass = scan; then
 
2227
            if test "$pass" = scan; then
1442
2228
              deplibs="$deplib $deplibs"
1443
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1444
2229
            else
1445
2230
              compile_deplibs="$deplib $compile_deplibs"
1446
2231
              finalize_deplibs="$deplib $finalize_deplibs"
1447
2232
            fi
 
2233
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1448
2234
            ;;
1449
2235
          *)
1450
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
2236
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1451
2237
            ;;
1452
2238
          esac # linkmode
1453
2239
          continue
1454
2240
          ;; # -L
1455
2241
        -R*)
1456
 
          if test $pass = link; then
 
2242
          if test "$pass" = link; then
1457
2243
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1458
2244
            # Make sure the xrpath contains only unique directories.
1459
2245
            case "$xrpath " in
1466
2252
          ;;
1467
2253
        *.la) lib="$deplib" ;;
1468
2254
        *.$libext)
1469
 
          if test $pass = conv; then
 
2255
          if test "$pass" = conv; then
1470
2256
            deplibs="$deplib $deplibs"
1471
2257
            continue
1472
2258
          fi
1473
2259
          case $linkmode in
1474
2260
          lib)
1475
 
            if test "$deplibs_check_method" != pass_all; then
1476
 
              echo
1477
 
              echo "*** Warning: Trying to link with static lib archive $deplib."
1478
 
              echo "*** I have the capability to make that library automatically link in when"
1479
 
              echo "*** you link to this library.  But I can only do this if you have a"
1480
 
              echo "*** shared version of the library, which you do not appear to have"
1481
 
              echo "*** because the file extensions .$libext of this argument makes me believe"
1482
 
              echo "*** that it is just a static archive that I should not used here."
 
2261
            valid_a_lib=no
 
2262
            case $deplibs_check_method in
 
2263
              match_pattern*)
 
2264
                set dummy $deplibs_check_method
 
2265
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2266
                if eval $echo \"$deplib\" 2>/dev/null \
 
2267
                    | $SED 10q \
 
2268
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2269
                  valid_a_lib=yes
 
2270
                fi
 
2271
                ;;
 
2272
              pass_all)
 
2273
                valid_a_lib=yes
 
2274
                ;;
 
2275
            esac
 
2276
            if test "$valid_a_lib" != yes; then
 
2277
              $echo
 
2278
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
2279
              $echo "*** I have the capability to make that library automatically link in when"
 
2280
              $echo "*** you link to this library.  But I can only do this if you have a"
 
2281
              $echo "*** shared version of the library, which you do not appear to have"
 
2282
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
2283
              $echo "*** that it is just a static archive that I should not used here."
1483
2284
            else
1484
 
              echo
1485
 
              echo "*** Warning: Linking the shared library $output against the"
1486
 
              echo "*** static library $deplib is not portable!"
 
2285
              $echo
 
2286
              $echo "*** Warning: Linking the shared library $output against the"
 
2287
              $echo "*** static library $deplib is not portable!"
1487
2288
              deplibs="$deplib $deplibs"
1488
2289
            fi
1489
2290
            continue
1490
2291
            ;;
1491
2292
          prog)
1492
 
            if test $pass != link; then
 
2293
            if test "$pass" != link; then
1493
2294
              deplibs="$deplib $deplibs"
1494
2295
            else
1495
2296
              compile_deplibs="$deplib $compile_deplibs"
1500
2301
          esac # linkmode
1501
2302
          ;; # *.$libext
1502
2303
        *.lo | *.$objext)
1503
 
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1504
 
            # If there is no dlopen support or we're linking statically,
1505
 
            # we need to preload.
1506
 
            newdlprefiles="$newdlprefiles $deplib"
1507
 
            compile_deplibs="$deplib $compile_deplibs"
1508
 
            finalize_deplibs="$deplib $finalize_deplibs"
1509
 
          else
1510
 
            newdlfiles="$newdlfiles $deplib"
 
2304
          if test "$pass" = conv; then
 
2305
            deplibs="$deplib $deplibs"
 
2306
          elif test "$linkmode" = prog; then
 
2307
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2308
              # If there is no dlopen support or we're linking statically,
 
2309
              # we need to preload.
 
2310
              newdlprefiles="$newdlprefiles $deplib"
 
2311
              compile_deplibs="$deplib $compile_deplibs"
 
2312
              finalize_deplibs="$deplib $finalize_deplibs"
 
2313
            else
 
2314
              newdlfiles="$newdlfiles $deplib"
 
2315
            fi
1511
2316
          fi
1512
2317
          continue
1513
2318
          ;;
1516
2321
          continue
1517
2322
          ;;
1518
2323
        esac # case $deplib
1519
 
        if test $found = yes || test -f "$lib"; then :
 
2324
        if test "$found" = yes || test -f "$lib"; then :
1520
2325
        else
1521
 
          $echo "$modename: cannot find the library \`$lib' (lib${name}.la: $deplib)" 1>&2
1522
 
          exit 1
 
2326
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
 
2327
          exit $EXIT_FAILURE
1523
2328
        fi
1524
2329
 
1525
2330
        # Check to see that this really is a libtool archive.
1526
 
        if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2331
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1527
2332
        else
1528
2333
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1529
 
          exit 1
 
2334
          exit $EXIT_FAILURE
1530
2335
        fi
1531
2336
 
1532
2337
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1539
2344
        library_names=
1540
2345
        old_library=
1541
2346
        # If the library was installed with an old release of libtool,
1542
 
        # it will not redefine variable installed.
 
2347
        # it will not redefine variables installed, or shouldnotlink
1543
2348
        installed=yes
 
2349
        shouldnotlink=no
 
2350
        avoidtemprpath=
 
2351
 
1544
2352
 
1545
2353
        # Read the .la file
1546
2354
        case $lib in
1550
2358
 
1551
2359
        if test "$linkmode,$pass" = "lib,link" ||
1552
2360
           test "$linkmode,$pass" = "prog,scan" ||
1553
 
           { test $linkmode = oldlib && test $linkmode = obj; }; then
1554
 
           # Add dl[pre]opened files of deplib
 
2361
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1555
2362
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1556
2363
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1557
2364
        fi
1558
2365
 
1559
 
        if test $pass = conv; then
 
2366
        if test "$pass" = conv; then
1560
2367
          # Only check for convenience libraries
1561
2368
          deplibs="$lib $deplibs"
1562
2369
          if test -z "$libdir"; then
1563
2370
            if test -z "$old_library"; then
1564
2371
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1565
 
              exit 1
 
2372
              exit $EXIT_FAILURE
1566
2373
            fi
1567
2374
            # It is a libtool convenience library, so add in its objects.
1568
2375
            convenience="$convenience $ladir/$objdir/$old_library"
1577
2384
              fi
1578
2385
              tmp_libs="$tmp_libs $deplib"
1579
2386
            done
1580
 
          elif test $linkmode != prog && test $linkmode != lib; then
 
2387
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1581
2388
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1582
 
            exit 1
 
2389
            exit $EXIT_FAILURE
1583
2390
          fi
1584
2391
          continue
1585
2392
        fi # $pass = conv
1586
2393
 
 
2394
 
1587
2395
        # Get the name of the library we link against.
1588
2396
        linklib=
1589
2397
        for l in $old_library $library_names; do
1591
2399
        done
1592
2400
        if test -z "$linklib"; then
1593
2401
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1594
 
          exit 1
 
2402
          exit $EXIT_FAILURE
1595
2403
        fi
1596
2404
 
1597
2405
        # This library was specified with -dlopen.
1598
 
        if test $pass = dlopen; then
 
2406
        if test "$pass" = dlopen; then
1599
2407
          if test -z "$libdir"; then
1600
2408
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1601
 
            exit 1
 
2409
            exit $EXIT_FAILURE
1602
2410
          fi
1603
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2411
          if test -z "$dlname" ||
 
2412
             test "$dlopen_support" != yes ||
 
2413
             test "$build_libtool_libs" = no; then
1604
2414
            # If there is no dlname, no dlopen support or we're linking
1605
 
            # statically, we need to preload.
1606
 
            dlprefiles="$dlprefiles $lib"
 
2415
            # statically, we need to preload.  We also need to preload any
 
2416
            # dependent libraries so libltdl's deplib preloader doesn't
 
2417
            # bomb out in the load deplibs phase.
 
2418
            dlprefiles="$dlprefiles $lib $dependency_libs"
1607
2419
          else
1608
2420
            newdlfiles="$newdlfiles $lib"
1609
2421
          fi
1635
2447
            dir="$libdir"
1636
2448
            absdir="$libdir"
1637
2449
          fi
 
2450
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
1638
2451
        else
1639
 
          dir="$ladir/$objdir"
1640
 
          absdir="$abs_ladir/$objdir"
1641
 
          # Remove this search path later
1642
 
          notinst_path="$notinst_path $abs_ladir"
 
2452
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2453
            dir="$ladir"
 
2454
            absdir="$abs_ladir"
 
2455
            # Remove this search path later
 
2456
            notinst_path="$notinst_path $abs_ladir"
 
2457
          else
 
2458
            dir="$ladir/$objdir"
 
2459
            absdir="$abs_ladir/$objdir"
 
2460
            # Remove this search path later
 
2461
            notinst_path="$notinst_path $abs_ladir"
 
2462
          fi
1643
2463
        fi # $installed = yes
1644
2464
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1645
2465
 
1646
2466
        # This library was specified with -dlpreopen.
1647
 
        if test $pass = dlpreopen; then
 
2467
        if test "$pass" = dlpreopen; then
1648
2468
          if test -z "$libdir"; then
1649
2469
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1650
 
            exit 1
 
2470
            exit $EXIT_FAILURE
1651
2471
          fi
1652
2472
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1653
2473
          # are required to link).
1663
2483
 
1664
2484
        if test -z "$libdir"; then
1665
2485
          # Link the convenience library
1666
 
          if test $linkmode = lib; then
 
2486
          if test "$linkmode" = lib; then
1667
2487
            deplibs="$dir/$old_library $deplibs"
1668
2488
          elif test "$linkmode,$pass" = "prog,link"; then
1669
2489
            compile_deplibs="$dir/$old_library $compile_deplibs"
1670
2490
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1671
2491
          else
1672
 
            deplibs="$lib $deplibs"
 
2492
            deplibs="$lib $deplibs" # used for prog,scan pass
1673
2493
          fi
1674
2494
          continue
1675
2495
        fi
1676
2496
 
1677
 
        if test $linkmode = prog && test $pass != link; then
 
2497
 
 
2498
        if test "$linkmode" = prog && test "$pass" != link; then
1678
2499
          newlib_search_path="$newlib_search_path $ladir"
1679
2500
          deplibs="$lib $deplibs"
1680
2501
 
1690
2511
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1691
2512
            esac
1692
2513
            # Need to link against all dependency_libs?
1693
 
            if test $linkalldeplibs = yes; then
 
2514
            if test "$linkalldeplibs" = yes; then
1694
2515
              deplibs="$deplib $deplibs"
1695
2516
            else
1696
2517
              # Need to hardcode shared library paths
1707
2528
          continue
1708
2529
        fi # $linkmode = prog...
1709
2530
 
 
2531
        if test "$linkmode,$pass" = "prog,link"; then
 
2532
          if test -n "$library_names" &&
 
2533
             { { test "$prefer_static_libs" = no ||
 
2534
                 test "$prefer_static_libs,$installed" = "built,yes"; } ||
 
2535
               test -z "$old_library"; }; then
 
2536
            # We need to hardcode the library path
 
2537
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 
2538
              # Make sure the rpath contains only unique directories.
 
2539
              case "$temp_rpath " in
 
2540
              *" $dir "*) ;;
 
2541
              *" $absdir "*) ;;
 
2542
              *) temp_rpath="$temp_rpath $absdir" ;;
 
2543
              esac
 
2544
            fi
 
2545
 
 
2546
            # Hardcode the library path.
 
2547
            # Skip directories that are in the system default run-time
 
2548
            # search path.
 
2549
            case " $sys_lib_dlsearch_path " in
 
2550
            *" $absdir "*) ;;
 
2551
            *)
 
2552
              case "$compile_rpath " in
 
2553
              *" $absdir "*) ;;
 
2554
              *) compile_rpath="$compile_rpath $absdir"
 
2555
              esac
 
2556
              ;;
 
2557
            esac
 
2558
            case " $sys_lib_dlsearch_path " in
 
2559
            *" $libdir "*) ;;
 
2560
            *)
 
2561
              case "$finalize_rpath " in
 
2562
              *" $libdir "*) ;;
 
2563
              *) finalize_rpath="$finalize_rpath $libdir"
 
2564
              esac
 
2565
              ;;
 
2566
            esac
 
2567
          fi # $linkmode,$pass = prog,link...
 
2568
 
 
2569
          if test "$alldeplibs" = yes &&
 
2570
             { test "$deplibs_check_method" = pass_all ||
 
2571
               { test "$build_libtool_libs" = yes &&
 
2572
                 test -n "$library_names"; }; }; then
 
2573
            # We only need to search for static libraries
 
2574
            continue
 
2575
          fi
 
2576
        fi
 
2577
 
1710
2578
        link_static=no # Whether the deplib will be linked statically
 
2579
        use_static_libs=$prefer_static_libs
 
2580
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2581
          use_static_libs=no
 
2582
        fi
1711
2583
        if test -n "$library_names" &&
1712
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1713
 
          # Link against this shared library
1714
 
 
1715
 
          if test "$linkmode,$pass" = "prog,link" ||
1716
 
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1717
 
            # Hardcode the library path.
1718
 
            # Skip directories that are in the system default run-time
1719
 
            # search path.
1720
 
            case " $sys_lib_dlsearch_path " in
1721
 
            *" $absdir "*) ;;
1722
 
            *)
1723
 
              case "$compile_rpath " in
1724
 
              *" $absdir "*) ;;
1725
 
              *) compile_rpath="$compile_rpath $absdir"
1726
 
              esac
1727
 
              ;;
1728
 
            esac
1729
 
            case " $sys_lib_dlsearch_path " in
1730
 
            *" $libdir "*) ;;
1731
 
            *)
1732
 
              case "$finalize_rpath " in
1733
 
              *" $libdir "*) ;;
1734
 
              *) finalize_rpath="$finalize_rpath $libdir"
1735
 
              esac
1736
 
              ;;
1737
 
            esac
1738
 
            if test $linkmode = prog; then
1739
 
              # We need to hardcode the library path
1740
 
              if test -n "$shlibpath_var"; then
1741
 
                # Make sure the rpath contains only unique directories.
1742
 
                case "$temp_rpath " in
1743
 
                *" $dir "*) ;;
1744
 
                *" $absdir "*) ;;
1745
 
                *) temp_rpath="$temp_rpath $dir" ;;
1746
 
                esac
1747
 
              fi
1748
 
            fi
1749
 
          fi # $linkmode,$pass = prog,link...
1750
 
 
1751
 
          if test "$alldeplibs" = yes &&
1752
 
             { test "$deplibs_check_method" = pass_all ||
1753
 
               { test "$build_libtool_libs" = yes &&
1754
 
                 test -n "$library_names"; }; }; then
1755
 
            # We only need to search for static libraries
1756
 
            continue
1757
 
          fi
1758
 
 
 
2584
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
1759
2585
          if test "$installed" = no; then
1760
2586
            notinst_deplibs="$notinst_deplibs $lib"
1761
2587
            need_relink=yes
1762
2588
          fi
 
2589
          # This is a shared library
 
2590
 
 
2591
          # Warn about portability, can't link against -module's on
 
2592
          # some systems (darwin)
 
2593
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2594
            $echo
 
2595
            if test "$linkmode" = prog; then
 
2596
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
2597
            else
 
2598
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
2599
            fi
 
2600
            $echo "*** $linklib is not portable!"
 
2601
          fi
 
2602
          if test "$linkmode" = lib &&
 
2603
             test "$hardcode_into_libs" = yes; then
 
2604
            # Hardcode the library path.
 
2605
            # Skip directories that are in the system default run-time
 
2606
            # search path.
 
2607
            case " $sys_lib_dlsearch_path " in
 
2608
            *" $absdir "*) ;;
 
2609
            *)
 
2610
              case "$compile_rpath " in
 
2611
              *" $absdir "*) ;;
 
2612
              *) compile_rpath="$compile_rpath $absdir"
 
2613
              esac
 
2614
              ;;
 
2615
            esac
 
2616
            case " $sys_lib_dlsearch_path " in
 
2617
            *" $libdir "*) ;;
 
2618
            *)
 
2619
              case "$finalize_rpath " in
 
2620
              *" $libdir "*) ;;
 
2621
              *) finalize_rpath="$finalize_rpath $libdir"
 
2622
              esac
 
2623
              ;;
 
2624
            esac
 
2625
          fi
1763
2626
 
1764
2627
          if test -n "$old_archive_from_expsyms_cmds"; then
1765
2628
            # figure out the soname
1773
2636
            elif test -n "$soname_spec"; then
1774
2637
              # bleh windows
1775
2638
              case $host in
1776
 
              *cygwin*)
 
2639
              *cygwin* | mingw*)
1777
2640
                major=`expr $current - $age`
1778
2641
                versuffix="-$major"
1779
2642
                ;;
1785
2648
 
1786
2649
            # Make a new name for the extract_expsyms_cmds to use
1787
2650
            soroot="$soname"
1788
 
            soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1789
 
            newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
2651
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2652
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1790
2653
 
1791
2654
            # If the library has no export list, then create one now
1792
2655
            if test -f "$output_objdir/$soname-def"; then :
1793
2656
            else
1794
2657
              $show "extracting exported symbol list from \`$soname'"
1795
2658
              save_ifs="$IFS"; IFS='~'
1796
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2659
              cmds=$extract_expsyms_cmds
1797
2660
              for cmd in $cmds; do
1798
2661
                IFS="$save_ifs"
 
2662
                eval cmd=\"$cmd\"
1799
2663
                $show "$cmd"
1800
2664
                $run eval "$cmd" || exit $?
1801
2665
              done
1806
2670
            if test -f "$output_objdir/$newlib"; then :; else
1807
2671
              $show "generating import library for \`$soname'"
1808
2672
              save_ifs="$IFS"; IFS='~'
1809
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2673
              cmds=$old_archive_from_expsyms_cmds
1810
2674
              for cmd in $cmds; do
1811
2675
                IFS="$save_ifs"
 
2676
                eval cmd=\"$cmd\"
1812
2677
                $show "$cmd"
1813
2678
                $run eval "$cmd" || exit $?
1814
2679
              done
1817
2682
            # make sure the library variables are pointing to the new library
1818
2683
            dir=$output_objdir
1819
2684
            linklib=$newlib
1820
 
          fi # test -n $old_archive_from_expsyms_cmds
 
2685
          fi # test -n "$old_archive_from_expsyms_cmds"
1821
2686
 
1822
 
          if test $linkmode = prog || test "$mode" != relink; then
 
2687
          if test "$linkmode" = prog || test "$mode" != relink; then
1823
2688
            add_shlibpath=
1824
2689
            add_dir=
1825
2690
            add=
1828
2693
            immediate | unsupported)
1829
2694
              if test "$hardcode_direct" = no; then
1830
2695
                add="$dir/$linklib"
 
2696
                case $host in
 
2697
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2698
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2699
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2700
                    *-*-unixware7*) add_dir="-L$dir" ;;
 
2701
                  *-*-darwin* )
 
2702
                    # if the lib is a module then we can not link against
 
2703
                    # it, someone is ignoring the new warnings I added
 
2704
                    if /usr/bin/file -L $add 2> /dev/null |
 
2705
                      $EGREP ": [^:]* bundle" >/dev/null ; then
 
2706
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2707
                      if test -z "$old_library" ; then
 
2708
                        $echo
 
2709
                        $echo "** And there doesn't seem to be a static archive available"
 
2710
                        $echo "** The link will probably fail, sorry"
 
2711
                      else
 
2712
                        add="$dir/$old_library"
 
2713
                      fi
 
2714
                    fi
 
2715
                esac
1831
2716
              elif test "$hardcode_minus_L" = no; then
1832
2717
                case $host in
1833
2718
                *-*-sunos*) add_shlibpath="$dir" ;;
1846
2731
                add="$dir/$linklib"
1847
2732
              elif test "$hardcode_minus_L" = yes; then
1848
2733
                add_dir="-L$dir"
 
2734
                # Try looking first in the location we're being installed to.
 
2735
                if test -n "$inst_prefix_dir"; then
 
2736
                  case $libdir in
 
2737
                    [\\/]*)
 
2738
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2739
                      ;;
 
2740
                  esac
 
2741
                fi
1849
2742
                add="-l$name"
1850
2743
              elif test "$hardcode_shlibpath_var" = yes; then
1851
2744
                add_shlibpath="$dir"
1859
2752
 
1860
2753
            if test "$lib_linked" != yes; then
1861
2754
              $echo "$modename: configuration error: unsupported hardcode properties"
1862
 
              exit 1
 
2755
              exit $EXIT_FAILURE
1863
2756
            fi
1864
2757
 
1865
2758
            if test -n "$add_shlibpath"; then
1868
2761
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1869
2762
              esac
1870
2763
            fi
1871
 
            if test $linkmode = prog; then
 
2764
            if test "$linkmode" = prog; then
1872
2765
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1873
2766
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1874
2767
            else
1885
2778
            fi
1886
2779
          fi
1887
2780
 
1888
 
          if test $linkmode = prog || test "$mode" = relink; then
 
2781
          if test "$linkmode" = prog || test "$mode" = relink; then
1889
2782
            add_shlibpath=
1890
2783
            add_dir=
1891
2784
            add=
1901
2794
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1902
2795
              esac
1903
2796
              add="-l$name"
 
2797
            elif test "$hardcode_automatic" = yes; then
 
2798
              if test -n "$inst_prefix_dir" &&
 
2799
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2800
                add="$inst_prefix_dir$libdir/$linklib"
 
2801
              else
 
2802
                add="$libdir/$linklib"
 
2803
              fi
1904
2804
            else
1905
2805
              # We cannot seem to hardcode it, guess we'll fake it.
1906
2806
              add_dir="-L$libdir"
 
2807
              # Try looking first in the location we're being installed to.
 
2808
              if test -n "$inst_prefix_dir"; then
 
2809
                case $libdir in
 
2810
                  [\\/]*)
 
2811
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2812
                    ;;
 
2813
                esac
 
2814
              fi
1907
2815
              add="-l$name"
1908
2816
            fi
1909
2817
 
1910
 
            if test $linkmode = prog; then
 
2818
            if test "$linkmode" = prog; then
1911
2819
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1912
2820
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1913
2821
            else
1915
2823
              test -n "$add" && deplibs="$add $deplibs"
1916
2824
            fi
1917
2825
          fi
1918
 
        elif test $linkmode = prog; then
1919
 
          if test "$alldeplibs" = yes &&
1920
 
             { test "$deplibs_check_method" = pass_all ||
1921
 
               { test "$build_libtool_libs" = yes &&
1922
 
                 test -n "$library_names"; }; }; then
1923
 
            # We only need to search for static libraries
1924
 
            continue
1925
 
          fi
1926
 
 
1927
 
          # Try to link the static library
 
2826
        elif test "$linkmode" = prog; then
1928
2827
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1929
2828
          # is not unsupported.  This is valid on all known static and
1930
2829
          # shared platforms.
1944
2843
 
1945
2844
            # Just print a warning and add the library to dependency_libs so
1946
2845
            # that the program can be linked against the static library.
1947
 
            echo
1948
 
            echo "*** Warning: This system can not link to static lib archive $lib."
1949
 
            echo "*** I have the capability to make that library automatically link in when"
1950
 
            echo "*** you link to this library.  But I can only do this if you have a"
1951
 
            echo "*** shared version of the library, which you do not appear to have."
 
2846
            $echo
 
2847
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2848
            $echo "*** I have the capability to make that library automatically link in when"
 
2849
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2850
            $echo "*** shared version of the library, which you do not appear to have."
1952
2851
            if test "$module" = yes; then
1953
 
              echo "*** But as you try to build a module library, libtool will still create "
1954
 
              echo "*** a static module, that should work as long as the dlopening application"
1955
 
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
2852
              $echo "*** But as you try to build a module library, libtool will still create "
 
2853
              $echo "*** a static module, that should work as long as the dlopening application"
 
2854
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1956
2855
              if test -z "$global_symbol_pipe"; then
1957
 
                echo
1958
 
                echo "*** However, this would only work if libtool was able to extract symbol"
1959
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1960
 
                echo "*** not find such a program.  So, this module is probably useless."
1961
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2856
                $echo
 
2857
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2858
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2859
                $echo "*** not find such a program.  So, this module is probably useless."
 
2860
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
1962
2861
              fi
1963
2862
              if test "$build_old_libs" = no; then
1964
2863
                build_libtool_libs=module
1968
2867
              fi
1969
2868
            fi
1970
2869
          else
1971
 
            convenience="$convenience $dir/$old_library"
1972
 
            old_convenience="$old_convenience $dir/$old_library"
1973
2870
            deplibs="$dir/$old_library $deplibs"
1974
2871
            link_static=yes
1975
2872
          fi
1976
2873
        fi # link shared/static library?
1977
2874
 
1978
 
        if test $linkmode = lib; then
 
2875
        if test "$linkmode" = lib; then
1979
2876
          if test -n "$dependency_libs" &&
1980
 
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1981
 
               test $link_static = yes; }; then
 
2877
             { test "$hardcode_into_libs" != yes ||
 
2878
               test "$build_old_libs" = yes ||
 
2879
               test "$link_static" = yes; }; then
1982
2880
            # Extract -R from dependency_libs
1983
2881
            temp_deplibs=
1984
2882
            for libdir in $dependency_libs; do
2009
2907
            tmp_libs="$tmp_libs $deplib"
2010
2908
          done
2011
2909
 
2012
 
          if test $link_all_deplibs != no; then
 
2910
          if test "$link_all_deplibs" != no; then
2013
2911
            # Add the search paths of all dependency libraries
2014
2912
            for deplib in $dependency_libs; do
2015
2913
              case $deplib in
2029
2927
                  ;;
2030
2928
                esac
2031
2929
                if grep "^installed=no" $deplib > /dev/null; then
2032
 
                  path="-L$absdir/$objdir"
 
2930
                  path="$absdir/$objdir"
2033
2931
                else
2034
2932
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2035
2933
                  if test -z "$libdir"; then
2036
2934
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2037
 
                    exit 1
 
2935
                    exit $EXIT_FAILURE
2038
2936
                  fi
2039
2937
                  if test "$absdir" != "$libdir"; then
2040
2938
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2041
2939
                  fi
2042
 
                  path="-L$absdir"
 
2940
                  path="$absdir"
2043
2941
                fi
 
2942
                depdepl=
 
2943
                case $host in
 
2944
                *-*-darwin*)
 
2945
                  # we do not want to link against static libs,
 
2946
                  # but need to link against shared
 
2947
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2948
                  if test -n "$deplibrary_names" ; then
 
2949
                    for tmp in $deplibrary_names ; do
 
2950
                      depdepl=$tmp
 
2951
                    done
 
2952
                    if test -f "$path/$depdepl" ; then
 
2953
                      depdepl="$path/$depdepl"
 
2954
                    fi
 
2955
                    # do not add paths which are already there
 
2956
                    case " $newlib_search_path " in
 
2957
                    *" $path "*) ;;
 
2958
                    *) newlib_search_path="$newlib_search_path $path";;
 
2959
                    esac
 
2960
                  fi
 
2961
                  path=""
 
2962
                  ;;
 
2963
                *)
 
2964
                  path="-L$path"
 
2965
                  ;;
 
2966
                esac
 
2967
                ;;
 
2968
              -l*)
 
2969
                case $host in
 
2970
                *-*-darwin*)
 
2971
                  # Again, we only want to link against shared libraries
 
2972
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2973
                  for tmp in $newlib_search_path ; do
 
2974
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2975
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2976
                      break
 
2977
                    fi
 
2978
                  done
 
2979
                  path=""
 
2980
                  ;;
 
2981
                *) continue ;;
 
2982
                esac
2044
2983
                ;;
2045
2984
              *) continue ;;
2046
2985
              esac
2047
2986
              case " $deplibs " in
2048
2987
              *" $path "*) ;;
2049
 
              *) deplibs="$deplibs $path" ;;
 
2988
              *) deplibs="$path $deplibs" ;;
 
2989
              esac
 
2990
              case " $deplibs " in
 
2991
              *" $depdepl "*) ;;
 
2992
              *) deplibs="$depdepl $deplibs" ;;
2050
2993
              esac
2051
2994
            done
2052
2995
          fi # link_all_deplibs != no
2053
2996
        fi # linkmode = lib
2054
2997
      done # for deplib in $libs
2055
 
      if test $pass = dlpreopen; then
 
2998
      dependency_libs="$newdependency_libs"
 
2999
      if test "$pass" = dlpreopen; then
2056
3000
        # Link the dlpreopened libraries before other libraries
2057
3001
        for deplib in $save_deplibs; do
2058
3002
          deplibs="$deplib $deplibs"
2059
3003
        done
2060
3004
      fi
2061
 
      if test $pass != dlopen; then
2062
 
        test $pass != scan && dependency_libs="$newdependency_libs"
2063
 
        if test $pass != conv; then
 
3005
      if test "$pass" != dlopen; then
 
3006
        if test "$pass" != conv; then
2064
3007
          # Make sure lib_search_path contains only unique directories.
2065
3008
          lib_search_path=
2066
3009
          for dir in $newlib_search_path; do
2082
3025
          eval tmp_libs=\"\$$var\"
2083
3026
          new_libs=
2084
3027
          for deplib in $tmp_libs; do
 
3028
            # FIXME: Pedantically, this is the right thing to do, so
 
3029
            #        that some nasty dependency loop isn't accidentally
 
3030
            #        broken:
 
3031
            #new_libs="$deplib $new_libs"
 
3032
            # Pragmatically, this seems to cause very few problems in
 
3033
            # practice:
2085
3034
            case $deplib in
2086
3035
            -L*) new_libs="$deplib $new_libs" ;;
 
3036
            -R*) ;;
2087
3037
            *)
 
3038
              # And here is the reason: when a library appears more
 
3039
              # than once as an explicit dependence of a library, or
 
3040
              # is implicitly linked in more than once by the
 
3041
              # compiler, it is considered special, and multiple
 
3042
              # occurrences thereof are not removed.  Compare this
 
3043
              # with having the same library being listed as a
 
3044
              # dependency of multiple other libraries: in this case,
 
3045
              # we know (pedantically, we assume) the library does not
 
3046
              # need to be listed more than once, so we keep only the
 
3047
              # last copy.  This is not always right, but it is rare
 
3048
              # enough that we require users that really mean to play
 
3049
              # such unportable linking tricks to link the library
 
3050
              # using -Wl,-lname, so that libtool does not consider it
 
3051
              # for duplicate removal.
2088
3052
              case " $specialdeplibs " in
2089
3053
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2090
3054
              *)
2112
3076
          eval $var=\"$tmp_libs\"
2113
3077
        done # for var
2114
3078
      fi
2115
 
      if test "$pass" = "conv" &&
2116
 
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2117
 
        libs="$deplibs" # reset libs
2118
 
        deplibs=
2119
 
      fi
 
3079
      # Last step: remove runtime libs from dependency_libs
 
3080
      # (they stay in deplibs)
 
3081
      tmp_libs=
 
3082
      for i in $dependency_libs ; do
 
3083
        case " $predeps $postdeps $compiler_lib_search_path " in
 
3084
        *" $i "*)
 
3085
          i=""
 
3086
          ;;
 
3087
        esac
 
3088
        if test -n "$i" ; then
 
3089
          tmp_libs="$tmp_libs $i"
 
3090
        fi
 
3091
      done
 
3092
      dependency_libs=$tmp_libs
2120
3093
    done # for pass
2121
 
    if test $linkmode = prog; then
 
3094
    if test "$linkmode" = prog; then
2122
3095
      dlfiles="$newdlfiles"
2123
3096
      dlprefiles="$newdlprefiles"
2124
3097
    fi
2125
3098
 
2126
3099
    case $linkmode in
2127
3100
    oldlib)
 
3101
      if test -n "$deplibs"; then
 
3102
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
 
3103
      fi
 
3104
 
2128
3105
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2129
3106
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2130
3107
      fi
2138
3115
      fi
2139
3116
 
2140
3117
      if test -n "$vinfo"; then
2141
 
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
3118
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2142
3119
      fi
2143
3120
 
2144
3121
      if test -n "$release"; then
2160
3137
      case $outputname in
2161
3138
      lib*)
2162
3139
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
3140
        eval shared_ext=\"$shrext_cmds\"
2163
3141
        eval libname=\"$libname_spec\"
2164
3142
        ;;
2165
3143
      *)
2166
3144
        if test "$module" = no; then
2167
3145
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2168
3146
          $echo "$help" 1>&2
2169
 
          exit 1
 
3147
          exit $EXIT_FAILURE
2170
3148
        fi
2171
3149
        if test "$need_lib_prefix" != no; then
2172
3150
          # Add the "lib" prefix for modules if required
2173
3151
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
3152
          eval shared_ext=\"$shrext_cmds\"
2174
3153
          eval libname=\"$libname_spec\"
2175
3154
        else
2176
3155
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2181
3160
      if test -n "$objs"; then
2182
3161
        if test "$deplibs_check_method" != pass_all; then
2183
3162
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2184
 
          exit 1
 
3163
          exit $EXIT_FAILURE
2185
3164
        else
2186
 
          echo
2187
 
          echo "*** Warning: Linking the shared library $output against the non-libtool"
2188
 
          echo "*** objects $objs is not portable!"
 
3165
          $echo
 
3166
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
3167
          $echo "*** objects $objs is not portable!"
2189
3168
          libobjs="$libobjs $objs"
2190
3169
        fi
2191
3170
      fi
2195
3174
      fi
2196
3175
 
2197
3176
      set dummy $rpath
2198
 
      if test $# -gt 2; then
 
3177
      if test "$#" -gt 2; then
2199
3178
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2200
3179
      fi
2201
3180
      install_libdir="$2"
2204
3183
      if test -z "$rpath"; then
2205
3184
        if test "$build_libtool_libs" = yes; then
2206
3185
          # Building a libtool convenience library.
2207
 
          libext=al
 
3186
          # Some compilers have problems with a `.al' extension so
 
3187
          # convenience libraries should have the same extension an
 
3188
          # archive normally would.
2208
3189
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2209
3190
          build_libtool_libs=convenience
2210
3191
          build_old_libs=yes
2211
3192
        fi
2212
3193
 
2213
3194
        if test -n "$vinfo"; then
2214
 
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
3195
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2215
3196
        fi
2216
3197
 
2217
3198
        if test -n "$release"; then
2227
3208
        if test -n "$8"; then
2228
3209
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2229
3210
          $echo "$help" 1>&2
2230
 
          exit 1
 
3211
          exit $EXIT_FAILURE
2231
3212
        fi
2232
3213
 
2233
 
        current="$2"
2234
 
        revision="$3"
2235
 
        age="$4"
 
3214
        # convert absolute version numbers to libtool ages
 
3215
        # this retains compatibility with .la files and attempts
 
3216
        # to make the code below a bit more comprehensible
 
3217
 
 
3218
        case $vinfo_number in
 
3219
        yes)
 
3220
          number_major="$2"
 
3221
          number_minor="$3"
 
3222
          number_revision="$4"
 
3223
          #
 
3224
          # There are really only two kinds -- those that
 
3225
          # use the current revision as the major version
 
3226
          # and those that subtract age and use age as
 
3227
          # a minor version.  But, then there is irix
 
3228
          # which has an extra 1 added just for fun
 
3229
          #
 
3230
          case $version_type in
 
3231
          darwin|linux|osf|windows|none)
 
3232
            current=`expr $number_major + $number_minor`
 
3233
            age="$number_minor"
 
3234
            revision="$number_revision"
 
3235
            ;;
 
3236
          freebsd-aout|freebsd-elf|sunos)
 
3237
            current="$number_major"
 
3238
            revision="$number_minor"
 
3239
            age="0"
 
3240
            ;;
 
3241
          irix|nonstopux)
 
3242
            current=`expr $number_major + $number_minor`
 
3243
            age="$number_minor"
 
3244
            revision="$number_minor"
 
3245
            lt_irix_increment=no
 
3246
            ;;
 
3247
          esac
 
3248
          ;;
 
3249
        no)
 
3250
          current="$2"
 
3251
          revision="$3"
 
3252
          age="$4"
 
3253
          ;;
 
3254
        esac
2236
3255
 
2237
3256
        # Check that each of the things are valid numbers.
2238
3257
        case $current in
2239
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3258
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2240
3259
        *)
2241
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3260
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2242
3261
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2243
 
          exit 1
 
3262
          exit $EXIT_FAILURE
2244
3263
          ;;
2245
3264
        esac
2246
3265
 
2247
3266
        case $revision in
2248
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3267
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2249
3268
        *)
2250
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3269
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2251
3270
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2252
 
          exit 1
 
3271
          exit $EXIT_FAILURE
2253
3272
          ;;
2254
3273
        esac
2255
3274
 
2256
3275
        case $age in
2257
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3276
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2258
3277
        *)
2259
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3278
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2260
3279
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2261
 
          exit 1
 
3280
          exit $EXIT_FAILURE
2262
3281
          ;;
2263
3282
        esac
2264
3283
 
2265
 
        if test $age -gt $current; then
 
3284
        if test "$age" -gt "$current"; then
2266
3285
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2267
3286
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2268
 
          exit 1
 
3287
          exit $EXIT_FAILURE
2269
3288
        fi
2270
3289
 
2271
3290
        # Calculate the version variables.
2282
3301
          versuffix="$major.$age.$revision"
2283
3302
          # Darwin ld doesn't like 0 for these options...
2284
3303
          minor_current=`expr $current + 1`
 
3304
          xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2285
3305
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2286
3306
          ;;
2287
3307
 
2296
3316
          ;;
2297
3317
 
2298
3318
        irix | nonstopux)
2299
 
          major=`expr $current - $age + 1`
2300
 
 
 
3319
          if test "X$lt_irix_increment" = "Xno"; then
 
3320
            major=`expr $current - $age`
 
3321
          else
 
3322
            major=`expr $current - $age + 1`
 
3323
          fi
2301
3324
          case $version_type in
2302
3325
            nonstopux) verstring_prefix=nonstopux ;;
2303
3326
            *)         verstring_prefix=sgi ;;
2306
3329
 
2307
3330
          # Add in all the interfaces that we are compatible with.
2308
3331
          loop=$revision
2309
 
          while test $loop != 0; do
 
3332
          while test "$loop" -ne 0; do
2310
3333
            iface=`expr $revision - $loop`
2311
3334
            loop=`expr $loop - 1`
2312
3335
            verstring="$verstring_prefix$major.$iface:$verstring"
2329
3352
 
2330
3353
          # Add in all the interfaces that we are compatible with.
2331
3354
          loop=$age
2332
 
          while test $loop != 0; do
 
3355
          while test "$loop" -ne 0; do
2333
3356
            iface=`expr $current - $loop`
2334
3357
            loop=`expr $loop - 1`
2335
3358
            verstring="$verstring:${iface}.0"
2353
3376
 
2354
3377
        *)
2355
3378
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2356
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2357
 
          exit 1
 
3379
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3380
          exit $EXIT_FAILURE
2358
3381
          ;;
2359
3382
        esac
2360
3383
 
2361
3384
        # Clear the version info if we defaulted, and they specified a release.
2362
3385
        if test -z "$vinfo" && test -n "$release"; then
2363
3386
          major=
2364
 
          verstring="0.0"
2365
3387
          case $version_type in
2366
3388
          darwin)
2367
3389
            # we can't check for "0.0" in archive_cmds due to quoting
2368
3390
            # problems, so we reset it completely
2369
 
            verstring=""
 
3391
            verstring=
2370
3392
            ;;
2371
3393
          *)
2372
3394
            verstring="0.0"
2400
3422
      fi
2401
3423
 
2402
3424
      if test "$mode" != relink; then
2403
 
        # Remove our outputs.
2404
 
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2405
 
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
 
3425
        # Remove our outputs, but don't remove object files since they
 
3426
        # may have been created when compiling PIC objects.
 
3427
        removelist=
 
3428
        tempremovelist=`$echo "$output_objdir/*"`
 
3429
        for p in $tempremovelist; do
 
3430
          case $p in
 
3431
            *.$objext)
 
3432
               ;;
 
3433
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3434
               if test "X$precious_files_regex" != "X"; then
 
3435
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3436
                 then
 
3437
                   continue
 
3438
                 fi
 
3439
               fi
 
3440
               removelist="$removelist $p"
 
3441
               ;;
 
3442
            *) ;;
 
3443
          esac
 
3444
        done
 
3445
        if test -n "$removelist"; then
 
3446
          $show "${rm}r $removelist"
 
3447
          $run ${rm}r $removelist
 
3448
        fi
2406
3449
      fi
2407
3450
 
2408
3451
      # Now set the variables for building old libraries.
2414
3457
      fi
2415
3458
 
2416
3459
      # Eliminate all temporary directories.
2417
 
      for path in $notinst_path; do
2418
 
        lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2419
 
        deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2420
 
        dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2421
 
      done
 
3460
      #for path in $notinst_path; do
 
3461
      # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3462
      # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3463
      # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
 
3464
      #done
2422
3465
 
2423
3466
      if test -n "$xrpath"; then
2424
3467
        # If the user specified any rpath flags, then add them.
2430
3473
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2431
3474
          esac
2432
3475
        done
2433
 
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
3476
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2434
3477
          dependency_libs="$temp_xrpath $dependency_libs"
2435
3478
        fi
2436
3479
      fi
2468
3511
          *-*-netbsd*)
2469
3512
            # Don't link with libc until the a.out ld.so is fixed.
2470
3513
            ;;
2471
 
          *-*-openbsd* | *-*-freebsd*)
 
3514
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
2472
3515
            # Do not include libc due to us having libc/libc_r.
2473
3516
            ;;
2474
 
          *)
 
3517
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3518
            # Causes problems with __ctype
 
3519
            ;;
 
3520
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3521
            # Compiler inserts libc in the correct place for threads to work
 
3522
            ;;
 
3523
          *)
2475
3524
            # Add libc to deplibs on all other systems if necessary.
2476
 
            if test $build_libtool_need_lc = "yes"; then
 
3525
            if test "$build_libtool_need_lc" = "yes"; then
2477
3526
              deplibs="$deplibs -lc"
2478
3527
            fi
2479
3528
            ;;
2500
3549
          # This might be a little naive.  We might want to check
2501
3550
          # whether the library exists or not.  But this is on
2502
3551
          # osf3 & osf4 and I'm not really sure... Just
2503
 
          # implementing what was already the behaviour.
 
3552
          # implementing what was already the behavior.
2504
3553
          newdeplibs=$deplibs
2505
3554
          ;;
2506
3555
        test_compile)
2513
3562
          int main() { return 0; }
2514
3563
EOF
2515
3564
          $rm conftest
2516
 
          $CC -o conftest conftest.c $deplibs
2517
 
          if test $? -eq 0 ; then
 
3565
          if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
2518
3566
            ldd_output=`ldd conftest`
2519
3567
            for i in $deplibs; do
2520
 
              name="`expr $i : '-l\(.*\)'`"
 
3568
              name=`expr $i : '-l\(.*\)'`
2521
3569
              # If $name is empty we are operating on a -L argument.
2522
 
              if test -n "$name" && test "$name" != "0"; then
2523
 
                libname=`eval \\$echo \"$libname_spec\"`
2524
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2525
 
                set dummy $deplib_matches
2526
 
                deplib_match=$2
2527
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2528
 
                  newdeplibs="$newdeplibs $i"
2529
 
                else
2530
 
                  droppeddeps=yes
2531
 
                  echo
2532
 
                  echo "*** Warning: dynamic linker does not accept needed library $i."
2533
 
                  echo "*** I have the capability to make that library automatically link in when"
2534
 
                  echo "*** you link to this library.  But I can only do this if you have a"
2535
 
                  echo "*** shared version of the library, which I believe you do not have"
2536
 
                  echo "*** because a test_compile did reveal that the linker did not use it for"
2537
 
                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
2538
 
                fi
2539
 
              else
2540
 
                newdeplibs="$newdeplibs $i"
2541
 
              fi
2542
 
            done
2543
 
          else
2544
 
            # Error occured in the first compile.  Let's try to salvage
2545
 
            # the situation: Compile a separate program for each library.
2546
 
            for i in $deplibs; do
2547
 
              name="`expr $i : '-l\(.*\)'`"
2548
 
             # If $name is empty we are operating on a -L argument.
2549
 
              if test -n "$name" && test "$name" != "0"; then
2550
 
                $rm conftest
2551
 
                $CC -o conftest conftest.c $i
2552
 
                # Did it work?
2553
 
                if test $? -eq 0 ; then
2554
 
                  ldd_output=`ldd conftest`
 
3570
              if test "$name" != "" && test "$name" != "0"; then
 
3571
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3572
                  case " $predeps $postdeps " in
 
3573
                  *" $i "*)
 
3574
                    newdeplibs="$newdeplibs $i"
 
3575
                    i=""
 
3576
                    ;;
 
3577
                  esac
 
3578
                fi
 
3579
                if test -n "$i" ; then
2555
3580
                  libname=`eval \\$echo \"$libname_spec\"`
2556
3581
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2557
3582
                  set dummy $deplib_matches
2560
3585
                    newdeplibs="$newdeplibs $i"
2561
3586
                  else
2562
3587
                    droppeddeps=yes
2563
 
                    echo
2564
 
                    echo "*** Warning: dynamic linker does not accept needed library $i."
2565
 
                    echo "*** I have the capability to make that library automatically link in when"
2566
 
                    echo "*** you link to this library.  But I can only do this if you have a"
2567
 
                    echo "*** shared version of the library, which you do not appear to have"
2568
 
                    echo "*** because a test_compile did reveal that the linker did not use this one"
2569
 
                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3588
                    $echo
 
3589
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3590
                    $echo "*** I have the capability to make that library automatically link in when"
 
3591
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3592
                    $echo "*** shared version of the library, which I believe you do not have"
 
3593
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3594
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3595
                  fi
 
3596
                fi
 
3597
              else
 
3598
                newdeplibs="$newdeplibs $i"
 
3599
              fi
 
3600
            done
 
3601
          else
 
3602
            # Error occurred in the first compile.  Let's try to salvage
 
3603
            # the situation: Compile a separate program for each library.
 
3604
            for i in $deplibs; do
 
3605
              name=`expr $i : '-l\(.*\)'`
 
3606
              # If $name is empty we are operating on a -L argument.
 
3607
              if test "$name" != "" && test "$name" != "0"; then
 
3608
                $rm conftest
 
3609
                if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
 
3610
                  ldd_output=`ldd conftest`
 
3611
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3612
                    case " $predeps $postdeps " in
 
3613
                    *" $i "*)
 
3614
                      newdeplibs="$newdeplibs $i"
 
3615
                      i=""
 
3616
                      ;;
 
3617
                    esac
 
3618
                  fi
 
3619
                  if test -n "$i" ; then
 
3620
                    libname=`eval \\$echo \"$libname_spec\"`
 
3621
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3622
                    set dummy $deplib_matches
 
3623
                    deplib_match=$2
 
3624
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3625
                      newdeplibs="$newdeplibs $i"
 
3626
                    else
 
3627
                      droppeddeps=yes
 
3628
                      $echo
 
3629
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3630
                      $echo "*** I have the capability to make that library automatically link in when"
 
3631
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3632
                      $echo "*** shared version of the library, which you do not appear to have"
 
3633
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3634
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3635
                    fi
2570
3636
                  fi
2571
3637
                else
2572
3638
                  droppeddeps=yes
2573
 
                  echo
2574
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2575
 
                  echo "***  make it link in!  You will probably need to install it or some"
2576
 
                  echo "*** library that it depends on before this library will be fully"
2577
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3639
                  $echo
 
3640
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3641
                  $echo "*** make it link in!  You will probably need to install it or some"
 
3642
                  $echo "*** library that it depends on before this library will be fully"
 
3643
                  $echo "*** functional.  Installing it before continuing would be even better."
2578
3644
                fi
2579
3645
              else
2580
3646
                newdeplibs="$newdeplibs $i"
2586
3652
          set dummy $deplibs_check_method
2587
3653
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2588
3654
          for a_deplib in $deplibs; do
2589
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3655
            name=`expr $a_deplib : '-l\(.*\)'`
2590
3656
            # If $name is empty we are operating on a -L argument.
2591
 
            if test -n "$name" && test "$name" != "0"; then
2592
 
              libname=`eval \\$echo \"$libname_spec\"`
2593
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2594
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2595
 
                    for potent_lib in $potential_libs; do
 
3657
            if test "$name" != "" && test  "$name" != "0"; then
 
3658
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3659
                case " $predeps $postdeps " in
 
3660
                *" $a_deplib "*)
 
3661
                  newdeplibs="$newdeplibs $a_deplib"
 
3662
                  a_deplib=""
 
3663
                  ;;
 
3664
                esac
 
3665
              fi
 
3666
              if test -n "$a_deplib" ; then
 
3667
                libname=`eval \\$echo \"$libname_spec\"`
 
3668
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3669
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3670
                  for potent_lib in $potential_libs; do
2596
3671
                      # Follow soft links.
2597
3672
                      if ls -lLd "$potent_lib" 2>/dev/null \
2598
3673
                         | grep " -> " >/dev/null; then
2613
3688
                      done
2614
3689
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2615
3690
                         | ${SED} 10q \
2616
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3691
                         | $EGREP "$file_magic_regex" > /dev/null; then
2617
3692
                        newdeplibs="$newdeplibs $a_deplib"
2618
3693
                        a_deplib=""
2619
3694
                        break 2
2620
3695
                      fi
2621
 
                    done
2622
 
              done
 
3696
                  done
 
3697
                done
 
3698
              fi
2623
3699
              if test -n "$a_deplib" ; then
2624
3700
                droppeddeps=yes
2625
 
                echo
2626
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2627
 
                echo "*** I have the capability to make that library automatically link in when"
2628
 
                echo "*** you link to this library.  But I can only do this if you have a"
2629
 
                echo "*** shared version of the library, which you do not appear to have"
2630
 
                echo "*** because I did check the linker path looking for a file starting"
 
3701
                $echo
 
3702
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3703
                $echo "*** I have the capability to make that library automatically link in when"
 
3704
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3705
                $echo "*** shared version of the library, which you do not appear to have"
 
3706
                $echo "*** because I did check the linker path looking for a file starting"
2631
3707
                if test -z "$potlib" ; then
2632
 
                  echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3708
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
2633
3709
                else
2634
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2635
 
                  echo "*** using a file magic. Last file checked: $potlib"
 
3710
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3711
                  $echo "*** using a file magic. Last file checked: $potlib"
2636
3712
                fi
2637
3713
              fi
2638
3714
            else
2645
3721
          set dummy $deplibs_check_method
2646
3722
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2647
3723
          for a_deplib in $deplibs; do
2648
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3724
            name=`expr $a_deplib : '-l\(.*\)'`
2649
3725
            # If $name is empty we are operating on a -L argument.
2650
3726
            if test -n "$name" && test "$name" != "0"; then
2651
 
              libname=`eval \\$echo \"$libname_spec\"`
2652
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2653
 
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2654
 
                for potent_lib in $potential_libs; do
2655
 
                  potlib="$potent_lib" # see symlink-check below in file_magic test
2656
 
                  if eval echo \"$potent_lib\" 2>/dev/null \
2657
 
                      | ${SED} 10q \
2658
 
                      | egrep "$match_pattern_regex" > /dev/null; then
2659
 
                    newdeplibs="$newdeplibs $a_deplib"
2660
 
                    a_deplib=""
2661
 
                    break 2
2662
 
                  fi
 
3727
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3728
                case " $predeps $postdeps " in
 
3729
                *" $a_deplib "*)
 
3730
                  newdeplibs="$newdeplibs $a_deplib"
 
3731
                  a_deplib=""
 
3732
                  ;;
 
3733
                esac
 
3734
              fi
 
3735
              if test -n "$a_deplib" ; then
 
3736
                libname=`eval \\$echo \"$libname_spec\"`
 
3737
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3738
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3739
                  for potent_lib in $potential_libs; do
 
3740
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3741
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3742
                        | ${SED} 10q \
 
3743
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3744
                      newdeplibs="$newdeplibs $a_deplib"
 
3745
                      a_deplib=""
 
3746
                      break 2
 
3747
                    fi
 
3748
                  done
2663
3749
                done
2664
 
              done
 
3750
              fi
2665
3751
              if test -n "$a_deplib" ; then
2666
3752
                droppeddeps=yes
2667
 
                echo
2668
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2669
 
                echo "*** I have the capability to make that library automatically link in when"
2670
 
                echo "*** you link to this library.  But I can only do this if you have a"
2671
 
                echo "*** shared version of the library, which you do not appear to have"
2672
 
                echo "*** because I did check the linker path looking for a file starting"
 
3753
                $echo
 
3754
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3755
                $echo "*** I have the capability to make that library automatically link in when"
 
3756
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3757
                $echo "*** shared version of the library, which you do not appear to have"
 
3758
                $echo "*** because I did check the linker path looking for a file starting"
2673
3759
                if test -z "$potlib" ; then
2674
 
                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3760
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2675
3761
                else
2676
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2677
 
                  echo "*** using a regex pattern. Last file checked: $potlib"
 
3762
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3763
                  $echo "*** using a regex pattern. Last file checked: $potlib"
2678
3764
                fi
2679
3765
              fi
2680
3766
            else
2685
3771
          ;;
2686
3772
        none | unknown | *)
2687
3773
          newdeplibs=""
2688
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2689
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2690
 
             grep . >/dev/null; then
2691
 
            echo
 
3774
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3775
            -e 's/ -[LR][^ ]*//g'`
 
3776
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3777
            for i in $predeps $postdeps ; do
 
3778
              # can't use Xsed below, because $i might contain '/'
 
3779
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3780
            done
 
3781
          fi
 
3782
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3783
            | grep . >/dev/null; then
 
3784
            $echo
2692
3785
            if test "X$deplibs_check_method" = "Xnone"; then
2693
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3786
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2694
3787
            else
2695
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3788
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2696
3789
            fi
2697
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3790
            $echo "*** All declared inter-library dependencies are being dropped."
2698
3791
            droppeddeps=yes
2699
3792
          fi
2700
3793
          ;;
2714
3807
 
2715
3808
        if test "$droppeddeps" = yes; then
2716
3809
          if test "$module" = yes; then
2717
 
            echo
2718
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2719
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2720
 
            echo "*** a static module, that should work as long as the dlopening"
2721
 
            echo "*** application is linked with the -dlopen flag."
 
3810
            $echo
 
3811
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3812
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3813
            $echo "*** a static module, that should work as long as the dlopening"
 
3814
            $echo "*** application is linked with the -dlopen flag."
2722
3815
            if test -z "$global_symbol_pipe"; then
2723
 
              echo
2724
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2725
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2726
 
              echo "*** not find such a program.  So, this module is probably useless."
2727
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3816
              $echo
 
3817
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3818
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3819
              $echo "*** not find such a program.  So, this module is probably useless."
 
3820
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2728
3821
            fi
2729
3822
            if test "$build_old_libs" = no; then
2730
3823
              oldlibs="$output_objdir/$libname.$libext"
2734
3827
              build_libtool_libs=no
2735
3828
            fi
2736
3829
          else
2737
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2738
 
            echo "*** automatically added whenever a program is linked with this library"
2739
 
            echo "*** or is declared to -dlopen it."
 
3830
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3831
            $echo "*** automatically added whenever a program is linked with this library"
 
3832
            $echo "*** or is declared to -dlopen it."
2740
3833
 
2741
 
            if test $allow_undefined = no; then
2742
 
              echo
2743
 
              echo "*** Since this library must not contain undefined symbols,"
2744
 
              echo "*** because either the platform does not support them or"
2745
 
              echo "*** it was explicitly requested with -no-undefined,"
2746
 
              echo "*** libtool will only create a static version of it."
 
3834
            if test "$allow_undefined" = no; then
 
3835
              $echo
 
3836
              $echo "*** Since this library must not contain undefined symbols,"
 
3837
              $echo "*** because either the platform does not support them or"
 
3838
              $echo "*** it was explicitly requested with -no-undefined,"
 
3839
              $echo "*** libtool will only create a static version of it."
2747
3840
              if test "$build_old_libs" = no; then
2748
3841
                oldlibs="$output_objdir/$libname.$libext"
2749
3842
                build_libtool_libs=module
2758
3851
        deplibs=$newdeplibs
2759
3852
      fi
2760
3853
 
 
3854
 
 
3855
      # move library search paths that coincide with paths to not yet
 
3856
      # installed libraries to the beginning of the library search list
 
3857
      new_libs=
 
3858
      for path in $notinst_path; do
 
3859
        case " $new_libs " in
 
3860
        *" -L$path/$objdir "*) ;;
 
3861
        *)
 
3862
          case " $deplibs " in
 
3863
          *" -L$path/$objdir "*)
 
3864
            new_libs="$new_libs -L$path/$objdir" ;;
 
3865
          esac
 
3866
          ;;
 
3867
        esac
 
3868
      done
 
3869
      for deplib in $deplibs; do
 
3870
        case $deplib in
 
3871
        -L*)
 
3872
          case " $new_libs " in
 
3873
          *" $deplib "*) ;;
 
3874
          *) new_libs="$new_libs $deplib" ;;
 
3875
          esac
 
3876
          ;;
 
3877
        *) new_libs="$new_libs $deplib" ;;
 
3878
        esac
 
3879
      done
 
3880
      deplibs="$new_libs"
 
3881
 
 
3882
 
2761
3883
      # All the library-specific variables (install_libdir is set above).
2762
3884
      library_names=
2763
3885
      old_library=
2765
3887
 
2766
3888
      # Test again, we may have decided not to build it any more
2767
3889
      if test "$build_libtool_libs" = yes; then
2768
 
        if test $hardcode_into_libs = yes; then
 
3890
        if test "$hardcode_into_libs" = yes; then
2769
3891
          # Hardcode the library paths
2770
3892
          hardcode_libdirs=
2771
3893
          dep_rpath=
2801
3923
          if test -n "$hardcode_libdir_separator" &&
2802
3924
             test -n "$hardcode_libdirs"; then
2803
3925
            libdir="$hardcode_libdirs"
2804
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3926
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3927
              case $archive_cmds in
 
3928
              *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
 
3929
              *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
 
3930
              esac
 
3931
            else
 
3932
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3933
            fi
2805
3934
          fi
2806
3935
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2807
3936
            # We should set the runpath_var.
2821
3950
        fi
2822
3951
 
2823
3952
        # Get the real and link names of the library.
 
3953
        eval shared_ext=\"$shrext_cmds\"
2824
3954
        eval library_names=\"$library_names_spec\"
2825
3955
        set dummy $library_names
2826
3956
        realname="$2"
2831
3961
        else
2832
3962
          soname="$realname"
2833
3963
        fi
2834
 
        test -z "$dlname" && dlname=$soname
 
3964
        if test -z "$dlname"; then
 
3965
          dlname=$soname
 
3966
        fi
2835
3967
 
2836
3968
        lib="$output_objdir/$realname"
 
3969
        linknames=
2837
3970
        for link
2838
3971
        do
2839
3972
          linknames="$linknames $link"
2840
3973
        done
2841
3974
 
2842
 
        # Ensure that we have .o objects for linkers which dislike .lo
2843
 
        # (e.g. aix) in case we are running --disable-static
2844
 
        for obj in $libobjs; do
2845
 
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2846
 
          if test "X$xdir" = "X$obj"; then
2847
 
            xdir="."
2848
 
          else
2849
 
            xdir="$xdir"
2850
 
          fi
2851
 
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2852
 
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2853
 
          if test ! -f $xdir/$oldobj; then
2854
 
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2855
 
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2856
 
          fi
2857
 
        done
2858
 
 
2859
3975
        # Use standard objects if they are pic
2860
3976
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2861
3977
 
2865
3981
            $show "generating symbol list for \`$libname.la'"
2866
3982
            export_symbols="$output_objdir/$libname.exp"
2867
3983
            $run $rm $export_symbols
2868
 
            eval cmds=\"$export_symbols_cmds\"
 
3984
            cmds=$export_symbols_cmds
2869
3985
            save_ifs="$IFS"; IFS='~'
2870
3986
            for cmd in $cmds; do
2871
3987
              IFS="$save_ifs"
2872
 
              $show "$cmd"
2873
 
              $run eval "$cmd" || exit $?
 
3988
              eval cmd=\"$cmd\"
 
3989
              if len=`expr "X$cmd" : ".*"` &&
 
3990
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3991
                $show "$cmd"
 
3992
                $run eval "$cmd" || exit $?
 
3993
                skipped_export=false
 
3994
              else
 
3995
                # The command line is too long to execute in one step.
 
3996
                $show "using reloadable object file for export list..."
 
3997
                skipped_export=:
 
3998
                # Break out early, otherwise skipped_export may be
 
3999
                # set to false by a later but shorter cmd.
 
4000
                break
 
4001
              fi
2874
4002
            done
2875
4003
            IFS="$save_ifs"
2876
4004
            if test -n "$export_symbols_regex"; then
2877
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2878
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
4005
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
4006
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2879
4007
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2880
4008
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2881
4009
            fi
2886
4014
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2887
4015
        fi
2888
4016
 
 
4017
        tmp_deplibs=
 
4018
        for test_deplib in $deplibs; do
 
4019
                case " $convenience " in
 
4020
                *" $test_deplib "*) ;;
 
4021
                *)
 
4022
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
4023
                        ;;
 
4024
                esac
 
4025
        done
 
4026
        deplibs="$tmp_deplibs"
 
4027
 
2889
4028
        if test -n "$convenience"; then
2890
4029
          if test -n "$whole_archive_flag_spec"; then
 
4030
            save_libobjs=$libobjs
2891
4031
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2892
4032
          else
2893
4033
            gentop="$output_objdir/${outputname}x"
2894
 
            $show "${rm}r $gentop"
2895
 
            $run ${rm}r "$gentop"
2896
 
            $show "mkdir $gentop"
2897
 
            $run mkdir "$gentop"
2898
 
            status=$?
2899
 
            if test $status -ne 0 && test ! -d "$gentop"; then
2900
 
              exit $status
2901
 
            fi
2902
4034
            generated="$generated $gentop"
2903
4035
 
2904
 
            for xlib in $convenience; do
2905
 
              # Extract the objects.
2906
 
              case $xlib in
2907
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2908
 
              *) xabs=`pwd`"/$xlib" ;;
2909
 
              esac
2910
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2911
 
              xdir="$gentop/$xlib"
2912
 
 
2913
 
              $show "${rm}r $xdir"
2914
 
              $run ${rm}r "$xdir"
2915
 
              $show "mkdir $xdir"
2916
 
              $run mkdir "$xdir"
2917
 
              status=$?
2918
 
              if test $status -ne 0 && test ! -d "$xdir"; then
2919
 
                exit $status
2920
 
              fi
2921
 
              $show "(cd $xdir && $AR x $xabs)"
2922
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2923
 
 
2924
 
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2925
 
            done
 
4036
            func_extract_archives $gentop $convenience
 
4037
            libobjs="$libobjs $func_extract_archives_result"
2926
4038
          fi
2927
4039
        fi
2928
 
 
 
4040
        
2929
4041
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2930
4042
          eval flag=\"$thread_safe_flag_spec\"
2931
4043
          linker_flags="$linker_flags $flag"
2937
4049
        fi
2938
4050
 
2939
4051
        # Do each of the archive commands.
 
4052
        if test "$module" = yes && test -n "$module_cmds" ; then
 
4053
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
4054
            eval test_cmds=\"$module_expsym_cmds\"
 
4055
            cmds=$module_expsym_cmds
 
4056
          else
 
4057
            eval test_cmds=\"$module_cmds\"
 
4058
            cmds=$module_cmds
 
4059
          fi
 
4060
        else
2940
4061
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2941
 
          eval cmds=\"$archive_expsym_cmds\"
2942
 
        else
2943
 
          save_deplibs="$deplibs"
2944
 
          for conv in $convenience; do
2945
 
            tmp_deplibs=
2946
 
            for test_deplib in $deplibs; do
2947
 
              if test "$test_deplib" != "$conv"; then
2948
 
                tmp_deplibs="$tmp_deplibs $test_deplib"
 
4062
          eval test_cmds=\"$archive_expsym_cmds\"
 
4063
          cmds=$archive_expsym_cmds
 
4064
        else
 
4065
          eval test_cmds=\"$archive_cmds\"
 
4066
          cmds=$archive_cmds
 
4067
          fi
 
4068
        fi
 
4069
 
 
4070
        if test "X$skipped_export" != "X:" &&
 
4071
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
4072
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
4073
          :
 
4074
        else
 
4075
          # The command line is too long to link in one step, link piecewise.
 
4076
          $echo "creating reloadable object files..."
 
4077
 
 
4078
          # Save the value of $output and $libobjs because we want to
 
4079
          # use them later.  If we have whole_archive_flag_spec, we
 
4080
          # want to use save_libobjs as it was before
 
4081
          # whole_archive_flag_spec was expanded, because we can't
 
4082
          # assume the linker understands whole_archive_flag_spec.
 
4083
          # This may have to be revisited, in case too many
 
4084
          # convenience libraries get linked in and end up exceeding
 
4085
          # the spec.
 
4086
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
4087
            save_libobjs=$libobjs
 
4088
          fi
 
4089
          save_output=$output
 
4090
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
 
4091
 
 
4092
          # Clear the reloadable object creation command queue and
 
4093
          # initialize k to one.
 
4094
          test_cmds=
 
4095
          concat_cmds=
 
4096
          objlist=
 
4097
          delfiles=
 
4098
          last_robj=
 
4099
          k=1
 
4100
          output=$output_objdir/$output_la-${k}.$objext
 
4101
          # Loop over the list of objects to be linked.
 
4102
          for obj in $save_libobjs
 
4103
          do
 
4104
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
4105
            if test "X$objlist" = X ||
 
4106
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
4107
                 test "$len" -le "$max_cmd_len"; }; then
 
4108
              objlist="$objlist $obj"
 
4109
            else
 
4110
              # The command $test_cmds is almost too long, add a
 
4111
              # command to the queue.
 
4112
              if test "$k" -eq 1 ; then
 
4113
                # The first file doesn't have a previous command to add.
 
4114
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
4115
              else
 
4116
                # All subsequent reloadable object files will link in
 
4117
                # the last one created.
 
4118
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
2949
4119
              fi
2950
 
            done
2951
 
            deplibs="$tmp_deplibs"
2952
 
          done
2953
 
          eval cmds=\"$archive_cmds\"
2954
 
          deplibs="$save_deplibs"
 
4120
              last_robj=$output_objdir/$output_la-${k}.$objext
 
4121
              k=`expr $k + 1`
 
4122
              output=$output_objdir/$output_la-${k}.$objext
 
4123
              objlist=$obj
 
4124
              len=1
 
4125
            fi
 
4126
          done
 
4127
          # Handle the remaining objects by creating one last
 
4128
          # reloadable object file.  All subsequent reloadable object
 
4129
          # files will link in the last one created.
 
4130
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
4131
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
4132
 
 
4133
          if ${skipped_export-false}; then
 
4134
            $show "generating symbol list for \`$libname.la'"
 
4135
            export_symbols="$output_objdir/$libname.exp"
 
4136
            $run $rm $export_symbols
 
4137
            libobjs=$output
 
4138
            # Append the command to create the export file.
 
4139
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
4140
          fi
 
4141
 
 
4142
          # Set up a command to remove the reloadable object files
 
4143
          # after they are used.
 
4144
          i=0
 
4145
          while test "$i" -lt "$k"
 
4146
          do
 
4147
            i=`expr $i + 1`
 
4148
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
 
4149
          done
 
4150
 
 
4151
          $echo "creating a temporary reloadable object file: $output"
 
4152
 
 
4153
          # Loop through the commands generated above and execute them.
 
4154
          save_ifs="$IFS"; IFS='~'
 
4155
          for cmd in $concat_cmds; do
 
4156
            IFS="$save_ifs"
 
4157
            $show "$cmd"
 
4158
            $run eval "$cmd" || exit $?
 
4159
          done
 
4160
          IFS="$save_ifs"
 
4161
 
 
4162
          libobjs=$output
 
4163
          # Restore the value of output.
 
4164
          output=$save_output
 
4165
 
 
4166
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
4167
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
4168
          fi
 
4169
          # Expand the library linking commands again to reset the
 
4170
          # value of $libobjs for piecewise linking.
 
4171
 
 
4172
          # Do each of the archive commands.
 
4173
          if test "$module" = yes && test -n "$module_cmds" ; then
 
4174
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
4175
              cmds=$module_expsym_cmds
 
4176
            else
 
4177
              cmds=$module_cmds
 
4178
            fi
 
4179
          else
 
4180
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
4181
            cmds=$archive_expsym_cmds
 
4182
          else
 
4183
            cmds=$archive_cmds
 
4184
            fi
 
4185
          fi
 
4186
 
 
4187
          # Append the command to remove the reloadable object files
 
4188
          # to the just-reset $cmds.
 
4189
          eval cmds=\"\$cmds~\$rm $delfiles\"
2955
4190
        fi
2956
4191
        save_ifs="$IFS"; IFS='~'
2957
4192
        for cmd in $cmds; do
2958
4193
          IFS="$save_ifs"
 
4194
          eval cmd=\"$cmd\"
2959
4195
          $show "$cmd"
2960
 
          $run eval "$cmd" || exit $?
 
4196
          $run eval "$cmd" || {
 
4197
            lt_exit=$?
 
4198
 
 
4199
            # Restore the uninstalled library and exit
 
4200
            if test "$mode" = relink; then
 
4201
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4202
            fi
 
4203
 
 
4204
            exit $lt_exit
 
4205
          }
2961
4206
        done
2962
4207
        IFS="$save_ifs"
2963
4208
 
2964
4209
        # Restore the uninstalled library and exit
2965
4210
        if test "$mode" = relink; then
2966
4211
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2967
 
          exit 0
 
4212
 
 
4213
          if test -n "$convenience"; then
 
4214
            if test -z "$whole_archive_flag_spec"; then
 
4215
              $show "${rm}r $gentop"
 
4216
              $run ${rm}r "$gentop"
 
4217
            fi
 
4218
          fi
 
4219
 
 
4220
          exit $EXIT_SUCCESS
2968
4221
        fi
2969
4222
 
2970
4223
        # Create links to the real library.
3012
4265
      *.lo)
3013
4266
        if test -n "$objs$old_deplibs"; then
3014
4267
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3015
 
          exit 1
 
4268
          exit $EXIT_FAILURE
3016
4269
        fi
3017
4270
        libobj="$output"
3018
4271
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3033
4286
      reload_conv_objs=
3034
4287
      gentop=
3035
4288
      # reload_cmds runs $LD directly, so let us get rid of
3036
 
      # -Wl from whole_archive_flag_spec
 
4289
      # -Wl from whole_archive_flag_spec and hope we can get by with
 
4290
      # turning comma into space..
3037
4291
      wl=
3038
4292
 
3039
4293
      if test -n "$convenience"; then
3040
4294
        if test -n "$whole_archive_flag_spec"; then
3041
 
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
 
4295
          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
 
4296
          reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
3042
4297
        else
3043
4298
          gentop="$output_objdir/${obj}x"
3044
 
          $show "${rm}r $gentop"
3045
 
          $run ${rm}r "$gentop"
3046
 
          $show "mkdir $gentop"
3047
 
          $run mkdir "$gentop"
3048
 
          status=$?
3049
 
          if test $status -ne 0 && test ! -d "$gentop"; then
3050
 
            exit $status
3051
 
          fi
3052
4299
          generated="$generated $gentop"
3053
4300
 
3054
 
          for xlib in $convenience; do
3055
 
            # Extract the objects.
3056
 
            case $xlib in
3057
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3058
 
            *) xabs=`pwd`"/$xlib" ;;
3059
 
            esac
3060
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3061
 
            xdir="$gentop/$xlib"
3062
 
 
3063
 
            $show "${rm}r $xdir"
3064
 
            $run ${rm}r "$xdir"
3065
 
            $show "mkdir $xdir"
3066
 
            $run mkdir "$xdir"
3067
 
            status=$?
3068
 
            if test $status -ne 0 && test ! -d "$xdir"; then
3069
 
              exit $status
3070
 
            fi
3071
 
            $show "(cd $xdir && $AR x $xabs)"
3072
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3073
 
 
3074
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3075
 
          done
 
4301
          func_extract_archives $gentop $convenience
 
4302
          reload_conv_objs="$reload_objs $func_extract_archives_result"
3076
4303
        fi
3077
4304
      fi
3078
4305
 
3080
4307
      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
3081
4308
 
3082
4309
      output="$obj"
3083
 
      eval cmds=\"$reload_cmds\"
 
4310
      cmds=$reload_cmds
3084
4311
      save_ifs="$IFS"; IFS='~'
3085
4312
      for cmd in $cmds; do
3086
4313
        IFS="$save_ifs"
 
4314
        eval cmd=\"$cmd\"
3087
4315
        $show "$cmd"
3088
4316
        $run eval "$cmd" || exit $?
3089
4317
      done
3096
4324
          $run ${rm}r $gentop
3097
4325
        fi
3098
4326
 
3099
 
        exit 0
 
4327
        exit $EXIT_SUCCESS
3100
4328
      fi
3101
4329
 
3102
4330
      if test "$build_libtool_libs" != yes; then
3107
4335
 
3108
4336
        # Create an invalid libtool object if no PIC, so that we don't
3109
4337
        # accidentally link it into a program.
3110
 
        $show "echo timestamp > $libobj"
3111
 
        $run eval "echo timestamp > $libobj" || exit $?
3112
 
        exit 0
 
4338
        # $show "echo timestamp > $libobj"
 
4339
        # $run eval "echo timestamp > $libobj" || exit $?
 
4340
        exit $EXIT_SUCCESS
3113
4341
      fi
3114
4342
 
3115
4343
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3116
4344
        # Only do commands if we really have different PIC objects.
3117
4345
        reload_objs="$libobjs $reload_conv_objs"
3118
4346
        output="$libobj"
3119
 
        eval cmds=\"$reload_cmds\"
 
4347
        cmds=$reload_cmds
3120
4348
        save_ifs="$IFS"; IFS='~'
3121
4349
        for cmd in $cmds; do
3122
4350
          IFS="$save_ifs"
 
4351
          eval cmd=\"$cmd\"
3123
4352
          $show "$cmd"
3124
4353
          $run eval "$cmd" || exit $?
3125
4354
        done
3126
4355
        IFS="$save_ifs"
3127
 
      else
3128
 
        # Just create a symlink.
3129
 
        $show $rm $libobj
3130
 
        $run $rm $libobj
3131
 
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3132
 
        if test "X$xdir" = "X$libobj"; then
3133
 
          xdir="."
3134
 
        else
3135
 
          xdir="$xdir"
3136
 
        fi
3137
 
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3138
 
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3139
 
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3140
 
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3141
4356
      fi
3142
4357
 
3143
4358
      if test -n "$gentop"; then
3145
4360
        $run ${rm}r $gentop
3146
4361
      fi
3147
4362
 
3148
 
      exit 0
 
4363
      exit $EXIT_SUCCESS
3149
4364
      ;;
3150
4365
 
3151
4366
    prog)
3152
4367
      case $host in
3153
 
        *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
 
4368
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3154
4369
      esac
3155
4370
      if test -n "$vinfo"; then
3156
4371
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3172
4387
        # On Rhapsody replace the C library is the System framework
3173
4388
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3174
4389
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3175
 
        case $host in
3176
 
        *darwin*)
3177
 
          # Don't allow lazy linking, it breaks C++ global constructors
3178
 
          compile_command="$compile_command ${wl}-bind_at_load"
3179
 
          finalize_command="$finalize_command ${wl}-bind_at_load"
3180
 
          ;;
3181
 
        esac
3182
4390
        ;;
3183
4391
      esac
3184
4392
 
 
4393
      case $host in
 
4394
      *darwin*)
 
4395
        # Don't allow lazy linking, it breaks C++ global constructors
 
4396
        if test "$tagname" = CXX ; then
 
4397
        compile_command="$compile_command ${wl}-bind_at_load"
 
4398
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4399
        fi
 
4400
        ;;
 
4401
      esac
 
4402
 
 
4403
 
 
4404
      # move library search paths that coincide with paths to not yet
 
4405
      # installed libraries to the beginning of the library search list
 
4406
      new_libs=
 
4407
      for path in $notinst_path; do
 
4408
        case " $new_libs " in
 
4409
        *" -L$path/$objdir "*) ;;
 
4410
        *)
 
4411
          case " $compile_deplibs " in
 
4412
          *" -L$path/$objdir "*)
 
4413
            new_libs="$new_libs -L$path/$objdir" ;;
 
4414
          esac
 
4415
          ;;
 
4416
        esac
 
4417
      done
 
4418
      for deplib in $compile_deplibs; do
 
4419
        case $deplib in
 
4420
        -L*)
 
4421
          case " $new_libs " in
 
4422
          *" $deplib "*) ;;
 
4423
          *) new_libs="$new_libs $deplib" ;;
 
4424
          esac
 
4425
          ;;
 
4426
        *) new_libs="$new_libs $deplib" ;;
 
4427
        esac
 
4428
      done
 
4429
      compile_deplibs="$new_libs"
 
4430
 
 
4431
 
3185
4432
      compile_command="$compile_command $compile_deplibs"
3186
4433
      finalize_command="$finalize_command $finalize_deplibs"
3187
4434
 
3226
4473
        fi
3227
4474
        case $host in
3228
4475
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4476
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
3229
4477
          case :$dllsearchpath: in
3230
4478
          *":$libdir:"*) ;;
3231
4479
          *) dllsearchpath="$dllsearchpath:$libdir";;
3232
4480
          esac
 
4481
          case :$dllsearchpath: in
 
4482
          *":$testbindir:"*) ;;
 
4483
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4484
          esac
3233
4485
          ;;
3234
4486
        esac
3235
4487
      done
3332
4584
            done
3333
4585
 
3334
4586
            if test -n "$exclude_expsyms"; then
3335
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4587
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3336
4588
              $run eval '$mv "$nlist"T "$nlist"'
3337
4589
            fi
3338
4590
 
3339
4591
            if test -n "$export_symbols_regex"; then
3340
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4592
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3341
4593
              $run eval '$mv "$nlist"T "$nlist"'
3342
4594
            fi
3343
4595
 
3344
4596
            # Prepare the list of exported symbols
3345
4597
            if test -z "$export_symbols"; then
3346
 
              export_symbols="$output_objdir/$output.exp"
 
4598
              export_symbols="$output_objdir/$outputname.exp"
3347
4599
              $run $rm $export_symbols
3348
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4600
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4601
              case $host in
 
4602
              *cygwin* | *mingw* )
 
4603
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4604
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4605
                ;;
 
4606
              esac
3349
4607
            else
3350
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3351
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4608
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4609
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3352
4610
              $run eval 'mv "$nlist"T "$nlist"'
 
4611
              case $host in
 
4612
              *cygwin* | *mingw* )
 
4613
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4614
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4615
                ;;
 
4616
              esac
3353
4617
            fi
3354
4618
          fi
3355
4619
 
3356
4620
          for arg in $dlprefiles; do
3357
4621
            $show "extracting global C symbols from \`$arg'"
3358
 
            name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3359
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4622
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4623
            $run eval '$echo ": $name " >> "$nlist"'
3360
4624
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3361
4625
          done
3362
4626
 
3365
4629
            test -f "$nlist" || : > "$nlist"
3366
4630
 
3367
4631
            if test -n "$exclude_expsyms"; then
3368
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4632
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3369
4633
              $mv "$nlist"T "$nlist"
3370
4634
            fi
3371
4635
 
3385
4649
            if test -f "$nlist"S; then
3386
4650
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3387
4651
            else
3388
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4652
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3389
4653
            fi
3390
4654
 
3391
4655
            $echo >> "$output_objdir/$dlsyms" "\
3400
4664
#endif
3401
4665
 
3402
4666
/* The mapping between symbol names and symbols. */
 
4667
"
 
4668
 
 
4669
            case $host in
 
4670
            *cygwin* | *mingw* )
 
4671
          $echo >> "$output_objdir/$dlsyms" "\
 
4672
/* DATA imports from DLLs on WIN32 can't be const, because
 
4673
   runtime relocations are performed -- see ld's documentation
 
4674
   on pseudo-relocs */
 
4675
struct {
 
4676
"
 
4677
              ;;
 
4678
            * )
 
4679
          $echo >> "$output_objdir/$dlsyms" "\
3403
4680
const struct {
 
4681
"
 
4682
              ;;
 
4683
            esac
 
4684
 
 
4685
 
 
4686
          $echo >> "$output_objdir/$dlsyms" "\
3404
4687
  const char *name;
3405
4688
  lt_ptr address;
3406
4689
}
3437
4720
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3438
4721
            case "$compile_command " in
3439
4722
            *" -static "*) ;;
3440
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4723
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3441
4724
            esac;;
3442
4725
          *-*-hpux*)
3443
4726
            case "$compile_command " in
3444
4727
            *" -static "*) ;;
3445
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4728
            *) pic_flag_for_symtable=" $pic_flag";;
3446
4729
            esac
3447
4730
          esac
3448
4731
 
3449
4732
          # Now compile the dynamic symbol file.
3450
 
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3451
 
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4733
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4734
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3452
4735
 
3453
4736
          # Clean up the generated files.
3454
4737
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3455
4738
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3456
4739
 
3457
4740
          # Transform the symbol file into the correct name.
3458
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3459
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4741
          case $host in
 
4742
          *cygwin* | *mingw* )
 
4743
            if test -f "$output_objdir/${outputname}.def" ; then
 
4744
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4745
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4746
            else
 
4747
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4748
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4749
             fi
 
4750
            ;;
 
4751
          * )
 
4752
            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4753
            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4754
            ;;
 
4755
          esac
3460
4756
          ;;
3461
4757
        *)
3462
4758
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3463
 
          exit 1
 
4759
          exit $EXIT_FAILURE
3464
4760
          ;;
3465
4761
        esac
3466
4762
      else
3469
4765
        # really was required.
3470
4766
 
3471
4767
        # Nullify the symbol file.
3472
 
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3473
 
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
 
4768
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
 
4769
        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
3474
4770
      fi
3475
4771
 
3476
 
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
4772
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3477
4773
        # Replace the output file specification.
3478
 
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
4774
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
3479
4775
        link_command="$compile_command$compile_rpath"
3480
4776
 
3481
4777
        # We have no uninstalled library dependencies, so finalize right now.
3482
4778
        $show "$link_command"
3483
4779
        $run eval "$link_command"
3484
 
        status=$?
 
4780
        exit_status=$?
3485
4781
 
3486
4782
        # Delete the generated files.
3487
4783
        if test -n "$dlsyms"; then
3489
4785
          $run $rm "$output_objdir/${outputname}S.${objext}"
3490
4786
        fi
3491
4787
 
3492
 
        exit $status
 
4788
        exit $exit_status
3493
4789
      fi
3494
4790
 
3495
4791
      if test -n "$shlibpath_var"; then
3548
4844
        # Link the executable and exit
3549
4845
        $show "$link_command"
3550
4846
        $run eval "$link_command" || exit $?
3551
 
        exit 0
 
4847
        exit $EXIT_SUCCESS
3552
4848
      fi
3553
4849
 
3554
4850
      if test "$hardcode_action" = relink; then
3562
4858
        if test "$fast_install" != no; then
3563
4859
          link_command="$finalize_var$compile_command$finalize_rpath"
3564
4860
          if test "$fast_install" = yes; then
3565
 
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
 
4861
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
3566
4862
          else
3567
4863
            # fast_install is set to needless
3568
4864
            relink_command=
3599
4895
          fi
3600
4896
        done
3601
4897
        relink_command="(cd `pwd`; $relink_command)"
3602
 
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
4898
        relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
3603
4899
      fi
3604
4900
 
3605
4901
      # Quote $echo for shipping.
3606
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3607
 
        case $0 in
3608
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3609
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4902
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4903
        case $progpath in
 
4904
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4905
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
3610
4906
        esac
3611
4907
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3612
4908
      else
3618
4914
        # win32 will think the script is a binary if it has
3619
4915
        # a .exe suffix, so we strip it off here.
3620
4916
        case $output in
3621
 
          *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
 
4917
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3622
4918
        esac
3623
4919
        # test for cygwin because mv fails w/o .exe extensions
3624
4920
        case $host in
3625
 
          *cygwin*) exeext=.exe ;;
 
4921
          *cygwin*)
 
4922
            exeext=.exe
 
4923
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3626
4924
          *) exeext= ;;
3627
4925
        esac
3628
 
        $rm $output
3629
 
        trap "$rm $output; exit 1" 1 2 15
 
4926
        case $host in
 
4927
          *cygwin* | *mingw* )
 
4928
            output_name=`basename $output`
 
4929
            output_path=`dirname $output`
 
4930
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4931
            cwrapper="$output_path/$output_name.exe"
 
4932
            $rm $cwrappersource $cwrapper
 
4933
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4934
 
 
4935
            cat > $cwrappersource <<EOF
 
4936
 
 
4937
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4938
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4939
 
 
4940
   The $output program cannot be directly executed until all the libtool
 
4941
   libraries that it depends on are installed.
 
4942
 
 
4943
   This wrapper executable should never be moved out of the build directory.
 
4944
   If it is, it will not operate correctly.
 
4945
 
 
4946
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4947
   but could eventually absorb all of the scripts functionality and
 
4948
   exec $objdir/$outputname directly.
 
4949
*/
 
4950
EOF
 
4951
            cat >> $cwrappersource<<"EOF"
 
4952
#include <stdio.h>
 
4953
#include <stdlib.h>
 
4954
#include <unistd.h>
 
4955
#include <malloc.h>
 
4956
#include <stdarg.h>
 
4957
#include <assert.h>
 
4958
#include <string.h>
 
4959
#include <ctype.h>
 
4960
#include <sys/stat.h>
 
4961
 
 
4962
#if defined(PATH_MAX)
 
4963
# define LT_PATHMAX PATH_MAX
 
4964
#elif defined(MAXPATHLEN)
 
4965
# define LT_PATHMAX MAXPATHLEN
 
4966
#else
 
4967
# define LT_PATHMAX 1024
 
4968
#endif
 
4969
 
 
4970
#ifndef DIR_SEPARATOR
 
4971
# define DIR_SEPARATOR '/'
 
4972
# define PATH_SEPARATOR ':'
 
4973
#endif
 
4974
 
 
4975
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4976
  defined (__OS2__)
 
4977
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4978
# ifndef DIR_SEPARATOR_2
 
4979
#  define DIR_SEPARATOR_2 '\\'
 
4980
# endif
 
4981
# ifndef PATH_SEPARATOR_2
 
4982
#  define PATH_SEPARATOR_2 ';'
 
4983
# endif
 
4984
#endif
 
4985
 
 
4986
#ifndef DIR_SEPARATOR_2
 
4987
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4988
#else /* DIR_SEPARATOR_2 */
 
4989
# define IS_DIR_SEPARATOR(ch) \
 
4990
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4991
#endif /* DIR_SEPARATOR_2 */
 
4992
 
 
4993
#ifndef PATH_SEPARATOR_2
 
4994
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4995
#else /* PATH_SEPARATOR_2 */
 
4996
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4997
#endif /* PATH_SEPARATOR_2 */
 
4998
 
 
4999
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
5000
#define XFREE(stale) do { \
 
5001
  if (stale) { free ((void *) stale); stale = 0; } \
 
5002
} while (0)
 
5003
 
 
5004
/* -DDEBUG is fairly common in CFLAGS.  */
 
5005
#undef DEBUG
 
5006
#if defined DEBUGWRAPPER
 
5007
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
5008
#else
 
5009
# define DEBUG(format, ...)
 
5010
#endif
 
5011
 
 
5012
const char *program_name = NULL;
 
5013
 
 
5014
void * xmalloc (size_t num);
 
5015
char * xstrdup (const char *string);
 
5016
const char * base_name (const char *name);
 
5017
char * find_executable(const char *wrapper);
 
5018
int    check_executable(const char *path);
 
5019
char * strendzap(char *str, const char *pat);
 
5020
void lt_fatal (const char *message, ...);
 
5021
 
 
5022
int
 
5023
main (int argc, char *argv[])
 
5024
{
 
5025
  char **newargz;
 
5026
  int i;
 
5027
 
 
5028
  program_name = (char *) xstrdup (base_name (argv[0]));
 
5029
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
5030
  DEBUG("(main) program_name : %s\n",program_name);
 
5031
  newargz = XMALLOC(char *, argc+2);
 
5032
EOF
 
5033
 
 
5034
            cat >> $cwrappersource <<EOF
 
5035
  newargz[0] = (char *) xstrdup("$SHELL");
 
5036
EOF
 
5037
 
 
5038
            cat >> $cwrappersource <<"EOF"
 
5039
  newargz[1] = find_executable(argv[0]);
 
5040
  if (newargz[1] == NULL)
 
5041
    lt_fatal("Couldn't find %s", argv[0]);
 
5042
  DEBUG("(main) found exe at : %s\n",newargz[1]);
 
5043
  /* we know the script has the same name, without the .exe */
 
5044
  /* so make sure newargz[1] doesn't end in .exe */
 
5045
  strendzap(newargz[1],".exe");
 
5046
  for (i = 1; i < argc; i++)
 
5047
    newargz[i+1] = xstrdup(argv[i]);
 
5048
  newargz[argc+1] = NULL;
 
5049
 
 
5050
  for (i=0; i<argc+1; i++)
 
5051
  {
 
5052
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
5053
    ;
 
5054
  }
 
5055
 
 
5056
EOF
 
5057
 
 
5058
            case $host_os in
 
5059
              mingw*)
 
5060
                cat >> $cwrappersource <<EOF
 
5061
  execv("$SHELL",(char const **)newargz);
 
5062
EOF
 
5063
              ;;
 
5064
              *)
 
5065
                cat >> $cwrappersource <<EOF
 
5066
  execv("$SHELL",newargz);
 
5067
EOF
 
5068
              ;;
 
5069
            esac
 
5070
 
 
5071
            cat >> $cwrappersource <<"EOF"
 
5072
  return 127;
 
5073
}
 
5074
 
 
5075
void *
 
5076
xmalloc (size_t num)
 
5077
{
 
5078
  void * p = (void *) malloc (num);
 
5079
  if (!p)
 
5080
    lt_fatal ("Memory exhausted");
 
5081
 
 
5082
  return p;
 
5083
}
 
5084
 
 
5085
char *
 
5086
xstrdup (const char *string)
 
5087
{
 
5088
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
5089
;
 
5090
}
 
5091
 
 
5092
const char *
 
5093
base_name (const char *name)
 
5094
{
 
5095
  const char *base;
 
5096
 
 
5097
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5098
  /* Skip over the disk name in MSDOS pathnames. */
 
5099
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
 
5100
    name += 2;
 
5101
#endif
 
5102
 
 
5103
  for (base = name; *name; name++)
 
5104
    if (IS_DIR_SEPARATOR (*name))
 
5105
      base = name + 1;
 
5106
  return base;
 
5107
}
 
5108
 
 
5109
int
 
5110
check_executable(const char * path)
 
5111
{
 
5112
  struct stat st;
 
5113
 
 
5114
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
 
5115
  if ((!path) || (!*path))
 
5116
    return 0;
 
5117
 
 
5118
  if ((stat (path, &st) >= 0) &&
 
5119
      (
 
5120
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5121
#if defined (S_IXOTH)
 
5122
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
5123
#endif
 
5124
#if defined (S_IXGRP)
 
5125
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
5126
#endif
 
5127
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5128
      )
 
5129
    return 1;
 
5130
  else
 
5131
    return 0;
 
5132
}
 
5133
 
 
5134
/* Searches for the full path of the wrapper.  Returns
 
5135
   newly allocated full path name if found, NULL otherwise */
 
5136
char *
 
5137
find_executable (const char* wrapper)
 
5138
{
 
5139
  int has_slash = 0;
 
5140
  const char* p;
 
5141
  const char* p_next;
 
5142
  /* static buffer for getcwd */
 
5143
  char tmp[LT_PATHMAX + 1];
 
5144
  int tmp_len;
 
5145
  char* concat_name;
 
5146
 
 
5147
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
 
5148
 
 
5149
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
5150
    return NULL;
 
5151
 
 
5152
  /* Absolute path? */
 
5153
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5154
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
5155
  {
 
5156
    concat_name = xstrdup (wrapper);
 
5157
    if (check_executable(concat_name))
 
5158
      return concat_name;
 
5159
    XFREE(concat_name);
 
5160
  }
 
5161
  else
 
5162
  {
 
5163
#endif
 
5164
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
5165
    {
 
5166
      concat_name = xstrdup (wrapper);
 
5167
      if (check_executable(concat_name))
 
5168
        return concat_name;
 
5169
      XFREE(concat_name);
 
5170
    }
 
5171
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5172
  }
 
5173
#endif
 
5174
 
 
5175
  for (p = wrapper; *p; p++)
 
5176
    if (*p == '/')
 
5177
    {
 
5178
      has_slash = 1;
 
5179
      break;
 
5180
    }
 
5181
  if (!has_slash)
 
5182
  {
 
5183
    /* no slashes; search PATH */
 
5184
    const char* path = getenv ("PATH");
 
5185
    if (path != NULL)
 
5186
    {
 
5187
      for (p = path; *p; p = p_next)
 
5188
      {
 
5189
        const char* q;
 
5190
        size_t p_len;
 
5191
        for (q = p; *q; q++)
 
5192
          if (IS_PATH_SEPARATOR(*q))
 
5193
            break;
 
5194
        p_len = q - p;
 
5195
        p_next = (*q == '\0' ? q : q + 1);
 
5196
        if (p_len == 0)
 
5197
        {
 
5198
          /* empty path: current directory */
 
5199
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5200
            lt_fatal ("getcwd failed");
 
5201
          tmp_len = strlen(tmp);
 
5202
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5203
          memcpy (concat_name, tmp, tmp_len);
 
5204
          concat_name[tmp_len] = '/';
 
5205
          strcpy (concat_name + tmp_len + 1, wrapper);
 
5206
        }
 
5207
        else
 
5208
        {
 
5209
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
5210
          memcpy (concat_name, p, p_len);
 
5211
          concat_name[p_len] = '/';
 
5212
          strcpy (concat_name + p_len + 1, wrapper);
 
5213
        }
 
5214
        if (check_executable(concat_name))
 
5215
          return concat_name;
 
5216
        XFREE(concat_name);
 
5217
      }
 
5218
    }
 
5219
    /* not found in PATH; assume curdir */
 
5220
  }
 
5221
  /* Relative path | not found in path: prepend cwd */
 
5222
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5223
    lt_fatal ("getcwd failed");
 
5224
  tmp_len = strlen(tmp);
 
5225
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5226
  memcpy (concat_name, tmp, tmp_len);
 
5227
  concat_name[tmp_len] = '/';
 
5228
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5229
 
 
5230
  if (check_executable(concat_name))
 
5231
    return concat_name;
 
5232
  XFREE(concat_name);
 
5233
  return NULL;
 
5234
}
 
5235
 
 
5236
char *
 
5237
strendzap(char *str, const char *pat)
 
5238
{
 
5239
  size_t len, patlen;
 
5240
 
 
5241
  assert(str != NULL);
 
5242
  assert(pat != NULL);
 
5243
 
 
5244
  len = strlen(str);
 
5245
  patlen = strlen(pat);
 
5246
 
 
5247
  if (patlen <= len)
 
5248
  {
 
5249
    str += len - patlen;
 
5250
    if (strcmp(str, pat) == 0)
 
5251
      *str = '\0';
 
5252
  }
 
5253
  return str;
 
5254
}
 
5255
 
 
5256
static void
 
5257
lt_error_core (int exit_status, const char * mode,
 
5258
          const char * message, va_list ap)
 
5259
{
 
5260
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
5261
  vfprintf (stderr, message, ap);
 
5262
  fprintf (stderr, ".\n");
 
5263
 
 
5264
  if (exit_status >= 0)
 
5265
    exit (exit_status);
 
5266
}
 
5267
 
 
5268
void
 
5269
lt_fatal (const char *message, ...)
 
5270
{
 
5271
  va_list ap;
 
5272
  va_start (ap, message);
 
5273
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
5274
  va_end (ap);
 
5275
}
 
5276
EOF
 
5277
          # we should really use a build-platform specific compiler
 
5278
          # here, but OTOH, the wrappers (shell script and this C one)
 
5279
          # are only useful if you want to execute the "real" binary.
 
5280
          # Since the "real" binary is built for $host, then this
 
5281
          # wrapper might as well be built for $host, too.
 
5282
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5283
          ;;
 
5284
        esac
 
5285
        $rm $output
 
5286
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
3630
5287
 
3631
5288
        $echo > $output "\
3632
5289
#! $SHELL
3642
5299
 
3643
5300
# Sed substitution that helps us do robust quoting.  It backslashifies
3644
5301
# metacharacters that are still active within double-quoted strings.
3645
 
Xsed="${SED}"' -e 1s/^X//'
 
5302
Xsed='${SED} -e 1s/^X//'
3646
5303
sed_quote_subst='$sed_quote_subst'
3647
5304
 
 
5305
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
 
5306
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
 
5307
  emulate sh
 
5308
  NULLCMD=:
 
5309
  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
 
5310
  # is contrary to our usage.  Disable this feature.
 
5311
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
 
5312
  setopt NO_GLOB_SUBST
 
5313
else
 
5314
  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
 
5315
fi
 
5316
BIN_SH=xpg4; export BIN_SH # for Tru64
 
5317
DUALCASE=1; export DUALCASE # for MKS sh
 
5318
 
3648
5319
# The HP-UX ksh and POSIX shell print the target directory to stdout
3649
5320
# if CDPATH is set.
3650
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
5321
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3651
5322
 
3652
5323
relink_command=\"$relink_command\"
3653
5324
 
3702
5373
"
3703
5374
 
3704
5375
        if test "$fast_install" = yes; then
3705
 
          echo >> $output "\
 
5376
          $echo >> $output "\
3706
5377
  program=lt-'$outputname'$exeext
3707
5378
  progdir=\"\$thisdir/$objdir\"
3708
5379
 
3718
5389
      $rm \"\$progdir/\$file\"
3719
5390
    fi"
3720
5391
 
3721
 
          echo >> $output "\
 
5392
          $echo >> $output "\
3722
5393
 
3723
5394
    # relink executable if necessary
3724
5395
    if test -n \"\$relink_command\"; then
3726
5397
      else
3727
5398
        $echo \"\$relink_command_output\" >&2
3728
5399
        $rm \"\$progdir/\$file\"
3729
 
        exit 1
 
5400
        exit $EXIT_FAILURE
3730
5401
      fi
3731
5402
    fi
3732
5403
 
3736
5407
    $rm \"\$progdir/\$file\"
3737
5408
  fi"
3738
5409
        else
3739
 
          echo >> $output "\
 
5410
          $echo >> $output "\
3740
5411
  program='$outputname'
3741
5412
  progdir=\"\$thisdir/$objdir\"
3742
5413
"
3743
5414
        fi
3744
5415
 
3745
 
        echo >> $output "\
 
5416
        $echo >> $output "\
3746
5417
 
3747
5418
  if test -f \"\$progdir/\$program\"; then"
3748
5419
 
3753
5424
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3754
5425
 
3755
5426
    # Some systems cannot cope with colon-terminated $shlibpath_var
3756
 
    # The second colon is a workaround for a bug in BeOS R4 ${SED}
 
5427
    # The second colon is a workaround for a bug in BeOS R4 sed
3757
5428
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3758
5429
 
3759
5430
    export $shlibpath_var
3773
5444
      # Run the actual program with our arguments.
3774
5445
"
3775
5446
        case $host in
3776
 
        # win32 systems need to use the prog path for dll
3777
 
        # lookup to work
3778
 
        *-*-cygwin* | *-*-pw32*)
3779
 
          $echo >> $output "\
3780
 
      exec \$progdir/\$program \${1+\"\$@\"}
3781
 
"
3782
 
          ;;
3783
 
 
3784
5447
        # Backslashes separate directories on plain windows
3785
5448
        *-*-mingw | *-*-os2*)
3786
5449
          $echo >> $output "\
3787
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5450
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3788
5451
"
3789
5452
          ;;
3790
5453
 
3791
5454
        *)
3792
5455
          $echo >> $output "\
3793
 
      # Export the path to the program.
3794
 
      PATH=\"\$progdir:\$PATH\"
3795
 
      export PATH
3796
 
 
3797
 
      exec \$program \${1+\"\$@\"}
 
5456
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
3798
5457
"
3799
5458
          ;;
3800
5459
        esac
3801
5460
        $echo >> $output "\
3802
 
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3803
 
      exit 1
 
5461
      \$echo \"\$0: cannot exec \$program \$*\"
 
5462
      exit $EXIT_FAILURE
3804
5463
    fi
3805
5464
  else
3806
5465
    # The program doesn't exist.
3807
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5466
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3808
5467
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
3809
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
3810
 
    exit 1
 
5468
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
5469
    exit $EXIT_FAILURE
3811
5470
  fi
3812
5471
fi\
3813
5472
"
3814
5473
        chmod +x $output
3815
5474
      fi
3816
 
      exit 0
 
5475
      exit $EXIT_SUCCESS
3817
5476
      ;;
3818
5477
    esac
3819
5478
 
3829
5488
          oldobjs="$libobjs_save"
3830
5489
          build_libtool_libs=no
3831
5490
        else
3832
 
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
5491
          oldobjs="$old_deplibs $non_pic_objects"
3833
5492
        fi
3834
5493
        addlibs="$old_convenience"
3835
5494
      fi
3836
5495
 
3837
5496
      if test -n "$addlibs"; then
3838
5497
        gentop="$output_objdir/${outputname}x"
3839
 
        $show "${rm}r $gentop"
3840
 
        $run ${rm}r "$gentop"
3841
 
        $show "mkdir $gentop"
3842
 
        $run mkdir "$gentop"
3843
 
        status=$?
3844
 
        if test $status -ne 0 && test ! -d "$gentop"; then
3845
 
          exit $status
3846
 
        fi
3847
5498
        generated="$generated $gentop"
3848
5499
 
3849
 
        # Add in members from convenience archives.
3850
 
        for xlib in $addlibs; do
3851
 
          # Extract the objects.
3852
 
          case $xlib in
3853
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3854
 
          *) xabs=`pwd`"/$xlib" ;;
3855
 
          esac
3856
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3857
 
          xdir="$gentop/$xlib"
3858
 
 
3859
 
          $show "${rm}r $xdir"
3860
 
          $run ${rm}r "$xdir"
3861
 
          $show "mkdir $xdir"
3862
 
          $run mkdir "$xdir"
3863
 
          status=$?
3864
 
          if test $status -ne 0 && test ! -d "$xdir"; then
3865
 
            exit $status
3866
 
          fi
3867
 
          $show "(cd $xdir && $AR x $xabs)"
3868
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3869
 
 
3870
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3871
 
        done
 
5500
        func_extract_archives $gentop $addlibs
 
5501
        oldobjs="$oldobjs $func_extract_archives_result"
3872
5502
      fi
3873
5503
 
3874
5504
      # Do each command in the archive commands.
3875
5505
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3876
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5506
       cmds=$old_archive_from_new_cmds
3877
5507
      else
3878
 
        # Ensure that we have .o objects in place in case we decided
3879
 
        # not to build a shared library, and have fallen back to building
3880
 
        # static libs even though --disable-static was passed!
3881
 
        for oldobj in $oldobjs; do
3882
 
          if test ! -f $oldobj; then
3883
 
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3884
 
            if test "X$xdir" = "X$oldobj"; then
3885
 
              xdir="."
3886
 
            else
3887
 
              xdir="$xdir"
 
5508
        # POSIX demands no paths to be encoded in archives.  We have
 
5509
        # to avoid creating archives with duplicate basenames if we
 
5510
        # might have to extract them afterwards, e.g., when creating a
 
5511
        # static archive out of a convenience library, or when linking
 
5512
        # the entirety of a libtool archive into another (currently
 
5513
        # not supported by libtool).
 
5514
        if (for obj in $oldobjs
 
5515
            do
 
5516
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5517
            done | sort | sort -uc >/dev/null 2>&1); then
 
5518
          :
 
5519
        else
 
5520
          $echo "copying selected object files to avoid basename conflicts..."
 
5521
 
 
5522
          if test -z "$gentop"; then
 
5523
            gentop="$output_objdir/${outputname}x"
 
5524
            generated="$generated $gentop"
 
5525
 
 
5526
            $show "${rm}r $gentop"
 
5527
            $run ${rm}r "$gentop"
 
5528
            $show "$mkdir $gentop"
 
5529
            $run $mkdir "$gentop"
 
5530
            exit_status=$?
 
5531
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5532
              exit $exit_status
3888
5533
            fi
3889
 
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3890
 
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3891
 
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3892
 
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3893
5534
          fi
3894
 
        done
 
5535
 
 
5536
          save_oldobjs=$oldobjs
 
5537
          oldobjs=
 
5538
          counter=1
 
5539
          for obj in $save_oldobjs
 
5540
          do
 
5541
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5542
            case " $oldobjs " in
 
5543
            " ") oldobjs=$obj ;;
 
5544
            *[\ /]"$objbase "*)
 
5545
              while :; do
 
5546
                # Make sure we don't pick an alternate name that also
 
5547
                # overlaps.
 
5548
                newobj=lt$counter-$objbase
 
5549
                counter=`expr $counter + 1`
 
5550
                case " $oldobjs " in
 
5551
                *[\ /]"$newobj "*) ;;
 
5552
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5553
                esac
 
5554
              done
 
5555
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5556
              $run ln "$obj" "$gentop/$newobj" ||
 
5557
              $run cp "$obj" "$gentop/$newobj"
 
5558
              oldobjs="$oldobjs $gentop/$newobj"
 
5559
              ;;
 
5560
            *) oldobjs="$oldobjs $obj" ;;
 
5561
            esac
 
5562
          done
 
5563
        fi
3895
5564
 
3896
5565
        eval cmds=\"$old_archive_cmds\"
 
5566
 
 
5567
        if len=`expr "X$cmds" : ".*"` &&
 
5568
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5569
          cmds=$old_archive_cmds
 
5570
        else
 
5571
          # the command line is too long to link in one step, link in parts
 
5572
          $echo "using piecewise archive linking..."
 
5573
          save_RANLIB=$RANLIB
 
5574
          RANLIB=:
 
5575
          objlist=
 
5576
          concat_cmds=
 
5577
          save_oldobjs=$oldobjs
 
5578
 
 
5579
          # Is there a better way of finding the last object in the list?
 
5580
          for obj in $save_oldobjs
 
5581
          do
 
5582
            last_oldobj=$obj
 
5583
          done
 
5584
          for obj in $save_oldobjs
 
5585
          do
 
5586
            oldobjs="$objlist $obj"
 
5587
            objlist="$objlist $obj"
 
5588
            eval test_cmds=\"$old_archive_cmds\"
 
5589
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
5590
               test "$len" -le "$max_cmd_len"; then
 
5591
              :
 
5592
            else
 
5593
              # the above command should be used before it gets too long
 
5594
              oldobjs=$objlist
 
5595
              if test "$obj" = "$last_oldobj" ; then
 
5596
                RANLIB=$save_RANLIB
 
5597
              fi
 
5598
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5599
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5600
              objlist=
 
5601
            fi
 
5602
          done
 
5603
          RANLIB=$save_RANLIB
 
5604
          oldobjs=$objlist
 
5605
          if test "X$oldobjs" = "X" ; then
 
5606
            eval cmds=\"\$concat_cmds\"
 
5607
          else
 
5608
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5609
          fi
 
5610
        fi
3897
5611
      fi
3898
5612
      save_ifs="$IFS"; IFS='~'
3899
5613
      for cmd in $cmds; do
 
5614
        eval cmd=\"$cmd\"
3900
5615
        IFS="$save_ifs"
3901
5616
        $show "$cmd"
3902
5617
        $run eval "$cmd" || exit $?
3928
5643
        fi
3929
5644
      done
3930
5645
      # Quote the link command for shipping.
3931
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
3932
 
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5646
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
 
5647
      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
 
5648
      if test "$hardcode_automatic" = yes ; then
 
5649
        relink_command=
 
5650
      fi
 
5651
 
3933
5652
 
3934
5653
      # Only create the output if not a dry run.
3935
5654
      if test -z "$run"; then
3948
5667
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3949
5668
                if test -z "$libdir"; then
3950
5669
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3951
 
                  exit 1
 
5670
                  exit $EXIT_FAILURE
3952
5671
                fi
3953
5672
                newdependency_libs="$newdependency_libs $libdir/$name"
3954
5673
                ;;
3962
5681
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3963
5682
              if test -z "$libdir"; then
3964
5683
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3965
 
                exit 1
 
5684
                exit $EXIT_FAILURE
3966
5685
              fi
3967
5686
              newdlfiles="$newdlfiles $libdir/$name"
3968
5687
            done
3973
5692
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3974
5693
              if test -z "$libdir"; then
3975
5694
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3976
 
                exit 1
 
5695
                exit $EXIT_FAILURE
3977
5696
              fi
3978
5697
              newdlprefiles="$newdlprefiles $libdir/$name"
3979
5698
            done
3980
5699
            dlprefiles="$newdlprefiles"
 
5700
          else
 
5701
            newdlfiles=
 
5702
            for lib in $dlfiles; do
 
5703
              case $lib in
 
5704
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5705
                *) abs=`pwd`"/$lib" ;;
 
5706
              esac
 
5707
              newdlfiles="$newdlfiles $abs"
 
5708
            done
 
5709
            dlfiles="$newdlfiles"
 
5710
            newdlprefiles=
 
5711
            for lib in $dlprefiles; do
 
5712
              case $lib in
 
5713
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5714
                *) abs=`pwd`"/$lib" ;;
 
5715
              esac
 
5716
              newdlprefiles="$newdlprefiles $abs"
 
5717
            done
 
5718
            dlprefiles="$newdlprefiles"
3981
5719
          fi
3982
5720
          $rm $output
3983
5721
          # place dlname in correct position for cygwin
3984
5722
          tdlname=$dlname
3985
5723
          case $host,$output,$installed,$module,$dlname in
3986
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5724
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3987
5725
          esac
3988
5726
          $echo > $output "\
3989
5727
# $outputname - a libtool library file
4012
5750
# Is this an already installed library?
4013
5751
installed=$installed
4014
5752
 
 
5753
# Should we warn about portability when linking against -modules?
 
5754
shouldnotlink=$module
 
5755
 
4015
5756
# Files to dlopen/dlpreopen
4016
5757
dlopen='$dlfiles'
4017
5758
dlpreopen='$dlprefiles'
4018
5759
 
4019
5760
# Directory that this library needs to be installed in:
4020
5761
libdir='$install_libdir'"
4021
 
          if test "$installed" = no && test $need_relink = yes; then
 
5762
          if test "$installed" = no && test "$need_relink" = yes; then
4022
5763
            $echo >> $output "\
4023
5764
relink_command=\"$relink_command\""
4024
5765
          fi
4031
5772
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4032
5773
      ;;
4033
5774
    esac
4034
 
    exit 0
 
5775
    exit $EXIT_SUCCESS
4035
5776
    ;;
4036
5777
 
4037
5778
  # libtool install mode
4042
5783
    # install_prog (especially on Windows NT).
4043
5784
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4044
5785
       # Allow the use of GNU shtool's install command.
4045
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5786
       $echo "X$nonopt" | grep shtool > /dev/null; then
4046
5787
      # Aesthetically quote it.
4047
5788
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4048
5789
      case $arg in
4049
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5790
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
4050
5791
        arg="\"$arg\""
4051
5792
        ;;
4052
5793
      esac
4055
5796
      shift
4056
5797
    else
4057
5798
      install_prog=
4058
 
      arg="$nonopt"
 
5799
      arg=$nonopt
4059
5800
    fi
4060
5801
 
4061
5802
    # The real first argument should be the name of the installation program.
4062
5803
    # Aesthetically quote it.
4063
5804
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4064
5805
    case $arg in
4065
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5806
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
4066
5807
      arg="\"$arg\""
4067
5808
      ;;
4068
5809
    esac
4080
5821
    do
4081
5822
      if test -n "$dest"; then
4082
5823
        files="$files $dest"
4083
 
        dest="$arg"
 
5824
        dest=$arg
4084
5825
        continue
4085
5826
      fi
4086
5827
 
4087
5828
      case $arg in
4088
5829
      -d) isdir=yes ;;
4089
 
      -f) prev="-f" ;;
4090
 
      -g) prev="-g" ;;
4091
 
      -m) prev="-m" ;;
4092
 
      -o) prev="-o" ;;
 
5830
      -f) 
 
5831
        case " $install_prog " in
 
5832
        *[\\\ /]cp\ *) ;;
 
5833
        *) prev=$arg ;;
 
5834
        esac
 
5835
        ;;
 
5836
      -g | -m | -o) prev=$arg ;;
4093
5837
      -s)
4094
5838
        stripme=" -s"
4095
5839
        continue
4096
5840
        ;;
4097
 
      -*) ;;
4098
 
 
 
5841
      -*)
 
5842
        ;;
4099
5843
      *)
4100
5844
        # If the previous option needed an argument, then skip it.
4101
5845
        if test -n "$prev"; then
4102
5846
          prev=
4103
5847
        else
4104
 
          dest="$arg"
 
5848
          dest=$arg
4105
5849
          continue
4106
5850
        fi
4107
5851
        ;;
4110
5854
      # Aesthetically quote the argument.
4111
5855
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4112
5856
      case $arg in
4113
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5857
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
4114
5858
        arg="\"$arg\""
4115
5859
        ;;
4116
5860
      esac
4120
5864
    if test -z "$install_prog"; then
4121
5865
      $echo "$modename: you must specify an install program" 1>&2
4122
5866
      $echo "$help" 1>&2
4123
 
      exit 1
 
5867
      exit $EXIT_FAILURE
4124
5868
    fi
4125
5869
 
4126
5870
    if test -n "$prev"; then
4127
5871
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4128
5872
      $echo "$help" 1>&2
4129
 
      exit 1
 
5873
      exit $EXIT_FAILURE
4130
5874
    fi
4131
5875
 
4132
5876
    if test -z "$files"; then
4136
5880
        $echo "$modename: you must specify a destination" 1>&2
4137
5881
      fi
4138
5882
      $echo "$help" 1>&2
4139
 
      exit 1
 
5883
      exit $EXIT_FAILURE
4140
5884
    fi
4141
5885
 
4142
5886
    # Strip any trailing slash from the destination.
4154
5898
 
4155
5899
      # Not a directory, so check to see that there is only one file specified.
4156
5900
      set dummy $files
4157
 
      if test $# -gt 2; then
 
5901
      if test "$#" -gt 2; then
4158
5902
        $echo "$modename: \`$dest' is not a directory" 1>&2
4159
5903
        $echo "$help" 1>&2
4160
 
        exit 1
 
5904
        exit $EXIT_FAILURE
4161
5905
      fi
4162
5906
    fi
4163
5907
    case $destdir in
4169
5913
        *)
4170
5914
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4171
5915
          $echo "$help" 1>&2
4172
 
          exit 1
 
5916
          exit $EXIT_FAILURE
4173
5917
          ;;
4174
5918
        esac
4175
5919
      done
4194
5938
 
4195
5939
      *.la)
4196
5940
        # Check to see that this really is a libtool archive.
4197
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5941
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4198
5942
        else
4199
5943
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4200
5944
          $echo "$help" 1>&2
4201
 
          exit 1
 
5945
          exit $EXIT_FAILURE
4202
5946
        fi
4203
5947
 
4204
5948
        library_names=
4229
5973
        dir="$dir$objdir"
4230
5974
 
4231
5975
        if test -n "$relink_command"; then
 
5976
          # Determine the prefix the user has applied to our future dir.
 
5977
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
 
5978
 
 
5979
          # Don't allow the user to place us outside of our expected
 
5980
          # location b/c this prevents finding dependent libraries that
 
5981
          # are installed to the same prefix.
 
5982
          # At present, this check doesn't affect windows .dll's that
 
5983
          # are installed into $libdir/../bin (currently, that works fine)
 
5984
          # but it's something to keep an eye on.
 
5985
          if test "$inst_prefix_dir" = "$destdir"; then
 
5986
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
 
5987
            exit $EXIT_FAILURE
 
5988
          fi
 
5989
 
 
5990
          if test -n "$inst_prefix_dir"; then
 
5991
            # Stick the inst_prefix_dir data into the link command.
 
5992
            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
 
5993
          else
 
5994
            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
 
5995
          fi
 
5996
 
4232
5997
          $echo "$modename: warning: relinking \`$file'" 1>&2
4233
5998
          $show "$relink_command"
4234
5999
          if $run eval "$relink_command"; then :
4235
6000
          else
4236
6001
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4237
 
            continue
 
6002
            exit $EXIT_FAILURE
4238
6003
          fi
4239
6004
        fi
4240
6005
 
4256
6021
            $run eval "$striplib $destdir/$realname" || exit $?
4257
6022
          fi
4258
6023
 
4259
 
          if test $# -gt 0; then
 
6024
          if test "$#" -gt 0; then
4260
6025
            # Delete the old symlinks, and create new ones.
 
6026
            # Try `ln -sf' first, because the `ln' binary might depend on
 
6027
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
6028
            # so we also need to try rm && ln -s.
4261
6029
            for linkname
4262
6030
            do
4263
6031
              if test "$linkname" != "$realname"; then
4264
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4265
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
6032
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
6033
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
4266
6034
              fi
4267
6035
            done
4268
6036
          fi
4269
6037
 
4270
6038
          # Do each command in the postinstall commands.
4271
6039
          lib="$destdir/$realname"
4272
 
          eval cmds=\"$postinstall_cmds\"
 
6040
          cmds=$postinstall_cmds
4273
6041
          save_ifs="$IFS"; IFS='~'
4274
6042
          for cmd in $cmds; do
4275
6043
            IFS="$save_ifs"
 
6044
            eval cmd=\"$cmd\"
4276
6045
            $show "$cmd"
4277
 
            $run eval "$cmd" || exit $?
 
6046
            $run eval "$cmd" || {
 
6047
              lt_exit=$?
 
6048
 
 
6049
              # Restore the uninstalled library and exit
 
6050
              if test "$mode" = relink; then
 
6051
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
6052
              fi
 
6053
 
 
6054
              exit $lt_exit
 
6055
            }
4278
6056
          done
4279
6057
          IFS="$save_ifs"
4280
6058
        fi
4312
6090
        *)
4313
6091
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4314
6092
          $echo "$help" 1>&2
4315
 
          exit 1
 
6093
          exit $EXIT_FAILURE
4316
6094
          ;;
4317
6095
        esac
4318
6096
 
4330
6108
          $show "$install_prog $staticobj $staticdest"
4331
6109
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4332
6110
        fi
4333
 
        exit 0
 
6111
        exit $EXIT_SUCCESS
4334
6112
        ;;
4335
6113
 
4336
6114
      *)
4342
6120
          destfile="$destdir/$destfile"
4343
6121
        fi
4344
6122
 
 
6123
        # If the file is missing, and there is a .exe on the end, strip it
 
6124
        # because it is most likely a libtool script we actually want to
 
6125
        # install
 
6126
        stripped_ext=""
 
6127
        case $file in
 
6128
          *.exe)
 
6129
            if test ! -f "$file"; then
 
6130
              file=`$echo $file|${SED} 's,.exe$,,'`
 
6131
              stripped_ext=".exe"
 
6132
            fi
 
6133
            ;;
 
6134
        esac
 
6135
 
4345
6136
        # Do a test to see if this is really a libtool program.
4346
6137
        case $host in
4347
6138
        *cygwin*|*mingw*)
4348
 
            wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
 
6139
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
4349
6140
            ;;
4350
6141
        *)
4351
6142
            wrapper=$file
4352
6143
            ;;
4353
6144
        esac
4354
 
        if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
6145
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4355
6146
          notinst_deplibs=
4356
6147
          relink_command=
4357
6148
 
 
6149
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6150
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6151
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6152
          # `FILE.' does not work on cygwin managed mounts.
 
6153
          #
4358
6154
          # If there is no directory component, then add one.
4359
 
          case $file in
4360
 
          */* | *\\*) . $wrapper ;;
4361
 
          *) . ./$wrapper ;;
 
6155
          case $wrapper in
 
6156
          */* | *\\*) . ${wrapper} ;;
 
6157
          *) . ./${wrapper} ;;
4362
6158
          esac
4363
6159
 
4364
6160
          # Check the variables that should have been set.
4365
6161
          if test -z "$notinst_deplibs"; then
4366
6162
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4367
 
            exit 1
 
6163
            exit $EXIT_FAILURE
4368
6164
          fi
4369
6165
 
4370
6166
          finalize=yes
4386
6182
          done
4387
6183
 
4388
6184
          relink_command=
 
6185
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6186
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6187
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6188
          # `FILE.' does not work on cygwin managed mounts.
 
6189
          #
4389
6190
          # If there is no directory component, then add one.
4390
 
          case $file in
4391
 
          */* | *\\*) . $wrapper ;;
4392
 
          *) . ./$wrapper ;;
 
6191
          case $wrapper in
 
6192
          */* | *\\*) . ${wrapper} ;;
 
6193
          *) . ./${wrapper} ;;
4393
6194
          esac
4394
6195
 
4395
6196
          outputname=
4396
6197
          if test "$fast_install" = no && test -n "$relink_command"; then
4397
6198
            if test "$finalize" = yes && test -z "$run"; then
4398
 
              tmpdir="/tmp"
4399
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4400
 
              tmpdir="$tmpdir/libtool-$$"
4401
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4402
 
              else
4403
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4404
 
                continue
4405
 
              fi
4406
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
6199
              tmpdir=`func_mktempdir`
 
6200
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4407
6201
              outputname="$tmpdir/$file"
4408
6202
              # Replace the output file specification.
4409
 
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
 
6203
              relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
4410
6204
 
4411
6205
              $show "$relink_command"
4412
6206
              if $run eval "$relink_command"; then :
4421
6215
            fi
4422
6216
          else
4423
6217
            # Install the binary that we compiled earlier.
4424
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
6218
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4425
6219
          fi
4426
6220
        fi
4427
6221
 
4428
6222
        # remove .exe since cygwin /usr/bin/install will append another
4429
 
        # one anyways
 
6223
        # one anyway 
4430
6224
        case $install_prog,$host in
4431
 
        /usr/bin/install*,*cygwin*)
 
6225
        */usr/bin/install*,*cygwin*)
4432
6226
          case $file:$destfile in
4433
6227
          *.exe:*.exe)
4434
6228
            # this is ok
4437
6231
            destfile=$destfile.exe
4438
6232
            ;;
4439
6233
          *:*.exe)
4440
 
            destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
 
6234
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4441
6235
            ;;
4442
6236
          esac
4443
6237
          ;;
4458
6252
      $show "$install_prog $file $oldlib"
4459
6253
      $run eval "$install_prog \$file \$oldlib" || exit $?
4460
6254
 
4461
 
      if test -n "$stripme" && test -n "$striplib"; then
 
6255
      if test -n "$stripme" && test -n "$old_striplib"; then
4462
6256
        $show "$old_striplib $oldlib"
4463
6257
        $run eval "$old_striplib $oldlib" || exit $?
4464
6258
      fi
4465
6259
 
4466
6260
      # Do each command in the postinstall commands.
4467
 
      eval cmds=\"$old_postinstall_cmds\"
 
6261
      cmds=$old_postinstall_cmds
4468
6262
      save_ifs="$IFS"; IFS='~'
4469
6263
      for cmd in $cmds; do
4470
6264
        IFS="$save_ifs"
 
6265
        eval cmd=\"$cmd\"
4471
6266
        $show "$cmd"
4472
6267
        $run eval "$cmd" || exit $?
4473
6268
      done
4481
6276
    if test -n "$current_libdirs"; then
4482
6277
      # Maybe just do a dry run.
4483
6278
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4484
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
6279
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
4485
6280
    else
4486
 
      exit 0
 
6281
      exit $EXIT_SUCCESS
4487
6282
    fi
4488
6283
    ;;
4489
6284
 
4502
6297
      for libdir in $libdirs; do
4503
6298
        if test -n "$finish_cmds"; then
4504
6299
          # Do each command in the finish commands.
4505
 
          eval cmds=\"$finish_cmds\"
 
6300
          cmds=$finish_cmds
4506
6301
          save_ifs="$IFS"; IFS='~'
4507
6302
          for cmd in $cmds; do
4508
6303
            IFS="$save_ifs"
 
6304
            eval cmd=\"$cmd\"
4509
6305
            $show "$cmd"
4510
6306
            $run eval "$cmd" || admincmds="$admincmds
4511
6307
       $cmd"
4522
6318
    fi
4523
6319
 
4524
6320
    # Exit here if they wanted silent mode.
4525
 
    test "$show" = ":" && exit 0
 
6321
    test "$show" = : && exit $EXIT_SUCCESS
4526
6322
 
4527
 
    echo "----------------------------------------------------------------------"
4528
 
    echo "Libraries have been installed in:"
 
6323
    $echo "X----------------------------------------------------------------------" | $Xsed
 
6324
    $echo "Libraries have been installed in:"
4529
6325
    for libdir in $libdirs; do
4530
 
      echo "   $libdir"
 
6326
      $echo "   $libdir"
4531
6327
    done
4532
 
    echo
4533
 
    echo "If you ever happen to want to link against installed libraries"
4534
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4535
 
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4536
 
    echo "flag during linking and do at least one of the following:"
 
6328
    $echo
 
6329
    $echo "If you ever happen to want to link against installed libraries"
 
6330
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
6331
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
6332
    $echo "flag during linking and do at least one of the following:"
4537
6333
    if test -n "$shlibpath_var"; then
4538
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4539
 
      echo "     during execution"
 
6334
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
6335
      $echo "     during execution"
4540
6336
    fi
4541
6337
    if test -n "$runpath_var"; then
4542
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4543
 
      echo "     during linking"
 
6338
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
6339
      $echo "     during linking"
4544
6340
    fi
4545
6341
    if test -n "$hardcode_libdir_flag_spec"; then
4546
6342
      libdir=LIBDIR
4547
6343
      eval flag=\"$hardcode_libdir_flag_spec\"
4548
6344
 
4549
 
      echo "   - use the \`$flag' linker flag"
 
6345
      $echo "   - use the \`$flag' linker flag"
4550
6346
    fi
4551
6347
    if test -n "$admincmds"; then
4552
 
      echo "   - have your system administrator run these commands:$admincmds"
 
6348
      $echo "   - have your system administrator run these commands:$admincmds"
4553
6349
    fi
4554
6350
    if test -f /etc/ld.so.conf; then
4555
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
6351
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4556
6352
    fi
4557
 
    echo
4558
 
    echo "See any operating system documentation about shared libraries for"
4559
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4560
 
    echo "----------------------------------------------------------------------"
4561
 
    exit 0
 
6353
    $echo
 
6354
    $echo "See any operating system documentation about shared libraries for"
 
6355
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
6356
    $echo "X----------------------------------------------------------------------" | $Xsed
 
6357
    exit $EXIT_SUCCESS
4562
6358
    ;;
4563
6359
 
4564
6360
  # libtool execute mode
4570
6366
    if test -z "$cmd"; then
4571
6367
      $echo "$modename: you must specify a COMMAND" 1>&2
4572
6368
      $echo "$help"
4573
 
      exit 1
 
6369
      exit $EXIT_FAILURE
4574
6370
    fi
4575
6371
 
4576
6372
    # Handle -dlopen flags immediately.
4578
6374
      if test ! -f "$file"; then
4579
6375
        $echo "$modename: \`$file' is not a file" 1>&2
4580
6376
        $echo "$help" 1>&2
4581
 
        exit 1
 
6377
        exit $EXIT_FAILURE
4582
6378
      fi
4583
6379
 
4584
6380
      dir=
4585
6381
      case $file in
4586
6382
      *.la)
4587
6383
        # Check to see that this really is a libtool archive.
4588
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
6384
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4589
6385
        else
4590
6386
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4591
6387
          $echo "$help" 1>&2
4592
 
          exit 1
 
6388
          exit $EXIT_FAILURE
4593
6389
        fi
4594
6390
 
4595
6391
        # Read the libtool library.
4615
6411
        if test -f "$dir/$objdir/$dlname"; then
4616
6412
          dir="$dir/$objdir"
4617
6413
        else
4618
 
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4619
 
          exit 1
 
6414
          if test ! -f "$dir/$dlname"; then
 
6415
            $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
 
6416
            exit $EXIT_FAILURE
 
6417
          fi
4620
6418
        fi
4621
6419
        ;;
4622
6420
 
4656
6454
      -*) ;;
4657
6455
      *)
4658
6456
        # Do a test to see if this is really a libtool program.
4659
 
        if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6457
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4660
6458
          # If there is no directory component, then add one.
4661
6459
          case $file in
4662
6460
          */* | *\\*) . $file ;;
4679
6477
        eval "export $shlibpath_var"
4680
6478
      fi
4681
6479
 
4682
 
      # Restore saved enviroment variables
4683
 
      if test "${save_LC_ALL+set}" = set; then
4684
 
        LC_ALL="$save_LC_ALL"; export LC_ALL
4685
 
      fi
4686
 
      if test "${save_LANG+set}" = set; then
4687
 
        LANG="$save_LANG"; export LANG
4688
 
      fi
 
6480
      # Restore saved environment variables
 
6481
      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
6482
      do
 
6483
        eval "if test \"\${save_$lt_var+set}\" = set; then
 
6484
                $lt_var=\$save_$lt_var; export $lt_var
 
6485
              fi"
 
6486
      done
4689
6487
 
4690
6488
      # Now prepare to actually exec the command.
4691
6489
      exec_cmd="\$cmd$args"
4696
6494
        $echo "export $shlibpath_var"
4697
6495
      fi
4698
6496
      $echo "$cmd$args"
4699
 
      exit 0
 
6497
      exit $EXIT_SUCCESS
4700
6498
    fi
4701
6499
    ;;
4702
6500
 
4724
6522
    if test -z "$rm"; then
4725
6523
      $echo "$modename: you must specify an RM program" 1>&2
4726
6524
      $echo "$help" 1>&2
4727
 
      exit 1
 
6525
      exit $EXIT_FAILURE
4728
6526
    fi
4729
6527
 
4730
6528
    rmdirs=
4731
6529
 
 
6530
    origobjdir="$objdir"
4732
6531
    for file in $files; do
4733
6532
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4734
6533
      if test "X$dir" = "X$file"; then
4735
6534
        dir=.
4736
 
        objdir="$objdir"
 
6535
        objdir="$origobjdir"
4737
6536
      else
4738
 
        objdir="$dir/$objdir"
 
6537
        objdir="$dir/$origobjdir"
4739
6538
      fi
4740
6539
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4741
 
      test $mode = uninstall && objdir="$dir"
 
6540
      test "$mode" = uninstall && objdir="$dir"
4742
6541
 
4743
6542
      # Remember objdir for removal later, being careful to avoid duplicates
4744
 
      if test $mode = clean; then
 
6543
      if test "$mode" = clean; then
4745
6544
        case " $rmdirs " in
4746
6545
          *" $objdir "*) ;;
4747
6546
          *) rmdirs="$rmdirs $objdir" ;;
4765
6564
      case $name in
4766
6565
      *.la)
4767
6566
        # Possibly a libtool archive, so verify it.
4768
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6567
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4769
6568
          . $dir/$name
4770
6569
 
4771
6570
          # Delete the libtool libraries and symlinks.
4773
6572
            rmfiles="$rmfiles $objdir/$n"
4774
6573
          done
4775
6574
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4776
 
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4777
6575
 
4778
 
          if test $mode = uninstall; then
 
6576
          case "$mode" in
 
6577
          clean)
 
6578
            case "  $library_names " in
 
6579
            # "  " in the beginning catches empty $dlname
 
6580
            *" $dlname "*) ;;
 
6581
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6582
            esac
 
6583
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6584
            ;;
 
6585
          uninstall)
4779
6586
            if test -n "$library_names"; then
4780
6587
              # Do each command in the postuninstall commands.
4781
 
              eval cmds=\"$postuninstall_cmds\"
 
6588
              cmds=$postuninstall_cmds
4782
6589
              save_ifs="$IFS"; IFS='~'
4783
6590
              for cmd in $cmds; do
4784
6591
                IFS="$save_ifs"
 
6592
                eval cmd=\"$cmd\"
4785
6593
                $show "$cmd"
4786
6594
                $run eval "$cmd"
4787
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6595
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4788
6596
                  exit_status=1
4789
6597
                fi
4790
6598
              done
4793
6601
 
4794
6602
            if test -n "$old_library"; then
4795
6603
              # Do each command in the old_postuninstall commands.
4796
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6604
              cmds=$old_postuninstall_cmds
4797
6605
              save_ifs="$IFS"; IFS='~'
4798
6606
              for cmd in $cmds; do
4799
6607
                IFS="$save_ifs"
 
6608
                eval cmd=\"$cmd\"
4800
6609
                $show "$cmd"
4801
6610
                $run eval "$cmd"
4802
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6611
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4803
6612
                  exit_status=1
4804
6613
                fi
4805
6614
              done
4806
6615
              IFS="$save_ifs"
4807
6616
            fi
4808
6617
            # FIXME: should reinstall the best remaining shared library.
4809
 
          fi
 
6618
            ;;
 
6619
          esac
4810
6620
        fi
4811
6621
        ;;
4812
6622
 
4813
6623
      *.lo)
4814
 
        if test "$build_old_libs" = yes; then
4815
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4816
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6624
        # Possibly a libtool object, so verify it.
 
6625
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6626
 
 
6627
          # Read the .lo file
 
6628
          . $dir/$name
 
6629
 
 
6630
          # Add PIC object to the list of files to remove.
 
6631
          if test -n "$pic_object" \
 
6632
             && test "$pic_object" != none; then
 
6633
            rmfiles="$rmfiles $dir/$pic_object"
 
6634
          fi
 
6635
 
 
6636
          # Add non-PIC object to the list of files to remove.
 
6637
          if test -n "$non_pic_object" \
 
6638
             && test "$non_pic_object" != none; then
 
6639
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6640
          fi
4817
6641
        fi
4818
6642
        ;;
4819
6643
 
4820
6644
      *)
4821
 
        # Do a test to see if this is a libtool program.
4822
 
        if test $mode = clean &&
4823
 
           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4824
 
          relink_command=
4825
 
          . $dir/$file
 
6645
        if test "$mode" = clean ; then
 
6646
          noexename=$name
 
6647
          case $file in
 
6648
          *.exe)
 
6649
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6650
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6651
            # $file with .exe has already been added to rmfiles,
 
6652
            # add $file without .exe
 
6653
            rmfiles="$rmfiles $file"
 
6654
            ;;
 
6655
          esac
 
6656
          # Do a test to see if this is a libtool program.
 
6657
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6658
            relink_command=
 
6659
            . $dir/$noexename
4826
6660
 
4827
 
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4828
 
          if test "$fast_install" = yes && test -n "$relink_command"; then
4829
 
            rmfiles="$rmfiles $objdir/lt-$name"
 
6661
            # note $name still contains .exe if it was in $file originally
 
6662
            # as does the version of $file that was added into $rmfiles
 
6663
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6664
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6665
              rmfiles="$rmfiles $objdir/lt-$name"
 
6666
            fi
 
6667
            if test "X$noexename" != "X$name" ; then
 
6668
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6669
            fi
4830
6670
          fi
4831
6671
        fi
4832
6672
        ;;
4834
6674
      $show "$rm $rmfiles"
4835
6675
      $run $rm $rmfiles || exit_status=1
4836
6676
    done
 
6677
    objdir="$origobjdir"
4837
6678
 
4838
6679
    # Try to remove the ${objdir}s in the directories where we deleted files
4839
6680
    for dir in $rmdirs; do
4849
6690
  "")
4850
6691
    $echo "$modename: you must specify a MODE" 1>&2
4851
6692
    $echo "$generic_help" 1>&2
4852
 
    exit 1
 
6693
    exit $EXIT_FAILURE
4853
6694
    ;;
4854
6695
  esac
4855
6696
 
4856
6697
  if test -z "$exec_cmd"; then
4857
6698
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
4858
6699
    $echo "$generic_help" 1>&2
4859
 
    exit 1
 
6700
    exit $EXIT_FAILURE
4860
6701
  fi
4861
6702
fi # test -z "$show_help"
4862
6703
 
4863
6704
if test -n "$exec_cmd"; then
4864
6705
  eval exec $exec_cmd
4865
 
  exit 1
 
6706
  exit $EXIT_FAILURE
4866
6707
fi
4867
6708
 
4868
6709
# We need to display help for each of the modes.
4881
6722
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4882
6723
    --quiet           same as \`--silent'
4883
6724
    --silent          don't print informational messages
 
6725
    --tag=TAG         use configuration variables from tag TAG
4884
6726
    --version         print version information
4885
6727
 
4886
6728
MODE must be one of the following:
4894
6736
      uninstall       remove libraries from an installed directory
4895
6737
 
4896
6738
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4897
 
a more detailed description of MODE."
4898
 
  exit 0
 
6739
a more detailed description of MODE.
 
6740
 
 
6741
Report bugs to <bug-libtool@gnu.org>."
 
6742
  exit $EXIT_SUCCESS
4899
6743
  ;;
4900
6744
 
4901
6745
clean)
4996
6840
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
4997
6841
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4998
6842
  -export-symbols SYMFILE
4999
 
                    try to export only the symbols listed in SYMFILE
 
6843
                    try to export only the symbols listed in SYMFILE
5000
6844
  -export-symbols-regex REGEX
5001
 
                    try to export only the symbols matching REGEX
 
6845
                    try to export only the symbols matching REGEX
5002
6846
  -LLIBDIR          search LIBDIR for required installed libraries
5003
6847
  -lNAME            OUTPUT-FILE requires the installed library libNAME
5004
6848
  -module           build a library that can dlopened
5006
6850
  -no-install       link a not-installable executable
5007
6851
  -no-undefined     declare that a library does not refer to external symbols
5008
6852
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6853
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6854
  -precious-files-regex REGEX
 
6855
                    don't remove output files matching REGEX
5009
6856
  -release RELEASE  specify package release information
5010
6857
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5011
6858
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5012
 
  -static           do not do any dynamic linking of libtool libraries
 
6859
  -static           do not do any dynamic linking of uninstalled libtool libraries
 
6860
  -static-libtool-libs
 
6861
                    do not do any dynamic linking of libtool libraries
5013
6862
  -version-info CURRENT[:REVISION[:AGE]]
5014
 
                    specify library version info [each variable defaults to 0]
 
6863
                    specify library version info [each variable defaults to 0]
5015
6864
 
5016
6865
All other options (arguments beginning with \`-') are ignored.
5017
6866
 
5047
6896
*)
5048
6897
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5049
6898
  $echo "$help" 1>&2
5050
 
  exit 1
 
6899
  exit $EXIT_FAILURE
5051
6900
  ;;
5052
6901
esac
5053
6902
 
5054
 
echo
 
6903
$echo
5055
6904
$echo "Try \`$modename --help' for more information about other modes."
5056
6905
 
5057
 
exit 0
 
6906
exit $?
 
6907
 
 
6908
# The TAGs below are defined such that we never get into a situation
 
6909
# in which we disable both kinds of libraries.  Given conflicting
 
6910
# choices, we go for a static library, that is the most portable,
 
6911
# since we can't tell whether shared libraries were disabled because
 
6912
# the user asked for that or because the platform doesn't support
 
6913
# them.  This is particularly important on AIX, because we don't
 
6914
# support having both static and shared libraries enabled at the same
 
6915
# time on that platform, so we default to a shared-only configuration.
 
6916
# If a disable-shared tag is given, we'll fallback to a static-only
 
6917
# configuration.  But we'll never go from static-only to shared-only.
 
6918
 
 
6919
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6920
disable_libs=shared
 
6921
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6922
 
 
6923
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6924
disable_libs=static
 
6925
# ### END LIBTOOL TAG CONFIG: disable-static
5058
6926
 
5059
6927
# Local Variables:
5060
6928
# mode:shell-script