~ubuntu-branches/debian/jessie/gamin/jessie

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2007-03-23 14:43:49 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070323144349-1inpdk22uaneks9h
Tags: 0.1.8-2
* debian/control: Improve long description. (Closes: #405347)
* debian/patches/14_nfs-fix.patch: Fix gam_server startup for Thunar.
  Thanks to Maximiliano Curia. (Closes: #403247)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ltmain.sh - Provide generalized library-building support services.
2
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
3
#
4
 
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
 
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.22
 
47
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
 
48
 
 
49
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
 
50
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
 
51
  emulate sh
 
52
  NULLCMD=:
 
53
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
 
54
  # is contrary to our usage.  Disable this feature.
 
55
  alias -g '${1+"$@"}'='"$@"'
 
56
  setopt NO_GLOB_SUBST
 
57
else
 
58
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 
59
fi
 
60
 
27
61
# Check that we have a working $echo.
28
62
if test "X$1" = X--no-reexec; then
29
63
  # Discard the --no-reexec flag, and continue.
36
70
  :
37
71
else
38
72
  # Restart under the correct shell, and then maybe $echo will work.
39
 
  exec $SHELL "$0" --no-reexec ${1+"$@"}
 
73
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
40
74
fi
41
75
 
42
76
if test "X$1" = X--fallback-echo; then
45
79
  cat <<EOF
46
80
$*
47
81
EOF
48
 
  exit 0
 
82
  exit $EXIT_SUCCESS
49
83
fi
50
84
 
51
 
# define SED for historic ltconfig's generated by Libtool 1.3
52
 
test -z "$SED" && SED=sed
53
 
 
54
 
# The name of this program.
55
 
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
56
 
modename="$progname"
57
 
 
58
 
# Constants.
59
 
PROGRAM=ltmain.sh
60
 
PACKAGE=libtool
61
 
VERSION=1.5
62
 
TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)"
63
 
 
64
85
default_mode=
65
86
help="Try \`$progname --help' for more information."
66
87
magic="%%%MAGIC variable%%%"
73
94
Xsed="${SED}"' -e 1s/^X//'
74
95
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
75
96
# test EBCDIC or ASCII
76
 
case `echo A|od -x` in
77
 
 *[Cc]1*) # EBCDIC based system
78
 
  SP2NL="tr '\100' '\n'"
79
 
  NL2SP="tr '\r\n' '\100\100'"
 
97
case `echo X|tr X '\101'` in
 
98
 A) # ASCII based system
 
99
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
 
100
  SP2NL='tr \040 \012'
 
101
  NL2SP='tr \015\012 \040\040'
80
102
  ;;
81
 
 *) # Assume ASCII based system
82
 
  SP2NL="tr '\040' '\012'"
83
 
  NL2SP="tr '\015\012' '\040\040'"
 
103
 *) # EBCDIC based system
 
104
  SP2NL='tr \100 \n'
 
105
  NL2SP='tr \r\n \100\100'
84
106
  ;;
85
107
esac
86
108
 
89
111
# These must not be set unconditionally because not all systems understand
90
112
# e.g. LANG=C (notably SCO).
91
113
# We save the old values to restore during execute mode.
92
 
if test "${LC_ALL+set}" = set; then
93
 
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
94
 
fi
95
 
if test "${LANG+set}" = set; then
96
 
  save_LANG="$LANG"; LANG=C; export LANG
97
 
fi
 
114
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
115
do
 
116
  eval "if test \"\${$lt_var+set}\" = set; then
 
117
         save_$lt_var=\$$lt_var
 
118
         $lt_var=C
 
119
         export $lt_var
 
120
       fi"
 
121
done
98
122
 
99
123
# Make sure IFS has a sensible default
100
 
: ${IFS="       "}
 
124
lt_nl='
 
125
'
 
126
IFS="   $lt_nl"
101
127
 
102
128
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
103
129
  $echo "$modename: not configured to build any kind of library" 1>&2
104
130
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
105
 
  exit 1
 
131
  exit $EXIT_FAILURE
106
132
fi
107
133
 
108
134
# Global variables.
114
140
show="$echo"
115
141
show_help=
116
142
execute_dlfiles=
 
143
duplicate_deps=no
 
144
preserve_args=
117
145
lo2o="s/\\.lo\$/.${objext}/"
118
146
o2lo="s/\\.${objext}\$/.lo/"
 
147
extracted_archives=
 
148
extracted_serial=0
119
149
 
120
150
#####################################
121
151
# Shell function definitions:
122
152
# This seems to be the best place for them
123
153
 
 
154
# func_mktempdir [string]
 
155
# Make a temporary directory that won't clash with other running
 
156
# libtool processes, and avoids race conditions if possible.  If
 
157
# given, STRING is the basename for that directory.
 
158
func_mktempdir ()
 
159
{
 
160
    my_template="${TMPDIR-/tmp}/${1-$progname}"
 
161
 
 
162
    if test "$run" = ":"; then
 
163
      # Return a directory name, but don't create it in dry-run mode
 
164
      my_tmpdir="${my_template}-$$"
 
165
    else
 
166
 
 
167
      # If mktemp works, use that first and foremost
 
168
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
169
 
 
170
      if test ! -d "$my_tmpdir"; then
 
171
        # Failing that, at least try and use $RANDOM to avoid a race
 
172
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
173
 
 
174
        save_mktempdir_umask=`umask`
 
175
        umask 0077
 
176
        $mkdir "$my_tmpdir"
 
177
        umask $save_mktempdir_umask
 
178
      fi
 
179
 
 
180
      # If we're not in dry-run mode, bomb out on failure
 
181
      test -d "$my_tmpdir" || {
 
182
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
 
183
        exit $EXIT_FAILURE
 
184
      }
 
185
    fi
 
186
 
 
187
    $echo "X$my_tmpdir" | $Xsed
 
188
}
 
189
 
 
190
 
 
191
# func_win32_libid arg
 
192
# return the library type of file 'arg'
 
193
#
124
194
# Need a lot of goo to handle *both* DLLs and import libs
125
195
# Has to be a shell function in order to 'eat' the argument
126
196
# that is supplied when $file_magic_command is called.
127
 
win32_libid () {
 
197
func_win32_libid ()
 
198
{
128
199
  win32_libid_type="unknown"
129
200
  win32_fileres=`file -L $1 2>/dev/null`
130
201
  case $win32_fileres in
133
204
    ;;
134
205
  *ar\ archive*) # could be an import, or static
135
206
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
136
 
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
207
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
137
208
      win32_nmres=`eval $NM -f posix -A $1 | \
138
 
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
139
 
      if test "X$win32_nmres" = "Ximport" ; then
140
 
        win32_libid_type="x86 archive import"
141
 
      else
142
 
        win32_libid_type="x86 archive static"
143
 
      fi
 
209
        $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
 
210
      case $win32_nmres in
 
211
      import*)  win32_libid_type="x86 archive import";;
 
212
      *)        win32_libid_type="x86 archive static";;
 
213
      esac
144
214
    fi
145
215
    ;;
146
 
  *DLL*) 
 
216
  *DLL*)
147
217
    win32_libid_type="x86 DLL"
148
218
    ;;
149
219
  *executable*) # but shell scripts are "executable" too...
157
227
  $echo $win32_libid_type
158
228
}
159
229
 
 
230
 
 
231
# func_infer_tag arg
 
232
# Infer tagged configuration to use if any are available and
 
233
# if one wasn't chosen via the "--tag" command line option.
 
234
# Only attempt this if the compiler in the base compile
 
235
# command doesn't match the default compiler.
 
236
# arg is usually of the form 'gcc ...'
 
237
func_infer_tag ()
 
238
{
 
239
    if test -n "$available_tags" && test -z "$tagname"; then
 
240
      CC_quoted=
 
241
      for arg in $CC; do
 
242
        case $arg in
 
243
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
244
          arg="\"$arg\""
 
245
          ;;
 
246
        esac
 
247
        CC_quoted="$CC_quoted $arg"
 
248
      done
 
249
      case $@ in
 
250
      # Blanks in the command may have been stripped by the calling shell,
 
251
      # but not from the CC environment variable when configure was run.
 
252
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
253
      # Blanks at the start of $base_compile will cause this to fail
 
254
      # if we don't check for them as well.
 
255
      *)
 
256
        for z in $available_tags; do
 
257
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
258
            # Evaluate the configuration.
 
259
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
260
            CC_quoted=
 
261
            for arg in $CC; do
 
262
            # Double-quote args containing other shell metacharacters.
 
263
            case $arg in
 
264
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
265
              arg="\"$arg\""
 
266
              ;;
 
267
            esac
 
268
            CC_quoted="$CC_quoted $arg"
 
269
          done
 
270
            case "$@ " in
 
271
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
272
              # The compiler in the base compile command matches
 
273
              # the one in the tagged configuration.
 
274
              # Assume this is the tagged configuration we want.
 
275
              tagname=$z
 
276
              break
 
277
              ;;
 
278
            esac
 
279
          fi
 
280
        done
 
281
        # If $tagname still isn't set, then no tagged configuration
 
282
        # was found and let the user know that the "--tag" command
 
283
        # line option must be used.
 
284
        if test -z "$tagname"; then
 
285
          $echo "$modename: unable to infer tagged configuration"
 
286
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
287
          exit $EXIT_FAILURE
 
288
#        else
 
289
#          $echo "$modename: using $tagname tagged configuration"
 
290
        fi
 
291
        ;;
 
292
      esac
 
293
    fi
 
294
}
 
295
 
 
296
 
 
297
# func_extract_an_archive dir oldlib
 
298
func_extract_an_archive ()
 
299
{
 
300
    f_ex_an_ar_dir="$1"; shift
 
301
    f_ex_an_ar_oldlib="$1"
 
302
 
 
303
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
 
304
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
 
305
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
 
306
     :
 
307
    else
 
308
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
 
309
      exit $EXIT_FAILURE
 
310
    fi
 
311
}
 
312
 
 
313
# func_extract_archives gentop oldlib ...
 
314
func_extract_archives ()
 
315
{
 
316
    my_gentop="$1"; shift
 
317
    my_oldlibs=${1+"$@"}
 
318
    my_oldobjs=""
 
319
    my_xlib=""
 
320
    my_xabs=""
 
321
    my_xdir=""
 
322
    my_status=""
 
323
 
 
324
    $show "${rm}r $my_gentop"
 
325
    $run ${rm}r "$my_gentop"
 
326
    $show "$mkdir $my_gentop"
 
327
    $run $mkdir "$my_gentop"
 
328
    my_status=$?
 
329
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
 
330
      exit $my_status
 
331
    fi
 
332
 
 
333
    for my_xlib in $my_oldlibs; do
 
334
      # Extract the objects.
 
335
      case $my_xlib in
 
336
        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
 
337
        *) my_xabs=`pwd`"/$my_xlib" ;;
 
338
      esac
 
339
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
 
340
      my_xlib_u=$my_xlib
 
341
      while :; do
 
342
        case " $extracted_archives " in
 
343
       *" $my_xlib_u "*)
 
344
         extracted_serial=`expr $extracted_serial + 1`
 
345
         my_xlib_u=lt$extracted_serial-$my_xlib ;;
 
346
       *) break ;;
 
347
       esac
 
348
      done
 
349
      extracted_archives="$extracted_archives $my_xlib_u"
 
350
      my_xdir="$my_gentop/$my_xlib_u"
 
351
 
 
352
      $show "${rm}r $my_xdir"
 
353
      $run ${rm}r "$my_xdir"
 
354
      $show "$mkdir $my_xdir"
 
355
      $run $mkdir "$my_xdir"
 
356
      exit_status=$?
 
357
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
 
358
        exit $exit_status
 
359
      fi
 
360
      case $host in
 
361
      *-darwin*)
 
362
        $show "Extracting $my_xabs"
 
363
        # Do not bother doing anything if just a dry run
 
364
        if test -z "$run"; then
 
365
          darwin_orig_dir=`pwd`
 
366
          cd $my_xdir || exit $?
 
367
          darwin_archive=$my_xabs
 
368
          darwin_curdir=`pwd`
 
369
          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
 
370
          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
 
371
          if test -n "$darwin_arches"; then 
 
372
            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
 
373
            darwin_arch=
 
374
            $show "$darwin_base_archive has multiple architectures $darwin_arches"
 
375
            for darwin_arch in  $darwin_arches ; do
 
376
              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
377
              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
 
378
              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
 
379
              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
 
380
              cd "$darwin_curdir"
 
381
              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
 
382
            done # $darwin_arches
 
383
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
 
384
            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
 
385
            darwin_file=
 
386
            darwin_files=
 
387
            for darwin_file in $darwin_filelist; do
 
388
              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 
389
              lipo -create -output "$darwin_file" $darwin_files
 
390
            done # $darwin_filelist
 
391
            ${rm}r unfat-$$
 
392
            cd "$darwin_orig_dir"
 
393
          else
 
394
            cd "$darwin_orig_dir"
 
395
            func_extract_an_archive "$my_xdir" "$my_xabs"
 
396
          fi # $darwin_arches
 
397
        fi # $run
 
398
        ;;
 
399
      *)
 
400
        func_extract_an_archive "$my_xdir" "$my_xabs"
 
401
        ;;
 
402
      esac
 
403
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 
404
    done
 
405
    func_extract_archives_result="$my_oldobjs"
 
406
}
160
407
# End of Shell function definitions
161
408
#####################################
162
409
 
 
410
# Darwin sucks
 
411
eval std_shrext=\"$shrext_cmds\"
 
412
 
 
413
disable_libs=no
 
414
 
163
415
# Parse our command line options once, thoroughly.
164
416
while test "$#" -gt 0
165
417
do
179
431
      ;;
180
432
    tag)
181
433
      tagname="$arg"
 
434
      preserve_args="${preserve_args}=$arg"
182
435
 
183
436
      # Check whether tagname contains only valid characters
184
437
      case $tagname in
185
438
      *[!-_A-Za-z0-9,/]*)
186
439
        $echo "$progname: invalid tag name: $tagname" 1>&2
187
 
        exit 1
 
440
        exit $EXIT_FAILURE
188
441
        ;;
189
442
      esac
190
443
 
194
447
        # not specially marked.
195
448
        ;;
196
449
      *)
197
 
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
 
450
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
198
451
          taglist="$taglist $tagname"
199
452
          # Evaluate the configuration.
200
 
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
 
453
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
201
454
        else
202
455
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
203
456
        fi
223
476
  --version)
224
477
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
225
478
    $echo
226
 
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
 
479
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
227
480
    $echo "This is free software; see the source for copying conditions.  There is NO"
228
481
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
229
 
    exit 0
 
482
    exit $?
230
483
    ;;
231
484
 
232
485
  --config)
233
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
 
486
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
234
487
    # Now print the configurations for the tags.
235
488
    for tagname in $taglist; do
236
 
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
 
489
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
237
490
    done
238
 
    exit 0
 
491
    exit $?
239
492
    ;;
240
493
 
241
494
  --debug)
242
495
    $echo "$progname: enabling shell trace mode"
243
496
    set -x
 
497
    preserve_args="$preserve_args $arg"
244
498
    ;;
245
499
 
246
500
  --dry-run | -n)
259
513
    else
260
514
      $echo "disable static libraries"
261
515
    fi
262
 
    exit 0
 
516
    exit $?
263
517
    ;;
264
518
 
265
519
  --finish) mode="finish" ;;
271
525
 
272
526
  --quiet | --silent)
273
527
    show=:
 
528
    preserve_args="$preserve_args $arg"
274
529
    ;;
275
530
 
276
 
  --tag) prevopt="--tag" prev=tag ;;
 
531
  --tag)
 
532
    prevopt="--tag"
 
533
    prev=tag
 
534
    preserve_args="$preserve_args --tag"
 
535
    ;;
277
536
  --tag=*)
278
537
    set tag "$optarg" ${1+"$@"}
279
538
    shift
280
539
    prev=tag
 
540
    preserve_args="$preserve_args --tag"
281
541
    ;;
282
542
 
283
543
  -dlopen)
288
548
  -*)
289
549
    $echo "$modename: unrecognized option \`$arg'" 1>&2
290
550
    $echo "$help" 1>&2
291
 
    exit 1
 
551
    exit $EXIT_FAILURE
292
552
    ;;
293
553
 
294
554
  *)
301
561
if test -n "$prevopt"; then
302
562
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
303
563
  $echo "$help" 1>&2
304
 
  exit 1
 
564
  exit $EXIT_FAILURE
305
565
fi
306
566
 
 
567
case $disable_libs in
 
568
no) 
 
569
  ;;
 
570
shared)
 
571
  build_libtool_libs=no
 
572
  build_old_libs=yes
 
573
  ;;
 
574
static)
 
575
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 
576
  ;;
 
577
esac
 
578
 
307
579
# If this variable is set in any of the actions, the command in it
308
580
# will be execed at the end.  This prevents here-documents from being
309
581
# left over by shells.
314
586
  # Infer the operation mode.
315
587
  if test -z "$mode"; then
316
588
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
317
 
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
 
589
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
318
590
    case $nonopt in
319
591
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
320
592
      mode=link
357
629
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
358
630
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
359
631
    $echo "$help" 1>&2
360
 
    exit 1
 
632
    exit $EXIT_FAILURE
361
633
  fi
362
634
 
363
635
  # Change the help message to a mode-specific one.
372
644
    # Get the compilation command and the source file.
373
645
    base_compile=
374
646
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
 
647
    suppress_opt=yes
375
648
    suppress_output=
376
649
    arg_mode=normal
377
650
    libobj=
 
651
    later=
378
652
 
379
653
    for arg
380
654
    do
381
 
      case "$arg_mode" in
 
655
      case $arg_mode in
382
656
      arg  )
383
657
        # do not "continue".  Instead, add this to base_compile
384
658
        lastarg="$arg"
397
671
        -o)
398
672
          if test -n "$libobj" ; then
399
673
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
400
 
            exit 1
 
674
            exit $EXIT_FAILURE
401
675
          fi
402
676
          arg_mode=target
403
677
          continue
404
678
          ;;
405
679
 
406
 
        -static)
407
 
          build_old_libs=yes
408
 
          continue
409
 
          ;;
410
 
 
411
 
        -prefer-pic)
412
 
          pic_mode=yes
413
 
          continue
414
 
          ;;
415
 
 
416
 
        -prefer-non-pic)
417
 
          pic_mode=no
 
680
        -static | -prefer-pic | -prefer-non-pic)
 
681
          later="$later $arg"
 
682
          continue
 
683
          ;;
 
684
 
 
685
        -no-suppress)
 
686
          suppress_opt=no
418
687
          continue
419
688
          ;;
420
689
 
427
696
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
428
697
          lastarg=
429
698
          save_ifs="$IFS"; IFS=','
430
 
          for arg in $args; do
 
699
          for arg in $args; do
431
700
            IFS="$save_ifs"
432
701
 
433
702
            # Double-quote args containing other shell metacharacters.
465
734
      case $lastarg in
466
735
      # Double-quote args containing other shell metacharacters.
467
736
      # Many Bourne shells cannot handle close brackets correctly
468
 
      # in scan sets, so we specify it separately.
 
737
      # in scan sets, and some SunOS ksh mistreat backslash-escaping
 
738
      # in scan sets (worked around with variable expansion),
 
739
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
 
740
      # at all, so we specify them separately.
469
741
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
470
742
        lastarg="\"$lastarg\""
471
743
        ;;
477
749
    case $arg_mode in
478
750
    arg)
479
751
      $echo "$modename: you must specify an argument for -Xcompile"
480
 
      exit 1
 
752
      exit $EXIT_FAILURE
481
753
      ;;
482
754
    target)
483
755
      $echo "$modename: you must specify a target with \`-o'" 1>&2
484
 
      exit 1
 
756
      exit $EXIT_FAILURE
485
757
      ;;
486
758
    *)
487
759
      # Get the name of the library object.
506
778
    *.f90) xform=f90 ;;
507
779
    *.for) xform=for ;;
508
780
    *.java) xform=java ;;
 
781
    *.obj) xform=obj ;;
509
782
    esac
510
783
 
511
784
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
514
787
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
515
788
    *)
516
789
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
517
 
      exit 1
 
790
      exit $EXIT_FAILURE
518
791
      ;;
519
792
    esac
520
793
 
521
 
    # Infer tagged configuration to use if any are available and
522
 
    # if one wasn't chosen via the "--tag" command line option.
523
 
    # Only attempt this if the compiler in the base compile
524
 
    # command doesn't match the default compiler.
525
 
    if test -n "$available_tags" && test -z "$tagname"; then
526
 
      case $base_compile in
527
 
      # Blanks in the command may have been stripped by the calling shell,
528
 
      # but not from the CC environment variable when configure was run.
529
 
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
530
 
      # Blanks at the start of $base_compile will cause this to fail
531
 
      # if we don't check for them as well.
532
 
      *)
533
 
        for z in $available_tags; do
534
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
535
 
            # Evaluate the configuration.
536
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
537
 
            case "$base_compile " in
538
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
539
 
              # The compiler in the base compile command matches
540
 
              # the one in the tagged configuration.
541
 
              # Assume this is the tagged configuration we want.
542
 
              tagname=$z
543
 
              break
544
 
              ;;
545
 
            esac
546
 
          fi
547
 
        done
548
 
        # If $tagname still isn't set, then no tagged configuration
549
 
        # was found and let the user know that the "--tag" command
550
 
        # line option must be used.
551
 
        if test -z "$tagname"; then
552
 
          $echo "$modename: unable to infer tagged configuration"
553
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
554
 
          exit 1
555
 
#        else
556
 
#          $echo "$modename: using $tagname tagged configuration"
557
 
        fi
 
794
    func_infer_tag $base_compile
 
795
 
 
796
    for arg in $later; do
 
797
      case $arg in
 
798
      -static)
 
799
        build_old_libs=yes
 
800
        continue
 
801
        ;;
 
802
 
 
803
      -prefer-pic)
 
804
        pic_mode=yes
 
805
        continue
 
806
        ;;
 
807
 
 
808
      -prefer-non-pic)
 
809
        pic_mode=no
 
810
        continue
558
811
        ;;
559
812
      esac
560
 
    fi
 
813
    done
561
814
 
 
815
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
 
816
    case $qlibobj in
 
817
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
818
        qlibobj="\"$qlibobj\"" ;;
 
819
    esac
 
820
    test "X$libobj" != "X$qlibobj" \
 
821
        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
 
822
        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
562
823
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
563
824
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
564
825
    if test "X$xdir" = "X$obj"; then
571
832
    if test -z "$base_compile"; then
572
833
      $echo "$modename: you must specify a compilation command" 1>&2
573
834
      $echo "$help" 1>&2
574
 
      exit 1
 
835
      exit $EXIT_FAILURE
575
836
    fi
576
837
 
577
838
    # Delete any leftover library objects.
582
843
    fi
583
844
 
584
845
    $run $rm $removelist
585
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
846
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
586
847
 
587
848
    # On Cygwin there's no "real" PIC flag so we must build both object types
588
849
    case $host_os in
601
862
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
602
863
      lockfile="$output_obj.lock"
603
864
      removelist="$removelist $output_obj $lockfile"
604
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
865
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
605
866
    else
606
867
      output_obj=
607
868
      need_locks=no
611
872
    # Lock this critical section if it is needed
612
873
    # We use this script file to make the link, it avoids creating a new file
613
874
    if test "$need_locks" = yes; then
614
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
875
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
615
876
        $show "Waiting for $lockfile to be removed"
616
877
        sleep 2
617
878
      done
629
890
compiler."
630
891
 
631
892
        $run $rm $removelist
632
 
        exit 1
 
893
        exit $EXIT_FAILURE
633
894
      fi
634
 
      $echo $srcfile > "$lockfile"
 
895
      $echo "$srcfile" > "$lockfile"
635
896
    fi
636
897
 
637
898
    if test -n "$fix_srcfile_path"; then
638
899
      eval srcfile=\"$fix_srcfile_path\"
639
900
    fi
 
901
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
 
902
    case $qsrcfile in
 
903
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
904
      qsrcfile="\"$qsrcfile\"" ;;
 
905
    esac
640
906
 
641
907
    $run $rm "$libobj" "${libobj}T"
642
908
 
658
924
      fbsd_hideous_sh_bug=$base_compile
659
925
 
660
926
      if test "$pic_mode" != no; then
661
 
        command="$base_compile $srcfile $pic_flag"
 
927
        command="$base_compile $qsrcfile $pic_flag"
662
928
      else
663
929
        # Don't build PIC code
664
 
        command="$base_compile $srcfile"
 
930
        command="$base_compile $qsrcfile"
665
931
      fi
666
932
 
667
933
      if test ! -d "${xdir}$objdir"; then
668
934
        $show "$mkdir ${xdir}$objdir"
669
935
        $run $mkdir ${xdir}$objdir
670
 
        status=$?
671
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
672
 
          exit $status
 
936
        exit_status=$?
 
937
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
938
          exit $exit_status
673
939
        fi
674
940
      fi
675
941
 
684
950
      if $run eval "$command"; then :
685
951
      else
686
952
        test -n "$output_obj" && $run $rm $removelist
687
 
        exit 1
 
953
        exit $EXIT_FAILURE
688
954
      fi
689
955
 
690
956
      if test "$need_locks" = warn &&
704
970
compiler."
705
971
 
706
972
        $run $rm $removelist
707
 
        exit 1
 
973
        exit $EXIT_FAILURE
708
974
      fi
709
975
 
710
976
      # Just move the object if needed, then go on to compile the next one
725
991
EOF
726
992
 
727
993
      # Allow error messages only from the first compilation.
728
 
      suppress_output=' >/dev/null 2>&1'
 
994
      if test "$suppress_opt" = yes; then
 
995
        suppress_output=' >/dev/null 2>&1'
 
996
      fi
729
997
    else
730
998
      # No PIC object so indicate it doesn't exist in the libtool
731
999
      # object file.
739
1007
    if test "$build_old_libs" = yes; then
740
1008
      if test "$pic_mode" != yes; then
741
1009
        # Don't build PIC code
742
 
        command="$base_compile $srcfile"
 
1010
        command="$base_compile $qsrcfile"
743
1011
      else
744
 
        command="$base_compile $srcfile $pic_flag"
 
1012
        command="$base_compile $qsrcfile $pic_flag"
745
1013
      fi
746
1014
      if test "$compiler_c_o" = yes; then
747
1015
        command="$command -o $obj"
754
1022
      if $run eval "$command"; then :
755
1023
      else
756
1024
        $run $rm $removelist
757
 
        exit 1
 
1025
        exit $EXIT_FAILURE
758
1026
      fi
759
1027
 
760
1028
      if test "$need_locks" = warn &&
774
1042
compiler."
775
1043
 
776
1044
        $run $rm $removelist
777
 
        exit 1
 
1045
        exit $EXIT_FAILURE
778
1046
      fi
779
1047
 
780
1048
      # Just move the object if needed
812
1080
      $run $rm "$lockfile"
813
1081
    fi
814
1082
 
815
 
    exit 0
 
1083
    exit $EXIT_SUCCESS
816
1084
    ;;
817
1085
 
818
1086
  # libtool link mode
838
1106
      ;;
839
1107
    esac
840
1108
    libtool_args="$nonopt"
841
 
    base_compile="$nonopt"
 
1109
    base_compile="$nonopt $@"
842
1110
    compile_command="$nonopt"
843
1111
    finalize_command="$nonopt"
844
1112
 
870
1138
    no_install=no
871
1139
    objs=
872
1140
    non_pic_objects=
 
1141
    notinst_path= # paths that contain not-installed libtool libraries
 
1142
    precious_files_regex=
873
1143
    prefer_static_libs=no
874
1144
    preload=no
875
1145
    prev=
883
1153
    vinfo=
884
1154
    vinfo_number=no
885
1155
 
 
1156
    func_infer_tag $base_compile
 
1157
 
886
1158
    # We need to know -static, to get the right output filenames.
887
1159
    for arg
888
1160
    do
889
1161
      case $arg in
890
 
      -all-static | -static)
891
 
        if test "X$arg" = "X-all-static"; then
 
1162
      -all-static | -static | -static-libtool-libs)
 
1163
    case $arg in
 
1164
    -all-static)
892
1165
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
893
1166
            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
894
1167
          fi
895
1168
          if test -n "$link_static_flag"; then
896
1169
            dlopen_self=$dlopen_self_static
897
1170
          fi
898
 
        else
 
1171
          prefer_static_libs=yes
 
1172
          ;;
 
1173
    -static)
899
1174
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
900
1175
            dlopen_self=$dlopen_self_static
901
1176
          fi
902
 
        fi
 
1177
          prefer_static_libs=built
 
1178
          ;;
 
1179
    -static-libtool-libs)
 
1180
      if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
1181
        dlopen_self=$dlopen_self_static
 
1182
      fi
 
1183
      prefer_static_libs=yes
 
1184
      ;;
 
1185
    esac
903
1186
        build_libtool_libs=no
904
1187
        build_old_libs=yes
905
 
        prefer_static_libs=yes
906
1188
        break
907
1189
        ;;
908
1190
      esac
914
1196
    # Go through the arguments, transforming them on the way.
915
1197
    while test "$#" -gt 0; do
916
1198
      arg="$1"
917
 
      base_compile="$base_compile $arg"
918
1199
      shift
919
1200
      case $arg in
920
1201
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
978
1259
          export_symbols="$arg"
979
1260
          if test ! -f "$arg"; then
980
1261
            $echo "$modename: symbol file \`$arg' does not exist"
981
 
            exit 1
 
1262
            exit $EXIT_FAILURE
982
1263
          fi
983
1264
          prev=
984
1265
          continue
993
1274
          prev=
994
1275
          continue
995
1276
          ;;
 
1277
        precious_regex)
 
1278
          precious_files_regex="$arg"
 
1279
          prev=
 
1280
          continue
 
1281
          ;;
996
1282
        release)
997
1283
          release="-$arg"
998
1284
          prev=
1025
1311
                   test "$pic_object" = none && \
1026
1312
                   test "$non_pic_object" = none; then
1027
1313
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1028
 
                  exit 1
 
1314
                  exit $EXIT_FAILURE
1029
1315
                fi
1030
1316
 
1031
1317
                # Extract subdirectory from the argument.
1073
1359
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1074
1360
                    arg="$non_pic_object"
1075
1361
                  fi
 
1362
                else
 
1363
                  # If the PIC object exists, use it instead.
 
1364
                  # $xdir was prepended to $pic_object above.
 
1365
                  non_pic_object="$pic_object"
 
1366
                  non_pic_objects="$non_pic_objects $non_pic_object"
1076
1367
                fi
1077
1368
              else
1078
1369
                # Only an error if not doing a dry-run.
1079
1370
                if test -z "$run"; then
1080
1371
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1081
 
                  exit 1
 
1372
                  exit $EXIT_FAILURE
1082
1373
                else
1083
1374
                  # Dry-run case.
1084
1375
 
1099
1390
            done
1100
1391
          else
1101
1392
            $echo "$modename: link input file \`$save_arg' does not exist"
1102
 
            exit 1
 
1393
            exit $EXIT_FAILURE
1103
1394
          fi
1104
1395
          arg=$save_arg
1105
1396
          prev=
1111
1402
          [\\/]* | [A-Za-z]:[\\/]*) ;;
1112
1403
          *)
1113
1404
            $echo "$modename: only absolute run-paths are allowed" 1>&2
1114
 
            exit 1
 
1405
            exit $EXIT_FAILURE
1115
1406
            ;;
1116
1407
          esac
1117
1408
          if test "$prev" = rpath; then
1151
1442
          finalize_command="$finalize_command $qarg"
1152
1443
          continue
1153
1444
          ;;
 
1445
        shrext)
 
1446
          shrext_cmds="$arg"
 
1447
          prev=
 
1448
          continue
 
1449
          ;;
 
1450
        darwin_framework|darwin_framework_skip)
 
1451
          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
 
1452
          compile_command="$compile_command $arg"
 
1453
          finalize_command="$finalize_command $arg"
 
1454
          prev=
 
1455
          continue
 
1456
          ;;
1154
1457
        *)
1155
1458
          eval "$prev=\"\$arg\""
1156
1459
          prev=
1199
1502
      -export-symbols | -export-symbols-regex)
1200
1503
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1201
1504
          $echo "$modename: more than one -exported-symbols argument is not allowed"
1202
 
          exit 1
 
1505
          exit $EXIT_FAILURE
1203
1506
        fi
1204
1507
        if test "X$arg" = "X-export-symbols"; then
1205
1508
          prev=expsyms
1209
1512
        continue
1210
1513
        ;;
1211
1514
 
 
1515
      -framework|-arch|-isysroot)
 
1516
        case " $CC " in
 
1517
          *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
 
1518
                prev=darwin_framework_skip ;;
 
1519
          *) compiler_flags="$compiler_flags $arg"
 
1520
             prev=darwin_framework ;;
 
1521
        esac
 
1522
        compile_command="$compile_command $arg"
 
1523
        finalize_command="$finalize_command $arg"
 
1524
        continue
 
1525
        ;;
 
1526
 
1212
1527
      -inst-prefix-dir)
1213
1528
        prev=inst_prefix
1214
1529
        continue
1235
1550
          absdir=`cd "$dir" && pwd`
1236
1551
          if test -z "$absdir"; then
1237
1552
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1238
 
            exit 1
 
1553
            absdir="$dir"
 
1554
            notinst_path="$notinst_path $dir"
1239
1555
          fi
1240
1556
          dir="$absdir"
1241
1557
          ;;
1249
1565
        esac
1250
1566
        case $host in
1251
1567
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1568
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1252
1569
          case :$dllsearchpath: in
1253
1570
          *":$dir:"*) ;;
1254
1571
          *) dllsearchpath="$dllsearchpath:$dir";;
1255
1572
          esac
 
1573
          case :$dllsearchpath: in
 
1574
          *":$testbindir:"*) ;;
 
1575
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1576
          esac
1256
1577
          ;;
1257
1578
        esac
1258
1579
        continue
1261
1582
      -l*)
1262
1583
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1263
1584
          case $host in
1264
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1585
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1265
1586
            # These systems don't actually have a C or math library (as such)
1266
1587
            continue
1267
1588
            ;;
1268
 
          *-*-mingw* | *-*-os2*)
 
1589
          *-*-os2*)
1269
1590
            # These systems don't actually have a C library (as such)
1270
1591
            test "X$arg" = "X-lc" && continue
1271
1592
            ;;
1272
 
          *-*-openbsd* | *-*-freebsd*)
 
1593
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1273
1594
            # Do not include libc due to us having libc/libc_r.
1274
1595
            test "X$arg" = "X-lc" && continue
1275
1596
            ;;
1277
1598
            # Rhapsody C and math libraries are in the System framework
1278
1599
            deplibs="$deplibs -framework System"
1279
1600
            continue
 
1601
            ;;
 
1602
          *-*-sco3.2v5* | *-*-sco5v6*)
 
1603
            # Causes problems with __ctype
 
1604
            test "X$arg" = "X-lc" && continue
 
1605
            ;;
 
1606
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
1607
            # Compiler inserts libc in the correct place for threads to work
 
1608
            test "X$arg" = "X-lc" && continue
 
1609
            ;;
1280
1610
          esac
1281
1611
        elif test "X$arg" = "X-lc_r"; then
1282
1612
         case $host in
1283
 
         *-*-openbsd* | *-*-freebsd*)
 
1613
         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1284
1614
           # Do not include libc_r directly, use -pthread flag.
1285
1615
           continue
1286
1616
           ;;
1290
1620
        continue
1291
1621
        ;;
1292
1622
 
 
1623
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
 
1624
      # classes, name mangling, and exception handling.
 
1625
      -model)
 
1626
        compile_command="$compile_command $arg"
 
1627
        compiler_flags="$compiler_flags $arg"
 
1628
        finalize_command="$finalize_command $arg"
 
1629
        prev=xcompiler
 
1630
        continue
 
1631
        ;;
 
1632
 
 
1633
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1634
        compiler_flags="$compiler_flags $arg"
 
1635
        compile_command="$compile_command $arg"
 
1636
        finalize_command="$finalize_command $arg"
 
1637
        continue
 
1638
        ;;
 
1639
 
1293
1640
      -module)
1294
1641
        module=yes
1295
1642
        continue
1296
1643
        ;;
1297
1644
 
1298
 
      # gcc -m* arguments should be passed to the linker via $compiler_flags
1299
 
      # in order to pass architecture information to the linker
1300
 
      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1301
 
      # but this is not reliable with gcc because gcc may use -mfoo to
1302
 
      # select a different linker, different libraries, etc, while
1303
 
      # -Wl,-mfoo simply passes -mfoo to the linker.
1304
 
      -m*)
 
1645
      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
 
1646
      # -r[0-9][0-9]* specifies the processor on the SGI compiler
 
1647
      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
 
1648
      # +DA*, +DD* enable 64-bit mode on the HP compiler
 
1649
      # -q* pass through compiler args for the IBM compiler
 
1650
      # -m* pass through architecture-specific compiler args for GCC
 
1651
      # -m*, -t[45]*, -txscale* pass through architecture-specific
 
1652
      # compiler args for GCC
 
1653
      # -pg pass through profiling flag for GCC
 
1654
      # @file GCC response files
 
1655
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
 
1656
      -t[45]*|-txscale*|@*)
 
1657
 
1305
1658
        # Unknown arguments in both finalize_command and compile_command need
1306
1659
        # to be aesthetically quoted because they are evaled later.
1307
1660
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1312
1665
        esac
1313
1666
        compile_command="$compile_command $arg"
1314
1667
        finalize_command="$finalize_command $arg"
1315
 
        if test "$with_gcc" = "yes" ; then
1316
 
          compiler_flags="$compiler_flags $arg"
1317
 
        fi
 
1668
        compiler_flags="$compiler_flags $arg"
1318
1669
        continue
1319
1670
        ;;
1320
1671
 
1354
1705
 
1355
1706
      -o) prev=output ;;
1356
1707
 
 
1708
      -precious-files-regex)
 
1709
        prev=precious_regex
 
1710
        continue
 
1711
        ;;
 
1712
 
1357
1713
      -release)
1358
1714
        prev=release
1359
1715
        continue
1376
1732
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1377
1733
        *)
1378
1734
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1379
 
          exit 1
 
1735
          exit $EXIT_FAILURE
1380
1736
          ;;
1381
1737
        esac
1382
1738
        case "$xrpath " in
1386
1742
        continue
1387
1743
        ;;
1388
1744
 
1389
 
      -static)
 
1745
      -static | -static-libtool-libs)
1390
1746
        # The effects of -static are defined in a previous loop.
1391
1747
        # We used to do the same as -all-static on platforms that
1392
1748
        # didn't have a PIC flag, but the assumption that the effects
1499
1855
             test "$pic_object" = none && \
1500
1856
             test "$non_pic_object" = none; then
1501
1857
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1502
 
            exit 1
 
1858
            exit $EXIT_FAILURE
1503
1859
          fi
1504
1860
 
1505
1861
          # Extract subdirectory from the argument.
1547
1903
            if test -z "$pic_object" || test "$pic_object" = none ; then
1548
1904
              arg="$non_pic_object"
1549
1905
            fi
 
1906
          else
 
1907
            # If the PIC object exists, use it instead.
 
1908
            # $xdir was prepended to $pic_object above.
 
1909
            non_pic_object="$pic_object"
 
1910
            non_pic_objects="$non_pic_objects $non_pic_object"
1550
1911
          fi
1551
1912
        else
1552
1913
          # Only an error if not doing a dry-run.
1553
1914
          if test -z "$run"; then
1554
1915
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1555
 
            exit 1
 
1916
            exit $EXIT_FAILURE
1556
1917
          else
1557
1918
            # Dry-run case.
1558
1919
 
1619
1980
    if test -n "$prev"; then
1620
1981
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1621
1982
      $echo "$help" 1>&2
1622
 
      exit 1
1623
 
    fi
1624
 
 
1625
 
    # Infer tagged configuration to use if any are available and
1626
 
    # if one wasn't chosen via the "--tag" command line option.
1627
 
    # Only attempt this if the compiler in the base link
1628
 
    # command doesn't match the default compiler.
1629
 
    if test -n "$available_tags" && test -z "$tagname"; then
1630
 
      case $base_compile in
1631
 
      # Blanks in the command may have been stripped by the calling shell,
1632
 
      # but not from the CC environment variable when configure was run.
1633
 
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1634
 
      # Blanks at the start of $base_compile will cause this to fail
1635
 
      # if we don't check for them as well.
1636
 
      *)
1637
 
        for z in $available_tags; do
1638
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1639
 
            # Evaluate the configuration.
1640
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1641
 
            case $base_compile in
1642
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1643
 
              # The compiler in $compile_command matches
1644
 
              # the one in the tagged configuration.
1645
 
              # Assume this is the tagged configuration we want.
1646
 
              tagname=$z
1647
 
              break
1648
 
              ;;
1649
 
            esac
1650
 
          fi
1651
 
        done
1652
 
        # If $tagname still isn't set, then no tagged configuration
1653
 
        # was found and let the user know that the "--tag" command
1654
 
        # line option must be used.
1655
 
        if test -z "$tagname"; then
1656
 
          $echo "$modename: unable to infer tagged configuration"
1657
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
1658
 
          exit 1
1659
 
#       else
1660
 
#         $echo "$modename: using $tagname tagged configuration"
1661
 
        fi
1662
 
        ;;
1663
 
      esac
 
1983
      exit $EXIT_FAILURE
1664
1984
    fi
1665
1985
 
1666
1986
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1693
2013
    if test ! -d "$output_objdir"; then
1694
2014
      $show "$mkdir $output_objdir"
1695
2015
      $run $mkdir $output_objdir
1696
 
      status=$?
1697
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1698
 
        exit $status
 
2016
      exit_status=$?
 
2017
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
2018
        exit $exit_status
1699
2019
      fi
1700
2020
    fi
1701
2021
 
1704
2024
    "")
1705
2025
      $echo "$modename: you must specify an output file" 1>&2
1706
2026
      $echo "$help" 1>&2
1707
 
      exit 1
 
2027
      exit $EXIT_FAILURE
1708
2028
      ;;
1709
2029
    *.$libext) linkmode=oldlib ;;
1710
2030
    *.lo | *.$objext) linkmode=obj ;;
1714
2034
 
1715
2035
    case $host in
1716
2036
    *cygwin* | *mingw* | *pw32*)
1717
 
      # don't eliminate duplcations in $postdeps and $predeps
 
2037
      # don't eliminate duplications in $postdeps and $predeps
1718
2038
      duplicate_compiler_generated_deps=yes
1719
2039
      ;;
1720
2040
    *)
1758
2078
    newlib_search_path=
1759
2079
    need_relink=no # whether we're linking any uninstalled libtool libraries
1760
2080
    notinst_deplibs= # not-installed libtool libraries
1761
 
    notinst_path= # paths that contain not-installed libtool libraries
1762
2081
    case $linkmode in
1763
2082
    lib)
1764
2083
        passes="conv link"
1767
2086
          *.la) ;;
1768
2087
          *)
1769
2088
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1770
 
            exit 1
 
2089
            exit $EXIT_FAILURE
1771
2090
            ;;
1772
2091
          esac
1773
2092
        done
1805
2124
        lib=
1806
2125
        found=no
1807
2126
        case $deplib in
 
2127
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
2128
          if test "$linkmode,$pass" = "prog,link"; then
 
2129
            compile_deplibs="$deplib $compile_deplibs"
 
2130
            finalize_deplibs="$deplib $finalize_deplibs"
 
2131
          else
 
2132
            compiler_flags="$compiler_flags $deplib"
 
2133
          fi
 
2134
          continue
 
2135
          ;;
1808
2136
        -l*)
1809
2137
          if test "$linkmode" != lib && test "$linkmode" != prog; then
1810
2138
            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1811
2139
            continue
1812
2140
          fi
1813
 
          if test "$pass" = conv; then
1814
 
            deplibs="$deplib $deplibs"
1815
 
            continue
1816
 
          fi
1817
2141
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1818
2142
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1819
 
            # Search the libtool library
1820
 
            lib="$searchdir/lib${name}.la"
1821
 
            if test -f "$lib"; then
1822
 
              found=yes
1823
 
              break
1824
 
            fi
 
2143
            for search_ext in .la $std_shrext .so .a; do
 
2144
              # Search the libtool library
 
2145
              lib="$searchdir/lib${name}${search_ext}"
 
2146
              if test -f "$lib"; then
 
2147
                if test "$search_ext" = ".la"; then
 
2148
                  found=yes
 
2149
                else
 
2150
                  found=no
 
2151
                fi
 
2152
                break 2
 
2153
              fi
 
2154
            done
1825
2155
          done
1826
2156
          if test "$found" != yes; then
1827
2157
            # deplib doesn't seem to be a libtool library
1886
2216
            fi
1887
2217
            if test "$pass" = scan; then
1888
2218
              deplibs="$deplib $deplibs"
1889
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1890
2219
            else
1891
2220
              compile_deplibs="$deplib $compile_deplibs"
1892
2221
              finalize_deplibs="$deplib $finalize_deplibs"
1893
2222
            fi
 
2223
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1894
2224
            ;;
1895
2225
          *)
1896
2226
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1918
2248
          fi
1919
2249
          case $linkmode in
1920
2250
          lib)
1921
 
            if test "$deplibs_check_method" != pass_all; then
 
2251
            valid_a_lib=no
 
2252
            case $deplibs_check_method in
 
2253
              match_pattern*)
 
2254
                set dummy $deplibs_check_method
 
2255
                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2256
                if eval $echo \"$deplib\" 2>/dev/null \
 
2257
                    | $SED 10q \
 
2258
                    | $EGREP "$match_pattern_regex" > /dev/null; then
 
2259
                  valid_a_lib=yes
 
2260
                fi
 
2261
                ;;
 
2262
              pass_all)
 
2263
                valid_a_lib=yes
 
2264
                ;;
 
2265
            esac
 
2266
            if test "$valid_a_lib" != yes; then
1922
2267
              $echo
1923
2268
              $echo "*** Warning: Trying to link with static lib archive $deplib."
1924
2269
              $echo "*** I have the capability to make that library automatically link in when"
1968
2313
        esac # case $deplib
1969
2314
        if test "$found" = yes || test -f "$lib"; then :
1970
2315
        else
1971
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
1972
 
          exit 1
 
2316
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
 
2317
          exit $EXIT_FAILURE
1973
2318
        fi
1974
2319
 
1975
2320
        # Check to see that this really is a libtool archive.
1976
2321
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1977
2322
        else
1978
2323
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1979
 
          exit 1
 
2324
          exit $EXIT_FAILURE
1980
2325
        fi
1981
2326
 
1982
2327
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1992
2337
        # it will not redefine variables installed, or shouldnotlink
1993
2338
        installed=yes
1994
2339
        shouldnotlink=no
 
2340
        avoidtemprpath=
 
2341
 
1995
2342
 
1996
2343
        # Read the .la file
1997
2344
        case $lib in
2012
2359
          if test -z "$libdir"; then
2013
2360
            if test -z "$old_library"; then
2014
2361
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2015
 
              exit 1
 
2362
              exit $EXIT_FAILURE
2016
2363
            fi
2017
2364
            # It is a libtool convenience library, so add in its objects.
2018
2365
            convenience="$convenience $ladir/$objdir/$old_library"
2029
2376
            done
2030
2377
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2031
2378
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2032
 
            exit 1
 
2379
            exit $EXIT_FAILURE
2033
2380
          fi
2034
2381
          continue
2035
2382
        fi # $pass = conv
2036
2383
 
2037
 
    
 
2384
 
2038
2385
        # Get the name of the library we link against.
2039
2386
        linklib=
2040
2387
        for l in $old_library $library_names; do
2042
2389
        done
2043
2390
        if test -z "$linklib"; then
2044
2391
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2045
 
          exit 1
 
2392
          exit $EXIT_FAILURE
2046
2393
        fi
2047
2394
 
2048
2395
        # This library was specified with -dlopen.
2049
2396
        if test "$pass" = dlopen; then
2050
2397
          if test -z "$libdir"; then
2051
2398
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2052
 
            exit 1
 
2399
            exit $EXIT_FAILURE
2053
2400
          fi
2054
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2401
          if test -z "$dlname" ||
 
2402
             test "$dlopen_support" != yes ||
 
2403
             test "$build_libtool_libs" = no; then
2055
2404
            # If there is no dlname, no dlopen support or we're linking
2056
2405
            # statically, we need to preload.  We also need to preload any
2057
2406
            # dependent libraries so libltdl's deplib preloader doesn't
2088
2437
            dir="$libdir"
2089
2438
            absdir="$libdir"
2090
2439
          fi
 
2440
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2091
2441
        else
2092
 
          dir="$ladir/$objdir"
2093
 
          absdir="$abs_ladir/$objdir"
2094
 
          # Remove this search path later
2095
 
          notinst_path="$notinst_path $abs_ladir"
 
2442
          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
2443
            dir="$ladir"
 
2444
            absdir="$abs_ladir"
 
2445
            # Remove this search path later
 
2446
            notinst_path="$notinst_path $abs_ladir"
 
2447
          else
 
2448
            dir="$ladir/$objdir"
 
2449
            absdir="$abs_ladir/$objdir"
 
2450
            # Remove this search path later
 
2451
            notinst_path="$notinst_path $abs_ladir"
 
2452
          fi
2096
2453
        fi # $installed = yes
2097
2454
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2098
2455
 
2100
2457
        if test "$pass" = dlpreopen; then
2101
2458
          if test -z "$libdir"; then
2102
2459
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2103
 
            exit 1
 
2460
            exit $EXIT_FAILURE
2104
2461
          fi
2105
2462
          # Prefer using a static library (so that no silly _DYNAMIC symbols
2106
2463
          # are required to link).
2127
2484
          continue
2128
2485
        fi
2129
2486
 
2130
 
    
 
2487
 
2131
2488
        if test "$linkmode" = prog && test "$pass" != link; then
2132
2489
          newlib_search_path="$newlib_search_path $ladir"
2133
2490
          deplibs="$lib $deplibs"
2163
2520
 
2164
2521
        if test "$linkmode,$pass" = "prog,link"; then
2165
2522
          if test -n "$library_names" &&
2166
 
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2523
         { { test "$prefer_static_libs" = no ||
 
2524
             test "$prefer_static_libs,$installed" = "built,yes"; } ||
 
2525
           test -z "$old_library"; }; then
2167
2526
            # We need to hardcode the library path
2168
 
            if test -n "$shlibpath_var"; then
 
2527
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2169
2528
              # Make sure the rpath contains only unique directories.
2170
2529
              case "$temp_rpath " in
2171
2530
              *" $dir "*) ;;
2172
2531
              *" $absdir "*) ;;
2173
 
              *) temp_rpath="$temp_rpath $dir" ;;
 
2532
              *) temp_rpath="$temp_rpath $absdir" ;;
2174
2533
              esac
2175
2534
            fi
2176
2535
 
2207
2566
        fi
2208
2567
 
2209
2568
        link_static=no # Whether the deplib will be linked statically
 
2569
        use_static_libs=$prefer_static_libs
 
2570
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2571
          use_static_libs=no
 
2572
        fi
2210
2573
        if test -n "$library_names" &&
2211
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2574
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2212
2575
          if test "$installed" = no; then
2213
2576
            notinst_deplibs="$notinst_deplibs $lib"
2214
2577
            need_relink=yes
2215
2578
          fi
2216
2579
          # This is a shared library
2217
 
        
2218
 
      # Warn about portability, can't link against -module's on some systems (darwin)
2219
 
      if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2580
 
 
2581
          # Warn about portability, can't link against -module's on
 
2582
          # some systems (darwin)
 
2583
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
2220
2584
            $echo
2221
2585
            if test "$linkmode" = prog; then
2222
2586
              $echo "*** Warning: Linking the executable $output against the loadable module"
2223
2587
            else
2224
2588
              $echo "*** Warning: Linking the shared library $output against the loadable module"
2225
2589
            fi
2226
 
            $echo "*** $linklib is not portable!"    
2227
 
      fi          
 
2590
            $echo "*** $linklib is not portable!"
 
2591
          fi
2228
2592
          if test "$linkmode" = lib &&
2229
2593
             test "$hardcode_into_libs" = yes; then
2230
2594
            # Hardcode the library path.
2282
2646
            else
2283
2647
              $show "extracting exported symbol list from \`$soname'"
2284
2648
              save_ifs="$IFS"; IFS='~'
2285
 
              eval cmds=\"$extract_expsyms_cmds\"
 
2649
              cmds=$extract_expsyms_cmds
2286
2650
              for cmd in $cmds; do
2287
2651
                IFS="$save_ifs"
 
2652
                eval cmd=\"$cmd\"
2288
2653
                $show "$cmd"
2289
2654
                $run eval "$cmd" || exit $?
2290
2655
              done
2295
2660
            if test -f "$output_objdir/$newlib"; then :; else
2296
2661
              $show "generating import library for \`$soname'"
2297
2662
              save_ifs="$IFS"; IFS='~'
2298
 
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
2663
              cmds=$old_archive_from_expsyms_cmds
2299
2664
              for cmd in $cmds; do
2300
2665
                IFS="$save_ifs"
 
2666
                eval cmd=\"$cmd\"
2301
2667
                $show "$cmd"
2302
2668
                $run eval "$cmd" || exit $?
2303
2669
              done
2318
2684
              if test "$hardcode_direct" = no; then
2319
2685
                add="$dir/$linklib"
2320
2686
                case $host in
2321
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2687
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2688
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2689
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2690
                    *-*-unixware7*) add_dir="-L$dir" ;;
2322
2691
                  *-*-darwin* )
2323
 
                    # if the lib is a module then we can not link against it, someone
2324
 
                    # is ignoring the new warnings I added
2325
 
                    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
 
2692
                    # if the lib is a module then we can not link against
 
2693
                    # it, someone is ignoring the new warnings I added
 
2694
                    if /usr/bin/file -L $add 2> /dev/null |
 
2695
                      $EGREP ": [^:]* bundle" >/dev/null ; then
2326
2696
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2327
2697
                      if test -z "$old_library" ; then
2328
2698
                        $echo
2330
2700
                        $echo "** The link will probably fail, sorry"
2331
2701
                      else
2332
2702
                        add="$dir/$old_library"
2333
 
                      fi 
 
2703
                      fi
2334
2704
                    fi
2335
2705
                esac
2336
2706
              elif test "$hardcode_minus_L" = no; then
2353
2723
                add_dir="-L$dir"
2354
2724
                # Try looking first in the location we're being installed to.
2355
2725
                if test -n "$inst_prefix_dir"; then
2356
 
                  case "$libdir" in
 
2726
                  case $libdir in
2357
2727
                    [\\/]*)
2358
2728
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2359
2729
                      ;;
2372
2742
 
2373
2743
            if test "$lib_linked" != yes; then
2374
2744
              $echo "$modename: configuration error: unsupported hardcode properties"
2375
 
              exit 1
 
2745
              exit $EXIT_FAILURE
2376
2746
            fi
2377
2747
 
2378
2748
            if test -n "$add_shlibpath"; then
2415
2785
              esac
2416
2786
              add="-l$name"
2417
2787
            elif test "$hardcode_automatic" = yes; then
2418
 
              if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2788
              if test -n "$inst_prefix_dir" &&
 
2789
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2419
2790
                add="$inst_prefix_dir$libdir/$linklib"
2420
2791
              else
2421
2792
                add="$libdir/$linklib"
2425
2796
              add_dir="-L$libdir"
2426
2797
              # Try looking first in the location we're being installed to.
2427
2798
              if test -n "$inst_prefix_dir"; then
2428
 
                case "$libdir" in
 
2799
                case $libdir in
2429
2800
                  [\\/]*)
2430
2801
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2431
2802
                    ;;
2486
2857
              fi
2487
2858
            fi
2488
2859
          else
2489
 
            convenience="$convenience $dir/$old_library"
2490
 
            old_convenience="$old_convenience $dir/$old_library"
2491
2860
            deplibs="$dir/$old_library $deplibs"
2492
2861
            link_static=yes
2493
2862
          fi
2495
2864
 
2496
2865
        if test "$linkmode" = lib; then
2497
2866
          if test -n "$dependency_libs" &&
2498
 
             { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
 
2867
             { test "$hardcode_into_libs" != yes ||
 
2868
               test "$build_old_libs" = yes ||
2499
2869
               test "$link_static" = yes; }; then
2500
2870
            # Extract -R from dependency_libs
2501
2871
            temp_deplibs=
2552
2922
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2553
2923
                  if test -z "$libdir"; then
2554
2924
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2555
 
                    exit 1
 
2925
                    exit $EXIT_FAILURE
2556
2926
                  fi
2557
2927
                  if test "$absdir" != "$libdir"; then
2558
2928
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2562
2932
                depdepl=
2563
2933
                case $host in
2564
2934
                *-*-darwin*)
2565
 
                  # we do not want to link against static libs, but need to link against shared
 
2935
                  # we do not want to link against static libs,
 
2936
                  # but need to link against shared
2566
2937
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2567
2938
                  if test -n "$deplibrary_names" ; then
2568
2939
                    for tmp in $deplibrary_names ; do
2570
2941
                    done
2571
2942
                    if test -f "$path/$depdepl" ; then
2572
2943
                      depdepl="$path/$depdepl"
2573
 
                   fi
2574
 
                    newlib_search_path="$newlib_search_path $path"
2575
 
                    path=""
 
2944
                    fi
 
2945
                    # do not add paths which are already there
 
2946
                    case " $newlib_search_path " in
 
2947
                    *" $path "*) ;;
 
2948
                    *) newlib_search_path="$newlib_search_path $path";;
 
2949
                    esac
2576
2950
                  fi
 
2951
                  path=""
2577
2952
                  ;;
2578
2953
                *)
2579
 
                path="-L$path"
2580
 
                ;;
2581
 
                esac 
2582
 
                
2583
 
                ;;
2584
 
                  -l*)
 
2954
                  path="-L$path"
 
2955
                  ;;
 
2956
                esac
 
2957
                ;;
 
2958
              -l*)
2585
2959
                case $host in
2586
2960
                *-*-darwin*)
2587
 
                 # Again, we only want to link against shared libraries
2588
 
                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2589
 
                 for tmp in $newlib_search_path ; do
2590
 
                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
2591
 
                       eval depdepl="$tmp/lib$tmp_libs.dylib"
2592
 
                       break
2593
 
                     fi  
2594
 
         done
2595
 
         path=""
 
2961
                  # Again, we only want to link against shared libraries
 
2962
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2963
                  for tmp in $newlib_search_path ; do
 
2964
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2965
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2966
                      break
 
2967
                    fi
 
2968
                  done
 
2969
                  path=""
2596
2970
                  ;;
2597
2971
                *) continue ;;
2598
 
                esac              
 
2972
                esac
2599
2973
                ;;
2600
2974
              *) continue ;;
2601
2975
              esac
2602
2976
              case " $deplibs " in
 
2977
              *" $path "*) ;;
 
2978
              *) deplibs="$path $deplibs" ;;
 
2979
              esac
 
2980
              case " $deplibs " in
2603
2981
              *" $depdepl "*) ;;
2604
 
              *) deplibs="$deplibs $depdepl" ;;
2605
 
              esac            
2606
 
              case " $deplibs " in
2607
 
              *" $path "*) ;;
2608
 
              *) deplibs="$deplibs $path" ;;
 
2982
              *) deplibs="$depdepl $deplibs" ;;
2609
2983
              esac
2610
2984
            done
2611
2985
          fi # link_all_deplibs != no
2692
3066
          eval $var=\"$tmp_libs\"
2693
3067
        done # for var
2694
3068
      fi
2695
 
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
 
3069
      # Last step: remove runtime libs from dependency_libs
 
3070
      # (they stay in deplibs)
2696
3071
      tmp_libs=
2697
3072
      for i in $dependency_libs ; do
2698
3073
        case " $predeps $postdeps $compiler_lib_search_path " in
2752
3127
      case $outputname in
2753
3128
      lib*)
2754
3129
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2755
 
        eval shared_ext=\"$shrext\"
 
3130
        eval shared_ext=\"$shrext_cmds\"
2756
3131
        eval libname=\"$libname_spec\"
2757
3132
        ;;
2758
3133
      *)
2759
3134
        if test "$module" = no; then
2760
3135
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2761
3136
          $echo "$help" 1>&2
2762
 
          exit 1
 
3137
          exit $EXIT_FAILURE
2763
3138
        fi
2764
3139
        if test "$need_lib_prefix" != no; then
2765
3140
          # Add the "lib" prefix for modules if required
2766
3141
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2767
 
          eval shared_ext=\"$shrext\"
 
3142
          eval shared_ext=\"$shrext_cmds\"
2768
3143
          eval libname=\"$libname_spec\"
2769
3144
        else
2770
3145
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2775
3150
      if test -n "$objs"; then
2776
3151
        if test "$deplibs_check_method" != pass_all; then
2777
3152
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2778
 
          exit 1
 
3153
          exit $EXIT_FAILURE
2779
3154
        else
2780
3155
          $echo
2781
3156
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
2823
3198
        if test -n "$8"; then
2824
3199
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2825
3200
          $echo "$help" 1>&2
2826
 
          exit 1
 
3201
          exit $EXIT_FAILURE
2827
3202
        fi
2828
3203
 
2829
3204
        # convert absolute version numbers to libtool ages
2830
3205
        # this retains compatibility with .la files and attempts
2831
3206
        # to make the code below a bit more comprehensible
2832
 
        
 
3207
 
2833
3208
        case $vinfo_number in
2834
3209
        yes)
2835
3210
          number_major="$2"
2843
3218
          # which has an extra 1 added just for fun
2844
3219
          #
2845
3220
          case $version_type in
2846
 
          darwin|linux|osf|windows)
 
3221
          darwin|linux|osf|windows|none)
2847
3222
            current=`expr $number_major + $number_minor`
2848
3223
            age="$number_minor"
2849
3224
            revision="$number_revision"
2869
3244
 
2870
3245
        # Check that each of the things are valid numbers.
2871
3246
        case $current in
2872
 
        [0-9]*) ;;
 
3247
        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]) ;;
2873
3248
        *)
2874
 
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
3249
          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2875
3250
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2876
 
          exit 1
 
3251
          exit $EXIT_FAILURE
2877
3252
          ;;
2878
3253
        esac
2879
3254
 
2880
3255
        case $revision in
2881
 
        [0-9]*) ;;
 
3256
        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]) ;;
2882
3257
        *)
2883
 
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
3258
          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2884
3259
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2885
 
          exit 1
 
3260
          exit $EXIT_FAILURE
2886
3261
          ;;
2887
3262
        esac
2888
3263
 
2889
3264
        case $age in
2890
 
        [0-9]*) ;;
 
3265
        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]) ;;
2891
3266
        *)
2892
 
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
3267
          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2893
3268
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2894
 
          exit 1
 
3269
          exit $EXIT_FAILURE
2895
3270
          ;;
2896
3271
        esac
2897
3272
 
2898
3273
        if test "$age" -gt "$current"; then
2899
3274
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2900
3275
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2901
 
          exit 1
 
3276
          exit $EXIT_FAILURE
2902
3277
        fi
2903
3278
 
2904
3279
        # Calculate the version variables.
2915
3290
          versuffix="$major.$age.$revision"
2916
3291
          # Darwin ld doesn't like 0 for these options...
2917
3292
          minor_current=`expr $current + 1`
2918
 
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
3293
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2919
3294
          ;;
2920
3295
 
2921
3296
        freebsd-aout)
2987
3362
        *)
2988
3363
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2989
3364
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2990
 
          exit 1
 
3365
          exit $EXIT_FAILURE
2991
3366
          ;;
2992
3367
        esac
2993
3368
 
3041
3416
            *.$objext)
3042
3417
               ;;
3043
3418
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 
3419
               if test "X$precious_files_regex" != "X"; then
 
3420
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3421
                 then
 
3422
                   continue
 
3423
                 fi
 
3424
               fi
3044
3425
               removelist="$removelist $p"
3045
3426
               ;;
3046
3427
            *) ;;
3061
3442
      fi
3062
3443
 
3063
3444
      # Eliminate all temporary directories.
3064
 
      for path in $notinst_path; do
3065
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3066
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3067
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3068
 
      done
 
3445
#      for path in $notinst_path; do
 
3446
#       lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3447
#       deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3448
#       dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
 
3449
#      done
3069
3450
 
3070
3451
      if test -n "$xrpath"; then
3071
3452
        # If the user specified any rpath flags, then add them.
3115
3496
          *-*-netbsd*)
3116
3497
            # Don't link with libc until the a.out ld.so is fixed.
3117
3498
            ;;
3118
 
          *-*-openbsd* | *-*-freebsd*)
 
3499
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3119
3500
            # Do not include libc due to us having libc/libc_r.
3120
 
            test "X$arg" = "X-lc" && continue
 
3501
            ;;
 
3502
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3503
            # Causes problems with __ctype
 
3504
            ;;
 
3505
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3506
            # Compiler inserts libc in the correct place for threads to work
3121
3507
            ;;
3122
3508
          *)
3123
3509
            # Add libc to deplibs on all other systems if necessary.
3161
3547
          int main() { return 0; }
3162
3548
EOF
3163
3549
          $rm conftest
3164
 
          $LTCC -o conftest conftest.c $deplibs
3165
 
          if test "$?" -eq 0 ; then
 
3550
      if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3166
3551
            ldd_output=`ldd conftest`
3167
3552
            for i in $deplibs; do
3168
 
              name="`expr $i : '-l\(.*\)'`"
 
3553
              name=`expr $i : '-l\(.*\)'`
3169
3554
              # If $name is empty we are operating on a -L argument.
3170
 
              if test "$name" != "" && test "$name" -ne "0"; then
 
3555
              if test "$name" != "" && test "$name" != "0"; then
3171
3556
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3172
3557
                  case " $predeps $postdeps " in
3173
3558
                  *" $i "*)
3202
3587
            # Error occurred in the first compile.  Let's try to salvage
3203
3588
            # the situation: Compile a separate program for each library.
3204
3589
            for i in $deplibs; do
3205
 
              name="`expr $i : '-l\(.*\)'`"
 
3590
              name=`expr $i : '-l\(.*\)'`
3206
3591
              # If $name is empty we are operating on a -L argument.
3207
3592
              if test "$name" != "" && test "$name" != "0"; then
3208
3593
                $rm conftest
3209
 
                $LTCC -o conftest conftest.c $i
3210
 
                # Did it work?
3211
 
                if test "$?" -eq 0 ; then
 
3594
                if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3212
3595
                  ldd_output=`ldd conftest`
3213
3596
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3214
3597
                    case " $predeps $postdeps " in
3240
3623
                  droppeddeps=yes
3241
3624
                  $echo
3242
3625
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3243
 
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3626
                  $echo "*** make it link in!  You will probably need to install it or some"
3244
3627
                  $echo "*** library that it depends on before this library will be fully"
3245
3628
                  $echo "*** functional.  Installing it before continuing would be even better."
3246
3629
                fi
3254
3637
          set dummy $deplibs_check_method
3255
3638
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3256
3639
          for a_deplib in $deplibs; do
3257
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3640
            name=`expr $a_deplib : '-l\(.*\)'`
3258
3641
            # If $name is empty we are operating on a -L argument.
3259
3642
            if test "$name" != "" && test  "$name" != "0"; then
3260
3643
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3323
3706
          set dummy $deplibs_check_method
3324
3707
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3325
3708
          for a_deplib in $deplibs; do
3326
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3709
            name=`expr $a_deplib : '-l\(.*\)'`
3327
3710
            # If $name is empty we are operating on a -L argument.
3328
3711
            if test -n "$name" && test "$name" != "0"; then
3329
3712
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3453
3836
        deplibs=$newdeplibs
3454
3837
      fi
3455
3838
 
 
3839
 
 
3840
      # move library search paths that coincide with paths to not yet
 
3841
      # installed libraries to the beginning of the library search list
 
3842
      new_libs=
 
3843
      for path in $notinst_path; do
 
3844
        case " $new_libs " in
 
3845
        *" -L$path/$objdir "*) ;;
 
3846
        *)
 
3847
          case " $deplibs " in
 
3848
          *" -L$path/$objdir "*)
 
3849
            new_libs="$new_libs -L$path/$objdir" ;;
 
3850
          esac
 
3851
          ;;
 
3852
        esac
 
3853
      done
 
3854
      for deplib in $deplibs; do
 
3855
        case $deplib in
 
3856
        -L*)
 
3857
          case " $new_libs " in
 
3858
          *" $deplib "*) ;;
 
3859
          *) new_libs="$new_libs $deplib" ;;
 
3860
          esac
 
3861
          ;;
 
3862
        *) new_libs="$new_libs $deplib" ;;
 
3863
        esac
 
3864
      done
 
3865
      deplibs="$new_libs"
 
3866
 
 
3867
 
3456
3868
      # All the library-specific variables (install_libdir is set above).
3457
3869
      library_names=
3458
3870
      old_library=
3520
3932
        fi
3521
3933
 
3522
3934
        # Get the real and link names of the library.
3523
 
        eval shared_ext=\"$shrext\"
 
3935
        eval shared_ext=\"$shrext_cmds\"
3524
3936
        eval library_names=\"$library_names_spec\"
3525
3937
        set dummy $library_names
3526
3938
        realname="$2"
3536
3948
        fi
3537
3949
 
3538
3950
        lib="$output_objdir/$realname"
 
3951
        linknames=
3539
3952
        for link
3540
3953
        do
3541
3954
          linknames="$linknames $link"
3550
3963
            $show "generating symbol list for \`$libname.la'"
3551
3964
            export_symbols="$output_objdir/$libname.exp"
3552
3965
            $run $rm $export_symbols
3553
 
            eval cmds=\"$export_symbols_cmds\"
 
3966
            cmds=$export_symbols_cmds
3554
3967
            save_ifs="$IFS"; IFS='~'
3555
3968
            for cmd in $cmds; do
3556
3969
              IFS="$save_ifs"
 
3970
              eval cmd=\"$cmd\"
3557
3971
              if len=`expr "X$cmd" : ".*"` &&
3558
3972
               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3559
3973
                $show "$cmd"
3563
3977
                # The command line is too long to execute in one step.
3564
3978
                $show "using reloadable object file for export list..."
3565
3979
                skipped_export=:
 
3980
                # Break out early, otherwise skipped_export may be
 
3981
                # set to false by a later but shorter cmd.
 
3982
                break
3566
3983
              fi
3567
3984
            done
3568
3985
            IFS="$save_ifs"
3583
4000
        for test_deplib in $deplibs; do
3584
4001
                case " $convenience " in
3585
4002
                *" $test_deplib "*) ;;
3586
 
                *) 
 
4003
                *)
3587
4004
                        tmp_deplibs="$tmp_deplibs $test_deplib"
3588
4005
                        ;;
3589
4006
                esac
3590
4007
        done
3591
 
        deplibs="$tmp_deplibs" 
 
4008
        deplibs="$tmp_deplibs"
3592
4009
 
3593
4010
        if test -n "$convenience"; then
3594
4011
          if test -n "$whole_archive_flag_spec"; then
3596
4013
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3597
4014
          else
3598
4015
            gentop="$output_objdir/${outputname}x"
3599
 
            $show "${rm}r $gentop"
3600
 
            $run ${rm}r "$gentop"
3601
 
            $show "$mkdir $gentop"
3602
 
            $run $mkdir "$gentop"
3603
 
            status=$?
3604
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
3605
 
              exit $status
3606
 
            fi
3607
4016
            generated="$generated $gentop"
3608
4017
 
3609
 
            for xlib in $convenience; do
3610
 
              # Extract the objects.
3611
 
              case $xlib in
3612
 
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3613
 
              *) xabs=`pwd`"/$xlib" ;;
3614
 
              esac
3615
 
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3616
 
              xdir="$gentop/$xlib"
3617
 
 
3618
 
              $show "${rm}r $xdir"
3619
 
              $run ${rm}r "$xdir"
3620
 
              $show "$mkdir $xdir"
3621
 
              $run $mkdir "$xdir"
3622
 
              status=$?
3623
 
              if test "$status" -ne 0 && test ! -d "$xdir"; then
3624
 
                exit $status
3625
 
              fi
3626
 
              # We will extract separately just the conflicting names and we will no
3627
 
              # longer touch any unique names. It is faster to leave these extract
3628
 
              # automatically by $AR in one run.
3629
 
              $show "(cd $xdir && $AR x $xabs)"
3630
 
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3631
 
              if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3632
 
                :
3633
 
              else
3634
 
                $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3635
 
                $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3636
 
                $AR t "$xabs" | sort | uniq -cd | while read -r count name
3637
 
                do
3638
 
                  i=1
3639
 
                  while test "$i" -le "$count"
3640
 
                  do
3641
 
                   # Put our $i before any first dot (extension)
3642
 
                   # Never overwrite any file
3643
 
                   name_to="$name"
3644
 
                   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3645
 
                   do
3646
 
                     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3647
 
                   done
3648
 
                   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3649
 
                   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3650
 
                   i=`expr $i + 1`
3651
 
                  done
3652
 
                done
3653
 
              fi
3654
 
 
3655
 
              libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3656
 
            done
 
4018
            func_extract_archives $gentop $convenience
 
4019
            libobjs="$libobjs $func_extract_archives_result"
3657
4020
          fi
3658
4021
        fi
3659
 
 
 
4022
        
3660
4023
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3661
4024
          eval flag=\"$thread_safe_flag_spec\"
3662
4025
          linker_flags="$linker_flags $flag"
3670
4033
        # Do each of the archive commands.
3671
4034
        if test "$module" = yes && test -n "$module_cmds" ; then
3672
4035
          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3673
 
            eval cmds=\"$module_expsym_cmds\"
 
4036
            eval test_cmds=\"$module_expsym_cmds\"
 
4037
            cmds=$module_expsym_cmds
3674
4038
          else
3675
 
            eval cmds=\"$module_cmds\"
 
4039
            eval test_cmds=\"$module_cmds\"
 
4040
            cmds=$module_cmds
3676
4041
          fi
3677
4042
        else
3678
4043
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3679
 
          eval cmds=\"$archive_expsym_cmds\"
 
4044
          eval test_cmds=\"$archive_expsym_cmds\"
 
4045
          cmds=$archive_expsym_cmds
3680
4046
        else
3681
 
          eval cmds=\"$archive_cmds\"
 
4047
          eval test_cmds=\"$archive_cmds\"
 
4048
          cmds=$archive_cmds
3682
4049
          fi
3683
4050
        fi
3684
4051
 
3685
 
        if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
 
4052
        if test "X$skipped_export" != "X:" &&
 
4053
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3686
4054
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3687
4055
          :
3688
4056
        else
3701
4069
            save_libobjs=$libobjs
3702
4070
          fi
3703
4071
          save_output=$output
 
4072
          output_la=`$echo "X$output" | $Xsed -e "$basename"`
3704
4073
 
3705
4074
          # Clear the reloadable object creation command queue and
3706
4075
          # initialize k to one.
3710
4079
          delfiles=
3711
4080
          last_robj=
3712
4081
          k=1
3713
 
          output=$output_objdir/$save_output-${k}.$objext
 
4082
          output=$output_objdir/$output_la-${k}.$objext
3714
4083
          # Loop over the list of objects to be linked.
3715
4084
          for obj in $save_libobjs
3716
4085
          do
3717
4086
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3718
4087
            if test "X$objlist" = X ||
3719
 
               { len=`expr "X$test_cmds" : ".*"` &&
 
4088
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3720
4089
                 test "$len" -le "$max_cmd_len"; }; then
3721
4090
              objlist="$objlist $obj"
3722
4091
            else
3730
4099
                # the last one created.
3731
4100
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3732
4101
              fi
3733
 
              last_robj=$output_objdir/$save_output-${k}.$objext
 
4102
              last_robj=$output_objdir/$output_la-${k}.$objext
3734
4103
              k=`expr $k + 1`
3735
 
              output=$output_objdir/$save_output-${k}.$objext
 
4104
              output=$output_objdir/$output_la-${k}.$objext
3736
4105
              objlist=$obj
3737
4106
              len=1
3738
4107
            fi
3752
4121
            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3753
4122
          fi
3754
4123
 
3755
 
          # Set up a command to remove the reloadale object files
 
4124
          # Set up a command to remove the reloadable object files
3756
4125
          # after they are used.
3757
4126
          i=0
3758
4127
          while test "$i" -lt "$k"
3759
4128
          do
3760
4129
            i=`expr $i + 1`
3761
 
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
 
4130
            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3762
4131
          done
3763
4132
 
3764
4133
          $echo "creating a temporary reloadable object file: $output"
3783
4152
          # value of $libobjs for piecewise linking.
3784
4153
 
3785
4154
          # Do each of the archive commands.
 
4155
          if test "$module" = yes && test -n "$module_cmds" ; then
 
4156
            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 
4157
              cmds=$module_expsym_cmds
 
4158
            else
 
4159
              cmds=$module_cmds
 
4160
            fi
 
4161
          else
3786
4162
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3787
 
            eval cmds=\"$archive_expsym_cmds\"
 
4163
            cmds=$archive_expsym_cmds
3788
4164
          else
3789
 
            eval cmds=\"$archive_cmds\"
 
4165
            cmds=$archive_cmds
 
4166
            fi
3790
4167
          fi
3791
4168
 
3792
4169
          # Append the command to remove the reloadable object files
3793
4170
          # to the just-reset $cmds.
3794
 
          eval cmds=\"\$cmds~$rm $delfiles\"
 
4171
          eval cmds=\"\$cmds~\$rm $delfiles\"
3795
4172
        fi
3796
4173
        save_ifs="$IFS"; IFS='~'
3797
4174
        for cmd in $cmds; do
3798
4175
          IFS="$save_ifs"
 
4176
          eval cmd=\"$cmd\"
3799
4177
          $show "$cmd"
3800
 
          $run eval "$cmd" || exit $?
 
4178
          $run eval "$cmd" || {
 
4179
            lt_exit=$?
 
4180
 
 
4181
            # Restore the uninstalled library and exit
 
4182
            if test "$mode" = relink; then
 
4183
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4184
            fi
 
4185
 
 
4186
            exit $lt_exit
 
4187
          }
3801
4188
        done
3802
4189
        IFS="$save_ifs"
3803
4190
 
3804
4191
        # Restore the uninstalled library and exit
3805
4192
        if test "$mode" = relink; then
3806
4193
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3807
 
          exit 0
 
4194
 
 
4195
          if test -n "$convenience"; then
 
4196
            if test -z "$whole_archive_flag_spec"; then
 
4197
              $show "${rm}r $gentop"
 
4198
              $run ${rm}r "$gentop"
 
4199
            fi
 
4200
          fi
 
4201
 
 
4202
          exit $EXIT_SUCCESS
3808
4203
        fi
3809
4204
 
3810
4205
        # Create links to the real library.
3852
4247
      *.lo)
3853
4248
        if test -n "$objs$old_deplibs"; then
3854
4249
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3855
 
          exit 1
 
4250
          exit $EXIT_FAILURE
3856
4251
        fi
3857
4252
        libobj="$output"
3858
4253
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3873
4268
      reload_conv_objs=
3874
4269
      gentop=
3875
4270
      # reload_cmds runs $LD directly, so let us get rid of
3876
 
      # -Wl from whole_archive_flag_spec
 
4271
      # -Wl from whole_archive_flag_spec and hope we can get by with
 
4272
      # turning comma into space..
3877
4273
      wl=
3878
4274
 
3879
4275
      if test -n "$convenience"; then
3880
4276
        if test -n "$whole_archive_flag_spec"; then
3881
 
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
 
4277
          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
 
4278
      reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
3882
4279
        else
3883
4280
          gentop="$output_objdir/${obj}x"
3884
 
          $show "${rm}r $gentop"
3885
 
          $run ${rm}r "$gentop"
3886
 
          $show "$mkdir $gentop"
3887
 
          $run $mkdir "$gentop"
3888
 
          status=$?
3889
 
          if test "$status" -ne 0 && test ! -d "$gentop"; then
3890
 
            exit $status
3891
 
          fi
3892
4281
          generated="$generated $gentop"
3893
4282
 
3894
 
          for xlib in $convenience; do
3895
 
            # Extract the objects.
3896
 
            case $xlib in
3897
 
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3898
 
            *) xabs=`pwd`"/$xlib" ;;
3899
 
            esac
3900
 
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3901
 
            xdir="$gentop/$xlib"
3902
 
 
3903
 
            $show "${rm}r $xdir"
3904
 
            $run ${rm}r "$xdir"
3905
 
            $show "$mkdir $xdir"
3906
 
            $run $mkdir "$xdir"
3907
 
            status=$?
3908
 
            if test "$status" -ne 0 && test ! -d "$xdir"; then
3909
 
              exit $status
3910
 
            fi
3911
 
            # We will extract separately just the conflicting names and we will no
3912
 
            # longer touch any unique names. It is faster to leave these extract
3913
 
            # automatically by $AR in one run.
3914
 
            $show "(cd $xdir && $AR x $xabs)"
3915
 
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3916
 
            if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3917
 
              :
3918
 
            else
3919
 
              $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3920
 
              $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3921
 
              $AR t "$xabs" | sort | uniq -cd | while read -r count name
3922
 
              do
3923
 
                i=1
3924
 
                while test "$i" -le "$count"
3925
 
                do
3926
 
                 # Put our $i before any first dot (extension)
3927
 
                 # Never overwrite any file
3928
 
                 name_to="$name"
3929
 
                 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3930
 
                 do
3931
 
                   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3932
 
                 done
3933
 
                 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3934
 
                 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3935
 
                 i=`expr $i + 1`
3936
 
                done
3937
 
              done
3938
 
            fi
3939
 
 
3940
 
            reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3941
 
          done
 
4283
          func_extract_archives $gentop $convenience
 
4284
          reload_conv_objs="$reload_objs $func_extract_archives_result"
3942
4285
        fi
3943
4286
      fi
3944
4287
 
3946
4289
      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
3947
4290
 
3948
4291
      output="$obj"
3949
 
      eval cmds=\"$reload_cmds\"
 
4292
      cmds=$reload_cmds
3950
4293
      save_ifs="$IFS"; IFS='~'
3951
4294
      for cmd in $cmds; do
3952
4295
        IFS="$save_ifs"
 
4296
        eval cmd=\"$cmd\"
3953
4297
        $show "$cmd"
3954
4298
        $run eval "$cmd" || exit $?
3955
4299
      done
3962
4306
          $run ${rm}r $gentop
3963
4307
        fi
3964
4308
 
3965
 
        exit 0
 
4309
        exit $EXIT_SUCCESS
3966
4310
      fi
3967
4311
 
3968
4312
      if test "$build_libtool_libs" != yes; then
3975
4319
        # accidentally link it into a program.
3976
4320
        # $show "echo timestamp > $libobj"
3977
4321
        # $run eval "echo timestamp > $libobj" || exit $?
3978
 
        exit 0
 
4322
        exit $EXIT_SUCCESS
3979
4323
      fi
3980
4324
 
3981
4325
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3982
4326
        # Only do commands if we really have different PIC objects.
3983
4327
        reload_objs="$libobjs $reload_conv_objs"
3984
4328
        output="$libobj"
3985
 
        eval cmds=\"$reload_cmds\"
 
4329
        cmds=$reload_cmds
3986
4330
        save_ifs="$IFS"; IFS='~'
3987
4331
        for cmd in $cmds; do
3988
4332
          IFS="$save_ifs"
 
4333
          eval cmd=\"$cmd\"
3989
4334
          $show "$cmd"
3990
4335
          $run eval "$cmd" || exit $?
3991
4336
        done
3997
4342
        $run ${rm}r $gentop
3998
4343
      fi
3999
4344
 
4000
 
      exit 0
 
4345
      exit $EXIT_SUCCESS
4001
4346
      ;;
4002
4347
 
4003
4348
    prog)
4037
4382
        ;;
4038
4383
      esac
4039
4384
 
 
4385
 
 
4386
      # move library search paths that coincide with paths to not yet
 
4387
      # installed libraries to the beginning of the library search list
 
4388
      new_libs=
 
4389
      for path in $notinst_path; do
 
4390
        case " $new_libs " in
 
4391
        *" -L$path/$objdir "*) ;;
 
4392
        *)
 
4393
          case " $compile_deplibs " in
 
4394
          *" -L$path/$objdir "*)
 
4395
            new_libs="$new_libs -L$path/$objdir" ;;
 
4396
          esac
 
4397
          ;;
 
4398
        esac
 
4399
      done
 
4400
      for deplib in $compile_deplibs; do
 
4401
        case $deplib in
 
4402
        -L*)
 
4403
          case " $new_libs " in
 
4404
          *" $deplib "*) ;;
 
4405
          *) new_libs="$new_libs $deplib" ;;
 
4406
          esac
 
4407
          ;;
 
4408
        *) new_libs="$new_libs $deplib" ;;
 
4409
        esac
 
4410
      done
 
4411
      compile_deplibs="$new_libs"
 
4412
 
 
4413
 
4040
4414
      compile_command="$compile_command $compile_deplibs"
4041
4415
      finalize_command="$finalize_command $finalize_deplibs"
4042
4416
 
4081
4455
        fi
4082
4456
        case $host in
4083
4457
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4458
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4084
4459
          case :$dllsearchpath: in
4085
4460
          *":$libdir:"*) ;;
4086
4461
          *) dllsearchpath="$dllsearchpath:$libdir";;
4087
4462
          esac
 
4463
          case :$dllsearchpath: in
 
4464
          *":$testbindir:"*) ;;
 
4465
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4466
          esac
4088
4467
          ;;
4089
4468
        esac
4090
4469
      done
4198
4577
 
4199
4578
            # Prepare the list of exported symbols
4200
4579
            if test -z "$export_symbols"; then
4201
 
              export_symbols="$output_objdir/$output.exp"
 
4580
              export_symbols="$output_objdir/$outputname.exp"
4202
4581
              $run $rm $export_symbols
4203
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4582
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4583
              case $host in
 
4584
              *cygwin* | *mingw* )
 
4585
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4586
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4587
                ;;
 
4588
              esac
4204
4589
            else
4205
 
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4206
 
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
4590
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4591
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4207
4592
              $run eval 'mv "$nlist"T "$nlist"'
 
4593
              case $host in
 
4594
              *cygwin* | *mingw* )
 
4595
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4596
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4597
                ;;
 
4598
              esac
4208
4599
            fi
4209
4600
          fi
4210
4601
 
4255
4646
#endif
4256
4647
 
4257
4648
/* The mapping between symbol names and symbols. */
 
4649
"
 
4650
 
 
4651
            case $host in
 
4652
            *cygwin* | *mingw* )
 
4653
          $echo >> "$output_objdir/$dlsyms" "\
 
4654
/* DATA imports from DLLs on WIN32 can't be const, because
 
4655
   runtime relocations are performed -- see ld's documentation
 
4656
   on pseudo-relocs */
 
4657
struct {
 
4658
"
 
4659
              ;;
 
4660
            * )
 
4661
          $echo >> "$output_objdir/$dlsyms" "\
4258
4662
const struct {
 
4663
"
 
4664
              ;;
 
4665
            esac
 
4666
 
 
4667
 
 
4668
          $echo >> "$output_objdir/$dlsyms" "\
4259
4669
  const char *name;
4260
4670
  lt_ptr address;
4261
4671
}
4302
4712
          esac
4303
4713
 
4304
4714
          # Now compile the dynamic symbol file.
4305
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4306
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4715
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4716
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4307
4717
 
4308
4718
          # Clean up the generated files.
4309
4719
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4310
4720
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4311
4721
 
4312
4722
          # Transform the symbol file into the correct name.
4313
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4314
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4723
          case $host in
 
4724
          *cygwin* | *mingw* )
 
4725
            if test -f "$output_objdir/${outputname}.def" ; then
 
4726
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4727
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4728
            else
 
4729
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4730
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4731
             fi
 
4732
            ;;
 
4733
          * )
 
4734
            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4735
            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4736
            ;;
 
4737
          esac
4315
4738
          ;;
4316
4739
        *)
4317
4740
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4318
 
          exit 1
 
4741
          exit $EXIT_FAILURE
4319
4742
          ;;
4320
4743
        esac
4321
4744
      else
4324
4747
        # really was required.
4325
4748
 
4326
4749
        # Nullify the symbol file.
4327
 
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4328
 
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
 
4750
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
 
4751
        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4329
4752
      fi
4330
4753
 
4331
4754
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4332
4755
        # Replace the output file specification.
4333
 
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
4756
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4334
4757
        link_command="$compile_command$compile_rpath"
4335
4758
 
4336
4759
        # We have no uninstalled library dependencies, so finalize right now.
4337
4760
        $show "$link_command"
4338
4761
        $run eval "$link_command"
4339
 
        status=$?
 
4762
        exit_status=$?
4340
4763
 
4341
4764
        # Delete the generated files.
4342
4765
        if test -n "$dlsyms"; then
4344
4767
          $run $rm "$output_objdir/${outputname}S.${objext}"
4345
4768
        fi
4346
4769
 
4347
 
        exit $status
 
4770
        exit $exit_status
4348
4771
      fi
4349
4772
 
4350
4773
      if test -n "$shlibpath_var"; then
4403
4826
        # Link the executable and exit
4404
4827
        $show "$link_command"
4405
4828
        $run eval "$link_command" || exit $?
4406
 
        exit 0
 
4829
        exit $EXIT_SUCCESS
4407
4830
      fi
4408
4831
 
4409
4832
      if test "$hardcode_action" = relink; then
4417
4840
        if test "$fast_install" != no; then
4418
4841
          link_command="$finalize_var$compile_command$finalize_rpath"
4419
4842
          if test "$fast_install" = yes; then
4420
 
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
 
4843
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4421
4844
          else
4422
4845
            # fast_install is set to needless
4423
4846
            relink_command=
4454
4877
          fi
4455
4878
        done
4456
4879
        relink_command="(cd `pwd`; $relink_command)"
4457
 
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
4880
        relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4458
4881
      fi
4459
4882
 
4460
4883
      # Quote $echo for shipping.
4461
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4462
 
        case $0 in
4463
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4464
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4884
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4885
        case $progpath in
 
4886
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4887
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4465
4888
        esac
4466
4889
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4467
4890
      else
4484
4907
        esac
4485
4908
        case $host in
4486
4909
          *cygwin* | *mingw* )
4487
 
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4488
 
            cwrapper=`$echo ${output}.exe`
4489
 
            $rm $cwrappersource $cwrapper
4490
 
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
 
4910
            output_name=`basename $output`
 
4911
            output_path=`dirname $output`
 
4912
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4913
            cwrapper="$output_path/$output_name.exe"
 
4914
            $rm $cwrappersource $cwrapper
 
4915
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4491
4916
 
4492
4917
            cat > $cwrappersource <<EOF
4493
4918
 
4496
4921
 
4497
4922
   The $output program cannot be directly executed until all the libtool
4498
4923
   libraries that it depends on are installed.
4499
 
   
 
4924
 
4500
4925
   This wrapper executable should never be moved out of the build directory.
4501
4926
   If it is, it will not operate correctly.
4502
4927
 
4512
4937
#include <malloc.h>
4513
4938
#include <stdarg.h>
4514
4939
#include <assert.h>
 
4940
#include <string.h>
 
4941
#include <ctype.h>
 
4942
#include <sys/stat.h>
4515
4943
 
4516
4944
#if defined(PATH_MAX)
4517
4945
# define LT_PATHMAX PATH_MAX
4522
4950
#endif
4523
4951
 
4524
4952
#ifndef DIR_SEPARATOR
4525
 
#define DIR_SEPARATOR '/'
 
4953
# define DIR_SEPARATOR '/'
 
4954
# define PATH_SEPARATOR ':'
4526
4955
#endif
4527
4956
 
4528
4957
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4529
4958
  defined (__OS2__)
4530
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4531
 
#ifndef DIR_SEPARATOR_2 
4532
 
#define DIR_SEPARATOR_2 '\\'
4533
 
#endif
 
4959
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4960
# ifndef DIR_SEPARATOR_2
 
4961
#  define DIR_SEPARATOR_2 '\\'
 
4962
# endif
 
4963
# ifndef PATH_SEPARATOR_2
 
4964
#  define PATH_SEPARATOR_2 ';'
 
4965
# endif
4534
4966
#endif
4535
4967
 
4536
4968
#ifndef DIR_SEPARATOR_2
4540
4972
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4541
4973
#endif /* DIR_SEPARATOR_2 */
4542
4974
 
 
4975
#ifndef PATH_SEPARATOR_2
 
4976
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4977
#else /* PATH_SEPARATOR_2 */
 
4978
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4979
#endif /* PATH_SEPARATOR_2 */
 
4980
 
4543
4981
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4544
4982
#define XFREE(stale) do { \
4545
4983
  if (stale) { free ((void *) stale); stale = 0; } \
4546
4984
} while (0)
4547
4985
 
 
4986
/* -DDEBUG is fairly common in CFLAGS.  */
 
4987
#undef DEBUG
 
4988
#if defined DEBUGWRAPPER
 
4989
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
4990
#else
 
4991
# define DEBUG(format, ...)
 
4992
#endif
 
4993
 
4548
4994
const char *program_name = NULL;
4549
4995
 
4550
4996
void * xmalloc (size_t num);
4551
4997
char * xstrdup (const char *string);
4552
 
char * basename (const char *name);
4553
 
char * fnqualify(const char *path);
 
4998
const char * base_name (const char *name);
 
4999
char * find_executable(const char *wrapper);
 
5000
int    check_executable(const char *path);
4554
5001
char * strendzap(char *str, const char *pat);
4555
5002
void lt_fatal (const char *message, ...);
4556
5003
 
4559
5006
{
4560
5007
  char **newargz;
4561
5008
  int i;
4562
 
  
4563
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
5009
 
 
5010
  program_name = (char *) xstrdup (base_name (argv[0]));
 
5011
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
5012
  DEBUG("(main) program_name : %s\n",program_name);
4564
5013
  newargz = XMALLOC(char *, argc+2);
4565
5014
EOF
4566
5015
 
4567
 
            cat >> $cwrappersource <<EOF
4568
 
  newargz[0] = "$SHELL";
 
5016
            cat >> $cwrappersource <<EOF
 
5017
  newargz[0] = (char *) xstrdup("$SHELL");
4569
5018
EOF
4570
5019
 
4571
 
            cat >> $cwrappersource <<"EOF"
4572
 
  newargz[1] = fnqualify(argv[0]);
 
5020
            cat >> $cwrappersource <<"EOF"
 
5021
  newargz[1] = find_executable(argv[0]);
 
5022
  if (newargz[1] == NULL)
 
5023
    lt_fatal("Couldn't find %s", argv[0]);
 
5024
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4573
5025
  /* we know the script has the same name, without the .exe */
4574
5026
  /* so make sure newargz[1] doesn't end in .exe */
4575
 
  strendzap(newargz[1],".exe"); 
 
5027
  strendzap(newargz[1],".exe");
4576
5028
  for (i = 1; i < argc; i++)
4577
5029
    newargz[i+1] = xstrdup(argv[i]);
4578
5030
  newargz[argc+1] = NULL;
4579
 
EOF
4580
 
 
4581
 
            cat >> $cwrappersource <<EOF
 
5031
 
 
5032
  for (i=0; i<argc+1; i++)
 
5033
  {
 
5034
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
5035
    ;
 
5036
  }
 
5037
 
 
5038
EOF
 
5039
 
 
5040
            case $host_os in
 
5041
              mingw*)
 
5042
                cat >> $cwrappersource <<EOF
 
5043
  execv("$SHELL",(char const **)newargz);
 
5044
EOF
 
5045
              ;;
 
5046
              *)
 
5047
                cat >> $cwrappersource <<EOF
4582
5048
  execv("$SHELL",newargz);
4583
5049
EOF
 
5050
              ;;
 
5051
            esac
4584
5052
 
4585
 
            cat >> $cwrappersource <<"EOF"
 
5053
            cat >> $cwrappersource <<"EOF"
 
5054
  return 127;
4586
5055
}
4587
5056
 
4588
5057
void *
4595
5064
  return p;
4596
5065
}
4597
5066
 
4598
 
char * 
 
5067
char *
4599
5068
xstrdup (const char *string)
4600
5069
{
4601
5070
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4602
5071
;
4603
5072
}
4604
5073
 
4605
 
char *
4606
 
basename (const char *name)
 
5074
const char *
 
5075
base_name (const char *name)
4607
5076
{
4608
5077
  const char *base;
4609
5078
 
4610
5079
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4611
5080
  /* Skip over the disk name in MSDOS pathnames. */
4612
 
  if (isalpha (name[0]) && name[1] == ':') 
 
5081
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4613
5082
    name += 2;
4614
5083
#endif
4615
5084
 
4616
5085
  for (base = name; *name; name++)
4617
5086
    if (IS_DIR_SEPARATOR (*name))
4618
5087
      base = name + 1;
4619
 
  return (char *) base;
4620
 
}
4621
 
 
4622
 
char * 
4623
 
fnqualify(const char *path)
4624
 
{
4625
 
  size_t size;
4626
 
  char *p;
 
5088
  return base;
 
5089
}
 
5090
 
 
5091
int
 
5092
check_executable(const char * path)
 
5093
{
 
5094
  struct stat st;
 
5095
 
 
5096
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
 
5097
  if ((!path) || (!*path))
 
5098
    return 0;
 
5099
 
 
5100
  if ((stat (path, &st) >= 0) &&
 
5101
      (
 
5102
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5103
#if defined (S_IXOTH)
 
5104
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
5105
#endif
 
5106
#if defined (S_IXGRP)
 
5107
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
5108
#endif
 
5109
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5110
      )
 
5111
    return 1;
 
5112
  else
 
5113
    return 0;
 
5114
}
 
5115
 
 
5116
/* Searches for the full path of the wrapper.  Returns
 
5117
   newly allocated full path name if found, NULL otherwise */
 
5118
char *
 
5119
find_executable (const char* wrapper)
 
5120
{
 
5121
  int has_slash = 0;
 
5122
  const char* p;
 
5123
  const char* p_next;
 
5124
  /* static buffer for getcwd */
4627
5125
  char tmp[LT_PATHMAX + 1];
4628
 
 
4629
 
  assert(path != NULL);
4630
 
 
4631
 
  /* Is it qualified already? */
4632
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4633
 
  if (isalpha (path[0]) && path[1] == ':')
4634
 
    return xstrdup (path);
4635
 
#endif
4636
 
  if (IS_DIR_SEPARATOR (path[0]))
4637
 
    return xstrdup (path);
4638
 
 
4639
 
  /* prepend the current directory */
4640
 
  /* doesn't handle '~' */
 
5126
  int tmp_len;
 
5127
  char* concat_name;
 
5128
 
 
5129
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
 
5130
 
 
5131
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
5132
    return NULL;
 
5133
 
 
5134
  /* Absolute path? */
 
5135
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5136
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
5137
  {
 
5138
    concat_name = xstrdup (wrapper);
 
5139
    if (check_executable(concat_name))
 
5140
      return concat_name;
 
5141
    XFREE(concat_name);
 
5142
  }
 
5143
  else
 
5144
  {
 
5145
#endif
 
5146
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
5147
    {
 
5148
      concat_name = xstrdup (wrapper);
 
5149
      if (check_executable(concat_name))
 
5150
        return concat_name;
 
5151
      XFREE(concat_name);
 
5152
    }
 
5153
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5154
  }
 
5155
#endif
 
5156
 
 
5157
  for (p = wrapper; *p; p++)
 
5158
    if (*p == '/')
 
5159
    {
 
5160
      has_slash = 1;
 
5161
      break;
 
5162
    }
 
5163
  if (!has_slash)
 
5164
  {
 
5165
    /* no slashes; search PATH */
 
5166
    const char* path = getenv ("PATH");
 
5167
    if (path != NULL)
 
5168
    {
 
5169
      for (p = path; *p; p = p_next)
 
5170
      {
 
5171
        const char* q;
 
5172
        size_t p_len;
 
5173
        for (q = p; *q; q++)
 
5174
          if (IS_PATH_SEPARATOR(*q))
 
5175
            break;
 
5176
        p_len = q - p;
 
5177
        p_next = (*q == '\0' ? q : q + 1);
 
5178
        if (p_len == 0)
 
5179
        {
 
5180
          /* empty path: current directory */
 
5181
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5182
            lt_fatal ("getcwd failed");
 
5183
          tmp_len = strlen(tmp);
 
5184
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5185
          memcpy (concat_name, tmp, tmp_len);
 
5186
          concat_name[tmp_len] = '/';
 
5187
          strcpy (concat_name + tmp_len + 1, wrapper);
 
5188
        }
 
5189
        else
 
5190
        {
 
5191
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
5192
          memcpy (concat_name, p, p_len);
 
5193
          concat_name[p_len] = '/';
 
5194
          strcpy (concat_name + p_len + 1, wrapper);
 
5195
        }
 
5196
        if (check_executable(concat_name))
 
5197
          return concat_name;
 
5198
        XFREE(concat_name);
 
5199
      }
 
5200
    }
 
5201
    /* not found in PATH; assume curdir */
 
5202
  }
 
5203
  /* Relative path | not found in path: prepend cwd */
4641
5204
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4642
5205
    lt_fatal ("getcwd failed");
4643
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4644
 
  p = XMALLOC(char, size);
4645
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4646
 
  return p;
 
5206
  tmp_len = strlen(tmp);
 
5207
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5208
  memcpy (concat_name, tmp, tmp_len);
 
5209
  concat_name[tmp_len] = '/';
 
5210
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5211
 
 
5212
  if (check_executable(concat_name))
 
5213
    return concat_name;
 
5214
  XFREE(concat_name);
 
5215
  return NULL;
4647
5216
}
4648
5217
 
4649
5218
char *
4650
 
strendzap(char *str, const char *pat) 
 
5219
strendzap(char *str, const char *pat)
4651
5220
{
4652
5221
  size_t len, patlen;
4653
5222
 
4667
5236
}
4668
5237
 
4669
5238
static void
4670
 
lt_error_core (int exit_status, const char * mode, 
 
5239
lt_error_core (int exit_status, const char * mode,
4671
5240
          const char * message, va_list ap)
4672
5241
{
4673
5242
  fprintf (stderr, "%s: %s: ", program_name, mode);
4687
5256
  va_end (ap);
4688
5257
}
4689
5258
EOF
4690
 
          # we should really use a build-platform specific compiler
4691
 
          # here, but OTOH, the wrappers (shell script and this C one)
4692
 
          # are only useful if you want to execute the "real" binary.
4693
 
          # Since the "real" binary is built for $host, then this
4694
 
          # wrapper might as well be built for $host, too.
4695
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4696
 
          ;;
4697
 
        esac
4698
 
        $rm $output
4699
 
        trap "$rm $output; exit 1" 1 2 15
 
5259
          # we should really use a build-platform specific compiler
 
5260
          # here, but OTOH, the wrappers (shell script and this C one)
 
5261
          # are only useful if you want to execute the "real" binary.
 
5262
          # Since the "real" binary is built for $host, then this
 
5263
          # wrapper might as well be built for $host, too.
 
5264
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5265
          ;;
 
5266
        esac
 
5267
        $rm $output
 
5268
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4700
5269
 
4701
5270
        $echo > $output "\
4702
5271
#! $SHELL
4715
5284
Xsed='${SED} -e 1s/^X//'
4716
5285
sed_quote_subst='$sed_quote_subst'
4717
5286
 
 
5287
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
 
5288
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
 
5289
  emulate sh
 
5290
  NULLCMD=:
 
5291
  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
 
5292
  # is contrary to our usage.  Disable this feature.
 
5293
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
 
5294
  setopt NO_GLOB_SUBST
 
5295
else
 
5296
  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
 
5297
fi
 
5298
 
4718
5299
# The HP-UX ksh and POSIX shell print the target directory to stdout
4719
5300
# if CDPATH is set.
4720
 
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
5301
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4721
5302
 
4722
5303
relink_command=\"$relink_command\"
4723
5304
 
4796
5377
      else
4797
5378
        $echo \"\$relink_command_output\" >&2
4798
5379
        $rm \"\$progdir/\$file\"
4799
 
        exit 1
 
5380
        exit $EXIT_FAILURE
4800
5381
      fi
4801
5382
    fi
4802
5383
 
4846
5427
        # Backslashes separate directories on plain windows
4847
5428
        *-*-mingw | *-*-os2*)
4848
5429
          $echo >> $output "\
4849
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5430
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4850
5431
"
4851
5432
          ;;
4852
5433
 
4853
5434
        *)
4854
5435
          $echo >> $output "\
4855
 
      exec \$progdir/\$program \${1+\"\$@\"}
 
5436
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
4856
5437
"
4857
5438
          ;;
4858
5439
        esac
4859
5440
        $echo >> $output "\
4860
 
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4861
 
      exit 1
 
5441
      \$echo \"\$0: cannot exec \$program \$*\"
 
5442
      exit $EXIT_FAILURE
4862
5443
    fi
4863
5444
  else
4864
5445
    # The program doesn't exist.
4865
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5446
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4866
5447
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4867
5448
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4868
 
    exit 1
 
5449
    exit $EXIT_FAILURE
4869
5450
  fi
4870
5451
fi\
4871
5452
"
4872
5453
        chmod +x $output
4873
5454
      fi
4874
 
      exit 0
 
5455
      exit $EXIT_SUCCESS
4875
5456
      ;;
4876
5457
    esac
4877
5458
 
4894
5475
 
4895
5476
      if test -n "$addlibs"; then
4896
5477
        gentop="$output_objdir/${outputname}x"
4897
 
        $show "${rm}r $gentop"
4898
 
        $run ${rm}r "$gentop"
4899
 
        $show "$mkdir $gentop"
4900
 
        $run $mkdir "$gentop"
4901
 
        status=$?
4902
 
        if test "$status" -ne 0 && test ! -d "$gentop"; then
4903
 
          exit $status
4904
 
        fi
4905
5478
        generated="$generated $gentop"
4906
5479
 
4907
 
        # Add in members from convenience archives.
4908
 
        for xlib in $addlibs; do
4909
 
          # Extract the objects.
4910
 
          case $xlib in
4911
 
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4912
 
          *) xabs=`pwd`"/$xlib" ;;
4913
 
          esac
4914
 
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4915
 
          xdir="$gentop/$xlib"
4916
 
 
4917
 
          $show "${rm}r $xdir"
4918
 
          $run ${rm}r "$xdir"
4919
 
          $show "$mkdir $xdir"
4920
 
          $run $mkdir "$xdir"
4921
 
          status=$?
4922
 
          if test "$status" -ne 0 && test ! -d "$xdir"; then
4923
 
            exit $status
4924
 
          fi
4925
 
          # We will extract separately just the conflicting names and we will no
4926
 
          # longer touch any unique names. It is faster to leave these extract
4927
 
          # automatically by $AR in one run.
4928
 
          $show "(cd $xdir && $AR x $xabs)"
4929
 
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4930
 
          if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4931
 
            :
4932
 
          else
4933
 
            $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4934
 
            $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4935
 
            $AR t "$xabs" | sort | uniq -cd | while read -r count name
4936
 
            do
4937
 
              i=1
4938
 
              while test "$i" -le "$count"
4939
 
              do
4940
 
               # Put our $i before any first dot (extension)
4941
 
               # Never overwrite any file
4942
 
               name_to="$name"
4943
 
               while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4944
 
               do
4945
 
                 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4946
 
               done
4947
 
               $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4948
 
               $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4949
 
               i=`expr $i + 1`
4950
 
              done
4951
 
            done
4952
 
          fi
4953
 
 
4954
 
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
4955
 
        done
 
5480
        func_extract_archives $gentop $addlibs
 
5481
        oldobjs="$oldobjs $func_extract_archives_result"
4956
5482
      fi
4957
5483
 
4958
5484
      # Do each command in the archive commands.
4959
5485
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4960
 
        eval cmds=\"$old_archive_from_new_cmds\"
 
5486
       cmds=$old_archive_from_new_cmds
4961
5487
      else
 
5488
        # POSIX demands no paths to be encoded in archives.  We have
 
5489
        # to avoid creating archives with duplicate basenames if we
 
5490
        # might have to extract them afterwards, e.g., when creating a
 
5491
        # static archive out of a convenience library, or when linking
 
5492
        # the entirety of a libtool archive into another (currently
 
5493
        # not supported by libtool).
 
5494
        if (for obj in $oldobjs
 
5495
            do
 
5496
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
 
5497
            done | sort | sort -uc >/dev/null 2>&1); then
 
5498
          :
 
5499
        else
 
5500
          $echo "copying selected object files to avoid basename conflicts..."
 
5501
 
 
5502
          if test -z "$gentop"; then
 
5503
            gentop="$output_objdir/${outputname}x"
 
5504
            generated="$generated $gentop"
 
5505
 
 
5506
            $show "${rm}r $gentop"
 
5507
            $run ${rm}r "$gentop"
 
5508
            $show "$mkdir $gentop"
 
5509
            $run $mkdir "$gentop"
 
5510
            exit_status=$?
 
5511
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5512
              exit $exit_status
 
5513
            fi
 
5514
          fi
 
5515
 
 
5516
          save_oldobjs=$oldobjs
 
5517
          oldobjs=
 
5518
          counter=1
 
5519
          for obj in $save_oldobjs
 
5520
          do
 
5521
            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
5522
            case " $oldobjs " in
 
5523
            " ") oldobjs=$obj ;;
 
5524
            *[\ /]"$objbase "*)
 
5525
              while :; do
 
5526
                # Make sure we don't pick an alternate name that also
 
5527
                # overlaps.
 
5528
                newobj=lt$counter-$objbase
 
5529
                counter=`expr $counter + 1`
 
5530
                case " $oldobjs " in
 
5531
                *[\ /]"$newobj "*) ;;
 
5532
                *) if test ! -f "$gentop/$newobj"; then break; fi ;;
 
5533
                esac
 
5534
              done
 
5535
              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
 
5536
              $run ln "$obj" "$gentop/$newobj" ||
 
5537
              $run cp "$obj" "$gentop/$newobj"
 
5538
              oldobjs="$oldobjs $gentop/$newobj"
 
5539
              ;;
 
5540
            *) oldobjs="$oldobjs $obj" ;;
 
5541
            esac
 
5542
          done
 
5543
        fi
 
5544
 
4962
5545
        eval cmds=\"$old_archive_cmds\"
4963
5546
 
4964
5547
        if len=`expr "X$cmds" : ".*"` &&
4965
5548
             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4966
 
          :
 
5549
          cmds=$old_archive_cmds
4967
5550
        else
4968
5551
          # the command line is too long to link in one step, link in parts
4969
5552
          $echo "using piecewise archive linking..."
4972
5555
          objlist=
4973
5556
          concat_cmds=
4974
5557
          save_oldobjs=$oldobjs
4975
 
          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
4976
 
          # encoded into archives.  This makes 'ar r' malfunction in
4977
 
          # this piecewise linking case whenever conflicting object
4978
 
          # names appear in distinct ar calls; check, warn and compensate.
4979
 
            if (for obj in $save_oldobjs
4980
 
            do
4981
 
              $echo "X$obj" | $Xsed -e 's%^.*/%%'
4982
 
            done | sort | sort -uc >/dev/null 2>&1); then
4983
 
            :
4984
 
          else
4985
 
            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
4986
 
            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
4987
 
            AR_FLAGS=cq
4988
 
          fi
 
5558
 
4989
5559
          # Is there a better way of finding the last object in the list?
4990
5560
          for obj in $save_oldobjs
4991
5561
          do
4992
5562
            last_oldobj=$obj
4993
 
          done  
 
5563
          done
4994
5564
          for obj in $save_oldobjs
4995
5565
          do
4996
5566
            oldobjs="$objlist $obj"
4997
5567
            objlist="$objlist $obj"
4998
5568
            eval test_cmds=\"$old_archive_cmds\"
4999
 
            if len=`expr "X$test_cmds" : ".*"` &&
 
5569
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5000
5570
               test "$len" -le "$max_cmd_len"; then
5001
5571
              :
5002
5572
            else
5004
5574
              oldobjs=$objlist
5005
5575
              if test "$obj" = "$last_oldobj" ; then
5006
5576
                RANLIB=$save_RANLIB
5007
 
              fi  
 
5577
              fi
5008
5578
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5009
5579
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5010
5580
              objlist=
5015
5585
          if test "X$oldobjs" = "X" ; then
5016
5586
            eval cmds=\"\$concat_cmds\"
5017
5587
          else
5018
 
            eval cmds=\"\$concat_cmds~$old_archive_cmds\"
 
5588
            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5019
5589
          fi
5020
5590
        fi
5021
5591
      fi
5022
5592
      save_ifs="$IFS"; IFS='~'
5023
5593
      for cmd in $cmds; do
 
5594
        eval cmd=\"$cmd\"
5024
5595
        IFS="$save_ifs"
5025
5596
        $show "$cmd"
5026
5597
        $run eval "$cmd" || exit $?
5052
5623
        fi
5053
5624
      done
5054
5625
      # Quote the link command for shipping.
5055
 
      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
5056
 
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5626
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
 
5627
      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
 
5628
      if test "$hardcode_automatic" = yes ; then
 
5629
        relink_command=
 
5630
      fi
 
5631
 
5057
5632
 
5058
5633
      # Only create the output if not a dry run.
5059
5634
      if test -z "$run"; then
5072
5647
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5073
5648
                if test -z "$libdir"; then
5074
5649
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5075
 
                  exit 1
 
5650
                  exit $EXIT_FAILURE
5076
5651
                fi
5077
5652
                newdependency_libs="$newdependency_libs $libdir/$name"
5078
5653
                ;;
5086
5661
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5087
5662
              if test -z "$libdir"; then
5088
5663
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5089
 
                exit 1
 
5664
                exit $EXIT_FAILURE
5090
5665
              fi
5091
5666
              newdlfiles="$newdlfiles $libdir/$name"
5092
5667
            done
5097
5672
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5098
5673
              if test -z "$libdir"; then
5099
5674
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5100
 
                exit 1
 
5675
                exit $EXIT_FAILURE
5101
5676
              fi
5102
5677
              newdlprefiles="$newdlprefiles $libdir/$name"
5103
5678
            done
5104
5679
            dlprefiles="$newdlprefiles"
 
5680
          else
 
5681
            newdlfiles=
 
5682
            for lib in $dlfiles; do
 
5683
              case $lib in
 
5684
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5685
                *) abs=`pwd`"/$lib" ;;
 
5686
              esac
 
5687
              newdlfiles="$newdlfiles $abs"
 
5688
            done
 
5689
            dlfiles="$newdlfiles"
 
5690
            newdlprefiles=
 
5691
            for lib in $dlprefiles; do
 
5692
              case $lib in
 
5693
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 
5694
                *) abs=`pwd`"/$lib" ;;
 
5695
              esac
 
5696
              newdlprefiles="$newdlprefiles $abs"
 
5697
            done
 
5698
            dlprefiles="$newdlprefiles"
5105
5699
          fi
5106
5700
          $rm $output
5107
5701
          # place dlname in correct position for cygwin
5158
5752
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5159
5753
      ;;
5160
5754
    esac
5161
 
    exit 0
 
5755
    exit $EXIT_SUCCESS
5162
5756
    ;;
5163
5757
 
5164
5758
  # libtool install mode
5169
5763
    # install_prog (especially on Windows NT).
5170
5764
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5171
5765
       # Allow the use of GNU shtool's install command.
5172
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5766
       $echo "X$nonopt" | grep shtool > /dev/null; then
5173
5767
      # Aesthetically quote it.
5174
5768
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5175
5769
      case $arg in
5176
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5770
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5177
5771
        arg="\"$arg\""
5178
5772
        ;;
5179
5773
      esac
5182
5776
      shift
5183
5777
    else
5184
5778
      install_prog=
5185
 
      arg="$nonopt"
 
5779
      arg=$nonopt
5186
5780
    fi
5187
5781
 
5188
5782
    # The real first argument should be the name of the installation program.
5189
5783
    # Aesthetically quote it.
5190
5784
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5191
5785
    case $arg in
5192
 
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
5786
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5193
5787
      arg="\"$arg\""
5194
5788
      ;;
5195
5789
    esac
5207
5801
    do
5208
5802
      if test -n "$dest"; then
5209
5803
        files="$files $dest"
5210
 
        dest="$arg"
 
5804
        dest=$arg
5211
5805
        continue
5212
5806
      fi
5213
5807
 
5214
5808
      case $arg in
5215
5809
      -d) isdir=yes ;;
5216
 
      -f) prev="-f" ;;
5217
 
      -g) prev="-g" ;;
5218
 
      -m) prev="-m" ;;
5219
 
      -o) prev="-o" ;;
 
5810
      -f) 
 
5811
        case " $install_prog " in
 
5812
        *[\\\ /]cp\ *) ;;
 
5813
        *) prev=$arg ;;
 
5814
        esac
 
5815
        ;;
 
5816
      -g | -m | -o) prev=$arg ;;
5220
5817
      -s)
5221
5818
        stripme=" -s"
5222
5819
        continue
5223
5820
        ;;
5224
 
      -*) ;;
5225
 
 
 
5821
      -*)
 
5822
        ;;
5226
5823
      *)
5227
5824
        # If the previous option needed an argument, then skip it.
5228
5825
        if test -n "$prev"; then
5229
5826
          prev=
5230
5827
        else
5231
 
          dest="$arg"
 
5828
          dest=$arg
5232
5829
          continue
5233
5830
        fi
5234
5831
        ;;
5237
5834
      # Aesthetically quote the argument.
5238
5835
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5239
5836
      case $arg in
5240
 
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
5837
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5241
5838
        arg="\"$arg\""
5242
5839
        ;;
5243
5840
      esac
5247
5844
    if test -z "$install_prog"; then
5248
5845
      $echo "$modename: you must specify an install program" 1>&2
5249
5846
      $echo "$help" 1>&2
5250
 
      exit 1
 
5847
      exit $EXIT_FAILURE
5251
5848
    fi
5252
5849
 
5253
5850
    if test -n "$prev"; then
5254
5851
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5255
5852
      $echo "$help" 1>&2
5256
 
      exit 1
 
5853
      exit $EXIT_FAILURE
5257
5854
    fi
5258
5855
 
5259
5856
    if test -z "$files"; then
5263
5860
        $echo "$modename: you must specify a destination" 1>&2
5264
5861
      fi
5265
5862
      $echo "$help" 1>&2
5266
 
      exit 1
 
5863
      exit $EXIT_FAILURE
5267
5864
    fi
5268
5865
 
5269
5866
    # Strip any trailing slash from the destination.
5284
5881
      if test "$#" -gt 2; then
5285
5882
        $echo "$modename: \`$dest' is not a directory" 1>&2
5286
5883
        $echo "$help" 1>&2
5287
 
        exit 1
 
5884
        exit $EXIT_FAILURE
5288
5885
      fi
5289
5886
    fi
5290
5887
    case $destdir in
5296
5893
        *)
5297
5894
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5298
5895
          $echo "$help" 1>&2
5299
 
          exit 1
 
5896
          exit $EXIT_FAILURE
5300
5897
          ;;
5301
5898
        esac
5302
5899
      done
5325
5922
        else
5326
5923
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5327
5924
          $echo "$help" 1>&2
5328
 
          exit 1
 
5925
          exit $EXIT_FAILURE
5329
5926
        fi
5330
5927
 
5331
5928
        library_names=
5367
5964
          # but it's something to keep an eye on.
5368
5965
          if test "$inst_prefix_dir" = "$destdir"; then
5369
5966
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5370
 
            exit 1
 
5967
            exit $EXIT_FAILURE
5371
5968
          fi
5372
5969
 
5373
5970
          if test -n "$inst_prefix_dir"; then
5374
5971
            # Stick the inst_prefix_dir data into the link command.
5375
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
5972
            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
5376
5973
          else
5377
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
5974
            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
5378
5975
          fi
5379
5976
 
5380
5977
          $echo "$modename: warning: relinking \`$file'" 1>&2
5382
5979
          if $run eval "$relink_command"; then :
5383
5980
          else
5384
5981
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5385
 
            exit 1
 
5982
            exit $EXIT_FAILURE
5386
5983
          fi
5387
5984
        fi
5388
5985
 
5406
6003
 
5407
6004
          if test "$#" -gt 0; then
5408
6005
            # Delete the old symlinks, and create new ones.
 
6006
            # Try `ln -sf' first, because the `ln' binary might depend on
 
6007
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
6008
            # so we also need to try rm && ln -s.
5409
6009
            for linkname
5410
6010
            do
5411
6011
              if test "$linkname" != "$realname"; then
5412
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5413
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
6012
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
6013
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5414
6014
              fi
5415
6015
            done
5416
6016
          fi
5417
6017
 
5418
6018
          # Do each command in the postinstall commands.
5419
6019
          lib="$destdir/$realname"
5420
 
          eval cmds=\"$postinstall_cmds\"
 
6020
          cmds=$postinstall_cmds
5421
6021
          save_ifs="$IFS"; IFS='~'
5422
6022
          for cmd in $cmds; do
5423
6023
            IFS="$save_ifs"
 
6024
            eval cmd=\"$cmd\"
5424
6025
            $show "$cmd"
5425
 
            $run eval "$cmd" || exit $?
 
6026
            $run eval "$cmd" || {
 
6027
              lt_exit=$?
 
6028
 
 
6029
              # Restore the uninstalled library and exit
 
6030
              if test "$mode" = relink; then
 
6031
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
6032
              fi
 
6033
 
 
6034
              exit $lt_exit
 
6035
            }
5426
6036
          done
5427
6037
          IFS="$save_ifs"
5428
6038
        fi
5460
6070
        *)
5461
6071
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5462
6072
          $echo "$help" 1>&2
5463
 
          exit 1
 
6073
          exit $EXIT_FAILURE
5464
6074
          ;;
5465
6075
        esac
5466
6076
 
5478
6088
          $show "$install_prog $staticobj $staticdest"
5479
6089
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5480
6090
        fi
5481
 
        exit 0
 
6091
        exit $EXIT_SUCCESS
5482
6092
        ;;
5483
6093
 
5484
6094
      *)
5516
6126
          notinst_deplibs=
5517
6127
          relink_command=
5518
6128
 
5519
 
          # To insure that "foo" is sourced, and not "foo.exe",
5520
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5521
 
          # which disallows the automatic-append-.exe behavior.
5522
 
          case $build in
5523
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5524
 
          *) wrapperdot=${wrapper} ;;
5525
 
          esac
 
6129
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6130
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6131
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6132
          # `FILE.' does not work on cygwin managed mounts.
 
6133
          #
5526
6134
          # If there is no directory component, then add one.
5527
 
          case $file in
5528
 
          */* | *\\*) . ${wrapperdot} ;;
5529
 
          *) . ./${wrapperdot} ;;
 
6135
          case $wrapper in
 
6136
          */* | *\\*) . ${wrapper} ;;
 
6137
          *) . ./${wrapper} ;;
5530
6138
          esac
5531
6139
 
5532
6140
          # Check the variables that should have been set.
5533
6141
          if test -z "$notinst_deplibs"; then
5534
6142
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5535
 
            exit 1
 
6143
            exit $EXIT_FAILURE
5536
6144
          fi
5537
6145
 
5538
6146
          finalize=yes
5554
6162
          done
5555
6163
 
5556
6164
          relink_command=
5557
 
          # To insure that "foo" is sourced, and not "foo.exe",
5558
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5559
 
          # which disallows the automatic-append-.exe behavior.
5560
 
          case $build in
5561
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5562
 
          *) wrapperdot=${wrapper} ;;
5563
 
          esac
 
6165
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6166
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6167
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6168
          # `FILE.' does not work on cygwin managed mounts.
 
6169
          #
5564
6170
          # If there is no directory component, then add one.
5565
 
          case $file in
5566
 
          */* | *\\*) . ${wrapperdot} ;;
5567
 
          *) . ./${wrapperdot} ;;
 
6171
          case $wrapper in
 
6172
          */* | *\\*) . ${wrapper} ;;
 
6173
          *) . ./${wrapper} ;;
5568
6174
          esac
5569
6175
 
5570
6176
          outputname=
5571
6177
          if test "$fast_install" = no && test -n "$relink_command"; then
5572
6178
            if test "$finalize" = yes && test -z "$run"; then
5573
 
              tmpdir="/tmp"
5574
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5575
 
              tmpdir_mktemp=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
5576
 
              if test "$?" = 0 ; then
5577
 
                tmpdir="$tmpdir_mktemp"
5578
 
                unset tmpdir_mktemp
5579
 
               else
5580
 
                tmpdir="$tmpdir/libtool-$$"
5581
 
              fi
5582
 
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
5583
 
              else
5584
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5585
 
                continue
5586
 
              fi
 
6179
              tmpdir=`func_mktempdir`
5587
6180
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5588
6181
              outputname="$tmpdir/$file"
5589
6182
              # Replace the output file specification.
5590
 
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
 
6183
              relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
5591
6184
 
5592
6185
              $show "$relink_command"
5593
6186
              if $run eval "$relink_command"; then :
5607
6200
        fi
5608
6201
 
5609
6202
        # remove .exe since cygwin /usr/bin/install will append another
5610
 
        # one anyways
 
6203
        # one anyway 
5611
6204
        case $install_prog,$host in
5612
6205
        */usr/bin/install*,*cygwin*)
5613
6206
          case $file:$destfile in
5639
6232
      $show "$install_prog $file $oldlib"
5640
6233
      $run eval "$install_prog \$file \$oldlib" || exit $?
5641
6234
 
5642
 
      if test -n "$stripme" && test -n "$striplib"; then
 
6235
      if test -n "$stripme" && test -n "$old_striplib"; then
5643
6236
        $show "$old_striplib $oldlib"
5644
6237
        $run eval "$old_striplib $oldlib" || exit $?
5645
6238
      fi
5646
6239
 
5647
6240
      # Do each command in the postinstall commands.
5648
 
      eval cmds=\"$old_postinstall_cmds\"
 
6241
      cmds=$old_postinstall_cmds
5649
6242
      save_ifs="$IFS"; IFS='~'
5650
6243
      for cmd in $cmds; do
5651
6244
        IFS="$save_ifs"
 
6245
        eval cmd=\"$cmd\"
5652
6246
        $show "$cmd"
5653
6247
        $run eval "$cmd" || exit $?
5654
6248
      done
5662
6256
    if test -n "$current_libdirs"; then
5663
6257
      # Maybe just do a dry run.
5664
6258
      test -n "$run" && current_libdirs=" -n$current_libdirs"
5665
 
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
6259
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
5666
6260
    else
5667
 
      exit 0
 
6261
      exit $EXIT_SUCCESS
5668
6262
    fi
5669
6263
    ;;
5670
6264
 
5683
6277
      for libdir in $libdirs; do
5684
6278
        if test -n "$finish_cmds"; then
5685
6279
          # Do each command in the finish commands.
5686
 
          eval cmds=\"$finish_cmds\"
 
6280
          cmds=$finish_cmds
5687
6281
          save_ifs="$IFS"; IFS='~'
5688
6282
          for cmd in $cmds; do
5689
6283
            IFS="$save_ifs"
 
6284
            eval cmd=\"$cmd\"
5690
6285
            $show "$cmd"
5691
6286
            $run eval "$cmd" || admincmds="$admincmds
5692
6287
       $cmd"
5703
6298
    fi
5704
6299
 
5705
6300
    # Exit here if they wanted silent mode.
5706
 
    test "$show" = : && exit 0
 
6301
    test "$show" = : && exit $EXIT_SUCCESS
5707
6302
 
5708
 
    $echo "----------------------------------------------------------------------"
 
6303
    $echo "X----------------------------------------------------------------------" | $Xsed
5709
6304
    $echo "Libraries have been installed in:"
5710
6305
    for libdir in $libdirs; do
5711
6306
      $echo "   $libdir"
5738
6333
    $echo
5739
6334
    $echo "See any operating system documentation about shared libraries for"
5740
6335
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5741
 
    $echo "----------------------------------------------------------------------"
5742
 
    exit 0
 
6336
    $echo "X----------------------------------------------------------------------" | $Xsed
 
6337
    exit $EXIT_SUCCESS
5743
6338
    ;;
5744
6339
 
5745
6340
  # libtool execute mode
5751
6346
    if test -z "$cmd"; then
5752
6347
      $echo "$modename: you must specify a COMMAND" 1>&2
5753
6348
      $echo "$help"
5754
 
      exit 1
 
6349
      exit $EXIT_FAILURE
5755
6350
    fi
5756
6351
 
5757
6352
    # Handle -dlopen flags immediately.
5759
6354
      if test ! -f "$file"; then
5760
6355
        $echo "$modename: \`$file' is not a file" 1>&2
5761
6356
        $echo "$help" 1>&2
5762
 
        exit 1
 
6357
        exit $EXIT_FAILURE
5763
6358
      fi
5764
6359
 
5765
6360
      dir=
5770
6365
        else
5771
6366
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5772
6367
          $echo "$help" 1>&2
5773
 
          exit 1
 
6368
          exit $EXIT_FAILURE
5774
6369
        fi
5775
6370
 
5776
6371
        # Read the libtool library.
5797
6392
          dir="$dir/$objdir"
5798
6393
        else
5799
6394
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5800
 
          exit 1
 
6395
          exit $EXIT_FAILURE
5801
6396
        fi
5802
6397
        ;;
5803
6398
 
5861
6456
      fi
5862
6457
 
5863
6458
      # Restore saved environment variables
5864
 
      if test "${save_LC_ALL+set}" = set; then
5865
 
        LC_ALL="$save_LC_ALL"; export LC_ALL
5866
 
      fi
5867
 
      if test "${save_LANG+set}" = set; then
5868
 
        LANG="$save_LANG"; export LANG
5869
 
      fi
 
6459
      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
6460
      do
 
6461
       eval "if test \"\${save_$lt_var+set}\" = set; then
 
6462
               $lt_var=\$save_$lt_var; export $lt_var
 
6463
             else
 
6464
               $lt_unset $lt_var
 
6465
             fi"
 
6466
      done
 
6467
 
5870
6468
 
5871
6469
      # Now prepare to actually exec the command.
5872
6470
      exec_cmd="\$cmd$args"
5877
6475
        $echo "export $shlibpath_var"
5878
6476
      fi
5879
6477
      $echo "$cmd$args"
5880
 
      exit 0
 
6478
      exit $EXIT_SUCCESS
5881
6479
    fi
5882
6480
    ;;
5883
6481
 
5905
6503
    if test -z "$rm"; then
5906
6504
      $echo "$modename: you must specify an RM program" 1>&2
5907
6505
      $echo "$help" 1>&2
5908
 
      exit 1
 
6506
      exit $EXIT_FAILURE
5909
6507
    fi
5910
6508
 
5911
6509
    rmdirs=
5955
6553
            rmfiles="$rmfiles $objdir/$n"
5956
6554
          done
5957
6555
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5958
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5959
6556
 
5960
 
          if test "$mode" = uninstall; then
 
6557
          case "$mode" in
 
6558
          clean)
 
6559
            case "  $library_names " in
 
6560
            # "  " in the beginning catches empty $dlname
 
6561
            *" $dlname "*) ;;
 
6562
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6563
            esac
 
6564
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6565
            ;;
 
6566
          uninstall)
5961
6567
            if test -n "$library_names"; then
5962
6568
              # Do each command in the postuninstall commands.
5963
 
              eval cmds=\"$postuninstall_cmds\"
 
6569
              cmds=$postuninstall_cmds
5964
6570
              save_ifs="$IFS"; IFS='~'
5965
6571
              for cmd in $cmds; do
5966
6572
                IFS="$save_ifs"
 
6573
                eval cmd=\"$cmd\"
5967
6574
                $show "$cmd"
5968
6575
                $run eval "$cmd"
5969
6576
                if test "$?" -ne 0 && test "$rmforce" != yes; then
5975
6582
 
5976
6583
            if test -n "$old_library"; then
5977
6584
              # Do each command in the old_postuninstall commands.
5978
 
              eval cmds=\"$old_postuninstall_cmds\"
 
6585
              cmds=$old_postuninstall_cmds
5979
6586
              save_ifs="$IFS"; IFS='~'
5980
6587
              for cmd in $cmds; do
5981
6588
                IFS="$save_ifs"
 
6589
                eval cmd=\"$cmd\"
5982
6590
                $show "$cmd"
5983
6591
                $run eval "$cmd"
5984
6592
                if test "$?" -ne 0 && test "$rmforce" != yes; then
5988
6596
              IFS="$save_ifs"
5989
6597
            fi
5990
6598
            # FIXME: should reinstall the best remaining shared library.
5991
 
          fi
 
6599
            ;;
 
6600
          esac
5992
6601
        fi
5993
6602
        ;;
5994
6603
 
6017
6626
        if test "$mode" = clean ; then
6018
6627
          noexename=$name
6019
6628
          case $file in
6020
 
          *.exe) 
 
6629
          *.exe)
6021
6630
            file=`$echo $file|${SED} 's,.exe$,,'`
6022
6631
            noexename=`$echo $name|${SED} 's,.exe$,,'`
6023
6632
            # $file with .exe has already been added to rmfiles,
6062
6671
  "")
6063
6672
    $echo "$modename: you must specify a MODE" 1>&2
6064
6673
    $echo "$generic_help" 1>&2
6065
 
    exit 1
 
6674
    exit $EXIT_FAILURE
6066
6675
    ;;
6067
6676
  esac
6068
6677
 
6069
6678
  if test -z "$exec_cmd"; then
6070
6679
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6071
6680
    $echo "$generic_help" 1>&2
6072
 
    exit 1
 
6681
    exit $EXIT_FAILURE
6073
6682
  fi
6074
6683
fi # test -z "$show_help"
6075
6684
 
6076
6685
if test -n "$exec_cmd"; then
6077
6686
  eval exec $exec_cmd
6078
 
  exit 1
 
6687
  exit $EXIT_FAILURE
6079
6688
fi
6080
6689
 
6081
6690
# We need to display help for each of the modes.
6111
6720
a more detailed description of MODE.
6112
6721
 
6113
6722
Report bugs to <bug-libtool@gnu.org>."
6114
 
  exit 0
 
6723
  exit $EXIT_SUCCESS
6115
6724
  ;;
6116
6725
 
6117
6726
clean)
6212
6821
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6213
6822
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6214
6823
  -export-symbols SYMFILE
6215
 
                    try to export only the symbols listed in SYMFILE
 
6824
                    try to export only the symbols listed in SYMFILE
6216
6825
  -export-symbols-regex REGEX
6217
 
                    try to export only the symbols matching REGEX
 
6826
                    try to export only the symbols matching REGEX
6218
6827
  -LLIBDIR          search LIBDIR for required installed libraries
6219
6828
  -lNAME            OUTPUT-FILE requires the installed library libNAME
6220
6829
  -module           build a library that can dlopened
6223
6832
  -no-undefined     declare that a library does not refer to external symbols
6224
6833
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6225
6834
  -objectlist FILE  Use a list of object files found in FILE to specify objects
 
6835
  -precious-files-regex REGEX
 
6836
                    don't remove output files matching REGEX
6226
6837
  -release RELEASE  specify package release information
6227
6838
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6228
6839
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6229
 
  -static           do not do any dynamic linking of libtool libraries
 
6840
  -static           do not do any dynamic linking of uninstalled libtool libraries
 
6841
  -static-libtool-libs
 
6842
                    do not do any dynamic linking of libtool libraries
6230
6843
  -version-info CURRENT[:REVISION[:AGE]]
6231
 
                    specify library version info [each variable defaults to 0]
 
6844
                    specify library version info [each variable defaults to 0]
6232
6845
 
6233
6846
All other options (arguments beginning with \`-') are ignored.
6234
6847
 
6264
6877
*)
6265
6878
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6266
6879
  $echo "$help" 1>&2
6267
 
  exit 1
 
6880
  exit $EXIT_FAILURE
6268
6881
  ;;
6269
6882
esac
6270
6883
 
6271
6884
$echo
6272
6885
$echo "Try \`$modename --help' for more information about other modes."
6273
6886
 
6274
 
exit 0
 
6887
exit $?
6275
6888
 
6276
6889
# The TAGs below are defined such that we never get into a situation
6277
6890
# in which we disable both kinds of libraries.  Given conflicting
6285
6898
# configuration.  But we'll never go from static-only to shared-only.
6286
6899
 
6287
6900
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6288
 
build_libtool_libs=no
6289
 
build_old_libs=yes
 
6901
disable_libs=shared
6290
6902
# ### END LIBTOOL TAG CONFIG: disable-shared
6291
6903
 
6292
6904
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6293
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6905
disable_libs=static
6294
6906
# ### END LIBTOOL TAG CONFIG: disable-static
6295
6907
 
6296
6908
# Local Variables: