~vlad-lesin/percona-server/mysql-5.0.33-original

« back to all changes in this revision

Viewing changes to bdb/dist/ltmain.sh

  • Committer: Vlad Lesin
  • Date: 2012-07-31 09:21:34 UTC
  • Revision ID: vladislav.lesin@percona.com-20120731092134-zfodx022b7992wsi
VirginĀ 5.0.33

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ltmain.sh - Provide generalized library-building support services.
 
2
# NOTE: Changing this file will not affect anything until you rerun configure.
 
3
#
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
 
5
# Free Software Foundation, Inc.
 
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 
7
#
 
8
# This program is free software; you can redistribute it and/or modify
 
9
# it under the terms of the GNU General Public License as published by
 
10
# the Free Software Foundation; either version 2 of the License, or
 
11
# (at your option) any later version.
 
12
#
 
13
# This program is distributed in the hope that it will be useful, but
 
14
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
# General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
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.
 
21
#
 
22
# As a special exception to the GNU General Public License, if you
 
23
# distribute this file as part of a program that contains a
 
24
# configuration script generated by Autoconf, you may include it under
 
25
# the same distribution terms that you use for the rest of that program.
 
26
 
 
27
# Check that we have a working $echo.
 
28
if test "X$1" = X--no-reexec; then
 
29
  # Discard the --no-reexec flag, and continue.
 
30
  shift
 
31
elif test "X$1" = X--fallback-echo; then
 
32
  # Avoid inline document here, it may be left over
 
33
  :
 
34
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
 
35
  # Yippee, $echo works!
 
36
  :
 
37
else
 
38
  # Restart under the correct shell, and then maybe $echo will work.
 
39
  exec $SHELL "$0" --no-reexec ${1+"$@"}
 
40
fi
 
41
 
 
42
if test "X$1" = X--fallback-echo; then
 
43
  # used as fallback echo
 
44
  shift
 
45
  cat <<EOF
 
46
$*
 
47
EOF
 
48
  exit 0
 
49
fi
 
50
 
 
51
# The name of this program.
 
52
progname=`$echo "$0" | sed 's%^.*/%%'`
 
53
modename="$progname"
 
54
 
 
55
# Constants.
 
56
PROGRAM=ltmain.sh
 
57
PACKAGE=libtool
 
58
VERSION=1.4.2
 
59
TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)"
 
60
 
 
61
default_mode=
 
62
help="Try \`$progname --help' for more information."
 
63
magic="%%%MAGIC variable%%%"
 
64
mkdir="mkdir"
 
65
mv="mv -f"
 
66
rm="rm -f"
 
67
 
 
68
# Sed substitution that helps us do robust quoting.  It backslashifies
 
69
# metacharacters that are still active within double-quoted strings.
 
70
Xsed='sed -e 1s/^X//'
 
71
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
 
72
SP2NL='tr \040 \012'
 
73
NL2SP='tr \015\012 \040\040'
 
74
 
 
75
# NLS nuisances.
 
76
# Only set LANG and LC_ALL to C if already set.
 
77
# These must not be set unconditionally because not all systems understand
 
78
# e.g. LANG=C (notably SCO).
 
79
# We save the old values to restore during execute mode.
 
80
if test "${LC_ALL+set}" = set; then
 
81
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
 
82
fi
 
83
if test "${LANG+set}" = set; then
 
84
  save_LANG="$LANG"; LANG=C; export LANG
 
85
fi
 
86
 
 
87
# Make sure IFS has a sensible default
 
88
: ${IFS="       "}
 
89
 
 
90
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
 
91
  echo "$modename: not configured to build any kind of library" 1>&2
 
92
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
93
  exit 1
 
94
fi
 
95
 
 
96
# Global variables.
 
97
mode=$default_mode
 
98
nonopt=
 
99
prev=
 
100
prevopt=
 
101
run=
 
102
show="$echo"
 
103
show_help=
 
104
execute_dlfiles=
 
105
lo2o="s/\\.lo\$/.${objext}/"
 
106
o2lo="s/\\.${objext}\$/.lo/"
 
107
 
 
108
# Parse our command line options once, thoroughly.
 
109
while test $# -gt 0
 
110
do
 
111
  arg="$1"
 
112
  shift
 
113
 
 
114
  case $arg in
 
115
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
 
116
  *) optarg= ;;
 
117
  esac
 
118
 
 
119
  # If the previous option needs an argument, assign it.
 
120
  if test -n "$prev"; then
 
121
    case $prev in
 
122
    execute_dlfiles)
 
123
      execute_dlfiles="$execute_dlfiles $arg"
 
124
      ;;
 
125
    *)
 
126
      eval "$prev=\$arg"
 
127
      ;;
 
128
    esac
 
129
 
 
130
    prev=
 
131
    prevopt=
 
132
    continue
 
133
  fi
 
134
 
 
135
  # Have we seen a non-optional argument yet?
 
136
  case $arg in
 
137
  --help)
 
138
    show_help=yes
 
139
    ;;
 
140
 
 
141
  --version)
 
142
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
 
143
    exit 0
 
144
    ;;
 
145
 
 
146
  --config)
 
147
    sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
 
148
    exit 0
 
149
    ;;
 
150
 
 
151
  --debug)
 
152
    echo "$progname: enabling shell trace mode"
 
153
    set -x
 
154
    ;;
 
155
 
 
156
  --dry-run | -n)
 
157
    run=:
 
158
    ;;
 
159
 
 
160
  --features)
 
161
    echo "host: $host"
 
162
    if test "$build_libtool_libs" = yes; then
 
163
      echo "enable shared libraries"
 
164
    else
 
165
      echo "disable shared libraries"
 
166
    fi
 
167
    if test "$build_old_libs" = yes; then
 
168
      echo "enable static libraries"
 
169
    else
 
170
      echo "disable static libraries"
 
171
    fi
 
172
    exit 0
 
173
    ;;
 
174
 
 
175
  --finish) mode="finish" ;;
 
176
 
 
177
  --mode) prevopt="--mode" prev=mode ;;
 
178
  --mode=*) mode="$optarg" ;;
 
179
 
 
180
  --quiet | --silent)
 
181
    show=:
 
182
    ;;
 
183
 
 
184
  -dlopen)
 
185
    prevopt="-dlopen"
 
186
    prev=execute_dlfiles
 
187
    ;;
 
188
 
 
189
  -*)
 
190
    $echo "$modename: unrecognized option \`$arg'" 1>&2
 
191
    $echo "$help" 1>&2
 
192
    exit 1
 
193
    ;;
 
194
 
 
195
  *)
 
196
    nonopt="$arg"
 
197
    break
 
198
    ;;
 
199
  esac
 
200
done
 
201
 
 
202
if test -n "$prevopt"; then
 
203
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
 
204
  $echo "$help" 1>&2
 
205
  exit 1
 
206
fi
 
207
 
 
208
# If this variable is set in any of the actions, the command in it
 
209
# will be execed at the end.  This prevents here-documents from being
 
210
# left over by shells.
 
211
exec_cmd=
 
212
 
 
213
if test -z "$show_help"; then
 
214
 
 
215
  # Infer the operation mode.
 
216
  if test -z "$mode"; then
 
217
    case $nonopt in
 
218
    *cc | *++ | gcc* | *-gcc*)
 
219
      mode=link
 
220
      for arg
 
221
      do
 
222
        case $arg in
 
223
        -c)
 
224
           mode=compile
 
225
           break
 
226
           ;;
 
227
        esac
 
228
      done
 
229
      ;;
 
230
    *db | *dbx | *strace | *truss)
 
231
      mode=execute
 
232
      ;;
 
233
    *install*|cp|mv)
 
234
      mode=install
 
235
      ;;
 
236
    *rm)
 
237
      mode=uninstall
 
238
      ;;
 
239
    *)
 
240
      # If we have no mode, but dlfiles were specified, then do execute mode.
 
241
      test -n "$execute_dlfiles" && mode=execute
 
242
 
 
243
      # Just use the default operation mode.
 
244
      if test -z "$mode"; then
 
245
        if test -n "$nonopt"; then
 
246
          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
 
247
        else
 
248
          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
 
249
        fi
 
250
      fi
 
251
      ;;
 
252
    esac
 
253
  fi
 
254
 
 
255
  # Only execute mode is allowed to have -dlopen flags.
 
256
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
 
257
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
 
258
    $echo "$help" 1>&2
 
259
    exit 1
 
260
  fi
 
261
 
 
262
  # Change the help message to a mode-specific one.
 
263
  generic_help="$help"
 
264
  help="Try \`$modename --help --mode=$mode' for more information."
 
265
 
 
266
  # These modes are in order of execution frequency so that they run quickly.
 
267
  case $mode in
 
268
  # libtool compile mode
 
269
  compile)
 
270
    modename="$modename: compile"
 
271
    # Get the compilation command and the source file.
 
272
    base_compile=
 
273
    prev=
 
274
    lastarg=
 
275
    srcfile="$nonopt"
 
276
    suppress_output=
 
277
 
 
278
    user_target=no
 
279
    for arg
 
280
    do
 
281
      case $prev in
 
282
      "") ;;
 
283
      xcompiler)
 
284
        # Aesthetically quote the previous argument.
 
285
        prev=
 
286
        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
287
 
 
288
        case $arg in
 
289
        # Double-quote args containing other shell metacharacters.
 
290
        # Many Bourne shells cannot handle close brackets correctly
 
291
        # in scan sets, so we specify it separately.
 
292
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
293
          arg="\"$arg\""
 
294
          ;;
 
295
        esac
 
296
 
 
297
        # Add the previous argument to base_compile.
 
298
        if test -z "$base_compile"; then
 
299
          base_compile="$lastarg"
 
300
        else
 
301
          base_compile="$base_compile $lastarg"
 
302
        fi
 
303
        continue
 
304
        ;;
 
305
      esac
 
306
 
 
307
      # Accept any command-line options.
 
308
      case $arg in
 
309
      -o)
 
310
        if test "$user_target" != "no"; then
 
311
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
 
312
          exit 1
 
313
        fi
 
314
        user_target=next
 
315
        ;;
 
316
 
 
317
      -static)
 
318
        build_old_libs=yes
 
319
        continue
 
320
        ;;
 
321
 
 
322
      -prefer-pic)
 
323
        pic_mode=yes
 
324
        continue
 
325
        ;;
 
326
 
 
327
      -prefer-non-pic)
 
328
        pic_mode=no
 
329
        continue
 
330
        ;;
 
331
 
 
332
      -Xcompiler)
 
333
        prev=xcompiler
 
334
        continue
 
335
        ;;
 
336
 
 
337
      -Wc,*)
 
338
        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
 
339
        lastarg=
 
340
        save_ifs="$IFS"; IFS=','
 
341
        for arg in $args; do
 
342
          IFS="$save_ifs"
 
343
 
 
344
          # Double-quote args containing other shell metacharacters.
 
345
          # Many Bourne shells cannot handle close brackets correctly
 
346
          # in scan sets, so we specify it separately.
 
347
          case $arg in
 
348
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
349
            arg="\"$arg\""
 
350
            ;;
 
351
          esac
 
352
          lastarg="$lastarg $arg"
 
353
        done
 
354
        IFS="$save_ifs"
 
355
        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
 
356
 
 
357
        # Add the arguments to base_compile.
 
358
        if test -z "$base_compile"; then
 
359
          base_compile="$lastarg"
 
360
        else
 
361
          base_compile="$base_compile $lastarg"
 
362
        fi
 
363
        continue
 
364
        ;;
 
365
      esac
 
366
 
 
367
      case $user_target in
 
368
      next)
 
369
        # The next one is the -o target name
 
370
        user_target=yes
 
371
        continue
 
372
        ;;
 
373
      yes)
 
374
        # We got the output file
 
375
        user_target=set
 
376
        libobj="$arg"
 
377
        continue
 
378
        ;;
 
379
      esac
 
380
 
 
381
      # Accept the current argument as the source file.
 
382
      lastarg="$srcfile"
 
383
      srcfile="$arg"
 
384
 
 
385
      # Aesthetically quote the previous argument.
 
386
 
 
387
      # Backslashify any backslashes, double quotes, and dollar signs.
 
388
      # These are the only characters that are still specially
 
389
      # interpreted inside of double-quoted scrings.
 
390
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
 
391
 
 
392
      # Double-quote args containing other shell metacharacters.
 
393
      # Many Bourne shells cannot handle close brackets correctly
 
394
      # in scan sets, so we specify it separately.
 
395
      case $lastarg in
 
396
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
397
        lastarg="\"$lastarg\""
 
398
        ;;
 
399
      esac
 
400
 
 
401
      # Add the previous argument to base_compile.
 
402
      if test -z "$base_compile"; then
 
403
        base_compile="$lastarg"
 
404
      else
 
405
        base_compile="$base_compile $lastarg"
 
406
      fi
 
407
    done
 
408
 
 
409
    case $user_target in
 
410
    set)
 
411
      ;;
 
412
    no)
 
413
      # Get the name of the library object.
 
414
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
 
415
      ;;
 
416
    *)
 
417
      $echo "$modename: you must specify a target with \`-o'" 1>&2
 
418
      exit 1
 
419
      ;;
 
420
    esac
 
421
 
 
422
    # Recognize several different file suffixes.
 
423
    # If the user specifies -o file.o, it is replaced with file.lo
 
424
    xform='[cCFSfmso]'
 
425
    case $libobj in
 
426
    *.ada) xform=ada ;;
 
427
    *.adb) xform=adb ;;
 
428
    *.ads) xform=ads ;;
 
429
    *.asm) xform=asm ;;
 
430
    *.c++) xform=c++ ;;
 
431
    *.cc) xform=cc ;;
 
432
    *.cpp) xform=cpp ;;
 
433
    *.cxx) xform=cxx ;;
 
434
    *.f90) xform=f90 ;;
 
435
    *.for) xform=for ;;
 
436
    esac
 
437
 
 
438
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
 
439
 
 
440
    case $libobj in
 
441
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
 
442
    *)
 
443
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
 
444
      exit 1
 
445
      ;;
 
446
    esac
 
447
 
 
448
    if test -z "$base_compile"; then
 
449
      $echo "$modename: you must specify a compilation command" 1>&2
 
450
      $echo "$help" 1>&2
 
451
      exit 1
 
452
    fi
 
453
 
 
454
    # Delete any leftover library objects.
 
455
    if test "$build_old_libs" = yes; then
 
456
      removelist="$obj $libobj"
 
457
    else
 
458
      removelist="$libobj"
 
459
    fi
 
460
 
 
461
    $run $rm $removelist
 
462
    trap "$run $rm $removelist; exit 1" 1 2 15
 
463
 
 
464
    # On Cygwin there's no "real" PIC flag so we must build both object types
 
465
    case $host_os in
 
466
    cygwin* | mingw* | pw32* | os2*)
 
467
      pic_mode=default
 
468
      ;;
 
469
    esac
 
470
    if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
 
471
      # non-PIC code in shared libraries is not supported
 
472
      pic_mode=default
 
473
    fi
 
474
 
 
475
    # Calculate the filename of the output object if compiler does
 
476
    # not support -o with -c
 
477
    if test "$compiler_c_o" = no; then
 
478
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
 
479
      lockfile="$output_obj.lock"
 
480
      removelist="$removelist $output_obj $lockfile"
 
481
      trap "$run $rm $removelist; exit 1" 1 2 15
 
482
    else
 
483
      need_locks=no
 
484
      lockfile=
 
485
    fi
 
486
 
 
487
    # Lock this critical section if it is needed
 
488
    # We use this script file to make the link, it avoids creating a new file
 
489
    if test "$need_locks" = yes; then
 
490
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
491
        $show "Waiting for $lockfile to be removed"
 
492
        sleep 2
 
493
      done
 
494
    elif test "$need_locks" = warn; then
 
495
      if test -f "$lockfile"; then
 
496
        echo "\
 
497
*** ERROR, $lockfile exists and contains:
 
498
`cat $lockfile 2>/dev/null`
 
499
 
 
500
This indicates that another process is trying to use the same
 
501
temporary object file, and libtool could not work around it because
 
502
your compiler does not support \`-c' and \`-o' together.  If you
 
503
repeat this compilation, it may succeed, by chance, but you had better
 
504
avoid parallel builds (make -j) in this platform, or get a better
 
505
compiler."
 
506
 
 
507
        $run $rm $removelist
 
508
        exit 1
 
509
      fi
 
510
      echo $srcfile > "$lockfile"
 
511
    fi
 
512
 
 
513
    if test -n "$fix_srcfile_path"; then
 
514
      eval srcfile=\"$fix_srcfile_path\"
 
515
    fi
 
516
 
 
517
    # Only build a PIC object if we are building libtool libraries.
 
518
    if test "$build_libtool_libs" = yes; then
 
519
      # Without this assignment, base_compile gets emptied.
 
520
      fbsd_hideous_sh_bug=$base_compile
 
521
 
 
522
      if test "$pic_mode" != no; then
 
523
        # All platforms use -DPIC, to notify preprocessed assembler code.
 
524
        command="$base_compile $srcfile $pic_flag -DPIC"
 
525
      else
 
526
        # Don't build PIC code
 
527
        command="$base_compile $srcfile"
 
528
      fi
 
529
      if test "$build_old_libs" = yes; then
 
530
        lo_libobj="$libobj"
 
531
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
 
532
        if test "X$dir" = "X$libobj"; then
 
533
          dir="$objdir"
 
534
        else
 
535
          dir="$dir/$objdir"
 
536
        fi
 
537
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
 
538
 
 
539
        if test -d "$dir"; then
 
540
          $show "$rm $libobj"
 
541
          $run $rm $libobj
 
542
        else
 
543
          $show "$mkdir $dir"
 
544
          $run $mkdir $dir
 
545
          status=$?
 
546
          if test $status -ne 0 && test ! -d $dir; then
 
547
            exit $status
 
548
          fi
 
549
        fi
 
550
      fi
 
551
      if test "$compiler_o_lo" = yes; then
 
552
        output_obj="$libobj"
 
553
        command="$command -o $output_obj"
 
554
      elif test "$compiler_c_o" = yes; then
 
555
        output_obj="$obj"
 
556
        command="$command -o $output_obj"
 
557
      fi
 
558
 
 
559
      $run $rm "$output_obj"
 
560
      $show "$command"
 
561
      if $run eval "$command"; then :
 
562
      else
 
563
        test -n "$output_obj" && $run $rm $removelist
 
564
        exit 1
 
565
      fi
 
566
 
 
567
      if test "$need_locks" = warn &&
 
568
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
 
569
        echo "\
 
570
*** ERROR, $lockfile contains:
 
571
`cat $lockfile 2>/dev/null`
 
572
 
 
573
but it should contain:
 
574
$srcfile
 
575
 
 
576
This indicates that another process is trying to use the same
 
577
temporary object file, and libtool could not work around it because
 
578
your compiler does not support \`-c' and \`-o' together.  If you
 
579
repeat this compilation, it may succeed, by chance, but you had better
 
580
avoid parallel builds (make -j) in this platform, or get a better
 
581
compiler."
 
582
 
 
583
        $run $rm $removelist
 
584
        exit 1
 
585
      fi
 
586
 
 
587
      # Just move the object if needed, then go on to compile the next one
 
588
      if test x"$output_obj" != x"$libobj"; then
 
589
        $show "$mv $output_obj $libobj"
 
590
        if $run $mv $output_obj $libobj; then :
 
591
        else
 
592
          error=$?
 
593
          $run $rm $removelist
 
594
          exit $error
 
595
        fi
 
596
      fi
 
597
 
 
598
      # If we have no pic_flag, then copy the object into place and finish.
 
599
      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
 
600
         test "$build_old_libs" = yes; then
 
601
        # Rename the .lo from within objdir to obj
 
602
        if test -f $obj; then
 
603
          $show $rm $obj
 
604
          $run $rm $obj
 
605
        fi
 
606
 
 
607
        $show "$mv $libobj $obj"
 
608
        if $run $mv $libobj $obj; then :
 
609
        else
 
610
          error=$?
 
611
          $run $rm $removelist
 
612
          exit $error
 
613
        fi
 
614
 
 
615
        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
616
        if test "X$xdir" = "X$obj"; then
 
617
          xdir="."
 
618
        else
 
619
          xdir="$xdir"
 
620
        fi
 
621
        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
 
622
        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
 
623
        # Now arrange that obj and lo_libobj become the same file
 
624
        $show "(cd $xdir && $LN_S $baseobj $libobj)"
 
625
        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
 
626
          # Unlock the critical section if it was locked
 
627
          if test "$need_locks" != no; then
 
628
            $run $rm "$lockfile"
 
629
          fi
 
630
          exit 0
 
631
        else
 
632
          error=$?
 
633
          $run $rm $removelist
 
634
          exit $error
 
635
        fi
 
636
      fi
 
637
 
 
638
      # Allow error messages only from the first compilation.
 
639
      suppress_output=' >/dev/null 2>&1'
 
640
    fi
 
641
 
 
642
    # Only build a position-dependent object if we build old libraries.
 
643
    if test "$build_old_libs" = yes; then
 
644
      if test "$pic_mode" != yes; then
 
645
        # Don't build PIC code
 
646
        command="$base_compile $srcfile"
 
647
      else
 
648
        # All platforms use -DPIC, to notify preprocessed assembler code.
 
649
        command="$base_compile $srcfile $pic_flag -DPIC"
 
650
      fi
 
651
      if test "$compiler_c_o" = yes; then
 
652
        command="$command -o $obj"
 
653
        output_obj="$obj"
 
654
      fi
 
655
 
 
656
      # Suppress compiler output if we already did a PIC compilation.
 
657
      command="$command$suppress_output"
 
658
      $run $rm "$output_obj"
 
659
      $show "$command"
 
660
      if $run eval "$command"; then :
 
661
      else
 
662
        $run $rm $removelist
 
663
        exit 1
 
664
      fi
 
665
 
 
666
      if test "$need_locks" = warn &&
 
667
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
 
668
        echo "\
 
669
*** ERROR, $lockfile contains:
 
670
`cat $lockfile 2>/dev/null`
 
671
 
 
672
but it should contain:
 
673
$srcfile
 
674
 
 
675
This indicates that another process is trying to use the same
 
676
temporary object file, and libtool could not work around it because
 
677
your compiler does not support \`-c' and \`-o' together.  If you
 
678
repeat this compilation, it may succeed, by chance, but you had better
 
679
avoid parallel builds (make -j) in this platform, or get a better
 
680
compiler."
 
681
 
 
682
        $run $rm $removelist
 
683
        exit 1
 
684
      fi
 
685
 
 
686
      # Just move the object if needed
 
687
      if test x"$output_obj" != x"$obj"; then
 
688
        $show "$mv $output_obj $obj"
 
689
        if $run $mv $output_obj $obj; then :
 
690
        else
 
691
          error=$?
 
692
          $run $rm $removelist
 
693
          exit $error
 
694
        fi
 
695
      fi
 
696
 
 
697
      # Create an invalid libtool object if no PIC, so that we do not
 
698
      # accidentally link it into a program.
 
699
      if test "$build_libtool_libs" != yes; then
 
700
        $show "echo timestamp > $libobj"
 
701
        $run eval "echo timestamp > \$libobj" || exit $?
 
702
      else
 
703
        # Move the .lo from within objdir
 
704
        $show "$mv $libobj $lo_libobj"
 
705
        if $run $mv $libobj $lo_libobj; then :
 
706
        else
 
707
          error=$?
 
708
          $run $rm $removelist
 
709
          exit $error
 
710
        fi
 
711
      fi
 
712
    fi
 
713
 
 
714
    # Unlock the critical section if it was locked
 
715
    if test "$need_locks" != no; then
 
716
      $run $rm "$lockfile"
 
717
    fi
 
718
 
 
719
    exit 0
 
720
    ;;
 
721
 
 
722
  # libtool link mode
 
723
  link | relink)
 
724
    modename="$modename: link"
 
725
    case $host in
 
726
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
727
      # It is impossible to link a dll without this setting, and
 
728
      # we shouldn't force the makefile maintainer to figure out
 
729
      # which system we are compiling for in order to pass an extra
 
730
      # flag for every libtool invokation.
 
731
      # allow_undefined=no
 
732
 
 
733
      # FIXME: Unfortunately, there are problems with the above when trying
 
734
      # to make a dll which has undefined symbols, in which case not
 
735
      # even a static library is built.  For now, we need to specify
 
736
      # -no-undefined on the libtool link line when we can be certain
 
737
      # that all symbols are satisfied, otherwise we get a static library.
 
738
      allow_undefined=yes
 
739
      ;;
 
740
    *)
 
741
      allow_undefined=yes
 
742
      ;;
 
743
    esac
 
744
    libtool_args="$nonopt"
 
745
    compile_command="$nonopt"
 
746
    finalize_command="$nonopt"
 
747
 
 
748
    compile_rpath=
 
749
    finalize_rpath=
 
750
    compile_shlibpath=
 
751
    finalize_shlibpath=
 
752
    convenience=
 
753
    old_convenience=
 
754
    deplibs=
 
755
    old_deplibs=
 
756
    compiler_flags=
 
757
    linker_flags=
 
758
    dllsearchpath=
 
759
    lib_search_path=`pwd`
 
760
 
 
761
    avoid_version=no
 
762
    dlfiles=
 
763
    dlprefiles=
 
764
    dlself=no
 
765
    export_dynamic=no
 
766
    export_symbols=
 
767
    export_symbols_regex=
 
768
    generated=
 
769
    libobjs=
 
770
    ltlibs=
 
771
    module=no
 
772
    no_install=no
 
773
    objs=
 
774
    prefer_static_libs=no
 
775
    preload=no
 
776
    prev=
 
777
    prevarg=
 
778
    release=
 
779
    rpath=
 
780
    xrpath=
 
781
    perm_rpath=
 
782
    temp_rpath=
 
783
    thread_safe=no
 
784
    vinfo=
 
785
 
 
786
    # We need to know -static, to get the right output filenames.
 
787
    for arg
 
788
    do
 
789
      case $arg in
 
790
      -all-static | -static)
 
791
        if test "X$arg" = "X-all-static"; then
 
792
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
 
793
            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
 
794
          fi
 
795
          if test -n "$link_static_flag"; then
 
796
            dlopen_self=$dlopen_self_static
 
797
          fi
 
798
        else
 
799
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
800
            dlopen_self=$dlopen_self_static
 
801
          fi
 
802
        fi
 
803
        build_libtool_libs=no
 
804
        build_old_libs=yes
 
805
        prefer_static_libs=yes
 
806
        break
 
807
        ;;
 
808
      esac
 
809
    done
 
810
 
 
811
    # See if our shared archives depend on static archives.
 
812
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
 
813
 
 
814
    # Go through the arguments, transforming them on the way.
 
815
    while test $# -gt 0; do
 
816
      arg="$1"
 
817
      shift
 
818
      case $arg in
 
819
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
820
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
 
821
        ;;
 
822
      *) qarg=$arg ;;
 
823
      esac
 
824
      libtool_args="$libtool_args $qarg"
 
825
 
 
826
      # If the previous option needs an argument, assign it.
 
827
      if test -n "$prev"; then
 
828
        case $prev in
 
829
        output)
 
830
          compile_command="$compile_command @OUTPUT@"
 
831
          finalize_command="$finalize_command @OUTPUT@"
 
832
          ;;
 
833
        esac
 
834
 
 
835
        case $prev in
 
836
        dlfiles|dlprefiles)
 
837
          if test "$preload" = no; then
 
838
            # Add the symbol object into the linking commands.
 
839
            compile_command="$compile_command @SYMFILE@"
 
840
            finalize_command="$finalize_command @SYMFILE@"
 
841
            preload=yes
 
842
          fi
 
843
          case $arg in
 
844
          *.la | *.lo) ;;  # We handle these cases below.
 
845
          force)
 
846
            if test "$dlself" = no; then
 
847
              dlself=needless
 
848
              export_dynamic=yes
 
849
            fi
 
850
            prev=
 
851
            continue
 
852
            ;;
 
853
          self)
 
854
            if test "$prev" = dlprefiles; then
 
855
              dlself=yes
 
856
            elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
 
857
              dlself=yes
 
858
            else
 
859
              dlself=needless
 
860
              export_dynamic=yes
 
861
            fi
 
862
            prev=
 
863
            continue
 
864
            ;;
 
865
          *)
 
866
            if test "$prev" = dlfiles; then
 
867
              dlfiles="$dlfiles $arg"
 
868
            else
 
869
              dlprefiles="$dlprefiles $arg"
 
870
            fi
 
871
            prev=
 
872
            continue
 
873
            ;;
 
874
          esac
 
875
          ;;
 
876
        expsyms)
 
877
          export_symbols="$arg"
 
878
          if test ! -f "$arg"; then
 
879
            $echo "$modename: symbol file \`$arg' does not exist"
 
880
            exit 1
 
881
          fi
 
882
          prev=
 
883
          continue
 
884
          ;;
 
885
        expsyms_regex)
 
886
          export_symbols_regex="$arg"
 
887
          prev=
 
888
          continue
 
889
          ;;
 
890
        release)
 
891
          release="-$arg"
 
892
          prev=
 
893
          continue
 
894
          ;;
 
895
        rpath | xrpath)
 
896
          # We need an absolute path.
 
897
          case $arg in
 
898
          [\\/]* | [A-Za-z]:[\\/]*) ;;
 
899
          *)
 
900
            $echo "$modename: only absolute run-paths are allowed" 1>&2
 
901
            exit 1
 
902
            ;;
 
903
          esac
 
904
          if test "$prev" = rpath; then
 
905
            case "$rpath " in
 
906
            *" $arg "*) ;;
 
907
            *) rpath="$rpath $arg" ;;
 
908
            esac
 
909
          else
 
910
            case "$xrpath " in
 
911
            *" $arg "*) ;;
 
912
            *) xrpath="$xrpath $arg" ;;
 
913
            esac
 
914
          fi
 
915
          prev=
 
916
          continue
 
917
          ;;
 
918
        xcompiler)
 
919
          compiler_flags="$compiler_flags $qarg"
 
920
          prev=
 
921
          compile_command="$compile_command $qarg"
 
922
          finalize_command="$finalize_command $qarg"
 
923
          continue
 
924
          ;;
 
925
        xlinker)
 
926
          linker_flags="$linker_flags $qarg"
 
927
          compiler_flags="$compiler_flags $wl$qarg"
 
928
          prev=
 
929
          compile_command="$compile_command $wl$qarg"
 
930
          finalize_command="$finalize_command $wl$qarg"
 
931
          continue
 
932
          ;;
 
933
        *)
 
934
          eval "$prev=\"\$arg\""
 
935
          prev=
 
936
          continue
 
937
          ;;
 
938
        esac
 
939
      fi # test -n $prev
 
940
 
 
941
      prevarg="$arg"
 
942
 
 
943
      case $arg in
 
944
      -all-static)
 
945
        if test -n "$link_static_flag"; then
 
946
          compile_command="$compile_command $link_static_flag"
 
947
          finalize_command="$finalize_command $link_static_flag"
 
948
        fi
 
949
        continue
 
950
        ;;
 
951
 
 
952
      -allow-undefined)
 
953
        # FIXME: remove this flag sometime in the future.
 
954
        $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
 
955
        continue
 
956
        ;;
 
957
 
 
958
      -avoid-version)
 
959
        avoid_version=yes
 
960
        continue
 
961
        ;;
 
962
 
 
963
      -dlopen)
 
964
        prev=dlfiles
 
965
        continue
 
966
        ;;
 
967
 
 
968
      -dlpreopen)
 
969
        prev=dlprefiles
 
970
        continue
 
971
        ;;
 
972
 
 
973
      -export-dynamic)
 
974
        export_dynamic=yes
 
975
        continue
 
976
        ;;
 
977
 
 
978
      -export-symbols | -export-symbols-regex)
 
979
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
 
980
          $echo "$modename: more than one -exported-symbols argument is not allowed"
 
981
          exit 1
 
982
        fi
 
983
        if test "X$arg" = "X-export-symbols"; then
 
984
          prev=expsyms
 
985
        else
 
986
          prev=expsyms_regex
 
987
        fi
 
988
        continue
 
989
        ;;
 
990
 
 
991
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
 
992
      # so, if we see these flags be careful not to treat them like -L
 
993
      -L[A-Z][A-Z]*:*)
 
994
        case $with_gcc/$host in
 
995
        no/*-*-irix*)
 
996
          compile_command="$compile_command $arg"
 
997
          finalize_command="$finalize_command $arg"
 
998
          ;;
 
999
        esac
 
1000
        continue
 
1001
        ;;
 
1002
 
 
1003
      -L*)
 
1004
        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
 
1005
        # We need an absolute path.
 
1006
        case $dir in
 
1007
        [\\/]* | [A-Za-z]:[\\/]*) ;;
 
1008
        *)
 
1009
          absdir=`cd "$dir" && pwd`
 
1010
          if test -z "$absdir"; then
 
1011
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
 
1012
            exit 1
 
1013
          fi
 
1014
          dir="$absdir"
 
1015
          ;;
 
1016
        esac
 
1017
        case "$deplibs " in
 
1018
        *" -L$dir "*) ;;
 
1019
        *)
 
1020
          deplibs="$deplibs -L$dir"
 
1021
          lib_search_path="$lib_search_path $dir"
 
1022
          ;;
 
1023
        esac
 
1024
        case $host in
 
1025
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1026
          case :$dllsearchpath: in
 
1027
          *":$dir:"*) ;;
 
1028
          *) dllsearchpath="$dllsearchpath:$dir";;
 
1029
          esac
 
1030
          ;;
 
1031
        esac
 
1032
        continue
 
1033
        ;;
 
1034
 
 
1035
      -l*)
 
1036
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 
1037
          case $host in
 
1038
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1039
            # These systems don't actually have a C or math library (as such)
 
1040
            continue
 
1041
            ;;
 
1042
          *-*-mingw* | *-*-os2*)
 
1043
            # These systems don't actually have a C library (as such)
 
1044
            test "X$arg" = "X-lc" && continue
 
1045
            ;;
 
1046
          *-*-openbsd*)
 
1047
            # Do not include libc due to us having libc/libc_r.
 
1048
            test "X$arg" = "X-lc" && continue
 
1049
            ;;
 
1050
          esac
 
1051
         elif test "X$arg" = "X-lc_r"; then
 
1052
          case $host in
 
1053
          *-*-openbsd*)
 
1054
            # Do not include libc_r directly, use -pthread flag.
 
1055
            continue
 
1056
            ;;
 
1057
          esac
 
1058
        fi
 
1059
        deplibs="$deplibs $arg"
 
1060
        continue
 
1061
        ;;
 
1062
 
 
1063
      -module)
 
1064
        module=yes
 
1065
        continue
 
1066
        ;;
 
1067
 
 
1068
      #### Local change for Sleepycat's Berkeley DB [#6117]:
 
1069
      -jnimodule)
 
1070
        module=yes
 
1071
        jnimodule=yes
 
1072
        continue
 
1073
        ;;
 
1074
 
 
1075
      -no-fast-install)
 
1076
        fast_install=no
 
1077
        continue
 
1078
        ;;
 
1079
 
 
1080
      -no-install)
 
1081
        case $host in
 
1082
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1083
          # The PATH hackery in wrapper scripts is required on Windows
 
1084
          # in order for the loader to find any dlls it needs.
 
1085
          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
 
1086
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
 
1087
          fast_install=no
 
1088
          ;;
 
1089
        *) no_install=yes ;;
 
1090
        esac
 
1091
        continue
 
1092
        ;;
 
1093
 
 
1094
      -no-undefined)
 
1095
        allow_undefined=no
 
1096
        continue
 
1097
        ;;
 
1098
 
 
1099
      -o) prev=output ;;
 
1100
 
 
1101
      -release)
 
1102
        prev=release
 
1103
        continue
 
1104
        ;;
 
1105
 
 
1106
      -rpath)
 
1107
        prev=rpath
 
1108
        continue
 
1109
        ;;
 
1110
 
 
1111
      -R)
 
1112
        prev=xrpath
 
1113
        continue
 
1114
        ;;
 
1115
 
 
1116
      -R*)
 
1117
        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
 
1118
        # We need an absolute path.
 
1119
        case $dir in
 
1120
        [\\/]* | [A-Za-z]:[\\/]*) ;;
 
1121
        *)
 
1122
          $echo "$modename: only absolute run-paths are allowed" 1>&2
 
1123
          exit 1
 
1124
          ;;
 
1125
        esac
 
1126
        case "$xrpath " in
 
1127
        *" $dir "*) ;;
 
1128
        *) xrpath="$xrpath $dir" ;;
 
1129
        esac
 
1130
        continue
 
1131
        ;;
 
1132
 
 
1133
      -static)
 
1134
        # The effects of -static are defined in a previous loop.
 
1135
        # We used to do the same as -all-static on platforms that
 
1136
        # didn't have a PIC flag, but the assumption that the effects
 
1137
        # would be equivalent was wrong.  It would break on at least
 
1138
        # Digital Unix and AIX.
 
1139
        continue
 
1140
        ;;
 
1141
 
 
1142
      -thread-safe)
 
1143
        thread_safe=yes
 
1144
        continue
 
1145
        ;;
 
1146
 
 
1147
      -version-info)
 
1148
        prev=vinfo
 
1149
        continue
 
1150
        ;;
 
1151
 
 
1152
      -Wc,*)
 
1153
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
 
1154
        arg=
 
1155
        save_ifs="$IFS"; IFS=','
 
1156
        for flag in $args; do
 
1157
          IFS="$save_ifs"
 
1158
          case $flag in
 
1159
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1160
            flag="\"$flag\""
 
1161
            ;;
 
1162
          esac
 
1163
          arg="$arg $wl$flag"
 
1164
          compiler_flags="$compiler_flags $flag"
 
1165
        done
 
1166
        IFS="$save_ifs"
 
1167
        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
 
1168
        ;;
 
1169
 
 
1170
      -Wl,*)
 
1171
        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
 
1172
        arg=
 
1173
        save_ifs="$IFS"; IFS=','
 
1174
        for flag in $args; do
 
1175
          IFS="$save_ifs"
 
1176
          case $flag in
 
1177
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
 
1178
            flag="\"$flag\""
 
1179
            ;;
 
1180
          esac
 
1181
          arg="$arg $wl$flag"
 
1182
          compiler_flags="$compiler_flags $wl$flag"
 
1183
          linker_flags="$linker_flags $flag"
 
1184
        done
 
1185
        IFS="$save_ifs"
 
1186
        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
 
1187
        ;;
 
1188
 
 
1189
      -Xcompiler)
 
1190
        prev=xcompiler
 
1191
        continue
 
1192
        ;;
 
1193
 
 
1194
      -Xlinker)
 
1195
        prev=xlinker
 
1196
        continue
 
1197
        ;;
 
1198
 
 
1199
      # Some other compiler flag.
 
1200
      -* | +*)
 
1201
        # Unknown arguments in both finalize_command and compile_command need
 
1202
        # to be aesthetically quoted because they are evaled later.
 
1203
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1204
        case $arg in
 
1205
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1206
          arg="\"$arg\""
 
1207
          ;;
 
1208
        esac
 
1209
        ;;
 
1210
 
 
1211
      *.lo | *.$objext)
 
1212
        # A library or standard object.
 
1213
        if test "$prev" = dlfiles; then
 
1214
          # This file was specified with -dlopen.
 
1215
          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
 
1216
            dlfiles="$dlfiles $arg"
 
1217
            prev=
 
1218
            continue
 
1219
          else
 
1220
            # If libtool objects are unsupported, then we need to preload.
 
1221
            prev=dlprefiles
 
1222
          fi
 
1223
        fi
 
1224
 
 
1225
        if test "$prev" = dlprefiles; then
 
1226
          # Preload the old-style object.
 
1227
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
 
1228
          prev=
 
1229
        else
 
1230
          case $arg in
 
1231
          *.lo) libobjs="$libobjs $arg" ;;
 
1232
          *) objs="$objs $arg" ;;
 
1233
          esac
 
1234
        fi
 
1235
        ;;
 
1236
 
 
1237
      *.$libext)
 
1238
        # An archive.
 
1239
        deplibs="$deplibs $arg"
 
1240
        old_deplibs="$old_deplibs $arg"
 
1241
        continue
 
1242
        ;;
 
1243
 
 
1244
      *.la)
 
1245
        # A libtool-controlled library.
 
1246
 
 
1247
        if test "$prev" = dlfiles; then
 
1248
          # This library was specified with -dlopen.
 
1249
          dlfiles="$dlfiles $arg"
 
1250
          prev=
 
1251
        elif test "$prev" = dlprefiles; then
 
1252
          # The library was specified with -dlpreopen.
 
1253
          dlprefiles="$dlprefiles $arg"
 
1254
          prev=
 
1255
        else
 
1256
          deplibs="$deplibs $arg"
 
1257
        fi
 
1258
        continue
 
1259
        ;;
 
1260
 
 
1261
      # Some other compiler argument.
 
1262
      *)
 
1263
        # Unknown arguments in both finalize_command and compile_command need
 
1264
        # to be aesthetically quoted because they are evaled later.
 
1265
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
1266
        case $arg in
 
1267
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
 
1268
          arg="\"$arg\""
 
1269
          ;;
 
1270
        esac
 
1271
        ;;
 
1272
      esac # arg
 
1273
 
 
1274
      # Now actually substitute the argument into the commands.
 
1275
      if test -n "$arg"; then
 
1276
        compile_command="$compile_command $arg"
 
1277
        finalize_command="$finalize_command $arg"
 
1278
      fi
 
1279
    done # argument parsing loop
 
1280
 
 
1281
    if test -n "$prev"; then
 
1282
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
 
1283
      $echo "$help" 1>&2
 
1284
      exit 1
 
1285
    fi
 
1286
 
 
1287
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
 
1288
      eval arg=\"$export_dynamic_flag_spec\"
 
1289
      compile_command="$compile_command $arg"
 
1290
      finalize_command="$finalize_command $arg"
 
1291
    fi
 
1292
 
 
1293
    # calculate the name of the file, without its directory
 
1294
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
 
1295
    libobjs_save="$libobjs"
 
1296
 
 
1297
    if test -n "$shlibpath_var"; then
 
1298
      # get the directories listed in $shlibpath_var
 
1299
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
 
1300
    else
 
1301
      shlib_search_path=
 
1302
    fi
 
1303
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
 
1304
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
 
1305
 
 
1306
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
 
1307
    if test "X$output_objdir" = "X$output"; then
 
1308
      output_objdir="$objdir"
 
1309
    else
 
1310
      output_objdir="$output_objdir/$objdir"
 
1311
    fi
 
1312
    # Create the object directory.
 
1313
    if test ! -d $output_objdir; then
 
1314
      $show "$mkdir $output_objdir"
 
1315
      $run $mkdir $output_objdir
 
1316
      status=$?
 
1317
      if test $status -ne 0 && test ! -d $output_objdir; then
 
1318
        exit $status
 
1319
      fi
 
1320
    fi
 
1321
 
 
1322
    # Determine the type of output
 
1323
    case $output in
 
1324
    "")
 
1325
      $echo "$modename: you must specify an output file" 1>&2
 
1326
      $echo "$help" 1>&2
 
1327
      exit 1
 
1328
      ;;
 
1329
    *.$libext) linkmode=oldlib ;;
 
1330
    *.lo | *.$objext) linkmode=obj ;;
 
1331
    *.la) linkmode=lib ;;
 
1332
    *) linkmode=prog ;; # Anything else should be a program.
 
1333
    esac
 
1334
 
 
1335
    specialdeplibs=
 
1336
    libs=
 
1337
    # Find all interdependent deplibs by searching for libraries
 
1338
    # that are linked more than once (e.g. -la -lb -la)
 
1339
    for deplib in $deplibs; do
 
1340
      case "$libs " in
 
1341
      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1342
      esac
 
1343
      libs="$libs $deplib"
 
1344
    done
 
1345
    deplibs=
 
1346
    newdependency_libs=
 
1347
    newlib_search_path=
 
1348
    need_relink=no # whether we're linking any uninstalled libtool libraries
 
1349
    notinst_deplibs= # not-installed libtool libraries
 
1350
    notinst_path= # paths that contain not-installed libtool libraries
 
1351
    case $linkmode in
 
1352
    lib)
 
1353
        passes="conv link"
 
1354
        for file in $dlfiles $dlprefiles; do
 
1355
          case $file in
 
1356
          *.la) ;;
 
1357
          *)
 
1358
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
 
1359
            exit 1
 
1360
            ;;
 
1361
          esac
 
1362
        done
 
1363
        ;;
 
1364
    prog)
 
1365
        compile_deplibs=
 
1366
        finalize_deplibs=
 
1367
        alldeplibs=no
 
1368
        newdlfiles=
 
1369
        newdlprefiles=
 
1370
        passes="conv scan dlopen dlpreopen link"
 
1371
        ;;
 
1372
    *)  passes="conv"
 
1373
        ;;
 
1374
    esac
 
1375
    for pass in $passes; do
 
1376
      if test $linkmode = prog; then
 
1377
        # Determine which files to process
 
1378
        case $pass in
 
1379
        dlopen)
 
1380
          libs="$dlfiles"
 
1381
          save_deplibs="$deplibs" # Collect dlpreopened libraries
 
1382
          deplibs=
 
1383
          ;;
 
1384
        dlpreopen) libs="$dlprefiles" ;;
 
1385
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
1386
        esac
 
1387
      fi
 
1388
      for deplib in $libs; do
 
1389
        lib=
 
1390
        found=no
 
1391
        case $deplib in
 
1392
        -l*)
 
1393
          if test $linkmode = oldlib && test $linkmode = obj; then
 
1394
            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
 
1395
            continue
 
1396
          fi
 
1397
          if test $pass = conv; then
 
1398
            deplibs="$deplib $deplibs"
 
1399
            continue
 
1400
          fi
 
1401
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
 
1402
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
1403
            # Search the libtool library
 
1404
            lib="$searchdir/lib${name}.la"
 
1405
            if test -f "$lib"; then
 
1406
              found=yes
 
1407
              break
 
1408
            fi
 
1409
          done
 
1410
          if test "$found" != yes; then
 
1411
            # deplib doesn't seem to be a libtool library
 
1412
            if test "$linkmode,$pass" = "prog,link"; then
 
1413
              compile_deplibs="$deplib $compile_deplibs"
 
1414
              finalize_deplibs="$deplib $finalize_deplibs"
 
1415
            else
 
1416
              deplibs="$deplib $deplibs"
 
1417
              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
 
1418
            fi
 
1419
            continue
 
1420
          fi
 
1421
          ;; # -l
 
1422
        -L*)
 
1423
          case $linkmode in
 
1424
          lib)
 
1425
            deplibs="$deplib $deplibs"
 
1426
            test $pass = conv && continue
 
1427
            newdependency_libs="$deplib $newdependency_libs"
 
1428
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 
1429
            ;;
 
1430
          prog)
 
1431
            if test $pass = conv; then
 
1432
              deplibs="$deplib $deplibs"
 
1433
              continue
 
1434
            fi
 
1435
            if test $pass = scan; then
 
1436
              deplibs="$deplib $deplibs"
 
1437
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
 
1438
            else
 
1439
              compile_deplibs="$deplib $compile_deplibs"
 
1440
              finalize_deplibs="$deplib $finalize_deplibs"
 
1441
            fi
 
1442
            ;;
 
1443
          *)
 
1444
            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
 
1445
            ;;
 
1446
          esac # linkmode
 
1447
          continue
 
1448
          ;; # -L
 
1449
        -R*)
 
1450
          if test $pass = link; then
 
1451
            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
 
1452
            # Make sure the xrpath contains only unique directories.
 
1453
            case "$xrpath " in
 
1454
            *" $dir "*) ;;
 
1455
            *) xrpath="$xrpath $dir" ;;
 
1456
            esac
 
1457
          fi
 
1458
          deplibs="$deplib $deplibs"
 
1459
          continue
 
1460
          ;;
 
1461
        *.la) lib="$deplib" ;;
 
1462
        *.$libext)
 
1463
          if test $pass = conv; then
 
1464
            deplibs="$deplib $deplibs"
 
1465
            continue
 
1466
          fi
 
1467
          case $linkmode in
 
1468
          lib)
 
1469
            if test "$deplibs_check_method" != pass_all; then
 
1470
              echo
 
1471
              echo "*** Warning: This library needs some functionality provided by $deplib."
 
1472
              echo "*** I have the capability to make that library automatically link in when"
 
1473
              echo "*** you link to this library.  But I can only do this if you have a"
 
1474
              echo "*** shared version of the library, which you do not appear to have."
 
1475
            else
 
1476
              echo
 
1477
              echo "*** Warning: Linking the shared library $output against the"
 
1478
              echo "*** static library $deplib is not portable!"
 
1479
              deplibs="$deplib $deplibs"
 
1480
            fi
 
1481
            continue
 
1482
            ;;
 
1483
          prog)
 
1484
            if test $pass != link; then
 
1485
              deplibs="$deplib $deplibs"
 
1486
            else
 
1487
              compile_deplibs="$deplib $compile_deplibs"
 
1488
              finalize_deplibs="$deplib $finalize_deplibs"
 
1489
            fi
 
1490
            continue
 
1491
            ;;
 
1492
          esac # linkmode
 
1493
          ;; # *.$libext
 
1494
        *.lo | *.$objext)
 
1495
          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
1496
            # If there is no dlopen support or we're linking statically,
 
1497
            # we need to preload.
 
1498
            newdlprefiles="$newdlprefiles $deplib"
 
1499
            compile_deplibs="$deplib $compile_deplibs"
 
1500
            finalize_deplibs="$deplib $finalize_deplibs"
 
1501
          else
 
1502
            newdlfiles="$newdlfiles $deplib"
 
1503
          fi
 
1504
          continue
 
1505
          ;;
 
1506
        %DEPLIBS%)
 
1507
          alldeplibs=yes
 
1508
          continue
 
1509
          ;;
 
1510
        esac # case $deplib
 
1511
        if test $found = yes || test -f "$lib"; then :
 
1512
        else
 
1513
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
1514
          exit 1
 
1515
        fi
 
1516
 
 
1517
        # Check to see that this really is a libtool archive.
 
1518
        if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
1519
        else
 
1520
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
1521
          exit 1
 
1522
        fi
 
1523
 
 
1524
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
 
1525
        test "X$ladir" = "X$lib" && ladir="."
 
1526
 
 
1527
        dlname=
 
1528
        dlopen=
 
1529
        dlpreopen=
 
1530
        libdir=
 
1531
        library_names=
 
1532
        old_library=
 
1533
        # If the library was installed with an old release of libtool,
 
1534
        # it will not redefine variable installed.
 
1535
        installed=yes
 
1536
 
 
1537
        # Read the .la file
 
1538
        case $lib in
 
1539
        */* | *\\*) . $lib ;;
 
1540
        *) . ./$lib ;;
 
1541
        esac
 
1542
 
 
1543
        if test "$linkmode,$pass" = "lib,link" ||
 
1544
           test "$linkmode,$pass" = "prog,scan" ||
 
1545
           { test $linkmode = oldlib && test $linkmode = obj; }; then
 
1546
           # Add dl[pre]opened files of deplib
 
1547
          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
 
1548
          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
 
1549
        fi
 
1550
 
 
1551
        if test $pass = conv; then
 
1552
          # Only check for convenience libraries
 
1553
          deplibs="$lib $deplibs"
 
1554
          if test -z "$libdir"; then
 
1555
            if test -z "$old_library"; then
 
1556
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
 
1557
              exit 1
 
1558
            fi
 
1559
            # It is a libtool convenience library, so add in its objects.
 
1560
            convenience="$convenience $ladir/$objdir/$old_library"
 
1561
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
 
1562
            tmp_libs=
 
1563
            for deplib in $dependency_libs; do
 
1564
              deplibs="$deplib $deplibs"
 
1565
              case "$tmp_libs " in
 
1566
              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1567
              esac
 
1568
              tmp_libs="$tmp_libs $deplib"
 
1569
            done
 
1570
          elif test $linkmode != prog && test $linkmode != lib; then
 
1571
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
 
1572
            exit 1
 
1573
          fi
 
1574
          continue
 
1575
        fi # $pass = conv
 
1576
 
 
1577
        # Get the name of the library we link against.
 
1578
        linklib=
 
1579
        for l in $old_library $library_names; do
 
1580
          linklib="$l"
 
1581
        done
 
1582
        if test -z "$linklib"; then
 
1583
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
 
1584
          exit 1
 
1585
        fi
 
1586
 
 
1587
        # This library was specified with -dlopen.
 
1588
        if test $pass = dlopen; then
 
1589
          if test -z "$libdir"; then
 
1590
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
 
1591
            exit 1
 
1592
          fi
 
1593
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
1594
            # If there is no dlname, no dlopen support or we're linking
 
1595
            # statically, we need to preload.
 
1596
            dlprefiles="$dlprefiles $lib"
 
1597
          else
 
1598
            newdlfiles="$newdlfiles $lib"
 
1599
          fi
 
1600
          continue
 
1601
        fi # $pass = dlopen
 
1602
 
 
1603
        # We need an absolute path.
 
1604
        case $ladir in
 
1605
        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
 
1606
        *)
 
1607
          abs_ladir=`cd "$ladir" && pwd`
 
1608
          if test -z "$abs_ladir"; then
 
1609
            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
 
1610
            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
 
1611
            abs_ladir="$ladir"
 
1612
          fi
 
1613
          ;;
 
1614
        esac
 
1615
        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
1616
 
 
1617
        # Find the relevant object directory and library name.
 
1618
        if test "X$installed" = Xyes; then
 
1619
          if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 
1620
            $echo "$modename: warning: library \`$lib' was moved." 1>&2
 
1621
            dir="$ladir"
 
1622
            absdir="$abs_ladir"
 
1623
            libdir="$abs_ladir"
 
1624
          else
 
1625
            dir="$libdir"
 
1626
            absdir="$libdir"
 
1627
          fi
 
1628
        else
 
1629
          dir="$ladir/$objdir"
 
1630
          absdir="$abs_ladir/$objdir"
 
1631
          # Remove this search path later
 
1632
          notinst_path="$notinst_path $abs_ladir"
 
1633
        fi # $installed = yes
 
1634
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
1635
 
 
1636
        # This library was specified with -dlpreopen.
 
1637
        if test $pass = dlpreopen; then
 
1638
          if test -z "$libdir"; then
 
1639
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
 
1640
            exit 1
 
1641
          fi
 
1642
          # Prefer using a static library (so that no silly _DYNAMIC symbols
 
1643
          # are required to link).
 
1644
          if test -n "$old_library"; then
 
1645
            newdlprefiles="$newdlprefiles $dir/$old_library"
 
1646
          # Otherwise, use the dlname, so that lt_dlopen finds it.
 
1647
          elif test -n "$dlname"; then
 
1648
            newdlprefiles="$newdlprefiles $dir/$dlname"
 
1649
          else
 
1650
            newdlprefiles="$newdlprefiles $dir/$linklib"
 
1651
          fi
 
1652
        fi # $pass = dlpreopen
 
1653
 
 
1654
        if test -z "$libdir"; then
 
1655
          # Link the convenience library
 
1656
          if test $linkmode = lib; then
 
1657
            deplibs="$dir/$old_library $deplibs"
 
1658
          elif test "$linkmode,$pass" = "prog,link"; then
 
1659
            compile_deplibs="$dir/$old_library $compile_deplibs"
 
1660
            finalize_deplibs="$dir/$old_library $finalize_deplibs"
 
1661
          else
 
1662
            deplibs="$lib $deplibs"
 
1663
          fi
 
1664
          continue
 
1665
        fi
 
1666
 
 
1667
        if test $linkmode = prog && test $pass != link; then
 
1668
          newlib_search_path="$newlib_search_path $ladir"
 
1669
          deplibs="$lib $deplibs"
 
1670
 
 
1671
          linkalldeplibs=no
 
1672
          if test "$link_all_deplibs" != no || test -z "$library_names" ||
 
1673
             test "$build_libtool_libs" = no; then
 
1674
            linkalldeplibs=yes
 
1675
          fi
 
1676
 
 
1677
          tmp_libs=
 
1678
          for deplib in $dependency_libs; do
 
1679
            case $deplib in
 
1680
            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
 
1681
            esac
 
1682
            # Need to link against all dependency_libs?
 
1683
            if test $linkalldeplibs = yes; then
 
1684
              deplibs="$deplib $deplibs"
 
1685
            else
 
1686
              # Need to hardcode shared library paths
 
1687
              # or/and link against static libraries
 
1688
              newdependency_libs="$deplib $newdependency_libs"
 
1689
            fi
 
1690
            case "$tmp_libs " in
 
1691
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1692
            esac
 
1693
            tmp_libs="$tmp_libs $deplib"
 
1694
          done # for deplib
 
1695
          continue
 
1696
        fi # $linkmode = prog...
 
1697
 
 
1698
        link_static=no # Whether the deplib will be linked statically
 
1699
        if test -n "$library_names" &&
 
1700
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
1701
          # Link against this shared library
 
1702
 
 
1703
          if test "$linkmode,$pass" = "prog,link" ||
 
1704
           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
 
1705
            # Hardcode the library path.
 
1706
            # Skip directories that are in the system default run-time
 
1707
            # search path.
 
1708
            case " $sys_lib_dlsearch_path " in
 
1709
            *" $absdir "*) ;;
 
1710
            *)
 
1711
              case "$compile_rpath " in
 
1712
              *" $absdir "*) ;;
 
1713
              *) compile_rpath="$compile_rpath $absdir"
 
1714
              esac
 
1715
              ;;
 
1716
            esac
 
1717
            case " $sys_lib_dlsearch_path " in
 
1718
            *" $libdir "*) ;;
 
1719
            *)
 
1720
              case "$finalize_rpath " in
 
1721
              *" $libdir "*) ;;
 
1722
              *) finalize_rpath="$finalize_rpath $libdir"
 
1723
              esac
 
1724
              ;;
 
1725
            esac
 
1726
            if test $linkmode = prog; then
 
1727
              # We need to hardcode the library path
 
1728
              if test -n "$shlibpath_var"; then
 
1729
                # Make sure the rpath contains only unique directories.
 
1730
                case "$temp_rpath " in
 
1731
                *" $dir "*) ;;
 
1732
                *" $absdir "*) ;;
 
1733
                *) temp_rpath="$temp_rpath $dir" ;;
 
1734
                esac
 
1735
              fi
 
1736
            fi
 
1737
          fi # $linkmode,$pass = prog,link...
 
1738
 
 
1739
          if test "$alldeplibs" = yes &&
 
1740
             { test "$deplibs_check_method" = pass_all ||
 
1741
               { test "$build_libtool_libs" = yes &&
 
1742
                 test -n "$library_names"; }; }; then
 
1743
            # We only need to search for static libraries
 
1744
            continue
 
1745
          fi
 
1746
 
 
1747
          if test "$installed" = no; then
 
1748
            notinst_deplibs="$notinst_deplibs $lib"
 
1749
            need_relink=yes
 
1750
          fi
 
1751
 
 
1752
          if test -n "$old_archive_from_expsyms_cmds"; then
 
1753
            # figure out the soname
 
1754
            set dummy $library_names
 
1755
            realname="$2"
 
1756
            shift; shift
 
1757
            libname=`eval \\$echo \"$libname_spec\"`
 
1758
            # use dlname if we got it. it's perfectly good, no?
 
1759
            if test -n "$dlname"; then
 
1760
              soname="$dlname"
 
1761
            elif test -n "$soname_spec"; then
 
1762
              # bleh windows
 
1763
              case $host in
 
1764
              *cygwin*)
 
1765
                major=`expr $current - $age`
 
1766
                versuffix="-$major"
 
1767
                ;;
 
1768
              esac
 
1769
              eval soname=\"$soname_spec\"
 
1770
            else
 
1771
              soname="$realname"
 
1772
            fi
 
1773
 
 
1774
            # Make a new name for the extract_expsyms_cmds to use
 
1775
            soroot="$soname"
 
1776
            soname=`echo $soroot | sed -e 's/^.*\///'`
 
1777
            newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
 
1778
 
 
1779
            # If the library has no export list, then create one now
 
1780
            if test -f "$output_objdir/$soname-def"; then :
 
1781
            else
 
1782
              $show "extracting exported symbol list from \`$soname'"
 
1783
              save_ifs="$IFS"; IFS='~'
 
1784
              eval cmds=\"$extract_expsyms_cmds\"
 
1785
              for cmd in $cmds; do
 
1786
                IFS="$save_ifs"
 
1787
                $show "$cmd"
 
1788
                $run eval "$cmd" || exit $?
 
1789
              done
 
1790
              IFS="$save_ifs"
 
1791
            fi
 
1792
 
 
1793
            # Create $newlib
 
1794
            if test -f "$output_objdir/$newlib"; then :; else
 
1795
              $show "generating import library for \`$soname'"
 
1796
              save_ifs="$IFS"; IFS='~'
 
1797
              eval cmds=\"$old_archive_from_expsyms_cmds\"
 
1798
              for cmd in $cmds; do
 
1799
                IFS="$save_ifs"
 
1800
                $show "$cmd"
 
1801
                $run eval "$cmd" || exit $?
 
1802
              done
 
1803
              IFS="$save_ifs"
 
1804
            fi
 
1805
            # make sure the library variables are pointing to the new library
 
1806
            dir=$output_objdir
 
1807
            linklib=$newlib
 
1808
          fi # test -n $old_archive_from_expsyms_cmds
 
1809
 
 
1810
          if test $linkmode = prog || test "$mode" != relink; then
 
1811
            add_shlibpath=
 
1812
            add_dir=
 
1813
            add=
 
1814
            lib_linked=yes
 
1815
            case $hardcode_action in
 
1816
            immediate | unsupported)
 
1817
              if test "$hardcode_direct" = no; then
 
1818
                add="$dir/$linklib"
 
1819
              elif test "$hardcode_minus_L" = no; then
 
1820
                case $host in
 
1821
                *-*-sunos*) add_shlibpath="$dir" ;;
 
1822
                esac
 
1823
                add_dir="-L$dir"
 
1824
                add="-l$name"
 
1825
              elif test "$hardcode_shlibpath_var" = no; then
 
1826
                add_shlibpath="$dir"
 
1827
                add="-l$name"
 
1828
              else
 
1829
                lib_linked=no
 
1830
              fi
 
1831
              ;;
 
1832
            relink)
 
1833
              if test "$hardcode_direct" = yes; then
 
1834
                add="$dir/$linklib"
 
1835
              elif test "$hardcode_minus_L" = yes; then
 
1836
                add_dir="-L$dir"
 
1837
                add="-l$name"
 
1838
              elif test "$hardcode_shlibpath_var" = yes; then
 
1839
                add_shlibpath="$dir"
 
1840
                add="-l$name"
 
1841
              else
 
1842
                lib_linked=no
 
1843
              fi
 
1844
              ;;
 
1845
            *) lib_linked=no ;;
 
1846
            esac
 
1847
 
 
1848
            if test "$lib_linked" != yes; then
 
1849
              $echo "$modename: configuration error: unsupported hardcode properties"
 
1850
              exit 1
 
1851
            fi
 
1852
 
 
1853
            if test -n "$add_shlibpath"; then
 
1854
              case :$compile_shlibpath: in
 
1855
              *":$add_shlibpath:"*) ;;
 
1856
              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
 
1857
              esac
 
1858
            fi
 
1859
            if test $linkmode = prog; then
 
1860
              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
 
1861
              test -n "$add" && compile_deplibs="$add $compile_deplibs"
 
1862
            else
 
1863
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
 
1864
              test -n "$add" && deplibs="$add $deplibs"
 
1865
              if test "$hardcode_direct" != yes && \
 
1866
                 test "$hardcode_minus_L" != yes && \
 
1867
                 test "$hardcode_shlibpath_var" = yes; then
 
1868
                case :$finalize_shlibpath: in
 
1869
                *":$libdir:"*) ;;
 
1870
                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 
1871
                esac
 
1872
              fi
 
1873
            fi
 
1874
          fi
 
1875
 
 
1876
          if test $linkmode = prog || test "$mode" = relink; then
 
1877
            add_shlibpath=
 
1878
            add_dir=
 
1879
            add=
 
1880
            # Finalize command for both is simple: just hardcode it.
 
1881
            if test "$hardcode_direct" = yes; then
 
1882
              add="$libdir/$linklib"
 
1883
            elif test "$hardcode_minus_L" = yes; then
 
1884
              add_dir="-L$libdir"
 
1885
              add="-l$name"
 
1886
            elif test "$hardcode_shlibpath_var" = yes; then
 
1887
              case :$finalize_shlibpath: in
 
1888
              *":$libdir:"*) ;;
 
1889
              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 
1890
              esac
 
1891
              add="-l$name"
 
1892
            else
 
1893
              # We cannot seem to hardcode it, guess we'll fake it.
 
1894
              add_dir="-L$libdir"
 
1895
              add="-l$name"
 
1896
            fi
 
1897
 
 
1898
            if test $linkmode = prog; then
 
1899
              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
 
1900
              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
 
1901
            else
 
1902
              test -n "$add_dir" && deplibs="$add_dir $deplibs"
 
1903
              test -n "$add" && deplibs="$add $deplibs"
 
1904
            fi
 
1905
          fi
 
1906
        elif test $linkmode = prog; then
 
1907
          if test "$alldeplibs" = yes &&
 
1908
             { test "$deplibs_check_method" = pass_all ||
 
1909
               { test "$build_libtool_libs" = yes &&
 
1910
                 test -n "$library_names"; }; }; then
 
1911
            # We only need to search for static libraries
 
1912
            continue
 
1913
          fi
 
1914
 
 
1915
          # Try to link the static library
 
1916
          # Here we assume that one of hardcode_direct or hardcode_minus_L
 
1917
          # is not unsupported.  This is valid on all known static and
 
1918
          # shared platforms.
 
1919
          if test "$hardcode_direct" != unsupported; then
 
1920
            test -n "$old_library" && linklib="$old_library"
 
1921
            compile_deplibs="$dir/$linklib $compile_deplibs"
 
1922
            finalize_deplibs="$dir/$linklib $finalize_deplibs"
 
1923
          else
 
1924
            compile_deplibs="-l$name -L$dir $compile_deplibs"
 
1925
            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
 
1926
          fi
 
1927
        elif test "$build_libtool_libs" = yes; then
 
1928
          # Not a shared library
 
1929
          if test "$deplibs_check_method" != pass_all; then
 
1930
            # We're trying link a shared library against a static one
 
1931
            # but the system doesn't support it.
 
1932
 
 
1933
            # Just print a warning and add the library to dependency_libs so
 
1934
            # that the program can be linked against the static library.
 
1935
            echo
 
1936
            echo "*** Warning: This library needs some functionality provided by $lib."
 
1937
            echo "*** I have the capability to make that library automatically link in when"
 
1938
            echo "*** you link to this library.  But I can only do this if you have a"
 
1939
            echo "*** shared version of the library, which you do not appear to have."
 
1940
            if test "$module" = yes; then
 
1941
              echo "*** Therefore, libtool will create a static module, that should work "
 
1942
              echo "*** as long as the dlopening application is linked with the -dlopen flag."
 
1943
              if test -z "$global_symbol_pipe"; then
 
1944
                echo
 
1945
                echo "*** However, this would only work if libtool was able to extract symbol"
 
1946
                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
1947
                echo "*** not find such a program.  So, this module is probably useless."
 
1948
                echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
1949
              fi
 
1950
              if test "$build_old_libs" = no; then
 
1951
                build_libtool_libs=module
 
1952
                build_old_libs=yes
 
1953
              else
 
1954
                build_libtool_libs=no
 
1955
              fi
 
1956
            fi
 
1957
          else
 
1958
            convenience="$convenience $dir/$old_library"
 
1959
            old_convenience="$old_convenience $dir/$old_library"
 
1960
            deplibs="$dir/$old_library $deplibs"
 
1961
            link_static=yes
 
1962
          fi
 
1963
        fi # link shared/static library?
 
1964
 
 
1965
        if test $linkmode = lib; then
 
1966
          if test -n "$dependency_libs" &&
 
1967
             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
 
1968
               test $link_static = yes; }; then
 
1969
            # Extract -R from dependency_libs
 
1970
            temp_deplibs=
 
1971
            for libdir in $dependency_libs; do
 
1972
              case $libdir in
 
1973
              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
 
1974
                   case " $xrpath " in
 
1975
                   *" $temp_xrpath "*) ;;
 
1976
                   *) xrpath="$xrpath $temp_xrpath";;
 
1977
                   esac;;
 
1978
              *) temp_deplibs="$temp_deplibs $libdir";;
 
1979
              esac
 
1980
            done
 
1981
            dependency_libs="$temp_deplibs"
 
1982
          fi
 
1983
 
 
1984
          newlib_search_path="$newlib_search_path $absdir"
 
1985
          # Link against this library
 
1986
          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 
1987
          # ... and its dependency_libs
 
1988
          tmp_libs=
 
1989
          for deplib in $dependency_libs; do
 
1990
            newdependency_libs="$deplib $newdependency_libs"
 
1991
            case "$tmp_libs " in
 
1992
            *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 
1993
            esac
 
1994
            tmp_libs="$tmp_libs $deplib"
 
1995
          done
 
1996
 
 
1997
          if test $link_all_deplibs != no; then
 
1998
            # Add the search paths of all dependency libraries
 
1999
            for deplib in $dependency_libs; do
 
2000
              case $deplib in
 
2001
              -L*) path="$deplib" ;;
 
2002
              *.la)
 
2003
                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
 
2004
                test "X$dir" = "X$deplib" && dir="."
 
2005
                # We need an absolute path.
 
2006
                case $dir in
 
2007
                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
 
2008
                *)
 
2009
                  absdir=`cd "$dir" && pwd`
 
2010
                  if test -z "$absdir"; then
 
2011
                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
 
2012
                    absdir="$dir"
 
2013
                  fi
 
2014
                  ;;
 
2015
                esac
 
2016
                if grep "^installed=no" $deplib > /dev/null; then
 
2017
                  path="-L$absdir/$objdir"
 
2018
                else
 
2019
                  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
2020
                  if test -z "$libdir"; then
 
2021
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
 
2022
                    exit 1
 
2023
                  fi
 
2024
                  if test "$absdir" != "$libdir"; then
 
2025
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
 
2026
                  fi
 
2027
                  path="-L$absdir"
 
2028
                fi
 
2029
                ;;
 
2030
              *) continue ;;
 
2031
              esac
 
2032
              case " $deplibs " in
 
2033
              *" $path "*) ;;
 
2034
              *) deplibs="$deplibs $path" ;;
 
2035
              esac
 
2036
            done
 
2037
          fi # link_all_deplibs != no
 
2038
        fi # linkmode = lib
 
2039
      done # for deplib in $libs
 
2040
      if test $pass = dlpreopen; then
 
2041
        # Link the dlpreopened libraries before other libraries
 
2042
        for deplib in $save_deplibs; do
 
2043
          deplibs="$deplib $deplibs"
 
2044
        done
 
2045
      fi
 
2046
      if test $pass != dlopen; then
 
2047
        test $pass != scan && dependency_libs="$newdependency_libs"
 
2048
        if test $pass != conv; then
 
2049
          # Make sure lib_search_path contains only unique directories.
 
2050
          lib_search_path=
 
2051
          for dir in $newlib_search_path; do
 
2052
            case "$lib_search_path " in
 
2053
            *" $dir "*) ;;
 
2054
            *) lib_search_path="$lib_search_path $dir" ;;
 
2055
            esac
 
2056
          done
 
2057
          newlib_search_path=
 
2058
        fi
 
2059
 
 
2060
        if test "$linkmode,$pass" != "prog,link"; then
 
2061
          vars="deplibs"
 
2062
        else
 
2063
          vars="compile_deplibs finalize_deplibs"
 
2064
        fi
 
2065
        for var in $vars dependency_libs; do
 
2066
          # Add libraries to $var in reverse order
 
2067
          eval tmp_libs=\"\$$var\"
 
2068
          new_libs=
 
2069
          for deplib in $tmp_libs; do
 
2070
            case $deplib in
 
2071
            -L*) new_libs="$deplib $new_libs" ;;
 
2072
            *)
 
2073
              case " $specialdeplibs " in
 
2074
              *" $deplib "*) new_libs="$deplib $new_libs" ;;
 
2075
              *)
 
2076
                case " $new_libs " in
 
2077
                *" $deplib "*) ;;
 
2078
                *) new_libs="$deplib $new_libs" ;;
 
2079
                esac
 
2080
                ;;
 
2081
              esac
 
2082
              ;;
 
2083
            esac
 
2084
          done
 
2085
          tmp_libs=
 
2086
          for deplib in $new_libs; do
 
2087
            case $deplib in
 
2088
            -L*)
 
2089
              case " $tmp_libs " in
 
2090
              *" $deplib "*) ;;
 
2091
              *) tmp_libs="$tmp_libs $deplib" ;;
 
2092
              esac
 
2093
              ;;
 
2094
            *) tmp_libs="$tmp_libs $deplib" ;;
 
2095
            esac
 
2096
          done
 
2097
          eval $var=\"$tmp_libs\"
 
2098
        done # for var
 
2099
      fi
 
2100
      if test "$pass" = "conv" &&
 
2101
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
 
2102
        libs="$deplibs" # reset libs
 
2103
        deplibs=
 
2104
      fi
 
2105
    done # for pass
 
2106
    if test $linkmode = prog; then
 
2107
      dlfiles="$newdlfiles"
 
2108
      dlprefiles="$newdlprefiles"
 
2109
    fi
 
2110
 
 
2111
    case $linkmode in
 
2112
    oldlib)
 
2113
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 
2114
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
 
2115
      fi
 
2116
 
 
2117
      if test -n "$rpath"; then
 
2118
        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
 
2119
      fi
 
2120
 
 
2121
      if test -n "$xrpath"; then
 
2122
        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
 
2123
      fi
 
2124
 
 
2125
      if test -n "$vinfo"; then
 
2126
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
 
2127
      fi
 
2128
 
 
2129
      if test -n "$release"; then
 
2130
        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
 
2131
      fi
 
2132
 
 
2133
      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
 
2134
        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
 
2135
      fi
 
2136
 
 
2137
      # Now set the variables for building old libraries.
 
2138
      build_libtool_libs=no
 
2139
      oldlibs="$output"
 
2140
      objs="$objs$old_deplibs"
 
2141
      ;;
 
2142
 
 
2143
    lib)
 
2144
      # Make sure we only generate libraries of the form `libNAME.la'.
 
2145
      case $outputname in
 
2146
      lib*)
 
2147
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
2148
        eval libname=\"$libname_spec\"
 
2149
        ;;
 
2150
      *)
 
2151
        if test "$module" = no; then
 
2152
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
 
2153
          $echo "$help" 1>&2
 
2154
          exit 1
 
2155
        fi
 
2156
        if test "$need_lib_prefix" != no; then
 
2157
          # Add the "lib" prefix for modules if required
 
2158
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
2159
          eval libname=\"$libname_spec\"
 
2160
        else
 
2161
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
 
2162
        fi
 
2163
        ;;
 
2164
      esac
 
2165
 
 
2166
      if test -n "$objs"; then
 
2167
        if test "$deplibs_check_method" != pass_all; then
 
2168
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
 
2169
          exit 1
 
2170
        else
 
2171
          echo
 
2172
          echo "*** Warning: Linking the shared library $output against the non-libtool"
 
2173
          echo "*** objects $objs is not portable!"
 
2174
          libobjs="$libobjs $objs"
 
2175
        fi
 
2176
      fi
 
2177
 
 
2178
      if test "$dlself" != no; then
 
2179
        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
 
2180
      fi
 
2181
 
 
2182
      set dummy $rpath
 
2183
      if test $# -gt 2; then
 
2184
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
 
2185
      fi
 
2186
      install_libdir="$2"
 
2187
 
 
2188
      oldlibs=
 
2189
      if test -z "$rpath"; then
 
2190
        if test "$build_libtool_libs" = yes; then
 
2191
          # Building a libtool convenience library.
 
2192
          libext=al
 
2193
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
 
2194
          build_libtool_libs=convenience
 
2195
          build_old_libs=yes
 
2196
        fi
 
2197
 
 
2198
        if test -n "$vinfo"; then
 
2199
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
 
2200
        fi
 
2201
 
 
2202
        if test -n "$release"; then
 
2203
          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
 
2204
        fi
 
2205
      else
 
2206
 
 
2207
        # Parse the version information argument.
 
2208
        save_ifs="$IFS"; IFS=':'
 
2209
        set dummy $vinfo 0 0 0
 
2210
        IFS="$save_ifs"
 
2211
 
 
2212
        if test -n "$8"; then
 
2213
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
 
2214
          $echo "$help" 1>&2
 
2215
          exit 1
 
2216
        fi
 
2217
 
 
2218
        current="$2"
 
2219
        revision="$3"
 
2220
        age="$4"
 
2221
 
 
2222
        # Check that each of the things are valid numbers.
 
2223
        case $current in
 
2224
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2225
        *)
 
2226
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 
2227
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
 
2228
          exit 1
 
2229
          ;;
 
2230
        esac
 
2231
 
 
2232
        case $revision in
 
2233
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2234
        *)
 
2235
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 
2236
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
 
2237
          exit 1
 
2238
          ;;
 
2239
        esac
 
2240
 
 
2241
        case $age in
 
2242
        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
 
2243
        *)
 
2244
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 
2245
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
 
2246
          exit 1
 
2247
          ;;
 
2248
        esac
 
2249
 
 
2250
        if test $age -gt $current; then
 
2251
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
 
2252
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
 
2253
          exit 1
 
2254
        fi
 
2255
 
 
2256
        # Calculate the version variables.
 
2257
        major=
 
2258
        versuffix=
 
2259
        verstring=
 
2260
        case $version_type in
 
2261
        none) ;;
 
2262
 
 
2263
        darwin)
 
2264
          # Like Linux, but with the current version available in
 
2265
          # verstring for coding it into the library header
 
2266
          major=.`expr $current - $age`
 
2267
          versuffix="$major.$age.$revision"
 
2268
          # Darwin ld doesn't like 0 for these options...
 
2269
          minor_current=`expr $current + 1`
 
2270
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
 
2271
          ;;
 
2272
 
 
2273
        freebsd-aout)
 
2274
          major=".$current"
 
2275
          versuffix=".$current.$revision";
 
2276
          ;;
 
2277
 
 
2278
        freebsd-elf)
 
2279
          major=".$current"
 
2280
          versuffix=".$current";
 
2281
          ;;
 
2282
 
 
2283
        irix)
 
2284
          major=`expr $current - $age + 1`
 
2285
          verstring="sgi$major.$revision"
 
2286
 
 
2287
          # Add in all the interfaces that we are compatible with.
 
2288
          loop=$revision
 
2289
          while test $loop != 0; do
 
2290
            iface=`expr $revision - $loop`
 
2291
            loop=`expr $loop - 1`
 
2292
            verstring="sgi$major.$iface:$verstring"
 
2293
          done
 
2294
 
 
2295
          # Before this point, $major must not contain `.'.
 
2296
          major=.$major
 
2297
          versuffix="$major.$revision"
 
2298
          ;;
 
2299
 
 
2300
        linux)
 
2301
          major=.`expr $current - $age`
 
2302
          versuffix="$major.$age.$revision"
 
2303
          ;;
 
2304
 
 
2305
        osf)
 
2306
          major=`expr $current - $age`
 
2307
          versuffix=".$current.$age.$revision"
 
2308
          verstring="$current.$age.$revision"
 
2309
 
 
2310
          # Add in all the interfaces that we are compatible with.
 
2311
          loop=$age
 
2312
          while test $loop != 0; do
 
2313
            iface=`expr $current - $loop`
 
2314
            loop=`expr $loop - 1`
 
2315
            verstring="$verstring:${iface}.0"
 
2316
          done
 
2317
 
 
2318
          # Make executables depend on our current version.
 
2319
          verstring="$verstring:${current}.0"
 
2320
          ;;
 
2321
 
 
2322
        sunos)
 
2323
          major=".$current"
 
2324
          versuffix=".$current.$revision"
 
2325
          ;;
 
2326
 
 
2327
        windows)
 
2328
          # Use '-' rather than '.', since we only want one
 
2329
          # extension on DOS 8.3 filesystems.
 
2330
          major=`expr $current - $age`
 
2331
          versuffix="-$major"
 
2332
          ;;
 
2333
 
 
2334
        *)
 
2335
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
 
2336
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
2337
          exit 1
 
2338
          ;;
 
2339
        esac
 
2340
 
 
2341
        # Clear the version info if we defaulted, and they specified a release.
 
2342
        if test -z "$vinfo" && test -n "$release"; then
 
2343
          major=
 
2344
          verstring="0.0"
 
2345
          case $version_type in
 
2346
          darwin)
 
2347
            # we can't check for "0.0" in archive_cmds due to quoting
 
2348
            # problems, so we reset it completely
 
2349
            verstring=""
 
2350
            ;;
 
2351
          *)
 
2352
            verstring="0.0"
 
2353
            ;;
 
2354
          esac
 
2355
          if test "$need_version" = no; then
 
2356
            versuffix=
 
2357
          else
 
2358
            versuffix=".0.0"
 
2359
          fi
 
2360
        fi
 
2361
 
 
2362
        # Remove version info from name if versioning should be avoided
 
2363
        if test "$avoid_version" = yes && test "$need_version" = no; then
 
2364
          major=
 
2365
          versuffix=
 
2366
          verstring=""
 
2367
        fi
 
2368
 
 
2369
        # Check to see if the archive will have undefined symbols.
 
2370
        if test "$allow_undefined" = yes; then
 
2371
          if test "$allow_undefined_flag" = unsupported; then
 
2372
            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
 
2373
            build_libtool_libs=no
 
2374
            build_old_libs=yes
 
2375
          fi
 
2376
        else
 
2377
          # Don't allow undefined symbols.
 
2378
          allow_undefined_flag="$no_undefined_flag"
 
2379
        fi
 
2380
      fi
 
2381
 
 
2382
      if test "$mode" != relink; then
 
2383
        # Remove our outputs.
 
2384
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
 
2385
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
 
2386
      fi
 
2387
 
 
2388
      # Now set the variables for building old libraries.
 
2389
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
 
2390
        oldlibs="$oldlibs $output_objdir/$libname.$libext"
 
2391
 
 
2392
        # Transform .lo files to .o files.
 
2393
        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
 
2394
      fi
 
2395
 
 
2396
      # Eliminate all temporary directories.
 
2397
      for path in $notinst_path; do
 
2398
        lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
 
2399
        deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
 
2400
        dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
 
2401
      done
 
2402
 
 
2403
      if test -n "$xrpath"; then
 
2404
        # If the user specified any rpath flags, then add them.
 
2405
        temp_xrpath=
 
2406
        for libdir in $xrpath; do
 
2407
          temp_xrpath="$temp_xrpath -R$libdir"
 
2408
          case "$finalize_rpath " in
 
2409
          *" $libdir "*) ;;
 
2410
          *) finalize_rpath="$finalize_rpath $libdir" ;;
 
2411
          esac
 
2412
        done
 
2413
        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
 
2414
          dependency_libs="$temp_xrpath $dependency_libs"
 
2415
        fi
 
2416
      fi
 
2417
 
 
2418
      # Make sure dlfiles contains only unique files that won't be dlpreopened
 
2419
      old_dlfiles="$dlfiles"
 
2420
      dlfiles=
 
2421
      for lib in $old_dlfiles; do
 
2422
        case " $dlprefiles $dlfiles " in
 
2423
        *" $lib "*) ;;
 
2424
        *) dlfiles="$dlfiles $lib" ;;
 
2425
        esac
 
2426
      done
 
2427
 
 
2428
      # Make sure dlprefiles contains only unique files
 
2429
      old_dlprefiles="$dlprefiles"
 
2430
      dlprefiles=
 
2431
      for lib in $old_dlprefiles; do
 
2432
        case "$dlprefiles " in
 
2433
        *" $lib "*) ;;
 
2434
        *) dlprefiles="$dlprefiles $lib" ;;
 
2435
        esac
 
2436
      done
 
2437
 
 
2438
      if test "$build_libtool_libs" = yes; then
 
2439
        if test -n "$rpath"; then
 
2440
          case $host in
 
2441
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
 
2442
            # these systems don't actually have a c library (as such)!
 
2443
            ;;
 
2444
          *-*-rhapsody* | *-*-darwin1.[012])
 
2445
            # Rhapsody C library is in the System framework
 
2446
            deplibs="$deplibs -framework System"
 
2447
            ;;
 
2448
          *-*-netbsd*)
 
2449
            # Don't link with libc until the a.out ld.so is fixed.
 
2450
            ;;
 
2451
          *-*-openbsd*)
 
2452
            # Do not include libc due to us having libc/libc_r.
 
2453
            ;;
 
2454
          #### Local change for Sleepycat's Berkeley DB [#2380]:
 
2455
          # FreeBSD, like OpenBSD, uses libc/libc_r and should not
 
2456
          # link against libc/c_r explicitly;  the -pthread linker flag
 
2457
          # implicitly controls use of -lc and -lc_r.
 
2458
          *-*-freebsd*)
 
2459
            # Do not include libc due to us having libc/libc_r.
 
2460
            ;; 
 
2461
          *)
 
2462
            # Add libc to deplibs on all other systems if necessary.
 
2463
            if test $build_libtool_need_lc = "yes"; then
 
2464
              deplibs="$deplibs -lc"
 
2465
            fi
 
2466
            ;;
 
2467
          esac
 
2468
        fi
 
2469
 
 
2470
        # Transform deplibs into only deplibs that can be linked in shared.
 
2471
        name_save=$name
 
2472
        libname_save=$libname
 
2473
        release_save=$release
 
2474
        versuffix_save=$versuffix
 
2475
        major_save=$major
 
2476
        # I'm not sure if I'm treating the release correctly.  I think
 
2477
        # release should show up in the -l (ie -lgmp5) so we don't want to
 
2478
        # add it in twice.  Is that correct?
 
2479
        release=""
 
2480
        versuffix=""
 
2481
        major=""
 
2482
        newdeplibs=
 
2483
        droppeddeps=no
 
2484
        case $deplibs_check_method in
 
2485
        pass_all)
 
2486
          # Don't check for shared/static.  Everything works.
 
2487
          # This might be a little naive.  We might want to check
 
2488
          # whether the library exists or not.  But this is on
 
2489
          # osf3 & osf4 and I'm not really sure... Just
 
2490
          # implementing what was already the behaviour.
 
2491
          newdeplibs=$deplibs
 
2492
          ;;
 
2493
        test_compile)
 
2494
          # This code stresses the "libraries are programs" paradigm to its
 
2495
          # limits. Maybe even breaks it.  We compile a program, linking it
 
2496
          # against the deplibs as a proxy for the library.  Then we can check
 
2497
          # whether they linked in statically or dynamically with ldd.
 
2498
          $rm conftest.c
 
2499
          cat > conftest.c <<EOF
 
2500
          int main() { return 0; }
 
2501
EOF
 
2502
          $rm conftest
 
2503
          $CC -o conftest conftest.c $deplibs
 
2504
          if test $? -eq 0 ; then
 
2505
            ldd_output=`ldd conftest`
 
2506
            for i in $deplibs; do
 
2507
              name="`expr $i : '-l\(.*\)'`"
 
2508
              # If $name is empty we are operating on a -L argument.
 
2509
              if test -n "$name" && test "$name" != "0"; then
 
2510
                libname=`eval \\$echo \"$libname_spec\"`
 
2511
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
2512
                set dummy $deplib_matches
 
2513
                deplib_match=$2
 
2514
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
2515
                  newdeplibs="$newdeplibs $i"
 
2516
                else
 
2517
                  droppeddeps=yes
 
2518
                  echo
 
2519
                  echo "*** Warning: This library needs some functionality provided by $i."
 
2520
                  echo "*** I have the capability to make that library automatically link in when"
 
2521
                  echo "*** you link to this library.  But I can only do this if you have a"
 
2522
                  echo "*** shared version of the library, which you do not appear to have."
 
2523
                fi
 
2524
              else
 
2525
                newdeplibs="$newdeplibs $i"
 
2526
              fi
 
2527
            done
 
2528
          else
 
2529
            # Error occured in the first compile.  Let's try to salvage the situation:
 
2530
            # Compile a seperate program for each library.
 
2531
            for i in $deplibs; do
 
2532
              name="`expr $i : '-l\(.*\)'`"
 
2533
             # If $name is empty we are operating on a -L argument.
 
2534
              if test -n "$name" && test "$name" != "0"; then
 
2535
                $rm conftest
 
2536
                $CC -o conftest conftest.c $i
 
2537
                # Did it work?
 
2538
                if test $? -eq 0 ; then
 
2539
                  ldd_output=`ldd conftest`
 
2540
                  libname=`eval \\$echo \"$libname_spec\"`
 
2541
                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
 
2542
                  set dummy $deplib_matches
 
2543
                  deplib_match=$2
 
2544
                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
 
2545
                    newdeplibs="$newdeplibs $i"
 
2546
                  else
 
2547
                    droppeddeps=yes
 
2548
                    echo
 
2549
                    echo "*** Warning: This library needs some functionality provided by $i."
 
2550
                    echo "*** I have the capability to make that library automatically link in when"
 
2551
                    echo "*** you link to this library.  But I can only do this if you have a"
 
2552
                    echo "*** shared version of the library, which you do not appear to have."
 
2553
                  fi
 
2554
                else
 
2555
                  droppeddeps=yes
 
2556
                  echo
 
2557
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
 
2558
                  echo "***  make it link in!  You will probably need to install it or some"
 
2559
                  echo "*** library that it depends on before this library will be fully"
 
2560
                  echo "*** functional.  Installing it before continuing would be even better."
 
2561
                fi
 
2562
              else
 
2563
                newdeplibs="$newdeplibs $i"
 
2564
              fi
 
2565
            done
 
2566
          fi
 
2567
          ;;
 
2568
        file_magic*)
 
2569
          set dummy $deplibs_check_method
 
2570
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2571
          for a_deplib in $deplibs; do
 
2572
            name="`expr $a_deplib : '-l\(.*\)'`"
 
2573
            # If $name is empty we are operating on a -L argument.
 
2574
            if test -n "$name" && test "$name" != "0"; then
 
2575
              libname=`eval \\$echo \"$libname_spec\"`
 
2576
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
2577
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
2578
                    for potent_lib in $potential_libs; do
 
2579
                      # Follow soft links.
 
2580
                      if ls -lLd "$potent_lib" 2>/dev/null \
 
2581
                         | grep " -> " >/dev/null; then
 
2582
                        continue
 
2583
                      fi
 
2584
                      # The statement above tries to avoid entering an
 
2585
                      # endless loop below, in case of cyclic links.
 
2586
                      # We might still enter an endless loop, since a link
 
2587
                      # loop can be closed while we follow links,
 
2588
                      # but so what?
 
2589
                      potlib="$potent_lib"
 
2590
                      while test -h "$potlib" 2>/dev/null; do
 
2591
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
 
2592
                        case $potliblink in
 
2593
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
 
2594
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
 
2595
                        esac
 
2596
                      done
 
2597
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
 
2598
                         | sed 10q \
 
2599
                         | egrep "$file_magic_regex" > /dev/null; then
 
2600
                        newdeplibs="$newdeplibs $a_deplib"
 
2601
                        a_deplib=""
 
2602
                        break 2
 
2603
                      fi
 
2604
                    done
 
2605
              done
 
2606
              if test -n "$a_deplib" ; then
 
2607
                droppeddeps=yes
 
2608
                echo
 
2609
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
 
2610
                echo "*** I have the capability to make that library automatically link in when"
 
2611
                echo "*** you link to this library.  But I can only do this if you have a"
 
2612
                echo "*** shared version of the library, which you do not appear to have."
 
2613
              fi
 
2614
            else
 
2615
              # Add a -L argument.
 
2616
              newdeplibs="$newdeplibs $a_deplib"
 
2617
            fi
 
2618
          done # Gone through all deplibs.
 
2619
          ;;
 
2620
        match_pattern*)
 
2621
          set dummy $deplibs_check_method
 
2622
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 
2623
          for a_deplib in $deplibs; do
 
2624
            name="`expr $a_deplib : '-l\(.*\)'`"
 
2625
            # If $name is empty we are operating on a -L argument.
 
2626
            if test -n "$name" && test "$name" != "0"; then
 
2627
              libname=`eval \\$echo \"$libname_spec\"`
 
2628
              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 
2629
                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 
2630
                for potent_lib in $potential_libs; do
 
2631
                  if eval echo \"$potent_lib\" 2>/dev/null \
 
2632
                      | sed 10q \
 
2633
                      | egrep "$match_pattern_regex" > /dev/null; then
 
2634
                    newdeplibs="$newdeplibs $a_deplib"
 
2635
                    a_deplib=""
 
2636
                    break 2
 
2637
                  fi
 
2638
                done
 
2639
              done
 
2640
              if test -n "$a_deplib" ; then
 
2641
                droppeddeps=yes
 
2642
                echo
 
2643
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
 
2644
                echo "*** I have the capability to make that library automatically link in when"
 
2645
                echo "*** you link to this library.  But I can only do this if you have a"
 
2646
                echo "*** shared version of the library, which you do not appear to have."
 
2647
              fi
 
2648
            else
 
2649
              # Add a -L argument.
 
2650
              newdeplibs="$newdeplibs $a_deplib"
 
2651
            fi
 
2652
          done # Gone through all deplibs.
 
2653
          ;;
 
2654
        none | unknown | *)
 
2655
          newdeplibs=""
 
2656
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
 
2657
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
 
2658
             grep . >/dev/null; then
 
2659
            echo
 
2660
            if test "X$deplibs_check_method" = "Xnone"; then
 
2661
              echo "*** Warning: inter-library dependencies are not supported in this platform."
 
2662
            else
 
2663
              echo "*** Warning: inter-library dependencies are not known to be supported."
 
2664
            fi
 
2665
            echo "*** All declared inter-library dependencies are being dropped."
 
2666
            droppeddeps=yes
 
2667
          fi
 
2668
          ;;
 
2669
        esac
 
2670
        versuffix=$versuffix_save
 
2671
        major=$major_save
 
2672
        release=$release_save
 
2673
        libname=$libname_save
 
2674
        name=$name_save
 
2675
 
 
2676
        case $host in
 
2677
        *-*-rhapsody* | *-*-darwin1.[012])
 
2678
          # On Rhapsody replace the C library is the System framework
 
2679
          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
2680
          ;;
 
2681
        esac
 
2682
 
 
2683
        if test "$droppeddeps" = yes; then
 
2684
          if test "$module" = yes; then
 
2685
            echo
 
2686
            echo "*** Warning: libtool could not satisfy all declared inter-library"
 
2687
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
 
2688
            echo "*** a static module, that should work as long as the dlopening"
 
2689
            echo "*** application is linked with the -dlopen flag."
 
2690
            if test -z "$global_symbol_pipe"; then
 
2691
              echo
 
2692
              echo "*** However, this would only work if libtool was able to extract symbol"
 
2693
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
 
2694
              echo "*** not find such a program.  So, this module is probably useless."
 
2695
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
 
2696
            fi
 
2697
            if test "$build_old_libs" = no; then
 
2698
              oldlibs="$output_objdir/$libname.$libext"
 
2699
              build_libtool_libs=module
 
2700
              build_old_libs=yes
 
2701
            else
 
2702
              build_libtool_libs=no
 
2703
            fi
 
2704
          else
 
2705
            echo "*** The inter-library dependencies that have been dropped here will be"
 
2706
            echo "*** automatically added whenever a program is linked with this library"
 
2707
            echo "*** or is declared to -dlopen it."
 
2708
 
 
2709
            if test $allow_undefined = no; then
 
2710
              echo
 
2711
              echo "*** Since this library must not contain undefined symbols,"
 
2712
              echo "*** because either the platform does not support them or"
 
2713
              echo "*** it was explicitly requested with -no-undefined,"
 
2714
              echo "*** libtool will only create a static version of it."
 
2715
              if test "$build_old_libs" = no; then
 
2716
                oldlibs="$output_objdir/$libname.$libext"
 
2717
                build_libtool_libs=module
 
2718
                build_old_libs=yes
 
2719
              else
 
2720
                build_libtool_libs=no
 
2721
              fi
 
2722
            fi
 
2723
          fi
 
2724
        fi
 
2725
        # Done checking deplibs!
 
2726
        deplibs=$newdeplibs
 
2727
      fi
 
2728
 
 
2729
      # All the library-specific variables (install_libdir is set above).
 
2730
      library_names=
 
2731
      old_library=
 
2732
      dlname=
 
2733
 
 
2734
      # Test again, we may have decided not to build it any more
 
2735
      if test "$build_libtool_libs" = yes; then
 
2736
        if test $hardcode_into_libs = yes; then
 
2737
          # Hardcode the library paths
 
2738
          hardcode_libdirs=
 
2739
          dep_rpath=
 
2740
          rpath="$finalize_rpath"
 
2741
          test "$mode" != relink && rpath="$compile_rpath$rpath"
 
2742
          for libdir in $rpath; do
 
2743
            if test -n "$hardcode_libdir_flag_spec"; then
 
2744
              if test -n "$hardcode_libdir_separator"; then
 
2745
                if test -z "$hardcode_libdirs"; then
 
2746
                  hardcode_libdirs="$libdir"
 
2747
                else
 
2748
                  # Just accumulate the unique libdirs.
 
2749
                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
 
2750
                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 
2751
                    ;;
 
2752
                  *)
 
2753
                    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 
2754
                    ;;
 
2755
                  esac
 
2756
                fi
 
2757
              else
 
2758
                eval flag=\"$hardcode_libdir_flag_spec\"
 
2759
                dep_rpath="$dep_rpath $flag"
 
2760
              fi
 
2761
            elif test -n "$runpath_var"; then
 
2762
              case "$perm_rpath " in
 
2763
              *" $libdir "*) ;;
 
2764
              *) perm_rpath="$perm_rpath $libdir" ;;
 
2765
              esac
 
2766
            fi
 
2767
          done
 
2768
          # Substitute the hardcoded libdirs into the rpath.
 
2769
          if test -n "$hardcode_libdir_separator" &&
 
2770
             test -n "$hardcode_libdirs"; then
 
2771
            libdir="$hardcode_libdirs"
 
2772
            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
 
2773
          fi
 
2774
          if test -n "$runpath_var" && test -n "$perm_rpath"; then
 
2775
            # We should set the runpath_var.
 
2776
            rpath=
 
2777
            for dir in $perm_rpath; do
 
2778
              rpath="$rpath$dir:"
 
2779
            done
 
2780
            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 
2781
          fi
 
2782
          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
 
2783
        fi
 
2784
 
 
2785
        shlibpath="$finalize_shlibpath"
 
2786
        test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 
2787
        if test -n "$shlibpath"; then
 
2788
          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 
2789
        fi
 
2790
 
 
2791
        # Get the real and link names of the library.
 
2792
        eval library_names=\"$library_names_spec\"
 
2793
        set dummy $library_names
 
2794
        realname="$2"
 
2795
        shift; shift
 
2796
 
 
2797
        if test -n "$soname_spec"; then
 
2798
          eval soname=\"$soname_spec\"
 
2799
        else
 
2800
          soname="$realname"
 
2801
        fi
 
2802
        test -z "$dlname" && dlname=$soname
 
2803
 
 
2804
        lib="$output_objdir/$realname"
 
2805
        for link
 
2806
        do
 
2807
          linknames="$linknames $link"
 
2808
        done
 
2809
 
 
2810
        # Ensure that we have .o objects for linkers which dislike .lo
 
2811
        # (e.g. aix) in case we are running --disable-static
 
2812
        for obj in $libobjs; do
 
2813
          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
 
2814
          if test "X$xdir" = "X$obj"; then
 
2815
            xdir="."
 
2816
          else
 
2817
            xdir="$xdir"
 
2818
          fi
 
2819
          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
 
2820
          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
 
2821
          if test ! -f $xdir/$oldobj; then
 
2822
            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
 
2823
            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
 
2824
          fi
 
2825
        done
 
2826
 
 
2827
        # Use standard objects if they are pic
 
2828
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
2829
 
 
2830
        # Prepare the list of exported symbols
 
2831
        if test -z "$export_symbols"; then
 
2832
          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
 
2833
            $show "generating symbol list for \`$libname.la'"
 
2834
            export_symbols="$output_objdir/$libname.exp"
 
2835
            $run $rm $export_symbols
 
2836
            eval cmds=\"$export_symbols_cmds\"
 
2837
            save_ifs="$IFS"; IFS='~'
 
2838
            for cmd in $cmds; do
 
2839
              IFS="$save_ifs"
 
2840
              $show "$cmd"
 
2841
              $run eval "$cmd" || exit $?
 
2842
            done
 
2843
            IFS="$save_ifs"
 
2844
            if test -n "$export_symbols_regex"; then
 
2845
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
 
2846
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 
2847
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
 
2848
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
 
2849
            fi
 
2850
          fi
 
2851
        fi
 
2852
 
 
2853
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
 
2854
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
 
2855
        fi
 
2856
 
 
2857
        if test -n "$convenience"; then
 
2858
          if test -n "$whole_archive_flag_spec"; then
 
2859
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 
2860
          else
 
2861
            gentop="$output_objdir/${outputname}x"
 
2862
            $show "${rm}r $gentop"
 
2863
            $run ${rm}r "$gentop"
 
2864
            $show "mkdir $gentop"
 
2865
            $run mkdir "$gentop"
 
2866
            status=$?
 
2867
            if test $status -ne 0 && test ! -d "$gentop"; then
 
2868
              exit $status
 
2869
            fi
 
2870
            generated="$generated $gentop"
 
2871
 
 
2872
            for xlib in $convenience; do
 
2873
              # Extract the objects.
 
2874
              case $xlib in
 
2875
              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
2876
              *) xabs=`pwd`"/$xlib" ;;
 
2877
              esac
 
2878
              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
2879
              xdir="$gentop/$xlib"
 
2880
 
 
2881
              $show "${rm}r $xdir"
 
2882
              $run ${rm}r "$xdir"
 
2883
              $show "mkdir $xdir"
 
2884
              $run mkdir "$xdir"
 
2885
              status=$?
 
2886
              if test $status -ne 0 && test ! -d "$xdir"; then
 
2887
                exit $status
 
2888
              fi
 
2889
              $show "(cd $xdir && $AR x $xabs)"
 
2890
              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
2891
 
 
2892
              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
 
2893
            done
 
2894
          fi
 
2895
        fi
 
2896
 
 
2897
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 
2898
          eval flag=\"$thread_safe_flag_spec\"
 
2899
          linker_flags="$linker_flags $flag"
 
2900
        fi
 
2901
 
 
2902
        # Make a backup of the uninstalled library when relinking
 
2903
        if test "$mode" = relink; then
 
2904
          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
 
2905
        fi
 
2906
 
 
2907
        # Do each of the archive commands.
 
2908
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
 
2909
          eval cmds=\"$archive_expsym_cmds\"
 
2910
        else
 
2911
          eval cmds=\"$archive_cmds\"
 
2912
        fi
 
2913
        save_ifs="$IFS"; IFS='~'
 
2914
        for cmd in $cmds; do
 
2915
          IFS="$save_ifs"
 
2916
          $show "$cmd"
 
2917
          $run eval "$cmd" || exit $?
 
2918
        done
 
2919
        IFS="$save_ifs"
 
2920
 
 
2921
        # Restore the uninstalled library and exit
 
2922
        if test "$mode" = relink; then
 
2923
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
 
2924
          exit 0
 
2925
        fi
 
2926
 
 
2927
        # Create links to the real library.
 
2928
        for linkname in $linknames; do
 
2929
          if test "$realname" != "$linkname"; then
 
2930
            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
 
2931
            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
 
2932
          fi
 
2933
        done
 
2934
 
 
2935
        # If -module or -export-dynamic was specified, set the dlname.
 
2936
        if test "$module" = yes || test "$export_dynamic" = yes; then
 
2937
          # On all known operating systems, these are identical.
 
2938
          dlname="$soname"
 
2939
        fi
 
2940
      fi
 
2941
      ;;
 
2942
 
 
2943
    obj)
 
2944
      if test -n "$deplibs"; then
 
2945
        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
 
2946
      fi
 
2947
 
 
2948
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 
2949
        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
 
2950
      fi
 
2951
 
 
2952
      if test -n "$rpath"; then
 
2953
        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
 
2954
      fi
 
2955
 
 
2956
      if test -n "$xrpath"; then
 
2957
        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
 
2958
      fi
 
2959
 
 
2960
      if test -n "$vinfo"; then
 
2961
        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
 
2962
      fi
 
2963
 
 
2964
      if test -n "$release"; then
 
2965
        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
 
2966
      fi
 
2967
 
 
2968
      case $output in
 
2969
      *.lo)
 
2970
        if test -n "$objs$old_deplibs"; then
 
2971
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
 
2972
          exit 1
 
2973
        fi
 
2974
        libobj="$output"
 
2975
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
 
2976
        ;;
 
2977
      *)
 
2978
        libobj=
 
2979
        obj="$output"
 
2980
        ;;
 
2981
      esac
 
2982
 
 
2983
      # Delete the old objects.
 
2984
      $run $rm $obj $libobj
 
2985
 
 
2986
      # Objects from convenience libraries.  This assumes
 
2987
      # single-version convenience libraries.  Whenever we create
 
2988
      # different ones for PIC/non-PIC, this we'll have to duplicate
 
2989
      # the extraction.
 
2990
      reload_conv_objs=
 
2991
      gentop=
 
2992
      # reload_cmds runs $LD directly, so let us get rid of
 
2993
      # -Wl from whole_archive_flag_spec
 
2994
      wl=
 
2995
 
 
2996
      if test -n "$convenience"; then
 
2997
        if test -n "$whole_archive_flag_spec"; then
 
2998
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
 
2999
        else
 
3000
          gentop="$output_objdir/${obj}x"
 
3001
          $show "${rm}r $gentop"
 
3002
          $run ${rm}r "$gentop"
 
3003
          $show "mkdir $gentop"
 
3004
          $run mkdir "$gentop"
 
3005
          status=$?
 
3006
          if test $status -ne 0 && test ! -d "$gentop"; then
 
3007
            exit $status
 
3008
          fi
 
3009
          generated="$generated $gentop"
 
3010
 
 
3011
          for xlib in $convenience; do
 
3012
            # Extract the objects.
 
3013
            case $xlib in
 
3014
            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
3015
            *) xabs=`pwd`"/$xlib" ;;
 
3016
            esac
 
3017
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
3018
            xdir="$gentop/$xlib"
 
3019
 
 
3020
            $show "${rm}r $xdir"
 
3021
            $run ${rm}r "$xdir"
 
3022
            $show "mkdir $xdir"
 
3023
            $run mkdir "$xdir"
 
3024
            status=$?
 
3025
            if test $status -ne 0 && test ! -d "$xdir"; then
 
3026
              exit $status
 
3027
            fi
 
3028
            $show "(cd $xdir && $AR x $xabs)"
 
3029
            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
3030
 
 
3031
            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
 
3032
          done
 
3033
        fi
 
3034
      fi
 
3035
 
 
3036
      # Create the old-style object.
 
3037
      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
 
3038
 
 
3039
      output="$obj"
 
3040
      eval cmds=\"$reload_cmds\"
 
3041
      save_ifs="$IFS"; IFS='~'
 
3042
      for cmd in $cmds; do
 
3043
        IFS="$save_ifs"
 
3044
        $show "$cmd"
 
3045
        $run eval "$cmd" || exit $?
 
3046
      done
 
3047
      IFS="$save_ifs"
 
3048
 
 
3049
      # Exit if we aren't doing a library object file.
 
3050
      if test -z "$libobj"; then
 
3051
        if test -n "$gentop"; then
 
3052
          $show "${rm}r $gentop"
 
3053
          $run ${rm}r $gentop
 
3054
        fi
 
3055
 
 
3056
        exit 0
 
3057
      fi
 
3058
 
 
3059
      if test "$build_libtool_libs" != yes; then
 
3060
        if test -n "$gentop"; then
 
3061
          $show "${rm}r $gentop"
 
3062
          $run ${rm}r $gentop
 
3063
        fi
 
3064
 
 
3065
        # Create an invalid libtool object if no PIC, so that we don't
 
3066
        # accidentally link it into a program.
 
3067
        $show "echo timestamp > $libobj"
 
3068
        $run eval "echo timestamp > $libobj" || exit $?
 
3069
        exit 0
 
3070
      fi
 
3071
 
 
3072
      if test -n "$pic_flag" || test "$pic_mode" != default; then
 
3073
        # Only do commands if we really have different PIC objects.
 
3074
        reload_objs="$libobjs $reload_conv_objs"
 
3075
        output="$libobj"
 
3076
        eval cmds=\"$reload_cmds\"
 
3077
        save_ifs="$IFS"; IFS='~'
 
3078
        for cmd in $cmds; do
 
3079
          IFS="$save_ifs"
 
3080
          $show "$cmd"
 
3081
          $run eval "$cmd" || exit $?
 
3082
        done
 
3083
        IFS="$save_ifs"
 
3084
      else
 
3085
        # Just create a symlink.
 
3086
        $show $rm $libobj
 
3087
        $run $rm $libobj
 
3088
        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
 
3089
        if test "X$xdir" = "X$libobj"; then
 
3090
          xdir="."
 
3091
        else
 
3092
          xdir="$xdir"
 
3093
        fi
 
3094
        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
 
3095
        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
 
3096
        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
 
3097
        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
 
3098
      fi
 
3099
 
 
3100
      if test -n "$gentop"; then
 
3101
        $show "${rm}r $gentop"
 
3102
        $run ${rm}r $gentop
 
3103
      fi
 
3104
 
 
3105
      exit 0
 
3106
      ;;
 
3107
 
 
3108
    prog)
 
3109
      case $host in
 
3110
        *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
 
3111
      esac
 
3112
      if test -n "$vinfo"; then
 
3113
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
 
3114
      fi
 
3115
 
 
3116
      if test -n "$release"; then
 
3117
        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
 
3118
      fi
 
3119
 
 
3120
      if test "$preload" = yes; then
 
3121
        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
 
3122
           test "$dlopen_self_static" = unknown; then
 
3123
          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
 
3124
        fi
 
3125
      fi
 
3126
 
 
3127
      case $host in
 
3128
      *-*-rhapsody* | *-*-darwin1.[012])
 
3129
        # On Rhapsody replace the C library is the System framework
 
3130
        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
3131
        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
 
3132
        ;;
 
3133
      esac
 
3134
 
 
3135
      compile_command="$compile_command $compile_deplibs"
 
3136
      finalize_command="$finalize_command $finalize_deplibs"
 
3137
 
 
3138
      if test -n "$rpath$xrpath"; then
 
3139
        # If the user specified any rpath flags, then add them.
 
3140
        for libdir in $rpath $xrpath; do
 
3141
          # This is the magic to use -rpath.
 
3142
          case "$finalize_rpath " in
 
3143
          *" $libdir "*) ;;
 
3144
          *) finalize_rpath="$finalize_rpath $libdir" ;;
 
3145
          esac
 
3146
        done
 
3147
      fi
 
3148
 
 
3149
      # Now hardcode the library paths
 
3150
      rpath=
 
3151
      hardcode_libdirs=
 
3152
      for libdir in $compile_rpath $finalize_rpath; do
 
3153
        if test -n "$hardcode_libdir_flag_spec"; then
 
3154
          if test -n "$hardcode_libdir_separator"; then
 
3155
            if test -z "$hardcode_libdirs"; then
 
3156
              hardcode_libdirs="$libdir"
 
3157
            else
 
3158
              # Just accumulate the unique libdirs.
 
3159
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
 
3160
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 
3161
                ;;
 
3162
              *)
 
3163
                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 
3164
                ;;
 
3165
              esac
 
3166
            fi
 
3167
          else
 
3168
            eval flag=\"$hardcode_libdir_flag_spec\"
 
3169
            rpath="$rpath $flag"
 
3170
          fi
 
3171
        elif test -n "$runpath_var"; then
 
3172
          case "$perm_rpath " in
 
3173
          *" $libdir "*) ;;
 
3174
          *) perm_rpath="$perm_rpath $libdir" ;;
 
3175
          esac
 
3176
        fi
 
3177
        case $host in
 
3178
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
3179
          case :$dllsearchpath: in
 
3180
          *":$libdir:"*) ;;
 
3181
          *) dllsearchpath="$dllsearchpath:$libdir";;
 
3182
          esac
 
3183
          ;;
 
3184
        esac
 
3185
      done
 
3186
      # Substitute the hardcoded libdirs into the rpath.
 
3187
      if test -n "$hardcode_libdir_separator" &&
 
3188
         test -n "$hardcode_libdirs"; then
 
3189
        libdir="$hardcode_libdirs"
 
3190
        eval rpath=\" $hardcode_libdir_flag_spec\"
 
3191
      fi
 
3192
      compile_rpath="$rpath"
 
3193
 
 
3194
      rpath=
 
3195
      hardcode_libdirs=
 
3196
      for libdir in $finalize_rpath; do
 
3197
        if test -n "$hardcode_libdir_flag_spec"; then
 
3198
          if test -n "$hardcode_libdir_separator"; then
 
3199
            if test -z "$hardcode_libdirs"; then
 
3200
              hardcode_libdirs="$libdir"
 
3201
            else
 
3202
              # Just accumulate the unique libdirs.
 
3203
              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
 
3204
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 
3205
                ;;
 
3206
              *)
 
3207
                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 
3208
                ;;
 
3209
              esac
 
3210
            fi
 
3211
          else
 
3212
            eval flag=\"$hardcode_libdir_flag_spec\"
 
3213
            rpath="$rpath $flag"
 
3214
          fi
 
3215
        elif test -n "$runpath_var"; then
 
3216
          case "$finalize_perm_rpath " in
 
3217
          *" $libdir "*) ;;
 
3218
          *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
 
3219
          esac
 
3220
        fi
 
3221
      done
 
3222
      # Substitute the hardcoded libdirs into the rpath.
 
3223
      if test -n "$hardcode_libdir_separator" &&
 
3224
         test -n "$hardcode_libdirs"; then
 
3225
        libdir="$hardcode_libdirs"
 
3226
        eval rpath=\" $hardcode_libdir_flag_spec\"
 
3227
      fi
 
3228
      finalize_rpath="$rpath"
 
3229
 
 
3230
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
 
3231
        # Transform all the library objects into standard objects.
 
3232
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
3233
        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
3234
      fi
 
3235
 
 
3236
      dlsyms=
 
3237
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 
3238
        if test -n "$NM" && test -n "$global_symbol_pipe"; then
 
3239
          dlsyms="${outputname}S.c"
 
3240
        else
 
3241
          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
 
3242
        fi
 
3243
      fi
 
3244
 
 
3245
      if test -n "$dlsyms"; then
 
3246
        case $dlsyms in
 
3247
        "") ;;
 
3248
        *.c)
 
3249
          # Discover the nlist of each of the dlfiles.
 
3250
          nlist="$output_objdir/${outputname}.nm"
 
3251
 
 
3252
          $show "$rm $nlist ${nlist}S ${nlist}T"
 
3253
          $run $rm "$nlist" "${nlist}S" "${nlist}T"
 
3254
 
 
3255
          # Parse the name list into a source file.
 
3256
          $show "creating $output_objdir/$dlsyms"
 
3257
 
 
3258
          test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
 
3259
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
 
3260
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
 
3261
 
 
3262
#ifdef __cplusplus
 
3263
extern \"C\" {
 
3264
#endif
 
3265
 
 
3266
/* Prevent the only kind of declaration conflicts we can make. */
 
3267
#define lt_preloaded_symbols some_other_symbol
 
3268
 
 
3269
/* External symbol declarations for the compiler. */\
 
3270
"
 
3271
 
 
3272
          if test "$dlself" = yes; then
 
3273
            $show "generating symbol list for \`$output'"
 
3274
 
 
3275
            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
 
3276
 
 
3277
            # Add our own program objects to the symbol list.
 
3278
            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 
3279
            for arg in $progfiles; do
 
3280
              $show "extracting global C symbols from \`$arg'"
 
3281
              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
 
3282
            done
 
3283
 
 
3284
            if test -n "$exclude_expsyms"; then
 
3285
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 
3286
              $run eval '$mv "$nlist"T "$nlist"'
 
3287
            fi
 
3288
 
 
3289
            if test -n "$export_symbols_regex"; then
 
3290
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 
3291
              $run eval '$mv "$nlist"T "$nlist"'
 
3292
            fi
 
3293
 
 
3294
            # Prepare the list of exported symbols
 
3295
            if test -z "$export_symbols"; then
 
3296
              export_symbols="$output_objdir/$output.exp"
 
3297
              $run $rm $export_symbols
 
3298
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
3299
            else
 
3300
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
 
3301
              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
 
3302
              $run eval 'mv "$nlist"T "$nlist"'
 
3303
            fi
 
3304
          fi
 
3305
 
 
3306
          for arg in $dlprefiles; do
 
3307
            $show "extracting global C symbols from \`$arg'"
 
3308
            name=`echo "$arg" | sed -e 's%^.*/%%'`
 
3309
            $run eval 'echo ": $name " >> "$nlist"'
 
3310
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
 
3311
          done
 
3312
 
 
3313
          if test -z "$run"; then
 
3314
            # Make sure we have at least an empty file.
 
3315
            test -f "$nlist" || : > "$nlist"
 
3316
 
 
3317
            if test -n "$exclude_expsyms"; then
 
3318
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
 
3319
              $mv "$nlist"T "$nlist"
 
3320
            fi
 
3321
 
 
3322
            # Try sorting and uniquifying the output.
 
3323
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
 
3324
              :
 
3325
            else
 
3326
              grep -v "^: " < "$nlist" > "$nlist"S
 
3327
            fi
 
3328
 
 
3329
            if test -f "$nlist"S; then
 
3330
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
 
3331
            else
 
3332
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
 
3333
            fi
 
3334
 
 
3335
            $echo >> "$output_objdir/$dlsyms" "\
 
3336
 
 
3337
#undef lt_preloaded_symbols
 
3338
 
 
3339
#if defined (__STDC__) && __STDC__
 
3340
# define lt_ptr void *
 
3341
#else
 
3342
# define lt_ptr char *
 
3343
# define const
 
3344
#endif
 
3345
 
 
3346
/* The mapping between symbol names and symbols. */
 
3347
const struct {
 
3348
  const char *name;
 
3349
  lt_ptr address;
 
3350
}
 
3351
lt_preloaded_symbols[] =
 
3352
{\
 
3353
"
 
3354
 
 
3355
            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
 
3356
 
 
3357
            $echo >> "$output_objdir/$dlsyms" "\
 
3358
  {0, (lt_ptr) 0}
 
3359
};
 
3360
 
 
3361
/* This works around a problem in FreeBSD linker */
 
3362
#ifdef FREEBSD_WORKAROUND
 
3363
static const void *lt_preloaded_setup() {
 
3364
  return lt_preloaded_symbols;
 
3365
}
 
3366
#endif
 
3367
 
 
3368
#ifdef __cplusplus
 
3369
}
 
3370
#endif\
 
3371
"
 
3372
          fi
 
3373
 
 
3374
          pic_flag_for_symtable=
 
3375
          case $host in
 
3376
          # compiling the symbol table file with pic_flag works around
 
3377
          # a FreeBSD bug that causes programs to crash when -lm is
 
3378
          # linked before any other PIC object.  But we must not use
 
3379
          # pic_flag when linking with -static.  The problem exists in
 
3380
          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
 
3381
          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 
3382
            case "$compile_command " in
 
3383
            *" -static "*) ;;
 
3384
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
 
3385
            esac;;
 
3386
          *-*-hpux*)
 
3387
            case "$compile_command " in
 
3388
            *" -static "*) ;;
 
3389
            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
 
3390
            esac
 
3391
          esac
 
3392
 
 
3393
          # Now compile the dynamic symbol file.
 
3394
          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
3395
          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
3396
 
 
3397
          # Clean up the generated files.
 
3398
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
 
3399
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
 
3400
 
 
3401
          # Transform the symbol file into the correct name.
 
3402
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
3403
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
3404
          ;;
 
3405
        *)
 
3406
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
 
3407
          exit 1
 
3408
          ;;
 
3409
        esac
 
3410
      else
 
3411
        # We keep going just in case the user didn't refer to
 
3412
        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
 
3413
        # really was required.
 
3414
 
 
3415
        # Nullify the symbol file.
 
3416
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
 
3417
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
 
3418
      fi
 
3419
 
 
3420
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 
3421
        # Replace the output file specification.
 
3422
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
3423
        link_command="$compile_command$compile_rpath"
 
3424
 
 
3425
        # We have no uninstalled library dependencies, so finalize right now.
 
3426
        $show "$link_command"
 
3427
        $run eval "$link_command"
 
3428
        status=$?
 
3429
 
 
3430
        # Delete the generated files.
 
3431
        if test -n "$dlsyms"; then
 
3432
          $show "$rm $output_objdir/${outputname}S.${objext}"
 
3433
          $run $rm "$output_objdir/${outputname}S.${objext}"
 
3434
        fi
 
3435
 
 
3436
        exit $status
 
3437
      fi
 
3438
 
 
3439
      if test -n "$shlibpath_var"; then
 
3440
        # We should set the shlibpath_var
 
3441
        rpath=
 
3442
        for dir in $temp_rpath; do
 
3443
          case $dir in
 
3444
          [\\/]* | [A-Za-z]:[\\/]*)
 
3445
            # Absolute path.
 
3446
            rpath="$rpath$dir:"
 
3447
            ;;
 
3448
          *)
 
3449
            # Relative path: add a thisdir entry.
 
3450
            rpath="$rpath\$thisdir/$dir:"
 
3451
            ;;
 
3452
          esac
 
3453
        done
 
3454
        temp_rpath="$rpath"
 
3455
      fi
 
3456
 
 
3457
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
 
3458
        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
 
3459
      fi
 
3460
      if test -n "$finalize_shlibpath"; then
 
3461
        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
 
3462
      fi
 
3463
 
 
3464
      compile_var=
 
3465
      finalize_var=
 
3466
      if test -n "$runpath_var"; then
 
3467
        if test -n "$perm_rpath"; then
 
3468
          # We should set the runpath_var.
 
3469
          rpath=
 
3470
          for dir in $perm_rpath; do
 
3471
            rpath="$rpath$dir:"
 
3472
          done
 
3473
          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
 
3474
        fi
 
3475
        if test -n "$finalize_perm_rpath"; then
 
3476
          # We should set the runpath_var.
 
3477
          rpath=
 
3478
          for dir in $finalize_perm_rpath; do
 
3479
            rpath="$rpath$dir:"
 
3480
          done
 
3481
          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
 
3482
        fi
 
3483
      fi
 
3484
 
 
3485
      if test "$no_install" = yes; then
 
3486
        # We don't need to create a wrapper script.
 
3487
        link_command="$compile_var$compile_command$compile_rpath"
 
3488
        # Replace the output file specification.
 
3489
        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
3490
        # Delete the old output file.
 
3491
        $run $rm $output
 
3492
        # Link the executable and exit
 
3493
        $show "$link_command"
 
3494
        $run eval "$link_command" || exit $?
 
3495
        exit 0
 
3496
      fi
 
3497
 
 
3498
      if test "$hardcode_action" = relink; then
 
3499
        # Fast installation is not supported
 
3500
        link_command="$compile_var$compile_command$compile_rpath"
 
3501
        relink_command="$finalize_var$finalize_command$finalize_rpath"
 
3502
 
 
3503
        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
 
3504
        $echo "$modename: \`$output' will be relinked during installation" 1>&2
 
3505
      else
 
3506
        if test "$fast_install" != no; then
 
3507
          link_command="$finalize_var$compile_command$finalize_rpath"
 
3508
          if test "$fast_install" = yes; then
 
3509
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
 
3510
          else
 
3511
            # fast_install is set to needless
 
3512
            relink_command=
 
3513
          fi
 
3514
        else
 
3515
          link_command="$compile_var$compile_command$compile_rpath"
 
3516
          relink_command="$finalize_var$finalize_command$finalize_rpath"
 
3517
        fi
 
3518
      fi
 
3519
 
 
3520
      # Replace the output file specification.
 
3521
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
3522
 
 
3523
      # Delete the old output files.
 
3524
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
3525
 
 
3526
      $show "$link_command"
 
3527
      $run eval "$link_command" || exit $?
 
3528
 
 
3529
      # Now create the wrapper script.
 
3530
      $show "creating $output"
 
3531
 
 
3532
      # Quote the relink command for shipping.
 
3533
      if test -n "$relink_command"; then
 
3534
        # Preserve any variables that may affect compiler behavior
 
3535
        for var in $variables_saved_for_relink; do
 
3536
          if eval test -z \"\${$var+set}\"; then
 
3537
            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
 
3538
          elif eval var_value=\$$var; test -z "$var_value"; then
 
3539
            relink_command="$var=; export $var; $relink_command"
 
3540
          else
 
3541
            var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
 
3542
            relink_command="$var=\"$var_value\"; export $var; $relink_command"
 
3543
          fi
 
3544
        done
 
3545
        relink_command="cd `pwd`; $relink_command"
 
3546
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
3547
      fi
 
3548
 
 
3549
      # Quote $echo for shipping.
 
3550
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
 
3551
        case $0 in
 
3552
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
 
3553
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
3554
        esac
 
3555
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
 
3556
      else
 
3557
        qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
 
3558
      fi
 
3559
 
 
3560
      # Only actually do things if our run command is non-null.
 
3561
      if test -z "$run"; then
 
3562
        # win32 will think the script is a binary if it has
 
3563
        # a .exe suffix, so we strip it off here.
 
3564
        case $output in
 
3565
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 
3566
        esac
 
3567
        # test for cygwin because mv fails w/o .exe extensions
 
3568
        case $host in
 
3569
          *cygwin*) exeext=.exe ;;
 
3570
          *) exeext= ;;
 
3571
        esac
 
3572
        $rm $output
 
3573
        trap "$rm $output; exit 1" 1 2 15
 
3574
 
 
3575
        $echo > $output "\
 
3576
#! $SHELL
 
3577
 
 
3578
# $output - temporary wrapper script for $objdir/$outputname
 
3579
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
3580
#
 
3581
# The $output program cannot be directly executed until all the libtool
 
3582
# libraries that it depends on are installed.
 
3583
#
 
3584
# This wrapper script should never be moved out of the build directory.
 
3585
# If it is, it will not operate correctly.
 
3586
 
 
3587
# Sed substitution that helps us do robust quoting.  It backslashifies
 
3588
# metacharacters that are still active within double-quoted strings.
 
3589
Xsed='sed -e 1s/^X//'
 
3590
sed_quote_subst='$sed_quote_subst'
 
3591
 
 
3592
# The HP-UX ksh and POSIX shell print the target directory to stdout
 
3593
# if CDPATH is set.
 
3594
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
 
3595
 
 
3596
relink_command=\"$relink_command\"
 
3597
 
 
3598
# This environment variable determines our operation mode.
 
3599
if test \"\$libtool_install_magic\" = \"$magic\"; then
 
3600
  # install mode needs the following variable:
 
3601
  notinst_deplibs='$notinst_deplibs'
 
3602
else
 
3603
  # When we are sourced in execute mode, \$file and \$echo are already set.
 
3604
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
 
3605
    echo=\"$qecho\"
 
3606
    file=\"\$0\"
 
3607
    # Make sure echo works.
 
3608
    if test \"X\$1\" = X--no-reexec; then
 
3609
      # Discard the --no-reexec flag, and continue.
 
3610
      shift
 
3611
    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
 
3612
      # Yippee, \$echo works!
 
3613
      :
 
3614
    else
 
3615
      # Restart under the correct shell, and then maybe \$echo will work.
 
3616
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
 
3617
    fi
 
3618
  fi\
 
3619
"
 
3620
        $echo >> $output "\
 
3621
 
 
3622
  # Find the directory that this script lives in.
 
3623
  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
 
3624
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 
3625
 
 
3626
  # Follow symbolic links until we get to the real thisdir.
 
3627
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
 
3628
  while test -n \"\$file\"; do
 
3629
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
 
3630
 
 
3631
    # If there was a directory component, then change thisdir.
 
3632
    if test \"x\$destdir\" != \"x\$file\"; then
 
3633
      case \"\$destdir\" in
 
3634
      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
 
3635
      *) thisdir=\"\$thisdir/\$destdir\" ;;
 
3636
      esac
 
3637
    fi
 
3638
 
 
3639
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
 
3640
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
 
3641
  done
 
3642
 
 
3643
  # Try to get the absolute directory name.
 
3644
  absdir=\`cd \"\$thisdir\" && pwd\`
 
3645
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
 
3646
"
 
3647
 
 
3648
        if test "$fast_install" = yes; then
 
3649
          echo >> $output "\
 
3650
  program=lt-'$outputname'$exeext
 
3651
  progdir=\"\$thisdir/$objdir\"
 
3652
 
 
3653
  if test ! -f \"\$progdir/\$program\" || \\
 
3654
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
 
3655
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
 
3656
 
 
3657
    file=\"\$\$-\$program\"
 
3658
 
 
3659
    if test ! -d \"\$progdir\"; then
 
3660
      $mkdir \"\$progdir\"
 
3661
    else
 
3662
      $rm \"\$progdir/\$file\"
 
3663
    fi"
 
3664
 
 
3665
          echo >> $output "\
 
3666
 
 
3667
    # relink executable if necessary
 
3668
    if test -n \"\$relink_command\"; then
 
3669
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
 
3670
      else
 
3671
        $echo \"\$relink_command_output\" >&2
 
3672
        $rm \"\$progdir/\$file\"
 
3673
        exit 1
 
3674
      fi
 
3675
    fi
 
3676
 
 
3677
    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
 
3678
    { $rm \"\$progdir/\$program\";
 
3679
      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
 
3680
    $rm \"\$progdir/\$file\"
 
3681
  fi"
 
3682
        else
 
3683
          echo >> $output "\
 
3684
  program='$outputname'
 
3685
  progdir=\"\$thisdir/$objdir\"
 
3686
"
 
3687
        fi
 
3688
 
 
3689
        echo >> $output "\
 
3690
 
 
3691
  if test -f \"\$progdir/\$program\"; then"
 
3692
 
 
3693
        # Export our shlibpath_var if we have one.
 
3694
        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 
3695
          $echo >> $output "\
 
3696
    # Add our own library path to $shlibpath_var
 
3697
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
 
3698
 
 
3699
    # Some systems cannot cope with colon-terminated $shlibpath_var
 
3700
    # The second colon is a workaround for a bug in BeOS R4 sed
 
3701
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
 
3702
 
 
3703
    export $shlibpath_var
 
3704
"
 
3705
        fi
 
3706
 
 
3707
        # fixup the dll searchpath if we need to.
 
3708
        if test -n "$dllsearchpath"; then
 
3709
          $echo >> $output "\
 
3710
    # Add the dll search path components to the executable PATH
 
3711
    PATH=$dllsearchpath:\$PATH
 
3712
"
 
3713
        fi
 
3714
 
 
3715
        $echo >> $output "\
 
3716
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
 
3717
      # Run the actual program with our arguments.
 
3718
"
 
3719
        case $host in
 
3720
        # win32 systems need to use the prog path for dll
 
3721
        # lookup to work
 
3722
        *-*-cygwin* | *-*-pw32*)
 
3723
          $echo >> $output "\
 
3724
      exec \$progdir/\$program \${1+\"\$@\"}
 
3725
"
 
3726
          ;;
 
3727
 
 
3728
        # Backslashes separate directories on plain windows
 
3729
        *-*-mingw | *-*-os2*)
 
3730
          $echo >> $output "\
 
3731
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
3732
"
 
3733
          ;;
 
3734
 
 
3735
        *)
 
3736
          $echo >> $output "\
 
3737
      # Export the path to the program.
 
3738
      PATH=\"\$progdir:\$PATH\"
 
3739
      export PATH
 
3740
 
 
3741
      exec \$program \${1+\"\$@\"}
 
3742
"
 
3743
          ;;
 
3744
        esac
 
3745
        $echo >> $output "\
 
3746
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
 
3747
      exit 1
 
3748
    fi
 
3749
  else
 
3750
    # The program doesn't exist.
 
3751
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
3752
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
 
3753
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
 
3754
    exit 1
 
3755
  fi
 
3756
fi\
 
3757
"
 
3758
        chmod +x $output
 
3759
      fi
 
3760
      exit 0
 
3761
      ;;
 
3762
    esac
 
3763
 
 
3764
    # See if we need to build an old-fashioned archive.
 
3765
    for oldlib in $oldlibs; do
 
3766
 
 
3767
      if test "$build_libtool_libs" = convenience; then
 
3768
        oldobjs="$libobjs_save"
 
3769
        addlibs="$convenience"
 
3770
        build_libtool_libs=no
 
3771
      else
 
3772
        if test "$build_libtool_libs" = module; then
 
3773
          oldobjs="$libobjs_save"
 
3774
          build_libtool_libs=no
 
3775
        else
 
3776
          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
 
3777
        fi
 
3778
        addlibs="$old_convenience"
 
3779
      fi
 
3780
 
 
3781
      if test -n "$addlibs"; then
 
3782
        gentop="$output_objdir/${outputname}x"
 
3783
        $show "${rm}r $gentop"
 
3784
        $run ${rm}r "$gentop"
 
3785
        $show "mkdir $gentop"
 
3786
        $run mkdir "$gentop"
 
3787
        status=$?
 
3788
        if test $status -ne 0 && test ! -d "$gentop"; then
 
3789
          exit $status
 
3790
        fi
 
3791
        generated="$generated $gentop"
 
3792
 
 
3793
        # Add in members from convenience archives.
 
3794
        for xlib in $addlibs; do
 
3795
          # Extract the objects.
 
3796
          case $xlib in
 
3797
          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
 
3798
          *) xabs=`pwd`"/$xlib" ;;
 
3799
          esac
 
3800
          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
 
3801
          xdir="$gentop/$xlib"
 
3802
 
 
3803
          $show "${rm}r $xdir"
 
3804
          $run ${rm}r "$xdir"
 
3805
          $show "mkdir $xdir"
 
3806
          $run mkdir "$xdir"
 
3807
          status=$?
 
3808
          if test $status -ne 0 && test ! -d "$xdir"; then
 
3809
            exit $status
 
3810
          fi
 
3811
          $show "(cd $xdir && $AR x $xabs)"
 
3812
          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
3813
 
 
3814
          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
 
3815
        done
 
3816
      fi
 
3817
 
 
3818
      # Do each command in the archive commands.
 
3819
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
 
3820
        eval cmds=\"$old_archive_from_new_cmds\"
 
3821
      else
 
3822
        # Ensure that we have .o objects in place in case we decided
 
3823
        # not to build a shared library, and have fallen back to building
 
3824
        # static libs even though --disable-static was passed!
 
3825
        for oldobj in $oldobjs; do
 
3826
          if test ! -f $oldobj; then
 
3827
            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
 
3828
            if test "X$xdir" = "X$oldobj"; then
 
3829
              xdir="."
 
3830
            else
 
3831
              xdir="$xdir"
 
3832
            fi
 
3833
            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
 
3834
            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
 
3835
            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
 
3836
            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
 
3837
          fi
 
3838
        done
 
3839
 
 
3840
        eval cmds=\"$old_archive_cmds\"
 
3841
      fi
 
3842
      save_ifs="$IFS"; IFS='~'
 
3843
      for cmd in $cmds; do
 
3844
        IFS="$save_ifs"
 
3845
        $show "$cmd"
 
3846
        $run eval "$cmd" || exit $?
 
3847
      done
 
3848
      IFS="$save_ifs"
 
3849
    done
 
3850
 
 
3851
    if test -n "$generated"; then
 
3852
      $show "${rm}r$generated"
 
3853
      $run ${rm}r$generated
 
3854
    fi
 
3855
 
 
3856
    # Now create the libtool archive.
 
3857
    case $output in
 
3858
    *.la)
 
3859
      old_library=
 
3860
      test "$build_old_libs" = yes && old_library="$libname.$libext"
 
3861
      $show "creating $output"
 
3862
 
 
3863
      # Preserve any variables that may affect compiler behavior
 
3864
      for var in $variables_saved_for_relink; do
 
3865
        if eval test -z \"\${$var+set}\"; then
 
3866
          relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
 
3867
        elif eval var_value=\$$var; test -z "$var_value"; then
 
3868
          relink_command="$var=; export $var; $relink_command"
 
3869
        else
 
3870
          var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
 
3871
          relink_command="$var=\"$var_value\"; export $var; $relink_command"
 
3872
        fi
 
3873
      done
 
3874
      # Quote the link command for shipping.
 
3875
      relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
 
3876
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
3877
 
 
3878
      # Only create the output if not a dry run.
 
3879
      if test -z "$run"; then
 
3880
        for installed in no yes; do
 
3881
          if test "$installed" = yes; then
 
3882
            if test -z "$install_libdir"; then
 
3883
              break
 
3884
            fi
 
3885
            output="$output_objdir/$outputname"i
 
3886
            # Replace all uninstalled libtool libraries with the installed ones
 
3887
            newdependency_libs=
 
3888
            for deplib in $dependency_libs; do
 
3889
              case $deplib in
 
3890
              *.la)
 
3891
                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
 
3892
                eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 
3893
                if test -z "$libdir"; then
 
3894
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
 
3895
                  exit 1
 
3896
                fi
 
3897
                newdependency_libs="$newdependency_libs $libdir/$name"
 
3898
                ;;
 
3899
              *) newdependency_libs="$newdependency_libs $deplib" ;;
 
3900
              esac
 
3901
            done
 
3902
            dependency_libs="$newdependency_libs"
 
3903
            newdlfiles=
 
3904
            for lib in $dlfiles; do
 
3905
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
3906
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
3907
              if test -z "$libdir"; then
 
3908
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
3909
                exit 1
 
3910
              fi
 
3911
              newdlfiles="$newdlfiles $libdir/$name"
 
3912
            done
 
3913
            dlfiles="$newdlfiles"
 
3914
            newdlprefiles=
 
3915
            for lib in $dlprefiles; do
 
3916
              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
 
3917
              eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 
3918
              if test -z "$libdir"; then
 
3919
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
3920
                exit 1
 
3921
              fi
 
3922
              newdlprefiles="$newdlprefiles $libdir/$name"
 
3923
            done
 
3924
            dlprefiles="$newdlprefiles"
 
3925
          fi
 
3926
          $rm $output
 
3927
          # place dlname in correct position for cygwin
 
3928
          tdlname=$dlname
 
3929
          case $host,$output,$installed,$module,$dlname in
 
3930
            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 
3931
          esac
 
3932
          $echo > $output "\
 
3933
# $outputname - a libtool library file
 
3934
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
 
3935
#
 
3936
# Please DO NOT delete this file!
 
3937
# It is necessary for linking the library.
 
3938
 
 
3939
# The name that we can dlopen(3).
 
3940
dlname='$tdlname'
 
3941
 
 
3942
# Names of this library.
 
3943
library_names='$library_names'
 
3944
 
 
3945
# The name of the static archive.
 
3946
old_library='$old_library'
 
3947
 
 
3948
# Libraries that this one depends upon.
 
3949
dependency_libs='$dependency_libs'
 
3950
 
 
3951
# Version information for $libname.
 
3952
current=$current
 
3953
age=$age
 
3954
revision=$revision
 
3955
 
 
3956
# Is this an already installed library?
 
3957
installed=$installed
 
3958
 
 
3959
# Files to dlopen/dlpreopen
 
3960
dlopen='$dlfiles'
 
3961
dlpreopen='$dlprefiles'
 
3962
 
 
3963
# Directory that this library needs to be installed in:
 
3964
libdir='$install_libdir'"
 
3965
          if test "$installed" = no && test $need_relink = yes; then
 
3966
            $echo >> $output "\
 
3967
relink_command=\"$relink_command\""
 
3968
          fi
 
3969
        done
 
3970
      fi
 
3971
 
 
3972
      # Do a symbolic link so that the libtool archive can be found in
 
3973
      # LD_LIBRARY_PATH before the program is installed.
 
3974
      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
 
3975
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
 
3976
      ;;
 
3977
    esac
 
3978
    exit 0
 
3979
    ;;
 
3980
 
 
3981
  # libtool install mode
 
3982
  install)
 
3983
    modename="$modename: install"
 
3984
 
 
3985
    # There may be an optional sh(1) argument at the beginning of
 
3986
    # install_prog (especially on Windows NT).
 
3987
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
 
3988
       # Allow the use of GNU shtool's install command.
 
3989
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
3990
      # Aesthetically quote it.
 
3991
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
 
3992
      case $arg in
 
3993
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
3994
        arg="\"$arg\""
 
3995
        ;;
 
3996
      esac
 
3997
      install_prog="$arg "
 
3998
      arg="$1"
 
3999
      shift
 
4000
    else
 
4001
      install_prog=
 
4002
      arg="$nonopt"
 
4003
    fi
 
4004
 
 
4005
    # The real first argument should be the name of the installation program.
 
4006
    # Aesthetically quote it.
 
4007
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
4008
    case $arg in
 
4009
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
 
4010
      arg="\"$arg\""
 
4011
      ;;
 
4012
    esac
 
4013
    install_prog="$install_prog$arg"
 
4014
 
 
4015
    # We need to accept at least all the BSD install flags.
 
4016
    dest=
 
4017
    files=
 
4018
    opts=
 
4019
    prev=
 
4020
    install_type=
 
4021
    isdir=no
 
4022
    stripme=
 
4023
    for arg
 
4024
    do
 
4025
      if test -n "$dest"; then
 
4026
        files="$files $dest"
 
4027
        dest="$arg"
 
4028
        continue
 
4029
      fi
 
4030
 
 
4031
      case $arg in
 
4032
      -d) isdir=yes ;;
 
4033
      -f) prev="-f" ;;
 
4034
      -g) prev="-g" ;;
 
4035
      -m) prev="-m" ;;
 
4036
      -o) prev="-o" ;;
 
4037
      -s)
 
4038
        stripme=" -s"
 
4039
        continue
 
4040
        ;;
 
4041
      -*) ;;
 
4042
 
 
4043
      *)
 
4044
        # If the previous option needed an argument, then skip it.
 
4045
        if test -n "$prev"; then
 
4046
          prev=
 
4047
        else
 
4048
          dest="$arg"
 
4049
          continue
 
4050
        fi
 
4051
        ;;
 
4052
      esac
 
4053
 
 
4054
      # Aesthetically quote the argument.
 
4055
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 
4056
      case $arg in
 
4057
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
 
4058
        arg="\"$arg\""
 
4059
        ;;
 
4060
      esac
 
4061
      install_prog="$install_prog $arg"
 
4062
    done
 
4063
 
 
4064
    if test -z "$install_prog"; then
 
4065
      $echo "$modename: you must specify an install program" 1>&2
 
4066
      $echo "$help" 1>&2
 
4067
      exit 1
 
4068
    fi
 
4069
 
 
4070
    if test -n "$prev"; then
 
4071
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
 
4072
      $echo "$help" 1>&2
 
4073
      exit 1
 
4074
    fi
 
4075
 
 
4076
    if test -z "$files"; then
 
4077
      if test -z "$dest"; then
 
4078
        $echo "$modename: no file or destination specified" 1>&2
 
4079
      else
 
4080
        $echo "$modename: you must specify a destination" 1>&2
 
4081
      fi
 
4082
      $echo "$help" 1>&2
 
4083
      exit 1
 
4084
    fi
 
4085
 
 
4086
    # Strip any trailing slash from the destination.
 
4087
    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
 
4088
 
 
4089
    # Check to see that the destination is a directory.
 
4090
    test -d "$dest" && isdir=yes
 
4091
    if test "$isdir" = yes; then
 
4092
      destdir="$dest"
 
4093
      destname=
 
4094
    else
 
4095
      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
 
4096
      test "X$destdir" = "X$dest" && destdir=.
 
4097
      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
 
4098
 
 
4099
      # Not a directory, so check to see that there is only one file specified.
 
4100
      set dummy $files
 
4101
      if test $# -gt 2; then
 
4102
        $echo "$modename: \`$dest' is not a directory" 1>&2
 
4103
        $echo "$help" 1>&2
 
4104
        exit 1
 
4105
      fi
 
4106
    fi
 
4107
    case $destdir in
 
4108
    [\\/]* | [A-Za-z]:[\\/]*) ;;
 
4109
    *)
 
4110
      for file in $files; do
 
4111
        case $file in
 
4112
        *.lo) ;;
 
4113
        *)
 
4114
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
 
4115
          $echo "$help" 1>&2
 
4116
          exit 1
 
4117
          ;;
 
4118
        esac
 
4119
      done
 
4120
      ;;
 
4121
    esac
 
4122
 
 
4123
    # This variable tells wrapper scripts just to set variables rather
 
4124
    # than running their programs.
 
4125
    libtool_install_magic="$magic"
 
4126
 
 
4127
    staticlibs=
 
4128
    future_libdirs=
 
4129
    current_libdirs=
 
4130
    for file in $files; do
 
4131
 
 
4132
      # Do each installation.
 
4133
      case $file in
 
4134
      *.$libext)
 
4135
        # Do the static libraries later.
 
4136
        staticlibs="$staticlibs $file"
 
4137
        ;;
 
4138
 
 
4139
      *.la)
 
4140
        # Check to see that this really is a libtool archive.
 
4141
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
4142
        else
 
4143
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
 
4144
          $echo "$help" 1>&2
 
4145
          exit 1
 
4146
        fi
 
4147
 
 
4148
        library_names=
 
4149
        old_library=
 
4150
        relink_command=
 
4151
        # If there is no directory component, then add one.
 
4152
        case $file in
 
4153
        */* | *\\*) . $file ;;
 
4154
        *) . ./$file ;;
 
4155
        esac
 
4156
 
 
4157
        # Add the libdir to current_libdirs if it is the destination.
 
4158
        if test "X$destdir" = "X$libdir"; then
 
4159
          case "$current_libdirs " in
 
4160
          *" $libdir "*) ;;
 
4161
          *) current_libdirs="$current_libdirs $libdir" ;;
 
4162
          esac
 
4163
        else
 
4164
          # Note the libdir as a future libdir.
 
4165
          case "$future_libdirs " in
 
4166
          *" $libdir "*) ;;
 
4167
          *) future_libdirs="$future_libdirs $libdir" ;;
 
4168
          esac
 
4169
        fi
 
4170
 
 
4171
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
 
4172
        test "X$dir" = "X$file/" && dir=
 
4173
        dir="$dir$objdir"
 
4174
 
 
4175
        if test -n "$relink_command"; then
 
4176
          $echo "$modename: warning: relinking \`$file'" 1>&2
 
4177
          $show "$relink_command"
 
4178
          if $run eval "$relink_command"; then :
 
4179
          else
 
4180
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
 
4181
            continue
 
4182
          fi
 
4183
        fi
 
4184
 
 
4185
        # See the names of the shared library.
 
4186
        set dummy $library_names
 
4187
        if test -n "$2"; then
 
4188
          realname="$2"
 
4189
          shift
 
4190
          shift
 
4191
 
 
4192
          srcname="$realname"
 
4193
          test -n "$relink_command" && srcname="$realname"T
 
4194
 
 
4195
          # Install the shared library and build the symlinks.
 
4196
          $show "$install_prog $dir/$srcname $destdir/$realname"
 
4197
          $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
 
4198
          if test -n "$stripme" && test -n "$striplib"; then
 
4199
            $show "$striplib $destdir/$realname"
 
4200
            $run eval "$striplib $destdir/$realname" || exit $?
 
4201
          fi
 
4202
 
 
4203
          if test $# -gt 0; then
 
4204
            # Delete the old symlinks, and create new ones.
 
4205
            for linkname
 
4206
            do
 
4207
              if test "$linkname" != "$realname"; then
 
4208
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
4209
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
4210
              fi
 
4211
            done
 
4212
          fi
 
4213
 
 
4214
          # Do each command in the postinstall commands.
 
4215
          lib="$destdir/$realname"
 
4216
          eval cmds=\"$postinstall_cmds\"
 
4217
          save_ifs="$IFS"; IFS='~'
 
4218
          for cmd in $cmds; do
 
4219
            IFS="$save_ifs"
 
4220
            $show "$cmd"
 
4221
            $run eval "$cmd" || exit $?
 
4222
          done
 
4223
          IFS="$save_ifs"
 
4224
        fi
 
4225
 
 
4226
        # Install the pseudo-library for information purposes.
 
4227
        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
4228
        instname="$dir/$name"i
 
4229
        $show "$install_prog $instname $destdir/$name"
 
4230
        $run eval "$install_prog $instname $destdir/$name" || exit $?
 
4231
 
 
4232
        # Maybe install the static library, too.
 
4233
        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
 
4234
        ;;
 
4235
 
 
4236
      *.lo)
 
4237
        # Install (i.e. copy) a libtool object.
 
4238
 
 
4239
        # Figure out destination file name, if it wasn't already specified.
 
4240
        if test -n "$destname"; then
 
4241
          destfile="$destdir/$destname"
 
4242
        else
 
4243
          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
4244
          destfile="$destdir/$destfile"
 
4245
        fi
 
4246
 
 
4247
        # Deduce the name of the destination old-style object file.
 
4248
        case $destfile in
 
4249
        *.lo)
 
4250
          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
 
4251
          ;;
 
4252
        *.$objext)
 
4253
          staticdest="$destfile"
 
4254
          destfile=
 
4255
          ;;
 
4256
        *)
 
4257
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
 
4258
          $echo "$help" 1>&2
 
4259
          exit 1
 
4260
          ;;
 
4261
        esac
 
4262
 
 
4263
        # Install the libtool object if requested.
 
4264
        if test -n "$destfile"; then
 
4265
          $show "$install_prog $file $destfile"
 
4266
          $run eval "$install_prog $file $destfile" || exit $?
 
4267
        fi
 
4268
 
 
4269
        # Install the old object if enabled.
 
4270
        if test "$build_old_libs" = yes; then
 
4271
          # Deduce the name of the old-style object file.
 
4272
          staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
 
4273
 
 
4274
          $show "$install_prog $staticobj $staticdest"
 
4275
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
 
4276
        fi
 
4277
        exit 0
 
4278
        ;;
 
4279
 
 
4280
      *)
 
4281
        # Figure out destination file name, if it wasn't already specified.
 
4282
        if test -n "$destname"; then
 
4283
          destfile="$destdir/$destname"
 
4284
        else
 
4285
          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
4286
          destfile="$destdir/$destfile"
 
4287
        fi
 
4288
 
 
4289
        # Do a test to see if this is really a libtool program.
 
4290
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4291
          notinst_deplibs=
 
4292
          relink_command=
 
4293
 
 
4294
          # If there is no directory component, then add one.
 
4295
          case $file in
 
4296
          */* | *\\*) . $file ;;
 
4297
          *) . ./$file ;;
 
4298
          esac
 
4299
 
 
4300
          # Check the variables that should have been set.
 
4301
          if test -z "$notinst_deplibs"; then
 
4302
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
 
4303
            exit 1
 
4304
          fi
 
4305
 
 
4306
          finalize=yes
 
4307
          for lib in $notinst_deplibs; do
 
4308
            # Check to see that each library is installed.
 
4309
            libdir=
 
4310
            if test -f "$lib"; then
 
4311
              # If there is no directory component, then add one.
 
4312
              case $lib in
 
4313
              */* | *\\*) . $lib ;;
 
4314
              *) . ./$lib ;;
 
4315
              esac
 
4316
            fi
 
4317
            libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
 
4318
            if test -n "$libdir" && test ! -f "$libfile"; then
 
4319
              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
 
4320
              finalize=no
 
4321
            fi
 
4322
          done
 
4323
 
 
4324
          relink_command=
 
4325
          # If there is no directory component, then add one.
 
4326
          case $file in
 
4327
          */* | *\\*) . $file ;;
 
4328
          *) . ./$file ;;
 
4329
          esac
 
4330
 
 
4331
          outputname=
 
4332
          if test "$fast_install" = no && test -n "$relink_command"; then
 
4333
            if test "$finalize" = yes && test -z "$run"; then
 
4334
              tmpdir="/tmp"
 
4335
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
 
4336
              tmpdir="$tmpdir/libtool-$$"
 
4337
              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
 
4338
              else
 
4339
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
 
4340
                continue
 
4341
              fi
 
4342
              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
4343
              outputname="$tmpdir/$file"
 
4344
              # Replace the output file specification.
 
4345
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
 
4346
 
 
4347
              $show "$relink_command"
 
4348
              if $run eval "$relink_command"; then :
 
4349
              else
 
4350
                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
 
4351
                ${rm}r "$tmpdir"
 
4352
                continue
 
4353
              fi
 
4354
              file="$outputname"
 
4355
            else
 
4356
              $echo "$modename: warning: cannot relink \`$file'" 1>&2
 
4357
            fi
 
4358
          else
 
4359
            # Install the binary that we compiled earlier.
 
4360
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 
4361
          fi
 
4362
        fi
 
4363
 
 
4364
        # remove .exe since cygwin /usr/bin/install will append another
 
4365
        # one anyways
 
4366
        case $install_prog,$host in
 
4367
        /usr/bin/install*,*cygwin*)
 
4368
          case $file:$destfile in
 
4369
          *.exe:*.exe)
 
4370
            # this is ok
 
4371
            ;;
 
4372
          *.exe:*)
 
4373
            destfile=$destfile.exe
 
4374
            ;;
 
4375
          *:*.exe)
 
4376
            destfile=`echo $destfile | sed -e 's,.exe$,,'`
 
4377
            ;;
 
4378
          esac
 
4379
          ;;
 
4380
        esac
 
4381
        $show "$install_prog$stripme $file $destfile"
 
4382
        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
 
4383
        test -n "$outputname" && ${rm}r "$tmpdir"
 
4384
        ;;
 
4385
      esac
 
4386
    done
 
4387
 
 
4388
    for file in $staticlibs; do
 
4389
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
4390
 
 
4391
      # Set up the ranlib parameters.
 
4392
      oldlib="$destdir/$name"
 
4393
 
 
4394
      $show "$install_prog $file $oldlib"
 
4395
      $run eval "$install_prog \$file \$oldlib" || exit $?
 
4396
 
 
4397
      if test -n "$stripme" && test -n "$striplib"; then
 
4398
        $show "$old_striplib $oldlib"
 
4399
        $run eval "$old_striplib $oldlib" || exit $?
 
4400
      fi
 
4401
 
 
4402
      # Do each command in the postinstall commands.
 
4403
      eval cmds=\"$old_postinstall_cmds\"
 
4404
      save_ifs="$IFS"; IFS='~'
 
4405
      for cmd in $cmds; do
 
4406
        IFS="$save_ifs"
 
4407
        $show "$cmd"
 
4408
        $run eval "$cmd" || exit $?
 
4409
      done
 
4410
      IFS="$save_ifs"
 
4411
    done
 
4412
 
 
4413
    if test -n "$future_libdirs"; then
 
4414
      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
 
4415
    fi
 
4416
 
 
4417
    if test -n "$current_libdirs"; then
 
4418
      # Maybe just do a dry run.
 
4419
      test -n "$run" && current_libdirs=" -n$current_libdirs"
 
4420
      exec_cmd='$SHELL $0 --finish$current_libdirs'
 
4421
    else
 
4422
      exit 0
 
4423
    fi
 
4424
    ;;
 
4425
 
 
4426
  # libtool finish mode
 
4427
  finish)
 
4428
    modename="$modename: finish"
 
4429
    libdirs="$nonopt"
 
4430
    admincmds=
 
4431
 
 
4432
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
 
4433
      for dir
 
4434
      do
 
4435
        libdirs="$libdirs $dir"
 
4436
      done
 
4437
 
 
4438
      for libdir in $libdirs; do
 
4439
        if test -n "$finish_cmds"; then
 
4440
          # Do each command in the finish commands.
 
4441
          eval cmds=\"$finish_cmds\"
 
4442
          save_ifs="$IFS"; IFS='~'
 
4443
          for cmd in $cmds; do
 
4444
            IFS="$save_ifs"
 
4445
            $show "$cmd"
 
4446
            $run eval "$cmd" || admincmds="$admincmds
 
4447
       $cmd"
 
4448
          done
 
4449
          IFS="$save_ifs"
 
4450
        fi
 
4451
        if test -n "$finish_eval"; then
 
4452
          # Do the single finish_eval.
 
4453
          eval cmds=\"$finish_eval\"
 
4454
          $run eval "$cmds" || admincmds="$admincmds
 
4455
       $cmds"
 
4456
        fi
 
4457
      done
 
4458
    fi
 
4459
 
 
4460
    # Exit here if they wanted silent mode.
 
4461
    test "$show" = ":" && exit 0
 
4462
 
 
4463
    echo "----------------------------------------------------------------------"
 
4464
    echo "Libraries have been installed in:"
 
4465
    for libdir in $libdirs; do
 
4466
      echo "   $libdir"
 
4467
    done
 
4468
    echo
 
4469
    echo "If you ever happen to want to link against installed libraries"
 
4470
    echo "in a given directory, LIBDIR, you must either use libtool, and"
 
4471
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
 
4472
    echo "flag during linking and do at least one of the following:"
 
4473
    if test -n "$shlibpath_var"; then
 
4474
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
 
4475
      echo "     during execution"
 
4476
    fi
 
4477
    if test -n "$runpath_var"; then
 
4478
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
 
4479
      echo "     during linking"
 
4480
    fi
 
4481
    if test -n "$hardcode_libdir_flag_spec"; then
 
4482
      libdir=LIBDIR
 
4483
      eval flag=\"$hardcode_libdir_flag_spec\"
 
4484
 
 
4485
      echo "   - use the \`$flag' linker flag"
 
4486
    fi
 
4487
    if test -n "$admincmds"; then
 
4488
      echo "   - have your system administrator run these commands:$admincmds"
 
4489
    fi
 
4490
    if test -f /etc/ld.so.conf; then
 
4491
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
 
4492
    fi
 
4493
    echo
 
4494
    echo "See any operating system documentation about shared libraries for"
 
4495
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
 
4496
    echo "----------------------------------------------------------------------"
 
4497
    exit 0
 
4498
    ;;
 
4499
 
 
4500
  # libtool execute mode
 
4501
  execute)
 
4502
    modename="$modename: execute"
 
4503
 
 
4504
    # The first argument is the command name.
 
4505
    cmd="$nonopt"
 
4506
    if test -z "$cmd"; then
 
4507
      $echo "$modename: you must specify a COMMAND" 1>&2
 
4508
      $echo "$help"
 
4509
      exit 1
 
4510
    fi
 
4511
 
 
4512
    # Handle -dlopen flags immediately.
 
4513
    for file in $execute_dlfiles; do
 
4514
      if test ! -f "$file"; then
 
4515
        $echo "$modename: \`$file' is not a file" 1>&2
 
4516
        $echo "$help" 1>&2
 
4517
        exit 1
 
4518
      fi
 
4519
 
 
4520
      dir=
 
4521
      case $file in
 
4522
      *.la)
 
4523
        # Check to see that this really is a libtool archive.
 
4524
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
 
4525
        else
 
4526
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
 
4527
          $echo "$help" 1>&2
 
4528
          exit 1
 
4529
        fi
 
4530
 
 
4531
        # Read the libtool library.
 
4532
        dlname=
 
4533
        library_names=
 
4534
 
 
4535
        # If there is no directory component, then add one.
 
4536
        case $file in
 
4537
        */* | *\\*) . $file ;;
 
4538
        *) . ./$file ;;
 
4539
        esac
 
4540
 
 
4541
        # Skip this library if it cannot be dlopened.
 
4542
        if test -z "$dlname"; then
 
4543
          # Warn if it was a shared library.
 
4544
          test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
 
4545
          continue
 
4546
        fi
 
4547
 
 
4548
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
 
4549
        test "X$dir" = "X$file" && dir=.
 
4550
 
 
4551
        if test -f "$dir/$objdir/$dlname"; then
 
4552
          dir="$dir/$objdir"
 
4553
        else
 
4554
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
 
4555
          exit 1
 
4556
        fi
 
4557
        ;;
 
4558
 
 
4559
      *.lo)
 
4560
        # Just add the directory containing the .lo file.
 
4561
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
 
4562
        test "X$dir" = "X$file" && dir=.
 
4563
        ;;
 
4564
 
 
4565
      *)
 
4566
        $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
 
4567
        continue
 
4568
        ;;
 
4569
      esac
 
4570
 
 
4571
      # Get the absolute pathname.
 
4572
      absdir=`cd "$dir" && pwd`
 
4573
      test -n "$absdir" && dir="$absdir"
 
4574
 
 
4575
      # Now add the directory to shlibpath_var.
 
4576
      if eval "test -z \"\$$shlibpath_var\""; then
 
4577
        eval "$shlibpath_var=\"\$dir\""
 
4578
      else
 
4579
        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
 
4580
      fi
 
4581
    done
 
4582
 
 
4583
    # This variable tells wrapper scripts just to set shlibpath_var
 
4584
    # rather than running their programs.
 
4585
    libtool_execute_magic="$magic"
 
4586
 
 
4587
    # Check if any of the arguments is a wrapper script.
 
4588
    args=
 
4589
    for file
 
4590
    do
 
4591
      case $file in
 
4592
      -*) ;;
 
4593
      *)
 
4594
        # Do a test to see if this is really a libtool program.
 
4595
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4596
          # If there is no directory component, then add one.
 
4597
          case $file in
 
4598
          */* | *\\*) . $file ;;
 
4599
          *) . ./$file ;;
 
4600
          esac
 
4601
 
 
4602
          # Transform arg to wrapped name.
 
4603
          file="$progdir/$program"
 
4604
        fi
 
4605
        ;;
 
4606
      esac
 
4607
      # Quote arguments (to preserve shell metacharacters).
 
4608
      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
 
4609
      args="$args \"$file\""
 
4610
    done
 
4611
 
 
4612
    if test -z "$run"; then
 
4613
      if test -n "$shlibpath_var"; then
 
4614
        # Export the shlibpath_var.
 
4615
        eval "export $shlibpath_var"
 
4616
      fi
 
4617
 
 
4618
      # Restore saved enviroment variables
 
4619
      if test "${save_LC_ALL+set}" = set; then
 
4620
        LC_ALL="$save_LC_ALL"; export LC_ALL
 
4621
      fi
 
4622
      if test "${save_LANG+set}" = set; then
 
4623
        LANG="$save_LANG"; export LANG
 
4624
      fi
 
4625
 
 
4626
      # Now prepare to actually exec the command.
 
4627
      exec_cmd='"$cmd"$args'
 
4628
    else
 
4629
      # Display what would be done.
 
4630
      if test -n "$shlibpath_var"; then
 
4631
        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
 
4632
        $echo "export $shlibpath_var"
 
4633
      fi
 
4634
      $echo "$cmd$args"
 
4635
      exit 0
 
4636
    fi
 
4637
    ;;
 
4638
 
 
4639
  # libtool clean and uninstall mode
 
4640
  clean | uninstall)
 
4641
    modename="$modename: $mode"
 
4642
    rm="$nonopt"
 
4643
    files=
 
4644
    rmforce=
 
4645
    exit_status=0
 
4646
 
 
4647
    # This variable tells wrapper scripts just to set variables rather
 
4648
    # than running their programs.
 
4649
    libtool_install_magic="$magic"
 
4650
 
 
4651
    for arg
 
4652
    do
 
4653
      case $arg in
 
4654
      -f) rm="$rm $arg"; rmforce=yes ;;
 
4655
      -*) rm="$rm $arg" ;;
 
4656
      *) files="$files $arg" ;;
 
4657
      esac
 
4658
    done
 
4659
 
 
4660
    if test -z "$rm"; then
 
4661
      $echo "$modename: you must specify an RM program" 1>&2
 
4662
      $echo "$help" 1>&2
 
4663
      exit 1
 
4664
    fi
 
4665
 
 
4666
    rmdirs=
 
4667
 
 
4668
    for file in $files; do
 
4669
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
 
4670
      if test "X$dir" = "X$file"; then
 
4671
        dir=.
 
4672
        objdir="$objdir"
 
4673
      else
 
4674
        objdir="$dir/$objdir"
 
4675
      fi
 
4676
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 
4677
      test $mode = uninstall && objdir="$dir"
 
4678
 
 
4679
      # Remember objdir for removal later, being careful to avoid duplicates
 
4680
      if test $mode = clean; then
 
4681
        case " $rmdirs " in
 
4682
          *" $objdir "*) ;;
 
4683
          *) rmdirs="$rmdirs $objdir" ;;
 
4684
        esac
 
4685
      fi
 
4686
 
 
4687
      # Don't error if the file doesn't exist and rm -f was used.
 
4688
      if (test -L "$file") >/dev/null 2>&1 \
 
4689
        || (test -h "$file") >/dev/null 2>&1 \
 
4690
        || test -f "$file"; then
 
4691
        :
 
4692
      elif test -d "$file"; then
 
4693
        exit_status=1
 
4694
        continue
 
4695
      elif test "$rmforce" = yes; then
 
4696
        continue
 
4697
      fi
 
4698
 
 
4699
      rmfiles="$file"
 
4700
 
 
4701
      case $name in
 
4702
      *.la)
 
4703
        # Possibly a libtool archive, so verify it.
 
4704
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4705
          . $dir/$name
 
4706
 
 
4707
          # Delete the libtool libraries and symlinks.
 
4708
          for n in $library_names; do
 
4709
            rmfiles="$rmfiles $objdir/$n"
 
4710
          done
 
4711
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
 
4712
          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
4713
 
 
4714
          if test $mode = uninstall; then
 
4715
            if test -n "$library_names"; then
 
4716
              # Do each command in the postuninstall commands.
 
4717
              eval cmds=\"$postuninstall_cmds\"
 
4718
              save_ifs="$IFS"; IFS='~'
 
4719
              for cmd in $cmds; do
 
4720
                IFS="$save_ifs"
 
4721
                $show "$cmd"
 
4722
                $run eval "$cmd"
 
4723
                if test $? != 0 && test "$rmforce" != yes; then
 
4724
                  exit_status=1
 
4725
                fi
 
4726
              done
 
4727
              IFS="$save_ifs"
 
4728
            fi
 
4729
 
 
4730
            if test -n "$old_library"; then
 
4731
              # Do each command in the old_postuninstall commands.
 
4732
              eval cmds=\"$old_postuninstall_cmds\"
 
4733
              save_ifs="$IFS"; IFS='~'
 
4734
              for cmd in $cmds; do
 
4735
                IFS="$save_ifs"
 
4736
                $show "$cmd"
 
4737
                $run eval "$cmd"
 
4738
                if test $? != 0 && test "$rmforce" != yes; then
 
4739
                  exit_status=1
 
4740
                fi
 
4741
              done
 
4742
              IFS="$save_ifs"
 
4743
            fi
 
4744
            # FIXME: should reinstall the best remaining shared library.
 
4745
          fi
 
4746
        fi
 
4747
        ;;
 
4748
 
 
4749
      *.lo)
 
4750
        if test "$build_old_libs" = yes; then
 
4751
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
 
4752
          rmfiles="$rmfiles $dir/$oldobj"
 
4753
        fi
 
4754
        ;;
 
4755
 
 
4756
      *)
 
4757
        # Do a test to see if this is a libtool program.
 
4758
        if test $mode = clean &&
 
4759
           (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
 
4760
          relink_command=
 
4761
          . $dir/$file
 
4762
 
 
4763
          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 
4764
          if test "$fast_install" = yes && test -n "$relink_command"; then
 
4765
            rmfiles="$rmfiles $objdir/lt-$name"
 
4766
          fi
 
4767
        fi
 
4768
        ;;
 
4769
      esac
 
4770
      $show "$rm $rmfiles"
 
4771
      $run $rm $rmfiles || exit_status=1
 
4772
    done
 
4773
 
 
4774
    # Try to remove the ${objdir}s in the directories where we deleted files
 
4775
    for dir in $rmdirs; do
 
4776
      if test -d "$dir"; then
 
4777
        $show "rmdir $dir"
 
4778
        $run rmdir $dir >/dev/null 2>&1
 
4779
      fi
 
4780
    done
 
4781
 
 
4782
    exit $exit_status
 
4783
    ;;
 
4784
 
 
4785
  "")
 
4786
    $echo "$modename: you must specify a MODE" 1>&2
 
4787
    $echo "$generic_help" 1>&2
 
4788
    exit 1
 
4789
    ;;
 
4790
  esac
 
4791
 
 
4792
  if test -z "$exec_cmd"; then
 
4793
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
 
4794
    $echo "$generic_help" 1>&2
 
4795
    exit 1
 
4796
  fi
 
4797
fi # test -z "$show_help"
 
4798
 
 
4799
if test -n "$exec_cmd"; then
 
4800
  eval exec $exec_cmd
 
4801
  exit 1
 
4802
fi
 
4803
 
 
4804
# We need to display help for each of the modes.
 
4805
case $mode in
 
4806
"") $echo \
 
4807
"Usage: $modename [OPTION]... [MODE-ARG]...
 
4808
 
 
4809
Provide generalized library-building support services.
 
4810
 
 
4811
    --config          show all configuration variables
 
4812
    --debug           enable verbose shell tracing
 
4813
-n, --dry-run         display commands without modifying any files
 
4814
    --features        display basic configuration information and exit
 
4815
    --finish          same as \`--mode=finish'
 
4816
    --help            display this help message and exit
 
4817
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
 
4818
    --quiet           same as \`--silent'
 
4819
    --silent          don't print informational messages
 
4820
    --version         print version information
 
4821
 
 
4822
MODE must be one of the following:
 
4823
 
 
4824
      clean           remove files from the build directory
 
4825
      compile         compile a source file into a libtool object
 
4826
      execute         automatically set library path, then run a program
 
4827
      finish          complete the installation of libtool libraries
 
4828
      install         install libraries or executables
 
4829
      link            create a library or an executable
 
4830
      uninstall       remove libraries from an installed directory
 
4831
 
 
4832
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
 
4833
a more detailed description of MODE."
 
4834
  exit 0
 
4835
  ;;
 
4836
 
 
4837
clean)
 
4838
  $echo \
 
4839
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
 
4840
 
 
4841
Remove files from the build directory.
 
4842
 
 
4843
RM is the name of the program to use to delete files associated with each FILE
 
4844
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
 
4845
to RM.
 
4846
 
 
4847
If FILE is a libtool library, object or program, all the files associated
 
4848
with it are deleted. Otherwise, only FILE itself is deleted using RM."
 
4849
  ;;
 
4850
 
 
4851
compile)
 
4852
  $echo \
 
4853
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
 
4854
 
 
4855
Compile a source file into a libtool library object.
 
4856
 
 
4857
This mode accepts the following additional options:
 
4858
 
 
4859
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
 
4860
  -prefer-pic       try to building PIC objects only
 
4861
  -prefer-non-pic   try to building non-PIC objects only
 
4862
  -static           always build a \`.o' file suitable for static linking
 
4863
 
 
4864
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 
4865
from the given SOURCEFILE.
 
4866
 
 
4867
The output file name is determined by removing the directory component from
 
4868
SOURCEFILE, then substituting the C source code suffix \`.c' with the
 
4869
library object suffix, \`.lo'."
 
4870
  ;;
 
4871
 
 
4872
execute)
 
4873
  $echo \
 
4874
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
 
4875
 
 
4876
Automatically set library path, then run a program.
 
4877
 
 
4878
This mode accepts the following additional options:
 
4879
 
 
4880
  -dlopen FILE      add the directory containing FILE to the library path
 
4881
 
 
4882
This mode sets the library path environment variable according to \`-dlopen'
 
4883
flags.
 
4884
 
 
4885
If any of the ARGS are libtool executable wrappers, then they are translated
 
4886
into their corresponding uninstalled binary, and any of their required library
 
4887
directories are added to the library path.
 
4888
 
 
4889
Then, COMMAND is executed, with ARGS as arguments."
 
4890
  ;;
 
4891
 
 
4892
finish)
 
4893
  $echo \
 
4894
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
 
4895
 
 
4896
Complete the installation of libtool libraries.
 
4897
 
 
4898
Each LIBDIR is a directory that contains libtool libraries.
 
4899
 
 
4900
The commands that this mode executes may require superuser privileges.  Use
 
4901
the \`--dry-run' option if you just want to see what would be executed."
 
4902
  ;;
 
4903
 
 
4904
install)
 
4905
  $echo \
 
4906
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
 
4907
 
 
4908
Install executables or libraries.
 
4909
 
 
4910
INSTALL-COMMAND is the installation command.  The first component should be
 
4911
either the \`install' or \`cp' program.
 
4912
 
 
4913
The rest of the components are interpreted as arguments to that command (only
 
4914
BSD-compatible install options are recognized)."
 
4915
  ;;
 
4916
 
 
4917
link)
 
4918
  $echo \
 
4919
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
 
4920
 
 
4921
Link object files or libraries together to form another library, or to
 
4922
create an executable program.
 
4923
 
 
4924
LINK-COMMAND is a command using the C compiler that you would use to create
 
4925
a program from several object files.
 
4926
 
 
4927
The following components of LINK-COMMAND are treated specially:
 
4928
 
 
4929
  -all-static       do not do any dynamic linking at all
 
4930
  -avoid-version    do not add a version suffix if possible
 
4931
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
 
4932
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
 
4933
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
 
4934
  -export-symbols SYMFILE
 
4935
                    try to export only the symbols listed in SYMFILE
 
4936
  -export-symbols-regex REGEX
 
4937
                    try to export only the symbols matching REGEX
 
4938
  -LLIBDIR          search LIBDIR for required installed libraries
 
4939
  -lNAME            OUTPUT-FILE requires the installed library libNAME
 
4940
  -jnimodule        build a library that can dlopened via Java JNI
 
4941
  -module           build a library that can dlopened
 
4942
  -no-fast-install  disable the fast-install mode
 
4943
  -no-install       link a not-installable executable
 
4944
  -no-undefined     declare that a library does not refer to external symbols
 
4945
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
 
4946
  -release RELEASE  specify package release information
 
4947
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
 
4948
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
 
4949
  -static           do not do any dynamic linking of libtool libraries
 
4950
  -version-info CURRENT[:REVISION[:AGE]]
 
4951
                    specify library version info [each variable defaults to 0]
 
4952
 
 
4953
All other options (arguments beginning with \`-') are ignored.
 
4954
 
 
4955
Every other argument is treated as a filename.  Files ending in \`.la' are
 
4956
treated as uninstalled libtool libraries, other files are standard or library
 
4957
object files.
 
4958
 
 
4959
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
 
4960
only library objects (\`.lo' files) may be specified, and \`-rpath' is
 
4961
required, except when creating a convenience library.
 
4962
 
 
4963
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
 
4964
using \`ar' and \`ranlib', or on Windows using \`lib'.
 
4965
 
 
4966
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
 
4967
is created, otherwise an executable program is created."
 
4968
  ;;
 
4969
 
 
4970
uninstall)
 
4971
  $echo \
 
4972
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
 
4973
 
 
4974
Remove libraries from an installation directory.
 
4975
 
 
4976
RM is the name of the program to use to delete files associated with each FILE
 
4977
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
 
4978
to RM.
 
4979
 
 
4980
If FILE is a libtool library, all the files associated with it are deleted.
 
4981
Otherwise, only FILE itself is deleted using RM."
 
4982
  ;;
 
4983
 
 
4984
*)
 
4985
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
 
4986
  $echo "$help" 1>&2
 
4987
  exit 1
 
4988
  ;;
 
4989
esac
 
4990
 
 
4991
echo
 
4992
$echo "Try \`$modename --help' for more information about other modes."
 
4993
 
 
4994
exit 0
 
4995
 
 
4996
# Local Variables:
 
4997
# mode:shell-script
 
4998
# sh-indentation:2
 
4999
# End: