~ubuntu-branches/debian/jessie/gsmlib/jessie

« back to all changes in this revision

Viewing changes to scripts/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2006-05-20 21:54:42 UTC
  • mfrom: (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20060520215442-nb9iiu95mzkqfejf
Tags: 1.10-10
FTBFS with G++ 4.1: extra qualifications (Closes: #356109)

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.20 Debian 1.5.20-2"
 
47
TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
 
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 X|tr X '\101'` in
 
92
 A) # ASCII based system
 
93
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
 
94
  SP2NL='tr \040 \012'
 
95
  NL2SP='tr \015\012 \040\040'
 
96
  ;;
 
97
 *) # EBCDIC based system
 
98
  SP2NL='tr \100 \n'
 
99
  NL2SP='tr \r\n \100\100'
 
100
  ;;
 
101
esac
74
102
 
75
103
# NLS nuisances.
76
104
# Only set LANG and LC_ALL to C if already set.
85
113
fi
86
114
 
87
115
# Make sure IFS has a sensible default
88
 
: ${IFS="       "}
 
116
lt_nl='
 
117
'
 
118
IFS="   $lt_nl"
89
119
 
90
120
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
 
121
  $echo "$modename: not configured to build any kind of library" 1>&2
 
122
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
123
  exit $EXIT_FAILURE
94
124
fi
95
125
 
96
126
# Global variables.
105
135
lo2o="s/\\.lo\$/.${objext}/"
106
136
o2lo="s/\\.${objext}\$/.lo/"
107
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
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
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
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
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\"
 
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
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
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
 
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.
398
665
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
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
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
741
        qlibobj="\"$qlibobj\"" ;;
 
742
    esac
 
743
    test "X$libobj" != "X$qlibobj" \
 
744
        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
 
745
        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
 
746
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
747
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
748
    if test "X$xdir" = "X$obj"; then
 
749
      xdir=
 
750
    else
 
751
      xdir=$xdir/
 
752
    fi
 
753
    lobj=${xdir}$objdir/$objname
 
754
 
450
755
    if test -z "$base_compile"; then
451
756
      $echo "$modename: you must specify a compilation command" 1>&2
452
757
      $echo "$help" 1>&2
453
 
      exit 1
 
758
      exit $EXIT_FAILURE
454
759
    fi
455
760
 
456
761
    # Delete any leftover library objects.
457
762
    if test "$build_old_libs" = yes; then
458
 
      removelist="$obj $libobj"
 
763
      removelist="$obj $lobj $libobj ${libobj}T"
459
764
    else
460
 
      removelist="$libobj"
 
765
      removelist="$lobj $libobj ${libobj}T"
461
766
    fi
462
767
 
463
768
    $run $rm $removelist
464
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
769
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
465
770
 
466
771
    # On Cygwin there's no "real" PIC flag so we must build both object types
467
772
    case $host_os in
480
785
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
481
786
      lockfile="$output_obj.lock"
482
787
      removelist="$removelist $output_obj $lockfile"
483
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
788
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
484
789
    else
 
790
      output_obj=
485
791
      need_locks=no
486
792
      lockfile=
487
793
    fi
489
795
    # Lock this critical section if it is needed
490
796
    # We use this script file to make the link, it avoids creating a new file
491
797
    if test "$need_locks" = yes; then
492
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
798
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
493
799
        $show "Waiting for $lockfile to be removed"
494
800
        sleep 2
495
801
      done
496
802
    elif test "$need_locks" = warn; then
497
803
      if test -f "$lockfile"; then
498
 
        echo "\
 
804
        $echo "\
499
805
*** ERROR, $lockfile exists and contains:
500
806
`cat $lockfile 2>/dev/null`
501
807
 
507
813
compiler."
508
814
 
509
815
        $run $rm $removelist
510
 
        exit 1
 
816
        exit $EXIT_FAILURE
511
817
      fi
512
 
      echo $srcfile > "$lockfile"
 
818
      $echo "$srcfile" > "$lockfile"
513
819
    fi
514
820
 
515
821
    if test -n "$fix_srcfile_path"; then
516
822
      eval srcfile=\"$fix_srcfile_path\"
517
823
    fi
 
824
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
 
825
    case $qsrcfile in
 
826
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
827
      qsrcfile="\"$qsrcfile\"" ;;
 
828
    esac
 
829
 
 
830
    $run $rm "$libobj" "${libobj}T"
 
831
 
 
832
    # Create a libtool object file (analogous to a ".la" file),
 
833
    # but don't create it if we're doing a dry run.
 
834
    test -z "$run" && cat > ${libobj}T <<EOF
 
835
# $libobj - a libtool object file
 
836
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
837
#
 
838
# Please DO NOT delete this file!
 
839
# It is necessary for linking the library.
 
840
 
 
841
# Name of the PIC object.
 
842
EOF
518
843
 
519
844
    # Only build a PIC object if we are building libtool libraries.
520
845
    if test "$build_libtool_libs" = yes; then
522
847
      fbsd_hideous_sh_bug=$base_compile
523
848
 
524
849
      if test "$pic_mode" != no; then
525
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
526
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
850
        command="$base_compile $qsrcfile $pic_flag"
527
851
      else
528
852
        # 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"
 
853
        command="$base_compile $qsrcfile"
 
854
      fi
 
855
 
 
856
      if test ! -d "${xdir}$objdir"; then
 
857
        $show "$mkdir ${xdir}$objdir"
 
858
        $run $mkdir ${xdir}$objdir
 
859
        status=$?
 
860
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
861
          exit $status
 
862
        fi
 
863
      fi
 
864
 
 
865
      if test -z "$output_obj"; then
 
866
        # Place PIC objects in $objdir
 
867
        command="$command -o $lobj"
 
868
      fi
 
869
 
 
870
      $run $rm "$lobj" "$output_obj"
 
871
 
562
872
      $show "$command"
563
873
      if $run eval "$command"; then :
564
874
      else
565
875
        test -n "$output_obj" && $run $rm $removelist
566
 
        exit 1
 
876
        exit $EXIT_FAILURE
567
877
      fi
568
878
 
569
879
      if test "$need_locks" = warn &&
570
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
571
 
        echo "\
 
880
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
881
        $echo "\
572
882
*** ERROR, $lockfile contains:
573
883
`cat $lockfile 2>/dev/null`
574
884
 
583
893
compiler."
584
894
 
585
895
        $run $rm $removelist
586
 
        exit 1
 
896
        exit $EXIT_FAILURE
587
897
      fi
588
898
 
589
899
      # 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
 
900
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
 
901
        $show "$mv $output_obj $lobj"
 
902
        if $run $mv $output_obj $lobj; then :
 
903
        else
 
904
          error=$?
 
905
          $run $rm $removelist
 
906
          exit $error
 
907
        fi
 
908
      fi
 
909
 
 
910
      # Append the name of the PIC object to the libtool object file.
 
911
      test -z "$run" && cat >> ${libobj}T <<EOF
 
912
pic_object='$objdir/$objname'
 
913
 
 
914
EOF
639
915
 
640
916
      # Allow error messages only from the first compilation.
641
 
      suppress_output=' >/dev/null 2>&1'
 
917
      if test "$suppress_opt" = yes; then
 
918
        suppress_output=' >/dev/null 2>&1'
 
919
      fi
 
920
    else
 
921
      # No PIC object so indicate it doesn't exist in the libtool
 
922
      # object file.
 
923
      test -z "$run" && cat >> ${libobj}T <<EOF
 
924
pic_object=none
 
925
 
 
926
EOF
642
927
    fi
643
928
 
644
929
    # Only build a position-dependent object if we build old libraries.
645
930
    if test "$build_old_libs" = yes; then
646
931
      if test "$pic_mode" != yes; then
647
932
        # Don't build PIC code
648
 
        command="$base_compile $srcfile"
 
933
        command="$base_compile $qsrcfile"
649
934
      else
650
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
651
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
935
        command="$base_compile $qsrcfile $pic_flag"
652
936
      fi
653
937
      if test "$compiler_c_o" = yes; then
654
938
        command="$command -o $obj"
655
 
        output_obj="$obj"
656
939
      fi
657
940
 
658
941
      # Suppress compiler output if we already did a PIC compilation.
659
942
      command="$command$suppress_output"
660
 
      $run $rm "$output_obj"
 
943
      $run $rm "$obj" "$output_obj"
661
944
      $show "$command"
662
945
      if $run eval "$command"; then :
663
946
      else
664
947
        $run $rm $removelist
665
 
        exit 1
 
948
        exit $EXIT_FAILURE
666
949
      fi
667
950
 
668
951
      if test "$need_locks" = warn &&
669
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
670
 
        echo "\
 
952
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
953
        $echo "\
671
954
*** ERROR, $lockfile contains:
672
955
`cat $lockfile 2>/dev/null`
673
956
 
682
965
compiler."
683
966
 
684
967
        $run $rm $removelist
685
 
        exit 1
 
968
        exit $EXIT_FAILURE
686
969
      fi
687
970
 
688
971
      # Just move the object if needed
689
 
      if test x"$output_obj" != x"$obj"; then
 
972
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
690
973
        $show "$mv $output_obj $obj"
691
974
        if $run $mv $output_obj $obj; then :
692
975
        else
696
979
        fi
697
980
      fi
698
981
 
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
 
982
      # Append the name of the non-PIC object the libtool object file.
 
983
      # Only append if the libtool object file exists.
 
984
      test -z "$run" && cat >> ${libobj}T <<EOF
 
985
# Name of the non-PIC object.
 
986
non_pic_object='$objname'
 
987
 
 
988
EOF
 
989
    else
 
990
      # Append the name of the non-PIC object the libtool object file.
 
991
      # Only append if the libtool object file exists.
 
992
      test -z "$run" && cat >> ${libobj}T <<EOF
 
993
# Name of the non-PIC object.
 
994
non_pic_object=none
 
995
 
 
996
EOF
714
997
    fi
715
998
 
 
999
    $run $mv "${libobj}T" "${libobj}"
 
1000
 
716
1001
    # Unlock the critical section if it was locked
717
1002
    if test "$need_locks" != no; then
718
1003
      $run $rm "$lockfile"
719
1004
    fi
720
1005
 
721
 
    exit 0
 
1006
    exit $EXIT_SUCCESS
722
1007
    ;;
723
1008
 
724
1009
  # libtool link mode
729
1014
      # It is impossible to link a dll without this setting, and
730
1015
      # we shouldn't force the makefile maintainer to figure out
731
1016
      # which system we are compiling for in order to pass an extra
732
 
      # flag for every libtool invokation.
 
1017
      # flag for every libtool invocation.
733
1018
      # allow_undefined=no
734
1019
 
735
1020
      # FIXME: Unfortunately, there are problems with the above when trying
744
1029
      ;;
745
1030
    esac
746
1031
    libtool_args="$nonopt"
 
1032
    base_compile="$nonopt $@"
747
1033
    compile_command="$nonopt"
748
1034
    finalize_command="$nonopt"
749
1035
 
774
1060
    module=no
775
1061
    no_install=no
776
1062
    objs=
 
1063
    non_pic_objects=
 
1064
    precious_files_regex=
777
1065
    prefer_static_libs=no
778
1066
    preload=no
779
1067
    prev=
785
1073
    temp_rpath=
786
1074
    thread_safe=no
787
1075
    vinfo=
 
1076
    vinfo_number=no
 
1077
 
 
1078
    func_infer_tag $base_compile
788
1079
 
789
1080
    # We need to know -static, to get the right output filenames.
790
1081
    for arg
815
1106
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
816
1107
 
817
1108
    # Go through the arguments, transforming them on the way.
818
 
    while test $# -gt 0; do
 
1109
    while test "$#" -gt 0; do
819
1110
      arg="$1"
820
1111
      shift
821
1112
      case $arg in
880
1171
          export_symbols="$arg"
881
1172
          if test ! -f "$arg"; then
882
1173
            $echo "$modename: symbol file \`$arg' does not exist"
883
 
            exit 1
 
1174
            exit $EXIT_FAILURE
884
1175
          fi
885
1176
          prev=
886
1177
          continue
890
1181
          prev=
891
1182
          continue
892
1183
          ;;
893
 
        inst_prefix)
 
1184
        inst_prefix)
894
1185
          inst_prefix_dir="$arg"
895
1186
          prev=
896
1187
          continue
897
1188
          ;;
 
1189
        precious_regex)
 
1190
          precious_files_regex="$arg"
 
1191
          prev=
 
1192
          continue
 
1193
          ;;
898
1194
        release)
899
1195
          release="-$arg"
900
1196
          prev=
901
1197
          continue
902
1198
          ;;
 
1199
        objectlist)
 
1200
          if test -f "$arg"; then
 
1201
            save_arg=$arg
 
1202
            moreargs=
 
1203
            for fil in `cat $save_arg`
 
1204
            do
 
1205
#             moreargs="$moreargs $fil"
 
1206
              arg=$fil
 
1207
              # A libtool-controlled object.
 
1208
 
 
1209
              # Check to see that this really is a libtool object.
 
1210
              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1211
                pic_object=
 
1212
                non_pic_object=
 
1213
 
 
1214
                # Read the .lo file
 
1215
                # If there is no directory component, then add one.
 
1216
                case $arg in
 
1217
                */* | *\\*) . $arg ;;
 
1218
                *) . ./$arg ;;
 
1219
                esac
 
1220
 
 
1221
                if test -z "$pic_object" || \
 
1222
                   test -z "$non_pic_object" ||
 
1223
                   test "$pic_object" = none && \
 
1224
                   test "$non_pic_object" = none; then
 
1225
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1226
                  exit $EXIT_FAILURE
 
1227
                fi
 
1228
 
 
1229
                # Extract subdirectory from the argument.
 
1230
                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1231
                if test "X$xdir" = "X$arg"; then
 
1232
                  xdir=
 
1233
                else
 
1234
                  xdir="$xdir/"
 
1235
                fi
 
1236
 
 
1237
                if test "$pic_object" != none; then
 
1238
                  # Prepend the subdirectory the object is found in.
 
1239
                  pic_object="$xdir$pic_object"
 
1240
 
 
1241
                  if test "$prev" = dlfiles; then
 
1242
                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1243
                      dlfiles="$dlfiles $pic_object"
 
1244
                      prev=
 
1245
                      continue
 
1246
                    else
 
1247
                      # If libtool objects are unsupported, then we need to preload.
 
1248
                      prev=dlprefiles
 
1249
                    fi
 
1250
                  fi
 
1251
 
 
1252
                  # CHECK ME:  I think I busted this.  -Ossama
 
1253
                  if test "$prev" = dlprefiles; then
 
1254
                    # Preload the old-style object.
 
1255
                    dlprefiles="$dlprefiles $pic_object"
 
1256
                    prev=
 
1257
                  fi
 
1258
 
 
1259
                  # A PIC object.
 
1260
                  libobjs="$libobjs $pic_object"
 
1261
                  arg="$pic_object"
 
1262
                fi
 
1263
 
 
1264
                # Non-PIC object.
 
1265
                if test "$non_pic_object" != none; then
 
1266
                  # Prepend the subdirectory the object is found in.
 
1267
                  non_pic_object="$xdir$non_pic_object"
 
1268
 
 
1269
                  # A standard non-PIC object
 
1270
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1271
                  if test -z "$pic_object" || test "$pic_object" = none ; then
 
1272
                    arg="$non_pic_object"
 
1273
                  fi
 
1274
                fi
 
1275
              else
 
1276
                # Only an error if not doing a dry-run.
 
1277
                if test -z "$run"; then
 
1278
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1279
                  exit $EXIT_FAILURE
 
1280
                else
 
1281
                  # Dry-run case.
 
1282
 
 
1283
                  # Extract subdirectory from the argument.
 
1284
                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1285
                  if test "X$xdir" = "X$arg"; then
 
1286
                    xdir=
 
1287
                  else
 
1288
                    xdir="$xdir/"
 
1289
                  fi
 
1290
 
 
1291
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1292
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1293
                  libobjs="$libobjs $pic_object"
 
1294
                  non_pic_objects="$non_pic_objects $non_pic_object"
 
1295
                fi
 
1296
              fi
 
1297
            done
 
1298
          else
 
1299
            $echo "$modename: link input file \`$save_arg' does not exist"
 
1300
            exit $EXIT_FAILURE
 
1301
          fi
 
1302
          arg=$save_arg
 
1303
          prev=
 
1304
          continue
 
1305
          ;;
903
1306
        rpath | xrpath)
904
1307
          # We need an absolute path.
905
1308
          case $arg in
906
1309
          [\\/]* | [A-Za-z]:[\\/]*) ;;
907
1310
          *)
908
1311
            $echo "$modename: only absolute run-paths are allowed" 1>&2
909
 
            exit 1
 
1312
            exit $EXIT_FAILURE
910
1313
            ;;
911
1314
          esac
912
1315
          if test "$prev" = rpath; then
938
1341
          finalize_command="$finalize_command $wl$qarg"
939
1342
          continue
940
1343
          ;;
 
1344
        xcclinker)
 
1345
          linker_flags="$linker_flags $qarg"
 
1346
          compiler_flags="$compiler_flags $qarg"
 
1347
          prev=
 
1348
          compile_command="$compile_command $qarg"
 
1349
          finalize_command="$finalize_command $qarg"
 
1350
          continue
 
1351
          ;;
 
1352
        shrext)
 
1353
          shrext_cmds="$arg"
 
1354
          prev=
 
1355
          continue
 
1356
          ;;
 
1357
        darwin_framework)
 
1358
          compiler_flags="$compiler_flags $arg"
 
1359
          compile_command="$compile_command $arg"
 
1360
          finalize_command="$finalize_command $arg"
 
1361
          prev=
 
1362
          continue
 
1363
          ;;
941
1364
        *)
942
1365
          eval "$prev=\"\$arg\""
943
1366
          prev=
944
1367
          continue
945
1368
          ;;
946
1369
        esac
947
 
      fi # test -n $prev
 
1370
      fi # test -n "$prev"
948
1371
 
949
1372
      prevarg="$arg"
950
1373
 
986
1409
      -export-symbols | -export-symbols-regex)
987
1410
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
988
1411
          $echo "$modename: more than one -exported-symbols argument is not allowed"
989
 
          exit 1
 
1412
          exit $EXIT_FAILURE
990
1413
        fi
991
1414
        if test "X$arg" = "X-export-symbols"; then
992
1415
          prev=expsyms
996
1419
        continue
997
1420
        ;;
998
1421
 
 
1422
      -framework|-arch)
 
1423
        prev=darwin_framework
 
1424
        compiler_flags="$compiler_flags $arg"
 
1425
        compile_command="$compile_command $arg"
 
1426
        finalize_command="$finalize_command $arg"
 
1427
        continue
 
1428
        ;;
 
1429
 
999
1430
      -inst-prefix-dir)
1000
1431
        prev=inst_prefix
1001
1432
        continue
1005
1436
      # so, if we see these flags be careful not to treat them like -L
1006
1437
      -L[A-Z][A-Z]*:*)
1007
1438
        case $with_gcc/$host in
1008
 
        no/*-*-irix*)
 
1439
        no/*-*-irix* | /*-*-irix*)
1009
1440
          compile_command="$compile_command $arg"
1010
1441
          finalize_command="$finalize_command $arg"
1011
1442
          ;;
1022
1453
          absdir=`cd "$dir" && pwd`
1023
1454
          if test -z "$absdir"; then
1024
1455
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1025
 
            exit 1
 
1456
            exit $EXIT_FAILURE
1026
1457
          fi
1027
1458
          dir="$absdir"
1028
1459
          ;;
1056
1487
            # These systems don't actually have a C library (as such)
1057
1488
            test "X$arg" = "X-lc" && continue
1058
1489
            ;;
1059
 
          *-*-openbsd*)
 
1490
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1060
1491
            # Do not include libc due to us having libc/libc_r.
1061
1492
            test "X$arg" = "X-lc" && continue
1062
1493
            ;;
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.
 
1494
          *-*-rhapsody* | *-*-darwin1.[012])
 
1495
            # Rhapsody C and math libraries are in the System framework
 
1496
            deplibs="$deplibs -framework System"
1068
1497
            continue
1069
 
            ;;
1070
1498
          esac
 
1499
        elif test "X$arg" = "X-lc_r"; then
 
1500
         case $host in
 
1501
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 
1502
           # Do not include libc_r directly, use -pthread flag.
 
1503
           continue
 
1504
           ;;
 
1505
         esac
1071
1506
        fi
1072
1507
        deplibs="$deplibs $arg"
1073
1508
        continue
1074
1509
        ;;
1075
1510
 
 
1511
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
1512
      # classes, name mangling, and exception handling.
 
1513
      -model)
 
1514
        compile_command="$compile_command $arg"
 
1515
        compiler_flags="$compiler_flags $arg"
 
1516
        finalize_command="$finalize_command $arg"
 
1517
        prev=xcompiler
 
1518
        continue
 
1519
        ;;
 
1520
 
 
1521
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1522
        compiler_flags="$compiler_flags $arg"
 
1523
        compile_command="$compile_command $arg"
 
1524
        finalize_command="$finalize_command $arg"
 
1525
        continue
 
1526
        ;;
 
1527
 
1076
1528
      -module)
1077
1529
        module=yes
1078
1530
        continue
1079
1531
        ;;
1080
1532
 
 
1533
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
 
1534
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
 
1535
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
 
1536
      # +DA*, +DD* enable 64-bit mode on the HP compiler
 
1537
      # -q* pass through compiler args for the IBM compiler
 
1538
      # -m* pass through architecture-specific compiler args for GCC
 
1539
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
 
1540
 
 
1541
        # Unknown arguments in both finalize_command and compile_command need
 
1542
        # to be aesthetically quoted because they are evaled later.
 
1543
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1544
        case $arg in
 
1545
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1546
          arg="\"$arg\""
 
1547
          ;;
 
1548
        esac
 
1549
        compile_command="$compile_command $arg"
 
1550
        finalize_command="$finalize_command $arg"
 
1551
        if test "$with_gcc" = "yes" ; then
 
1552
          compiler_flags="$compiler_flags $arg"
 
1553
        fi
 
1554
        continue
 
1555
        ;;
 
1556
 
 
1557
      -shrext)
 
1558
        prev=shrext
 
1559
        continue
 
1560
        ;;
 
1561
 
1081
1562
      -no-fast-install)
1082
1563
        fast_install=no
1083
1564
        continue
1102
1583
        continue
1103
1584
        ;;
1104
1585
 
 
1586
      -objectlist)
 
1587
        prev=objectlist
 
1588
        continue
 
1589
        ;;
 
1590
 
1105
1591
      -o) prev=output ;;
1106
1592
 
 
1593
      -precious-files-regex)
 
1594
        prev=precious_regex
 
1595
        continue
 
1596
        ;;
 
1597
 
1107
1598
      -release)
1108
1599
        prev=release
1109
1600
        continue
1126
1617
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1127
1618
        *)
1128
1619
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1129
 
          exit 1
 
1620
          exit $EXIT_FAILURE
1130
1621
          ;;
1131
1622
        esac
1132
1623
        case "$xrpath " in
1154
1645
        prev=vinfo
1155
1646
        continue
1156
1647
        ;;
 
1648
      -version-number)
 
1649
        prev=vinfo
 
1650
        vinfo_number=yes
 
1651
        continue
 
1652
        ;;
1157
1653
 
1158
1654
      -Wc,*)
1159
1655
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1202
1698
        continue
1203
1699
        ;;
1204
1700
 
 
1701
      -XCClinker)
 
1702
        prev=xcclinker
 
1703
        continue
 
1704
        ;;
 
1705
 
1205
1706
      # Some other compiler flag.
1206
1707
      -* | +*)
1207
1708
        # Unknown arguments in both finalize_command and compile_command need
1214
1715
        esac
1215
1716
        ;;
1216
1717
 
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
 
1718
      *.$objext)
 
1719
        # A standard object.
 
1720
        objs="$objs $arg"
 
1721
        ;;
 
1722
 
 
1723
      *.lo)
 
1724
        # A libtool-controlled object.
 
1725
 
 
1726
        # Check to see that this really is a libtool object.
 
1727
        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
1728
          pic_object=
 
1729
          non_pic_object=
 
1730
 
 
1731
          # Read the .lo file
 
1732
          # If there is no directory component, then add one.
1236
1733
          case $arg in
1237
 
          *.lo) libobjs="$libobjs $arg" ;;
1238
 
          *) objs="$objs $arg" ;;
 
1734
          */* | *\\*) . $arg ;;
 
1735
          *) . ./$arg ;;
1239
1736
          esac
 
1737
 
 
1738
          if test -z "$pic_object" || \
 
1739
             test -z "$non_pic_object" ||
 
1740
             test "$pic_object" = none && \
 
1741
             test "$non_pic_object" = none; then
 
1742
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
 
1743
            exit $EXIT_FAILURE
 
1744
          fi
 
1745
 
 
1746
          # Extract subdirectory from the argument.
 
1747
          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1748
          if test "X$xdir" = "X$arg"; then
 
1749
            xdir=
 
1750
          else
 
1751
            xdir="$xdir/"
 
1752
          fi
 
1753
 
 
1754
          if test "$pic_object" != none; then
 
1755
            # Prepend the subdirectory the object is found in.
 
1756
            pic_object="$xdir$pic_object"
 
1757
 
 
1758
            if test "$prev" = dlfiles; then
 
1759
              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1760
                dlfiles="$dlfiles $pic_object"
 
1761
                prev=
 
1762
                continue
 
1763
              else
 
1764
                # If libtool objects are unsupported, then we need to preload.
 
1765
                prev=dlprefiles
 
1766
              fi
 
1767
            fi
 
1768
 
 
1769
            # CHECK ME:  I think I busted this.  -Ossama
 
1770
            if test "$prev" = dlprefiles; then
 
1771
              # Preload the old-style object.
 
1772
              dlprefiles="$dlprefiles $pic_object"
 
1773
              prev=
 
1774
            fi
 
1775
 
 
1776
            # A PIC object.
 
1777
            libobjs="$libobjs $pic_object"
 
1778
            arg="$pic_object"
 
1779
          fi
 
1780
 
 
1781
          # Non-PIC object.
 
1782
          if test "$non_pic_object" != none; then
 
1783
            # Prepend the subdirectory the object is found in.
 
1784
            non_pic_object="$xdir$non_pic_object"
 
1785
 
 
1786
            # A standard non-PIC object
 
1787
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1788
            if test -z "$pic_object" || test "$pic_object" = none ; then
 
1789
              arg="$non_pic_object"
 
1790
            fi
 
1791
          fi
 
1792
        else
 
1793
          # Only an error if not doing a dry-run.
 
1794
          if test -z "$run"; then
 
1795
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
 
1796
            exit $EXIT_FAILURE
 
1797
          else
 
1798
            # Dry-run case.
 
1799
 
 
1800
            # Extract subdirectory from the argument.
 
1801
            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
 
1802
            if test "X$xdir" = "X$arg"; then
 
1803
              xdir=
 
1804
            else
 
1805
              xdir="$xdir/"
 
1806
            fi
 
1807
 
 
1808
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
 
1809
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
 
1810
            libobjs="$libobjs $pic_object"
 
1811
            non_pic_objects="$non_pic_objects $non_pic_object"
 
1812
          fi
1240
1813
        fi
1241
1814
        ;;
1242
1815
 
1287
1860
    if test -n "$prev"; then
1288
1861
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1289
1862
      $echo "$help" 1>&2
1290
 
      exit 1
 
1863
      exit $EXIT_FAILURE
1291
1864
    fi
1292
1865
 
1293
1866
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1296
1869
      finalize_command="$finalize_command $arg"
1297
1870
    fi
1298
1871
 
 
1872
    oldlibs=
1299
1873
    # calculate the name of the file, without its directory
1300
1874
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1301
1875
    libobjs_save="$libobjs"
1330
1904
    "")
1331
1905
      $echo "$modename: you must specify an output file" 1>&2
1332
1906
      $echo "$help" 1>&2
1333
 
      exit 1
 
1907
      exit $EXIT_FAILURE
1334
1908
      ;;
1335
1909
    *.$libext) linkmode=oldlib ;;
1336
1910
    *.lo | *.$objext) linkmode=obj ;;
1338
1912
    *) linkmode=prog ;; # Anything else should be a program.
1339
1913
    esac
1340
1914
 
 
1915
    case $host in
 
1916
    *cygwin* | *mingw* | *pw32*)
 
1917
      # don't eliminate duplications in $postdeps and $predeps
 
1918
      duplicate_compiler_generated_deps=yes
 
1919
      ;;
 
1920
    *)
 
1921
      duplicate_compiler_generated_deps=$duplicate_deps
 
1922
      ;;
 
1923
    esac
1341
1924
    specialdeplibs=
 
1925
 
1342
1926
    libs=
1343
1927
    # Find all interdependent deplibs by searching for libraries
1344
1928
    # that are linked more than once (e.g. -la -lb -la)
1358
1942
      # $postdeps and mark them as special (i.e., whose duplicates are
1359
1943
      # not to be eliminated).
1360
1944
      pre_post_deps=
1361
 
      if test "X$duplicate_deps" = "Xyes" ; then
 
1945
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1362
1946
        for pre_post_dep in $predeps $postdeps; do
1363
1947
          case "$pre_post_deps " in
1364
1948
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1383
1967
          *.la) ;;
1384
1968
          *)
1385
1969
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1386
 
            exit 1
 
1970
            exit $EXIT_FAILURE
1387
1971
            ;;
1388
1972
          esac
1389
1973
        done
1400
1984
        ;;
1401
1985
    esac
1402
1986
    for pass in $passes; do
 
1987
      if test "$linkmode,$pass" = "lib,link" ||
 
1988
         test "$linkmode,$pass" = "prog,scan"; then
 
1989
        libs="$deplibs"
 
1990
        deplibs=
 
1991
      fi
1403
1992
      if test "$linkmode" = prog; then
1404
 
        # Determine which files to process
1405
1993
        case $pass in
1406
 
        dlopen)
1407
 
          libs="$dlfiles"
1408
 
          save_deplibs="$deplibs" # Collect dlpreopened libraries
1409
 
          deplibs=
1410
 
          ;;
 
1994
        dlopen) libs="$dlfiles" ;;
1411
1995
        dlpreopen) libs="$dlprefiles" ;;
1412
 
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
1996
        link)
 
1997
          libs="$deplibs %DEPLIBS%"
 
1998
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
 
1999
          ;;
1413
2000
        esac
1414
2001
      fi
 
2002
      if test "$pass" = dlopen; then
 
2003
        # Collect dlpreopened libraries
 
2004
        save_deplibs="$deplibs"
 
2005
        deplibs=
 
2006
      fi
1415
2007
      for deplib in $libs; do
1416
2008
        lib=
1417
2009
        found=no
1418
2010
        case $deplib in
 
2011
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
2012
          if test "$linkmode,$pass" = "prog,link"; then
 
2013
            compile_deplibs="$deplib $compile_deplibs"
 
2014
            finalize_deplibs="$deplib $finalize_deplibs"
 
2015
          else
 
2016
            compiler_flags="$compiler_flags $deplib"
 
2017
          fi
 
2018
          continue
 
2019
          ;;
1419
2020
        -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"
 
2021
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
2022
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1426
2023
            continue
1427
2024
          fi
1428
2025
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1429
2026
          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
 
2027
            for search_ext in .la $std_shrext .so .a; do
 
2028
              # Search the libtool library
 
2029
              lib="$searchdir/lib${name}${search_ext}"
 
2030
              if test -f "$lib"; then
 
2031
                if test "$search_ext" = ".la"; then
 
2032
                  found=yes
 
2033
                else
 
2034
                  found=no
 
2035
                fi
 
2036
                break 2
 
2037
              fi
 
2038
            done
1436
2039
          done
1437
2040
          if test "$found" != yes; then
1438
2041
            # deplib doesn't seem to be a libtool library
1444
2047
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1445
2048
            fi
1446
2049
            continue
 
2050
          else # deplib is a libtool library
 
2051
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
2052
            # We need to do some special things here, and not later.
 
2053
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
2054
              case " $predeps $postdeps " in
 
2055
              *" $deplib "*)
 
2056
                if (${SED} -e '2q' $lib |
 
2057
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
2058
                  library_names=
 
2059
                  old_library=
 
2060
                  case $lib in
 
2061
                  */* | *\\*) . $lib ;;
 
2062
                  *) . ./$lib ;;
 
2063
                  esac
 
2064
                  for l in $old_library $library_names; do
 
2065
                    ll="$l"
 
2066
                  done
 
2067
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
2068
                    found=no
 
2069
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
2070
                    test "X$ladir" = "X$lib" && ladir="."
 
2071
                    lib=$ladir/$old_library
 
2072
                    if test "$linkmode,$pass" = "prog,link"; then
 
2073
                      compile_deplibs="$deplib $compile_deplibs"
 
2074
                      finalize_deplibs="$deplib $finalize_deplibs"
 
2075
                    else
 
2076
                      deplibs="$deplib $deplibs"
 
2077
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
2078
                    fi
 
2079
                    continue
 
2080
                  fi
 
2081
                fi
 
2082
                ;;
 
2083
              *) ;;
 
2084
              esac
 
2085
            fi
1447
2086
          fi
1448
2087
          ;; # -l
1449
2088
        -L*)
1461
2100
            fi
1462
2101
            if test "$pass" = scan; then
1463
2102
              deplibs="$deplib $deplibs"
1464
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1465
2103
            else
1466
2104
              compile_deplibs="$deplib $compile_deplibs"
1467
2105
              finalize_deplibs="$deplib $finalize_deplibs"
1468
2106
            fi
 
2107
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1469
2108
            ;;
1470
2109
          *)
1471
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
2110
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1472
2111
            ;;
1473
2112
          esac # linkmode
1474
2113
          continue
1493
2132
          fi
1494
2133
          case $linkmode in
1495
2134
          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."
 
2135
            valid_a_lib=no
 
2136
            case $deplibs_check_method in
 
2137
              match_pattern*)
 
2138
                set dummy $deplibs_check_method
 
2139
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2140
                if eval $echo \"$deplib\" 2>/dev/null \
 
2141
                    | $SED 10q \
 
2142
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2143
                  valid_a_lib=yes
 
2144
                fi
 
2145
                ;;
 
2146
              pass_all)
 
2147
                valid_a_lib=yes
 
2148
                ;;
 
2149
            esac
 
2150
            if test "$valid_a_lib" != yes; then
 
2151
              $echo
 
2152
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
2153
              $echo "*** I have the capability to make that library automatically link in when"
 
2154
              $echo "*** you link to this library.  But I can only do this if you have a"
 
2155
              $echo "*** shared version of the library, which you do not appear to have"
 
2156
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
2157
              $echo "*** that it is just a static archive that I should not used here."
1502
2158
            else
1503
 
              echo
1504
 
              echo "*** Warning: Linking the shared library $output against the"
1505
 
              echo "*** static library $deplib is not portable!"
 
2159
              $echo
 
2160
              $echo "*** Warning: Linking the shared library $output against the"
 
2161
              $echo "*** static library $deplib is not portable!"
1506
2162
              deplibs="$deplib $deplibs"
1507
2163
            fi
1508
2164
            continue
1519
2175
          esac # linkmode
1520
2176
          ;; # *.$libext
1521
2177
        *.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"
 
2178
          if test "$pass" = conv; then
 
2179
            deplibs="$deplib $deplibs"
 
2180
          elif test "$linkmode" = prog; then
 
2181
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2182
              # If there is no dlopen support or we're linking statically,
 
2183
              # we need to preload.
 
2184
              newdlprefiles="$newdlprefiles $deplib"
 
2185
              compile_deplibs="$deplib $compile_deplibs"
 
2186
              finalize_deplibs="$deplib $finalize_deplibs"
 
2187
            else
 
2188
              newdlfiles="$newdlfiles $deplib"
 
2189
            fi
1530
2190
          fi
1531
2191
          continue
1532
2192
          ;;
1538
2198
        if test "$found" = yes || test -f "$lib"; then :
1539
2199
        else
1540
2200
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1541
 
          exit 1
 
2201
          exit $EXIT_FAILURE
1542
2202
        fi
1543
2203
 
1544
2204
        # 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 :
 
2205
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1546
2206
        else
1547
2207
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1548
 
          exit 1
 
2208
          exit $EXIT_FAILURE
1549
2209
        fi
1550
2210
 
1551
2211
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1558
2218
        library_names=
1559
2219
        old_library=
1560
2220
        # If the library was installed with an old release of libtool,
1561
 
        # it will not redefine variable installed.
 
2221
        # it will not redefine variables installed, or shouldnotlink
1562
2222
        installed=yes
 
2223
        shouldnotlink=no
 
2224
        avoidtemprpath=
 
2225
 
1563
2226
 
1564
2227
        # Read the .la file
1565
2228
        case $lib in
1569
2232
 
1570
2233
        if test "$linkmode,$pass" = "lib,link" ||
1571
2234
           test "$linkmode,$pass" = "prog,scan" ||
1572
 
           { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then
1573
 
           # Add dl[pre]opened files of deplib
 
2235
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1574
2236
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1575
2237
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1576
2238
        fi
1581
2243
          if test -z "$libdir"; then
1582
2244
            if test -z "$old_library"; then
1583
2245
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1584
 
              exit 1
 
2246
              exit $EXIT_FAILURE
1585
2247
            fi
1586
2248
            # It is a libtool convenience library, so add in its objects.
1587
2249
            convenience="$convenience $ladir/$objdir/$old_library"
1598
2260
            done
1599
2261
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1600
2262
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1601
 
            exit 1
 
2263
            exit $EXIT_FAILURE
1602
2264
          fi
1603
2265
          continue
1604
2266
        fi # $pass = conv
1605
2267
 
 
2268
 
1606
2269
        # Get the name of the library we link against.
1607
2270
        linklib=
1608
2271
        for l in $old_library $library_names; do
1610
2273
        done
1611
2274
        if test -z "$linklib"; then
1612
2275
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1613
 
          exit 1
 
2276
          exit $EXIT_FAILURE
1614
2277
        fi
1615
2278
 
1616
2279
        # This library was specified with -dlopen.
1617
2280
        if test "$pass" = dlopen; then
1618
2281
          if test -z "$libdir"; then
1619
2282
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1620
 
            exit 1
 
2283
            exit $EXIT_FAILURE
1621
2284
          fi
1622
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2285
          if test -z "$dlname" ||
 
2286
             test "$dlopen_support" != yes ||
 
2287
             test "$build_libtool_libs" = no; then
1623
2288
            # If there is no dlname, no dlopen support or we're linking
1624
 
            # statically, we need to preload.
1625
 
            dlprefiles="$dlprefiles $lib"
 
2289
            # statically, we need to preload.  We also need to preload any
 
2290
            # dependent libraries so libltdl's deplib preloader doesn't
 
2291
            # bomb out in the load deplibs phase.
 
2292
            dlprefiles="$dlprefiles $lib $dependency_libs"
1626
2293
          else
1627
2294
            newdlfiles="$newdlfiles $lib"
1628
2295
          fi
1654
2321
            dir="$libdir"
1655
2322
            absdir="$libdir"
1656
2323
          fi
 
2324
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
1657
2325
        else
1658
 
          dir="$ladir/$objdir"
1659
 
          absdir="$abs_ladir/$objdir"
1660
 
          # Remove this search path later
1661
 
          notinst_path="$notinst_path $abs_ladir"
 
2326
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2327
            dir="$ladir"
 
2328
            absdir="$abs_ladir"
 
2329
            # Remove this search path later
 
2330
            notinst_path="$notinst_path $abs_ladir"
 
2331
          else
 
2332
            dir="$ladir/$objdir"
 
2333
            absdir="$abs_ladir/$objdir"
 
2334
            # Remove this search path later
 
2335
            notinst_path="$notinst_path $abs_ladir"
 
2336
          fi
1662
2337
        fi # $installed = yes
1663
2338
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1664
2339
 
1666
2341
        if test "$pass" = dlpreopen; then
1667
2342
          if test -z "$libdir"; then
1668
2343
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1669
 
            exit 1
 
2344
            exit $EXIT_FAILURE
1670
2345
          fi
1671
2346
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1672
2347
          # are required to link).
1688
2363
            compile_deplibs="$dir/$old_library $compile_deplibs"
1689
2364
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1690
2365
          else
1691
 
            deplibs="$lib $deplibs"
 
2366
            deplibs="$lib $deplibs" # used for prog,scan pass
1692
2367
          fi
1693
2368
          continue
1694
2369
        fi
1695
2370
 
 
2371
 
1696
2372
        if test "$linkmode" = prog && test "$pass" != link; then
1697
2373
          newlib_search_path="$newlib_search_path $ladir"
1698
2374
          deplibs="$lib $deplibs"
1726
2402
          continue
1727
2403
        fi # $linkmode = prog...
1728
2404
 
 
2405
        if test "$linkmode,$pass" = "prog,link"; then
 
2406
          if test -n "$library_names" &&
 
2407
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2408
            # We need to hardcode the library path
 
2409
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 
2410
              # Make sure the rpath contains only unique directories.
 
2411
              case "$temp_rpath " in
 
2412
              *" $dir "*) ;;
 
2413
              *" $absdir "*) ;;
 
2414
              *) temp_rpath="$temp_rpath $absdir" ;;
 
2415
              esac
 
2416
            fi
 
2417
 
 
2418
            # Hardcode the library path.
 
2419
            # Skip directories that are in the system default run-time
 
2420
            # search path.
 
2421
            case " $sys_lib_dlsearch_path " in
 
2422
            *" $absdir "*) ;;
 
2423
            *)
 
2424
              case "$compile_rpath " in
 
2425
              *" $absdir "*) ;;
 
2426
              *) compile_rpath="$compile_rpath $absdir"
 
2427
              esac
 
2428
              ;;
 
2429
            esac
 
2430
            case " $sys_lib_dlsearch_path " in
 
2431
            *" $libdir "*) ;;
 
2432
            *)
 
2433
              case "$finalize_rpath " in
 
2434
              *" $libdir "*) ;;
 
2435
              *) finalize_rpath="$finalize_rpath $libdir"
 
2436
              esac
 
2437
              ;;
 
2438
            esac
 
2439
          fi # $linkmode,$pass = prog,link...
 
2440
 
 
2441
          if test "$alldeplibs" = yes &&
 
2442
             { test "$deplibs_check_method" = pass_all ||
 
2443
               { test "$build_libtool_libs" = yes &&
 
2444
                 test -n "$library_names"; }; }; then
 
2445
            # We only need to search for static libraries
 
2446
            continue
 
2447
          fi
 
2448
        fi
 
2449
 
1729
2450
        link_static=no # Whether the deplib will be linked statically
1730
2451
        if test -n "$library_names" &&
1731
2452
           { 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
2453
          if test "$installed" = no; then
1779
2454
            notinst_deplibs="$notinst_deplibs $lib"
1780
2455
            need_relink=yes
1781
2456
          fi
 
2457
          # This is a shared library
 
2458
 
 
2459
          # Warn about portability, can't link against -module's on
 
2460
          # some systems (darwin)
 
2461
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2462
            $echo
 
2463
            if test "$linkmode" = prog; then
 
2464
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
2465
            else
 
2466
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
2467
            fi
 
2468
            $echo "*** $linklib is not portable!"
 
2469
          fi
 
2470
          if test "$linkmode" = lib &&
 
2471
             test "$hardcode_into_libs" = yes; then
 
2472
            # Hardcode the library path.
 
2473
            # Skip directories that are in the system default run-time
 
2474
            # search path.
 
2475
            case " $sys_lib_dlsearch_path " in
 
2476
            *" $absdir "*) ;;
 
2477
            *)
 
2478
              case "$compile_rpath " in
 
2479
              *" $absdir "*) ;;
 
2480
              *) compile_rpath="$compile_rpath $absdir"
 
2481
              esac
 
2482
              ;;
 
2483
            esac
 
2484
            case " $sys_lib_dlsearch_path " in
 
2485
            *" $libdir "*) ;;
 
2486
            *)
 
2487
              case "$finalize_rpath " in
 
2488
              *" $libdir "*) ;;
 
2489
              *) finalize_rpath="$finalize_rpath $libdir"
 
2490
              esac
 
2491
              ;;
 
2492
            esac
 
2493
          fi
1782
2494
 
1783
2495
          if test -n "$old_archive_from_expsyms_cmds"; then
1784
2496
            # figure out the soname
1792
2504
            elif test -n "$soname_spec"; then
1793
2505
              # bleh windows
1794
2506
              case $host in
1795
 
              *cygwin*)
 
2507
              *cygwin* | mingw*)
1796
2508
                major=`expr $current - $age`
1797
2509
                versuffix="-$major"
1798
2510
                ;;
1804
2516
 
1805
2517
            # Make a new name for the extract_expsyms_cmds to use
1806
2518
            soroot="$soname"
1807
 
            soname=`echo $soroot | sed -e 's/^.*\///'`
1808
 
            newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
 
2519
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2520
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1809
2521
 
1810
2522
            # If the library has no export list, then create one now
1811
2523
            if test -f "$output_objdir/$soname-def"; then :
1812
2524
            else
1813
2525
              $show "extracting exported symbol list from \`$soname'"
1814
2526
              save_ifs="$IFS"; IFS='~'
1815
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2527
              cmds=$extract_expsyms_cmds
1816
2528
              for cmd in $cmds; do
1817
2529
                IFS="$save_ifs"
 
2530
                eval cmd=\"$cmd\"
1818
2531
                $show "$cmd"
1819
2532
                $run eval "$cmd" || exit $?
1820
2533
              done
1825
2538
            if test -f "$output_objdir/$newlib"; then :; else
1826
2539
              $show "generating import library for \`$soname'"
1827
2540
              save_ifs="$IFS"; IFS='~'
1828
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2541
              cmds=$old_archive_from_expsyms_cmds
1829
2542
              for cmd in $cmds; do
1830
2543
                IFS="$save_ifs"
 
2544
                eval cmd=\"$cmd\"
1831
2545
                $show "$cmd"
1832
2546
                $run eval "$cmd" || exit $?
1833
2547
              done
1847
2561
            immediate | unsupported)
1848
2562
              if test "$hardcode_direct" = no; then
1849
2563
                add="$dir/$linklib"
 
2564
                case $host in
 
2565
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2566
                  *-*-darwin* )
 
2567
                    # if the lib is a module then we can not link against
 
2568
                    # it, someone is ignoring the new warnings I added
 
2569
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2570
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2571
                      if test -z "$old_library" ; then
 
2572
                        $echo
 
2573
                        $echo "** And there doesn't seem to be a static archive available"
 
2574
                        $echo "** The link will probably fail, sorry"
 
2575
                      else
 
2576
                        add="$dir/$old_library"
 
2577
                      fi
 
2578
                    fi
 
2579
                esac
1850
2580
              elif test "$hardcode_minus_L" = no; then
1851
2581
                case $host in
1852
2582
                *-*-sunos*) add_shlibpath="$dir" ;;
1865
2595
                add="$dir/$linklib"
1866
2596
              elif test "$hardcode_minus_L" = yes; then
1867
2597
                add_dir="-L$dir"
 
2598
                # Try looking first in the location we're being installed to.
 
2599
                if test -n "$inst_prefix_dir"; then
 
2600
                  case $libdir in
 
2601
                    [\\/]*)
 
2602
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2603
                      ;;
 
2604
                  esac
 
2605
                fi
1868
2606
                add="-l$name"
1869
2607
              elif test "$hardcode_shlibpath_var" = yes; then
1870
2608
                add_shlibpath="$dir"
1878
2616
 
1879
2617
            if test "$lib_linked" != yes; then
1880
2618
              $echo "$modename: configuration error: unsupported hardcode properties"
1881
 
              exit 1
 
2619
              exit $EXIT_FAILURE
1882
2620
            fi
1883
2621
 
1884
2622
            if test -n "$add_shlibpath"; then
1912
2650
            if test "$hardcode_direct" = yes; then
1913
2651
              add="$libdir/$linklib"
1914
2652
            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"
 
2653
              add_dir="-L$libdir"
1925
2654
              add="-l$name"
1926
2655
            elif test "$hardcode_shlibpath_var" = yes; then
1927
2656
              case :$finalize_shlibpath: in
1929
2658
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1930
2659
              esac
1931
2660
              add="-l$name"
 
2661
            elif test "$hardcode_automatic" = yes; then
 
2662
              if test -n "$inst_prefix_dir" &&
 
2663
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2664
                add="$inst_prefix_dir$libdir/$linklib"
 
2665
              else
 
2666
                add="$libdir/$linklib"
 
2667
              fi
1932
2668
            else
1933
2669
              # We cannot seem to hardcode it, guess we'll fake it.
 
2670
              add_dir="-L$libdir"
1934
2671
              # Try looking first in the location we're being installed to.
1935
 
              add_dir=
1936
2672
              if test -n "$inst_prefix_dir"; then
1937
 
                case "$libdir" in
1938
 
                [\\/]*)
1939
 
                  add_dir="-L$inst_prefix_dir$libdir"
1940
 
                  ;;
 
2673
                case $libdir in
 
2674
                  [\\/]*)
 
2675
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2676
                    ;;
1941
2677
                esac
1942
2678
              fi
1943
 
              add_dir="$add_dir -L$libdir"
1944
2679
              add="-l$name"
1945
2680
            fi
1946
2681
 
1953
2688
            fi
1954
2689
          fi
1955
2690
        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
2691
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1966
2692
          # is not unsupported.  This is valid on all known static and
1967
2693
          # shared platforms.
1981
2707
 
1982
2708
            # Just print a warning and add the library to dependency_libs so
1983
2709
            # 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."
 
2710
            $echo
 
2711
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2712
            $echo "*** I have the capability to make that library automatically link in when"
 
2713
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2714
            $echo "*** shared version of the library, which you do not appear to have."
1989
2715
            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."
 
2716
              $echo "*** But as you try to build a module library, libtool will still create "
 
2717
              $echo "*** a static module, that should work as long as the dlopening application"
 
2718
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1992
2719
              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."
 
2720
                $echo
 
2721
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2722
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2723
                $echo "*** not find such a program.  So, this module is probably useless."
 
2724
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
1998
2725
              fi
1999
2726
              if test "$build_old_libs" = no; then
2000
2727
                build_libtool_libs=module
2004
2731
              fi
2005
2732
            fi
2006
2733
          else
2007
 
            convenience="$convenience $dir/$old_library"
2008
 
            old_convenience="$old_convenience $dir/$old_library"
2009
2734
            deplibs="$dir/$old_library $deplibs"
2010
2735
            link_static=yes
2011
2736
          fi
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
          *)
 
3111
            $echo "$modename: unknown library version type \`$version_type'" 1>&2
 
3112
            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3113
            exit $EXIT_FAILURE
 
3114
            ;;
 
3115
          esac
 
3116
          ;;
 
3117
        no)
 
3118
          current="$2"
 
3119
          revision="$3"
 
3120
          age="$4"
 
3121
          ;;
 
3122
        esac
2272
3123
 
2273
3124
        # Check that each of the things are valid numbers.
2274
3125
        case $current in
2275
 
        [0-9]*) ;;
 
3126
        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
3127
        *)
2277
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3128
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2278
3129
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2279
 
          exit 1
 
3130
          exit $EXIT_FAILURE
2280
3131
          ;;
2281
3132
        esac
2282
3133
 
2283
3134
        case $revision in
2284
 
        [0-9]*) ;;
 
3135
        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
3136
        *)
2286
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3137
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2287
3138
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2288
 
          exit 1
 
3139
          exit $EXIT_FAILURE
2289
3140
          ;;
2290
3141
        esac
2291
3142
 
2292
3143
        case $age in
2293
 
        [0-9]*) ;;
 
3144
        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
3145
        *)
2295
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3146
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2296
3147
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2297
 
          exit 1
 
3148
          exit $EXIT_FAILURE
2298
3149
          ;;
2299
3150
        esac
2300
3151
 
2301
3152
        if test "$age" -gt "$current"; then
2302
3153
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2303
3154
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2304
 
          exit 1
 
3155
          exit $EXIT_FAILURE
2305
3156
        fi
2306
3157
 
2307
3158
        # Calculate the version variables.
2318
3169
          versuffix="$major.$age.$revision"
2319
3170
          # Darwin ld doesn't like 0 for these options...
2320
3171
          minor_current=`expr $current + 1`
2321
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3172
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2322
3173
          ;;
2323
3174
 
2324
3175
        freebsd-aout)
2331
3182
          versuffix=".$current";
2332
3183
          ;;
2333
3184
 
2334
 
        irix)
 
3185
        irix | nonstopux)
2335
3186
          major=`expr $current - $age + 1`
2336
 
          verstring="sgi$major.$revision"
 
3187
 
 
3188
          case $version_type in
 
3189
            nonstopux) verstring_prefix=nonstopux ;;
 
3190
            *)         verstring_prefix=sgi ;;
 
3191
          esac
 
3192
          verstring="$verstring_prefix$major.$revision"
2337
3193
 
2338
3194
          # Add in all the interfaces that we are compatible with.
2339
3195
          loop=$revision
2340
3196
          while test "$loop" -ne 0; do
2341
3197
            iface=`expr $revision - $loop`
2342
3198
            loop=`expr $loop - 1`
2343
 
            verstring="sgi$major.$iface:$verstring"
 
3199
            verstring="$verstring_prefix$major.$iface:$verstring"
2344
3200
          done
2345
3201
 
2346
3202
          # Before this point, $major must not contain `.'.
2354
3210
          ;;
2355
3211
 
2356
3212
        osf)
2357
 
          major=`expr $current - $age`
 
3213
          major=.`expr $current - $age`
2358
3214
          versuffix=".$current.$age.$revision"
2359
3215
          verstring="$current.$age.$revision"
2360
3216
 
2384
3240
 
2385
3241
        *)
2386
3242
          $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
 
3243
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3244
          exit $EXIT_FAILURE
2389
3245
          ;;
2390
3246
        esac
2391
3247
 
2392
3248
        # Clear the version info if we defaulted, and they specified a release.
2393
3249
        if test -z "$vinfo" && test -n "$release"; then
2394
3250
          major=
2395
 
          verstring="0.0"
2396
3251
          case $version_type in
2397
3252
          darwin)
2398
3253
            # we can't check for "0.0" in archive_cmds due to quoting
2399
3254
            # problems, so we reset it completely
2400
 
            verstring=""
 
3255
            verstring=
2401
3256
            ;;
2402
3257
          *)
2403
3258
            verstring="0.0"
2431
3286
      fi
2432
3287
 
2433
3288
      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}.*
 
3289
        # Remove our outputs, but don't remove object files since they
 
3290
        # may have been created when compiling PIC objects.
 
3291
        removelist=
 
3292
        tempremovelist=`$echo "$output_objdir/*"`
 
3293
        for p in $tempremovelist; do
 
3294
          case $p in
 
3295
            *.$objext)
 
3296
               ;;
 
3297
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3298
               if test "X$precious_files_regex" != "X"; then
 
3299
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3300
                 then
 
3301
                   continue
 
3302
                 fi
 
3303
               fi
 
3304
               removelist="$removelist $p"
 
3305
               ;;
 
3306
            *) ;;
 
3307
          esac
 
3308
        done
 
3309
        if test -n "$removelist"; then
 
3310
          $show "${rm}r $removelist"
 
3311
          $run ${rm}r $removelist
 
3312
        fi
2437
3313
      fi
2438
3314
 
2439
3315
      # Now set the variables for building old libraries.
2446
3322
 
2447
3323
      # Eliminate all temporary directories.
2448
3324
      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'`
 
3325
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3326
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3327
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2452
3328
      done
2453
3329
 
2454
3330
      if test -n "$xrpath"; then
2499
3375
          *-*-netbsd*)
2500
3376
            # Don't link with libc until the a.out ld.so is fixed.
2501
3377
            ;;
2502
 
          *-*-openbsd*)
 
3378
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
2503
3379
            # Do not include libc due to us having libc/libc_r.
 
3380
            test "X$arg" = "X-lc" && continue
2504
3381
            ;;
2505
 
          *)
 
3382
          *)
2506
3383
            # Add libc to deplibs on all other systems if necessary.
2507
3384
            if test "$build_libtool_need_lc" = "yes"; then
2508
3385
              deplibs="$deplibs -lc"
2531
3408
          # This might be a little naive.  We might want to check
2532
3409
          # whether the library exists or not.  But this is on
2533
3410
          # osf3 & osf4 and I'm not really sure... Just
2534
 
          # implementing what was already the behaviour.
 
3411
          # implementing what was already the behavior.
2535
3412
          newdeplibs=$deplibs
2536
3413
          ;;
2537
3414
        test_compile)
2544
3421
          int main() { return 0; }
2545
3422
EOF
2546
3423
          $rm conftest
2547
 
          $CC -o conftest conftest.c $deplibs
 
3424
          $LTCC -o conftest conftest.c $deplibs
2548
3425
          if test "$?" -eq 0 ; then
2549
3426
            ldd_output=`ldd conftest`
2550
3427
            for i in $deplibs; do
2551
 
              name="`expr $i : '-l\(.*\)'`"
 
3428
              name=`expr $i : '-l\(.*\)'`
2552
3429
              # 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`
 
3430
              if test "$name" != "" && test "$name" -ne "0"; then
 
3431
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3432
                  case " $predeps $postdeps " in
 
3433
                  *" $i "*)
 
3434
                    newdeplibs="$newdeplibs $i"
 
3435
                    i=""
 
3436
                    ;;
 
3437
                  esac
 
3438
                fi
 
3439
                if test -n "$i" ; then
2584
3440
                  libname=`eval \\$echo \"$libname_spec\"`
2585
3441
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2586
3442
                  set dummy $deplib_matches
2589
3445
                    newdeplibs="$newdeplibs $i"
2590
3446
                  else
2591
3447
                    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."
 
3448
                    $echo
 
3449
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3450
                    $echo "*** I have the capability to make that library automatically link in when"
 
3451
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3452
                    $echo "*** shared version of the library, which I believe you do not have"
 
3453
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3454
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3455
                  fi
 
3456
                fi
 
3457
              else
 
3458
                newdeplibs="$newdeplibs $i"
 
3459
              fi
 
3460
            done
 
3461
          else
 
3462
            # Error occurred in the first compile.  Let's try to salvage
 
3463
            # the situation: Compile a separate program for each library.
 
3464
            for i in $deplibs; do
 
3465
              name=`expr $i : '-l\(.*\)'`
 
3466
              # If $name is empty we are operating on a -L argument.
 
3467
              if test "$name" != "" && test "$name" != "0"; then
 
3468
                $rm conftest
 
3469
                $LTCC -o conftest conftest.c $i
 
3470
                # Did it work?
 
3471
                if test "$?" -eq 0 ; then
 
3472
                  ldd_output=`ldd conftest`
 
3473
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3474
                    case " $predeps $postdeps " in
 
3475
                    *" $i "*)
 
3476
                      newdeplibs="$newdeplibs $i"
 
3477
                      i=""
 
3478
                      ;;
 
3479
                    esac
 
3480
                  fi
 
3481
                  if test -n "$i" ; then
 
3482
                    libname=`eval \\$echo \"$libname_spec\"`
 
3483
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3484
                    set dummy $deplib_matches
 
3485
                    deplib_match=$2
 
3486
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3487
                      newdeplibs="$newdeplibs $i"
 
3488
                    else
 
3489
                      droppeddeps=yes
 
3490
                      $echo
 
3491
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3492
                      $echo "*** I have the capability to make that library automatically link in when"
 
3493
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3494
                      $echo "*** shared version of the library, which you do not appear to have"
 
3495
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3496
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3497
                    fi
2597
3498
                  fi
2598
3499
                else
2599
3500
                  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."
 
3501
                  $echo
 
3502
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3503
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3504
                  $echo "*** library that it depends on before this library will be fully"
 
3505
                  $echo "*** functional.  Installing it before continuing would be even better."
2605
3506
                fi
2606
3507
              else
2607
3508
                newdeplibs="$newdeplibs $i"
2613
3514
          set dummy $deplibs_check_method
2614
3515
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2615
3516
          for a_deplib in $deplibs; do
2616
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3517
            name=`expr $a_deplib : '-l\(.*\)'`
2617
3518
            # 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
 
3519
            if test "$name" != "" && test  "$name" != "0"; then
 
3520
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3521
                case " $predeps $postdeps " in
 
3522
                *" $a_deplib "*)
 
3523
                  newdeplibs="$newdeplibs $a_deplib"
 
3524
                  a_deplib=""
 
3525
                  ;;
 
3526
                esac
 
3527
              fi
 
3528
              if test -n "$a_deplib" ; then
 
3529
                libname=`eval \\$echo \"$libname_spec\"`
 
3530
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3531
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3532
                  for potent_lib in $potential_libs; do
2623
3533
                      # Follow soft links.
2624
3534
                      if ls -lLd "$potent_lib" 2>/dev/null \
2625
3535
                         | grep " -> " >/dev/null; then
2632
3542
                      # but so what?
2633
3543
                      potlib="$potent_lib"
2634
3544
                      while test -h "$potlib" 2>/dev/null; do
2635
 
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
 
3545
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2636
3546
                        case $potliblink in
2637
3547
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2638
3548
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2639
3549
                        esac
2640
3550
                      done
2641
3551
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2642
 
                         | sed 10q \
2643
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3552
                         | ${SED} 10q \
 
3553
                         | $EGREP "$file_magic_regex" > /dev/null; then
2644
3554
                        newdeplibs="$newdeplibs $a_deplib"
2645
3555
                        a_deplib=""
2646
3556
                        break 2
2647
3557
                      fi
2648
 
                    done
2649
 
              done
 
3558
                  done
 
3559
                done
 
3560
              fi
2650
3561
              if test -n "$a_deplib" ; then
2651
3562
                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."
 
3563
                $echo
 
3564
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3565
                $echo "*** I have the capability to make that library automatically link in when"
 
3566
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3567
                $echo "*** shared version of the library, which you do not appear to have"
 
3568
                $echo "*** because I did check the linker path looking for a file starting"
 
3569
                if test -z "$potlib" ; then
 
3570
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3571
                else
 
3572
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3573
                  $echo "*** using a file magic. Last file checked: $potlib"
 
3574
                fi
2657
3575
              fi
2658
3576
            else
2659
3577
              # Add a -L argument.
2665
3583
          set dummy $deplibs_check_method
2666
3584
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2667
3585
          for a_deplib in $deplibs; do
2668
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3586
            name=`expr $a_deplib : '-l\(.*\)'`
2669
3587
            # If $name is empty we are operating on a -L argument.
2670
3588
            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
 
3589
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3590
                case " $predeps $postdeps " in
 
3591
                *" $a_deplib "*)
 
3592
                  newdeplibs="$newdeplibs $a_deplib"
 
3593
                  a_deplib=""
 
3594
                  ;;
 
3595
                esac
 
3596
              fi
 
3597
              if test -n "$a_deplib" ; then
 
3598
                libname=`eval \\$echo \"$libname_spec\"`
 
3599
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3600
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3601
                  for potent_lib in $potential_libs; do
 
3602
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3603
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3604
                        | ${SED} 10q \
 
3605
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3606
                      newdeplibs="$newdeplibs $a_deplib"
 
3607
                      a_deplib=""
 
3608
                      break 2
 
3609
                    fi
 
3610
                  done
2682
3611
                done
2683
 
              done
 
3612
              fi
2684
3613
              if test -n "$a_deplib" ; then
2685
3614
                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."
 
3615
                $echo
 
3616
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3617
                $echo "*** I have the capability to make that library automatically link in when"
 
3618
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3619
                $echo "*** shared version of the library, which you do not appear to have"
 
3620
                $echo "*** because I did check the linker path looking for a file starting"
 
3621
                if test -z "$potlib" ; then
 
3622
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3623
                else
 
3624
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3625
                  $echo "*** using a regex pattern. Last file checked: $potlib"
 
3626
                fi
2691
3627
              fi
2692
3628
            else
2693
3629
              # Add a -L argument.
2697
3633
          ;;
2698
3634
        none | unknown | *)
2699
3635
          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
 
3636
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3637
            -e 's/ -[LR][^ ]*//g'`
 
3638
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3639
            for i in $predeps $postdeps ; do
 
3640
              # can't use Xsed below, because $i might contain '/'
 
3641
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3642
            done
 
3643
          fi
 
3644
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3645
            | grep . >/dev/null; then
 
3646
            $echo
2704
3647
            if test "X$deplibs_check_method" = "Xnone"; then
2705
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3648
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2706
3649
            else
2707
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3650
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2708
3651
            fi
2709
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3652
            $echo "*** All declared inter-library dependencies are being dropped."
2710
3653
            droppeddeps=yes
2711
3654
          fi
2712
3655
          ;;
2726
3669
 
2727
3670
        if test "$droppeddeps" = yes; then
2728
3671
          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."
 
3672
            $echo
 
3673
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3674
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3675
            $echo "*** a static module, that should work as long as the dlopening"
 
3676
            $echo "*** application is linked with the -dlopen flag."
2734
3677
            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."
 
3678
              $echo
 
3679
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3680
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3681
              $echo "*** not find such a program.  So, this module is probably useless."
 
3682
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2740
3683
            fi
2741
3684
            if test "$build_old_libs" = no; then
2742
3685
              oldlibs="$output_objdir/$libname.$libext"
2746
3689
              build_libtool_libs=no
2747
3690
            fi
2748
3691
          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."
 
3692
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3693
            $echo "*** automatically added whenever a program is linked with this library"
 
3694
            $echo "*** or is declared to -dlopen it."
2752
3695
 
2753
3696
            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."
 
3697
              $echo
 
3698
              $echo "*** Since this library must not contain undefined symbols,"
 
3699
              $echo "*** because either the platform does not support them or"
 
3700
              $echo "*** it was explicitly requested with -no-undefined,"
 
3701
              $echo "*** libtool will only create a static version of it."
2759
3702
              if test "$build_old_libs" = no; then
2760
3703
                oldlibs="$output_objdir/$libname.$libext"
2761
3704
                build_libtool_libs=module
2813
3756
          if test -n "$hardcode_libdir_separator" &&
2814
3757
             test -n "$hardcode_libdirs"; then
2815
3758
            libdir="$hardcode_libdirs"
2816
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3759
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3760
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3761
            else
 
3762
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3763
            fi
2817
3764
          fi
2818
3765
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2819
3766
            # We should set the runpath_var.
2833
3780
        fi
2834
3781
 
2835
3782
        # Get the real and link names of the library.
 
3783
        eval shared_ext=\"$shrext_cmds\"
2836
3784
        eval library_names=\"$library_names_spec\"
2837
3785
        set dummy $library_names
2838
3786
        realname="$2"
2843
3791
        else
2844
3792
          soname="$realname"
2845
3793
        fi
2846
 
        test -z "$dlname" && dlname=$soname
 
3794
        if test -z "$dlname"; then
 
3795
          dlname=$soname
 
3796
        fi
2847
3797
 
2848
3798
        lib="$output_objdir/$realname"
2849
3799
        for link
2851
3801
          linknames="$linknames $link"
2852
3802
        done
2853
3803
 
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
3804
        # Use standard objects if they are pic
2872
3805
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2873
3806
 
2877
3810
            $show "generating symbol list for \`$libname.la'"
2878
3811
            export_symbols="$output_objdir/$libname.exp"
2879
3812
            $run $rm $export_symbols
2880
 
            eval cmds=\"$export_symbols_cmds\"
 
3813
            cmds=$export_symbols_cmds
2881
3814
            save_ifs="$IFS"; IFS='~'
2882
3815
            for cmd in $cmds; do
2883
3816
              IFS="$save_ifs"
2884
 
              $show "$cmd"
2885
 
              $run eval "$cmd" || exit $?
 
3817
              eval cmd=\"$cmd\"
 
3818
              if len=`expr "X$cmd" : ".*"` &&
 
3819
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3820
                $show "$cmd"
 
3821
                $run eval "$cmd" || exit $?
 
3822
                skipped_export=false
 
3823
              else
 
3824
                # The command line is too long to execute in one step.
 
3825
                $show "using reloadable object file for export list..."
 
3826
                skipped_export=:
 
3827
                # Break out early, otherwise skipped_export may be
 
3828
                # set to false by a later but shorter cmd.
 
3829
                break
 
3830
              fi
2886
3831
            done
2887
3832
            IFS="$save_ifs"
2888
3833
            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"'
 
3834
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3835
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2891
3836
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2892
3837
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2893
3838
            fi
2898
3843
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2899
3844
        fi
2900
3845
 
 
3846
        tmp_deplibs=
 
3847
        for test_deplib in $deplibs; do
 
3848
                case " $convenience " in
 
3849
                *" $test_deplib "*) ;;
 
3850
                *)
 
3851
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3852
                        ;;
 
3853
                esac
 
3854
        done
 
3855
        deplibs="$tmp_deplibs"
 
3856
 
2901
3857
        if test -n "$convenience"; then
2902
3858
          if test -n "$whole_archive_flag_spec"; then
 
3859
            save_libobjs=$libobjs
2903
3860
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2904
3861
          else
2905
3862
            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
3863
            generated="$generated $gentop"
2915
3864
 
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
 
3865
            func_extract_archives $gentop $convenience
 
3866
            libobjs="$libobjs $func_extract_archives_result"
2938
3867
          fi
2939
3868
        fi
2940
 
 
 
3869
        
2941
3870
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2942
3871
          eval flag=\"$thread_safe_flag_spec\"
2943
3872
          linker_flags="$linker_flags $flag"
2949
3878
        fi
2950
3879
 
2951
3880
        # Do each of the archive commands.
 
3881
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3882
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3883
            eval test_cmds=\"$module_expsym_cmds\"
 
3884
            cmds=$module_expsym_cmds
 
3885
          else
 
3886
            eval test_cmds=\"$module_cmds\"
 
3887
            cmds=$module_cmds
 
3888
          fi
 
3889
        else
2952
3890
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2953
 
          eval cmds=\"$archive_expsym_cmds\"
2954
 
        else
2955
 
          eval cmds=\"$archive_cmds\"
 
3891
          eval test_cmds=\"$archive_expsym_cmds\"
 
3892
          cmds=$archive_expsym_cmds
 
3893
        else
 
3894
          eval test_cmds=\"$archive_cmds\"
 
3895
          cmds=$archive_cmds
 
3896
          fi
 
3897
        fi
 
3898
 
 
3899
        if test "X$skipped_export" != "X:" &&
 
3900
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
3901
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3902
          :
 
3903
        else
 
3904
          # The command line is too long to link in one step, link piecewise.
 
3905
          $echo "creating reloadable object files..."
 
3906
 
 
3907
          # Save the value of $output and $libobjs because we want to
 
3908
          # use them later.  If we have whole_archive_flag_spec, we
 
3909
          # want to use save_libobjs as it was before
 
3910
          # whole_archive_flag_spec was expanded, because we can't
 
3911
          # assume the linker understands whole_archive_flag_spec.
 
3912
          # This may have to be revisited, in case too many
 
3913
          # convenience libraries get linked in and end up exceeding
 
3914
          # the spec.
 
3915
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
3916
            save_libobjs=$libobjs
 
3917
          fi
 
3918
          save_output=$output
 
3919
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
 
3920
 
 
3921
          # Clear the reloadable object creation command queue and
 
3922
          # initialize k to one.
 
3923
          test_cmds=
 
3924
          concat_cmds=
 
3925
          objlist=
 
3926
          delfiles=
 
3927
          last_robj=
 
3928
          k=1
 
3929
          output=$output_objdir/$output_la-${k}.$objext
 
3930
          # Loop over the list of objects to be linked.
 
3931
          for obj in $save_libobjs
 
3932
          do
 
3933
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3934
            if test "X$objlist" = X ||
 
3935
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
3936
                 test "$len" -le "$max_cmd_len"; }; then
 
3937
              objlist="$objlist $obj"
 
3938
            else
 
3939
              # The command $test_cmds is almost too long, add a
 
3940
              # command to the queue.
 
3941
              if test "$k" -eq 1 ; then
 
3942
                # The first file doesn't have a previous command to add.
 
3943
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3944
              else
 
3945
                # All subsequent reloadable object files will link in
 
3946
                # the last one created.
 
3947
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
 
3948
              fi
 
3949
              last_robj=$output_objdir/$output_la-${k}.$objext
 
3950
              k=`expr $k + 1`
 
3951
              output=$output_objdir/$output_la-${k}.$objext
 
3952
              objlist=$obj
 
3953
              len=1
 
3954
            fi
 
3955
          done
 
3956
          # Handle the remaining objects by creating one last
 
3957
          # reloadable object file.  All subsequent reloadable object
 
3958
          # files will link in the last one created.
 
3959
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
3960
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3961
 
 
3962
          if ${skipped_export-false}; then
 
3963
            $show "generating symbol list for \`$libname.la'"
 
3964
            export_symbols="$output_objdir/$libname.exp"
 
3965
            $run $rm $export_symbols
 
3966
            libobjs=$output
 
3967
            # Append the command to create the export file.
 
3968
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3969
          fi
 
3970
 
 
3971
          # Set up a command to remove the reloadable object files
 
3972
          # after they are used.
 
3973
          i=0
 
3974
          while test "$i" -lt "$k"
 
3975
          do
 
3976
            i=`expr $i + 1`
 
3977
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
 
3978
          done
 
3979
 
 
3980
          $echo "creating a temporary reloadable object file: $output"
 
3981
 
 
3982
          # Loop through the commands generated above and execute them.
 
3983
          save_ifs="$IFS"; IFS='~'
 
3984
          for cmd in $concat_cmds; do
 
3985
            IFS="$save_ifs"
 
3986
            $show "$cmd"
 
3987
            $run eval "$cmd" || exit $?
 
3988
          done
 
3989
          IFS="$save_ifs"
 
3990
 
 
3991
          libobjs=$output
 
3992
          # Restore the value of output.
 
3993
          output=$save_output
 
3994
 
 
3995
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
3996
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
3997
          fi
 
3998
          # Expand the library linking commands again to reset the
 
3999
          # value of $libobjs for piecewise linking.
 
4000
 
 
4001
          # Do each of the archive commands.
 
4002
          if test "$module" = yes && test -n "$module_cmds" ; then
 
4003
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
4004
              cmds=$module_expsym_cmds
 
4005
            else
 
4006
              cmds=$module_cmds
 
4007
            fi
 
4008
          else
 
4009
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
4010
            cmds=$archive_expsym_cmds
 
4011
          else
 
4012
            cmds=$archive_cmds
 
4013
            fi
 
4014
          fi
 
4015
 
 
4016
          # Append the command to remove the reloadable object files
 
4017
          # to the just-reset $cmds.
 
4018
          eval cmds=\"\$cmds~\$rm $delfiles\"
2956
4019
        fi
2957
4020
        save_ifs="$IFS"; IFS='~'
2958
4021
        for cmd in $cmds; do
2959
4022
          IFS="$save_ifs"
 
4023
          eval cmd=\"$cmd\"
2960
4024
          $show "$cmd"
2961
 
          $run eval "$cmd" || exit $?
 
4025
          $run eval "$cmd" || {
 
4026
            lt_exit=$?
 
4027
 
 
4028
            # Restore the uninstalled library and exit
 
4029
            if test "$mode" = relink; then
 
4030
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4031
            fi
 
4032
 
 
4033
            exit $lt_exit
 
4034
          }
2962
4035
        done
2963
4036
        IFS="$save_ifs"
2964
4037
 
2965
4038
        # Restore the uninstalled library and exit
2966
4039
        if test "$mode" = relink; then
2967
4040
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2968
 
          exit 0
 
4041
 
 
4042
          if test -n "$convenience"; then
 
4043
            if test -z "$whole_archive_flag_spec"; then
 
4044
              $show "${rm}r $gentop"
 
4045
              $run ${rm}r "$gentop"
 
4046
            fi
 
4047
          fi
 
4048
 
 
4049
          exit $EXIT_SUCCESS
2969
4050
        fi
2970
4051
 
2971
4052
        # Create links to the real library.
3013
4094
      *.lo)
3014
4095
        if test -n "$objs$old_deplibs"; then
3015
4096
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3016
 
          exit 1
 
4097
          exit $EXIT_FAILURE
3017
4098
        fi
3018
4099
        libobj="$output"
3019
4100
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3042
4123
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3043
4124
        else
3044
4125
          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
4126
          generated="$generated $gentop"
3054
4127
 
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
 
4128
          func_extract_archives $gentop $convenience
 
4129
          reload_conv_objs="$reload_objs $func_extract_archives_result"
3077
4130
        fi
3078
4131
      fi
3079
4132
 
3081
4134
      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
4135
 
3083
4136
      output="$obj"
3084
 
      eval cmds=\"$reload_cmds\"
 
4137
      cmds=$reload_cmds
3085
4138
      save_ifs="$IFS"; IFS='~'
3086
4139
      for cmd in $cmds; do
3087
4140
        IFS="$save_ifs"
 
4141
        eval cmd=\"$cmd\"
3088
4142
        $show "$cmd"
3089
4143
        $run eval "$cmd" || exit $?
3090
4144
      done
3097
4151
          $run ${rm}r $gentop
3098
4152
        fi
3099
4153
 
3100
 
        exit 0
 
4154
        exit $EXIT_SUCCESS
3101
4155
      fi
3102
4156
 
3103
4157
      if test "$build_libtool_libs" != yes; then
3108
4162
 
3109
4163
        # Create an invalid libtool object if no PIC, so that we don't
3110
4164
        # accidentally link it into a program.
3111
 
        $show "echo timestamp > $libobj"
3112
 
        $run eval "echo timestamp > $libobj" || exit $?
3113
 
        exit 0
 
4165
        # $show "echo timestamp > $libobj"
 
4166
        # $run eval "echo timestamp > $libobj" || exit $?
 
4167
        exit $EXIT_SUCCESS
3114
4168
      fi
3115
4169
 
3116
4170
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3117
4171
        # Only do commands if we really have different PIC objects.
3118
4172
        reload_objs="$libobjs $reload_conv_objs"
3119
4173
        output="$libobj"
3120
 
        eval cmds=\"$reload_cmds\"
 
4174
        cmds=$reload_cmds
3121
4175
        save_ifs="$IFS"; IFS='~'
3122
4176
        for cmd in $cmds; do
3123
4177
          IFS="$save_ifs"
 
4178
          eval cmd=\"$cmd\"
3124
4179
          $show "$cmd"
3125
4180
          $run eval "$cmd" || exit $?
3126
4181
        done
3127
4182
        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
4183
      fi
3143
4184
 
3144
4185
      if test -n "$gentop"; then
3146
4187
        $run ${rm}r $gentop
3147
4188
      fi
3148
4189
 
3149
 
      exit 0
 
4190
      exit $EXIT_SUCCESS
3150
4191
      ;;
3151
4192
 
3152
4193
    prog)
3153
4194
      case $host in
3154
 
        *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
 
4195
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3155
4196
      esac
3156
4197
      if test -n "$vinfo"; then
3157
4198
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3176
4217
        ;;
3177
4218
      esac
3178
4219
 
 
4220
      case $host in
 
4221
      *darwin*)
 
4222
        # Don't allow lazy linking, it breaks C++ global constructors
 
4223
        if test "$tagname" = CXX ; then
 
4224
        compile_command="$compile_command ${wl}-bind_at_load"
 
4225
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4226
        fi
 
4227
        ;;
 
4228
      esac
 
4229
 
3179
4230
      compile_command="$compile_command $compile_deplibs"
3180
4231
      finalize_command="$finalize_command $finalize_deplibs"
3181
4232
 
3326
4377
            done
3327
4378
 
3328
4379
            if test -n "$exclude_expsyms"; then
3329
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4380
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3330
4381
              $run eval '$mv "$nlist"T "$nlist"'
3331
4382
            fi
3332
4383
 
3333
4384
            if test -n "$export_symbols_regex"; then
3334
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4385
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3335
4386
              $run eval '$mv "$nlist"T "$nlist"'
3336
4387
            fi
3337
4388
 
3338
4389
            # Prepare the list of exported symbols
3339
4390
            if test -z "$export_symbols"; then
3340
 
              export_symbols="$output_objdir/$output.exp"
 
4391
              export_symbols="$output_objdir/$outputname.exp"
3341
4392
              $run $rm $export_symbols
3342
 
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4393
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3343
4394
            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'
 
4395
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4396
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3346
4397
              $run eval 'mv "$nlist"T "$nlist"'
3347
4398
            fi
3348
4399
          fi
3349
4400
 
3350
4401
          for arg in $dlprefiles; do
3351
4402
            $show "extracting global C symbols from \`$arg'"
3352
 
            name=`echo "$arg" | sed -e 's%^.*/%%'`
3353
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4403
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4404
            $run eval '$echo ": $name " >> "$nlist"'
3354
4405
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3355
4406
          done
3356
4407
 
3359
4410
            test -f "$nlist" || : > "$nlist"
3360
4411
 
3361
4412
            if test -n "$exclude_expsyms"; then
3362
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4413
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3363
4414
              $mv "$nlist"T "$nlist"
3364
4415
            fi
3365
4416
 
3366
4417
            # Try sorting and uniquifying the output.
3367
 
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
4418
            if grep -v "^: " < "$nlist" |
 
4419
                if sort -k 3 </dev/null >/dev/null 2>&1; then
 
4420
                  sort -k 3
 
4421
                else
 
4422
                  sort +2
 
4423
                fi |
 
4424
                uniq > "$nlist"S; then
3368
4425
              :
3369
4426
            else
3370
4427
              grep -v "^: " < "$nlist" > "$nlist"S
3373
4430
            if test -f "$nlist"S; then
3374
4431
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3375
4432
            else
3376
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4433
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3377
4434
            fi
3378
4435
 
3379
4436
            $echo >> "$output_objdir/$dlsyms" "\
3388
4445
#endif
3389
4446
 
3390
4447
/* The mapping between symbol names and symbols. */
 
4448
"
 
4449
 
 
4450
            case $host in
 
4451
            *cygwin* | *mingw* )
 
4452
          $echo >> "$output_objdir/$dlsyms" "\
 
4453
/* DATA imports from DLLs on WIN32 can't be const, because
 
4454
   runtime relocations are performed -- see ld's documentation
 
4455
   on pseudo-relocs */
 
4456
struct {
 
4457
"
 
4458
              ;;
 
4459
            * )
 
4460
          $echo >> "$output_objdir/$dlsyms" "\
3391
4461
const struct {
 
4462
"
 
4463
              ;;
 
4464
            esac
 
4465
 
 
4466
 
 
4467
          $echo >> "$output_objdir/$dlsyms" "\
3392
4468
  const char *name;
3393
4469
  lt_ptr address;
3394
4470
}
3425
4501
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3426
4502
            case "$compile_command " in
3427
4503
            *" -static "*) ;;
3428
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4504
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3429
4505
            esac;;
3430
4506
          *-*-hpux*)
3431
4507
            case "$compile_command " in
3432
4508
            *" -static "*) ;;
3433
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4509
            *) pic_flag_for_symtable=" $pic_flag";;
3434
4510
            esac
3435
4511
          esac
3436
4512
 
3437
4513
          # 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 $?
 
4514
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4515
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3440
4516
 
3441
4517
          # Clean up the generated files.
3442
4518
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3448
4524
          ;;
3449
4525
        *)
3450
4526
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3451
 
          exit 1
 
4527
          exit $EXIT_FAILURE
3452
4528
          ;;
3453
4529
        esac
3454
4530
      else
3536
4612
        # Link the executable and exit
3537
4613
        $show "$link_command"
3538
4614
        $run eval "$link_command" || exit $?
3539
 
        exit 0
 
4615
        exit $EXIT_SUCCESS
3540
4616
      fi
3541
4617
 
3542
4618
      if test "$hardcode_action" = relink; then
3591
4667
      fi
3592
4668
 
3593
4669
      # 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";;
 
4670
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4671
        case $progpath in
 
4672
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4673
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
3598
4674
        esac
3599
4675
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3600
4676
      else
3606
4682
        # win32 will think the script is a binary if it has
3607
4683
        # a .exe suffix, so we strip it off here.
3608
4684
        case $output in
3609
 
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
4685
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3610
4686
        esac
3611
4687
        # test for cygwin because mv fails w/o .exe extensions
3612
4688
        case $host in
3613
 
          *cygwin*) exeext=.exe ;;
 
4689
          *cygwin*)
 
4690
            exeext=.exe
 
4691
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3614
4692
          *) exeext= ;;
3615
4693
        esac
 
4694
        case $host in
 
4695
          *cygwin* | *mingw* )
 
4696
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
 
4697
            cwrapper=`$echo ${output}.exe`
 
4698
            $rm $cwrappersource $cwrapper
 
4699
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4700
 
 
4701
            cat > $cwrappersource <<EOF
 
4702
 
 
4703
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4704
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4705
 
 
4706
   The $output program cannot be directly executed until all the libtool
 
4707
   libraries that it depends on are installed.
 
4708
 
 
4709
   This wrapper executable should never be moved out of the build directory.
 
4710
   If it is, it will not operate correctly.
 
4711
 
 
4712
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4713
   but could eventually absorb all of the scripts functionality and
 
4714
   exec $objdir/$outputname directly.
 
4715
*/
 
4716
EOF
 
4717
            cat >> $cwrappersource<<"EOF"
 
4718
#include <stdio.h>
 
4719
#include <stdlib.h>
 
4720
#include <unistd.h>
 
4721
#include <malloc.h>
 
4722
#include <stdarg.h>
 
4723
#include <assert.h>
 
4724
 
 
4725
#if defined(PATH_MAX)
 
4726
# define LT_PATHMAX PATH_MAX
 
4727
#elif defined(MAXPATHLEN)
 
4728
# define LT_PATHMAX MAXPATHLEN
 
4729
#else
 
4730
# define LT_PATHMAX 1024
 
4731
#endif
 
4732
 
 
4733
#ifndef DIR_SEPARATOR
 
4734
#define DIR_SEPARATOR '/'
 
4735
#endif
 
4736
 
 
4737
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4738
  defined (__OS2__)
 
4739
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4740
#ifndef DIR_SEPARATOR_2
 
4741
#define DIR_SEPARATOR_2 '\\'
 
4742
#endif
 
4743
#endif
 
4744
 
 
4745
#ifndef DIR_SEPARATOR_2
 
4746
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4747
#else /* DIR_SEPARATOR_2 */
 
4748
# define IS_DIR_SEPARATOR(ch) \
 
4749
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4750
#endif /* DIR_SEPARATOR_2 */
 
4751
 
 
4752
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4753
#define XFREE(stale) do { \
 
4754
  if (stale) { free ((void *) stale); stale = 0; } \
 
4755
} while (0)
 
4756
 
 
4757
const char *program_name = NULL;
 
4758
 
 
4759
void * xmalloc (size_t num);
 
4760
char * xstrdup (const char *string);
 
4761
char * basename (const char *name);
 
4762
char * fnqualify(const char *path);
 
4763
char * strendzap(char *str, const char *pat);
 
4764
void lt_fatal (const char *message, ...);
 
4765
 
 
4766
int
 
4767
main (int argc, char *argv[])
 
4768
{
 
4769
  char **newargz;
 
4770
  int i;
 
4771
 
 
4772
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4773
  newargz = XMALLOC(char *, argc+2);
 
4774
EOF
 
4775
 
 
4776
            cat >> $cwrappersource <<EOF
 
4777
  newargz[0] = "$SHELL";
 
4778
EOF
 
4779
 
 
4780
            cat >> $cwrappersource <<"EOF"
 
4781
  newargz[1] = fnqualify(argv[0]);
 
4782
  /* we know the script has the same name, without the .exe */
 
4783
  /* so make sure newargz[1] doesn't end in .exe */
 
4784
  strendzap(newargz[1],".exe");
 
4785
  for (i = 1; i < argc; i++)
 
4786
    newargz[i+1] = xstrdup(argv[i]);
 
4787
  newargz[argc+1] = NULL;
 
4788
EOF
 
4789
 
 
4790
            cat >> $cwrappersource <<EOF
 
4791
  execv("$SHELL",newargz);
 
4792
EOF
 
4793
 
 
4794
            cat >> $cwrappersource <<"EOF"
 
4795
  return 127;
 
4796
}
 
4797
 
 
4798
void *
 
4799
xmalloc (size_t num)
 
4800
{
 
4801
  void * p = (void *) malloc (num);
 
4802
  if (!p)
 
4803
    lt_fatal ("Memory exhausted");
 
4804
 
 
4805
  return p;
 
4806
}
 
4807
 
 
4808
char *
 
4809
xstrdup (const char *string)
 
4810
{
 
4811
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4812
;
 
4813
}
 
4814
 
 
4815
char *
 
4816
basename (const char *name)
 
4817
{
 
4818
  const char *base;
 
4819
 
 
4820
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4821
  /* Skip over the disk name in MSDOS pathnames. */
 
4822
  if (isalpha (name[0]) && name[1] == ':')
 
4823
    name += 2;
 
4824
#endif
 
4825
 
 
4826
  for (base = name; *name; name++)
 
4827
    if (IS_DIR_SEPARATOR (*name))
 
4828
      base = name + 1;
 
4829
  return (char *) base;
 
4830
}
 
4831
 
 
4832
char *
 
4833
fnqualify(const char *path)
 
4834
{
 
4835
  size_t size;
 
4836
  char *p;
 
4837
  char tmp[LT_PATHMAX + 1];
 
4838
 
 
4839
  assert(path != NULL);
 
4840
 
 
4841
  /* Is it qualified already? */
 
4842
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4843
  if (isalpha (path[0]) && path[1] == ':')
 
4844
    return xstrdup (path);
 
4845
#endif
 
4846
  if (IS_DIR_SEPARATOR (path[0]))
 
4847
    return xstrdup (path);
 
4848
 
 
4849
  /* prepend the current directory */
 
4850
  /* doesn't handle '~' */
 
4851
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4852
    lt_fatal ("getcwd failed");
 
4853
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4854
  p = XMALLOC(char, size);
 
4855
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4856
  return p;
 
4857
}
 
4858
 
 
4859
char *
 
4860
strendzap(char *str, const char *pat)
 
4861
{
 
4862
  size_t len, patlen;
 
4863
 
 
4864
  assert(str != NULL);
 
4865
  assert(pat != NULL);
 
4866
 
 
4867
  len = strlen(str);
 
4868
  patlen = strlen(pat);
 
4869
 
 
4870
  if (patlen <= len)
 
4871
  {
 
4872
    str += len - patlen;
 
4873
    if (strcmp(str, pat) == 0)
 
4874
      *str = '\0';
 
4875
  }
 
4876
  return str;
 
4877
}
 
4878
 
 
4879
static void
 
4880
lt_error_core (int exit_status, const char * mode,
 
4881
          const char * message, va_list ap)
 
4882
{
 
4883
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4884
  vfprintf (stderr, message, ap);
 
4885
  fprintf (stderr, ".\n");
 
4886
 
 
4887
  if (exit_status >= 0)
 
4888
    exit (exit_status);
 
4889
}
 
4890
 
 
4891
void
 
4892
lt_fatal (const char *message, ...)
 
4893
{
 
4894
  va_list ap;
 
4895
  va_start (ap, message);
 
4896
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4897
  va_end (ap);
 
4898
}
 
4899
EOF
 
4900
          # we should really use a build-platform specific compiler
 
4901
          # here, but OTOH, the wrappers (shell script and this C one)
 
4902
          # are only useful if you want to execute the "real" binary.
 
4903
          # Since the "real" binary is built for $host, then this
 
4904
          # wrapper might as well be built for $host, too.
 
4905
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4906
          ;;
 
4907
        esac
3616
4908
        $rm $output
3617
 
        trap "$rm $output; exit 1" 1 2 15
 
4909
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
3618
4910
 
3619
4911
        $echo > $output "\
3620
4912
#! $SHELL
3630
4922
 
3631
4923
# Sed substitution that helps us do robust quoting.  It backslashifies
3632
4924
# metacharacters that are still active within double-quoted strings.
3633
 
Xsed='sed -e 1s/^X//'
 
4925
Xsed='${SED} -e 1s/^X//'
3634
4926
sed_quote_subst='$sed_quote_subst'
3635
4927
 
3636
4928
# The HP-UX ksh and POSIX shell print the target directory to stdout
3637
4929
# if CDPATH is set.
3638
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
4930
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3639
4931
 
3640
4932
relink_command=\"$relink_command\"
3641
4933
 
3668
4960
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3669
4961
 
3670
4962
  # Follow symbolic links until we get to the real thisdir.
3671
 
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
4963
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3672
4964
  while test -n \"\$file\"; do
3673
4965
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3674
4966
 
3681
4973
    fi
3682
4974
 
3683
4975
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3684
 
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
4976
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3685
4977
  done
3686
4978
 
3687
4979
  # Try to get the absolute directory name.
3690
4982
"
3691
4983
 
3692
4984
        if test "$fast_install" = yes; then
3693
 
          echo >> $output "\
 
4985
          $echo >> $output "\
3694
4986
  program=lt-'$outputname'$exeext
3695
4987
  progdir=\"\$thisdir/$objdir\"
3696
4988
 
3697
4989
  if test ! -f \"\$progdir/\$program\" || \\
3698
 
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
4990
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3699
4991
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3700
4992
 
3701
4993
    file=\"\$\$-\$program\"
3706
4998
      $rm \"\$progdir/\$file\"
3707
4999
    fi"
3708
5000
 
3709
 
          echo >> $output "\
 
5001
          $echo >> $output "\
3710
5002
 
3711
5003
    # relink executable if necessary
3712
5004
    if test -n \"\$relink_command\"; then
3714
5006
      else
3715
5007
        $echo \"\$relink_command_output\" >&2
3716
5008
        $rm \"\$progdir/\$file\"
3717
 
        exit 1
 
5009
        exit $EXIT_FAILURE
3718
5010
      fi
3719
5011
    fi
3720
5012
 
3724
5016
    $rm \"\$progdir/\$file\"
3725
5017
  fi"
3726
5018
        else
3727
 
          echo >> $output "\
 
5019
          $echo >> $output "\
3728
5020
  program='$outputname'
3729
5021
  progdir=\"\$thisdir/$objdir\"
3730
5022
"
3731
5023
        fi
3732
5024
 
3733
 
        echo >> $output "\
 
5025
        $echo >> $output "\
3734
5026
 
3735
5027
  if test -f \"\$progdir/\$program\"; then"
3736
5028
 
3761
5053
      # Run the actual program with our arguments.
3762
5054
"
3763
5055
        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
5056
        # Backslashes separate directories on plain windows
3773
5057
        *-*-mingw | *-*-os2*)
3774
5058
          $echo >> $output "\
3775
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5059
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3776
5060
"
3777
5061
          ;;
3778
5062
 
3779
5063
        *)
3780
5064
          $echo >> $output "\
3781
 
      # Export the path to the program.
3782
 
      PATH=\"\$progdir:\$PATH\"
3783
 
      export PATH
3784
 
 
3785
 
      exec \$program \${1+\"\$@\"}
 
5065
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
3786
5066
"
3787
5067
          ;;
3788
5068
        esac
3789
5069
        $echo >> $output "\
3790
5070
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3791
 
      exit 1
 
5071
      exit $EXIT_FAILURE
3792
5072
    fi
3793
5073
  else
3794
5074
    # The program doesn't exist.
3795
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5075
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3796
5076
    \$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
 
5077
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
5078
    exit $EXIT_FAILURE
3799
5079
  fi
3800
5080
fi\
3801
5081
"
3802
5082
        chmod +x $output
3803
5083
      fi
3804
 
      exit 0
 
5084
      exit $EXIT_SUCCESS
3805
5085
      ;;
3806
5086
    esac
3807
5087
 
3817
5097
          oldobjs="$libobjs_save"
3818
5098
          build_libtool_libs=no
3819
5099
        else
3820
 
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
5100
          oldobjs="$old_deplibs $non_pic_objects"
3821
5101
        fi
3822
5102
        addlibs="$old_convenience"
3823
5103
      fi
3824
5104
 
3825
5105
      if test -n "$addlibs"; then
3826
5106
        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
5107
        generated="$generated $gentop"
3836
5108
 
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
 
5109
        func_extract_archives $gentop $addlibs
 
5110
        oldobjs="$oldobjs $func_extract_archives_result"
3860
5111
      fi
3861
5112
 
3862
5113
      # Do each command in the archive commands.
3863
5114
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3864
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5115
       cmds=$old_archive_from_new_cmds
3865
5116
      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"
 
5117
        # POSIX demands no paths to be encoded in archives.  We have
 
5118
        # to avoid creating archives with duplicate basenames if we
 
5119
        # might have to extract them afterwards, e.g., when creating a
 
5120
        # static archive out of a convenience library, or when linking
 
5121
        # the entirety of a libtool archive into another (currently
 
5122
        # not supported by libtool).
 
5123
        if (for obj in $oldobjs
 
5124
            do
 
5125
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5126
            done | sort | sort -uc >/dev/null 2>&1); then
 
5127
          :
 
5128
        else
 
5129
          $echo "copying selected object files to avoid basename conflicts..."
 
5130
 
 
5131
          if test -z "$gentop"; then
 
5132
            gentop="$output_objdir/${outputname}x"
 
5133
            generated="$generated $gentop"
 
5134
 
 
5135
            $show "${rm}r $gentop"
 
5136
            $run ${rm}r "$gentop"
 
5137
            $show "$mkdir $gentop"
 
5138
            $run $mkdir "$gentop"
 
5139
            status=$?
 
5140
            if test "$status" -ne 0 && test ! -d "$gentop"; then
 
5141
              exit $status
3876
5142
            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
5143
          fi
3882
 
        done
 
5144
 
 
5145
          save_oldobjs=$oldobjs
 
5146
          oldobjs=
 
5147
          counter=1
 
5148
          for obj in $save_oldobjs
 
5149
          do
 
5150
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5151
            case " $oldobjs " in
 
5152
            " ") oldobjs=$obj ;;
 
5153
            *[\ /]"$objbase "*)
 
5154
              while :; do
 
5155
                # Make sure we don't pick an alternate name that also
 
5156
                # overlaps.
 
5157
                newobj=lt$counter-$objbase
 
5158
                counter=`expr $counter + 1`
 
5159
                case " $oldobjs " in
 
5160
                *[\ /]"$newobj "*) ;;
 
5161
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5162
                esac
 
5163
              done
 
5164
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5165
              $run ln "$obj" "$gentop/$newobj" ||
 
5166
              $run cp "$obj" "$gentop/$newobj"
 
5167
              oldobjs="$oldobjs $gentop/$newobj"
 
5168
              ;;
 
5169
            *) oldobjs="$oldobjs $obj" ;;
 
5170
            esac
 
5171
          done
 
5172
        fi
3883
5173
 
3884
5174
        eval cmds=\"$old_archive_cmds\"
 
5175
 
 
5176
        if len=`expr "X$cmds" : ".*"` &&
 
5177
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5178
          cmds=$old_archive_cmds
 
5179
        else
 
5180
          # the command line is too long to link in one step, link in parts
 
5181
          $echo "using piecewise archive linking..."
 
5182
          save_RANLIB=$RANLIB
 
5183
          RANLIB=:
 
5184
          objlist=
 
5185
          concat_cmds=
 
5186
          save_oldobjs=$oldobjs
 
5187
 
 
5188
          # Is there a better way of finding the last object in the list?
 
5189
          for obj in $save_oldobjs
 
5190
          do
 
5191
            last_oldobj=$obj
 
5192
          done
 
5193
          for obj in $save_oldobjs
 
5194
          do
 
5195
            oldobjs="$objlist $obj"
 
5196
            objlist="$objlist $obj"
 
5197
            eval test_cmds=\"$old_archive_cmds\"
 
5198
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
5199
               test "$len" -le "$max_cmd_len"; then
 
5200
              :
 
5201
            else
 
5202
              # the above command should be used before it gets too long
 
5203
              oldobjs=$objlist
 
5204
              if test "$obj" = "$last_oldobj" ; then
 
5205
                RANLIB=$save_RANLIB
 
5206
              fi
 
5207
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5208
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5209
              objlist=
 
5210
            fi
 
5211
          done
 
5212
          RANLIB=$save_RANLIB
 
5213
          oldobjs=$objlist
 
5214
          if test "X$oldobjs" = "X" ; then
 
5215
            eval cmds=\"\$concat_cmds\"
 
5216
          else
 
5217
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5218
          fi
 
5219
        fi
3885
5220
      fi
3886
5221
      save_ifs="$IFS"; IFS='~'
3887
5222
      for cmd in $cmds; do
 
5223
        eval cmd=\"$cmd\"
3888
5224
        IFS="$save_ifs"
3889
5225
        $show "$cmd"
3890
5226
        $run eval "$cmd" || exit $?
3916
5252
        fi
3917
5253
      done
3918
5254
      # Quote the link command for shipping.
3919
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
 
5255
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
3920
5256
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5257
      if test "$hardcode_automatic" = yes ; then
 
5258
        relink_command=
 
5259
      fi
 
5260
 
3921
5261
 
3922
5262
      # Only create the output if not a dry run.
3923
5263
      if test -z "$run"; then
3933
5273
              case $deplib in
3934
5274
              *.la)
3935
5275
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3936
 
                eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
5276
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3937
5277
                if test -z "$libdir"; then
3938
5278
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3939
 
                  exit 1
 
5279
                  exit $EXIT_FAILURE
3940
5280
                fi
3941
5281
                newdependency_libs="$newdependency_libs $libdir/$name"
3942
5282
                ;;
3947
5287
            newdlfiles=
3948
5288
            for lib in $dlfiles; do
3949
5289
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3950
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5290
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3951
5291
              if test -z "$libdir"; then
3952
5292
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3953
 
                exit 1
 
5293
                exit $EXIT_FAILURE
3954
5294
              fi
3955
5295
              newdlfiles="$newdlfiles $libdir/$name"
3956
5296
            done
3958
5298
            newdlprefiles=
3959
5299
            for lib in $dlprefiles; do
3960
5300
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3961
 
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
5301
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3962
5302
              if test -z "$libdir"; then
3963
5303
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3964
 
                exit 1
 
5304
                exit $EXIT_FAILURE
3965
5305
              fi
3966
5306
              newdlprefiles="$newdlprefiles $libdir/$name"
3967
5307
            done
3968
5308
            dlprefiles="$newdlprefiles"
 
5309
          else
 
5310
            newdlfiles=
 
5311
            for lib in $dlfiles; do
 
5312
              case $lib in
 
5313
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5314
                *) abs=`pwd`"/$lib" ;;
 
5315
              esac
 
5316
              newdlfiles="$newdlfiles $abs"
 
5317
            done
 
5318
            dlfiles="$newdlfiles"
 
5319
            newdlprefiles=
 
5320
            for lib in $dlprefiles; do
 
5321
              case $lib in
 
5322
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5323
                *) abs=`pwd`"/$lib" ;;
 
5324
              esac
 
5325
              newdlprefiles="$newdlprefiles $abs"
 
5326
            done
 
5327
            dlprefiles="$newdlprefiles"
3969
5328
          fi
3970
5329
          $rm $output
3971
5330
          # place dlname in correct position for cygwin
3972
5331
          tdlname=$dlname
3973
5332
          case $host,$output,$installed,$module,$dlname in
3974
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5333
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3975
5334
          esac
3976
5335
          $echo > $output "\
3977
5336
# $outputname - a libtool library file
4000
5359
# Is this an already installed library?
4001
5360
installed=$installed
4002
5361
 
 
5362
# Should we warn about portability when linking against -modules?
 
5363
shouldnotlink=$module
 
5364
 
4003
5365
# Files to dlopen/dlpreopen
4004
5366
dlopen='$dlfiles'
4005
5367
dlpreopen='$dlprefiles'
4019
5381
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4020
5382
      ;;
4021
5383
    esac
4022
 
    exit 0
 
5384
    exit $EXIT_SUCCESS
4023
5385
    ;;
4024
5386
 
4025
5387
  # libtool install mode
4030
5392
    # install_prog (especially on Windows NT).
4031
5393
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4032
5394
       # Allow the use of GNU shtool's install command.
4033
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5395
       $echo "X$nonopt" | grep shtool > /dev/null; then
4034
5396
      # Aesthetically quote it.
4035
5397
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4036
5398
      case $arg in
4037
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5399
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
4038
5400
        arg="\"$arg\""
4039
5401
        ;;
4040
5402
      esac
4043
5405
      shift
4044
5406
    else
4045
5407
      install_prog=
4046
 
      arg="$nonopt"
 
5408
      arg=$nonopt
4047
5409
    fi
4048
5410
 
4049
5411
    # The real first argument should be the name of the installation program.
4050
5412
    # Aesthetically quote it.
4051
5413
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4052
5414
    case $arg in
4053
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5415
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
4054
5416
      arg="\"$arg\""
4055
5417
      ;;
4056
5418
    esac
4068
5430
    do
4069
5431
      if test -n "$dest"; then
4070
5432
        files="$files $dest"
4071
 
        dest="$arg"
 
5433
        dest=$arg
4072
5434
        continue
4073
5435
      fi
4074
5436
 
4075
5437
      case $arg in
4076
5438
      -d) isdir=yes ;;
4077
 
      -f) prev="-f" ;;
4078
 
      -g) prev="-g" ;;
4079
 
      -m) prev="-m" ;;
4080
 
      -o) prev="-o" ;;
 
5439
      -f) 
 
5440
        case " $install_prog " in
 
5441
        *[\\\ /]cp\ *) ;;
 
5442
        *) prev=$arg ;;
 
5443
        esac
 
5444
        ;;
 
5445
      -g | -m | -o) prev=$arg ;;
4081
5446
      -s)
4082
5447
        stripme=" -s"
4083
5448
        continue
4084
5449
        ;;
4085
 
      -*) ;;
4086
 
 
 
5450
      -*)
 
5451
        ;;
4087
5452
      *)
4088
5453
        # If the previous option needed an argument, then skip it.
4089
5454
        if test -n "$prev"; then
4090
5455
          prev=
4091
5456
        else
4092
 
          dest="$arg"
 
5457
          dest=$arg
4093
5458
          continue
4094
5459
        fi
4095
5460
        ;;
4098
5463
      # Aesthetically quote the argument.
4099
5464
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4100
5465
      case $arg in
4101
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5466
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
4102
5467
        arg="\"$arg\""
4103
5468
        ;;
4104
5469
      esac
4108
5473
    if test -z "$install_prog"; then
4109
5474
      $echo "$modename: you must specify an install program" 1>&2
4110
5475
      $echo "$help" 1>&2
4111
 
      exit 1
 
5476
      exit $EXIT_FAILURE
4112
5477
    fi
4113
5478
 
4114
5479
    if test -n "$prev"; then
4115
5480
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4116
5481
      $echo "$help" 1>&2
4117
 
      exit 1
 
5482
      exit $EXIT_FAILURE
4118
5483
    fi
4119
5484
 
4120
5485
    if test -z "$files"; then
4124
5489
        $echo "$modename: you must specify a destination" 1>&2
4125
5490
      fi
4126
5491
      $echo "$help" 1>&2
4127
 
      exit 1
 
5492
      exit $EXIT_FAILURE
4128
5493
    fi
4129
5494
 
4130
5495
    # Strip any trailing slash from the destination.
4145
5510
      if test "$#" -gt 2; then
4146
5511
        $echo "$modename: \`$dest' is not a directory" 1>&2
4147
5512
        $echo "$help" 1>&2
4148
 
        exit 1
 
5513
        exit $EXIT_FAILURE
4149
5514
      fi
4150
5515
    fi
4151
5516
    case $destdir in
4157
5522
        *)
4158
5523
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4159
5524
          $echo "$help" 1>&2
4160
 
          exit 1
 
5525
          exit $EXIT_FAILURE
4161
5526
          ;;
4162
5527
        esac
4163
5528
      done
4182
5547
 
4183
5548
      *.la)
4184
5549
        # 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 :
 
5550
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4186
5551
        else
4187
5552
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4188
5553
          $echo "$help" 1>&2
4189
 
          exit 1
 
5554
          exit $EXIT_FAILURE
4190
5555
        fi
4191
5556
 
4192
5557
        library_names=
4218
5583
 
4219
5584
        if test -n "$relink_command"; then
4220
5585
          # Determine the prefix the user has applied to our future dir.
4221
 
          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
 
5586
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
4222
5587
 
4223
5588
          # Don't allow the user to place us outside of our expected
4224
5589
          # location b/c this prevents finding dependent libraries that
4225
5590
          # are installed to the same prefix.
 
5591
          # At present, this check doesn't affect windows .dll's that
 
5592
          # are installed into $libdir/../bin (currently, that works fine)
 
5593
          # but it's something to keep an eye on.
4226
5594
          if test "$inst_prefix_dir" = "$destdir"; then
4227
5595
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4228
 
            exit 1
 
5596
            exit $EXIT_FAILURE
4229
5597
          fi
4230
5598
 
4231
5599
          if test -n "$inst_prefix_dir"; then
4232
5600
            # 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%"`
 
5601
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4234
5602
          else
4235
 
            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
 
5603
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4236
5604
          fi
4237
5605
 
4238
5606
          $echo "$modename: warning: relinking \`$file'" 1>&2
4240
5608
          if $run eval "$relink_command"; then :
4241
5609
          else
4242
5610
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4243
 
            exit 1
 
5611
            exit $EXIT_FAILURE
4244
5612
          fi
4245
5613
        fi
4246
5614
 
4264
5632
 
4265
5633
          if test "$#" -gt 0; then
4266
5634
            # Delete the old symlinks, and create new ones.
 
5635
            # Try `ln -sf' first, because the `ln' binary might depend on
 
5636
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
5637
            # so we also need to try rm && ln -s.
4267
5638
            for linkname
4268
5639
            do
4269
5640
              if test "$linkname" != "$realname"; then
4270
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4271
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
5641
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
5642
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
4272
5643
              fi
4273
5644
            done
4274
5645
          fi
4275
5646
 
4276
5647
          # Do each command in the postinstall commands.
4277
5648
          lib="$destdir/$realname"
4278
 
          eval cmds=\"$postinstall_cmds\"
 
5649
          cmds=$postinstall_cmds
4279
5650
          save_ifs="$IFS"; IFS='~'
4280
5651
          for cmd in $cmds; do
4281
5652
            IFS="$save_ifs"
 
5653
            eval cmd=\"$cmd\"
4282
5654
            $show "$cmd"
4283
 
            $run eval "$cmd" || exit $?
 
5655
            $run eval "$cmd" || {
 
5656
              lt_exit=$?
 
5657
 
 
5658
              # Restore the uninstalled library and exit
 
5659
              if test "$mode" = relink; then
 
5660
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
5661
              fi
 
5662
 
 
5663
              exit $lt_exit
 
5664
            }
4284
5665
          done
4285
5666
          IFS="$save_ifs"
4286
5667
        fi
4318
5699
        *)
4319
5700
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4320
5701
          $echo "$help" 1>&2
4321
 
          exit 1
 
5702
          exit $EXIT_FAILURE
4322
5703
          ;;
4323
5704
        esac
4324
5705
 
4336
5717
          $show "$install_prog $staticobj $staticdest"
4337
5718
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4338
5719
        fi
4339
 
        exit 0
 
5720
        exit $EXIT_SUCCESS
4340
5721
        ;;
4341
5722
 
4342
5723
      *)
4348
5729
          destfile="$destdir/$destfile"
4349
5730
        fi
4350
5731
 
 
5732
        # If the file is missing, and there is a .exe on the end, strip it
 
5733
        # because it is most likely a libtool script we actually want to
 
5734
        # install
 
5735
        stripped_ext=""
 
5736
        case $file in
 
5737
          *.exe)
 
5738
            if test ! -f "$file"; then
 
5739
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5740
              stripped_ext=".exe"
 
5741
            fi
 
5742
            ;;
 
5743
        esac
 
5744
 
4351
5745
        # 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
 
5746
        case $host in
 
5747
        *cygwin*|*mingw*)
 
5748
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
 
5749
            ;;
 
5750
        *)
 
5751
            wrapper=$file
 
5752
            ;;
 
5753
        esac
 
5754
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4353
5755
          notinst_deplibs=
4354
5756
          relink_command=
4355
5757
 
 
5758
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
5759
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
5760
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
5761
          # `FILE.' does not work on cygwin managed mounts.
 
5762
          #
4356
5763
          # If there is no directory component, then add one.
4357
 
          case $file in
4358
 
          */* | *\\*) . $file ;;
4359
 
          *) . ./$file ;;
 
5764
          case $wrapper in
 
5765
          */* | *\\*) . ${wrapper} ;;
 
5766
          *) . ./${wrapper} ;;
4360
5767
          esac
4361
5768
 
4362
5769
          # Check the variables that should have been set.
4363
5770
          if test -z "$notinst_deplibs"; then
4364
 
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4365
 
            exit 1
 
5771
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
 
5772
            exit $EXIT_FAILURE
4366
5773
          fi
4367
5774
 
4368
5775
          finalize=yes
4384
5791
          done
4385
5792
 
4386
5793
          relink_command=
 
5794
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
5795
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
5796
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
5797
          # `FILE.' does not work on cygwin managed mounts.
 
5798
          #
4387
5799
          # If there is no directory component, then add one.
4388
 
          case $file in
4389
 
          */* | *\\*) . $file ;;
4390
 
          *) . ./$file ;;
 
5800
          case $wrapper in
 
5801
          */* | *\\*) . ${wrapper} ;;
 
5802
          *) . ./${wrapper} ;;
4391
5803
          esac
4392
5804
 
4393
5805
          outputname=
4395
5807
            if test "$finalize" = yes && test -z "$run"; then
4396
5808
              tmpdir="/tmp"
4397
5809
              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 :
 
5810
              tmpdir="$tmpdir/libtool-$$"
 
5811
              save_umask=`umask`
 
5812
              umask 0077
 
5813
              if $mkdir "$tmpdir"; then
 
5814
                umask $save_umask
4404
5815
              else
 
5816
                umask $save_umask
4405
5817
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4406
5818
                continue
4407
5819
              fi
4408
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
5820
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4409
5821
              outputname="$tmpdir/$file"
4410
5822
              # Replace the output file specification.
4411
5823
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4423
5835
            fi
4424
5836
          else
4425
5837
            # Install the binary that we compiled earlier.
4426
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5838
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4427
5839
          fi
4428
5840
        fi
4429
5841
 
4430
5842
        # remove .exe since cygwin /usr/bin/install will append another
4431
 
        # one anyways
 
5843
        # one anyway 
4432
5844
        case $install_prog,$host in
4433
 
        /usr/bin/install*,*cygwin*)
 
5845
        */usr/bin/install*,*cygwin*)
4434
5846
          case $file:$destfile in
4435
5847
          *.exe:*.exe)
4436
5848
            # this is ok
4439
5851
            destfile=$destfile.exe
4440
5852
            ;;
4441
5853
          *:*.exe)
4442
 
            destfile=`echo $destfile | sed -e 's,.exe$,,'`
 
5854
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4443
5855
            ;;
4444
5856
          esac
4445
5857
          ;;
4460
5872
      $show "$install_prog $file $oldlib"
4461
5873
      $run eval "$install_prog \$file \$oldlib" || exit $?
4462
5874
 
4463
 
      if test -n "$stripme" && test -n "$striplib"; then
 
5875
      if test -n "$stripme" && test -n "$old_striplib"; then
4464
5876
        $show "$old_striplib $oldlib"
4465
5877
        $run eval "$old_striplib $oldlib" || exit $?
4466
5878
      fi
4467
5879
 
4468
5880
      # Do each command in the postinstall commands.
4469
 
      eval cmds=\"$old_postinstall_cmds\"
 
5881
      cmds=$old_postinstall_cmds
4470
5882
      save_ifs="$IFS"; IFS='~'
4471
5883
      for cmd in $cmds; do
4472
5884
        IFS="$save_ifs"
 
5885
        eval cmd=\"$cmd\"
4473
5886
        $show "$cmd"
4474
5887
        $run eval "$cmd" || exit $?
4475
5888
      done
4483
5896
    if test -n "$current_libdirs"; then
4484
5897
      # Maybe just do a dry run.
4485
5898
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4486
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
5899
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
4487
5900
    else
4488
 
      exit 0
 
5901
      exit $EXIT_SUCCESS
4489
5902
    fi
4490
5903
    ;;
4491
5904
 
4504
5917
      for libdir in $libdirs; do
4505
5918
        if test -n "$finish_cmds"; then
4506
5919
          # Do each command in the finish commands.
4507
 
          eval cmds=\"$finish_cmds\"
 
5920
          cmds=$finish_cmds
4508
5921
          save_ifs="$IFS"; IFS='~'
4509
5922
          for cmd in $cmds; do
4510
5923
            IFS="$save_ifs"
 
5924
            eval cmd=\"$cmd\"
4511
5925
            $show "$cmd"
4512
5926
            $run eval "$cmd" || admincmds="$admincmds
4513
5927
       $cmd"
4524
5938
    fi
4525
5939
 
4526
5940
    # Exit here if they wanted silent mode.
4527
 
    test "$show" = : && exit 0
 
5941
    test "$show" = : && exit $EXIT_SUCCESS
4528
5942
 
4529
 
    echo "----------------------------------------------------------------------"
4530
 
    echo "Libraries have been installed in:"
 
5943
    $echo "----------------------------------------------------------------------"
 
5944
    $echo "Libraries have been installed in:"
4531
5945
    for libdir in $libdirs; do
4532
 
      echo "   $libdir"
 
5946
      $echo "   $libdir"
4533
5947
    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:"
 
5948
    $echo
 
5949
    $echo "If you ever happen to want to link against installed libraries"
 
5950
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5951
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5952
    $echo "flag during linking and do at least one of the following:"
4539
5953
    if test -n "$shlibpath_var"; then
4540
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4541
 
      echo "     during execution"
 
5954
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5955
      $echo "     during execution"
4542
5956
    fi
4543
5957
    if test -n "$runpath_var"; then
4544
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4545
 
      echo "     during linking"
 
5958
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5959
      $echo "     during linking"
4546
5960
    fi
4547
5961
    if test -n "$hardcode_libdir_flag_spec"; then
4548
5962
      libdir=LIBDIR
4549
5963
      eval flag=\"$hardcode_libdir_flag_spec\"
4550
5964
 
4551
 
      echo "   - use the \`$flag' linker flag"
 
5965
      $echo "   - use the \`$flag' linker flag"
4552
5966
    fi
4553
5967
    if test -n "$admincmds"; then
4554
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5968
      $echo "   - have your system administrator run these commands:$admincmds"
4555
5969
    fi
4556
5970
    if test -f /etc/ld.so.conf; then
4557
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5971
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4558
5972
    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
 
5973
    $echo
 
5974
    $echo "See any operating system documentation about shared libraries for"
 
5975
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5976
    $echo "----------------------------------------------------------------------"
 
5977
    exit $EXIT_SUCCESS
4564
5978
    ;;
4565
5979
 
4566
5980
  # libtool execute mode
4572
5986
    if test -z "$cmd"; then
4573
5987
      $echo "$modename: you must specify a COMMAND" 1>&2
4574
5988
      $echo "$help"
4575
 
      exit 1
 
5989
      exit $EXIT_FAILURE
4576
5990
    fi
4577
5991
 
4578
5992
    # Handle -dlopen flags immediately.
4580
5994
      if test ! -f "$file"; then
4581
5995
        $echo "$modename: \`$file' is not a file" 1>&2
4582
5996
        $echo "$help" 1>&2
4583
 
        exit 1
 
5997
        exit $EXIT_FAILURE
4584
5998
      fi
4585
5999
 
4586
6000
      dir=
4587
6001
      case $file in
4588
6002
      *.la)
4589
6003
        # 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 :
 
6004
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4591
6005
        else
4592
6006
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4593
6007
          $echo "$help" 1>&2
4594
 
          exit 1
 
6008
          exit $EXIT_FAILURE
4595
6009
        fi
4596
6010
 
4597
6011
        # Read the libtool library.
4618
6032
          dir="$dir/$objdir"
4619
6033
        else
4620
6034
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4621
 
          exit 1
 
6035
          exit $EXIT_FAILURE
4622
6036
        fi
4623
6037
        ;;
4624
6038
 
4658
6072
      -*) ;;
4659
6073
      *)
4660
6074
        # 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
 
6075
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4662
6076
          # If there is no directory component, then add one.
4663
6077
          case $file in
4664
6078
          */* | *\\*) . $file ;;
4681
6095
        eval "export $shlibpath_var"
4682
6096
      fi
4683
6097
 
4684
 
      # Restore saved enviroment variables
 
6098
      # Restore saved environment variables
4685
6099
      if test "${save_LC_ALL+set}" = set; then
4686
6100
        LC_ALL="$save_LC_ALL"; export LC_ALL
4687
6101
      fi
4698
6112
        $echo "export $shlibpath_var"
4699
6113
      fi
4700
6114
      $echo "$cmd$args"
4701
 
      exit 0
 
6115
      exit $EXIT_SUCCESS
4702
6116
    fi
4703
6117
    ;;
4704
6118
 
4726
6140
    if test -z "$rm"; then
4727
6141
      $echo "$modename: you must specify an RM program" 1>&2
4728
6142
      $echo "$help" 1>&2
4729
 
      exit 1
 
6143
      exit $EXIT_FAILURE
4730
6144
    fi
4731
6145
 
4732
6146
    rmdirs=
4733
6147
 
 
6148
    origobjdir="$objdir"
4734
6149
    for file in $files; do
4735
6150
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4736
6151
      if test "X$dir" = "X$file"; then
4737
6152
        dir=.
4738
 
        objdir="$objdir"
 
6153
        objdir="$origobjdir"
4739
6154
      else
4740
 
        objdir="$dir/$objdir"
 
6155
        objdir="$dir/$origobjdir"
4741
6156
      fi
4742
6157
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4743
6158
      test "$mode" = uninstall && objdir="$dir"
4767
6182
      case $name in
4768
6183
      *.la)
4769
6184
        # Possibly a libtool archive, so verify it.
4770
 
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6185
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4771
6186
          . $dir/$name
4772
6187
 
4773
6188
          # Delete the libtool libraries and symlinks.
4780
6195
          if test "$mode" = uninstall; then
4781
6196
            if test -n "$library_names"; then
4782
6197
              # Do each command in the postuninstall commands.
4783
 
              eval cmds=\"$postuninstall_cmds\"
 
6198
              cmds=$postuninstall_cmds
4784
6199
              save_ifs="$IFS"; IFS='~'
4785
6200
              for cmd in $cmds; do
4786
6201
                IFS="$save_ifs"
 
6202
                eval cmd=\"$cmd\"
4787
6203
                $show "$cmd"
4788
6204
                $run eval "$cmd"
4789
6205
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4795
6211
 
4796
6212
            if test -n "$old_library"; then
4797
6213
              # Do each command in the old_postuninstall commands.
4798
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6214
              cmds=$old_postuninstall_cmds
4799
6215
              save_ifs="$IFS"; IFS='~'
4800
6216
              for cmd in $cmds; do
4801
6217
                IFS="$save_ifs"
 
6218
                eval cmd=\"$cmd\"
4802
6219
                $show "$cmd"
4803
6220
                $run eval "$cmd"
4804
6221
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4813
6230
        ;;
4814
6231
 
4815
6232
      *.lo)
4816
 
        if test "$build_old_libs" = yes; then
4817
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4818
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6233
        # Possibly a libtool object, so verify it.
 
6234
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6235
 
 
6236
          # Read the .lo file
 
6237
          . $dir/$name
 
6238
 
 
6239
          # Add PIC object to the list of files to remove.
 
6240
          if test -n "$pic_object" \
 
6241
             && test "$pic_object" != none; then
 
6242
            rmfiles="$rmfiles $dir/$pic_object"
 
6243
          fi
 
6244
 
 
6245
          # Add non-PIC object to the list of files to remove.
 
6246
          if test -n "$non_pic_object" \
 
6247
             && test "$non_pic_object" != none; then
 
6248
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6249
          fi
4819
6250
        fi
4820
6251
        ;;
4821
6252
 
4822
6253
      *)
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
 
6254
        if test "$mode" = clean ; then
 
6255
          noexename=$name
 
6256
          case $file in
 
6257
          *.exe)
 
6258
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6259
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6260
            # $file with .exe has already been added to rmfiles,
 
6261
            # add $file without .exe
 
6262
            rmfiles="$rmfiles $file"
 
6263
            ;;
 
6264
          esac
 
6265
          # Do a test to see if this is a libtool program.
 
6266
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6267
            relink_command=
 
6268
            . $dir/$noexename
4828
6269
 
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"
 
6270
            # note $name still contains .exe if it was in $file originally
 
6271
            # as does the version of $file that was added into $rmfiles
 
6272
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6273
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6274
              rmfiles="$rmfiles $objdir/lt-$name"
 
6275
            fi
 
6276
            if test "X$noexename" != "X$name" ; then
 
6277
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6278
            fi
4832
6279
          fi
4833
6280
        fi
4834
6281
        ;;
4836
6283
      $show "$rm $rmfiles"
4837
6284
      $run $rm $rmfiles || exit_status=1
4838
6285
    done
 
6286
    objdir="$origobjdir"
4839
6287
 
4840
6288
    # Try to remove the ${objdir}s in the directories where we deleted files
4841
6289
    for dir in $rmdirs; do
4851
6299
  "")
4852
6300
    $echo "$modename: you must specify a MODE" 1>&2
4853
6301
    $echo "$generic_help" 1>&2
4854
 
    exit 1
 
6302
    exit $EXIT_FAILURE
4855
6303
    ;;
4856
6304
  esac
4857
6305
 
4858
6306
  if test -z "$exec_cmd"; then
4859
6307
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
4860
6308
    $echo "$generic_help" 1>&2
4861
 
    exit 1
 
6309
    exit $EXIT_FAILURE
4862
6310
  fi
4863
6311
fi # test -z "$show_help"
4864
6312
 
4865
6313
if test -n "$exec_cmd"; then
4866
6314
  eval exec $exec_cmd
4867
 
  exit 1
 
6315
  exit $EXIT_FAILURE
4868
6316
fi
4869
6317
 
4870
6318
# We need to display help for each of the modes.
4883
6331
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4884
6332
    --quiet           same as \`--silent'
4885
6333
    --silent          don't print informational messages
 
6334
    --tag=TAG         use configuration variables from tag TAG
4886
6335
    --version         print version information
4887
6336
 
4888
6337
MODE must be one of the following:
4896
6345
      uninstall       remove libraries from an installed directory
4897
6346
 
4898
6347
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4899
 
a more detailed description of MODE."
4900
 
  exit 0
 
6348
a more detailed description of MODE.
 
6349
 
 
6350
Report bugs to <bug-libtool@gnu.org>."
 
6351
  exit $EXIT_SUCCESS
4901
6352
  ;;
4902
6353
 
4903
6354
clean)
5008
6459
  -no-install       link a not-installable executable
5009
6460
  -no-undefined     declare that a library does not refer to external symbols
5010
6461
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6462
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6463
  -precious-files-regex REGEX
 
6464
                    don't remove output files matching REGEX
5011
6465
  -release RELEASE  specify package release information
5012
6466
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5013
6467
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5049
6503
*)
5050
6504
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5051
6505
  $echo "$help" 1>&2
5052
 
  exit 1
 
6506
  exit $EXIT_FAILURE
5053
6507
  ;;
5054
6508
esac
5055
6509
 
5056
 
echo
 
6510
$echo
5057
6511
$echo "Try \`$modename --help' for more information about other modes."
5058
6512
 
5059
 
exit 0
 
6513
exit $?
 
6514
 
 
6515
# The TAGs below are defined such that we never get into a situation
 
6516
# in which we disable both kinds of libraries.  Given conflicting
 
6517
# choices, we go for a static library, that is the most portable,
 
6518
# since we can't tell whether shared libraries were disabled because
 
6519
# the user asked for that or because the platform doesn't support
 
6520
# them.  This is particularly important on AIX, because we don't
 
6521
# support having both static and shared libraries enabled at the same
 
6522
# time on that platform, so we default to a shared-only configuration.
 
6523
# If a disable-shared tag is given, we'll fallback to a static-only
 
6524
# configuration.  But we'll never go from static-only to shared-only.
 
6525
 
 
6526
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6527
build_libtool_libs=no
 
6528
build_old_libs=yes
 
6529
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6530
 
 
6531
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6532
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6533
# ### END LIBTOOL TAG CONFIG: disable-static
5060
6534
 
5061
6535
# Local Variables:
5062
6536
# mode:shell-script