~ubuntu-branches/ubuntu/edgy/rxtx/edgy-201105201527

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Mario Joussen
  • Date: 2006-03-01 18:56:52 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20060301185652-qqaxmsc37np81hr3
Tags: upstream-2.1.7
ImportĀ upstreamĀ versionĀ 2.1.7

Show diffs side-by-side

added added

removed removed

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