~ubuntu-branches/ubuntu/gutsy/psqlodbc/gutsy

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2007-03-05 22:28:19 UTC
  • mfrom: (3.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20070305222819-95d0rzmt2ah6dwwc
Tags: 1:08.01.0200-2.1
* Non-maintainer upload.
* High-urgency upload for RC bugfix.
* Fix the signature of SQLGetData on 64-bit architectures.

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
 
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.3
59
 
TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
60
 
 
61
79
default_mode=
62
80
help="Try \`$progname --help' for more information."
63
81
magic="%%%MAGIC variable%%%"
69
87
# metacharacters that are still active within double-quoted strings.
70
88
Xsed="${SED}"' -e 1s/^X//'
71
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72
 
# test EBCDIC or ASCII                                                         
73
 
case `echo A|od -x` in                                                         
74
 
 *[Cc]1*) # EBCDIC based system                                                
75
 
  SP2NL="tr '\100' '\n'"                                                       
76
 
  NL2SP="tr '\r\n' '\100\100'"                                                 
77
 
  ;;                                                                           
78
 
 *) # Assume ASCII based system                                                
79
 
  SP2NL="tr '\040' '\012'"                                                     
80
 
  NL2SP="tr '\015\012' '\040\040'"                                             
81
 
  ;;                                                                           
82
 
esac                                                                           
 
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
83
102
 
84
103
# NLS nuisances.
85
104
# Only set LANG and LC_ALL to C if already set.
94
113
fi
95
114
 
96
115
# Make sure IFS has a sensible default
97
 
: ${IFS="       "}
 
116
lt_nl='
 
117
'
 
118
IFS="   $lt_nl"
98
119
 
99
120
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100
 
  echo "$modename: not configured to build any kind of library" 1>&2
101
 
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
102
 
  exit 1
 
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
103
124
fi
104
125
 
105
126
# Global variables.
114
135
lo2o="s/\\.lo\$/.${objext}/"
115
136
o2lo="s/\\.${objext}\$/.lo/"
116
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
 
117
355
# Parse our command line options once, thoroughly.
118
 
while test $# -gt 0
 
356
while test "$#" -gt 0
119
357
do
120
358
  arg="$1"
121
359
  shift
131
369
    execute_dlfiles)
132
370
      execute_dlfiles="$execute_dlfiles $arg"
133
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
      ;;
134
400
    *)
135
401
      eval "$prev=\$arg"
136
402
      ;;
148
414
    ;;
149
415
 
150
416
  --version)
151
 
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
152
 
    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 $?
153
423
    ;;
154
424
 
155
425
  --config)
156
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
157
 
    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 $?
158
432
    ;;
159
433
 
160
434
  --debug)
161
 
    echo "$progname: enabling shell trace mode"
 
435
    $echo "$progname: enabling shell trace mode"
162
436
    set -x
 
437
    preserve_args="$preserve_args $arg"
163
438
    ;;
164
439
 
165
440
  --dry-run | -n)
167
442
    ;;
168
443
 
169
444
  --features)
170
 
    echo "host: $host"
 
445
    $echo "host: $host"
171
446
    if test "$build_libtool_libs" = yes; then
172
 
      echo "enable shared libraries"
 
447
      $echo "enable shared libraries"
173
448
    else
174
 
      echo "disable shared libraries"
 
449
      $echo "disable shared libraries"
175
450
    fi
176
451
    if test "$build_old_libs" = yes; then
177
 
      echo "enable static libraries"
 
452
      $echo "enable static libraries"
178
453
    else
179
 
      echo "disable static libraries"
 
454
      $echo "disable static libraries"
180
455
    fi
181
 
    exit 0
 
456
    exit $?
182
457
    ;;
183
458
 
184
459
  --finish) mode="finish" ;;
190
465
 
191
466
  --quiet | --silent)
192
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"
193
477
    ;;
194
478
 
195
479
  -dlopen)
200
484
  -*)
201
485
    $echo "$modename: unrecognized option \`$arg'" 1>&2
202
486
    $echo "$help" 1>&2
203
 
    exit 1
 
487
    exit $EXIT_FAILURE
204
488
    ;;
205
489
 
206
490
  *)
213
497
if test -n "$prevopt"; then
214
498
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
215
499
  $echo "$help" 1>&2
216
 
  exit 1
 
500
  exit $EXIT_FAILURE
217
501
fi
218
502
 
219
503
# If this variable is set in any of the actions, the command in it
225
509
 
226
510
  # Infer the operation mode.
227
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
228
514
    case $nonopt in
229
 
    *cc | *++ | gcc* | *-gcc* | xlc*)
 
515
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
230
516
      mode=link
231
517
      for arg
232
518
      do
267
553
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
268
554
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
269
555
    $echo "$help" 1>&2
270
 
    exit 1
 
556
    exit $EXIT_FAILURE
271
557
  fi
272
558
 
273
559
  # Change the help message to a mode-specific one.
281
567
    modename="$modename: compile"
282
568
    # Get the compilation command and the source file.
283
569
    base_compile=
284
 
    prev=
285
 
    lastarg=
286
 
    srcfile="$nonopt"
 
570
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
571
    suppress_opt=yes
287
572
    suppress_output=
 
573
    arg_mode=normal
 
574
    libobj=
 
575
    later=
288
576
 
289
 
    user_target=no
290
577
    for arg
291
578
    do
292
 
      case $prev in
293
 
      "") ;;
294
 
      xcompiler)
295
 
        # Aesthetically quote the previous argument.
296
 
        prev=
297
 
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
298
 
 
299
 
        case $arg in
300
 
        # Double-quote args containing other shell metacharacters.
301
 
        # Many Bourne shells cannot handle close brackets correctly
302
 
        # in scan sets, so we specify it separately.
303
 
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
304
 
          arg="\"$arg\""
305
 
          ;;
306
 
        esac
307
 
 
308
 
        # Add the previous argument to base_compile.
309
 
        if test -z "$base_compile"; then
310
 
          base_compile="$lastarg"
311
 
        else
312
 
          base_compile="$base_compile $lastarg"
313
 
        fi
314
 
        continue
315
 
        ;;
316
 
      esac
317
 
 
318
 
      # Accept any command-line options.
319
 
      case $arg in
320
 
      -o)
321
 
        if test "$user_target" != "no"; then
322
 
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
323
 
          exit 1
324
 
        fi
325
 
        user_target=next
326
 
        ;;
327
 
 
328
 
      -static)
329
 
        build_old_libs=yes
330
 
        continue
331
 
        ;;
332
 
 
333
 
      -prefer-pic)
334
 
        pic_mode=yes
335
 
        continue
336
 
        ;;
337
 
 
338
 
      -prefer-non-pic)
339
 
        pic_mode=no
340
 
        continue
341
 
        ;;
342
 
 
343
 
      -Xcompiler)
344
 
        prev=xcompiler
345
 
        continue
346
 
        ;;
347
 
 
348
 
      -Wc,*)
349
 
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
350
 
        lastarg=
351
 
        save_ifs="$IFS"; IFS=','
352
 
        for arg in $args; do
353
 
          IFS="$save_ifs"
354
 
 
355
 
          # Double-quote args containing other shell metacharacters.
356
 
          # Many Bourne shells cannot handle close brackets correctly
357
 
          # in scan sets, so we specify it separately.
358
 
          case $arg in
359
 
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
360
 
            arg="\"$arg\""
361
 
            ;;
362
 
          esac
363
 
          lastarg="$lastarg $arg"
364
 
        done
365
 
        IFS="$save_ifs"
366
 
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
367
 
 
368
 
        # Add the arguments to base_compile.
369
 
        if test -z "$base_compile"; then
370
 
          base_compile="$lastarg"
371
 
        else
372
 
          base_compile="$base_compile $lastarg"
373
 
        fi
374
 
        continue
375
 
        ;;
376
 
      esac
377
 
 
378
 
      case $user_target in
379
 
      next)
380
 
        # The next one is the -o target name
381
 
        user_target=yes
382
 
        continue
383
 
        ;;
384
 
      yes)
385
 
        # We got the output file
386
 
        user_target=set
 
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 )
387
587
        libobj="$arg"
 
588
        arg_mode=normal
388
589
        continue
389
590
        ;;
390
 
      esac
391
 
 
392
 
      # Accept the current argument as the source file.
393
 
      lastarg="$srcfile"
394
 
      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
395
654
 
396
655
      # Aesthetically quote the previous argument.
397
 
 
398
 
      # Backslashify any backslashes, double quotes, and dollar signs.
399
 
      # These are the only characters that are still specially
400
 
      # interpreted inside of double-quoted scrings.
401
656
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
402
657
 
 
658
      case $lastarg in
403
659
      # Double-quote args containing other shell metacharacters.
404
660
      # Many Bourne shells cannot handle close brackets correctly
405
 
      # in scan sets, so we specify it separately.
406
 
      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.
407
665
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
408
666
        lastarg="\"$lastarg\""
409
667
        ;;
410
668
      esac
411
669
 
412
 
      # Add the previous argument to base_compile.
413
 
      if test -z "$base_compile"; then
414
 
        base_compile="$lastarg"
415
 
      else
416
 
        base_compile="$base_compile $lastarg"
417
 
      fi
418
 
    done
 
670
      base_compile="$base_compile $lastarg"
 
671
    done # for arg
419
672
 
420
 
    case $user_target in
421
 
    set)
422
 
      ;;
423
 
    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
    *)
424
683
      # Get the name of the library object.
425
 
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
426
 
      ;;
427
 
    *)
428
 
      $echo "$modename: you must specify a target with \`-o'" 1>&2
429
 
      exit 1
 
684
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
430
685
      ;;
431
686
    esac
432
687
 
433
688
    # Recognize several different file suffixes.
434
689
    # If the user specifies -o file.o, it is replaced with file.lo
435
 
    xform='[cCFSfmso]'
 
690
    xform='[cCFSifmso]'
436
691
    case $libobj in
437
692
    *.ada) xform=ada ;;
438
693
    *.adb) xform=adb ;;
440
695
    *.asm) xform=asm ;;
441
696
    *.c++) xform=c++ ;;
442
697
    *.cc) xform=cc ;;
 
698
    *.ii) xform=ii ;;
 
699
    *.class) xform=class ;;
443
700
    *.cpp) xform=cpp ;;
444
701
    *.cxx) xform=cxx ;;
445
702
    *.f90) xform=f90 ;;
446
703
    *.for) xform=for ;;
 
704
    *.java) xform=java ;;
447
705
    esac
448
706
 
449
707
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
452
710
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
453
711
    *)
454
712
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
455
 
      exit 1
 
713
      exit $EXIT_FAILURE
456
714
      ;;
457
715
    esac
458
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
 
459
755
    if test -z "$base_compile"; then
460
756
      $echo "$modename: you must specify a compilation command" 1>&2
461
757
      $echo "$help" 1>&2
462
 
      exit 1
 
758
      exit $EXIT_FAILURE
463
759
    fi
464
760
 
465
761
    # Delete any leftover library objects.
466
762
    if test "$build_old_libs" = yes; then
467
 
      removelist="$obj $libobj"
 
763
      removelist="$obj $lobj $libobj ${libobj}T"
468
764
    else
469
 
      removelist="$libobj"
 
765
      removelist="$lobj $libobj ${libobj}T"
470
766
    fi
471
767
 
472
768
    $run $rm $removelist
473
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
769
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
474
770
 
475
771
    # On Cygwin there's no "real" PIC flag so we must build both object types
476
772
    case $host_os in
489
785
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
490
786
      lockfile="$output_obj.lock"
491
787
      removelist="$removelist $output_obj $lockfile"
492
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
788
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
493
789
    else
 
790
      output_obj=
494
791
      need_locks=no
495
792
      lockfile=
496
793
    fi
498
795
    # Lock this critical section if it is needed
499
796
    # We use this script file to make the link, it avoids creating a new file
500
797
    if test "$need_locks" = yes; then
501
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
798
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
502
799
        $show "Waiting for $lockfile to be removed"
503
800
        sleep 2
504
801
      done
505
802
    elif test "$need_locks" = warn; then
506
803
      if test -f "$lockfile"; then
507
 
        echo "\
 
804
        $echo "\
508
805
*** ERROR, $lockfile exists and contains:
509
806
`cat $lockfile 2>/dev/null`
510
807
 
516
813
compiler."
517
814
 
518
815
        $run $rm $removelist
519
 
        exit 1
 
816
        exit $EXIT_FAILURE
520
817
      fi
521
 
      echo $srcfile > "$lockfile"
 
818
      $echo "$srcfile" > "$lockfile"
522
819
    fi
523
820
 
524
821
    if test -n "$fix_srcfile_path"; then
525
822
      eval srcfile=\"$fix_srcfile_path\"
526
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
527
843
 
528
844
    # Only build a PIC object if we are building libtool libraries.
529
845
    if test "$build_libtool_libs" = yes; then
531
847
      fbsd_hideous_sh_bug=$base_compile
532
848
 
533
849
      if test "$pic_mode" != no; then
534
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
535
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
850
        command="$base_compile $qsrcfile $pic_flag"
536
851
      else
537
852
        # Don't build PIC code
538
 
        command="$base_compile $srcfile"
539
 
      fi
540
 
      if test "$build_old_libs" = yes; then
541
 
        lo_libobj="$libobj"
542
 
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
543
 
        if test "X$dir" = "X$libobj"; then
544
 
          dir="$objdir"
545
 
        else
546
 
          dir="$dir/$objdir"
547
 
        fi
548
 
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
549
 
 
550
 
        if test -d "$dir"; then
551
 
          $show "$rm $libobj"
552
 
          $run $rm $libobj
553
 
        else
554
 
          $show "$mkdir $dir"
555
 
          $run $mkdir $dir
556
 
          status=$?
557
 
          if test $status -ne 0 && test ! -d $dir; then
558
 
            exit $status
559
 
          fi
560
 
        fi
561
 
      fi
562
 
      if test "$compiler_o_lo" = yes; then
563
 
        output_obj="$libobj"
564
 
        command="$command -o $output_obj"
565
 
      elif test "$compiler_c_o" = yes; then
566
 
        output_obj="$obj"
567
 
        command="$command -o $output_obj"
568
 
      fi
569
 
 
570
 
      $run $rm "$output_obj"
 
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
 
571
872
      $show "$command"
572
873
      if $run eval "$command"; then :
573
874
      else
574
875
        test -n "$output_obj" && $run $rm $removelist
575
 
        exit 1
 
876
        exit $EXIT_FAILURE
576
877
      fi
577
878
 
578
879
      if test "$need_locks" = warn &&
579
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
580
 
        echo "\
 
880
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
881
        $echo "\
581
882
*** ERROR, $lockfile contains:
582
883
`cat $lockfile 2>/dev/null`
583
884
 
592
893
compiler."
593
894
 
594
895
        $run $rm $removelist
595
 
        exit 1
 
896
        exit $EXIT_FAILURE
596
897
      fi
597
898
 
598
899
      # Just move the object if needed, then go on to compile the next one
599
 
      if test x"$output_obj" != x"$libobj"; then
600
 
        $show "$mv $output_obj $libobj"
601
 
        if $run $mv $output_obj $libobj; then :
602
 
        else
603
 
          error=$?
604
 
          $run $rm $removelist
605
 
          exit $error
606
 
        fi
607
 
      fi
608
 
 
609
 
      # If we have no pic_flag, then copy the object into place and finish.
610
 
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
611
 
         test "$build_old_libs" = yes; then
612
 
        # Rename the .lo from within objdir to obj
613
 
        if test -f $obj; then
614
 
          $show $rm $obj
615
 
          $run $rm $obj
616
 
        fi
617
 
 
618
 
        $show "$mv $libobj $obj"
619
 
        if $run $mv $libobj $obj; then :
620
 
        else
621
 
          error=$?
622
 
          $run $rm $removelist
623
 
          exit $error
624
 
        fi
625
 
 
626
 
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
627
 
        if test "X$xdir" = "X$obj"; then
628
 
          xdir="."
629
 
        else
630
 
          xdir="$xdir"
631
 
        fi
632
 
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
633
 
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
634
 
        # Now arrange that obj and lo_libobj become the same file
635
 
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
636
 
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
637
 
          # Unlock the critical section if it was locked
638
 
          if test "$need_locks" != no; then
639
 
            $run $rm "$lockfile"
640
 
          fi
641
 
          exit 0
642
 
        else
643
 
          error=$?
644
 
          $run $rm $removelist
645
 
          exit $error
646
 
        fi
647
 
      fi
 
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
648
915
 
649
916
      # Allow error messages only from the first compilation.
650
 
      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
651
927
    fi
652
928
 
653
929
    # Only build a position-dependent object if we build old libraries.
654
930
    if test "$build_old_libs" = yes; then
655
931
      if test "$pic_mode" != yes; then
656
932
        # Don't build PIC code
657
 
        command="$base_compile $srcfile"
 
933
        command="$base_compile $qsrcfile"
658
934
      else
659
 
        # All platforms use -DPIC, to notify preprocessed assembler code.
660
 
        command="$base_compile $srcfile $pic_flag -DPIC"
 
935
        command="$base_compile $qsrcfile $pic_flag"
661
936
      fi
662
937
      if test "$compiler_c_o" = yes; then
663
938
        command="$command -o $obj"
664
 
        output_obj="$obj"
665
939
      fi
666
940
 
667
941
      # Suppress compiler output if we already did a PIC compilation.
668
942
      command="$command$suppress_output"
669
 
      $run $rm "$output_obj"
 
943
      $run $rm "$obj" "$output_obj"
670
944
      $show "$command"
671
945
      if $run eval "$command"; then :
672
946
      else
673
947
        $run $rm $removelist
674
 
        exit 1
 
948
        exit $EXIT_FAILURE
675
949
      fi
676
950
 
677
951
      if test "$need_locks" = warn &&
678
 
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
679
 
        echo "\
 
952
         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 
953
        $echo "\
680
954
*** ERROR, $lockfile contains:
681
955
`cat $lockfile 2>/dev/null`
682
956
 
691
965
compiler."
692
966
 
693
967
        $run $rm $removelist
694
 
        exit 1
 
968
        exit $EXIT_FAILURE
695
969
      fi
696
970
 
697
971
      # Just move the object if needed
698
 
      if test x"$output_obj" != x"$obj"; then
 
972
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
699
973
        $show "$mv $output_obj $obj"
700
974
        if $run $mv $output_obj $obj; then :
701
975
        else
705
979
        fi
706
980
      fi
707
981
 
708
 
      # Create an invalid libtool object if no PIC, so that we do not
709
 
      # accidentally link it into a program.
710
 
      if test "$build_libtool_libs" != yes; then
711
 
        $show "echo timestamp > $libobj"
712
 
        $run eval "echo timestamp > \$libobj" || exit $?
713
 
      else
714
 
        # Move the .lo from within objdir
715
 
        $show "$mv $libobj $lo_libobj"
716
 
        if $run $mv $libobj $lo_libobj; then :
717
 
        else
718
 
          error=$?
719
 
          $run $rm $removelist
720
 
          exit $error
721
 
        fi
722
 
      fi
 
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
723
997
    fi
724
998
 
 
999
    $run $mv "${libobj}T" "${libobj}"
 
1000
 
725
1001
    # Unlock the critical section if it was locked
726
1002
    if test "$need_locks" != no; then
727
1003
      $run $rm "$lockfile"
728
1004
    fi
729
1005
 
730
 
    exit 0
 
1006
    exit $EXIT_SUCCESS
731
1007
    ;;
732
1008
 
733
1009
  # libtool link mode
738
1014
      # It is impossible to link a dll without this setting, and
739
1015
      # we shouldn't force the makefile maintainer to figure out
740
1016
      # which system we are compiling for in order to pass an extra
741
 
      # flag for every libtool invokation.
 
1017
      # flag for every libtool invocation.
742
1018
      # allow_undefined=no
743
1019
 
744
1020
      # FIXME: Unfortunately, there are problems with the above when trying
753
1029
      ;;
754
1030
    esac
755
1031
    libtool_args="$nonopt"
 
1032
    base_compile="$nonopt $@"
756
1033
    compile_command="$nonopt"
757
1034
    finalize_command="$nonopt"
758
1035
 
768
1045
    linker_flags=
769
1046
    dllsearchpath=
770
1047
    lib_search_path=`pwd`
 
1048
    inst_prefix_dir=
771
1049
 
772
1050
    avoid_version=no
773
1051
    dlfiles=
782
1060
    module=no
783
1061
    no_install=no
784
1062
    objs=
 
1063
    non_pic_objects=
 
1064
    precious_files_regex=
785
1065
    prefer_static_libs=no
786
1066
    preload=no
787
1067
    prev=
793
1073
    temp_rpath=
794
1074
    thread_safe=no
795
1075
    vinfo=
 
1076
    vinfo_number=no
 
1077
 
 
1078
    func_infer_tag $base_compile
796
1079
 
797
1080
    # We need to know -static, to get the right output filenames.
798
1081
    for arg
823
1106
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
824
1107
 
825
1108
    # Go through the arguments, transforming them on the way.
826
 
    while test $# -gt 0; do
 
1109
    while test "$#" -gt 0; do
827
1110
      arg="$1"
828
1111
      shift
829
1112
      case $arg in
888
1171
          export_symbols="$arg"
889
1172
          if test ! -f "$arg"; then
890
1173
            $echo "$modename: symbol file \`$arg' does not exist"
891
 
            exit 1
 
1174
            exit $EXIT_FAILURE
892
1175
          fi
893
1176
          prev=
894
1177
          continue
898
1181
          prev=
899
1182
          continue
900
1183
          ;;
 
1184
        inst_prefix)
 
1185
          inst_prefix_dir="$arg"
 
1186
          prev=
 
1187
          continue
 
1188
          ;;
 
1189
        precious_regex)
 
1190
          precious_files_regex="$arg"
 
1191
          prev=
 
1192
          continue
 
1193
          ;;
901
1194
        release)
902
1195
          release="-$arg"
903
1196
          prev=
904
1197
          continue
905
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
          ;;
906
1306
        rpath | xrpath)
907
1307
          # We need an absolute path.
908
1308
          case $arg in
909
1309
          [\\/]* | [A-Za-z]:[\\/]*) ;;
910
1310
          *)
911
1311
            $echo "$modename: only absolute run-paths are allowed" 1>&2
912
 
            exit 1
 
1312
            exit $EXIT_FAILURE
913
1313
            ;;
914
1314
          esac
915
1315
          if test "$prev" = rpath; then
941
1341
          finalize_command="$finalize_command $wl$qarg"
942
1342
          continue
943
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
          ;;
944
1364
        *)
945
1365
          eval "$prev=\"\$arg\""
946
1366
          prev=
947
1367
          continue
948
1368
          ;;
949
1369
        esac
950
 
      fi # test -n $prev
 
1370
      fi # test -n "$prev"
951
1371
 
952
1372
      prevarg="$arg"
953
1373
 
989
1409
      -export-symbols | -export-symbols-regex)
990
1410
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
991
1411
          $echo "$modename: more than one -exported-symbols argument is not allowed"
992
 
          exit 1
 
1412
          exit $EXIT_FAILURE
993
1413
        fi
994
1414
        if test "X$arg" = "X-export-symbols"; then
995
1415
          prev=expsyms
999
1419
        continue
1000
1420
        ;;
1001
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
 
 
1430
      -inst-prefix-dir)
 
1431
        prev=inst_prefix
 
1432
        continue
 
1433
        ;;
 
1434
 
1002
1435
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1003
1436
      # so, if we see these flags be careful not to treat them like -L
1004
1437
      -L[A-Z][A-Z]*:*)
1005
1438
        case $with_gcc/$host in
1006
 
        no/*-*-irix* | no/*-*-nonstopux*)
 
1439
        no/*-*-irix* | /*-*-irix*)
1007
1440
          compile_command="$compile_command $arg"
1008
1441
          finalize_command="$finalize_command $arg"
1009
1442
          ;;
1020
1453
          absdir=`cd "$dir" && pwd`
1021
1454
          if test -z "$absdir"; then
1022
1455
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1023
 
            exit 1
 
1456
            exit $EXIT_FAILURE
1024
1457
          fi
1025
1458
          dir="$absdir"
1026
1459
          ;;
1054
1487
            # These systems don't actually have a C library (as such)
1055
1488
            test "X$arg" = "X-lc" && continue
1056
1489
            ;;
1057
 
          *-*-openbsd* | *-*-freebsd*)
 
1490
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1058
1491
            # Do not include libc due to us having libc/libc_r.
1059
1492
            test "X$arg" = "X-lc" && continue
1060
1493
            ;;
1061
 
          esac
1062
 
         elif test "X$arg" = "X-lc_r"; then
1063
 
          case $host in
1064
 
         *-*-openbsd* | *-*-freebsd*)
1065
 
            # Do not include libc_r directly, use -pthread flag.
 
1494
          *-*-rhapsody* | *-*-darwin1.[012])
 
1495
            # Rhapsody C and math libraries are in the System framework
 
1496
            deplibs="$deplibs -framework System"
1066
1497
            continue
1067
 
            ;;
1068
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
1069
1506
        fi
1070
1507
        deplibs="$deplibs $arg"
1071
1508
        continue
1072
1509
        ;;
1073
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
 
1074
1528
      -module)
1075
1529
        module=yes
1076
1530
        continue
1077
1531
        ;;
1078
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
 
1079
1562
      -no-fast-install)
1080
1563
        fast_install=no
1081
1564
        continue
1100
1583
        continue
1101
1584
        ;;
1102
1585
 
 
1586
      -objectlist)
 
1587
        prev=objectlist
 
1588
        continue
 
1589
        ;;
 
1590
 
1103
1591
      -o) prev=output ;;
1104
1592
 
 
1593
      -precious-files-regex)
 
1594
        prev=precious_regex
 
1595
        continue
 
1596
        ;;
 
1597
 
1105
1598
      -release)
1106
1599
        prev=release
1107
1600
        continue
1124
1617
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1125
1618
        *)
1126
1619
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1127
 
          exit 1
 
1620
          exit $EXIT_FAILURE
1128
1621
          ;;
1129
1622
        esac
1130
1623
        case "$xrpath " in
1152
1645
        prev=vinfo
1153
1646
        continue
1154
1647
        ;;
 
1648
      -version-number)
 
1649
        prev=vinfo
 
1650
        vinfo_number=yes
 
1651
        continue
 
1652
        ;;
1155
1653
 
1156
1654
      -Wc,*)
1157
1655
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1200
1698
        continue
1201
1699
        ;;
1202
1700
 
 
1701
      -XCClinker)
 
1702
        prev=xcclinker
 
1703
        continue
 
1704
        ;;
 
1705
 
1203
1706
      # Some other compiler flag.
1204
1707
      -* | +*)
1205
1708
        # Unknown arguments in both finalize_command and compile_command need
1212
1715
        esac
1213
1716
        ;;
1214
1717
 
1215
 
      *.lo | *.$objext)
1216
 
        # A library or standard object.
1217
 
        if test "$prev" = dlfiles; then
1218
 
          # This file was specified with -dlopen.
1219
 
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1220
 
            dlfiles="$dlfiles $arg"
1221
 
            prev=
1222
 
            continue
1223
 
          else
1224
 
            # If libtool objects are unsupported, then we need to preload.
1225
 
            prev=dlprefiles
1226
 
          fi
1227
 
        fi
1228
 
 
1229
 
        if test "$prev" = dlprefiles; then
1230
 
          # Preload the old-style object.
1231
 
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1232
 
          prev=
1233
 
        else
 
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.
1234
1733
          case $arg in
1235
 
          *.lo) libobjs="$libobjs $arg" ;;
1236
 
          *) objs="$objs $arg" ;;
 
1734
          */* | *\\*) . $arg ;;
 
1735
          *) . ./$arg ;;
1237
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
1238
1813
        fi
1239
1814
        ;;
1240
1815
 
1285
1860
    if test -n "$prev"; then
1286
1861
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1287
1862
      $echo "$help" 1>&2
1288
 
      exit 1
 
1863
      exit $EXIT_FAILURE
1289
1864
    fi
1290
1865
 
1291
1866
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1294
1869
      finalize_command="$finalize_command $arg"
1295
1870
    fi
1296
1871
 
 
1872
    oldlibs=
1297
1873
    # calculate the name of the file, without its directory
1298
1874
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1299
1875
    libobjs_save="$libobjs"
1314
1890
      output_objdir="$output_objdir/$objdir"
1315
1891
    fi
1316
1892
    # Create the object directory.
1317
 
    if test ! -d $output_objdir; then
 
1893
    if test ! -d "$output_objdir"; then
1318
1894
      $show "$mkdir $output_objdir"
1319
1895
      $run $mkdir $output_objdir
1320
1896
      status=$?
1321
 
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1897
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1322
1898
        exit $status
1323
1899
      fi
1324
1900
    fi
1328
1904
    "")
1329
1905
      $echo "$modename: you must specify an output file" 1>&2
1330
1906
      $echo "$help" 1>&2
1331
 
      exit 1
 
1907
      exit $EXIT_FAILURE
1332
1908
      ;;
1333
1909
    *.$libext) linkmode=oldlib ;;
1334
1910
    *.lo | *.$objext) linkmode=obj ;;
1336
1912
    *) linkmode=prog ;; # Anything else should be a program.
1337
1913
    esac
1338
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
1339
1924
    specialdeplibs=
 
1925
 
1340
1926
    libs=
1341
1927
    # Find all interdependent deplibs by searching for libraries
1342
1928
    # that are linked more than once (e.g. -la -lb -la)
1348
1934
      fi
1349
1935
      libs="$libs $deplib"
1350
1936
    done
 
1937
 
 
1938
    if test "$linkmode" = lib; then
 
1939
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
1940
 
 
1941
      # Compute libraries that are listed more than once in $predeps
 
1942
      # $postdeps and mark them as special (i.e., whose duplicates are
 
1943
      # not to be eliminated).
 
1944
      pre_post_deps=
 
1945
      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
 
1946
        for pre_post_dep in $predeps $postdeps; do
 
1947
          case "$pre_post_deps " in
 
1948
          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 
1949
          esac
 
1950
          pre_post_deps="$pre_post_deps $pre_post_dep"
 
1951
        done
 
1952
      fi
 
1953
      pre_post_deps=
 
1954
    fi
 
1955
 
1351
1956
    deplibs=
1352
1957
    newdependency_libs=
1353
1958
    newlib_search_path=
1362
1967
          *.la) ;;
1363
1968
          *)
1364
1969
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1365
 
            exit 1
 
1970
            exit $EXIT_FAILURE
1366
1971
            ;;
1367
1972
          esac
1368
1973
        done
1379
1984
        ;;
1380
1985
    esac
1381
1986
    for pass in $passes; do
1382
 
      if test $linkmode = prog; then
1383
 
        # Determine which files to process
 
1987
      if test "$linkmode,$pass" = "lib,link" ||
 
1988
         test "$linkmode,$pass" = "prog,scan"; then
 
1989
        libs="$deplibs"
 
1990
        deplibs=
 
1991
      fi
 
1992
      if test "$linkmode" = prog; then
1384
1993
        case $pass in
1385
 
        dlopen)
1386
 
          libs="$dlfiles"
1387
 
          save_deplibs="$deplibs" # Collect dlpreopened libraries
1388
 
          deplibs=
1389
 
          ;;
 
1994
        dlopen) libs="$dlfiles" ;;
1390
1995
        dlpreopen) libs="$dlprefiles" ;;
1391
1996
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1392
1997
        esac
1393
1998
      fi
 
1999
      if test "$pass" = dlopen; then
 
2000
        # Collect dlpreopened libraries
 
2001
        save_deplibs="$deplibs"
 
2002
        deplibs=
 
2003
      fi
1394
2004
      for deplib in $libs; do
1395
2005
        lib=
1396
2006
        found=no
1397
2007
        case $deplib in
 
2008
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
2009
          if test "$linkmode,$pass" = "prog,link"; then
 
2010
            compile_deplibs="$deplib $compile_deplibs"
 
2011
            finalize_deplibs="$deplib $finalize_deplibs"
 
2012
          else
 
2013
            compiler_flags="$compiler_flags $deplib"
 
2014
          fi
 
2015
          continue
 
2016
          ;;
1398
2017
        -l*)
1399
 
          if test $linkmode = oldlib && test $linkmode = obj; then
1400
 
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1401
 
            continue
1402
 
          fi
1403
 
          if test $pass = conv; then
1404
 
            deplibs="$deplib $deplibs"
 
2018
          if test "$linkmode" != lib && test "$linkmode" != prog; then
 
2019
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1405
2020
            continue
1406
2021
          fi
1407
2022
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1408
2023
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1409
 
            # Search the libtool library
1410
 
            lib="$searchdir/lib${name}.la"
1411
 
            if test -f "$lib"; then
1412
 
              found=yes
1413
 
              break
1414
 
            fi
 
2024
            for search_ext in .la $std_shrext .so .a; do
 
2025
              # Search the libtool library
 
2026
              lib="$searchdir/lib${name}${search_ext}"
 
2027
              if test -f "$lib"; then
 
2028
                if test "$search_ext" = ".la"; then
 
2029
                  found=yes
 
2030
                else
 
2031
                  found=no
 
2032
                fi
 
2033
                break 2
 
2034
              fi
 
2035
            done
1415
2036
          done
1416
2037
          if test "$found" != yes; then
1417
2038
            # deplib doesn't seem to be a libtool library
1420
2041
              finalize_deplibs="$deplib $finalize_deplibs"
1421
2042
            else
1422
2043
              deplibs="$deplib $deplibs"
1423
 
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
2044
              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1424
2045
            fi
1425
2046
            continue
 
2047
          else # deplib is a libtool library
 
2048
            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 
2049
            # We need to do some special things here, and not later.
 
2050
            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
2051
              case " $predeps $postdeps " in
 
2052
              *" $deplib "*)
 
2053
                if (${SED} -e '2q' $lib |
 
2054
                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
2055
                  library_names=
 
2056
                  old_library=
 
2057
                  case $lib in
 
2058
                  */* | *\\*) . $lib ;;
 
2059
                  *) . ./$lib ;;
 
2060
                  esac
 
2061
                  for l in $old_library $library_names; do
 
2062
                    ll="$l"
 
2063
                  done
 
2064
                  if test "X$ll" = "X$old_library" ; then # only static version available
 
2065
                    found=no
 
2066
                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
2067
                    test "X$ladir" = "X$lib" && ladir="."
 
2068
                    lib=$ladir/$old_library
 
2069
                    if test "$linkmode,$pass" = "prog,link"; then
 
2070
                      compile_deplibs="$deplib $compile_deplibs"
 
2071
                      finalize_deplibs="$deplib $finalize_deplibs"
 
2072
                    else
 
2073
                      deplibs="$deplib $deplibs"
 
2074
                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
 
2075
                    fi
 
2076
                    continue
 
2077
                  fi
 
2078
                fi
 
2079
                ;;
 
2080
              *) ;;
 
2081
              esac
 
2082
            fi
1426
2083
          fi
1427
2084
          ;; # -l
1428
2085
        -L*)
1429
2086
          case $linkmode in
1430
2087
          lib)
1431
2088
            deplibs="$deplib $deplibs"
1432
 
            test $pass = conv && continue
 
2089
            test "$pass" = conv && continue
1433
2090
            newdependency_libs="$deplib $newdependency_libs"
1434
2091
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1435
2092
            ;;
1436
2093
          prog)
1437
 
            if test $pass = conv; then
 
2094
            if test "$pass" = conv; then
1438
2095
              deplibs="$deplib $deplibs"
1439
2096
              continue
1440
2097
            fi
1441
 
            if test $pass = scan; then
 
2098
            if test "$pass" = scan; then
1442
2099
              deplibs="$deplib $deplibs"
1443
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1444
2100
            else
1445
2101
              compile_deplibs="$deplib $compile_deplibs"
1446
2102
              finalize_deplibs="$deplib $finalize_deplibs"
1447
2103
            fi
 
2104
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1448
2105
            ;;
1449
2106
          *)
1450
 
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
2107
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1451
2108
            ;;
1452
2109
          esac # linkmode
1453
2110
          continue
1454
2111
          ;; # -L
1455
2112
        -R*)
1456
 
          if test $pass = link; then
 
2113
          if test "$pass" = link; then
1457
2114
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1458
2115
            # Make sure the xrpath contains only unique directories.
1459
2116
            case "$xrpath " in
1466
2123
          ;;
1467
2124
        *.la) lib="$deplib" ;;
1468
2125
        *.$libext)
1469
 
          if test $pass = conv; then
 
2126
          if test "$pass" = conv; then
1470
2127
            deplibs="$deplib $deplibs"
1471
2128
            continue
1472
2129
          fi
1473
2130
          case $linkmode in
1474
2131
          lib)
1475
 
            if test "$deplibs_check_method" != pass_all; then
1476
 
              echo
1477
 
              echo "*** Warning: Trying to link with static lib archive $deplib."
1478
 
              echo "*** I have the capability to make that library automatically link in when"
1479
 
              echo "*** you link to this library.  But I can only do this if you have a"
1480
 
              echo "*** shared version of the library, which you do not appear to have"
1481
 
              echo "*** because the file extensions .$libext of this argument makes me believe"
1482
 
              echo "*** that it is just a static archive that I should not used here."
 
2132
            valid_a_lib=no
 
2133
            case $deplibs_check_method in
 
2134
              match_pattern*)
 
2135
                set dummy $deplibs_check_method
 
2136
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2137
                if eval $echo \"$deplib\" 2>/dev/null \
 
2138
                    | $SED 10q \
 
2139
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2140
                  valid_a_lib=yes
 
2141
                fi
 
2142
                ;;
 
2143
              pass_all)
 
2144
                valid_a_lib=yes
 
2145
                ;;
 
2146
            esac
 
2147
            if test "$valid_a_lib" != yes; then
 
2148
              $echo
 
2149
              $echo "*** Warning: Trying to link with static lib archive $deplib."
 
2150
              $echo "*** I have the capability to make that library automatically link in when"
 
2151
              $echo "*** you link to this library.  But I can only do this if you have a"
 
2152
              $echo "*** shared version of the library, which you do not appear to have"
 
2153
              $echo "*** because the file extensions .$libext of this argument makes me believe"
 
2154
              $echo "*** that it is just a static archive that I should not used here."
1483
2155
            else
1484
 
              echo
1485
 
              echo "*** Warning: Linking the shared library $output against the"
1486
 
              echo "*** static library $deplib is not portable!"
 
2156
              $echo
 
2157
              $echo "*** Warning: Linking the shared library $output against the"
 
2158
              $echo "*** static library $deplib is not portable!"
1487
2159
              deplibs="$deplib $deplibs"
1488
2160
            fi
1489
2161
            continue
1490
2162
            ;;
1491
2163
          prog)
1492
 
            if test $pass != link; then
 
2164
            if test "$pass" != link; then
1493
2165
              deplibs="$deplib $deplibs"
1494
2166
            else
1495
2167
              compile_deplibs="$deplib $compile_deplibs"
1500
2172
          esac # linkmode
1501
2173
          ;; # *.$libext
1502
2174
        *.lo | *.$objext)
1503
 
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1504
 
            # If there is no dlopen support or we're linking statically,
1505
 
            # we need to preload.
1506
 
            newdlprefiles="$newdlprefiles $deplib"
1507
 
            compile_deplibs="$deplib $compile_deplibs"
1508
 
            finalize_deplibs="$deplib $finalize_deplibs"
1509
 
          else
1510
 
            newdlfiles="$newdlfiles $deplib"
 
2175
          if test "$pass" = conv; then
 
2176
            deplibs="$deplib $deplibs"
 
2177
          elif test "$linkmode" = prog; then
 
2178
            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2179
              # If there is no dlopen support or we're linking statically,
 
2180
              # we need to preload.
 
2181
              newdlprefiles="$newdlprefiles $deplib"
 
2182
              compile_deplibs="$deplib $compile_deplibs"
 
2183
              finalize_deplibs="$deplib $finalize_deplibs"
 
2184
            else
 
2185
              newdlfiles="$newdlfiles $deplib"
 
2186
            fi
1511
2187
          fi
1512
2188
          continue
1513
2189
          ;;
1516
2192
          continue
1517
2193
          ;;
1518
2194
        esac # case $deplib
1519
 
        if test $found = yes || test -f "$lib"; then :
 
2195
        if test "$found" = yes || test -f "$lib"; then :
1520
2196
        else
1521
2197
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1522
 
          exit 1
 
2198
          exit $EXIT_FAILURE
1523
2199
        fi
1524
2200
 
1525
2201
        # Check to see that this really is a libtool archive.
1526
 
        if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
2202
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1527
2203
        else
1528
2204
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1529
 
          exit 1
 
2205
          exit $EXIT_FAILURE
1530
2206
        fi
1531
2207
 
1532
2208
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1539
2215
        library_names=
1540
2216
        old_library=
1541
2217
        # If the library was installed with an old release of libtool,
1542
 
        # it will not redefine variable installed.
 
2218
        # it will not redefine variables installed, or shouldnotlink
1543
2219
        installed=yes
 
2220
        shouldnotlink=no
 
2221
        avoidtemprpath=
 
2222
 
1544
2223
 
1545
2224
        # Read the .la file
1546
2225
        case $lib in
1550
2229
 
1551
2230
        if test "$linkmode,$pass" = "lib,link" ||
1552
2231
           test "$linkmode,$pass" = "prog,scan" ||
1553
 
           { test $linkmode = oldlib && test $linkmode = obj; }; then
1554
 
           # Add dl[pre]opened files of deplib
 
2232
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
1555
2233
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1556
2234
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1557
2235
        fi
1558
2236
 
1559
 
        if test $pass = conv; then
 
2237
        if test "$pass" = conv; then
1560
2238
          # Only check for convenience libraries
1561
2239
          deplibs="$lib $deplibs"
1562
2240
          if test -z "$libdir"; then
1563
2241
            if test -z "$old_library"; then
1564
2242
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1565
 
              exit 1
 
2243
              exit $EXIT_FAILURE
1566
2244
            fi
1567
2245
            # It is a libtool convenience library, so add in its objects.
1568
2246
            convenience="$convenience $ladir/$objdir/$old_library"
1577
2255
              fi
1578
2256
              tmp_libs="$tmp_libs $deplib"
1579
2257
            done
1580
 
          elif test $linkmode != prog && test $linkmode != lib; then
 
2258
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
1581
2259
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1582
 
            exit 1
 
2260
            exit $EXIT_FAILURE
1583
2261
          fi
1584
2262
          continue
1585
2263
        fi # $pass = conv
1586
2264
 
 
2265
 
1587
2266
        # Get the name of the library we link against.
1588
2267
        linklib=
1589
2268
        for l in $old_library $library_names; do
1591
2270
        done
1592
2271
        if test -z "$linklib"; then
1593
2272
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1594
 
          exit 1
 
2273
          exit $EXIT_FAILURE
1595
2274
        fi
1596
2275
 
1597
2276
        # This library was specified with -dlopen.
1598
 
        if test $pass = dlopen; then
 
2277
        if test "$pass" = dlopen; then
1599
2278
          if test -z "$libdir"; then
1600
2279
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1601
 
            exit 1
 
2280
            exit $EXIT_FAILURE
1602
2281
          fi
1603
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2282
          if test -z "$dlname" ||
 
2283
             test "$dlopen_support" != yes ||
 
2284
             test "$build_libtool_libs" = no; then
1604
2285
            # If there is no dlname, no dlopen support or we're linking
1605
 
            # statically, we need to preload.
1606
 
            dlprefiles="$dlprefiles $lib"
 
2286
            # statically, we need to preload.  We also need to preload any
 
2287
            # dependent libraries so libltdl's deplib preloader doesn't
 
2288
            # bomb out in the load deplibs phase.
 
2289
            dlprefiles="$dlprefiles $lib $dependency_libs"
1607
2290
          else
1608
2291
            newdlfiles="$newdlfiles $lib"
1609
2292
          fi
1635
2318
            dir="$libdir"
1636
2319
            absdir="$libdir"
1637
2320
          fi
 
2321
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
1638
2322
        else
1639
 
          dir="$ladir/$objdir"
1640
 
          absdir="$abs_ladir/$objdir"
1641
 
          # Remove this search path later
1642
 
          notinst_path="$notinst_path $abs_ladir"
 
2323
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2324
            dir="$ladir"
 
2325
            absdir="$abs_ladir"
 
2326
            # Remove this search path later
 
2327
            notinst_path="$notinst_path $abs_ladir"
 
2328
          else
 
2329
            dir="$ladir/$objdir"
 
2330
            absdir="$abs_ladir/$objdir"
 
2331
            # Remove this search path later
 
2332
            notinst_path="$notinst_path $abs_ladir"
 
2333
          fi
1643
2334
        fi # $installed = yes
1644
2335
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1645
2336
 
1646
2337
        # This library was specified with -dlpreopen.
1647
 
        if test $pass = dlpreopen; then
 
2338
        if test "$pass" = dlpreopen; then
1648
2339
          if test -z "$libdir"; then
1649
2340
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1650
 
            exit 1
 
2341
            exit $EXIT_FAILURE
1651
2342
          fi
1652
2343
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1653
2344
          # are required to link).
1663
2354
 
1664
2355
        if test -z "$libdir"; then
1665
2356
          # Link the convenience library
1666
 
          if test $linkmode = lib; then
 
2357
          if test "$linkmode" = lib; then
1667
2358
            deplibs="$dir/$old_library $deplibs"
1668
2359
          elif test "$linkmode,$pass" = "prog,link"; then
1669
2360
            compile_deplibs="$dir/$old_library $compile_deplibs"
1670
2361
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1671
2362
          else
1672
 
            deplibs="$lib $deplibs"
 
2363
            deplibs="$lib $deplibs" # used for prog,scan pass
1673
2364
          fi
1674
2365
          continue
1675
2366
        fi
1676
2367
 
1677
 
        if test $linkmode = prog && test $pass != link; then
 
2368
 
 
2369
        if test "$linkmode" = prog && test "$pass" != link; then
1678
2370
          newlib_search_path="$newlib_search_path $ladir"
1679
2371
          deplibs="$lib $deplibs"
1680
2372
 
1690
2382
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1691
2383
            esac
1692
2384
            # Need to link against all dependency_libs?
1693
 
            if test $linkalldeplibs = yes; then
 
2385
            if test "$linkalldeplibs" = yes; then
1694
2386
              deplibs="$deplib $deplibs"
1695
2387
            else
1696
2388
              # Need to hardcode shared library paths
1707
2399
          continue
1708
2400
        fi # $linkmode = prog...
1709
2401
 
 
2402
        if test "$linkmode,$pass" = "prog,link"; then
 
2403
          if test -n "$library_names" &&
 
2404
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2405
            # We need to hardcode the library path
 
2406
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
 
2407
              # Make sure the rpath contains only unique directories.
 
2408
              case "$temp_rpath " in
 
2409
              *" $dir "*) ;;
 
2410
              *" $absdir "*) ;;
 
2411
              *) temp_rpath="$temp_rpath $absdir" ;;
 
2412
              esac
 
2413
            fi
 
2414
 
 
2415
            # Hardcode the library path.
 
2416
            # Skip directories that are in the system default run-time
 
2417
            # search path.
 
2418
            case " $sys_lib_dlsearch_path " in
 
2419
            *" $absdir "*) ;;
 
2420
            *)
 
2421
              case "$compile_rpath " in
 
2422
              *" $absdir "*) ;;
 
2423
              *) compile_rpath="$compile_rpath $absdir"
 
2424
              esac
 
2425
              ;;
 
2426
            esac
 
2427
            case " $sys_lib_dlsearch_path " in
 
2428
            *" $libdir "*) ;;
 
2429
            *)
 
2430
              case "$finalize_rpath " in
 
2431
              *" $libdir "*) ;;
 
2432
              *) finalize_rpath="$finalize_rpath $libdir"
 
2433
              esac
 
2434
              ;;
 
2435
            esac
 
2436
          fi # $linkmode,$pass = prog,link...
 
2437
 
 
2438
          if test "$alldeplibs" = yes &&
 
2439
             { test "$deplibs_check_method" = pass_all ||
 
2440
               { test "$build_libtool_libs" = yes &&
 
2441
                 test -n "$library_names"; }; }; then
 
2442
            # We only need to search for static libraries
 
2443
            continue
 
2444
          fi
 
2445
        fi
 
2446
 
1710
2447
        link_static=no # Whether the deplib will be linked statically
1711
2448
        if test -n "$library_names" &&
1712
2449
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1713
 
          # Link against this shared library
1714
 
 
1715
 
          if test "$linkmode,$pass" = "prog,link" ||
1716
 
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1717
 
            # Hardcode the library path.
1718
 
            # Skip directories that are in the system default run-time
1719
 
            # search path.
1720
 
            case " $sys_lib_dlsearch_path " in
1721
 
            *" $absdir "*) ;;
1722
 
            *)
1723
 
              case "$compile_rpath " in
1724
 
              *" $absdir "*) ;;
1725
 
              *) compile_rpath="$compile_rpath $absdir"
1726
 
              esac
1727
 
              ;;
1728
 
            esac
1729
 
            case " $sys_lib_dlsearch_path " in
1730
 
            *" $libdir "*) ;;
1731
 
            *)
1732
 
              case "$finalize_rpath " in
1733
 
              *" $libdir "*) ;;
1734
 
              *) finalize_rpath="$finalize_rpath $libdir"
1735
 
              esac
1736
 
              ;;
1737
 
            esac
1738
 
            if test $linkmode = prog; then
1739
 
              # We need to hardcode the library path
1740
 
              if test -n "$shlibpath_var"; then
1741
 
                # Make sure the rpath contains only unique directories.
1742
 
                case "$temp_rpath " in
1743
 
                *" $dir "*) ;;
1744
 
                *" $absdir "*) ;;
1745
 
                *) temp_rpath="$temp_rpath $dir" ;;
1746
 
                esac
1747
 
              fi
1748
 
            fi
1749
 
          fi # $linkmode,$pass = prog,link...
1750
 
 
1751
 
          if test "$alldeplibs" = yes &&
1752
 
             { test "$deplibs_check_method" = pass_all ||
1753
 
               { test "$build_libtool_libs" = yes &&
1754
 
                 test -n "$library_names"; }; }; then
1755
 
            # We only need to search for static libraries
1756
 
            continue
1757
 
          fi
1758
 
 
1759
2450
          if test "$installed" = no; then
1760
2451
            notinst_deplibs="$notinst_deplibs $lib"
1761
2452
            need_relink=yes
1762
2453
          fi
 
2454
          # This is a shared library
 
2455
 
 
2456
          # Warn about portability, can't link against -module's on
 
2457
          # some systems (darwin)
 
2458
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2459
            $echo
 
2460
            if test "$linkmode" = prog; then
 
2461
              $echo "*** Warning: Linking the executable $output against the loadable module"
 
2462
            else
 
2463
              $echo "*** Warning: Linking the shared library $output against the loadable module"
 
2464
            fi
 
2465
            $echo "*** $linklib is not portable!"
 
2466
          fi
 
2467
          if test "$linkmode" = lib &&
 
2468
             test "$hardcode_into_libs" = yes; then
 
2469
            # Hardcode the library path.
 
2470
            # Skip directories that are in the system default run-time
 
2471
            # search path.
 
2472
            case " $sys_lib_dlsearch_path " in
 
2473
            *" $absdir "*) ;;
 
2474
            *)
 
2475
              case "$compile_rpath " in
 
2476
              *" $absdir "*) ;;
 
2477
              *) compile_rpath="$compile_rpath $absdir"
 
2478
              esac
 
2479
              ;;
 
2480
            esac
 
2481
            case " $sys_lib_dlsearch_path " in
 
2482
            *" $libdir "*) ;;
 
2483
            *)
 
2484
              case "$finalize_rpath " in
 
2485
              *" $libdir "*) ;;
 
2486
              *) finalize_rpath="$finalize_rpath $libdir"
 
2487
              esac
 
2488
              ;;
 
2489
            esac
 
2490
          fi
1763
2491
 
1764
2492
          if test -n "$old_archive_from_expsyms_cmds"; then
1765
2493
            # figure out the soname
1773
2501
            elif test -n "$soname_spec"; then
1774
2502
              # bleh windows
1775
2503
              case $host in
1776
 
              *cygwin*)
 
2504
              *cygwin* | mingw*)
1777
2505
                major=`expr $current - $age`
1778
2506
                versuffix="-$major"
1779
2507
                ;;
1785
2513
 
1786
2514
            # Make a new name for the extract_expsyms_cmds to use
1787
2515
            soroot="$soname"
1788
 
            soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1789
 
            newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
 
2516
            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
 
2517
            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1790
2518
 
1791
2519
            # If the library has no export list, then create one now
1792
2520
            if test -f "$output_objdir/$soname-def"; then :
1793
2521
            else
1794
2522
              $show "extracting exported symbol list from \`$soname'"
1795
2523
              save_ifs="$IFS"; IFS='~'
1796
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2524
              cmds=$extract_expsyms_cmds
1797
2525
              for cmd in $cmds; do
1798
2526
                IFS="$save_ifs"
 
2527
                eval cmd=\"$cmd\"
1799
2528
                $show "$cmd"
1800
2529
                $run eval "$cmd" || exit $?
1801
2530
              done
1806
2535
            if test -f "$output_objdir/$newlib"; then :; else
1807
2536
              $show "generating import library for \`$soname'"
1808
2537
              save_ifs="$IFS"; IFS='~'
1809
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2538
              cmds=$old_archive_from_expsyms_cmds
1810
2539
              for cmd in $cmds; do
1811
2540
                IFS="$save_ifs"
 
2541
                eval cmd=\"$cmd\"
1812
2542
                $show "$cmd"
1813
2543
                $run eval "$cmd" || exit $?
1814
2544
              done
1817
2547
            # make sure the library variables are pointing to the new library
1818
2548
            dir=$output_objdir
1819
2549
            linklib=$newlib
1820
 
          fi # test -n $old_archive_from_expsyms_cmds
 
2550
          fi # test -n "$old_archive_from_expsyms_cmds"
1821
2551
 
1822
 
          if test $linkmode = prog || test "$mode" != relink; then
 
2552
          if test "$linkmode" = prog || test "$mode" != relink; then
1823
2553
            add_shlibpath=
1824
2554
            add_dir=
1825
2555
            add=
1828
2558
            immediate | unsupported)
1829
2559
              if test "$hardcode_direct" = no; then
1830
2560
                add="$dir/$linklib"
 
2561
                case $host in
 
2562
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2563
                  *-*-darwin* )
 
2564
                    # if the lib is a module then we can not link against
 
2565
                    # it, someone is ignoring the new warnings I added
 
2566
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2567
                      $echo "** Warning, lib $linklib is a module, not a shared library"
 
2568
                      if test -z "$old_library" ; then
 
2569
                        $echo
 
2570
                        $echo "** And there doesn't seem to be a static archive available"
 
2571
                        $echo "** The link will probably fail, sorry"
 
2572
                      else
 
2573
                        add="$dir/$old_library"
 
2574
                      fi
 
2575
                    fi
 
2576
                esac
1831
2577
              elif test "$hardcode_minus_L" = no; then
1832
2578
                case $host in
1833
2579
                *-*-sunos*) add_shlibpath="$dir" ;;
1846
2592
                add="$dir/$linklib"
1847
2593
              elif test "$hardcode_minus_L" = yes; then
1848
2594
                add_dir="-L$dir"
 
2595
                # Try looking first in the location we're being installed to.
 
2596
                if test -n "$inst_prefix_dir"; then
 
2597
                  case $libdir in
 
2598
                    [\\/]*)
 
2599
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2600
                      ;;
 
2601
                  esac
 
2602
                fi
1849
2603
                add="-l$name"
1850
2604
              elif test "$hardcode_shlibpath_var" = yes; then
1851
2605
                add_shlibpath="$dir"
1859
2613
 
1860
2614
            if test "$lib_linked" != yes; then
1861
2615
              $echo "$modename: configuration error: unsupported hardcode properties"
1862
 
              exit 1
 
2616
              exit $EXIT_FAILURE
1863
2617
            fi
1864
2618
 
1865
2619
            if test -n "$add_shlibpath"; then
1868
2622
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1869
2623
              esac
1870
2624
            fi
1871
 
            if test $linkmode = prog; then
 
2625
            if test "$linkmode" = prog; then
1872
2626
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1873
2627
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1874
2628
            else
1885
2639
            fi
1886
2640
          fi
1887
2641
 
1888
 
          if test $linkmode = prog || test "$mode" = relink; then
 
2642
          if test "$linkmode" = prog || test "$mode" = relink; then
1889
2643
            add_shlibpath=
1890
2644
            add_dir=
1891
2645
            add=
1901
2655
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1902
2656
              esac
1903
2657
              add="-l$name"
 
2658
            elif test "$hardcode_automatic" = yes; then
 
2659
              if test -n "$inst_prefix_dir" &&
 
2660
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2661
                add="$inst_prefix_dir$libdir/$linklib"
 
2662
              else
 
2663
                add="$libdir/$linklib"
 
2664
              fi
1904
2665
            else
1905
2666
              # We cannot seem to hardcode it, guess we'll fake it.
1906
2667
              add_dir="-L$libdir"
 
2668
              # Try looking first in the location we're being installed to.
 
2669
              if test -n "$inst_prefix_dir"; then
 
2670
                case $libdir in
 
2671
                  [\\/]*)
 
2672
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 
2673
                    ;;
 
2674
                esac
 
2675
              fi
1907
2676
              add="-l$name"
1908
2677
            fi
1909
2678
 
1910
 
            if test $linkmode = prog; then
 
2679
            if test "$linkmode" = prog; then
1911
2680
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1912
2681
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1913
2682
            else
1915
2684
              test -n "$add" && deplibs="$add $deplibs"
1916
2685
            fi
1917
2686
          fi
1918
 
        elif test $linkmode = prog; then
1919
 
          if test "$alldeplibs" = yes &&
1920
 
             { test "$deplibs_check_method" = pass_all ||
1921
 
               { test "$build_libtool_libs" = yes &&
1922
 
                 test -n "$library_names"; }; }; then
1923
 
            # We only need to search for static libraries
1924
 
            continue
1925
 
          fi
1926
 
 
1927
 
          # Try to link the static library
 
2687
        elif test "$linkmode" = prog; then
1928
2688
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1929
2689
          # is not unsupported.  This is valid on all known static and
1930
2690
          # shared platforms.
1944
2704
 
1945
2705
            # Just print a warning and add the library to dependency_libs so
1946
2706
            # that the program can be linked against the static library.
1947
 
            echo
1948
 
            echo "*** Warning: This system can not link to static lib archive $lib."
1949
 
            echo "*** I have the capability to make that library automatically link in when"
1950
 
            echo "*** you link to this library.  But I can only do this if you have a"
1951
 
            echo "*** shared version of the library, which you do not appear to have."
 
2707
            $echo
 
2708
            $echo "*** Warning: This system can not link to static lib archive $lib."
 
2709
            $echo "*** I have the capability to make that library automatically link in when"
 
2710
            $echo "*** you link to this library.  But I can only do this if you have a"
 
2711
            $echo "*** shared version of the library, which you do not appear to have."
1952
2712
            if test "$module" = yes; then
1953
 
              echo "*** But as you try to build a module library, libtool will still create "
1954
 
              echo "*** a static module, that should work as long as the dlopening application"
1955
 
              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 
2713
              $echo "*** But as you try to build a module library, libtool will still create "
 
2714
              $echo "*** a static module, that should work as long as the dlopening application"
 
2715
              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1956
2716
              if test -z "$global_symbol_pipe"; then
1957
 
                echo
1958
 
                echo "*** However, this would only work if libtool was able to extract symbol"
1959
 
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1960
 
                echo "*** not find such a program.  So, this module is probably useless."
1961
 
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2717
                $echo
 
2718
                $echo "*** However, this would only work if libtool was able to extract symbol"
 
2719
                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2720
                $echo "*** not find such a program.  So, this module is probably useless."
 
2721
                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
1962
2722
              fi
1963
2723
              if test "$build_old_libs" = no; then
1964
2724
                build_libtool_libs=module
1968
2728
              fi
1969
2729
            fi
1970
2730
          else
1971
 
            convenience="$convenience $dir/$old_library"
1972
 
            old_convenience="$old_convenience $dir/$old_library"
1973
2731
            deplibs="$dir/$old_library $deplibs"
1974
2732
            link_static=yes
1975
2733
          fi
1976
2734
        fi # link shared/static library?
1977
2735
 
1978
 
        if test $linkmode = lib; then
 
2736
        if test "$linkmode" = lib; then
1979
2737
          if test -n "$dependency_libs" &&
1980
 
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1981
 
               test $link_static = yes; }; then
 
2738
             { test "$hardcode_into_libs" != yes ||
 
2739
               test "$build_old_libs" = yes ||
 
2740
               test "$link_static" = yes; }; then
1982
2741
            # Extract -R from dependency_libs
1983
2742
            temp_deplibs=
1984
2743
            for libdir in $dependency_libs; do
2009
2768
            tmp_libs="$tmp_libs $deplib"
2010
2769
          done
2011
2770
 
2012
 
          if test $link_all_deplibs != no; then
 
2771
          if test "$link_all_deplibs" != no; then
2013
2772
            # Add the search paths of all dependency libraries
2014
2773
            for deplib in $dependency_libs; do
2015
2774
              case $deplib in
2029
2788
                  ;;
2030
2789
                esac
2031
2790
                if grep "^installed=no" $deplib > /dev/null; then
2032
 
                  path="-L$absdir/$objdir"
 
2791
                  path="$absdir/$objdir"
2033
2792
                else
2034
2793
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2035
2794
                  if test -z "$libdir"; then
2036
2795
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2037
 
                    exit 1
 
2796
                    exit $EXIT_FAILURE
2038
2797
                  fi
2039
2798
                  if test "$absdir" != "$libdir"; then
2040
2799
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2041
2800
                  fi
2042
 
                  path="-L$absdir"
 
2801
                  path="$absdir"
2043
2802
                fi
 
2803
                depdepl=
 
2804
                case $host in
 
2805
                *-*-darwin*)
 
2806
                  # we do not want to link against static libs,
 
2807
                  # but need to link against shared
 
2808
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
 
2809
                  if test -n "$deplibrary_names" ; then
 
2810
                    for tmp in $deplibrary_names ; do
 
2811
                      depdepl=$tmp
 
2812
                    done
 
2813
                    if test -f "$path/$depdepl" ; then
 
2814
                      depdepl="$path/$depdepl"
 
2815
                    fi
 
2816
                    # do not add paths which are already there
 
2817
                    case " $newlib_search_path " in
 
2818
                    *" $path "*) ;;
 
2819
                    *) newlib_search_path="$newlib_search_path $path";;
 
2820
                    esac
 
2821
                  fi
 
2822
                  path=""
 
2823
                  ;;
 
2824
                *)
 
2825
                  path="-L$path"
 
2826
                  ;;
 
2827
                esac
 
2828
                ;;
 
2829
              -l*)
 
2830
                case $host in
 
2831
                *-*-darwin*)
 
2832
                  # Again, we only want to link against shared libraries
 
2833
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2834
                  for tmp in $newlib_search_path ; do
 
2835
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2836
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2837
                      break
 
2838
                    fi
 
2839
                  done
 
2840
                  path=""
 
2841
                  ;;
 
2842
                *) continue ;;
 
2843
                esac
2044
2844
                ;;
2045
2845
              *) continue ;;
2046
2846
              esac
2047
2847
              case " $deplibs " in
2048
2848
              *" $path "*) ;;
2049
 
              *) deplibs="$deplibs $path" ;;
 
2849
              *) deplibs="$path $deplibs" ;;
 
2850
              esac
 
2851
              case " $deplibs " in
 
2852
              *" $depdepl "*) ;;
 
2853
              *) deplibs="$depdepl $deplibs" ;;
2050
2854
              esac
2051
2855
            done
2052
2856
          fi # link_all_deplibs != no
2053
2857
        fi # linkmode = lib
2054
2858
      done # for deplib in $libs
2055
 
      if test $pass = dlpreopen; then
 
2859
      dependency_libs="$newdependency_libs"
 
2860
      if test "$pass" = dlpreopen; then
2056
2861
        # Link the dlpreopened libraries before other libraries
2057
2862
        for deplib in $save_deplibs; do
2058
2863
          deplibs="$deplib $deplibs"
2059
2864
        done
2060
2865
      fi
2061
 
      if test $pass != dlopen; then
2062
 
        test $pass != scan && dependency_libs="$newdependency_libs"
2063
 
        if test $pass != conv; then
 
2866
      if test "$pass" != dlopen; then
 
2867
        if test "$pass" != conv; then
2064
2868
          # Make sure lib_search_path contains only unique directories.
2065
2869
          lib_search_path=
2066
2870
          for dir in $newlib_search_path; do
2082
2886
          eval tmp_libs=\"\$$var\"
2083
2887
          new_libs=
2084
2888
          for deplib in $tmp_libs; do
 
2889
            # FIXME: Pedantically, this is the right thing to do, so
 
2890
            #        that some nasty dependency loop isn't accidentally
 
2891
            #        broken:
 
2892
            #new_libs="$deplib $new_libs"
 
2893
            # Pragmatically, this seems to cause very few problems in
 
2894
            # practice:
2085
2895
            case $deplib in
2086
2896
            -L*) new_libs="$deplib $new_libs" ;;
 
2897
            -R*) ;;
2087
2898
            *)
 
2899
              # And here is the reason: when a library appears more
 
2900
              # than once as an explicit dependence of a library, or
 
2901
              # is implicitly linked in more than once by the
 
2902
              # compiler, it is considered special, and multiple
 
2903
              # occurrences thereof are not removed.  Compare this
 
2904
              # with having the same library being listed as a
 
2905
              # dependency of multiple other libraries: in this case,
 
2906
              # we know (pedantically, we assume) the library does not
 
2907
              # need to be listed more than once, so we keep only the
 
2908
              # last copy.  This is not always right, but it is rare
 
2909
              # enough that we require users that really mean to play
 
2910
              # such unportable linking tricks to link the library
 
2911
              # using -Wl,-lname, so that libtool does not consider it
 
2912
              # for duplicate removal.
2088
2913
              case " $specialdeplibs " in
2089
2914
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2090
2915
              *)
2112
2937
          eval $var=\"$tmp_libs\"
2113
2938
        done # for var
2114
2939
      fi
2115
 
      if test "$pass" = "conv" &&
2116
 
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2117
 
        libs="$deplibs" # reset libs
2118
 
        deplibs=
2119
 
      fi
 
2940
      # Last step: remove runtime libs from dependency_libs
 
2941
      # (they stay in deplibs)
 
2942
      tmp_libs=
 
2943
      for i in $dependency_libs ; do
 
2944
        case " $predeps $postdeps $compiler_lib_search_path " in
 
2945
        *" $i "*)
 
2946
          i=""
 
2947
          ;;
 
2948
        esac
 
2949
        if test -n "$i" ; then
 
2950
          tmp_libs="$tmp_libs $i"
 
2951
        fi
 
2952
      done
 
2953
      dependency_libs=$tmp_libs
2120
2954
    done # for pass
2121
 
    if test $linkmode = prog; then
 
2955
    if test "$linkmode" = prog; then
2122
2956
      dlfiles="$newdlfiles"
2123
2957
      dlprefiles="$newdlprefiles"
2124
2958
    fi
2125
2959
 
2126
2960
    case $linkmode in
2127
2961
    oldlib)
 
2962
      if test -n "$deplibs"; then
 
2963
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
 
2964
      fi
 
2965
 
2128
2966
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2129
2967
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2130
2968
      fi
2138
2976
      fi
2139
2977
 
2140
2978
      if test -n "$vinfo"; then
2141
 
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
2979
        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2142
2980
      fi
2143
2981
 
2144
2982
      if test -n "$release"; then
2160
2998
      case $outputname in
2161
2999
      lib*)
2162
3000
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
3001
        eval shared_ext=\"$shrext_cmds\"
2163
3002
        eval libname=\"$libname_spec\"
2164
3003
        ;;
2165
3004
      *)
2166
3005
        if test "$module" = no; then
2167
3006
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2168
3007
          $echo "$help" 1>&2
2169
 
          exit 1
 
3008
          exit $EXIT_FAILURE
2170
3009
        fi
2171
3010
        if test "$need_lib_prefix" != no; then
2172
3011
          # Add the "lib" prefix for modules if required
2173
3012
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
3013
          eval shared_ext=\"$shrext_cmds\"
2174
3014
          eval libname=\"$libname_spec\"
2175
3015
        else
2176
3016
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2181
3021
      if test -n "$objs"; then
2182
3022
        if test "$deplibs_check_method" != pass_all; then
2183
3023
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2184
 
          exit 1
 
3024
          exit $EXIT_FAILURE
2185
3025
        else
2186
 
          echo
2187
 
          echo "*** Warning: Linking the shared library $output against the non-libtool"
2188
 
          echo "*** objects $objs is not portable!"
 
3026
          $echo
 
3027
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
 
3028
          $echo "*** objects $objs is not portable!"
2189
3029
          libobjs="$libobjs $objs"
2190
3030
        fi
2191
3031
      fi
2195
3035
      fi
2196
3036
 
2197
3037
      set dummy $rpath
2198
 
      if test $# -gt 2; then
 
3038
      if test "$#" -gt 2; then
2199
3039
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2200
3040
      fi
2201
3041
      install_libdir="$2"
2204
3044
      if test -z "$rpath"; then
2205
3045
        if test "$build_libtool_libs" = yes; then
2206
3046
          # Building a libtool convenience library.
2207
 
          libext=al
 
3047
          # Some compilers have problems with a `.al' extension so
 
3048
          # convenience libraries should have the same extension an
 
3049
          # archive normally would.
2208
3050
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2209
3051
          build_libtool_libs=convenience
2210
3052
          build_old_libs=yes
2211
3053
        fi
2212
3054
 
2213
3055
        if test -n "$vinfo"; then
2214
 
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
3056
          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2215
3057
        fi
2216
3058
 
2217
3059
        if test -n "$release"; then
2227
3069
        if test -n "$8"; then
2228
3070
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2229
3071
          $echo "$help" 1>&2
2230
 
          exit 1
 
3072
          exit $EXIT_FAILURE
2231
3073
        fi
2232
3074
 
2233
 
        current="$2"
2234
 
        revision="$3"
2235
 
        age="$4"
 
3075
        # convert absolute version numbers to libtool ages
 
3076
        # this retains compatibility with .la files and attempts
 
3077
        # to make the code below a bit more comprehensible
 
3078
 
 
3079
        case $vinfo_number in
 
3080
        yes)
 
3081
          number_major="$2"
 
3082
          number_minor="$3"
 
3083
          number_revision="$4"
 
3084
          #
 
3085
          # There are really only two kinds -- those that
 
3086
          # use the current revision as the major version
 
3087
          # and those that subtract age and use age as
 
3088
          # a minor version.  But, then there is irix
 
3089
          # which has an extra 1 added just for fun
 
3090
          #
 
3091
          case $version_type in
 
3092
          darwin|linux|osf|windows)
 
3093
            current=`expr $number_major + $number_minor`
 
3094
            age="$number_minor"
 
3095
            revision="$number_revision"
 
3096
            ;;
 
3097
          freebsd-aout|freebsd-elf|sunos)
 
3098
            current="$number_major"
 
3099
            revision="$number_minor"
 
3100
            age="0"
 
3101
            ;;
 
3102
          irix|nonstopux)
 
3103
            current=`expr $number_major + $number_minor - 1`
 
3104
            age="$number_minor"
 
3105
            revision="$number_minor"
 
3106
            ;;
 
3107
          esac
 
3108
          ;;
 
3109
        no)
 
3110
          current="$2"
 
3111
          revision="$3"
 
3112
          age="$4"
 
3113
          ;;
 
3114
        esac
2236
3115
 
2237
3116
        # Check that each of the things are valid numbers.
2238
3117
        case $current in
2239
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3118
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2240
3119
        *)
2241
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3120
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2242
3121
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2243
 
          exit 1
 
3122
          exit $EXIT_FAILURE
2244
3123
          ;;
2245
3124
        esac
2246
3125
 
2247
3126
        case $revision in
2248
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3127
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2249
3128
        *)
2250
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3129
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2251
3130
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2252
 
          exit 1
 
3131
          exit $EXIT_FAILURE
2253
3132
          ;;
2254
3133
        esac
2255
3134
 
2256
3135
        case $age in
2257
 
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
3136
        0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2258
3137
        *)
2259
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3138
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2260
3139
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2261
 
          exit 1
 
3140
          exit $EXIT_FAILURE
2262
3141
          ;;
2263
3142
        esac
2264
3143
 
2265
 
        if test $age -gt $current; then
 
3144
        if test "$age" -gt "$current"; then
2266
3145
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2267
3146
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2268
 
          exit 1
 
3147
          exit $EXIT_FAILURE
2269
3148
        fi
2270
3149
 
2271
3150
        # Calculate the version variables.
2282
3161
          versuffix="$major.$age.$revision"
2283
3162
          # Darwin ld doesn't like 0 for these options...
2284
3163
          minor_current=`expr $current + 1`
2285
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3164
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2286
3165
          ;;
2287
3166
 
2288
3167
        freebsd-aout)
2306
3185
 
2307
3186
          # Add in all the interfaces that we are compatible with.
2308
3187
          loop=$revision
2309
 
          while test $loop != 0; do
 
3188
          while test "$loop" -ne 0; do
2310
3189
            iface=`expr $revision - $loop`
2311
3190
            loop=`expr $loop - 1`
2312
3191
            verstring="$verstring_prefix$major.$iface:$verstring"
2329
3208
 
2330
3209
          # Add in all the interfaces that we are compatible with.
2331
3210
          loop=$age
2332
 
          while test $loop != 0; do
 
3211
          while test "$loop" -ne 0; do
2333
3212
            iface=`expr $current - $loop`
2334
3213
            loop=`expr $loop - 1`
2335
3214
            verstring="$verstring:${iface}.0"
2353
3232
 
2354
3233
        *)
2355
3234
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2356
 
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2357
 
          exit 1
 
3235
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3236
          exit $EXIT_FAILURE
2358
3237
          ;;
2359
3238
        esac
2360
3239
 
2361
3240
        # Clear the version info if we defaulted, and they specified a release.
2362
3241
        if test -z "$vinfo" && test -n "$release"; then
2363
3242
          major=
2364
 
          verstring="0.0"
2365
3243
          case $version_type in
2366
3244
          darwin)
2367
3245
            # we can't check for "0.0" in archive_cmds due to quoting
2368
3246
            # problems, so we reset it completely
2369
 
            verstring=""
 
3247
            verstring=
2370
3248
            ;;
2371
3249
          *)
2372
3250
            verstring="0.0"
2400
3278
      fi
2401
3279
 
2402
3280
      if test "$mode" != relink; then
2403
 
        # Remove our outputs.
2404
 
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2405
 
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
 
3281
        # Remove our outputs, but don't remove object files since they
 
3282
        # may have been created when compiling PIC objects.
 
3283
        removelist=
 
3284
        tempremovelist=`$echo "$output_objdir/*"`
 
3285
        for p in $tempremovelist; do
 
3286
          case $p in
 
3287
            *.$objext)
 
3288
               ;;
 
3289
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3290
               if test "X$precious_files_regex" != "X"; then
 
3291
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3292
                 then
 
3293
                   continue
 
3294
                 fi
 
3295
               fi
 
3296
               removelist="$removelist $p"
 
3297
               ;;
 
3298
            *) ;;
 
3299
          esac
 
3300
        done
 
3301
        if test -n "$removelist"; then
 
3302
          $show "${rm}r $removelist"
 
3303
          $run ${rm}r $removelist
 
3304
        fi
2406
3305
      fi
2407
3306
 
2408
3307
      # Now set the variables for building old libraries.
2415
3314
 
2416
3315
      # Eliminate all temporary directories.
2417
3316
      for path in $notinst_path; do
2418
 
        lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2419
 
        deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2420
 
        dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3317
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
 
3318
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
 
3319
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2421
3320
      done
2422
3321
 
2423
3322
      if test -n "$xrpath"; then
2430
3329
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2431
3330
          esac
2432
3331
        done
2433
 
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
3332
        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2434
3333
          dependency_libs="$temp_xrpath $dependency_libs"
2435
3334
        fi
2436
3335
      fi
2468
3367
          *-*-netbsd*)
2469
3368
            # Don't link with libc until the a.out ld.so is fixed.
2470
3369
            ;;
2471
 
          *-*-openbsd* | *-*-freebsd*)
 
3370
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
2472
3371
            # Do not include libc due to us having libc/libc_r.
 
3372
            test "X$arg" = "X-lc" && continue
2473
3373
            ;;
2474
 
          *)
 
3374
          *)
2475
3375
            # Add libc to deplibs on all other systems if necessary.
2476
 
            if test $build_libtool_need_lc = "yes"; then
 
3376
            if test "$build_libtool_need_lc" = "yes"; then
2477
3377
              deplibs="$deplibs -lc"
2478
3378
            fi
2479
3379
            ;;
2500
3400
          # This might be a little naive.  We might want to check
2501
3401
          # whether the library exists or not.  But this is on
2502
3402
          # osf3 & osf4 and I'm not really sure... Just
2503
 
          # implementing what was already the behaviour.
 
3403
          # implementing what was already the behavior.
2504
3404
          newdeplibs=$deplibs
2505
3405
          ;;
2506
3406
        test_compile)
2513
3413
          int main() { return 0; }
2514
3414
EOF
2515
3415
          $rm conftest
2516
 
          $CC -o conftest conftest.c $deplibs
2517
 
          if test $? -eq 0 ; then
 
3416
          $LTCC -o conftest conftest.c $deplibs
 
3417
          if test "$?" -eq 0 ; then
2518
3418
            ldd_output=`ldd conftest`
2519
3419
            for i in $deplibs; do
2520
 
              name="`expr $i : '-l\(.*\)'`"
 
3420
              name=`expr $i : '-l\(.*\)'`
2521
3421
              # If $name is empty we are operating on a -L argument.
2522
 
              if test -n "$name" && test "$name" != "0"; then
2523
 
                libname=`eval \\$echo \"$libname_spec\"`
2524
 
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2525
 
                set dummy $deplib_matches
2526
 
                deplib_match=$2
2527
 
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2528
 
                  newdeplibs="$newdeplibs $i"
2529
 
                else
2530
 
                  droppeddeps=yes
2531
 
                  echo
2532
 
                  echo "*** Warning: dynamic linker does not accept needed library $i."
2533
 
                  echo "*** I have the capability to make that library automatically link in when"
2534
 
                  echo "*** you link to this library.  But I can only do this if you have a"
2535
 
                  echo "*** shared version of the library, which I believe you do not have"
2536
 
                  echo "*** because a test_compile did reveal that the linker did not use it for"
2537
 
                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
2538
 
                fi
2539
 
              else
2540
 
                newdeplibs="$newdeplibs $i"
2541
 
              fi
2542
 
            done
2543
 
          else
2544
 
            # Error occured in the first compile.  Let's try to salvage
2545
 
            # the situation: Compile a separate program for each library.
2546
 
            for i in $deplibs; do
2547
 
              name="`expr $i : '-l\(.*\)'`"
2548
 
             # If $name is empty we are operating on a -L argument.
2549
 
              if test -n "$name" && test "$name" != "0"; then
2550
 
                $rm conftest
2551
 
                $CC -o conftest conftest.c $i
2552
 
                # Did it work?
2553
 
                if test $? -eq 0 ; then
2554
 
                  ldd_output=`ldd conftest`
 
3422
              if test "$name" != "" && test "$name" -ne "0"; then
 
3423
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3424
                  case " $predeps $postdeps " in
 
3425
                  *" $i "*)
 
3426
                    newdeplibs="$newdeplibs $i"
 
3427
                    i=""
 
3428
                    ;;
 
3429
                  esac
 
3430
                fi
 
3431
                if test -n "$i" ; then
2555
3432
                  libname=`eval \\$echo \"$libname_spec\"`
2556
3433
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2557
3434
                  set dummy $deplib_matches
2560
3437
                    newdeplibs="$newdeplibs $i"
2561
3438
                  else
2562
3439
                    droppeddeps=yes
2563
 
                    echo
2564
 
                    echo "*** Warning: dynamic linker does not accept needed library $i."
2565
 
                    echo "*** I have the capability to make that library automatically link in when"
2566
 
                    echo "*** you link to this library.  But I can only do this if you have a"
2567
 
                    echo "*** shared version of the library, which you do not appear to have"
2568
 
                    echo "*** because a test_compile did reveal that the linker did not use this one"
2569
 
                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3440
                    $echo
 
3441
                    $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3442
                    $echo "*** I have the capability to make that library automatically link in when"
 
3443
                    $echo "*** you link to this library.  But I can only do this if you have a"
 
3444
                    $echo "*** shared version of the library, which I believe you do not have"
 
3445
                    $echo "*** because a test_compile did reveal that the linker did not use it for"
 
3446
                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
 
3447
                  fi
 
3448
                fi
 
3449
              else
 
3450
                newdeplibs="$newdeplibs $i"
 
3451
              fi
 
3452
            done
 
3453
          else
 
3454
            # Error occurred in the first compile.  Let's try to salvage
 
3455
            # the situation: Compile a separate program for each library.
 
3456
            for i in $deplibs; do
 
3457
              name=`expr $i : '-l\(.*\)'`
 
3458
              # If $name is empty we are operating on a -L argument.
 
3459
              if test "$name" != "" && test "$name" != "0"; then
 
3460
                $rm conftest
 
3461
                $LTCC -o conftest conftest.c $i
 
3462
                # Did it work?
 
3463
                if test "$?" -eq 0 ; then
 
3464
                  ldd_output=`ldd conftest`
 
3465
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3466
                    case " $predeps $postdeps " in
 
3467
                    *" $i "*)
 
3468
                      newdeplibs="$newdeplibs $i"
 
3469
                      i=""
 
3470
                      ;;
 
3471
                    esac
 
3472
                  fi
 
3473
                  if test -n "$i" ; then
 
3474
                    libname=`eval \\$echo \"$libname_spec\"`
 
3475
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
3476
                    set dummy $deplib_matches
 
3477
                    deplib_match=$2
 
3478
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
3479
                      newdeplibs="$newdeplibs $i"
 
3480
                    else
 
3481
                      droppeddeps=yes
 
3482
                      $echo
 
3483
                      $echo "*** Warning: dynamic linker does not accept needed library $i."
 
3484
                      $echo "*** I have the capability to make that library automatically link in when"
 
3485
                      $echo "*** you link to this library.  But I can only do this if you have a"
 
3486
                      $echo "*** shared version of the library, which you do not appear to have"
 
3487
                      $echo "*** because a test_compile did reveal that the linker did not use this one"
 
3488
                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 
3489
                    fi
2570
3490
                  fi
2571
3491
                else
2572
3492
                  droppeddeps=yes
2573
 
                  echo
2574
 
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2575
 
                  echo "***  make it link in!  You will probably need to install it or some"
2576
 
                  echo "*** library that it depends on before this library will be fully"
2577
 
                  echo "*** functional.  Installing it before continuing would be even better."
 
3493
                  $echo
 
3494
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
3495
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3496
                  $echo "*** library that it depends on before this library will be fully"
 
3497
                  $echo "*** functional.  Installing it before continuing would be even better."
2578
3498
                fi
2579
3499
              else
2580
3500
                newdeplibs="$newdeplibs $i"
2586
3506
          set dummy $deplibs_check_method
2587
3507
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2588
3508
          for a_deplib in $deplibs; do
2589
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3509
            name=`expr $a_deplib : '-l\(.*\)'`
2590
3510
            # If $name is empty we are operating on a -L argument.
2591
 
            if test -n "$name" && test "$name" != "0"; then
2592
 
              libname=`eval \\$echo \"$libname_spec\"`
2593
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2594
 
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2595
 
                    for potent_lib in $potential_libs; do
 
3511
            if test "$name" != "" && test  "$name" != "0"; then
 
3512
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3513
                case " $predeps $postdeps " in
 
3514
                *" $a_deplib "*)
 
3515
                  newdeplibs="$newdeplibs $a_deplib"
 
3516
                  a_deplib=""
 
3517
                  ;;
 
3518
                esac
 
3519
              fi
 
3520
              if test -n "$a_deplib" ; then
 
3521
                libname=`eval \\$echo \"$libname_spec\"`
 
3522
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3523
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3524
                  for potent_lib in $potential_libs; do
2596
3525
                      # Follow soft links.
2597
3526
                      if ls -lLd "$potent_lib" 2>/dev/null \
2598
3527
                         | grep " -> " >/dev/null; then
2613
3542
                      done
2614
3543
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2615
3544
                         | ${SED} 10q \
2616
 
                         | egrep "$file_magic_regex" > /dev/null; then
 
3545
                         | $EGREP "$file_magic_regex" > /dev/null; then
2617
3546
                        newdeplibs="$newdeplibs $a_deplib"
2618
3547
                        a_deplib=""
2619
3548
                        break 2
2620
3549
                      fi
2621
 
                    done
2622
 
              done
 
3550
                  done
 
3551
                done
 
3552
              fi
2623
3553
              if test -n "$a_deplib" ; then
2624
3554
                droppeddeps=yes
2625
 
                echo
2626
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2627
 
                echo "*** I have the capability to make that library automatically link in when"
2628
 
                echo "*** you link to this library.  But I can only do this if you have a"
2629
 
                echo "*** shared version of the library, which you do not appear to have"
2630
 
                echo "*** because I did check the linker path looking for a file starting"
 
3555
                $echo
 
3556
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3557
                $echo "*** I have the capability to make that library automatically link in when"
 
3558
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3559
                $echo "*** shared version of the library, which you do not appear to have"
 
3560
                $echo "*** because I did check the linker path looking for a file starting"
2631
3561
                if test -z "$potlib" ; then
2632
 
                  echo "*** with $libname but no candidates were found. (...for file magic test)"
 
3562
                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
2633
3563
                else
2634
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2635
 
                  echo "*** using a file magic. Last file checked: $potlib"
 
3564
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3565
                  $echo "*** using a file magic. Last file checked: $potlib"
2636
3566
                fi
2637
3567
              fi
2638
3568
            else
2645
3575
          set dummy $deplibs_check_method
2646
3576
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2647
3577
          for a_deplib in $deplibs; do
2648
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3578
            name=`expr $a_deplib : '-l\(.*\)'`
2649
3579
            # If $name is empty we are operating on a -L argument.
2650
3580
            if test -n "$name" && test "$name" != "0"; then
2651
 
              libname=`eval \\$echo \"$libname_spec\"`
2652
 
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2653
 
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2654
 
                for potent_lib in $potential_libs; do
2655
 
                  potlib="$potent_lib" # see symlink-check below in file_magic test
2656
 
                  if eval echo \"$potent_lib\" 2>/dev/null \
2657
 
                      | ${SED} 10q \
2658
 
                      | egrep "$match_pattern_regex" > /dev/null; then
2659
 
                    newdeplibs="$newdeplibs $a_deplib"
2660
 
                    a_deplib=""
2661
 
                    break 2
2662
 
                  fi
 
3581
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3582
                case " $predeps $postdeps " in
 
3583
                *" $a_deplib "*)
 
3584
                  newdeplibs="$newdeplibs $a_deplib"
 
3585
                  a_deplib=""
 
3586
                  ;;
 
3587
                esac
 
3588
              fi
 
3589
              if test -n "$a_deplib" ; then
 
3590
                libname=`eval \\$echo \"$libname_spec\"`
 
3591
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
3592
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
3593
                  for potent_lib in $potential_libs; do
 
3594
                    potlib="$potent_lib" # see symlink-check above in file_magic test
 
3595
                    if eval $echo \"$potent_lib\" 2>/dev/null \
 
3596
                        | ${SED} 10q \
 
3597
                        | $EGREP "$match_pattern_regex" > /dev/null; then
 
3598
                      newdeplibs="$newdeplibs $a_deplib"
 
3599
                      a_deplib=""
 
3600
                      break 2
 
3601
                    fi
 
3602
                  done
2663
3603
                done
2664
 
              done
 
3604
              fi
2665
3605
              if test -n "$a_deplib" ; then
2666
3606
                droppeddeps=yes
2667
 
                echo
2668
 
                echo "*** Warning: linker path does not have real file for library $a_deplib."
2669
 
                echo "*** I have the capability to make that library automatically link in when"
2670
 
                echo "*** you link to this library.  But I can only do this if you have a"
2671
 
                echo "*** shared version of the library, which you do not appear to have"
2672
 
                echo "*** because I did check the linker path looking for a file starting"
 
3607
                $echo
 
3608
                $echo "*** Warning: linker path does not have real file for library $a_deplib."
 
3609
                $echo "*** I have the capability to make that library automatically link in when"
 
3610
                $echo "*** you link to this library.  But I can only do this if you have a"
 
3611
                $echo "*** shared version of the library, which you do not appear to have"
 
3612
                $echo "*** because I did check the linker path looking for a file starting"
2673
3613
                if test -z "$potlib" ; then
2674
 
                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
 
3614
                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2675
3615
                else
2676
 
                  echo "*** with $libname and none of the candidates passed a file format test"
2677
 
                  echo "*** using a regex pattern. Last file checked: $potlib"
 
3616
                  $echo "*** with $libname and none of the candidates passed a file format test"
 
3617
                  $echo "*** using a regex pattern. Last file checked: $potlib"
2678
3618
                fi
2679
3619
              fi
2680
3620
            else
2685
3625
          ;;
2686
3626
        none | unknown | *)
2687
3627
          newdeplibs=""
2688
 
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2689
 
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2690
 
             grep . >/dev/null; then
2691
 
            echo
 
3628
          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
3629
            -e 's/ -[LR][^ ]*//g'`
 
3630
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 
3631
            for i in $predeps $postdeps ; do
 
3632
              # can't use Xsed below, because $i might contain '/'
 
3633
              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
 
3634
            done
 
3635
          fi
 
3636
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
 
3637
            | grep . >/dev/null; then
 
3638
            $echo
2692
3639
            if test "X$deplibs_check_method" = "Xnone"; then
2693
 
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
3640
              $echo "*** Warning: inter-library dependencies are not supported in this platform."
2694
3641
            else
2695
 
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
3642
              $echo "*** Warning: inter-library dependencies are not known to be supported."
2696
3643
            fi
2697
 
            echo "*** All declared inter-library dependencies are being dropped."
 
3644
            $echo "*** All declared inter-library dependencies are being dropped."
2698
3645
            droppeddeps=yes
2699
3646
          fi
2700
3647
          ;;
2714
3661
 
2715
3662
        if test "$droppeddeps" = yes; then
2716
3663
          if test "$module" = yes; then
2717
 
            echo
2718
 
            echo "*** Warning: libtool could not satisfy all declared inter-library"
2719
 
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2720
 
            echo "*** a static module, that should work as long as the dlopening"
2721
 
            echo "*** application is linked with the -dlopen flag."
 
3664
            $echo
 
3665
            $echo "*** Warning: libtool could not satisfy all declared inter-library"
 
3666
            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
3667
            $echo "*** a static module, that should work as long as the dlopening"
 
3668
            $echo "*** application is linked with the -dlopen flag."
2722
3669
            if test -z "$global_symbol_pipe"; then
2723
 
              echo
2724
 
              echo "*** However, this would only work if libtool was able to extract symbol"
2725
 
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2726
 
              echo "*** not find such a program.  So, this module is probably useless."
2727
 
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
3670
              $echo
 
3671
              $echo "*** However, this would only work if libtool was able to extract symbol"
 
3672
              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
3673
              $echo "*** not find such a program.  So, this module is probably useless."
 
3674
              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2728
3675
            fi
2729
3676
            if test "$build_old_libs" = no; then
2730
3677
              oldlibs="$output_objdir/$libname.$libext"
2734
3681
              build_libtool_libs=no
2735
3682
            fi
2736
3683
          else
2737
 
            echo "*** The inter-library dependencies that have been dropped here will be"
2738
 
            echo "*** automatically added whenever a program is linked with this library"
2739
 
            echo "*** or is declared to -dlopen it."
 
3684
            $echo "*** The inter-library dependencies that have been dropped here will be"
 
3685
            $echo "*** automatically added whenever a program is linked with this library"
 
3686
            $echo "*** or is declared to -dlopen it."
2740
3687
 
2741
 
            if test $allow_undefined = no; then
2742
 
              echo
2743
 
              echo "*** Since this library must not contain undefined symbols,"
2744
 
              echo "*** because either the platform does not support them or"
2745
 
              echo "*** it was explicitly requested with -no-undefined,"
2746
 
              echo "*** libtool will only create a static version of it."
 
3688
            if test "$allow_undefined" = no; then
 
3689
              $echo
 
3690
              $echo "*** Since this library must not contain undefined symbols,"
 
3691
              $echo "*** because either the platform does not support them or"
 
3692
              $echo "*** it was explicitly requested with -no-undefined,"
 
3693
              $echo "*** libtool will only create a static version of it."
2747
3694
              if test "$build_old_libs" = no; then
2748
3695
                oldlibs="$output_objdir/$libname.$libext"
2749
3696
                build_libtool_libs=module
2765
3712
 
2766
3713
      # Test again, we may have decided not to build it any more
2767
3714
      if test "$build_libtool_libs" = yes; then
2768
 
        if test $hardcode_into_libs = yes; then
 
3715
        if test "$hardcode_into_libs" = yes; then
2769
3716
          # Hardcode the library paths
2770
3717
          hardcode_libdirs=
2771
3718
          dep_rpath=
2801
3748
          if test -n "$hardcode_libdir_separator" &&
2802
3749
             test -n "$hardcode_libdirs"; then
2803
3750
            libdir="$hardcode_libdirs"
2804
 
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3751
            if test -n "$hardcode_libdir_flag_spec_ld"; then
 
3752
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3753
            else
 
3754
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
3755
            fi
2805
3756
          fi
2806
3757
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2807
3758
            # We should set the runpath_var.
2821
3772
        fi
2822
3773
 
2823
3774
        # Get the real and link names of the library.
 
3775
        eval shared_ext=\"$shrext_cmds\"
2824
3776
        eval library_names=\"$library_names_spec\"
2825
3777
        set dummy $library_names
2826
3778
        realname="$2"
2831
3783
        else
2832
3784
          soname="$realname"
2833
3785
        fi
2834
 
        test -z "$dlname" && dlname=$soname
 
3786
        if test -z "$dlname"; then
 
3787
          dlname=$soname
 
3788
        fi
2835
3789
 
2836
3790
        lib="$output_objdir/$realname"
2837
3791
        for link
2839
3793
          linknames="$linknames $link"
2840
3794
        done
2841
3795
 
2842
 
        # Ensure that we have .o objects for linkers which dislike .lo
2843
 
        # (e.g. aix) in case we are running --disable-static
2844
 
        for obj in $libobjs; do
2845
 
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2846
 
          if test "X$xdir" = "X$obj"; then
2847
 
            xdir="."
2848
 
          else
2849
 
            xdir="$xdir"
2850
 
          fi
2851
 
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2852
 
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2853
 
          if test ! -f $xdir/$oldobj; then
2854
 
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2855
 
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2856
 
          fi
2857
 
        done
2858
 
 
2859
3796
        # Use standard objects if they are pic
2860
3797
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2861
3798
 
2865
3802
            $show "generating symbol list for \`$libname.la'"
2866
3803
            export_symbols="$output_objdir/$libname.exp"
2867
3804
            $run $rm $export_symbols
2868
 
            eval cmds=\"$export_symbols_cmds\"
 
3805
            cmds=$export_symbols_cmds
2869
3806
            save_ifs="$IFS"; IFS='~'
2870
3807
            for cmd in $cmds; do
2871
3808
              IFS="$save_ifs"
2872
 
              $show "$cmd"
2873
 
              $run eval "$cmd" || exit $?
 
3809
              eval cmd=\"$cmd\"
 
3810
              if len=`expr "X$cmd" : ".*"` &&
 
3811
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3812
                $show "$cmd"
 
3813
                $run eval "$cmd" || exit $?
 
3814
                skipped_export=false
 
3815
              else
 
3816
                # The command line is too long to execute in one step.
 
3817
                $show "using reloadable object file for export list..."
 
3818
                skipped_export=:
 
3819
                # Break out early, otherwise skipped_export may be
 
3820
                # set to false by a later but shorter cmd.
 
3821
                break
 
3822
              fi
2874
3823
            done
2875
3824
            IFS="$save_ifs"
2876
3825
            if test -n "$export_symbols_regex"; then
2877
 
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2878
 
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
3826
              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
3827
              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2879
3828
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2880
3829
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2881
3830
            fi
2886
3835
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2887
3836
        fi
2888
3837
 
 
3838
        tmp_deplibs=
 
3839
        for test_deplib in $deplibs; do
 
3840
                case " $convenience " in
 
3841
                *" $test_deplib "*) ;;
 
3842
                *)
 
3843
                        tmp_deplibs="$tmp_deplibs $test_deplib"
 
3844
                        ;;
 
3845
                esac
 
3846
        done
 
3847
        deplibs="$tmp_deplibs"
 
3848
 
2889
3849
        if test -n "$convenience"; then
2890
3850
          if test -n "$whole_archive_flag_spec"; then
 
3851
            save_libobjs=$libobjs
2891
3852
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2892
3853
          else
2893
3854
            gentop="$output_objdir/${outputname}x"
2894
 
            $show "${rm}r $gentop"
2895
 
            $run ${rm}r "$gentop"
2896
 
            $show "mkdir $gentop"
2897
 
            $run mkdir "$gentop"
2898
 
            status=$?
2899
 
            if test $status -ne 0 && test ! -d "$gentop"; then
2900
 
              exit $status
2901
 
            fi
2902
3855
            generated="$generated $gentop"
2903
3856
 
2904
 
            for xlib in $convenience; do
2905
 
              # Extract the objects.
2906
 
              case $xlib in
2907
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2908
 
              *) xabs=`pwd`"/$xlib" ;;
2909
 
              esac
2910
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2911
 
              xdir="$gentop/$xlib"
2912
 
 
2913
 
              $show "${rm}r $xdir"
2914
 
              $run ${rm}r "$xdir"
2915
 
              $show "mkdir $xdir"
2916
 
              $run mkdir "$xdir"
2917
 
              status=$?
2918
 
              if test $status -ne 0 && test ! -d "$xdir"; then
2919
 
                exit $status
2920
 
              fi
2921
 
              $show "(cd $xdir && $AR x $xabs)"
2922
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2923
 
 
2924
 
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2925
 
            done
 
3857
            func_extract_archives $gentop $convenience
 
3858
            libobjs="$libobjs $func_extract_archives_result"
2926
3859
          fi
2927
3860
        fi
2928
 
 
 
3861
        
2929
3862
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2930
3863
          eval flag=\"$thread_safe_flag_spec\"
2931
3864
          linker_flags="$linker_flags $flag"
2937
3870
        fi
2938
3871
 
2939
3872
        # Do each of the archive commands.
 
3873
        if test "$module" = yes && test -n "$module_cmds" ; then
 
3874
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3875
            eval test_cmds=\"$module_expsym_cmds\"
 
3876
            cmds=$module_expsym_cmds
 
3877
          else
 
3878
            eval test_cmds=\"$module_cmds\"
 
3879
            cmds=$module_cmds
 
3880
          fi
 
3881
        else
2940
3882
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2941
 
          eval cmds=\"$archive_expsym_cmds\"
2942
 
        else
2943
 
          save_deplibs="$deplibs"
2944
 
          for conv in $convenience; do
2945
 
            tmp_deplibs=
2946
 
            for test_deplib in $deplibs; do
2947
 
              if test "$test_deplib" != "$conv"; then
2948
 
                tmp_deplibs="$tmp_deplibs $test_deplib"
 
3883
          eval test_cmds=\"$archive_expsym_cmds\"
 
3884
          cmds=$archive_expsym_cmds
 
3885
        else
 
3886
          eval test_cmds=\"$archive_cmds\"
 
3887
          cmds=$archive_cmds
 
3888
          fi
 
3889
        fi
 
3890
 
 
3891
        if test "X$skipped_export" != "X:" &&
 
3892
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
3893
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
3894
          :
 
3895
        else
 
3896
          # The command line is too long to link in one step, link piecewise.
 
3897
          $echo "creating reloadable object files..."
 
3898
 
 
3899
          # Save the value of $output and $libobjs because we want to
 
3900
          # use them later.  If we have whole_archive_flag_spec, we
 
3901
          # want to use save_libobjs as it was before
 
3902
          # whole_archive_flag_spec was expanded, because we can't
 
3903
          # assume the linker understands whole_archive_flag_spec.
 
3904
          # This may have to be revisited, in case too many
 
3905
          # convenience libraries get linked in and end up exceeding
 
3906
          # the spec.
 
3907
          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
 
3908
            save_libobjs=$libobjs
 
3909
          fi
 
3910
          save_output=$output
 
3911
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
 
3912
 
 
3913
          # Clear the reloadable object creation command queue and
 
3914
          # initialize k to one.
 
3915
          test_cmds=
 
3916
          concat_cmds=
 
3917
          objlist=
 
3918
          delfiles=
 
3919
          last_robj=
 
3920
          k=1
 
3921
          output=$output_objdir/$output_la-${k}.$objext
 
3922
          # Loop over the list of objects to be linked.
 
3923
          for obj in $save_libobjs
 
3924
          do
 
3925
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
 
3926
            if test "X$objlist" = X ||
 
3927
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
3928
                 test "$len" -le "$max_cmd_len"; }; then
 
3929
              objlist="$objlist $obj"
 
3930
            else
 
3931
              # The command $test_cmds is almost too long, add a
 
3932
              # command to the queue.
 
3933
              if test "$k" -eq 1 ; then
 
3934
                # The first file doesn't have a previous command to add.
 
3935
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 
3936
              else
 
3937
                # All subsequent reloadable object files will link in
 
3938
                # the last one created.
 
3939
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
2949
3940
              fi
2950
 
            done
2951
 
            deplibs="$tmp_deplibs"
2952
 
          done
2953
 
          eval cmds=\"$archive_cmds\"
2954
 
          deplibs="$save_deplibs"
 
3941
              last_robj=$output_objdir/$output_la-${k}.$objext
 
3942
              k=`expr $k + 1`
 
3943
              output=$output_objdir/$output_la-${k}.$objext
 
3944
              objlist=$obj
 
3945
              len=1
 
3946
            fi
 
3947
          done
 
3948
          # Handle the remaining objects by creating one last
 
3949
          # reloadable object file.  All subsequent reloadable object
 
3950
          # files will link in the last one created.
 
3951
          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
3952
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 
3953
 
 
3954
          if ${skipped_export-false}; then
 
3955
            $show "generating symbol list for \`$libname.la'"
 
3956
            export_symbols="$output_objdir/$libname.exp"
 
3957
            $run $rm $export_symbols
 
3958
            libobjs=$output
 
3959
            # Append the command to create the export file.
 
3960
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
 
3961
          fi
 
3962
 
 
3963
          # Set up a command to remove the reloadable object files
 
3964
          # after they are used.
 
3965
          i=0
 
3966
          while test "$i" -lt "$k"
 
3967
          do
 
3968
            i=`expr $i + 1`
 
3969
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
 
3970
          done
 
3971
 
 
3972
          $echo "creating a temporary reloadable object file: $output"
 
3973
 
 
3974
          # Loop through the commands generated above and execute them.
 
3975
          save_ifs="$IFS"; IFS='~'
 
3976
          for cmd in $concat_cmds; do
 
3977
            IFS="$save_ifs"
 
3978
            $show "$cmd"
 
3979
            $run eval "$cmd" || exit $?
 
3980
          done
 
3981
          IFS="$save_ifs"
 
3982
 
 
3983
          libobjs=$output
 
3984
          # Restore the value of output.
 
3985
          output=$save_output
 
3986
 
 
3987
          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
 
3988
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
3989
          fi
 
3990
          # Expand the library linking commands again to reset the
 
3991
          # value of $libobjs for piecewise linking.
 
3992
 
 
3993
          # Do each of the archive commands.
 
3994
          if test "$module" = yes && test -n "$module_cmds" ; then
 
3995
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
3996
              cmds=$module_expsym_cmds
 
3997
            else
 
3998
              cmds=$module_cmds
 
3999
            fi
 
4000
          else
 
4001
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
4002
            cmds=$archive_expsym_cmds
 
4003
          else
 
4004
            cmds=$archive_cmds
 
4005
            fi
 
4006
          fi
 
4007
 
 
4008
          # Append the command to remove the reloadable object files
 
4009
          # to the just-reset $cmds.
 
4010
          eval cmds=\"\$cmds~\$rm $delfiles\"
2955
4011
        fi
2956
4012
        save_ifs="$IFS"; IFS='~'
2957
4013
        for cmd in $cmds; do
2958
4014
          IFS="$save_ifs"
 
4015
          eval cmd=\"$cmd\"
2959
4016
          $show "$cmd"
2960
 
          $run eval "$cmd" || exit $?
 
4017
          $run eval "$cmd" || {
 
4018
            lt_exit=$?
 
4019
 
 
4020
            # Restore the uninstalled library and exit
 
4021
            if test "$mode" = relink; then
 
4022
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4023
            fi
 
4024
 
 
4025
            exit $lt_exit
 
4026
          }
2961
4027
        done
2962
4028
        IFS="$save_ifs"
2963
4029
 
2964
4030
        # Restore the uninstalled library and exit
2965
4031
        if test "$mode" = relink; then
2966
4032
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2967
 
          exit 0
 
4033
 
 
4034
          if test -n "$convenience"; then
 
4035
            if test -z "$whole_archive_flag_spec"; then
 
4036
              $show "${rm}r $gentop"
 
4037
              $run ${rm}r "$gentop"
 
4038
            fi
 
4039
          fi
 
4040
 
 
4041
          exit $EXIT_SUCCESS
2968
4042
        fi
2969
4043
 
2970
4044
        # Create links to the real library.
3012
4086
      *.lo)
3013
4087
        if test -n "$objs$old_deplibs"; then
3014
4088
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3015
 
          exit 1
 
4089
          exit $EXIT_FAILURE
3016
4090
        fi
3017
4091
        libobj="$output"
3018
4092
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3041
4115
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3042
4116
        else
3043
4117
          gentop="$output_objdir/${obj}x"
3044
 
          $show "${rm}r $gentop"
3045
 
          $run ${rm}r "$gentop"
3046
 
          $show "mkdir $gentop"
3047
 
          $run mkdir "$gentop"
3048
 
          status=$?
3049
 
          if test $status -ne 0 && test ! -d "$gentop"; then
3050
 
            exit $status
3051
 
          fi
3052
4118
          generated="$generated $gentop"
3053
4119
 
3054
 
          for xlib in $convenience; do
3055
 
            # Extract the objects.
3056
 
            case $xlib in
3057
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3058
 
            *) xabs=`pwd`"/$xlib" ;;
3059
 
            esac
3060
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3061
 
            xdir="$gentop/$xlib"
3062
 
 
3063
 
            $show "${rm}r $xdir"
3064
 
            $run ${rm}r "$xdir"
3065
 
            $show "mkdir $xdir"
3066
 
            $run mkdir "$xdir"
3067
 
            status=$?
3068
 
            if test $status -ne 0 && test ! -d "$xdir"; then
3069
 
              exit $status
3070
 
            fi
3071
 
            $show "(cd $xdir && $AR x $xabs)"
3072
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3073
 
 
3074
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3075
 
          done
 
4120
          func_extract_archives $gentop $convenience
 
4121
          reload_conv_objs="$reload_objs $func_extract_archives_result"
3076
4122
        fi
3077
4123
      fi
3078
4124
 
3080
4126
      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
3081
4127
 
3082
4128
      output="$obj"
3083
 
      eval cmds=\"$reload_cmds\"
 
4129
      cmds=$reload_cmds
3084
4130
      save_ifs="$IFS"; IFS='~'
3085
4131
      for cmd in $cmds; do
3086
4132
        IFS="$save_ifs"
 
4133
        eval cmd=\"$cmd\"
3087
4134
        $show "$cmd"
3088
4135
        $run eval "$cmd" || exit $?
3089
4136
      done
3096
4143
          $run ${rm}r $gentop
3097
4144
        fi
3098
4145
 
3099
 
        exit 0
 
4146
        exit $EXIT_SUCCESS
3100
4147
      fi
3101
4148
 
3102
4149
      if test "$build_libtool_libs" != yes; then
3107
4154
 
3108
4155
        # Create an invalid libtool object if no PIC, so that we don't
3109
4156
        # accidentally link it into a program.
3110
 
        $show "echo timestamp > $libobj"
3111
 
        $run eval "echo timestamp > $libobj" || exit $?
3112
 
        exit 0
 
4157
        # $show "echo timestamp > $libobj"
 
4158
        # $run eval "echo timestamp > $libobj" || exit $?
 
4159
        exit $EXIT_SUCCESS
3113
4160
      fi
3114
4161
 
3115
4162
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3116
4163
        # Only do commands if we really have different PIC objects.
3117
4164
        reload_objs="$libobjs $reload_conv_objs"
3118
4165
        output="$libobj"
3119
 
        eval cmds=\"$reload_cmds\"
 
4166
        cmds=$reload_cmds
3120
4167
        save_ifs="$IFS"; IFS='~'
3121
4168
        for cmd in $cmds; do
3122
4169
          IFS="$save_ifs"
 
4170
          eval cmd=\"$cmd\"
3123
4171
          $show "$cmd"
3124
4172
          $run eval "$cmd" || exit $?
3125
4173
        done
3126
4174
        IFS="$save_ifs"
3127
 
      else
3128
 
        # Just create a symlink.
3129
 
        $show $rm $libobj
3130
 
        $run $rm $libobj
3131
 
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3132
 
        if test "X$xdir" = "X$libobj"; then
3133
 
          xdir="."
3134
 
        else
3135
 
          xdir="$xdir"
3136
 
        fi
3137
 
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3138
 
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3139
 
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3140
 
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3141
4175
      fi
3142
4176
 
3143
4177
      if test -n "$gentop"; then
3145
4179
        $run ${rm}r $gentop
3146
4180
      fi
3147
4181
 
3148
 
      exit 0
 
4182
      exit $EXIT_SUCCESS
3149
4183
      ;;
3150
4184
 
3151
4185
    prog)
3152
4186
      case $host in
3153
 
        *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
 
4187
        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3154
4188
      esac
3155
4189
      if test -n "$vinfo"; then
3156
4190
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3172
4206
        # On Rhapsody replace the C library is the System framework
3173
4207
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3174
4208
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3175
 
        case $host in
3176
 
        *darwin*)
3177
 
          # Don't allow lazy linking, it breaks C++ global constructors
3178
 
          compile_command="$compile_command ${wl}-bind_at_load"
3179
 
          finalize_command="$finalize_command ${wl}-bind_at_load"
3180
 
          ;;
3181
 
        esac
3182
4209
        ;;
3183
4210
      esac
3184
4211
 
 
4212
      case $host in
 
4213
      *darwin*)
 
4214
        # Don't allow lazy linking, it breaks C++ global constructors
 
4215
        if test "$tagname" = CXX ; then
 
4216
        compile_command="$compile_command ${wl}-bind_at_load"
 
4217
        finalize_command="$finalize_command ${wl}-bind_at_load"
 
4218
        fi
 
4219
        ;;
 
4220
      esac
 
4221
 
3185
4222
      compile_command="$compile_command $compile_deplibs"
3186
4223
      finalize_command="$finalize_command $finalize_deplibs"
3187
4224
 
3332
4369
            done
3333
4370
 
3334
4371
            if test -n "$exclude_expsyms"; then
3335
 
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
4372
              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3336
4373
              $run eval '$mv "$nlist"T "$nlist"'
3337
4374
            fi
3338
4375
 
3339
4376
            if test -n "$export_symbols_regex"; then
3340
 
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
4377
              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3341
4378
              $run eval '$mv "$nlist"T "$nlist"'
3342
4379
            fi
3343
4380
 
3344
4381
            # Prepare the list of exported symbols
3345
4382
            if test -z "$export_symbols"; then
3346
 
              export_symbols="$output_objdir/$output.exp"
 
4383
              export_symbols="$output_objdir/$outputname.exp"
3347
4384
              $run $rm $export_symbols
3348
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4385
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3349
4386
            else
3350
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3351
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4387
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4388
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
3352
4389
              $run eval 'mv "$nlist"T "$nlist"'
3353
4390
            fi
3354
4391
          fi
3355
4392
 
3356
4393
          for arg in $dlprefiles; do
3357
4394
            $show "extracting global C symbols from \`$arg'"
3358
 
            name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3359
 
            $run eval 'echo ": $name " >> "$nlist"'
 
4395
            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
 
4396
            $run eval '$echo ": $name " >> "$nlist"'
3360
4397
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3361
4398
          done
3362
4399
 
3365
4402
            test -f "$nlist" || : > "$nlist"
3366
4403
 
3367
4404
            if test -n "$exclude_expsyms"; then
3368
 
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
4405
              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3369
4406
              $mv "$nlist"T "$nlist"
3370
4407
            fi
3371
4408
 
3385
4422
            if test -f "$nlist"S; then
3386
4423
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3387
4424
            else
3388
 
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
4425
              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
3389
4426
            fi
3390
4427
 
3391
4428
            $echo >> "$output_objdir/$dlsyms" "\
3400
4437
#endif
3401
4438
 
3402
4439
/* The mapping between symbol names and symbols. */
 
4440
"
 
4441
 
 
4442
            case $host in
 
4443
            *cygwin* | *mingw* )
 
4444
          $echo >> "$output_objdir/$dlsyms" "\
 
4445
/* DATA imports from DLLs on WIN32 can't be const, because
 
4446
   runtime relocations are performed -- see ld's documentation
 
4447
   on pseudo-relocs */
 
4448
struct {
 
4449
"
 
4450
              ;;
 
4451
            * )
 
4452
          $echo >> "$output_objdir/$dlsyms" "\
3403
4453
const struct {
 
4454
"
 
4455
              ;;
 
4456
            esac
 
4457
 
 
4458
 
 
4459
          $echo >> "$output_objdir/$dlsyms" "\
3404
4460
  const char *name;
3405
4461
  lt_ptr address;
3406
4462
}
3437
4493
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3438
4494
            case "$compile_command " in
3439
4495
            *" -static "*) ;;
3440
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
4496
            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3441
4497
            esac;;
3442
4498
          *-*-hpux*)
3443
4499
            case "$compile_command " in
3444
4500
            *" -static "*) ;;
3445
 
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
4501
            *) pic_flag_for_symtable=" $pic_flag";;
3446
4502
            esac
3447
4503
          esac
3448
4504
 
3449
4505
          # Now compile the dynamic symbol file.
3450
 
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3451
 
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4506
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4507
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3452
4508
 
3453
4509
          # Clean up the generated files.
3454
4510
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3460
4516
          ;;
3461
4517
        *)
3462
4518
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3463
 
          exit 1
 
4519
          exit $EXIT_FAILURE
3464
4520
          ;;
3465
4521
        esac
3466
4522
      else
3473
4529
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3474
4530
      fi
3475
4531
 
3476
 
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
4532
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3477
4533
        # Replace the output file specification.
3478
4534
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3479
4535
        link_command="$compile_command$compile_rpath"
3548
4604
        # Link the executable and exit
3549
4605
        $show "$link_command"
3550
4606
        $run eval "$link_command" || exit $?
3551
 
        exit 0
 
4607
        exit $EXIT_SUCCESS
3552
4608
      fi
3553
4609
 
3554
4610
      if test "$hardcode_action" = relink; then
3603
4659
      fi
3604
4660
 
3605
4661
      # Quote $echo for shipping.
3606
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3607
 
        case $0 in
3608
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3609
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4662
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4663
        case $progpath in
 
4664
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4665
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
3610
4666
        esac
3611
4667
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3612
4668
      else
3618
4674
        # win32 will think the script is a binary if it has
3619
4675
        # a .exe suffix, so we strip it off here.
3620
4676
        case $output in
3621
 
          *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
 
4677
          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
3622
4678
        esac
3623
4679
        # test for cygwin because mv fails w/o .exe extensions
3624
4680
        case $host in
3625
 
          *cygwin*) exeext=.exe ;;
 
4681
          *cygwin*)
 
4682
            exeext=.exe
 
4683
            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
3626
4684
          *) exeext= ;;
3627
4685
        esac
 
4686
        case $host in
 
4687
          *cygwin* | *mingw* )
 
4688
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
 
4689
            cwrapper=`$echo ${output}.exe`
 
4690
            $rm $cwrappersource $cwrapper
 
4691
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4692
 
 
4693
            cat > $cwrappersource <<EOF
 
4694
 
 
4695
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
 
4696
   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
4697
 
 
4698
   The $output program cannot be directly executed until all the libtool
 
4699
   libraries that it depends on are installed.
 
4700
 
 
4701
   This wrapper executable should never be moved out of the build directory.
 
4702
   If it is, it will not operate correctly.
 
4703
 
 
4704
   Currently, it simply execs the wrapper *script* "/bin/sh $output",
 
4705
   but could eventually absorb all of the scripts functionality and
 
4706
   exec $objdir/$outputname directly.
 
4707
*/
 
4708
EOF
 
4709
            cat >> $cwrappersource<<"EOF"
 
4710
#include <stdio.h>
 
4711
#include <stdlib.h>
 
4712
#include <unistd.h>
 
4713
#include <malloc.h>
 
4714
#include <stdarg.h>
 
4715
#include <assert.h>
 
4716
 
 
4717
#if defined(PATH_MAX)
 
4718
# define LT_PATHMAX PATH_MAX
 
4719
#elif defined(MAXPATHLEN)
 
4720
# define LT_PATHMAX MAXPATHLEN
 
4721
#else
 
4722
# define LT_PATHMAX 1024
 
4723
#endif
 
4724
 
 
4725
#ifndef DIR_SEPARATOR
 
4726
#define DIR_SEPARATOR '/'
 
4727
#endif
 
4728
 
 
4729
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
 
4730
  defined (__OS2__)
 
4731
#define HAVE_DOS_BASED_FILE_SYSTEM
 
4732
#ifndef DIR_SEPARATOR_2
 
4733
#define DIR_SEPARATOR_2 '\\'
 
4734
#endif
 
4735
#endif
 
4736
 
 
4737
#ifndef DIR_SEPARATOR_2
 
4738
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
 
4739
#else /* DIR_SEPARATOR_2 */
 
4740
# define IS_DIR_SEPARATOR(ch) \
 
4741
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
 
4742
#endif /* DIR_SEPARATOR_2 */
 
4743
 
 
4744
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 
4745
#define XFREE(stale) do { \
 
4746
  if (stale) { free ((void *) stale); stale = 0; } \
 
4747
} while (0)
 
4748
 
 
4749
const char *program_name = NULL;
 
4750
 
 
4751
void * xmalloc (size_t num);
 
4752
char * xstrdup (const char *string);
 
4753
char * basename (const char *name);
 
4754
char * fnqualify(const char *path);
 
4755
char * strendzap(char *str, const char *pat);
 
4756
void lt_fatal (const char *message, ...);
 
4757
 
 
4758
int
 
4759
main (int argc, char *argv[])
 
4760
{
 
4761
  char **newargz;
 
4762
  int i;
 
4763
 
 
4764
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4765
  newargz = XMALLOC(char *, argc+2);
 
4766
EOF
 
4767
 
 
4768
            cat >> $cwrappersource <<EOF
 
4769
  newargz[0] = "$SHELL";
 
4770
EOF
 
4771
 
 
4772
            cat >> $cwrappersource <<"EOF"
 
4773
  newargz[1] = fnqualify(argv[0]);
 
4774
  /* we know the script has the same name, without the .exe */
 
4775
  /* so make sure newargz[1] doesn't end in .exe */
 
4776
  strendzap(newargz[1],".exe");
 
4777
  for (i = 1; i < argc; i++)
 
4778
    newargz[i+1] = xstrdup(argv[i]);
 
4779
  newargz[argc+1] = NULL;
 
4780
EOF
 
4781
 
 
4782
            cat >> $cwrappersource <<EOF
 
4783
  execv("$SHELL",newargz);
 
4784
EOF
 
4785
 
 
4786
            cat >> $cwrappersource <<"EOF"
 
4787
  return 127;
 
4788
}
 
4789
 
 
4790
void *
 
4791
xmalloc (size_t num)
 
4792
{
 
4793
  void * p = (void *) malloc (num);
 
4794
  if (!p)
 
4795
    lt_fatal ("Memory exhausted");
 
4796
 
 
4797
  return p;
 
4798
}
 
4799
 
 
4800
char *
 
4801
xstrdup (const char *string)
 
4802
{
 
4803
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
 
4804
;
 
4805
}
 
4806
 
 
4807
char *
 
4808
basename (const char *name)
 
4809
{
 
4810
  const char *base;
 
4811
 
 
4812
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4813
  /* Skip over the disk name in MSDOS pathnames. */
 
4814
  if (isalpha (name[0]) && name[1] == ':')
 
4815
    name += 2;
 
4816
#endif
 
4817
 
 
4818
  for (base = name; *name; name++)
 
4819
    if (IS_DIR_SEPARATOR (*name))
 
4820
      base = name + 1;
 
4821
  return (char *) base;
 
4822
}
 
4823
 
 
4824
char *
 
4825
fnqualify(const char *path)
 
4826
{
 
4827
  size_t size;
 
4828
  char *p;
 
4829
  char tmp[LT_PATHMAX + 1];
 
4830
 
 
4831
  assert(path != NULL);
 
4832
 
 
4833
  /* Is it qualified already? */
 
4834
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
4835
  if (isalpha (path[0]) && path[1] == ':')
 
4836
    return xstrdup (path);
 
4837
#endif
 
4838
  if (IS_DIR_SEPARATOR (path[0]))
 
4839
    return xstrdup (path);
 
4840
 
 
4841
  /* prepend the current directory */
 
4842
  /* doesn't handle '~' */
 
4843
  if (getcwd (tmp, LT_PATHMAX) == NULL)
 
4844
    lt_fatal ("getcwd failed");
 
4845
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
 
4846
  p = XMALLOC(char, size);
 
4847
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
 
4848
  return p;
 
4849
}
 
4850
 
 
4851
char *
 
4852
strendzap(char *str, const char *pat)
 
4853
{
 
4854
  size_t len, patlen;
 
4855
 
 
4856
  assert(str != NULL);
 
4857
  assert(pat != NULL);
 
4858
 
 
4859
  len = strlen(str);
 
4860
  patlen = strlen(pat);
 
4861
 
 
4862
  if (patlen <= len)
 
4863
  {
 
4864
    str += len - patlen;
 
4865
    if (strcmp(str, pat) == 0)
 
4866
      *str = '\0';
 
4867
  }
 
4868
  return str;
 
4869
}
 
4870
 
 
4871
static void
 
4872
lt_error_core (int exit_status, const char * mode,
 
4873
          const char * message, va_list ap)
 
4874
{
 
4875
  fprintf (stderr, "%s: %s: ", program_name, mode);
 
4876
  vfprintf (stderr, message, ap);
 
4877
  fprintf (stderr, ".\n");
 
4878
 
 
4879
  if (exit_status >= 0)
 
4880
    exit (exit_status);
 
4881
}
 
4882
 
 
4883
void
 
4884
lt_fatal (const char *message, ...)
 
4885
{
 
4886
  va_list ap;
 
4887
  va_start (ap, message);
 
4888
  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
 
4889
  va_end (ap);
 
4890
}
 
4891
EOF
 
4892
          # we should really use a build-platform specific compiler
 
4893
          # here, but OTOH, the wrappers (shell script and this C one)
 
4894
          # are only useful if you want to execute the "real" binary.
 
4895
          # Since the "real" binary is built for $host, then this
 
4896
          # wrapper might as well be built for $host, too.
 
4897
          $run $LTCC -s -o $cwrapper $cwrappersource
 
4898
          ;;
 
4899
        esac
3628
4900
        $rm $output
3629
 
        trap "$rm $output; exit 1" 1 2 15
 
4901
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
3630
4902
 
3631
4903
        $echo > $output "\
3632
4904
#! $SHELL
3642
4914
 
3643
4915
# Sed substitution that helps us do robust quoting.  It backslashifies
3644
4916
# metacharacters that are still active within double-quoted strings.
3645
 
Xsed="${SED}"' -e 1s/^X//'
 
4917
Xsed='${SED} -e 1s/^X//'
3646
4918
sed_quote_subst='$sed_quote_subst'
3647
4919
 
3648
4920
# The HP-UX ksh and POSIX shell print the target directory to stdout
3649
4921
# if CDPATH is set.
3650
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
4922
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
3651
4923
 
3652
4924
relink_command=\"$relink_command\"
3653
4925
 
3702
4974
"
3703
4975
 
3704
4976
        if test "$fast_install" = yes; then
3705
 
          echo >> $output "\
 
4977
          $echo >> $output "\
3706
4978
  program=lt-'$outputname'$exeext
3707
4979
  progdir=\"\$thisdir/$objdir\"
3708
4980
 
3718
4990
      $rm \"\$progdir/\$file\"
3719
4991
    fi"
3720
4992
 
3721
 
          echo >> $output "\
 
4993
          $echo >> $output "\
3722
4994
 
3723
4995
    # relink executable if necessary
3724
4996
    if test -n \"\$relink_command\"; then
3726
4998
      else
3727
4999
        $echo \"\$relink_command_output\" >&2
3728
5000
        $rm \"\$progdir/\$file\"
3729
 
        exit 1
 
5001
        exit $EXIT_FAILURE
3730
5002
      fi
3731
5003
    fi
3732
5004
 
3736
5008
    $rm \"\$progdir/\$file\"
3737
5009
  fi"
3738
5010
        else
3739
 
          echo >> $output "\
 
5011
          $echo >> $output "\
3740
5012
  program='$outputname'
3741
5013
  progdir=\"\$thisdir/$objdir\"
3742
5014
"
3743
5015
        fi
3744
5016
 
3745
 
        echo >> $output "\
 
5017
        $echo >> $output "\
3746
5018
 
3747
5019
  if test -f \"\$progdir/\$program\"; then"
3748
5020
 
3753
5025
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3754
5026
 
3755
5027
    # Some systems cannot cope with colon-terminated $shlibpath_var
3756
 
    # The second colon is a workaround for a bug in BeOS R4 ${SED}
 
5028
    # The second colon is a workaround for a bug in BeOS R4 sed
3757
5029
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3758
5030
 
3759
5031
    export $shlibpath_var
3773
5045
      # Run the actual program with our arguments.
3774
5046
"
3775
5047
        case $host in
3776
 
        # win32 systems need to use the prog path for dll
3777
 
        # lookup to work
3778
 
        *-*-cygwin* | *-*-pw32*)
3779
 
          $echo >> $output "\
3780
 
      exec \$progdir/\$program \${1+\"\$@\"}
3781
 
"
3782
 
          ;;
3783
 
 
3784
5048
        # Backslashes separate directories on plain windows
3785
5049
        *-*-mingw | *-*-os2*)
3786
5050
          $echo >> $output "\
3787
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5051
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
3788
5052
"
3789
5053
          ;;
3790
5054
 
3791
5055
        *)
3792
5056
          $echo >> $output "\
3793
 
      # Export the path to the program.
3794
 
      PATH=\"\$progdir:\$PATH\"
3795
 
      export PATH
3796
 
 
3797
 
      exec \$program \${1+\"\$@\"}
 
5057
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
3798
5058
"
3799
5059
          ;;
3800
5060
        esac
3801
5061
        $echo >> $output "\
3802
5062
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3803
 
      exit 1
 
5063
      exit $EXIT_FAILURE
3804
5064
    fi
3805
5065
  else
3806
5066
    # The program doesn't exist.
3807
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5067
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
3808
5068
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
3809
 
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
3810
 
    exit 1
 
5069
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
5070
    exit $EXIT_FAILURE
3811
5071
  fi
3812
5072
fi\
3813
5073
"
3814
5074
        chmod +x $output
3815
5075
      fi
3816
 
      exit 0
 
5076
      exit $EXIT_SUCCESS
3817
5077
      ;;
3818
5078
    esac
3819
5079
 
3829
5089
          oldobjs="$libobjs_save"
3830
5090
          build_libtool_libs=no
3831
5091
        else
3832
 
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
5092
          oldobjs="$old_deplibs $non_pic_objects"
3833
5093
        fi
3834
5094
        addlibs="$old_convenience"
3835
5095
      fi
3836
5096
 
3837
5097
      if test -n "$addlibs"; then
3838
5098
        gentop="$output_objdir/${outputname}x"
3839
 
        $show "${rm}r $gentop"
3840
 
        $run ${rm}r "$gentop"
3841
 
        $show "mkdir $gentop"
3842
 
        $run mkdir "$gentop"
3843
 
        status=$?
3844
 
        if test $status -ne 0 && test ! -d "$gentop"; then
3845
 
          exit $status
3846
 
        fi
3847
5099
        generated="$generated $gentop"
3848
5100
 
3849
 
        # Add in members from convenience archives.
3850
 
        for xlib in $addlibs; do
3851
 
          # Extract the objects.
3852
 
          case $xlib in
3853
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3854
 
          *) xabs=`pwd`"/$xlib" ;;
3855
 
          esac
3856
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3857
 
          xdir="$gentop/$xlib"
3858
 
 
3859
 
          $show "${rm}r $xdir"
3860
 
          $run ${rm}r "$xdir"
3861
 
          $show "mkdir $xdir"
3862
 
          $run mkdir "$xdir"
3863
 
          status=$?
3864
 
          if test $status -ne 0 && test ! -d "$xdir"; then
3865
 
            exit $status
3866
 
          fi
3867
 
          $show "(cd $xdir && $AR x $xabs)"
3868
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3869
 
 
3870
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3871
 
        done
 
5101
        func_extract_archives $gentop $addlibs
 
5102
        oldobjs="$oldobjs $func_extract_archives_result"
3872
5103
      fi
3873
5104
 
3874
5105
      # Do each command in the archive commands.
3875
5106
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3876
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5107
       cmds=$old_archive_from_new_cmds
3877
5108
      else
3878
 
        # Ensure that we have .o objects in place in case we decided
3879
 
        # not to build a shared library, and have fallen back to building
3880
 
        # static libs even though --disable-static was passed!
3881
 
        for oldobj in $oldobjs; do
3882
 
          if test ! -f $oldobj; then
3883
 
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3884
 
            if test "X$xdir" = "X$oldobj"; then
3885
 
              xdir="."
3886
 
            else
3887
 
              xdir="$xdir"
 
5109
        # POSIX demands no paths to be encoded in archives.  We have
 
5110
        # to avoid creating archives with duplicate basenames if we
 
5111
        # might have to extract them afterwards, e.g., when creating a
 
5112
        # static archive out of a convenience library, or when linking
 
5113
        # the entirety of a libtool archive into another (currently
 
5114
        # not supported by libtool).
 
5115
        if (for obj in $oldobjs
 
5116
            do
 
5117
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5118
            done | sort | sort -uc >/dev/null 2>&1); then
 
5119
          :
 
5120
        else
 
5121
          $echo "copying selected object files to avoid basename conflicts..."
 
5122
 
 
5123
          if test -z "$gentop"; then
 
5124
            gentop="$output_objdir/${outputname}x"
 
5125
            generated="$generated $gentop"
 
5126
 
 
5127
            $show "${rm}r $gentop"
 
5128
            $run ${rm}r "$gentop"
 
5129
            $show "$mkdir $gentop"
 
5130
            $run $mkdir "$gentop"
 
5131
            status=$?
 
5132
            if test "$status" -ne 0 && test ! -d "$gentop"; then
 
5133
              exit $status
3888
5134
            fi
3889
 
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3890
 
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3891
 
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3892
 
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3893
5135
          fi
3894
 
        done
 
5136
 
 
5137
          save_oldobjs=$oldobjs
 
5138
          oldobjs=
 
5139
          counter=1
 
5140
          for obj in $save_oldobjs
 
5141
          do
 
5142
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5143
            case " $oldobjs " in
 
5144
            " ") oldobjs=$obj ;;
 
5145
            *[\ /]"$objbase "*)
 
5146
              while :; do
 
5147
                # Make sure we don't pick an alternate name that also
 
5148
                # overlaps.
 
5149
                newobj=lt$counter-$objbase
 
5150
                counter=`expr $counter + 1`
 
5151
                case " $oldobjs " in
 
5152
                *[\ /]"$newobj "*) ;;
 
5153
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5154
                esac
 
5155
              done
 
5156
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5157
              $run ln "$obj" "$gentop/$newobj" ||
 
5158
              $run cp "$obj" "$gentop/$newobj"
 
5159
              oldobjs="$oldobjs $gentop/$newobj"
 
5160
              ;;
 
5161
            *) oldobjs="$oldobjs $obj" ;;
 
5162
            esac
 
5163
          done
 
5164
        fi
3895
5165
 
3896
5166
        eval cmds=\"$old_archive_cmds\"
 
5167
 
 
5168
        if len=`expr "X$cmds" : ".*"` &&
 
5169
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 
5170
          cmds=$old_archive_cmds
 
5171
        else
 
5172
          # the command line is too long to link in one step, link in parts
 
5173
          $echo "using piecewise archive linking..."
 
5174
          save_RANLIB=$RANLIB
 
5175
          RANLIB=:
 
5176
          objlist=
 
5177
          concat_cmds=
 
5178
          save_oldobjs=$oldobjs
 
5179
 
 
5180
          # Is there a better way of finding the last object in the list?
 
5181
          for obj in $save_oldobjs
 
5182
          do
 
5183
            last_oldobj=$obj
 
5184
          done
 
5185
          for obj in $save_oldobjs
 
5186
          do
 
5187
            oldobjs="$objlist $obj"
 
5188
            objlist="$objlist $obj"
 
5189
            eval test_cmds=\"$old_archive_cmds\"
 
5190
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
 
5191
               test "$len" -le "$max_cmd_len"; then
 
5192
              :
 
5193
            else
 
5194
              # the above command should be used before it gets too long
 
5195
              oldobjs=$objlist
 
5196
              if test "$obj" = "$last_oldobj" ; then
 
5197
                RANLIB=$save_RANLIB
 
5198
              fi
 
5199
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 
5200
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
 
5201
              objlist=
 
5202
            fi
 
5203
          done
 
5204
          RANLIB=$save_RANLIB
 
5205
          oldobjs=$objlist
 
5206
          if test "X$oldobjs" = "X" ; then
 
5207
            eval cmds=\"\$concat_cmds\"
 
5208
          else
 
5209
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 
5210
          fi
 
5211
        fi
3897
5212
      fi
3898
5213
      save_ifs="$IFS"; IFS='~'
3899
5214
      for cmd in $cmds; do
 
5215
        eval cmd=\"$cmd\"
3900
5216
        IFS="$save_ifs"
3901
5217
        $show "$cmd"
3902
5218
        $run eval "$cmd" || exit $?
3928
5244
        fi
3929
5245
      done
3930
5246
      # Quote the link command for shipping.
3931
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
 
5247
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
3932
5248
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5249
      if test "$hardcode_automatic" = yes ; then
 
5250
        relink_command=
 
5251
      fi
 
5252
 
3933
5253
 
3934
5254
      # Only create the output if not a dry run.
3935
5255
      if test -z "$run"; then
3948
5268
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3949
5269
                if test -z "$libdir"; then
3950
5270
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3951
 
                  exit 1
 
5271
                  exit $EXIT_FAILURE
3952
5272
                fi
3953
5273
                newdependency_libs="$newdependency_libs $libdir/$name"
3954
5274
                ;;
3962
5282
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3963
5283
              if test -z "$libdir"; then
3964
5284
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3965
 
                exit 1
 
5285
                exit $EXIT_FAILURE
3966
5286
              fi
3967
5287
              newdlfiles="$newdlfiles $libdir/$name"
3968
5288
            done
3973
5293
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3974
5294
              if test -z "$libdir"; then
3975
5295
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3976
 
                exit 1
 
5296
                exit $EXIT_FAILURE
3977
5297
              fi
3978
5298
              newdlprefiles="$newdlprefiles $libdir/$name"
3979
5299
            done
3980
5300
            dlprefiles="$newdlprefiles"
 
5301
          else
 
5302
            newdlfiles=
 
5303
            for lib in $dlfiles; do
 
5304
              case $lib in
 
5305
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5306
                *) abs=`pwd`"/$lib" ;;
 
5307
              esac
 
5308
              newdlfiles="$newdlfiles $abs"
 
5309
            done
 
5310
            dlfiles="$newdlfiles"
 
5311
            newdlprefiles=
 
5312
            for lib in $dlprefiles; do
 
5313
              case $lib in
 
5314
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5315
                *) abs=`pwd`"/$lib" ;;
 
5316
              esac
 
5317
              newdlprefiles="$newdlprefiles $abs"
 
5318
            done
 
5319
            dlprefiles="$newdlprefiles"
3981
5320
          fi
3982
5321
          $rm $output
3983
5322
          # place dlname in correct position for cygwin
3984
5323
          tdlname=$dlname
3985
5324
          case $host,$output,$installed,$module,$dlname in
3986
 
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
5325
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3987
5326
          esac
3988
5327
          $echo > $output "\
3989
5328
# $outputname - a libtool library file
4012
5351
# Is this an already installed library?
4013
5352
installed=$installed
4014
5353
 
 
5354
# Should we warn about portability when linking against -modules?
 
5355
shouldnotlink=$module
 
5356
 
4015
5357
# Files to dlopen/dlpreopen
4016
5358
dlopen='$dlfiles'
4017
5359
dlpreopen='$dlprefiles'
4018
5360
 
4019
5361
# Directory that this library needs to be installed in:
4020
5362
libdir='$install_libdir'"
4021
 
          if test "$installed" = no && test $need_relink = yes; then
 
5363
          if test "$installed" = no && test "$need_relink" = yes; then
4022
5364
            $echo >> $output "\
4023
5365
relink_command=\"$relink_command\""
4024
5366
          fi
4031
5373
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4032
5374
      ;;
4033
5375
    esac
4034
 
    exit 0
 
5376
    exit $EXIT_SUCCESS
4035
5377
    ;;
4036
5378
 
4037
5379
  # libtool install mode
4042
5384
    # install_prog (especially on Windows NT).
4043
5385
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4044
5386
       # Allow the use of GNU shtool's install command.
4045
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5387
       $echo "X$nonopt" | grep shtool > /dev/null; then
4046
5388
      # Aesthetically quote it.
4047
5389
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4048
5390
      case $arg in
4049
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5391
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
4050
5392
        arg="\"$arg\""
4051
5393
        ;;
4052
5394
      esac
4055
5397
      shift
4056
5398
    else
4057
5399
      install_prog=
4058
 
      arg="$nonopt"
 
5400
      arg=$nonopt
4059
5401
    fi
4060
5402
 
4061
5403
    # The real first argument should be the name of the installation program.
4062
5404
    # Aesthetically quote it.
4063
5405
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4064
5406
    case $arg in
4065
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5407
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
4066
5408
      arg="\"$arg\""
4067
5409
      ;;
4068
5410
    esac
4080
5422
    do
4081
5423
      if test -n "$dest"; then
4082
5424
        files="$files $dest"
4083
 
        dest="$arg"
 
5425
        dest=$arg
4084
5426
        continue
4085
5427
      fi
4086
5428
 
4087
5429
      case $arg in
4088
5430
      -d) isdir=yes ;;
4089
 
      -f) prev="-f" ;;
4090
 
      -g) prev="-g" ;;
4091
 
      -m) prev="-m" ;;
4092
 
      -o) prev="-o" ;;
 
5431
      -f) 
 
5432
        case " $install_prog " in
 
5433
        *[\\\ /]cp\ *) ;;
 
5434
        *) prev=$arg ;;
 
5435
        esac
 
5436
        ;;
 
5437
      -g | -m | -o) prev=$arg ;;
4093
5438
      -s)
4094
5439
        stripme=" -s"
4095
5440
        continue
4096
5441
        ;;
4097
 
      -*) ;;
4098
 
 
 
5442
      -*)
 
5443
        ;;
4099
5444
      *)
4100
5445
        # If the previous option needed an argument, then skip it.
4101
5446
        if test -n "$prev"; then
4102
5447
          prev=
4103
5448
        else
4104
 
          dest="$arg"
 
5449
          dest=$arg
4105
5450
          continue
4106
5451
        fi
4107
5452
        ;;
4110
5455
      # Aesthetically quote the argument.
4111
5456
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4112
5457
      case $arg in
4113
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5458
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
4114
5459
        arg="\"$arg\""
4115
5460
        ;;
4116
5461
      esac
4120
5465
    if test -z "$install_prog"; then
4121
5466
      $echo "$modename: you must specify an install program" 1>&2
4122
5467
      $echo "$help" 1>&2
4123
 
      exit 1
 
5468
      exit $EXIT_FAILURE
4124
5469
    fi
4125
5470
 
4126
5471
    if test -n "$prev"; then
4127
5472
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4128
5473
      $echo "$help" 1>&2
4129
 
      exit 1
 
5474
      exit $EXIT_FAILURE
4130
5475
    fi
4131
5476
 
4132
5477
    if test -z "$files"; then
4136
5481
        $echo "$modename: you must specify a destination" 1>&2
4137
5482
      fi
4138
5483
      $echo "$help" 1>&2
4139
 
      exit 1
 
5484
      exit $EXIT_FAILURE
4140
5485
    fi
4141
5486
 
4142
5487
    # Strip any trailing slash from the destination.
4154
5499
 
4155
5500
      # Not a directory, so check to see that there is only one file specified.
4156
5501
      set dummy $files
4157
 
      if test $# -gt 2; then
 
5502
      if test "$#" -gt 2; then
4158
5503
        $echo "$modename: \`$dest' is not a directory" 1>&2
4159
5504
        $echo "$help" 1>&2
4160
 
        exit 1
 
5505
        exit $EXIT_FAILURE
4161
5506
      fi
4162
5507
    fi
4163
5508
    case $destdir in
4169
5514
        *)
4170
5515
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4171
5516
          $echo "$help" 1>&2
4172
 
          exit 1
 
5517
          exit $EXIT_FAILURE
4173
5518
          ;;
4174
5519
        esac
4175
5520
      done
4194
5539
 
4195
5540
      *.la)
4196
5541
        # Check to see that this really is a libtool archive.
4197
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5542
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4198
5543
        else
4199
5544
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4200
5545
          $echo "$help" 1>&2
4201
 
          exit 1
 
5546
          exit $EXIT_FAILURE
4202
5547
        fi
4203
5548
 
4204
5549
        library_names=
4229
5574
        dir="$dir$objdir"
4230
5575
 
4231
5576
        if test -n "$relink_command"; then
 
5577
          # Determine the prefix the user has applied to our future dir.
 
5578
          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
 
5579
 
 
5580
          # Don't allow the user to place us outside of our expected
 
5581
          # location b/c this prevents finding dependent libraries that
 
5582
          # are installed to the same prefix.
 
5583
          # At present, this check doesn't affect windows .dll's that
 
5584
          # are installed into $libdir/../bin (currently, that works fine)
 
5585
          # but it's something to keep an eye on.
 
5586
          if test "$inst_prefix_dir" = "$destdir"; then
 
5587
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
 
5588
            exit $EXIT_FAILURE
 
5589
          fi
 
5590
 
 
5591
          if test -n "$inst_prefix_dir"; then
 
5592
            # Stick the inst_prefix_dir data into the link command.
 
5593
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5594
          else
 
5595
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
5596
          fi
 
5597
 
4232
5598
          $echo "$modename: warning: relinking \`$file'" 1>&2
4233
5599
          $show "$relink_command"
4234
5600
          if $run eval "$relink_command"; then :
4235
5601
          else
4236
5602
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4237
 
            continue
 
5603
            exit $EXIT_FAILURE
4238
5604
          fi
4239
5605
        fi
4240
5606
 
4256
5622
            $run eval "$striplib $destdir/$realname" || exit $?
4257
5623
          fi
4258
5624
 
4259
 
          if test $# -gt 0; then
 
5625
          if test "$#" -gt 0; then
4260
5626
            # Delete the old symlinks, and create new ones.
 
5627
            # Try `ln -sf' first, because the `ln' binary might depend on
 
5628
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
5629
            # so we also need to try rm && ln -s.
4261
5630
            for linkname
4262
5631
            do
4263
5632
              if test "$linkname" != "$realname"; then
4264
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4265
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
5633
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
5634
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
4266
5635
              fi
4267
5636
            done
4268
5637
          fi
4269
5638
 
4270
5639
          # Do each command in the postinstall commands.
4271
5640
          lib="$destdir/$realname"
4272
 
          eval cmds=\"$postinstall_cmds\"
 
5641
          cmds=$postinstall_cmds
4273
5642
          save_ifs="$IFS"; IFS='~'
4274
5643
          for cmd in $cmds; do
4275
5644
            IFS="$save_ifs"
 
5645
            eval cmd=\"$cmd\"
4276
5646
            $show "$cmd"
4277
 
            $run eval "$cmd" || exit $?
 
5647
            $run eval "$cmd" || {
 
5648
              lt_exit=$?
 
5649
 
 
5650
              # Restore the uninstalled library and exit
 
5651
              if test "$mode" = relink; then
 
5652
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
5653
              fi
 
5654
 
 
5655
              exit $lt_exit
 
5656
            }
4278
5657
          done
4279
5658
          IFS="$save_ifs"
4280
5659
        fi
4312
5691
        *)
4313
5692
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4314
5693
          $echo "$help" 1>&2
4315
 
          exit 1
 
5694
          exit $EXIT_FAILURE
4316
5695
          ;;
4317
5696
        esac
4318
5697
 
4330
5709
          $show "$install_prog $staticobj $staticdest"
4331
5710
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4332
5711
        fi
4333
 
        exit 0
 
5712
        exit $EXIT_SUCCESS
4334
5713
        ;;
4335
5714
 
4336
5715
      *)
4342
5721
          destfile="$destdir/$destfile"
4343
5722
        fi
4344
5723
 
 
5724
        # If the file is missing, and there is a .exe on the end, strip it
 
5725
        # because it is most likely a libtool script we actually want to
 
5726
        # install
 
5727
        stripped_ext=""
 
5728
        case $file in
 
5729
          *.exe)
 
5730
            if test ! -f "$file"; then
 
5731
              file=`$echo $file|${SED} 's,.exe$,,'`
 
5732
              stripped_ext=".exe"
 
5733
            fi
 
5734
            ;;
 
5735
        esac
 
5736
 
4345
5737
        # Do a test to see if this is really a libtool program.
4346
5738
        case $host in
4347
5739
        *cygwin*|*mingw*)
4348
 
            wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
 
5740
            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
4349
5741
            ;;
4350
5742
        *)
4351
5743
            wrapper=$file
4352
5744
            ;;
4353
5745
        esac
4354
 
        if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
 
5746
        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4355
5747
          notinst_deplibs=
4356
5748
          relink_command=
4357
5749
 
 
5750
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
5751
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
5752
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
5753
          # `FILE.' does not work on cygwin managed mounts.
 
5754
          #
4358
5755
          # If there is no directory component, then add one.
4359
 
          case $file in
4360
 
          */* | *\\*) . $wrapper ;;
4361
 
          *) . ./$wrapper ;;
 
5756
          case $wrapper in
 
5757
          */* | *\\*) . ${wrapper} ;;
 
5758
          *) . ./${wrapper} ;;
4362
5759
          esac
4363
5760
 
4364
5761
          # Check the variables that should have been set.
4365
5762
          if test -z "$notinst_deplibs"; then
4366
5763
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4367
 
            exit 1
 
5764
            exit $EXIT_FAILURE
4368
5765
          fi
4369
5766
 
4370
5767
          finalize=yes
4386
5783
          done
4387
5784
 
4388
5785
          relink_command=
 
5786
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
5787
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
5788
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
5789
          # `FILE.' does not work on cygwin managed mounts.
 
5790
          #
4389
5791
          # If there is no directory component, then add one.
4390
 
          case $file in
4391
 
          */* | *\\*) . $wrapper ;;
4392
 
          *) . ./$wrapper ;;
 
5792
          case $wrapper in
 
5793
          */* | *\\*) . ${wrapper} ;;
 
5794
          *) . ./${wrapper} ;;
4393
5795
          esac
4394
5796
 
4395
5797
          outputname=
4398
5800
              tmpdir="/tmp"
4399
5801
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4400
5802
              tmpdir="$tmpdir/libtool-$$"
4401
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5803
              save_umask=`umask`
 
5804
              umask 0077
 
5805
              if $mkdir "$tmpdir"; then
 
5806
                umask $save_umask
4402
5807
              else
 
5808
                umask $save_umask
4403
5809
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4404
5810
                continue
4405
5811
              fi
4406
 
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
5812
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
4407
5813
              outputname="$tmpdir/$file"
4408
5814
              # Replace the output file specification.
4409
5815
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4421
5827
            fi
4422
5828
          else
4423
5829
            # Install the binary that we compiled earlier.
4424
 
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
5830
            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4425
5831
          fi
4426
5832
        fi
4427
5833
 
4428
5834
        # remove .exe since cygwin /usr/bin/install will append another
4429
 
        # one anyways
 
5835
        # one anyway 
4430
5836
        case $install_prog,$host in
4431
 
        /usr/bin/install*,*cygwin*)
 
5837
        */usr/bin/install*,*cygwin*)
4432
5838
          case $file:$destfile in
4433
5839
          *.exe:*.exe)
4434
5840
            # this is ok
4437
5843
            destfile=$destfile.exe
4438
5844
            ;;
4439
5845
          *:*.exe)
4440
 
            destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
 
5846
            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
4441
5847
            ;;
4442
5848
          esac
4443
5849
          ;;
4458
5864
      $show "$install_prog $file $oldlib"
4459
5865
      $run eval "$install_prog \$file \$oldlib" || exit $?
4460
5866
 
4461
 
      if test -n "$stripme" && test -n "$striplib"; then
 
5867
      if test -n "$stripme" && test -n "$old_striplib"; then
4462
5868
        $show "$old_striplib $oldlib"
4463
5869
        $run eval "$old_striplib $oldlib" || exit $?
4464
5870
      fi
4465
5871
 
4466
5872
      # Do each command in the postinstall commands.
4467
 
      eval cmds=\"$old_postinstall_cmds\"
 
5873
      cmds=$old_postinstall_cmds
4468
5874
      save_ifs="$IFS"; IFS='~'
4469
5875
      for cmd in $cmds; do
4470
5876
        IFS="$save_ifs"
 
5877
        eval cmd=\"$cmd\"
4471
5878
        $show "$cmd"
4472
5879
        $run eval "$cmd" || exit $?
4473
5880
      done
4481
5888
    if test -n "$current_libdirs"; then
4482
5889
      # Maybe just do a dry run.
4483
5890
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4484
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
5891
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
4485
5892
    else
4486
 
      exit 0
 
5893
      exit $EXIT_SUCCESS
4487
5894
    fi
4488
5895
    ;;
4489
5896
 
4502
5909
      for libdir in $libdirs; do
4503
5910
        if test -n "$finish_cmds"; then
4504
5911
          # Do each command in the finish commands.
4505
 
          eval cmds=\"$finish_cmds\"
 
5912
          cmds=$finish_cmds
4506
5913
          save_ifs="$IFS"; IFS='~'
4507
5914
          for cmd in $cmds; do
4508
5915
            IFS="$save_ifs"
 
5916
            eval cmd=\"$cmd\"
4509
5917
            $show "$cmd"
4510
5918
            $run eval "$cmd" || admincmds="$admincmds
4511
5919
       $cmd"
4522
5930
    fi
4523
5931
 
4524
5932
    # Exit here if they wanted silent mode.
4525
 
    test "$show" = ":" && exit 0
 
5933
    test "$show" = : && exit $EXIT_SUCCESS
4526
5934
 
4527
 
    echo "----------------------------------------------------------------------"
4528
 
    echo "Libraries have been installed in:"
 
5935
    $echo "----------------------------------------------------------------------"
 
5936
    $echo "Libraries have been installed in:"
4529
5937
    for libdir in $libdirs; do
4530
 
      echo "   $libdir"
 
5938
      $echo "   $libdir"
4531
5939
    done
4532
 
    echo
4533
 
    echo "If you ever happen to want to link against installed libraries"
4534
 
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4535
 
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4536
 
    echo "flag during linking and do at least one of the following:"
 
5940
    $echo
 
5941
    $echo "If you ever happen to want to link against installed libraries"
 
5942
    $echo "in a given directory, LIBDIR, you must either use libtool, and"
 
5943
    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
5944
    $echo "flag during linking and do at least one of the following:"
4537
5945
    if test -n "$shlibpath_var"; then
4538
 
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4539
 
      echo "     during execution"
 
5946
      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
5947
      $echo "     during execution"
4540
5948
    fi
4541
5949
    if test -n "$runpath_var"; then
4542
 
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4543
 
      echo "     during linking"
 
5950
      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
5951
      $echo "     during linking"
4544
5952
    fi
4545
5953
    if test -n "$hardcode_libdir_flag_spec"; then
4546
5954
      libdir=LIBDIR
4547
5955
      eval flag=\"$hardcode_libdir_flag_spec\"
4548
5956
 
4549
 
      echo "   - use the \`$flag' linker flag"
 
5957
      $echo "   - use the \`$flag' linker flag"
4550
5958
    fi
4551
5959
    if test -n "$admincmds"; then
4552
 
      echo "   - have your system administrator run these commands:$admincmds"
 
5960
      $echo "   - have your system administrator run these commands:$admincmds"
4553
5961
    fi
4554
5962
    if test -f /etc/ld.so.conf; then
4555
 
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
5963
      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4556
5964
    fi
4557
 
    echo
4558
 
    echo "See any operating system documentation about shared libraries for"
4559
 
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4560
 
    echo "----------------------------------------------------------------------"
4561
 
    exit 0
 
5965
    $echo
 
5966
    $echo "See any operating system documentation about shared libraries for"
 
5967
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
5968
    $echo "----------------------------------------------------------------------"
 
5969
    exit $EXIT_SUCCESS
4562
5970
    ;;
4563
5971
 
4564
5972
  # libtool execute mode
4570
5978
    if test -z "$cmd"; then
4571
5979
      $echo "$modename: you must specify a COMMAND" 1>&2
4572
5980
      $echo "$help"
4573
 
      exit 1
 
5981
      exit $EXIT_FAILURE
4574
5982
    fi
4575
5983
 
4576
5984
    # Handle -dlopen flags immediately.
4578
5986
      if test ! -f "$file"; then
4579
5987
        $echo "$modename: \`$file' is not a file" 1>&2
4580
5988
        $echo "$help" 1>&2
4581
 
        exit 1
 
5989
        exit $EXIT_FAILURE
4582
5990
      fi
4583
5991
 
4584
5992
      dir=
4585
5993
      case $file in
4586
5994
      *.la)
4587
5995
        # Check to see that this really is a libtool archive.
4588
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
5996
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4589
5997
        else
4590
5998
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4591
5999
          $echo "$help" 1>&2
4592
 
          exit 1
 
6000
          exit $EXIT_FAILURE
4593
6001
        fi
4594
6002
 
4595
6003
        # Read the libtool library.
4616
6024
          dir="$dir/$objdir"
4617
6025
        else
4618
6026
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4619
 
          exit 1
 
6027
          exit $EXIT_FAILURE
4620
6028
        fi
4621
6029
        ;;
4622
6030
 
4656
6064
      -*) ;;
4657
6065
      *)
4658
6066
        # Do a test to see if this is really a libtool program.
4659
 
        if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6067
        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4660
6068
          # If there is no directory component, then add one.
4661
6069
          case $file in
4662
6070
          */* | *\\*) . $file ;;
4679
6087
        eval "export $shlibpath_var"
4680
6088
      fi
4681
6089
 
4682
 
      # Restore saved enviroment variables
 
6090
      # Restore saved environment variables
4683
6091
      if test "${save_LC_ALL+set}" = set; then
4684
6092
        LC_ALL="$save_LC_ALL"; export LC_ALL
4685
6093
      fi
4696
6104
        $echo "export $shlibpath_var"
4697
6105
      fi
4698
6106
      $echo "$cmd$args"
4699
 
      exit 0
 
6107
      exit $EXIT_SUCCESS
4700
6108
    fi
4701
6109
    ;;
4702
6110
 
4724
6132
    if test -z "$rm"; then
4725
6133
      $echo "$modename: you must specify an RM program" 1>&2
4726
6134
      $echo "$help" 1>&2
4727
 
      exit 1
 
6135
      exit $EXIT_FAILURE
4728
6136
    fi
4729
6137
 
4730
6138
    rmdirs=
4731
6139
 
 
6140
    origobjdir="$objdir"
4732
6141
    for file in $files; do
4733
6142
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4734
6143
      if test "X$dir" = "X$file"; then
4735
6144
        dir=.
4736
 
        objdir="$objdir"
 
6145
        objdir="$origobjdir"
4737
6146
      else
4738
 
        objdir="$dir/$objdir"
 
6147
        objdir="$dir/$origobjdir"
4739
6148
      fi
4740
6149
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4741
 
      test $mode = uninstall && objdir="$dir"
 
6150
      test "$mode" = uninstall && objdir="$dir"
4742
6151
 
4743
6152
      # Remember objdir for removal later, being careful to avoid duplicates
4744
 
      if test $mode = clean; then
 
6153
      if test "$mode" = clean; then
4745
6154
        case " $rmdirs " in
4746
6155
          *" $objdir "*) ;;
4747
6156
          *) rmdirs="$rmdirs $objdir" ;;
4765
6174
      case $name in
4766
6175
      *.la)
4767
6176
        # Possibly a libtool archive, so verify it.
4768
 
        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6177
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4769
6178
          . $dir/$name
4770
6179
 
4771
6180
          # Delete the libtool libraries and symlinks.
4773
6182
            rmfiles="$rmfiles $objdir/$n"
4774
6183
          done
4775
6184
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4776
 
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6185
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4777
6186
 
4778
 
          if test $mode = uninstall; then
 
6187
          if test "$mode" = uninstall; then
4779
6188
            if test -n "$library_names"; then
4780
6189
              # Do each command in the postuninstall commands.
4781
 
              eval cmds=\"$postuninstall_cmds\"
 
6190
              cmds=$postuninstall_cmds
4782
6191
              save_ifs="$IFS"; IFS='~'
4783
6192
              for cmd in $cmds; do
4784
6193
                IFS="$save_ifs"
 
6194
                eval cmd=\"$cmd\"
4785
6195
                $show "$cmd"
4786
6196
                $run eval "$cmd"
4787
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6197
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4788
6198
                  exit_status=1
4789
6199
                fi
4790
6200
              done
4793
6203
 
4794
6204
            if test -n "$old_library"; then
4795
6205
              # Do each command in the old_postuninstall commands.
4796
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6206
              cmds=$old_postuninstall_cmds
4797
6207
              save_ifs="$IFS"; IFS='~'
4798
6208
              for cmd in $cmds; do
4799
6209
                IFS="$save_ifs"
 
6210
                eval cmd=\"$cmd\"
4800
6211
                $show "$cmd"
4801
6212
                $run eval "$cmd"
4802
 
                if test $? != 0 && test "$rmforce" != yes; then
 
6213
                if test "$?" -ne 0 && test "$rmforce" != yes; then
4803
6214
                  exit_status=1
4804
6215
                fi
4805
6216
              done
4811
6222
        ;;
4812
6223
 
4813
6224
      *.lo)
4814
 
        if test "$build_old_libs" = yes; then
4815
 
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4816
 
          rmfiles="$rmfiles $dir/$oldobj"
 
6225
        # Possibly a libtool object, so verify it.
 
6226
        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6227
 
 
6228
          # Read the .lo file
 
6229
          . $dir/$name
 
6230
 
 
6231
          # Add PIC object to the list of files to remove.
 
6232
          if test -n "$pic_object" \
 
6233
             && test "$pic_object" != none; then
 
6234
            rmfiles="$rmfiles $dir/$pic_object"
 
6235
          fi
 
6236
 
 
6237
          # Add non-PIC object to the list of files to remove.
 
6238
          if test -n "$non_pic_object" \
 
6239
             && test "$non_pic_object" != none; then
 
6240
            rmfiles="$rmfiles $dir/$non_pic_object"
 
6241
          fi
4817
6242
        fi
4818
6243
        ;;
4819
6244
 
4820
6245
      *)
4821
 
        # Do a test to see if this is a libtool program.
4822
 
        if test $mode = clean &&
4823
 
           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4824
 
          relink_command=
4825
 
          . $dir/$file
 
6246
        if test "$mode" = clean ; then
 
6247
          noexename=$name
 
6248
          case $file in
 
6249
          *.exe)
 
6250
            file=`$echo $file|${SED} 's,.exe$,,'`
 
6251
            noexename=`$echo $name|${SED} 's,.exe$,,'`
 
6252
            # $file with .exe has already been added to rmfiles,
 
6253
            # add $file without .exe
 
6254
            rmfiles="$rmfiles $file"
 
6255
            ;;
 
6256
          esac
 
6257
          # Do a test to see if this is a libtool program.
 
6258
          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
6259
            relink_command=
 
6260
            . $dir/$noexename
4826
6261
 
4827
 
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4828
 
          if test "$fast_install" = yes && test -n "$relink_command"; then
4829
 
            rmfiles="$rmfiles $objdir/lt-$name"
 
6262
            # note $name still contains .exe if it was in $file originally
 
6263
            # as does the version of $file that was added into $rmfiles
 
6264
            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
6265
            if test "$fast_install" = yes && test -n "$relink_command"; then
 
6266
              rmfiles="$rmfiles $objdir/lt-$name"
 
6267
            fi
 
6268
            if test "X$noexename" != "X$name" ; then
 
6269
              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 
6270
            fi
4830
6271
          fi
4831
6272
        fi
4832
6273
        ;;
4834
6275
      $show "$rm $rmfiles"
4835
6276
      $run $rm $rmfiles || exit_status=1
4836
6277
    done
 
6278
    objdir="$origobjdir"
4837
6279
 
4838
6280
    # Try to remove the ${objdir}s in the directories where we deleted files
4839
6281
    for dir in $rmdirs; do
4849
6291
  "")
4850
6292
    $echo "$modename: you must specify a MODE" 1>&2
4851
6293
    $echo "$generic_help" 1>&2
4852
 
    exit 1
 
6294
    exit $EXIT_FAILURE
4853
6295
    ;;
4854
6296
  esac
4855
6297
 
4856
6298
  if test -z "$exec_cmd"; then
4857
6299
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
4858
6300
    $echo "$generic_help" 1>&2
4859
 
    exit 1
 
6301
    exit $EXIT_FAILURE
4860
6302
  fi
4861
6303
fi # test -z "$show_help"
4862
6304
 
4863
6305
if test -n "$exec_cmd"; then
4864
6306
  eval exec $exec_cmd
4865
 
  exit 1
 
6307
  exit $EXIT_FAILURE
4866
6308
fi
4867
6309
 
4868
6310
# We need to display help for each of the modes.
4881
6323
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4882
6324
    --quiet           same as \`--silent'
4883
6325
    --silent          don't print informational messages
 
6326
    --tag=TAG         use configuration variables from tag TAG
4884
6327
    --version         print version information
4885
6328
 
4886
6329
MODE must be one of the following:
4894
6337
      uninstall       remove libraries from an installed directory
4895
6338
 
4896
6339
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4897
 
a more detailed description of MODE."
4898
 
  exit 0
 
6340
a more detailed description of MODE.
 
6341
 
 
6342
Report bugs to <bug-libtool@gnu.org>."
 
6343
  exit $EXIT_SUCCESS
4899
6344
  ;;
4900
6345
 
4901
6346
clean)
5006
6451
  -no-install       link a not-installable executable
5007
6452
  -no-undefined     declare that a library does not refer to external symbols
5008
6453
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
6454
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6455
  -precious-files-regex REGEX
 
6456
                    don't remove output files matching REGEX
5009
6457
  -release RELEASE  specify package release information
5010
6458
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5011
6459
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5047
6495
*)
5048
6496
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5049
6497
  $echo "$help" 1>&2
5050
 
  exit 1
 
6498
  exit $EXIT_FAILURE
5051
6499
  ;;
5052
6500
esac
5053
6501
 
5054
 
echo
 
6502
$echo
5055
6503
$echo "Try \`$modename --help' for more information about other modes."
5056
6504
 
5057
 
exit 0
 
6505
exit $?
 
6506
 
 
6507
# The TAGs below are defined such that we never get into a situation
 
6508
# in which we disable both kinds of libraries.  Given conflicting
 
6509
# choices, we go for a static library, that is the most portable,
 
6510
# since we can't tell whether shared libraries were disabled because
 
6511
# the user asked for that or because the platform doesn't support
 
6512
# them.  This is particularly important on AIX, because we don't
 
6513
# support having both static and shared libraries enabled at the same
 
6514
# time on that platform, so we default to a shared-only configuration.
 
6515
# If a disable-shared tag is given, we'll fallback to a static-only
 
6516
# configuration.  But we'll never go from static-only to shared-only.
 
6517
 
 
6518
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
 
6519
build_libtool_libs=no
 
6520
build_old_libs=yes
 
6521
# ### END LIBTOOL TAG CONFIG: disable-shared
 
6522
 
 
6523
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
 
6524
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6525
# ### END LIBTOOL TAG CONFIG: disable-static
5058
6526
 
5059
6527
# Local Variables:
5060
6528
# mode:shell-script