~ubuntu-branches/ubuntu/trusty/xserver-xorg-input-elographics/trusty-proposed

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Stone
  • Date: 2005-12-19 08:55:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051219085512-zuedypd3anm59i9i
Tags: 1:1.0.0.4-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ltmain.sh - Provide generalized library-building support services.
2
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
3
#
4
 
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5
5
# Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
17
17
#
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program; if not, write to the Free Software
20
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
21
#
22
22
# As a special exception to the GNU General Public License, if you
23
23
# distribute this file as part of a program that contains a
24
24
# configuration script generated by Autoconf, you may include it under
25
25
# the same distribution terms that you use for the rest of that program.
26
26
 
27
 
basename="s,^.*/,,g"
28
 
 
29
 
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30
 
# is ksh but when the shell is invoked as "sh" and the current value of
31
 
# the _XPG environment variable is not equal to 1 (one), the special
32
 
# positional parameter $0, within a function call, is the name of the
33
 
# function.
34
 
progpath="$0"
35
 
 
36
 
# The name of this program:
37
 
progname=`echo "$progpath" | $SED $basename`
38
 
modename="$progname"
39
 
 
40
 
# Global variables:
41
 
EXIT_SUCCESS=0
42
 
EXIT_FAILURE=1
43
 
 
44
 
PROGRAM=ltmain.sh
45
 
PACKAGE=libtool
46
 
VERSION=1.5.18
47
 
TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)"
48
 
 
49
 
# See if we are running on zsh, and set the options which allow our
50
 
# commands through without removal of \ escapes.
51
 
if test -n "${ZSH_VERSION+set}" ; then
52
 
  setopt NO_GLOB_SUBST
53
 
fi
54
 
 
55
27
# Check that we have a working $echo.
56
28
if test "X$1" = X--no-reexec; then
57
29
  # Discard the --no-reexec flag, and continue.
64
36
  :
65
37
else
66
38
  # Restart under the correct shell, and then maybe $echo will work.
67
 
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
 
39
  exec $SHELL "$0" --no-reexec ${1+"$@"}
68
40
fi
69
41
 
70
42
if test "X$1" = X--fallback-echo; then
73
45
  cat <<EOF
74
46
$*
75
47
EOF
76
 
  exit $EXIT_SUCCESS
 
48
  exit 0
77
49
fi
78
50
 
 
51
# define SED for historic ltconfig's generated by Libtool 1.3
 
52
test -z "$SED" && SED=sed
 
53
 
 
54
# The name of this program.
 
55
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
 
56
modename="$progname"
 
57
 
 
58
# Constants.
 
59
PROGRAM=ltmain.sh
 
60
PACKAGE=libtool
 
61
VERSION=1.5.2
 
62
TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)"
 
63
 
79
64
default_mode=
80
65
help="Try \`$progname --help' for more information."
81
66
magic="%%%MAGIC variable%%%"
112
97
fi
113
98
 
114
99
# Make sure IFS has a sensible default
115
 
lt_nl='
116
 
'
117
 
IFS="   $lt_nl"
 
100
: ${IFS="       
 
101
"}
118
102
 
119
103
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
120
104
  $echo "$modename: not configured to build any kind of library" 1>&2
121
105
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
122
 
  exit $EXIT_FAILURE
 
106
  exit 1
123
107
fi
124
108
 
125
109
# Global variables.
133
117
execute_dlfiles=
134
118
lo2o="s/\\.lo\$/.${objext}/"
135
119
o2lo="s/\\.${objext}\$/.lo/"
136
 
quote_scanset='[[~#^*{};<>?'"'"'        ]'
 
120
 
 
121
if test -z "$max_cmd_len"; then
 
122
  i=0
 
123
  testring="ABCD"
 
124
  new_result=
 
125
  
 
126
  # If test is not a shell built-in, we'll probably end up computing a
 
127
  # maximum length that is only half of the actual maximum length, but
 
128
  # we can't tell.
 
129
  while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
 
130
             = "XX$testring") >/dev/null 2>&1 &&
 
131
          new_result=`expr "X$testring" : ".*" 2>&1` &&
 
132
          max_cmd_len="$new_result" &&
 
133
          test $i != 17 # 1/2 MB should be enough
 
134
  do
 
135
    i=`expr $i + 1`
 
136
    testring="$testring$testring"
 
137
  done
 
138
  testring=
 
139
  # Add a significant safety factor because C++ compilers can tack on massive
 
140
  # amounts of additional arguments before passing them to the linker.
 
141
  # It appears as though 1/2 is a usable value.
 
142
  max_cmd_len=`expr $max_cmd_len \/ 2`
 
143
fi
137
144
 
138
145
#####################################
139
146
# Shell function definitions:
140
147
# This seems to be the best place for them
141
148
 
142
 
# func_win32_libid arg
143
 
# return the library type of file 'arg'
144
 
#
145
149
# Need a lot of goo to handle *both* DLLs and import libs
146
150
# Has to be a shell function in order to 'eat' the argument
147
151
# that is supplied when $file_magic_command is called.
148
 
func_win32_libid ()
149
 
{
 
152
win32_libid () {
150
153
  win32_libid_type="unknown"
151
154
  win32_fileres=`file -L $1 2>/dev/null`
152
155
  case $win32_fileres in
155
158
    ;;
156
159
  *ar\ archive*) # could be an import, or static
157
160
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
158
 
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
161
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
159
162
      win32_nmres=`eval $NM -f posix -A $1 | \
160
163
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
161
164
      if test "X$win32_nmres" = "Ximport" ; then
165
168
      fi
166
169
    fi
167
170
    ;;
168
 
  *DLL*)
 
171
  *DLL*) 
169
172
    win32_libid_type="x86 DLL"
170
173
    ;;
171
174
  *executable*) # but shell scripts are "executable" too...
179
182
  $echo $win32_libid_type
180
183
}
181
184
 
182
 
 
183
 
# func_infer_tag arg
184
 
# Infer tagged configuration to use if any are available and
185
 
# if one wasn't chosen via the "--tag" command line option.
186
 
# Only attempt this if the compiler in the base compile
187
 
# command doesn't match the default compiler.
188
 
# arg is usually of the form 'gcc ...'
189
 
func_infer_tag ()
190
 
{
191
 
    if test -n "$available_tags" && test -z "$tagname"; then
192
 
      CC_quoted=
193
 
      for arg in $CC; do
194
 
        case $arg in
195
 
          *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
196
 
          arg="\"$arg\""
197
 
          ;;
198
 
        esac
199
 
        CC_quoted="$CC_quoted $arg"
200
 
      done
201
 
      case $@ in
202
 
      # Blanks in the command may have been stripped by the calling shell,
203
 
      # but not from the CC environment variable when configure was run.
204
 
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
205
 
      # Blanks at the start of $base_compile will cause this to fail
206
 
      # if we don't check for them as well.
207
 
      *)
208
 
        for z in $available_tags; do
209
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
210
 
            # Evaluate the configuration.
211
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
212
 
            CC_quoted=
213
 
            for arg in $CC; do
214
 
            # Double-quote args containing other shell metacharacters.
215
 
            case $arg in
216
 
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
217
 
              arg="\"$arg\""
218
 
              ;;
219
 
            esac
220
 
            CC_quoted="$CC_quoted $arg"
221
 
          done
222
 
            case "$@ " in
223
 
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
224
 
              # The compiler in the base compile command matches
225
 
              # the one in the tagged configuration.
226
 
              # Assume this is the tagged configuration we want.
227
 
              tagname=$z
228
 
              break
229
 
              ;;
230
 
            esac
231
 
          fi
232
 
        done
233
 
        # If $tagname still isn't set, then no tagged configuration
234
 
        # was found and let the user know that the "--tag" command
235
 
        # line option must be used.
236
 
        if test -z "$tagname"; then
237
 
          $echo "$modename: unable to infer tagged configuration"
238
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
239
 
          exit $EXIT_FAILURE
240
 
#        else
241
 
#          $echo "$modename: using $tagname tagged configuration"
242
 
        fi
243
 
        ;;
244
 
      esac
245
 
    fi
246
 
}
247
 
 
248
 
 
249
 
# func_extract_an_archive dir oldlib
250
 
func_extract_an_archive ()
251
 
{
252
 
    f_ex_an_ar_dir="$1"; shift
253
 
    f_ex_an_ar_oldlib="$1"
254
 
 
255
 
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
256
 
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
257
 
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
258
 
     :
259
 
    else
260
 
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
261
 
      exit $EXIT_FAILURE
262
 
    fi
263
 
}
264
 
 
265
 
# func_extract_archives gentop oldlib ...
266
 
func_extract_archives ()
267
 
{
268
 
    my_gentop="$1"; shift
269
 
    my_oldlibs=${1+"$@"}
270
 
    my_oldobjs=""
271
 
    my_xlib=""
272
 
    my_xabs=""
273
 
    my_xdir=""
274
 
    my_status=""
275
 
 
276
 
    $show "${rm}r $my_gentop"
277
 
    $run ${rm}r "$my_gentop"
278
 
    $show "$mkdir $my_gentop"
279
 
    $run $mkdir "$my_gentop"
280
 
    my_status=$?
281
 
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
282
 
      exit $my_status
283
 
    fi
284
 
 
285
 
    for my_xlib in $my_oldlibs; do
286
 
      # Extract the objects.
287
 
      case $my_xlib in
288
 
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
289
 
        *) my_xabs=`pwd`"/$my_xlib" ;;
290
 
      esac
291
 
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
292
 
      my_xdir="$my_gentop/$my_xlib"
293
 
 
294
 
      $show "${rm}r $my_xdir"
295
 
      $run ${rm}r "$my_xdir"
296
 
      $show "$mkdir $my_xdir"
297
 
      $run $mkdir "$my_xdir"
298
 
      status=$?
299
 
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
300
 
        exit $status
301
 
      fi
302
 
      case $host in
303
 
      *-darwin*)
304
 
        $show "Extracting $my_xabs"
305
 
        # Do not bother doing anything if just a dry run
306
 
        if test -z "$run"; then
307
 
          darwin_orig_dir=`pwd`
308
 
          cd $my_xdir || exit $?
309
 
          darwin_archive=$my_xabs
310
 
          darwin_curdir=`pwd`
311
 
          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
312
 
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
313
 
          if test -n "$darwin_arches"; then 
314
 
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
315
 
            darwin_arch=
316
 
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
317
 
            for darwin_arch in  $darwin_arches ; do
318
 
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
319
 
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
320
 
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
321
 
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
322
 
              cd "$darwin_curdir"
323
 
              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
324
 
            done # $darwin_arches
325
 
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
326
 
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
327
 
            darwin_file=
328
 
            darwin_files=
329
 
            for darwin_file in $darwin_filelist; do
330
 
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
331
 
              lipo -create -output "$darwin_file" $darwin_files
332
 
            done # $darwin_filelist
333
 
            ${rm}r unfat-$$
334
 
            cd "$darwin_orig_dir"
335
 
          else
336
 
            cd "$darwin_orig_dir"
337
 
            func_extract_an_archive "$my_xdir" "$my_xabs"
338
 
          fi # $darwin_arches
339
 
        fi # $run
340
 
      ;;
341
 
      *)
342
 
        func_extract_an_archive "$my_xdir" "$my_xabs"
343
 
        ;;
344
 
      esac
345
 
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
346
 
    done
347
 
    func_extract_archives_result="$my_oldobjs"
348
 
}
349
185
# End of Shell function definitions
350
186
#####################################
351
187
 
352
 
# Darwin sucks
353
 
eval std_shrext=\"$shrext_cmds\"
354
 
 
355
188
# Parse our command line options once, thoroughly.
356
189
while test "$#" -gt 0
357
190
do
377
210
      case $tagname in
378
211
      *[!-_A-Za-z0-9,/]*)
379
212
        $echo "$progname: invalid tag name: $tagname" 1>&2
380
 
        exit $EXIT_FAILURE
 
213
        exit 1
381
214
        ;;
382
215
      esac
383
216
 
387
220
        # not specially marked.
388
221
        ;;
389
222
      *)
390
 
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
 
223
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
391
224
          taglist="$taglist $tagname"
392
225
          # Evaluate the configuration.
393
 
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
 
226
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
394
227
        else
395
228
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
396
229
        fi
416
249
  --version)
417
250
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
418
251
    $echo
419
 
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
 
252
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
420
253
    $echo "This is free software; see the source for copying conditions.  There is NO"
421
254
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
422
 
    exit $?
 
255
    exit 0
423
256
    ;;
424
257
 
425
258
  --config)
426
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
 
259
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
427
260
    # Now print the configurations for the tags.
428
261
    for tagname in $taglist; do
429
 
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
 
262
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
430
263
    done
431
 
    exit $?
 
264
    exit 0
432
265
    ;;
433
266
 
434
267
  --debug)
453
286
    else
454
287
      $echo "disable static libraries"
455
288
    fi
456
 
    exit $?
 
289
    exit 0
457
290
    ;;
458
291
 
459
292
  --finish) mode="finish" ;;
484
317
  -*)
485
318
    $echo "$modename: unrecognized option \`$arg'" 1>&2
486
319
    $echo "$help" 1>&2
487
 
    exit $EXIT_FAILURE
 
320
    exit 1
488
321
    ;;
489
322
 
490
323
  *)
497
330
if test -n "$prevopt"; then
498
331
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
499
332
  $echo "$help" 1>&2
500
 
  exit $EXIT_FAILURE
 
333
  exit 1
501
334
fi
502
335
 
503
336
# If this variable is set in any of the actions, the command in it
510
343
  # Infer the operation mode.
511
344
  if test -z "$mode"; then
512
345
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
513
 
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
 
346
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
514
347
    case $nonopt in
515
348
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
516
349
      mode=link
553
386
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
554
387
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
555
388
    $echo "$help" 1>&2
556
 
    exit $EXIT_FAILURE
 
389
    exit 1
557
390
  fi
558
391
 
559
392
  # Change the help message to a mode-specific one.
595
428
        -o)
596
429
          if test -n "$libobj" ; then
597
430
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
598
 
            exit $EXIT_FAILURE
 
431
            exit 1
599
432
          fi
600
433
          arg_mode=target
601
434
          continue
620
453
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
621
454
          lastarg=
622
455
          save_ifs="$IFS"; IFS=','
623
 
          for arg in $args; do
 
456
          for arg in $args; do
624
457
            IFS="$save_ifs"
625
458
 
626
459
            # Double-quote args containing other shell metacharacters.
627
460
            # Many Bourne shells cannot handle close brackets correctly
628
461
            # in scan sets, so we specify it separately.
629
462
            case $arg in
630
 
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
463
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
631
464
              arg="\"$arg\""
632
465
              ;;
633
466
            esac
658
491
      case $lastarg in
659
492
      # Double-quote args containing other shell metacharacters.
660
493
      # Many Bourne shells cannot handle close brackets correctly
661
 
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
662
 
      # in scan sets (worked around with variable expansion),
663
 
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
664
 
      # at all, so we specify them separately.
665
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
494
      # in scan sets, so we specify it separately.
 
495
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
666
496
        lastarg="\"$lastarg\""
667
497
        ;;
668
498
      esac
673
503
    case $arg_mode in
674
504
    arg)
675
505
      $echo "$modename: you must specify an argument for -Xcompile"
676
 
      exit $EXIT_FAILURE
 
506
      exit 1
677
507
      ;;
678
508
    target)
679
509
      $echo "$modename: you must specify a target with \`-o'" 1>&2
680
 
      exit $EXIT_FAILURE
 
510
      exit 1
681
511
      ;;
682
512
    *)
683
513
      # Get the name of the library object.
710
540
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
711
541
    *)
712
542
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
713
 
      exit $EXIT_FAILURE
 
543
      exit 1
714
544
      ;;
715
545
    esac
716
546
 
717
 
    func_infer_tag $base_compile
 
547
    # Infer tagged configuration to use if any are available and
 
548
    # if one wasn't chosen via the "--tag" command line option.
 
549
    # Only attempt this if the compiler in the base compile
 
550
    # command doesn't match the default compiler.
 
551
    if test -n "$available_tags" && test -z "$tagname"; then
 
552
      case $base_compile in
 
553
      # Blanks in the command may have been stripped by the calling shell,
 
554
      # but not from the CC environment variable when configure was run.
 
555
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
 
556
      # Blanks at the start of $base_compile will cause this to fail
 
557
      # if we don't check for them as well.
 
558
      *)
 
559
        for z in $available_tags; do
 
560
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
 
561
            # Evaluate the configuration.
 
562
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
 
563
            case "$base_compile " in
 
564
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
 
565
              # The compiler in the base compile command matches
 
566
              # the one in the tagged configuration.
 
567
              # Assume this is the tagged configuration we want.
 
568
              tagname=$z
 
569
              break
 
570
              ;;
 
571
            esac
 
572
          fi
 
573
        done
 
574
        # If $tagname still isn't set, then no tagged configuration
 
575
        # was found and let the user know that the "--tag" command
 
576
        # line option must be used.
 
577
        if test -z "$tagname"; then
 
578
          $echo "$modename: unable to infer tagged configuration"
 
579
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
580
          exit 1
 
581
#        else
 
582
#          $echo "$modename: using $tagname tagged configuration"
 
583
        fi
 
584
        ;;
 
585
      esac
 
586
    fi
718
587
 
719
588
    for arg in $later; do
720
589
      case $arg in
735
604
      esac
736
605
    done
737
606
 
738
 
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
739
 
    case $qlibobj in
740
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
741
 
        qlibobj="\"$qlibobj\"" ;;
742
 
    esac
743
 
    if test "X$libobj" != "X$qlibobj"; then
744
 
        $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
745
 
        exit $EXIT_FAILURE
746
 
    fi
747
607
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
748
608
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
749
609
    if test "X$xdir" = "X$obj"; then
756
616
    if test -z "$base_compile"; then
757
617
      $echo "$modename: you must specify a compilation command" 1>&2
758
618
      $echo "$help" 1>&2
759
 
      exit $EXIT_FAILURE
 
619
      exit 1
760
620
    fi
761
621
 
762
622
    # Delete any leftover library objects.
767
627
    fi
768
628
 
769
629
    $run $rm $removelist
770
 
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
 
630
    trap "$run $rm $removelist; exit 1" 1 2 15
771
631
 
772
632
    # On Cygwin there's no "real" PIC flag so we must build both object types
773
633
    case $host_os in
786
646
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
787
647
      lockfile="$output_obj.lock"
788
648
      removelist="$removelist $output_obj $lockfile"
789
 
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
 
649
      trap "$run $rm $removelist; exit 1" 1 2 15
790
650
    else
791
651
      output_obj=
792
652
      need_locks=no
796
656
    # Lock this critical section if it is needed
797
657
    # We use this script file to make the link, it avoids creating a new file
798
658
    if test "$need_locks" = yes; then
799
 
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
 
659
      until $run ln "$0" "$lockfile" 2>/dev/null; do
800
660
        $show "Waiting for $lockfile to be removed"
801
661
        sleep 2
802
662
      done
814
674
compiler."
815
675
 
816
676
        $run $rm $removelist
817
 
        exit $EXIT_FAILURE
 
677
        exit 1
818
678
      fi
819
 
      $echo "$srcfile" > "$lockfile"
 
679
      $echo $srcfile > "$lockfile"
820
680
    fi
821
681
 
822
682
    if test -n "$fix_srcfile_path"; then
823
683
      eval srcfile=\"$fix_srcfile_path\"
824
684
    fi
825
 
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
826
 
    case $qsrcfile in
827
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
828
 
      qsrcfile="\"$qsrcfile\"" ;;
829
 
    esac
830
685
 
831
686
    $run $rm "$libobj" "${libobj}T"
832
687
 
848
703
      fbsd_hideous_sh_bug=$base_compile
849
704
 
850
705
      if test "$pic_mode" != no; then
851
 
        command="$base_compile $qsrcfile $pic_flag"
 
706
        command="$base_compile $srcfile $pic_flag"
852
707
      else
853
708
        # Don't build PIC code
854
 
        command="$base_compile $qsrcfile"
 
709
        command="$base_compile $srcfile"
855
710
      fi
856
711
 
857
712
      if test ! -d "${xdir}$objdir"; then
874
729
      if $run eval "$command"; then :
875
730
      else
876
731
        test -n "$output_obj" && $run $rm $removelist
877
 
        exit $EXIT_FAILURE
 
732
        exit 1
878
733
      fi
879
734
 
880
735
      if test "$need_locks" = warn &&
894
749
compiler."
895
750
 
896
751
        $run $rm $removelist
897
 
        exit $EXIT_FAILURE
 
752
        exit 1
898
753
      fi
899
754
 
900
755
      # Just move the object if needed, then go on to compile the next one
931
786
    if test "$build_old_libs" = yes; then
932
787
      if test "$pic_mode" != yes; then
933
788
        # Don't build PIC code
934
 
        command="$base_compile $qsrcfile"
 
789
        command="$base_compile $srcfile"
935
790
      else
936
 
        command="$base_compile $qsrcfile $pic_flag"
 
791
        command="$base_compile $srcfile $pic_flag"
937
792
      fi
938
793
      if test "$compiler_c_o" = yes; then
939
794
        command="$command -o $obj"
946
801
      if $run eval "$command"; then :
947
802
      else
948
803
        $run $rm $removelist
949
 
        exit $EXIT_FAILURE
 
804
        exit 1
950
805
      fi
951
806
 
952
807
      if test "$need_locks" = warn &&
966
821
compiler."
967
822
 
968
823
        $run $rm $removelist
969
 
        exit $EXIT_FAILURE
 
824
        exit 1
970
825
      fi
971
826
 
972
827
      # Just move the object if needed
1004
859
      $run $rm "$lockfile"
1005
860
    fi
1006
861
 
1007
 
    exit $EXIT_SUCCESS
 
862
    exit 0
1008
863
    ;;
1009
864
 
1010
865
  # libtool link mode
1076
931
    vinfo=
1077
932
    vinfo_number=no
1078
933
 
1079
 
    func_infer_tag $base_compile
 
934
    # Infer tagged configuration to use if any are available and
 
935
    # if one wasn't chosen via the "--tag" command line option.
 
936
    # Only attempt this if the compiler in the base link
 
937
    # command doesn't match the default compiler.
 
938
    if test -n "$available_tags" && test -z "$tagname"; then
 
939
      case $base_compile in
 
940
      # Blanks in the command may have been stripped by the calling shell,
 
941
      # but not from the CC environment variable when configure was run.
 
942
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
 
943
      # Blanks at the start of $base_compile will cause this to fail
 
944
      # if we don't check for them as well.
 
945
      *)
 
946
        for z in $available_tags; do
 
947
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
 
948
            # Evaluate the configuration.
 
949
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
 
950
            case $base_compile in
 
951
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
 
952
              # The compiler in $compile_command matches
 
953
              # the one in the tagged configuration.
 
954
              # Assume this is the tagged configuration we want.
 
955
              tagname=$z
 
956
              break
 
957
              ;;
 
958
            esac
 
959
          fi
 
960
        done
 
961
        # If $tagname still isn't set, then no tagged configuration
 
962
        # was found and let the user know that the "--tag" command
 
963
        # line option must be used.
 
964
        if test -z "$tagname"; then
 
965
          $echo "$modename: unable to infer tagged configuration"
 
966
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
967
          exit 1
 
968
#       else
 
969
#         $echo "$modename: using $tagname tagged configuration"
 
970
        fi
 
971
        ;;
 
972
      esac
 
973
    fi
1080
974
 
1081
975
    # We need to know -static, to get the right output filenames.
1082
976
    for arg
1111
1005
      arg="$1"
1112
1006
      shift
1113
1007
      case $arg in
1114
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1008
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
1115
1009
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1116
1010
        ;;
1117
1011
      *) qarg=$arg ;;
1172
1066
          export_symbols="$arg"
1173
1067
          if test ! -f "$arg"; then
1174
1068
            $echo "$modename: symbol file \`$arg' does not exist"
1175
 
            exit $EXIT_FAILURE
 
1069
            exit 1
1176
1070
          fi
1177
1071
          prev=
1178
1072
          continue
1224
1118
                   test "$pic_object" = none && \
1225
1119
                   test "$non_pic_object" = none; then
1226
1120
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1227
 
                  exit $EXIT_FAILURE
 
1121
                  exit 1
1228
1122
                fi
1229
1123
 
1230
1124
                # Extract subdirectory from the argument.
1277
1171
                # Only an error if not doing a dry-run.
1278
1172
                if test -z "$run"; then
1279
1173
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1280
 
                  exit $EXIT_FAILURE
 
1174
                  exit 1
1281
1175
                else
1282
1176
                  # Dry-run case.
1283
1177
 
1298
1192
            done
1299
1193
          else
1300
1194
            $echo "$modename: link input file \`$save_arg' does not exist"
1301
 
            exit $EXIT_FAILURE
 
1195
            exit 1
1302
1196
          fi
1303
1197
          arg=$save_arg
1304
1198
          prev=
1310
1204
          [\\/]* | [A-Za-z]:[\\/]*) ;;
1311
1205
          *)
1312
1206
            $echo "$modename: only absolute run-paths are allowed" 1>&2
1313
 
            exit $EXIT_FAILURE
 
1207
            exit 1
1314
1208
            ;;
1315
1209
          esac
1316
1210
          if test "$prev" = rpath; then
1350
1244
          finalize_command="$finalize_command $qarg"
1351
1245
          continue
1352
1246
          ;;
1353
 
        shrext)
1354
 
          shrext_cmds="$arg"
1355
 
          prev=
1356
 
          continue
1357
 
          ;;
1358
 
        darwin_framework)
1359
 
          compiler_flags="$compiler_flags $arg"
1360
 
          compile_command="$compile_command $arg"
1361
 
          finalize_command="$finalize_command $arg"
1362
 
          prev=
1363
 
          continue
1364
 
          ;;
1365
1247
        *)
1366
1248
          eval "$prev=\"\$arg\""
1367
1249
          prev=
1410
1292
      -export-symbols | -export-symbols-regex)
1411
1293
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1412
1294
          $echo "$modename: more than one -exported-symbols argument is not allowed"
1413
 
          exit $EXIT_FAILURE
 
1295
          exit 1
1414
1296
        fi
1415
1297
        if test "X$arg" = "X-export-symbols"; then
1416
1298
          prev=expsyms
1420
1302
        continue
1421
1303
        ;;
1422
1304
 
1423
 
      -framework)
1424
 
        prev=darwin_framework
1425
 
        compiler_flags="$compiler_flags $arg"
1426
 
        compile_command="$compile_command $arg"
1427
 
        finalize_command="$finalize_command $arg"
1428
 
        continue
1429
 
        ;;
1430
 
 
1431
1305
      -inst-prefix-dir)
1432
1306
        prev=inst_prefix
1433
1307
        continue
1454
1328
          absdir=`cd "$dir" && pwd`
1455
1329
          if test -z "$absdir"; then
1456
1330
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1457
 
            exit $EXIT_FAILURE
 
1331
            exit 1
1458
1332
          fi
1459
1333
          dir="$absdir"
1460
1334
          ;;
1488
1362
            # These systems don't actually have a C library (as such)
1489
1363
            test "X$arg" = "X-lc" && continue
1490
1364
            ;;
1491
 
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
1365
          *-*-openbsd* | *-*-freebsd*)
1492
1366
            # Do not include libc due to us having libc/libc_r.
1493
1367
            test "X$arg" = "X-lc" && continue
1494
1368
            ;;
1499
1373
          esac
1500
1374
        elif test "X$arg" = "X-lc_r"; then
1501
1375
         case $host in
1502
 
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
1376
         *-*-openbsd* | *-*-freebsd*)
1503
1377
           # Do not include libc_r directly, use -pthread flag.
1504
1378
           continue
1505
1379
           ;;
1509
1383
        continue
1510
1384
        ;;
1511
1385
 
1512
 
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
1513
 
      # classes, name mangling, and exception handling.
1514
 
      -model)
1515
 
        compile_command="$compile_command $arg"
1516
 
        compiler_flags="$compiler_flags $arg"
1517
 
        finalize_command="$finalize_command $arg"
1518
 
        prev=xcompiler
1519
 
        continue
1520
 
        ;;
1521
 
 
1522
1386
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1523
 
        compiler_flags="$compiler_flags $arg"
1524
 
        compile_command="$compile_command $arg"
1525
 
        finalize_command="$finalize_command $arg"
 
1387
        deplibs="$deplibs $arg"
1526
1388
        continue
1527
1389
        ;;
1528
1390
 
1531
1393
        continue
1532
1394
        ;;
1533
1395
 
1534
 
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1535
 
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
1536
 
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1537
 
      # +DA*, +DD* enable 64-bit mode on the HP compiler
1538
 
      # -q* pass through compiler args for the IBM compiler
1539
 
      # -m* pass through architecture-specific compiler args for GCC
1540
 
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
1541
 
 
 
1396
      # gcc -m* arguments should be passed to the linker via $compiler_flags
 
1397
      # in order to pass architecture information to the linker
 
1398
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
 
1399
      # but this is not reliable with gcc because gcc may use -mfoo to
 
1400
      # select a different linker, different libraries, etc, while
 
1401
      # -Wl,-mfoo simply passes -mfoo to the linker.
 
1402
      -m*)
1542
1403
        # Unknown arguments in both finalize_command and compile_command need
1543
1404
        # to be aesthetically quoted because they are evaled later.
1544
1405
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1545
1406
        case $arg in
1546
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1407
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1547
1408
          arg="\"$arg\""
1548
1409
          ;;
1549
1410
        esac
1618
1479
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1619
1480
        *)
1620
1481
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1621
 
          exit $EXIT_FAILURE
 
1482
          exit 1
1622
1483
          ;;
1623
1484
        esac
1624
1485
        case "$xrpath " in
1659
1520
        for flag in $args; do
1660
1521
          IFS="$save_ifs"
1661
1522
          case $flag in
1662
 
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1523
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1663
1524
            flag="\"$flag\""
1664
1525
            ;;
1665
1526
          esac
1677
1538
        for flag in $args; do
1678
1539
          IFS="$save_ifs"
1679
1540
          case $flag in
1680
 
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1541
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1681
1542
            flag="\"$flag\""
1682
1543
            ;;
1683
1544
          esac
1704
1565
        continue
1705
1566
        ;;
1706
1567
 
 
1568
      -Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread )
 
1569
        compiler_flags="$compiler_flags $arg"
 
1570
        continue
 
1571
        ;;
 
1572
 
1707
1573
      # Some other compiler flag.
1708
1574
      -* | +*)
1709
1575
        # Unknown arguments in both finalize_command and compile_command need
1710
1576
        # to be aesthetically quoted because they are evaled later.
1711
1577
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1712
1578
        case $arg in
1713
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1579
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1714
1580
          arg="\"$arg\""
1715
1581
          ;;
1716
1582
        esac
1741
1607
             test "$pic_object" = none && \
1742
1608
             test "$non_pic_object" = none; then
1743
1609
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1744
 
            exit $EXIT_FAILURE
 
1610
            exit 1
1745
1611
          fi
1746
1612
 
1747
1613
          # Extract subdirectory from the argument.
1794
1660
          # Only an error if not doing a dry-run.
1795
1661
          if test -z "$run"; then
1796
1662
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1797
 
            exit $EXIT_FAILURE
 
1663
            exit 1
1798
1664
          else
1799
1665
            # Dry-run case.
1800
1666
 
1844
1710
        # to be aesthetically quoted because they are evaled later.
1845
1711
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1846
1712
        case $arg in
1847
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1713
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1848
1714
          arg="\"$arg\""
1849
1715
          ;;
1850
1716
        esac
1861
1727
    if test -n "$prev"; then
1862
1728
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1863
1729
      $echo "$help" 1>&2
1864
 
      exit $EXIT_FAILURE
 
1730
      exit 1
1865
1731
    fi
1866
1732
 
1867
1733
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1905
1771
    "")
1906
1772
      $echo "$modename: you must specify an output file" 1>&2
1907
1773
      $echo "$help" 1>&2
1908
 
      exit $EXIT_FAILURE
 
1774
      exit 1
1909
1775
      ;;
1910
1776
    *.$libext) linkmode=oldlib ;;
1911
1777
    *.lo | *.$objext) linkmode=obj ;;
1915
1781
 
1916
1782
    case $host in
1917
1783
    *cygwin* | *mingw* | *pw32*)
1918
 
      # don't eliminate duplications in $postdeps and $predeps
 
1784
      # don't eliminate duplcations in $postdeps and $predeps
1919
1785
      duplicate_compiler_generated_deps=yes
1920
1786
      ;;
1921
1787
    *)
1968
1834
          *.la) ;;
1969
1835
          *)
1970
1836
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1971
 
            exit $EXIT_FAILURE
 
1837
            exit 1
1972
1838
            ;;
1973
1839
          esac
1974
1840
        done
2011
1877
            compile_deplibs="$deplib $compile_deplibs"
2012
1878
            finalize_deplibs="$deplib $finalize_deplibs"
2013
1879
          else
2014
 
            compiler_flags="$compiler_flags $deplib"
 
1880
            deplibs="$deplib $deplibs"
2015
1881
          fi
2016
1882
          continue
2017
1883
          ;;
2020
1886
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2021
1887
            continue
2022
1888
          fi
 
1889
          if test "$pass" = conv; then
 
1890
            deplibs="$deplib $deplibs"
 
1891
            continue
 
1892
          fi
2023
1893
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2024
1894
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2025
 
            for search_ext in .la $std_shrext .so .a; do
 
1895
            for search_ext in .la $shrext .so .a; do
2026
1896
              # Search the libtool library
2027
1897
              lib="$searchdir/lib${name}${search_ext}"
2028
1898
              if test -f "$lib"; then
2098
1968
            fi
2099
1969
            if test "$pass" = scan; then
2100
1970
              deplibs="$deplib $deplibs"
 
1971
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2101
1972
            else
2102
1973
              compile_deplibs="$deplib $compile_deplibs"
2103
1974
              finalize_deplibs="$deplib $finalize_deplibs"
2104
1975
            fi
2105
 
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2106
1976
            ;;
2107
1977
          *)
2108
1978
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2130
2000
          fi
2131
2001
          case $linkmode in
2132
2002
          lib)
2133
 
            valid_a_lib=no
2134
 
            case $deplibs_check_method in
2135
 
              match_pattern*)
2136
 
                set dummy $deplibs_check_method
2137
 
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2138
 
                if eval $echo \"$deplib\" 2>/dev/null \
2139
 
                    | $SED 10q \
2140
 
                    | $EGREP "$match_pattern_regex" > /dev/null; then
2141
 
                  valid_a_lib=yes
2142
 
                fi
2143
 
                ;;
2144
 
              pass_all)
2145
 
                valid_a_lib=yes
2146
 
                ;;
2147
 
            esac
2148
 
            if test "$valid_a_lib" != yes; then
 
2003
            if test "$deplibs_check_method" != pass_all; then
2149
2004
              $echo
2150
2005
              $echo "*** Warning: Trying to link with static lib archive $deplib."
2151
2006
              $echo "*** I have the capability to make that library automatically link in when"
2196
2051
        if test "$found" = yes || test -f "$lib"; then :
2197
2052
        else
2198
2053
          $echo "$modename: cannot find the library \`$lib'" 1>&2
2199
 
          exit $EXIT_FAILURE
 
2054
          exit 1
2200
2055
        fi
2201
2056
 
2202
2057
        # Check to see that this really is a libtool archive.
2203
2058
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2204
2059
        else
2205
2060
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2206
 
          exit $EXIT_FAILURE
 
2061
          exit 1
2207
2062
        fi
2208
2063
 
2209
2064
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2219
2074
        # it will not redefine variables installed, or shouldnotlink
2220
2075
        installed=yes
2221
2076
        shouldnotlink=no
2222
 
        avoidtemprpath=
2223
 
 
2224
2077
 
2225
2078
        # Read the .la file
2226
2079
        case $lib in
2241
2094
          if test -z "$libdir"; then
2242
2095
            if test -z "$old_library"; then
2243
2096
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2244
 
              exit $EXIT_FAILURE
 
2097
              exit 1
2245
2098
            fi
2246
2099
            # It is a libtool convenience library, so add in its objects.
2247
2100
            convenience="$convenience $ladir/$objdir/$old_library"
2258
2111
            done
2259
2112
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2260
2113
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2261
 
            exit $EXIT_FAILURE
 
2114
            exit 1
2262
2115
          fi
2263
2116
          continue
2264
2117
        fi # $pass = conv
2265
2118
 
2266
 
 
 
2119
    
2267
2120
        # Get the name of the library we link against.
2268
2121
        linklib=
2269
2122
        for l in $old_library $library_names; do
2271
2124
        done
2272
2125
        if test -z "$linklib"; then
2273
2126
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2274
 
          exit $EXIT_FAILURE
 
2127
          exit 1
2275
2128
        fi
2276
2129
 
2277
2130
        # This library was specified with -dlopen.
2278
2131
        if test "$pass" = dlopen; then
2279
2132
          if test -z "$libdir"; then
2280
2133
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2281
 
            exit $EXIT_FAILURE
 
2134
            exit 1
2282
2135
          fi
2283
 
          if test -z "$dlname" ||
2284
 
             test "$dlopen_support" != yes ||
2285
 
             test "$build_libtool_libs" = no; then
 
2136
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2286
2137
            # If there is no dlname, no dlopen support or we're linking
2287
2138
            # statically, we need to preload.  We also need to preload any
2288
2139
            # dependent libraries so libltdl's deplib preloader doesn't
2319
2170
            dir="$libdir"
2320
2171
            absdir="$libdir"
2321
2172
          fi
2322
 
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2323
2173
        else
2324
 
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2325
 
            dir="$ladir"
2326
 
            absdir="$abs_ladir"
2327
 
            # Remove this search path later
2328
 
            notinst_path="$notinst_path $abs_ladir"
2329
 
          else
2330
 
            dir="$ladir/$objdir"
2331
 
            absdir="$abs_ladir/$objdir"
2332
 
            # Remove this search path later
2333
 
            notinst_path="$notinst_path $abs_ladir"
2334
 
          fi
 
2174
          dir="$ladir/$objdir"
 
2175
          absdir="$abs_ladir/$objdir"
 
2176
          # Remove this search path later
 
2177
          notinst_path="$notinst_path $abs_ladir"
2335
2178
        fi # $installed = yes
2336
2179
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2337
2180
 
2339
2182
        if test "$pass" = dlpreopen; then
2340
2183
          if test -z "$libdir"; then
2341
2184
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2342
 
            exit $EXIT_FAILURE
 
2185
            exit 1
2343
2186
          fi
2344
2187
          # Prefer using a static library (so that no silly _DYNAMIC symbols
2345
2188
          # are required to link).
2366
2209
          continue
2367
2210
        fi
2368
2211
 
2369
 
 
 
2212
    
2370
2213
        if test "$linkmode" = prog && test "$pass" != link; then
2371
2214
          newlib_search_path="$newlib_search_path $ladir"
2372
2215
          deplibs="$lib $deplibs"
2404
2247
          if test -n "$library_names" &&
2405
2248
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2406
2249
            # We need to hardcode the library path
2407
 
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 
2250
            if test -n "$shlibpath_var"; then
2408
2251
              # Make sure the rpath contains only unique directories.
2409
2252
              case "$temp_rpath " in
2410
2253
              *" $dir "*) ;;
2453
2296
            need_relink=yes
2454
2297
          fi
2455
2298
          # This is a shared library
2456
 
 
2457
 
          # Warn about portability, can't link against -module's on
2458
 
          # some systems (darwin)
2459
 
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2299
        
 
2300
      # Warn about portability, can't link against -module's on some systems (darwin)
 
2301
      if test "$shouldnotlink" = yes && test "$pass" = link ; then
2460
2302
            $echo
2461
2303
            if test "$linkmode" = prog; then
2462
2304
              $echo "*** Warning: Linking the executable $output against the loadable module"
2463
2305
            else
2464
2306
              $echo "*** Warning: Linking the shared library $output against the loadable module"
2465
2307
            fi
2466
 
            $echo "*** $linklib is not portable!"
2467
 
          fi
 
2308
            $echo "*** $linklib is not portable!"    
 
2309
      fi          
2468
2310
          if test "$linkmode" = lib &&
2469
2311
             test "$hardcode_into_libs" = yes; then
2470
2312
            # Hardcode the library path.
2562
2404
                case $host in
2563
2405
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2564
2406
                  *-*-darwin* )
2565
 
                    # if the lib is a module then we can not link against
2566
 
                    # it, someone is ignoring the new warnings I added
2567
 
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2407
                    # if the lib is a module then we can not link against it, someone
 
2408
                    # is ignoring the new warnings I added
 
2409
                    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2568
2410
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2569
2411
                      if test -z "$old_library" ; then
2570
2412
                        $echo
2572
2414
                        $echo "** The link will probably fail, sorry"
2573
2415
                      else
2574
2416
                        add="$dir/$old_library"
2575
 
                      fi
 
2417
                      fi 
2576
2418
                    fi
2577
2419
                esac
2578
2420
              elif test "$hardcode_minus_L" = no; then
2614
2456
 
2615
2457
            if test "$lib_linked" != yes; then
2616
2458
              $echo "$modename: configuration error: unsupported hardcode properties"
2617
 
              exit $EXIT_FAILURE
 
2459
              exit 1
2618
2460
            fi
2619
2461
 
2620
2462
            if test -n "$add_shlibpath"; then
2657
2499
              esac
2658
2500
              add="-l$name"
2659
2501
            elif test "$hardcode_automatic" = yes; then
2660
 
              if test -n "$inst_prefix_dir" &&
2661
 
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2502
              if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2662
2503
                add="$inst_prefix_dir$libdir/$linklib"
2663
2504
              else
2664
2505
                add="$libdir/$linklib"
2738
2579
 
2739
2580
        if test "$linkmode" = lib; then
2740
2581
          if test -n "$dependency_libs" &&
2741
 
             { test "$hardcode_into_libs" != yes ||
2742
 
               test "$build_old_libs" = yes ||
 
2582
             { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2743
2583
               test "$link_static" = yes; }; then
2744
2584
            # Extract -R from dependency_libs
2745
2585
            temp_deplibs=
2796
2636
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2797
2637
                  if test -z "$libdir"; then
2798
2638
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2799
 
                    exit $EXIT_FAILURE
 
2639
                    exit 1
2800
2640
                  fi
2801
2641
                  if test "$absdir" != "$libdir"; then
2802
2642
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2806
2646
                depdepl=
2807
2647
                case $host in
2808
2648
                *-*-darwin*)
2809
 
                  # we do not want to link against static libs,
2810
 
                  # but need to link against shared
 
2649
                  # we do not want to link against static libs, but need to link against shared
2811
2650
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2812
2651
                  if test -n "$deplibrary_names" ; then
2813
2652
                    for tmp in $deplibrary_names ; do
2815
2654
                    done
2816
2655
                    if test -f "$path/$depdepl" ; then
2817
2656
                      depdepl="$path/$depdepl"
2818
 
                    fi
 
2657
                   fi
2819
2658
                    # do not add paths which are already there
2820
2659
                    case " $newlib_search_path " in
2821
2660
                    *" $path "*) ;;
2825
2664
                  path=""
2826
2665
                  ;;
2827
2666
                *)
2828
 
                  path="-L$path"
2829
 
                  ;;
2830
 
                esac
2831
 
                ;;
2832
 
              -l*)
 
2667
                path="-L$path"
 
2668
                ;;
 
2669
                esac 
 
2670
                
 
2671
                ;;
 
2672
                  -l*)
2833
2673
                case $host in
2834
2674
                *-*-darwin*)
2835
 
                  # Again, we only want to link against shared libraries
2836
 
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2837
 
                  for tmp in $newlib_search_path ; do
2838
 
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
2839
 
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
2840
 
                      break
2841
 
                    fi
2842
 
                  done
2843
 
                  path=""
 
2675
                 # Again, we only want to link against shared libraries
 
2676
                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2677
                 for tmp in $newlib_search_path ; do
 
2678
                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2679
                       eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2680
                       break
 
2681
                     fi  
 
2682
         done
 
2683
         path=""
2844
2684
                  ;;
2845
2685
                *) continue ;;
2846
 
                esac
 
2686
                esac              
2847
2687
                ;;
2848
2688
              *) continue ;;
2849
2689
              esac
2850
2690
              case " $deplibs " in
 
2691
              *" $depdepl "*) ;;
 
2692
              *) deplibs="$deplibs $depdepl" ;;
 
2693
              esac            
 
2694
              case " $deplibs " in
2851
2695
              *" $path "*) ;;
2852
 
              *) deplibs="$path $deplibs" ;;
2853
 
              esac
2854
 
              case " $deplibs " in
2855
 
              *" $depdepl "*) ;;
2856
 
              *) deplibs="$depdepl $deplibs" ;;
 
2696
              *) deplibs="$deplibs $path" ;;
2857
2697
              esac
2858
2698
            done
2859
2699
          fi # link_all_deplibs != no
2940
2780
          eval $var=\"$tmp_libs\"
2941
2781
        done # for var
2942
2782
      fi
2943
 
      # Last step: remove runtime libs from dependency_libs
2944
 
      # (they stay in deplibs)
 
2783
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2945
2784
      tmp_libs=
2946
2785
      for i in $dependency_libs ; do
2947
2786
        case " $predeps $postdeps $compiler_lib_search_path " in
3001
2840
      case $outputname in
3002
2841
      lib*)
3003
2842
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3004
 
        eval shared_ext=\"$shrext_cmds\"
 
2843
        eval shared_ext=\"$shrext\"
3005
2844
        eval libname=\"$libname_spec\"
3006
2845
        ;;
3007
2846
      *)
3008
2847
        if test "$module" = no; then
3009
2848
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3010
2849
          $echo "$help" 1>&2
3011
 
          exit $EXIT_FAILURE
 
2850
          exit 1
3012
2851
        fi
3013
2852
        if test "$need_lib_prefix" != no; then
3014
2853
          # Add the "lib" prefix for modules if required
3015
2854
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3016
 
          eval shared_ext=\"$shrext_cmds\"
 
2855
          eval shared_ext=\"$shrext\"
3017
2856
          eval libname=\"$libname_spec\"
3018
2857
        else
3019
2858
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3024
2863
      if test -n "$objs"; then
3025
2864
        if test "$deplibs_check_method" != pass_all; then
3026
2865
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3027
 
          exit $EXIT_FAILURE
 
2866
          exit 1
3028
2867
        else
3029
2868
          $echo
3030
2869
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
3072
2911
        if test -n "$8"; then
3073
2912
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
3074
2913
          $echo "$help" 1>&2
3075
 
          exit $EXIT_FAILURE
 
2914
          exit 1
3076
2915
        fi
3077
2916
 
3078
2917
        # convert absolute version numbers to libtool ages
3079
2918
        # this retains compatibility with .la files and attempts
3080
2919
        # to make the code below a bit more comprehensible
3081
 
 
 
2920
        
3082
2921
        case $vinfo_number in
3083
2922
        yes)
3084
2923
          number_major="$2"
3118
2957
 
3119
2958
        # Check that each of the things are valid numbers.
3120
2959
        case $current in
3121
 
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 
2960
        [0-9]*) ;;
3122
2961
        *)
3123
 
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
 
2962
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3124
2963
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3125
 
          exit $EXIT_FAILURE
 
2964
          exit 1
3126
2965
          ;;
3127
2966
        esac
3128
2967
 
3129
2968
        case $revision in
3130
 
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 
2969
        [0-9]*) ;;
3131
2970
        *)
3132
 
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
 
2971
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3133
2972
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3134
 
          exit $EXIT_FAILURE
 
2973
          exit 1
3135
2974
          ;;
3136
2975
        esac
3137
2976
 
3138
2977
        case $age in
3139
 
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 
2978
        [0-9]*) ;;
3140
2979
        *)
3141
 
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
 
2980
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3142
2981
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3143
 
          exit $EXIT_FAILURE
 
2982
          exit 1
3144
2983
          ;;
3145
2984
        esac
3146
2985
 
3147
2986
        if test "$age" -gt "$current"; then
3148
2987
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3149
2988
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3150
 
          exit $EXIT_FAILURE
 
2989
          exit 1
3151
2990
        fi
3152
2991
 
3153
2992
        # Calculate the version variables.
3164
3003
          versuffix="$major.$age.$revision"
3165
3004
          # Darwin ld doesn't like 0 for these options...
3166
3005
          minor_current=`expr $current + 1`
3167
 
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
 
3006
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3168
3007
          ;;
3169
3008
 
3170
3009
        freebsd-aout)
3236
3075
        *)
3237
3076
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
3238
3077
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3239
 
          exit $EXIT_FAILURE
 
3078
          exit 1
3240
3079
          ;;
3241
3080
        esac
3242
3081
 
3290
3129
            *.$objext)
3291
3130
               ;;
3292
3131
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3293
 
               if test "X$precious_files_regex" != "X"; then
3294
 
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3295
 
                 then
3296
 
                   continue
3297
 
                 fi
 
3132
               if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3133
               then
 
3134
                 continue
3298
3135
               fi
3299
3136
               removelist="$removelist $p"
3300
3137
               ;;
3370
3207
          *-*-netbsd*)
3371
3208
            # Don't link with libc until the a.out ld.so is fixed.
3372
3209
            ;;
3373
 
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
3210
          *-*-openbsd* | *-*-freebsd*)
3374
3211
            # Do not include libc due to us having libc/libc_r.
3375
3212
            test "X$arg" = "X-lc" && continue
3376
3213
            ;;
3543
3380
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3544
3381
                        esac
3545
3382
                      done
 
3383
                      # It is ok to link against an archive when
 
3384
                      # building a shared library.
 
3385
                      if $AR -t $potlib > /dev/null 2>&1; then
 
3386
                        newdeplibs="$newdeplibs $a_deplib"
 
3387
                        a_deplib=""
 
3388
                        break 2
 
3389
                      fi
3546
3390
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3547
3391
                         | ${SED} 10q \
3548
3392
                         | $EGREP "$file_magic_regex" > /dev/null; then
3775
3619
        fi
3776
3620
 
3777
3621
        # Get the real and link names of the library.
3778
 
        eval shared_ext=\"$shrext_cmds\"
 
3622
        eval shared_ext=\"$shrext\"
3779
3623
        eval library_names=\"$library_names_spec\"
3780
3624
        set dummy $library_names
3781
3625
        realname="$2"
3839
3683
        for test_deplib in $deplibs; do
3840
3684
                case " $convenience " in
3841
3685
                *" $test_deplib "*) ;;
3842
 
                *)
 
3686
                *) 
3843
3687
                        tmp_deplibs="$tmp_deplibs $test_deplib"
3844
3688
                        ;;
3845
3689
                esac
3846
3690
        done
3847
 
        deplibs="$tmp_deplibs"
 
3691
        deplibs="$tmp_deplibs" 
3848
3692
 
3849
3693
        if test -n "$convenience"; then
3850
3694
          if test -n "$whole_archive_flag_spec"; then
3852
3696
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3853
3697
          else
3854
3698
            gentop="$output_objdir/${outputname}x"
 
3699
            $show "${rm}r $gentop"
 
3700
            $run ${rm}r "$gentop"
 
3701
            $show "$mkdir $gentop"
 
3702
            $run $mkdir "$gentop"
 
3703
            status=$?
 
3704
            if test "$status" -ne 0 && test ! -d "$gentop"; then
 
3705
              exit $status
 
3706
            fi
3855
3707
            generated="$generated $gentop"
3856
3708
 
3857
 
            func_extract_archives $gentop $convenience
3858
 
            libobjs="$libobjs $func_extract_archives_result"
 
3709
            for xlib in $convenience; do
 
3710
              # Extract the objects.
 
3711
              case $xlib in
 
3712
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
3713
              *) xabs=`pwd`"/$xlib" ;;
 
3714
              esac
 
3715
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
3716
              xdir="$gentop/$xlib"
 
3717
 
 
3718
              $show "${rm}r $xdir"
 
3719
              $run ${rm}r "$xdir"
 
3720
              $show "$mkdir $xdir"
 
3721
              $run $mkdir "$xdir"
 
3722
              status=$?
 
3723
              if test "$status" -ne 0 && test ! -d "$xdir"; then
 
3724
                exit $status
 
3725
              fi
 
3726
              # We will extract separately just the conflicting names and we will no
 
3727
              # longer touch any unique names. It is faster to leave these extract
 
3728
              # automatically by $AR in one run.
 
3729
              $show "(cd $xdir && $AR x $xabs)"
 
3730
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
3731
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
3732
                :
 
3733
              else
 
3734
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
3735
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
3736
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
3737
                do
 
3738
                  i=1
 
3739
                  while test "$i" -le "$count"
 
3740
                  do
 
3741
                   # Put our $i before any first dot (extension)
 
3742
                   # Never overwrite any file
 
3743
                   name_to="$name"
 
3744
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
3745
                   do
 
3746
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
3747
                   done
 
3748
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
3749
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
3750
                   i=`expr $i + 1`
 
3751
                  done
 
3752
                done
 
3753
              fi
 
3754
 
 
3755
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
3756
            done
3859
3757
          fi
3860
3758
        fi
3861
 
        
 
3759
 
3862
3760
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3863
3761
          eval flag=\"$thread_safe_flag_spec\"
3864
3762
          linker_flags="$linker_flags $flag"
3907
3805
            save_libobjs=$libobjs
3908
3806
          fi
3909
3807
          save_output=$output
3910
 
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
3911
3808
 
3912
3809
          # Clear the reloadable object creation command queue and
3913
3810
          # initialize k to one.
3917
3814
          delfiles=
3918
3815
          last_robj=
3919
3816
          k=1
3920
 
          output=$output_objdir/$output_la-${k}.$objext
 
3817
          output=$output_objdir/$save_output-${k}.$objext
3921
3818
          # Loop over the list of objects to be linked.
3922
3819
          for obj in $save_libobjs
3923
3820
          do
3937
3834
                # the last one created.
3938
3835
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3939
3836
              fi
3940
 
              last_robj=$output_objdir/$output_la-${k}.$objext
 
3837
              last_robj=$output_objdir/$save_output-${k}.$objext
3941
3838
              k=`expr $k + 1`
3942
 
              output=$output_objdir/$output_la-${k}.$objext
 
3839
              output=$output_objdir/$save_output-${k}.$objext
3943
3840
              objlist=$obj
3944
3841
              len=1
3945
3842
            fi
3959
3856
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3960
3857
          fi
3961
3858
 
3962
 
          # Set up a command to remove the reloadable object files
 
3859
          # Set up a command to remove the reloadale object files
3963
3860
          # after they are used.
3964
3861
          i=0
3965
3862
          while test "$i" -lt "$k"
3966
3863
          do
3967
3864
            i=`expr $i + 1`
3968
 
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
 
3865
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3969
3866
          done
3970
3867
 
3971
3868
          $echo "creating a temporary reloadable object file: $output"
3974
3871
          save_ifs="$IFS"; IFS='~'
3975
3872
          for cmd in $concat_cmds; do
3976
3873
            IFS="$save_ifs"
 
3874
            eval cmd=\"$cmd\"
3977
3875
            $show "$cmd"
3978
3876
            $run eval "$cmd" || exit $?
3979
3877
          done
4020
3918
        # Restore the uninstalled library and exit
4021
3919
        if test "$mode" = relink; then
4022
3920
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4023
 
          exit $EXIT_SUCCESS
 
3921
          exit 0
4024
3922
        fi
4025
3923
 
4026
3924
        # Create links to the real library.
4068
3966
      *.lo)
4069
3967
        if test -n "$objs$old_deplibs"; then
4070
3968
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4071
 
          exit $EXIT_FAILURE
 
3969
          exit 1
4072
3970
        fi
4073
3971
        libobj="$output"
4074
3972
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4097
3995
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4098
3996
        else
4099
3997
          gentop="$output_objdir/${obj}x"
 
3998
          $show "${rm}r $gentop"
 
3999
          $run ${rm}r "$gentop"
 
4000
          $show "$mkdir $gentop"
 
4001
          $run $mkdir "$gentop"
 
4002
          status=$?
 
4003
          if test "$status" -ne 0 && test ! -d "$gentop"; then
 
4004
            exit $status
 
4005
          fi
4100
4006
          generated="$generated $gentop"
4101
4007
 
4102
 
          func_extract_archives $gentop $convenience
4103
 
          reload_conv_objs="$reload_objs $func_extract_archives_result"
 
4008
          for xlib in $convenience; do
 
4009
            # Extract the objects.
 
4010
            case $xlib in
 
4011
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
4012
            *) xabs=`pwd`"/$xlib" ;;
 
4013
            esac
 
4014
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
4015
            xdir="$gentop/$xlib"
 
4016
 
 
4017
            $show "${rm}r $xdir"
 
4018
            $run ${rm}r "$xdir"
 
4019
            $show "$mkdir $xdir"
 
4020
            $run $mkdir "$xdir"
 
4021
            status=$?
 
4022
            if test "$status" -ne 0 && test ! -d "$xdir"; then
 
4023
              exit $status
 
4024
            fi
 
4025
            # We will extract separately just the conflicting names and we will no
 
4026
            # longer touch any unique names. It is faster to leave these extract
 
4027
            # automatically by $AR in one run.
 
4028
            $show "(cd $xdir && $AR x $xabs)"
 
4029
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
4030
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
4031
              :
 
4032
            else
 
4033
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
4034
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
4035
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
4036
              do
 
4037
                i=1
 
4038
                while test "$i" -le "$count"
 
4039
                do
 
4040
                 # Put our $i before any first dot (extension)
 
4041
                 # Never overwrite any file
 
4042
                 name_to="$name"
 
4043
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
4044
                 do
 
4045
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
4046
                 done
 
4047
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
4048
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
4049
                 i=`expr $i + 1`
 
4050
                done
 
4051
              done
 
4052
            fi
 
4053
 
 
4054
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
4055
          done
4104
4056
        fi
4105
4057
      fi
4106
4058
 
4125
4077
          $run ${rm}r $gentop
4126
4078
        fi
4127
4079
 
4128
 
        exit $EXIT_SUCCESS
 
4080
        exit 0
4129
4081
      fi
4130
4082
 
4131
4083
      if test "$build_libtool_libs" != yes; then
4138
4090
        # accidentally link it into a program.
4139
4091
        # $show "echo timestamp > $libobj"
4140
4092
        # $run eval "echo timestamp > $libobj" || exit $?
4141
 
        exit $EXIT_SUCCESS
 
4093
        exit 0
4142
4094
      fi
4143
4095
 
4144
4096
      if test -n "$pic_flag" || test "$pic_mode" != default; then
4161
4113
        $run ${rm}r $gentop
4162
4114
      fi
4163
4115
 
4164
 
      exit $EXIT_SUCCESS
 
4116
      exit 0
4165
4117
      ;;
4166
4118
 
4167
4119
    prog)
4362
4314
 
4363
4315
            # Prepare the list of exported symbols
4364
4316
            if test -z "$export_symbols"; then
4365
 
              export_symbols="$output_objdir/$outputname.exp"
 
4317
              export_symbols="$output_objdir/$output.exp"
4366
4318
              $run $rm $export_symbols
4367
4319
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4368
4320
            else
4369
 
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4370
 
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 
4321
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
 
4322
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4371
4323
              $run eval 'mv "$nlist"T "$nlist"'
4372
4324
            fi
4373
4325
          fi
4419
4371
#endif
4420
4372
 
4421
4373
/* The mapping between symbol names and symbols. */
4422
 
"
4423
 
 
4424
 
            case $host in
4425
 
            *cygwin* | *mingw* )
4426
 
          $echo >> "$output_objdir/$dlsyms" "\
4427
 
/* DATA imports from DLLs on WIN32 can't be const, because
4428
 
   runtime relocations are performed -- see ld's documentation
4429
 
   on pseudo-relocs */
4430
 
struct {
4431
 
"
4432
 
              ;;
4433
 
            * )
4434
 
          $echo >> "$output_objdir/$dlsyms" "\
4435
4374
const struct {
4436
 
"
4437
 
              ;;
4438
 
            esac
4439
 
 
4440
 
 
4441
 
          $echo >> "$output_objdir/$dlsyms" "\
4442
4375
  const char *name;
4443
4376
  lt_ptr address;
4444
4377
}
4498
4431
          ;;
4499
4432
        *)
4500
4433
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4501
 
          exit $EXIT_FAILURE
 
4434
          exit 1
4502
4435
          ;;
4503
4436
        esac
4504
4437
      else
4586
4519
        # Link the executable and exit
4587
4520
        $show "$link_command"
4588
4521
        $run eval "$link_command" || exit $?
4589
 
        exit $EXIT_SUCCESS
 
4522
        exit 0
4590
4523
      fi
4591
4524
 
4592
4525
      if test "$hardcode_action" = relink; then
4641
4574
      fi
4642
4575
 
4643
4576
      # Quote $echo for shipping.
4644
 
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4645
 
        case $progpath in
4646
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4647
 
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
 
4577
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
 
4578
        case $0 in
 
4579
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
 
4580
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4648
4581
        esac
4649
4582
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4650
4583
      else
4667
4600
        esac
4668
4601
        case $host in
4669
4602
          *cygwin* | *mingw* )
4670
 
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
 
4603
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4671
4604
            cwrapper=`$echo ${output}.exe`
4672
4605
            $rm $cwrappersource $cwrapper
4673
 
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4606
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4674
4607
 
4675
4608
            cat > $cwrappersource <<EOF
4676
4609
 
4679
4612
 
4680
4613
   The $output program cannot be directly executed until all the libtool
4681
4614
   libraries that it depends on are installed.
4682
 
 
 
4615
   
4683
4616
   This wrapper executable should never be moved out of the build directory.
4684
4617
   If it is, it will not operate correctly.
4685
4618
 
4711
4644
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4712
4645
  defined (__OS2__)
4713
4646
#define HAVE_DOS_BASED_FILE_SYSTEM
4714
 
#ifndef DIR_SEPARATOR_2
 
4647
#ifndef DIR_SEPARATOR_2 
4715
4648
#define DIR_SEPARATOR_2 '\\'
4716
4649
#endif
4717
4650
#endif
4742
4675
{
4743
4676
  char **newargz;
4744
4677
  int i;
4745
 
 
 
4678
  
4746
4679
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4747
4680
  newargz = XMALLOC(char *, argc+2);
4748
4681
EOF
4755
4688
  newargz[1] = fnqualify(argv[0]);
4756
4689
  /* we know the script has the same name, without the .exe */
4757
4690
  /* so make sure newargz[1] doesn't end in .exe */
4758
 
  strendzap(newargz[1],".exe");
 
4691
  strendzap(newargz[1],".exe"); 
4759
4692
  for (i = 1; i < argc; i++)
4760
4693
    newargz[i+1] = xstrdup(argv[i]);
4761
4694
  newargz[argc+1] = NULL;
4778
4711
  return p;
4779
4712
}
4780
4713
 
4781
 
char *
 
4714
char * 
4782
4715
xstrdup (const char *string)
4783
4716
{
4784
4717
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4792
4725
 
4793
4726
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4794
4727
  /* Skip over the disk name in MSDOS pathnames. */
4795
 
  if (isalpha (name[0]) && name[1] == ':')
 
4728
  if (isalpha (name[0]) && name[1] == ':') 
4796
4729
    name += 2;
4797
4730
#endif
4798
4731
 
4802
4735
  return (char *) base;
4803
4736
}
4804
4737
 
4805
 
char *
 
4738
char * 
4806
4739
fnqualify(const char *path)
4807
4740
{
4808
4741
  size_t size;
4830
4763
}
4831
4764
 
4832
4765
char *
4833
 
strendzap(char *str, const char *pat)
 
4766
strendzap(char *str, const char *pat) 
4834
4767
{
4835
4768
  size_t len, patlen;
4836
4769
 
4850
4783
}
4851
4784
 
4852
4785
static void
4853
 
lt_error_core (int exit_status, const char * mode,
 
4786
lt_error_core (int exit_status, const char * mode, 
4854
4787
          const char * message, va_list ap)
4855
4788
{
4856
4789
  fprintf (stderr, "%s: %s: ", program_name, mode);
4879
4812
          ;;
4880
4813
        esac
4881
4814
        $rm $output
4882
 
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
 
4815
        trap "$rm $output; exit 1" 1 2 15
4883
4816
 
4884
4817
        $echo > $output "\
4885
4818
#! $SHELL
4900
4833
 
4901
4834
# The HP-UX ksh and POSIX shell print the target directory to stdout
4902
4835
# if CDPATH is set.
4903
 
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
4836
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4904
4837
 
4905
4838
relink_command=\"$relink_command\"
4906
4839
 
4979
4912
      else
4980
4913
        $echo \"\$relink_command_output\" >&2
4981
4914
        $rm \"\$progdir/\$file\"
4982
 
        exit $EXIT_FAILURE
 
4915
        exit 1
4983
4916
      fi
4984
4917
    fi
4985
4918
 
5041
4974
        esac
5042
4975
        $echo >> $output "\
5043
4976
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5044
 
      exit $EXIT_FAILURE
 
4977
      exit 1
5045
4978
    fi
5046
4979
  else
5047
4980
    # The program doesn't exist.
5048
4981
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
5049
4982
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
5050
4983
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5051
 
    exit $EXIT_FAILURE
 
4984
    exit 1
5052
4985
  fi
5053
4986
fi\
5054
4987
"
5055
4988
        chmod +x $output
5056
4989
      fi
5057
 
      exit $EXIT_SUCCESS
 
4990
      exit 0
5058
4991
      ;;
5059
4992
    esac
5060
4993
 
5077
5010
 
5078
5011
      if test -n "$addlibs"; then
5079
5012
        gentop="$output_objdir/${outputname}x"
 
5013
        $show "${rm}r $gentop"
 
5014
        $run ${rm}r "$gentop"
 
5015
        $show "$mkdir $gentop"
 
5016
        $run $mkdir "$gentop"
 
5017
        status=$?
 
5018
        if test "$status" -ne 0 && test ! -d "$gentop"; then
 
5019
          exit $status
 
5020
        fi
5080
5021
        generated="$generated $gentop"
5081
5022
 
5082
 
        func_extract_archives $gentop $addlibs
5083
 
        oldobjs="$oldobjs $func_extract_archives_result"
 
5023
        # Add in members from convenience archives.
 
5024
        for xlib in $addlibs; do
 
5025
          # Extract the objects.
 
5026
          case $xlib in
 
5027
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
5028
          *) xabs=`pwd`"/$xlib" ;;
 
5029
          esac
 
5030
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
5031
          xdir="$gentop/$xlib"
 
5032
 
 
5033
          $show "${rm}r $xdir"
 
5034
          $run ${rm}r "$xdir"
 
5035
          $show "$mkdir $xdir"
 
5036
          $run $mkdir "$xdir"
 
5037
          status=$?
 
5038
          if test "$status" -ne 0 && test ! -d "$xdir"; then
 
5039
            exit $status
 
5040
          fi
 
5041
          # We will extract separately just the conflicting names and we will no
 
5042
          # longer touch any unique names. It is faster to leave these extract
 
5043
          # automatically by $AR in one run.
 
5044
          $show "(cd $xdir && $AR x $xabs)"
 
5045
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
5046
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
 
5047
            :
 
5048
          else
 
5049
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
 
5050
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
 
5051
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
 
5052
            do
 
5053
              i=1
 
5054
              while test "$i" -le "$count"
 
5055
              do
 
5056
               # Put our $i before any first dot (extension)
 
5057
               # Never overwrite any file
 
5058
               name_to="$name"
 
5059
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
 
5060
               do
 
5061
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
 
5062
               done
 
5063
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
 
5064
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
 
5065
               i=`expr $i + 1`
 
5066
              done
 
5067
            done
 
5068
          fi
 
5069
 
 
5070
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
 
5071
        done
5084
5072
      fi
5085
5073
 
5086
5074
      # Do each command in the archive commands.
5087
5075
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5088
5076
       cmds=$old_archive_from_new_cmds
5089
5077
      else
5090
 
        # POSIX demands no paths to be encoded in archives.  We have
5091
 
        # to avoid creating archives with duplicate basenames if we
5092
 
        # might have to extract them afterwards, e.g., when creating a
5093
 
        # static archive out of a convenience library, or when linking
5094
 
        # the entirety of a libtool archive into another (currently
5095
 
        # not supported by libtool).
5096
 
        if (for obj in $oldobjs
5097
 
            do
5098
 
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
5099
 
            done | sort | sort -uc >/dev/null 2>&1); then
5100
 
          :
5101
 
        else
5102
 
          $echo "copying selected object files to avoid basename conflicts..."
5103
 
 
5104
 
          if test -z "$gentop"; then
5105
 
            gentop="$output_objdir/${outputname}x"
5106
 
            generated="$generated $gentop"
5107
 
 
5108
 
            $show "${rm}r $gentop"
5109
 
            $run ${rm}r "$gentop"
5110
 
            $show "$mkdir $gentop"
5111
 
            $run $mkdir "$gentop"
5112
 
            status=$?
5113
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
5114
 
              exit $status
5115
 
            fi
5116
 
          fi
5117
 
 
5118
 
          save_oldobjs=$oldobjs
5119
 
          oldobjs=
5120
 
          counter=1
5121
 
          for obj in $save_oldobjs
5122
 
          do
5123
 
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5124
 
            case " $oldobjs " in
5125
 
            " ") oldobjs=$obj ;;
5126
 
            *[\ /]"$objbase "*)
5127
 
              while :; do
5128
 
                # Make sure we don't pick an alternate name that also
5129
 
                # overlaps.
5130
 
                newobj=lt$counter-$objbase
5131
 
                counter=`expr $counter + 1`
5132
 
                case " $oldobjs " in
5133
 
                *[\ /]"$newobj "*) ;;
5134
 
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5135
 
                esac
5136
 
              done
5137
 
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5138
 
              $run ln "$obj" "$gentop/$newobj" ||
5139
 
              $run cp "$obj" "$gentop/$newobj"
5140
 
              oldobjs="$oldobjs $gentop/$newobj"
5141
 
              ;;
5142
 
            *) oldobjs="$oldobjs $obj" ;;
5143
 
            esac
5144
 
          done
5145
 
        fi
5146
 
 
5147
5078
        eval cmds=\"$old_archive_cmds\"
5148
5079
 
5149
5080
        if len=`expr "X$cmds" : ".*"` &&
5157
5088
          objlist=
5158
5089
          concat_cmds=
5159
5090
          save_oldobjs=$oldobjs
5160
 
 
 
5091
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
 
5092
          # encoded into archives.  This makes 'ar r' malfunction in
 
5093
          # this piecewise linking case whenever conflicting object
 
5094
          # names appear in distinct ar calls; check, warn and compensate.
 
5095
            if (for obj in $save_oldobjs
 
5096
            do
 
5097
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5098
            done | sort | sort -uc >/dev/null 2>&1); then
 
5099
            :
 
5100
          else
 
5101
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
 
5102
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
 
5103
            AR_FLAGS=cq
 
5104
          fi
5161
5105
          # Is there a better way of finding the last object in the list?
5162
5106
          for obj in $save_oldobjs
5163
5107
          do
5164
5108
            last_oldobj=$obj
5165
 
          done
 
5109
          done  
5166
5110
          for obj in $save_oldobjs
5167
5111
          do
5168
5112
            oldobjs="$objlist $obj"
5176
5120
              oldobjs=$objlist
5177
5121
              if test "$obj" = "$last_oldobj" ; then
5178
5122
                RANLIB=$save_RANLIB
5179
 
              fi
 
5123
              fi  
5180
5124
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5181
5125
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5182
5126
              objlist=
5225
5169
        fi
5226
5170
      done
5227
5171
      # Quote the link command for shipping.
5228
 
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
 
5172
      relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5229
5173
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5230
5174
      if test "$hardcode_automatic" = yes ; then
5231
 
        relink_command=
5232
 
      fi
5233
 
 
5234
 
 
 
5175
        relink_command=
 
5176
      fi  
5235
5177
      # Only create the output if not a dry run.
5236
5178
      if test -z "$run"; then
5237
5179
        for installed in no yes; do
5249
5191
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5250
5192
                if test -z "$libdir"; then
5251
5193
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5252
 
                  exit $EXIT_FAILURE
5253
 
                fi
5254
 
                newdependency_libs="$newdependency_libs $libdir/$name"
5255
 
                ;;
5256
 
              *) newdependency_libs="$newdependency_libs $deplib" ;;
 
5194
                  exit 1
 
5195
                fi
 
5196
                # We do not want portage's install root ($D) present.  Check only for
 
5197
                # this if the .la is being installed.
 
5198
                if test "$installed" = yes && test "$D"; then
 
5199
                  eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
 
5200
                else
 
5201
                  mynewdependency_lib="$libdir/$name"
 
5202
                fi
 
5203
                # Do not add duplicates
 
5204
                if test "$mynewdependency_lib"; then
 
5205
                  if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
 
5206
                    newdependency_libs="$newdependency_libs $mynewdependency_lib"
 
5207
                  fi
 
5208
                fi
 
5209
                ;;
 
5210
                  *)
 
5211
                if test "$installed" = yes; then
 
5212
          # Rather use S=WORKDIR if our version of portage supports it.
 
5213
          # This is because some ebuild (gcc) do not use $S as buildroot.
 
5214
                  if test "$PWORKDIR"; then
 
5215
                    S="$PWORKDIR"
 
5216
                  fi
 
5217
                  # We do not want portage's build root ($S) present.
 
5218
                  if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
 
5219
                    mynewdependency_lib=""
 
5220
                  # We do not want portage's install root ($D) present.
 
5221
                  elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
 
5222
                    eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
 
5223
                  else
 
5224
                    mynewdependency_lib="$deplib"
 
5225
                  fi
 
5226
                else
 
5227
                  mynewdependency_lib="$deplib"
 
5228
                fi
 
5229
                # Do not add duplicates
 
5230
                if test "$mynewdependency_lib"; then
 
5231
                  if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
 
5232
                        newdependency_libs="$newdependency_libs $mynewdependency_lib"
 
5233
                  fi
 
5234
                fi
 
5235
                ;;
5257
5236
              esac
5258
5237
            done
5259
5238
            dependency_libs="$newdependency_libs"
5263
5242
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5264
5243
              if test -z "$libdir"; then
5265
5244
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5266
 
                exit $EXIT_FAILURE
 
5245
                exit 1
5267
5246
              fi
5268
5247
              newdlfiles="$newdlfiles $libdir/$name"
5269
5248
            done
5274
5253
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5275
5254
              if test -z "$libdir"; then
5276
5255
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5277
 
                exit $EXIT_FAILURE
 
5256
                exit 1
5278
5257
              fi
5279
5258
              newdlprefiles="$newdlprefiles $libdir/$name"
5280
5259
            done
5282
5261
          else
5283
5262
            newdlfiles=
5284
5263
            for lib in $dlfiles; do
5285
 
              case $lib in
 
5264
              case $lib in 
5286
5265
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5287
5266
                *) abs=`pwd`"/$lib" ;;
5288
5267
              esac
5291
5270
            dlfiles="$newdlfiles"
5292
5271
            newdlprefiles=
5293
5272
            for lib in $dlprefiles; do
5294
 
              case $lib in
 
5273
              case $lib in 
5295
5274
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5296
5275
                *) abs=`pwd`"/$lib" ;;
5297
5276
              esac
5305
5284
          case $host,$output,$installed,$module,$dlname in
5306
5285
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5307
5286
          esac
 
5287
          # Do not add duplicates
 
5288
          if test "$installed" = yes && test "$D"; then
 
5289
            install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
 
5290
          fi
5308
5291
          $echo > $output "\
5309
5292
# $outputname - a libtool library file
5310
5293
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5354
5337
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5355
5338
      ;;
5356
5339
    esac
5357
 
    exit $EXIT_SUCCESS
 
5340
    exit 0
5358
5341
    ;;
5359
5342
 
5360
5343
  # libtool install mode
5369
5352
      # Aesthetically quote it.
5370
5353
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5371
5354
      case $arg in
5372
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5355
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
5373
5356
        arg="\"$arg\""
5374
5357
        ;;
5375
5358
      esac
5385
5368
    # Aesthetically quote it.
5386
5369
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5387
5370
    case $arg in
5388
 
    *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5371
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
5389
5372
      arg="\"$arg\""
5390
5373
      ;;
5391
5374
    esac
5433
5416
      # Aesthetically quote the argument.
5434
5417
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5435
5418
      case $arg in
5436
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5419
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
5437
5420
        arg="\"$arg\""
5438
5421
        ;;
5439
5422
      esac
5443
5426
    if test -z "$install_prog"; then
5444
5427
      $echo "$modename: you must specify an install program" 1>&2
5445
5428
      $echo "$help" 1>&2
5446
 
      exit $EXIT_FAILURE
 
5429
      exit 1
5447
5430
    fi
5448
5431
 
5449
5432
    if test -n "$prev"; then
5450
5433
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5451
5434
      $echo "$help" 1>&2
5452
 
      exit $EXIT_FAILURE
 
5435
      exit 1
5453
5436
    fi
5454
5437
 
5455
5438
    if test -z "$files"; then
5459
5442
        $echo "$modename: you must specify a destination" 1>&2
5460
5443
      fi
5461
5444
      $echo "$help" 1>&2
5462
 
      exit $EXIT_FAILURE
 
5445
      exit 1
5463
5446
    fi
5464
5447
 
5465
5448
    # Strip any trailing slash from the destination.
5480
5463
      if test "$#" -gt 2; then
5481
5464
        $echo "$modename: \`$dest' is not a directory" 1>&2
5482
5465
        $echo "$help" 1>&2
5483
 
        exit $EXIT_FAILURE
 
5466
        exit 1
5484
5467
      fi
5485
5468
    fi
5486
5469
    case $destdir in
5492
5475
        *)
5493
5476
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5494
5477
          $echo "$help" 1>&2
5495
 
          exit $EXIT_FAILURE
 
5478
          exit 1
5496
5479
          ;;
5497
5480
        esac
5498
5481
      done
5521
5504
        else
5522
5505
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5523
5506
          $echo "$help" 1>&2
5524
 
          exit $EXIT_FAILURE
 
5507
          exit 1
5525
5508
        fi
5526
5509
 
5527
5510
        library_names=
5563
5546
          # but it's something to keep an eye on.
5564
5547
          if test "$inst_prefix_dir" = "$destdir"; then
5565
5548
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5566
 
            exit $EXIT_FAILURE
 
5549
            exit 1
5567
5550
          fi
5568
5551
 
5569
5552
          if test -n "$inst_prefix_dir"; then
5578
5561
          if $run eval "$relink_command"; then :
5579
5562
          else
5580
5563
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5581
 
            exit $EXIT_FAILURE
 
5564
            exit 1
5582
5565
          fi
5583
5566
        fi
5584
5567
 
5657
5640
        *)
5658
5641
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5659
5642
          $echo "$help" 1>&2
5660
 
          exit $EXIT_FAILURE
 
5643
          exit 1
5661
5644
          ;;
5662
5645
        esac
5663
5646
 
5675
5658
          $show "$install_prog $staticobj $staticdest"
5676
5659
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5677
5660
        fi
5678
 
        exit $EXIT_SUCCESS
 
5661
        exit 0
5679
5662
        ;;
5680
5663
 
5681
5664
      *)
5729
5712
          # Check the variables that should have been set.
5730
5713
          if test -z "$notinst_deplibs"; then
5731
5714
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5732
 
            exit $EXIT_FAILURE
 
5715
            exit 1
5733
5716
          fi
5734
5717
 
5735
5718
          finalize=yes
5770
5753
              tmpdir="/tmp"
5771
5754
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5772
5755
              tmpdir="$tmpdir/libtool-$$"
5773
 
              save_umask=`umask`
5774
 
              umask 0077
5775
 
              if $mkdir "$tmpdir"; then
5776
 
                umask $save_umask
 
5756
              if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
5777
5757
              else
5778
 
                umask $save_umask
5779
5758
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5780
5759
                continue
5781
5760
              fi
5858
5837
    if test -n "$current_libdirs"; then
5859
5838
      # Maybe just do a dry run.
5860
5839
      test -n "$run" && current_libdirs=" -n$current_libdirs"
5861
 
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
 
5840
      exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs'
5862
5841
    else
5863
 
      exit $EXIT_SUCCESS
 
5842
      exit 0
5864
5843
    fi
5865
5844
    ;;
5866
5845
 
5900
5879
    fi
5901
5880
 
5902
5881
    # Exit here if they wanted silent mode.
5903
 
    test "$show" = : && exit $EXIT_SUCCESS
 
5882
    test "$show" = : && exit 0
5904
5883
 
5905
5884
    $echo "----------------------------------------------------------------------"
5906
5885
    $echo "Libraries have been installed in:"
5936
5915
    $echo "See any operating system documentation about shared libraries for"
5937
5916
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5938
5917
    $echo "----------------------------------------------------------------------"
5939
 
    exit $EXIT_SUCCESS
 
5918
    exit 0
5940
5919
    ;;
5941
5920
 
5942
5921
  # libtool execute mode
5948
5927
    if test -z "$cmd"; then
5949
5928
      $echo "$modename: you must specify a COMMAND" 1>&2
5950
5929
      $echo "$help"
5951
 
      exit $EXIT_FAILURE
 
5930
      exit 1
5952
5931
    fi
5953
5932
 
5954
5933
    # Handle -dlopen flags immediately.
5956
5935
      if test ! -f "$file"; then
5957
5936
        $echo "$modename: \`$file' is not a file" 1>&2
5958
5937
        $echo "$help" 1>&2
5959
 
        exit $EXIT_FAILURE
 
5938
        exit 1
5960
5939
      fi
5961
5940
 
5962
5941
      dir=
5967
5946
        else
5968
5947
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5969
5948
          $echo "$help" 1>&2
5970
 
          exit $EXIT_FAILURE
 
5949
          exit 1
5971
5950
        fi
5972
5951
 
5973
5952
        # Read the libtool library.
5994
5973
          dir="$dir/$objdir"
5995
5974
        else
5996
5975
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5997
 
          exit $EXIT_FAILURE
 
5976
          exit 1
5998
5977
        fi
5999
5978
        ;;
6000
5979
 
6074
6053
        $echo "export $shlibpath_var"
6075
6054
      fi
6076
6055
      $echo "$cmd$args"
6077
 
      exit $EXIT_SUCCESS
 
6056
      exit 0
6078
6057
    fi
6079
6058
    ;;
6080
6059
 
6102
6081
    if test -z "$rm"; then
6103
6082
      $echo "$modename: you must specify an RM program" 1>&2
6104
6083
      $echo "$help" 1>&2
6105
 
      exit $EXIT_FAILURE
 
6084
      exit 1
6106
6085
    fi
6107
6086
 
6108
6087
    rmdirs=
6216
6195
        if test "$mode" = clean ; then
6217
6196
          noexename=$name
6218
6197
          case $file in
6219
 
          *.exe)
 
6198
          *.exe) 
6220
6199
            file=`$echo $file|${SED} 's,.exe$,,'`
6221
6200
            noexename=`$echo $name|${SED} 's,.exe$,,'`
6222
6201
            # $file with .exe has already been added to rmfiles,
6261
6240
  "")
6262
6241
    $echo "$modename: you must specify a MODE" 1>&2
6263
6242
    $echo "$generic_help" 1>&2
6264
 
    exit $EXIT_FAILURE
 
6243
    exit 1
6265
6244
    ;;
6266
6245
  esac
6267
6246
 
6268
6247
  if test -z "$exec_cmd"; then
6269
6248
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6270
6249
    $echo "$generic_help" 1>&2
6271
 
    exit $EXIT_FAILURE
 
6250
    exit 1
6272
6251
  fi
6273
6252
fi # test -z "$show_help"
6274
6253
 
6275
6254
if test -n "$exec_cmd"; then
6276
6255
  eval exec $exec_cmd
6277
 
  exit $EXIT_FAILURE
 
6256
  exit 1
6278
6257
fi
6279
6258
 
6280
6259
# We need to display help for each of the modes.
6310
6289
a more detailed description of MODE.
6311
6290
 
6312
6291
Report bugs to <bug-libtool@gnu.org>."
6313
 
  exit $EXIT_SUCCESS
 
6292
  exit 0
6314
6293
  ;;
6315
6294
 
6316
6295
clean)
6465
6444
*)
6466
6445
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6467
6446
  $echo "$help" 1>&2
6468
 
  exit $EXIT_FAILURE
 
6447
  exit 1
6469
6448
  ;;
6470
6449
esac
6471
6450
 
6472
6451
$echo
6473
6452
$echo "Try \`$modename --help' for more information about other modes."
6474
6453
 
6475
 
exit $?
 
6454
exit 0
6476
6455
 
6477
6456
# The TAGs below are defined such that we never get into a situation
6478
6457
# in which we disable both kinds of libraries.  Given conflicting