OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [acsupport/] [ltmain.sh] - Blame information for rev 493

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
# ltmain.sh - Provide generalized library-building support services.
2
# NOTE: Changing this file will not affect anything until you rerun ltconfig.
3
#
4
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
5
# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6
#
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
# General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#
21
# As a special exception to the GNU General Public License, if you
22
# distribute this file as part of a program that contains a
23
# configuration script generated by Autoconf, you may include it under
24
# the same distribution terms that you use for the rest of that program.
25
 
26
# Check that we have a working $echo.
27
if test "X$1" = X--no-reexec; then
28
  # Discard the --no-reexec flag, and continue.
29
  shift
30
elif test "X$1" = X--fallback-echo; then
31
  # used as fallback echo
32
  shift
33
  cat <<EOF
34
$*
35
EOF
36
  exit 0
37
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
38
  # Yippee, $echo works!
39
  :
40
else
41
  # Restart under the correct shell, and then maybe $echo will work.
42
  exec $SHELL "$0" --no-reexec ${1+"$@"}
43
fi
44
 
45
# The name of this program.
46
progname=`$echo "$0" | sed 's%^.*/%%'`
47
modename="$progname"
48
 
49
# Constants.
50
PROGRAM=ltmain.sh
51
PACKAGE=libtool
52
VERSION=1.2f
53
TIMESTAMP=" (1.385 1999/03/15 17:24:54)"
54
 
55
default_mode=
56
help="Try \`$progname --help' for more information."
57
magic="%%%MAGIC variable%%%"
58
mkdir="mkdir"
59
mv="mv -f"
60
rm="rm -f"
61
 
62
# Sed substitution that helps us do robust quoting.  It backslashifies
63
# metacharacters that are still active within double-quoted strings.
64
Xsed='sed -e 1s/^X//'
65
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
66
SP2NL='tr \040 \012'
67
NL2SP='tr \012 \040'
68
 
69
# NLS nuisances.
70
# Only set LANG and LC_ALL to C if already set.
71
# These must not be set unconditionally because not all systems understand
72
# e.g. LANG=C (notably SCO).
73
# We save the old values to restore during execute mode.
74
if test "${LC_ALL+set}" = set; then
75
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
76
fi
77
if test "${LANG+set}" = set; then
78
  save_LANG="$LANG"; LANG=C; export LANG
79
fi
80
 
81
if test "$LTCONFIG_VERSION" != "$VERSION"; then
82
  echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
83
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
84
  exit 1
85
fi
86
 
87
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
88
  echo "$modename: not configured to build any kind of library" 1>&2
89
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
90
  exit 1
91
fi
92
 
93
# Global variables.
94
mode=$default_mode
95
nonopt=
96
prev=
97
prevopt=
98
run=
99
show="$echo"
100
show_help=
101
execute_dlfiles=
102
lo2o="s/\\.lo\$/.${objext}/"
103
 
104
# Parse our command line options once, thoroughly.
105
while test $# -gt 0
106
do
107
  arg="$1"
108
  shift
109
 
110
  case "$arg" in
111
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
112
  *) optarg= ;;
113
  esac
114
 
115
  # If the previous option needs an argument, assign it.
116
  if test -n "$prev"; then
117
    case "$prev" in
118
    execute_dlfiles)
119
      eval "$prev=\"\$$prev \$arg\""
120
      ;;
121
    *)
122
      eval "$prev=\$arg"
123
      ;;
124
    esac
125
 
126
    prev=
127
    prevopt=
128
    continue
129
  fi
130
 
131
  # Have we seen a non-optional argument yet?
132
  case "$arg" in
133
  --help)
134
    show_help=yes
135
    ;;
136
 
137
  --version)
138
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
139
    exit 0
140
    ;;
141
 
142
  --config)
143
    sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
144
    exit 0
145
    ;;
146
 
147
  --debug)
148
    echo "$progname: enabling shell trace mode"
149
    set -x
150
    ;;
151
 
152
  --dry-run | -n)
153
    run=:
154
    ;;
155
 
156
  --features)
157
    echo "host: $host"
158
    if test "$build_libtool_libs" = yes; then
159
      echo "enable shared libraries"
160
    else
161
      echo "disable shared libraries"
162
    fi
163
    if test "$build_old_libs" = yes; then
164
      echo "enable static libraries"
165
    else
166
      echo "disable static libraries"
167
    fi
168
    exit 0
169
    ;;
170
 
171
  --finish) mode="finish" ;;
172
 
173
  --mode) prevopt="--mode" prev=mode ;;
174
  --mode=*) mode="$optarg" ;;
175
 
176
  --quiet | --silent)
177
    show=:
178
    ;;
179
 
180
  -dlopen)
181
    prevopt="-dlopen"
182
    prev=execute_dlfiles
183
    ;;
184
 
185
  -*)
186
    $echo "$modename: unrecognized option \`$arg'" 1>&2
187
    $echo "$help" 1>&2
188
    exit 1
189
    ;;
190
 
191
  *)
192
    nonopt="$arg"
193
    break
194
    ;;
195
  esac
196
done
197
 
198
if test -n "$prevopt"; then
199
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
200
  $echo "$help" 1>&2
201
  exit 1
202
fi
203
 
204
if test -z "$show_help"; then
205
 
206
  # Infer the operation mode.
207
  if test -z "$mode"; then
208
    case "$nonopt" in
209
    *cc | *++ | gcc* | *-gcc*)
210
      mode=link
211
      for arg
212
      do
213
        case "$arg" in
214
        -c)
215
           mode=compile
216
           break
217
           ;;
218
        esac
219
      done
220
      ;;
221
    *db | *dbx | *strace | *truss)
222
      mode=execute
223
      ;;
224
    *install*|cp|mv)
225
      mode=install
226
      ;;
227
    *rm)
228
      mode=uninstall
229
      ;;
230
    *)
231
      # If we have no mode, but dlfiles were specified, then do execute mode.
232
      test -n "$execute_dlfiles" && mode=execute
233
 
234
      # Just use the default operation mode.
235
      if test -z "$mode"; then
236
        if test -n "$nonopt"; then
237
          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
238
        else
239
          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
240
        fi
241
      fi
242
      ;;
243
    esac
244
  fi
245
 
246
  # Only execute mode is allowed to have -dlopen flags.
247
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
248
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
249
    $echo "$help" 1>&2
250
    exit 1
251
  fi
252
 
253
  # Change the help message to a mode-specific one.
254
  generic_help="$help"
255
  help="Try \`$modename --help --mode=$mode' for more information."
256
 
257
  # These modes are in order of execution frequency so that they run quickly.
258
  case "$mode" in
259
  # libtool compile mode
260
  compile)
261
    modename="$modename: compile"
262
    # Get the compilation command and the source file.
263
    base_compile=
264
    lastarg=
265
    srcfile="$nonopt"
266
    suppress_output=
267
 
268
    user_target=no
269
    for arg
270
    do
271
      # Accept any command-line options.
272
      case "$arg" in
273
      -o)
274
        if test "$user_target" != "no"; then
275
          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
276
          exit 1
277
        fi
278
        user_target=next
279
        ;;
280
 
281
      -static)
282
        build_old_libs=yes
283
        continue
284
        ;;
285
      esac
286
 
287
      case "$user_target" in
288
      next)
289
        # The next one is the -o target name
290
        user_target=yes
291
        continue
292
        ;;
293
      yes)
294
        # We got the output file
295
        user_target=set
296
        libobj="$arg"
297
        continue
298
        ;;
299
      esac
300
 
301
      # Accept the current argument as the source file.
302
      lastarg="$srcfile"
303
      srcfile="$arg"
304
 
305
      # Aesthetically quote the previous argument.
306
 
307
      # Backslashify any backslashes, double quotes, and dollar signs.
308
      # These are the only characters that are still specially
309
      # interpreted inside of double-quoted scrings.
310
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
311
 
312
      # Double-quote args containing other shell metacharacters.
313
      # Many Bourne shells cannot handle close brackets correctly in scan
314
      # sets, so we specify it separately.
315
      case "$lastarg" in
316
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
317
        lastarg="\"$lastarg\""
318
        ;;
319
      esac
320
 
321
      # Add the previous argument to base_compile.
322
      if test -z "$base_compile"; then
323
        base_compile="$lastarg"
324
      else
325
        base_compile="$base_compile $lastarg"
326
      fi
327
    done
328
 
329
    case "$user_target" in
330
    set)
331
      ;;
332
    no)
333
      # Get the name of the library object.
334
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
335
      ;;
336
    *)
337
      $echo "$modename: you must specify a target with \`-o'" 1>&2
338
      exit 1
339
      ;;
340
    esac
341
 
342
    # Recognize several different file suffixes.
343
    # If the user specifies -o file.o, it is replaced with file.lo
344
    xform='[cCFSfmso]'
345
    case "$libobj" in
346
    *.ada) xform=ada ;;
347
    *.adb) xform=adb ;;
348
    *.ads) xform=ads ;;
349
    *.asm) xform=asm ;;
350
    *.c++) xform=c++ ;;
351
    *.cc) xform=cc ;;
352
    *.cpp) xform=cpp ;;
353
    *.cxx) xform=cxx ;;
354
    *.f90) xform=f90 ;;
355
    *.for) xform=for ;;
356
    esac
357
 
358
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
359
 
360
    case "$libobj" in
361
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
362
    *)
363
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
364
      exit 1
365
      ;;
366
    esac
367
 
368
    if test -z "$base_compile"; then
369
      $echo "$modename: you must specify a compilation command" 1>&2
370
      $echo "$help" 1>&2
371
      exit 1
372
    fi
373
 
374
    # Delete any leftover library objects.
375
    if test "$build_old_libs" = yes; then
376
      removelist="$obj $libobj"
377
    else
378
      removelist="$libobj"
379
    fi
380
 
381
    $run $rm $removelist
382
    trap "$run $rm $removelist; exit 1" 1 2 15
383
 
384
    # Calculate the filename of the output object if compiler does
385
    # not support -o with -c
386
    if test "$compiler_c_o" = no; then
387
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
388
      lockfile="$output_obj.lock"
389
      removelist="$removelist $output_obj $lockfile"
390
      trap "$run $rm $removelist; exit 1" 1 2 15
391
    else
392
      need_locks=no
393
      lockfile=
394
    fi
395
 
396
    # Lock this critical section if it is needed
397
    # We use this script file to make the link, it avoids creating a new file
398
    if test "$need_locks" = yes; then
399
      until ln "$0" "$lockfile" 2>/dev/null; do
400
        $show "Waiting for $lockfile to be removed"
401
        sleep 2
402
      done
403
    elif test "$need_locks" = warn; then
404
      if test -f "$lockfile"; then
405
        echo "\
406
*** ERROR, $lockfile exists and contains:
407
`cat $lockfile 2>/dev/null`
408
 
409
This indicates that another process is trying to use the same
410
temporary object file, and libtool could not work around it because
411
your compiler does not support \`-c' and \`-o' together.  If you
412
repeat this compilation, it may succeed, by chance, but you had better
413
avoid parallel builds (make -j) in this platform, or get a better
414
compiler."
415
 
416
        $run $rm $removelist
417
        exit 1
418
      fi
419
      echo $srcfile > "$lockfile"
420
    fi
421
 
422
    if test -n "$fix_srcfile_path"; then
423
      eval srcfile=\"$fix_srcfile_path\"
424
    fi
425
 
426
    # Only build a PIC object if we are building libtool libraries.
427
    if test "$build_libtool_libs" = yes; then
428
      # Without this assignment, base_compile gets emptied.
429
      fbsd_hideous_sh_bug=$base_compile
430
 
431
      # All platforms use -DPIC, to notify preprocessed assembler code.
432
      command="$base_compile $pic_flag -DPIC $srcfile"
433
      if test "$build_old_libs" = yes; then
434
        lo_libobj="$libobj"
435
        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
436
        if test "X$dir" = "X$libobj"; then
437
          dir="$objdir"
438
        else
439
          dir="$dir/$objdir"
440
        fi
441
        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
442
 
443
        if test -d "$dir"; then
444
          $show "$rm $libobj"
445
          $run $rm $libobj
446
        else
447
          $show "$mkdir $dir"
448
          $run $mkdir $dir
449
          status=$?
450
          if test $status -ne 0 && test ! -d $dir; then
451
            exit $status
452
          fi
453
        fi
454
      fi
455
      if test "$compiler_o_lo" = yes; then
456
        output_obj="$libobj"
457
        command="$command -o $output_obj"
458
      elif test "$compiler_c_o" = yes; then
459
        output_obj="$obj"
460
        command="$command -o $output_obj"
461
      fi
462
 
463
      $show "$command"
464
      if $run eval "$command"; then :
465
      else
466
        test -n "$output_obj" && $run $rm $removelist
467
        exit 1
468
      fi
469
 
470
      if test "$need_locks" = warn &&
471
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
472
        echo "\
473
*** ERROR, $lockfile contains:
474
`cat $lockfile 2>/dev/null`
475
 
476
but it should contain:
477
$srcfile
478
 
479
This indicates that another process is trying to use the same
480
temporary object file, and libtool could not work around it because
481
your compiler does not support \`-c' and \`-o' together.  If you
482
repeat this compilation, it may succeed, by chance, but you had better
483
avoid parallel builds (make -j) in this platform, or get a better
484
compiler."
485
 
486
        $run $rm $removelist
487
        exit 1
488
      fi
489
 
490
      # Just move the object if needed, then go on to compile the next one
491
      if test x"$output_obj" != x"$libobj"; then
492
        $show "$mv $output_obj $libobj"
493
        if $run $mv $output_obj $libobj; then :
494
        else
495
          error=$?
496
          $run $rm $removelist
497
          exit $error
498
        fi
499
      fi
500
 
501
      # If we have no pic_flag, then copy the object into place and finish.
502
      if test -z "$pic_flag" && test "$build_old_libs" = yes; then
503
        # Rename the .lo from within objdir to obj
504
        if test -f $obj; then
505
          $show $rm $obj
506
          $run $rm $obj
507
        fi
508
 
509
        $show "$mv $libobj $obj"
510
        if $run $mv $libobj $obj; then :
511
        else
512
          error=$?
513
          $run $rm $removelist
514
          exit $error
515
        fi
516
 
517
        # Now arrange that obj and lo_libobj become the same file
518
        $show "$LN_S $obj $lo_libobj"
519
        if $run $LN_S $obj $lo_libobj; then
520
          exit 0
521
        else
522
          error=$?
523
          $run $rm $removelist
524
          exit $error
525
        fi
526
      fi
527
 
528
      # Allow error messages only from the first compilation.
529
      suppress_output=' >/dev/null 2>&1'
530
    fi
531
 
532
    # Only build a position-dependent object if we build old libraries.
533
    if test "$build_old_libs" = yes; then
534
      command="$base_compile $srcfile"
535
      if test "$compiler_c_o" = yes; then
536
        command="$command -o $obj"
537
        output_obj="$obj"
538
      fi
539
 
540
      # Suppress compiler output if we already did a PIC compilation.
541
      command="$command$suppress_output"
542
      $show "$command"
543
      if $run eval "$command"; then :
544
      else
545
        $run $rm $removelist
546
        exit 1
547
      fi
548
 
549
      if test "$need_locks" = warn &&
550
         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
551
        echo "\
552
*** ERROR, $lockfile contains:
553
`cat $lockfile 2>/dev/null`
554
 
555
but it should contain:
556
$srcfile
557
 
558
This indicates that another process is trying to use the same
559
temporary object file, and libtool could not work around it because
560
your compiler does not support \`-c' and \`-o' together.  If you
561
repeat this compilation, it may succeed, by chance, but you had better
562
avoid parallel builds (make -j) in this platform, or get a better
563
compiler."
564
 
565
        $run $rm $removelist
566
        exit 1
567
      fi
568
 
569
      # Just move the object if needed
570
      if test x"$output_obj" != x"$obj"; then
571
        $show "$mv $output_obj $obj"
572
        if $run $mv $output_obj $obj; then :
573
        else
574
          error=$?
575
          $run $rm $removelist
576
          exit $error
577
        fi
578
      fi
579
 
580
      # Create an invalid libtool object if no PIC, so that we do not
581
      # accidentally link it into a program.
582
      if test "$build_libtool_libs" != yes; then
583
        $show "echo timestamp > $libobj"
584
        $run eval "echo timestamp > \$libobj" || exit $?
585
      else
586
        # Move the .lo from within objdir
587
        $show "$mv $libobj $lo_libobj"
588
        if $run $mv $libobj $lo_libobj; then :
589
        else
590
          error=$?
591
          $run $rm $removelist
592
          exit $error
593
        fi
594
      fi
595
    fi
596
 
597
    # Unlock the critical section if it was locked
598
    if test "$need_locks" != no; then
599
      $rm "$lockfile"
600
    fi
601
 
602
    exit 0
603
    ;;
604
 
605
  # libtool link mode
606
  link)
607
    modename="$modename: link"
608
    C_compiler="$CC" # save it, to compile generated C sources
609
    CC="$nonopt"
610
    case "$host" in
611
    *-*-cygwin* | *-*-mingw* | *-*-os2*)
612
      # It is impossible to link a dll without this setting, and
613
      # we shouldn't force the makefile maintainer to figure out
614
      # which system we are compiling for in order to pass an extra
615
      # flag for every libtool invokation.
616
      # allow_undefined=no
617
 
618
      # FIXME: Unfortunately, there are problems with the above when trying
619
      # to make a dll which has undefined symbols, in which case not
620
      # even a static library is built.  For now, we need to specify
621
      # -no-undefined on the libtool link line when we can be certain
622
      # that all symbols are satisfied, otherwise we get a static library.
623
      allow_undefined=yes
624
 
625
      # This is a source program that is used to create dlls on Windows
626
      # Don't remove nor modify the starting and closing comments
627
# /* ltdll.c starts here */
628
# #define WIN32_LEAN_AND_MEAN
629
# #include <windows.h>
630
# #undef WIN32_LEAN_AND_MEAN
631
# #include <stdio.h>
632
#
633
# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
634
#
635
# #include <cygwin/cygwin_dll.h>
636
# DECLARE_CYGWIN_DLL( DllMain );
637
# HINSTANCE __hDllInstance_base;
638
#
639
# BOOL APIENTRY
640
# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
641
# {
642
#   __hDllInstance_base = hInst;
643
#   return TRUE;
644
# }
645
# /* ltdll.c ends here */
646
      # This is a source program that is used to create import libraries
647
      # on Windows for dlls which lack them. Don't remove nor modify the
648
      # starting and closing comments
649
# /* impgen.c starts here */
650
# /*   Copyright (C) 1999 Free Software Foundation, Inc.
651
#
652
#  This file is part of GNU libtool.
653
#
654
#  This program is free software; you can redistribute it and/or modify
655
#  it under the terms of the GNU General Public License as published by
656
#  the Free Software Foundation; either version 2 of the License, or
657
#  (at your option) any later version.
658
#
659
#  This program is distributed in the hope that it will be useful,
660
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
661
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
662
#  GNU General Public License for more details.
663
#
664
#  You should have received a copy of the GNU General Public License
665
#  along with this program; if not, write to the Free Software
666
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
667
#  */
668
#
669
#  #include <stdio.h>           /* for printf() */
670
#  #include <unistd.h>          /* for open(), lseek(), read() */
671
#  #include <fcntl.h>           /* for O_RDONLY, O_BINARY */
672
#  #include <string.h>          /* for strdup() */
673
#
674
#  static unsigned int
675
#  pe_get16 (fd, offset)
676
#       int fd;
677
#       int offset;
678
#  {
679
#    unsigned char b[2];
680
#    lseek (fd, offset, SEEK_SET);
681
#    read (fd, b, 2);
682
#    return b[0] + (b[1]<<8);
683
#  }
684
#
685
#  static unsigned int
686
#  pe_get32 (fd, offset)
687
#      int fd;
688
#      int offset;
689
#  {
690
#    unsigned char b[4];
691
#    lseek (fd, offset, SEEK_SET);
692
#    read (fd, b, 4);
693
#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
694
#  }
695
#
696
#  static unsigned int
697
#  pe_as32 (ptr)
698
#       void *ptr;
699
#  {
700
#    unsigned char *b = ptr;
701
#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
702
#  }
703
#
704
#  int
705
#  main (argc, argv)
706
#      int argc;
707
#      char *argv[];
708
#  {
709
#      int dll;
710
#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
711
#      unsigned long export_rva, export_size, nsections, secptr, expptr;
712
#      unsigned long name_rvas, nexp;
713
#      unsigned char *expdata, *erva;
714
#      char *filename, *dll_name;
715
#
716
#      filename = argv[1];
717
#
718
#      dll = open(filename, O_RDONLY|O_BINARY);
719
#      if (!dll)
720
#       return 1;
721
#
722
#      dll_name = filename;
723
#
724
#      for (i=0; filename[i]; i++)
725
#       if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
726
#           dll_name = filename + i +1;
727
#
728
#      pe_header_offset = pe_get32 (dll, 0x3c);
729
#      opthdr_ofs = pe_header_offset + 4 + 20;
730
#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
731
#
732
#      if (num_entries < 1) /* no exports */
733
#       return 1;
734
#
735
#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
736
#      export_size = pe_get32 (dll, opthdr_ofs + 100);
737
#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
738
#      secptr = (pe_header_offset + 4 + 20 +
739
#             pe_get16 (dll, pe_header_offset + 4 + 16));
740
#
741
#      expptr = 0;
742
#      for (i = 0; i < nsections; i++)
743
#      {
744
#       char sname[8];
745
#       unsigned long secptr1 = secptr + 40 * i;
746
#       unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
747
#       unsigned long vsize = pe_get32 (dll, secptr1 + 16);
748
#       unsigned long fptr = pe_get32 (dll, secptr1 + 20);
749
#       lseek(dll, secptr1, SEEK_SET);
750
#       read(dll, sname, 8);
751
#       if (vaddr <= export_rva && vaddr+vsize > export_rva)
752
#       {
753
#           expptr = fptr + (export_rva - vaddr);
754
#           if (export_rva + export_size > vaddr + vsize)
755
#               export_size = vsize - (export_rva - vaddr);
756
#           break;
757
#       }
758
#      }
759
#
760
#      expdata = (unsigned char*)malloc(export_size);
761
#      lseek (dll, expptr, SEEK_SET);
762
#      read (dll, expdata, export_size);
763
#      erva = expdata - export_rva;
764
#
765
#      nexp = pe_as32 (expdata+24);
766
#      name_rvas = pe_as32 (expdata+32);
767
#
768
#      printf ("EXPORTS\n");
769
#      for (i = 0; i<nexp; i++)
770
#      {
771
#       unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
772
#       printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
773
#      }
774
#
775
#      return 0;
776
#  }
777
# /* impgen.c ends here */
778
      ;;
779
    *)
780
      allow_undefined=yes
781
      ;;
782
    esac
783
    compile_command="$CC"
784
    finalize_command="$CC"
785
 
786
    compile_rpath=
787
    finalize_rpath=
788
    compile_shlibpath=
789
    finalize_shlibpath=
790
    convenience=
791
    old_convenience=
792
    deplibs=
793
    linkopts=
794
 
795
    if test -n "$shlibpath_var"; then
796
      # get the directories listed in $shlibpath_var
797
      eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
798
    else
799
      lib_search_path=
800
    fi
801
    # now prepend the system-specific ones
802
    eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
803
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
804
 
805
    avoid_version=no
806
    dlfiles=
807
    dlprefiles=
808
    dlself=no
809
    export_dynamic=no
810
    export_symbols=
811
    export_symbols_regex=
812
    generated=
813
    libobjs=
814
    link_against_libtool_libs=
815
    ltlibs=
816
    module=no
817
    objs=
818
    preload=no
819
    prev=
820
    prevarg=
821
    release=
822
    rpath=
823
    xrpath=
824
    perm_rpath=
825
    temp_rpath=
826
    thread_safe=no
827
    vinfo=
828
 
829
    # We need to know -static, to get the right output filenames.
830
    for arg
831
    do
832
      case "$arg" in
833
      -all-static | -static)
834
        if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
835
            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
836
        fi
837
        build_libtool_libs=no
838
        build_old_libs=yes
839
        break
840
        ;;
841
      esac
842
    done
843
 
844
    # See if our shared archives depend on static archives.
845
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
846
 
847
    # Go through the arguments, transforming them on the way.
848
    while test $# -gt 0; do
849
      arg="$1"
850
      shift
851
 
852
      # If the previous option needs an argument, assign it.
853
      if test -n "$prev"; then
854
        case "$prev" in
855
        output)
856
          compile_command="$compile_command @OUTPUT@"
857
          finalize_command="$finalize_command @OUTPUT@"
858
          ;;
859
        esac
860
 
861
        case "$prev" in
862
        dlfiles|dlprefiles)
863
          if test "$preload" = no; then
864
            # Add the symbol object into the linking commands.
865
            compile_command="$compile_command @SYMFILE@"
866
            finalize_command="$finalize_command @SYMFILE@"
867
            preload=yes
868
          fi
869
          case "$arg" in
870
          *.la | *.lo) ;;  # We handle these cases below.
871
          self)
872
            if test "$prev" = dlprefiles; then
873
              dlself=yes
874
            elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
875
              dlself=yes
876
            fi
877
            prev=
878
            continue
879
            ;;
880
          *)
881
            dlprefiles="$dlprefiles $arg"
882
            test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
883
            prev=
884
            ;;
885
          esac
886
          ;;
887
        expsyms)
888
          export_symbols="$arg"
889
          if test ! -f "$arg"; then
890
            $echo "$modename: symbol file \`$arg' does not exist"
891
            exit 1
892
          fi
893
          prev=
894
          continue
895
          ;;
896
        expsyms_regex)
897
          export_symbols_regex="$arg"
898
          prev=
899
          continue
900
          ;;
901
        release)
902
          release="-$arg"
903
          prev=
904
          continue
905
          ;;
906
        rpath)
907
          rpath="$rpath $arg"
908
          prev=
909
          continue
910
          ;;
911
        xrpath)
912
          xrpath="$xrpath $arg"
913
          prev=
914
          continue
915
          ;;
916
        *)
917
          eval "$prev=\"\$arg\""
918
          prev=
919
          continue
920
          ;;
921
        esac
922
      fi
923
 
924
      prevarg="$arg"
925
 
926
      case "$arg" in
927
      -all-static)
928
        if test -n "$link_static_flag"; then
929
          compile_command="$compile_command $link_static_flag"
930
          finalize_command="$finalize_command $link_static_flag"
931
          dlopen_self=$dlopen_self_static
932
        fi
933
        continue
934
        ;;
935
 
936
      -allow-undefined)
937
        # FIXME: remove this flag sometime in the future.
938
        $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
939
        continue
940
        ;;
941
 
942
      -avoid-version)
943
        avoid_version=yes
944
        continue
945
        ;;
946
 
947
      -dlopen)
948
        prev=dlfiles
949
        continue
950
        ;;
951
 
952
      -dlpreopen)
953
        prev=dlprefiles
954
        continue
955
        ;;
956
 
957
      -export-dynamic)
958
        if test "$export_dynamic" != yes; then
959
          export_dynamic=yes
960
          if test -n "$export_dynamic_flag_spec"; then
961
            eval arg=\"$export_dynamic_flag_spec\"
962
          else
963
            arg=
964
          fi
965
        fi
966
        ;;
967
 
968
      -export-symbols | -export-symbols-regex)
969
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
970
          $echo "$modename: cannot have more than one -exported-symbols"
971
          exit 1
972
        fi
973
        if test "$arg" = "-export-symbols"; then
974
          prev=expsyms
975
        else
976
          prev=expsyms_regex
977
        fi
978
        continue
979
        ;;
980
 
981
      -L*)
982
        dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
983
        case "$dir" in
984
        /* | [A-Za-z]:[/\\]*)
985
          # Add the corresponding hardcode_libdir_flag, if it is not identical.
986
          ;;
987
        *)
988
          $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
989
          exit 1
990
          ;;
991
        esac
992
        case " $deplibs " in
993
        *" $arg "*) ;;
994
        *) deplibs="$deplibs $arg";;
995
        esac
996
        case " $lib_search_path " in
997
        *" $dir "*) ;;
998
        *) lib_search_path="$lib_search_path $dir";;
999
        esac
1000
        case "$host" in
1001
        *-*-cygwin* | *-*-mingw* | *-*-os2*)
1002
          dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1003
          case ":$dllsearchpath:" in
1004
          ::) dllsearchpath="$dllsearchdir";;
1005
          *":$dllsearchdir:"*) ;;
1006
          *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1007
          esac
1008
          ;;
1009
        esac
1010
        ;;
1011
 
1012
      -l*)
1013
        deplibs="$deplibs $arg"
1014
        ;;
1015
 
1016
      -module)
1017
        if test "$module" != yes; then
1018
          module=yes
1019
          if test -n "$export_dynamic_flag_spec"; then
1020
            eval arg=\"$export_dynamic_flag_spec\"
1021
          else
1022
            arg=
1023
          fi
1024
        fi
1025
        ;;
1026
 
1027
      -no-undefined)
1028
        allow_undefined=no
1029
        continue
1030
        ;;
1031
 
1032
      -o) prev=output ;;
1033
 
1034
      -release)
1035
        prev=release
1036
        continue
1037
        ;;
1038
 
1039
      -rpath)
1040
        prev=rpath
1041
        continue
1042
        ;;
1043
 
1044
      -R)
1045
        prev=xrpath
1046
        continue
1047
        ;;
1048
 
1049
      -R*)
1050
        xrpath="$xrpath "`$echo "X$arg" | $Xsed -e 's/^-R//'`
1051
        continue
1052
        ;;
1053
 
1054
      -static)
1055
        # If we have no pic_flag, then this is the same as -all-static.
1056
        if test -z "$pic_flag" && test -n "$link_static_flag"; then
1057
          compile_command="$compile_command $link_static_flag"
1058
          finalize_command="$finalize_command $link_static_flag"
1059
          dlopen_self=$dlopen_self_static
1060
        fi
1061
        continue
1062
        ;;
1063
 
1064
      -thread-safe)
1065
        thread_safe=yes
1066
        continue
1067
        ;;
1068
 
1069
      -version-info)
1070
        prev=vinfo
1071
        continue
1072
        ;;
1073
 
1074
      # Some other compiler flag.
1075
      -* | +*)
1076
        # Unknown arguments in both finalize_command and compile_command need
1077
        # to be aesthetically quoted because they are evaled later.
1078
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1079
        case "$arg" in
1080
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
1081
          arg="\"$arg\""
1082
          ;;
1083
        esac
1084
        ;;
1085
 
1086
      *.o | *.obj | *.a | *.lib)
1087
        # A standard object.
1088
        objs="$objs $arg"
1089
        ;;
1090
 
1091
      *.lo)
1092
        # A library object.
1093
        if test "$prev" = dlfiles; then
1094
          dlfiles="$dlfiles $arg"
1095
          if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1096
            prev=
1097
            continue
1098
          else
1099
            # If libtool objects are unsupported, then we need to preload.
1100
            prev=dlprefiles
1101
          fi
1102
        fi
1103
 
1104
        if test "$prev" = dlprefiles; then
1105
          # Preload the old-style object.
1106
          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1107
          prev=
1108
        fi
1109
        libobjs="$libobjs $arg"
1110
        ;;
1111
 
1112
      *.la)
1113
        # A libtool-controlled library.
1114
 
1115
        dlname=
1116
        libdir=
1117
        library_names=
1118
        old_library=
1119
 
1120
        # Check to see that this really is a libtool archive.
1121
        if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1122
        else
1123
          $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1124
          exit 1
1125
        fi
1126
 
1127
        # If the library was installed with an old release of libtool,
1128
        # it will not redefine variable installed.
1129
        installed=yes
1130
 
1131
        # If there is no directory component, then add one.
1132
        case "$arg" in
1133
        */* | *\\*) . $arg ;;
1134
        *) . ./$arg ;;
1135
        esac
1136
 
1137
        # Get the name of the library we link against.
1138
        linklib=
1139
        for l in $old_library $library_names; do
1140
          linklib="$l"
1141
        done
1142
 
1143
        if test -z "$linklib"; then
1144
          $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1145
          exit 1
1146
        fi
1147
 
1148
        # Find the relevant object directory and library name.
1149
        name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1150
 
1151
        if test "X$installed" = Xyes; then
1152
          dir="$libdir"
1153
        else
1154
          dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1155
          if test "X$dir" = "X$arg"; then
1156
            dir="$objdir"
1157
          else
1158
            dir="$dir/$objdir"
1159
          fi
1160
        fi
1161
 
1162
        if test -n "$dependency_libs"; then
1163
          # Extract -R from dependency_libs
1164
          temp_deplibs=
1165
          for deplib in $dependency_libs; do
1166
            case "$deplib" in
1167
            -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1168
                 case " $rpath $xrpath " in
1169
                 *" $temp_xrpath "*) ;;
1170
                 *) xrpath="$xrpath $temp_xrpath";;
1171
                 esac;;
1172
            -L*) case "$compile_command $temp_deplibs " in
1173
                 *" $deplib "*) ;;
1174
                 *) temp_deplibs="$temp_deplibs $deplib";;
1175
                 esac;;
1176
            *) temp_deplibs="$temp_deplibs $deplib";;
1177
            esac
1178
          done
1179
          dependency_libs="$temp_deplibs"
1180
        fi
1181
 
1182
        if test -z "$libdir"; then
1183
          # It is a libtool convenience library, so add in its objects.
1184
          convenience="$convenience $dir/$old_library"
1185
          old_convenience="$old_convenience $dir/$old_library"
1186
          deplibs="$deplibs$dependency_libs"
1187
          compile_command="$compile_command $dir/$old_library$dependency_libs"
1188
          finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1189
          continue
1190
        fi
1191
 
1192
        # This library was specified with -dlopen.
1193
        if test "$prev" = dlfiles; then
1194
          dlfiles="$dlfiles $arg"
1195
          if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1196
            # If there is no dlname, no dlopen support or we're linking statically,
1197
            # we need to preload.
1198
            prev=dlprefiles
1199
          else
1200
            # We should not create a dependency on this library, but we
1201
            # may need any libraries it requires.
1202
            compile_command="$compile_command$dependency_libs"
1203
            finalize_command="$finalize_command$dependency_libs"
1204
            prev=
1205
            continue
1206
          fi
1207
        fi
1208
 
1209
        # The library was specified with -dlpreopen.
1210
        if test "$prev" = dlprefiles; then
1211
          # Prefer using a static library (so that no silly _DYNAMIC symbols
1212
          # are required to link).
1213
          if test -n "$old_library"; then
1214
            dlprefiles="$dlprefiles $dir/$old_library"
1215
          else
1216
            dlprefiles="$dlprefiles $dir/$linklib"
1217
          fi
1218
          prev=
1219
        fi
1220
 
1221
        if test "$build_libtool_libs" = yes && test -n "$library_names"; then
1222
          link_against_libtool_libs="$link_against_libtool_libs $arg"
1223
          if test -n "$shlibpath_var"; then
1224
            # Make sure the rpath contains only unique directories.
1225
            case "$temp_rpath " in
1226
            *" $dir "*) ;;
1227
            *) temp_rpath="$temp_rpath $dir" ;;
1228
            esac
1229
          fi
1230
 
1231
          # We need an absolute path.
1232
          case "$dir" in
1233
          /* | [A-Za-z]:[/\\]*) absdir="$dir" ;;
1234
          *)
1235
            absdir=`cd "$dir" && pwd`
1236
            if test -z "$absdir"; then
1237
              $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2
1238
              exit 1
1239
            fi
1240
            ;;
1241
          esac
1242
 
1243
          # This is the magic to use -rpath.
1244
          # Skip directories that are in the system default run-time
1245
          # search path, unless they have been requested with -R.
1246
          case " $sys_lib_dlsearch_path " in
1247
          *" $absdir "*) ;;
1248
          *)
1249
            case "$compile_rpath " in
1250
            *" $absdir "*) ;;
1251
            *) compile_rpath="$compile_rpath $absdir"
1252
            esac
1253
            ;;
1254
          esac
1255
 
1256
          case " $sys_lib_dlsearch_path " in
1257
          *" $libdir "*) ;;
1258
          *)
1259
            case "$finalize_rpath " in
1260
            *" $libdir "*) ;;
1261
            *) finalize_rpath="$finalize_rpath $libdir"
1262
            esac
1263
            ;;
1264
          esac
1265
 
1266
          lib_linked=yes
1267
          case "$hardcode_action" in
1268
          immediate | unsupported)
1269
            if test "$hardcode_direct" = no; then
1270
              compile_command="$compile_command $dir/$linklib"
1271
              deplibs="$deplibs $dir/$linklib"
1272
              case "$host" in
1273
              *-*-cygwin* | *-*-mingw* | *-*-os2*)
1274
                dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1275
                if test -n "$dllsearchpath"; then
1276
                  dllsearchpath="$dllsearchpath:$dllsearchdir"
1277
                else
1278
                  dllsearchpath="$dllsearchdir"
1279
                fi
1280
                ;;
1281
              esac
1282
            elif test "$hardcode_minus_L" = no; then
1283
              case "$host" in
1284
              *-*-sunos*)
1285
                compile_shlibpath="$compile_shlibpath$dir:"
1286
                ;;
1287
              esac
1288
              case "$compile_command " in
1289
              *" -L$dir "*) ;;
1290
              *) compile_command="$compile_command -L$dir";;
1291
              esac
1292
              compile_command="$compile_command -l$name"
1293
              deplibs="$deplibs -L$dir -l$name"
1294
            elif test "$hardcode_shlibpath_var" = no; then
1295
              case ":$compile_shlibpath:" in
1296
              *":$dir:"*) ;;
1297
              *) compile_shlibpath="$compile_shlibpath$dir:";;
1298
              esac
1299
              compile_command="$compile_command -l$name"
1300
              deplibs="$deplibs -l$name"
1301
            else
1302
              lib_linked=no
1303
            fi
1304
            ;;
1305
 
1306
          relink)
1307
            if test "$hardcode_direct" = yes; then
1308
              compile_command="$compile_command $absdir/$linklib"
1309
              deplibs="$deplibs $absdir/$linklib"
1310
            elif test "$hardcode_minus_L" = yes; then
1311
              case "$compile_command " in
1312
              *" -L$absdir "*) ;;
1313
              *) compile_command="$compile_command -L$absdir";;
1314
              esac
1315
              compile_command="$compile_command -l$name"
1316
              deplibs="$deplibs -L$absdir -l$name"
1317
            elif test "$hardcode_shlibpath_var" = yes; then
1318
              case ":$compile_shlibpath:" in
1319
              *":$absdir:"*) ;;
1320
              *) compile_shlibpath="$compile_shlibpath$absdir:";;
1321
              esac
1322
              compile_command="$compile_command -l$name"
1323
              deplibs="$deplibs -l$name"
1324
            else
1325
              lib_linked=no
1326
            fi
1327
            ;;
1328
 
1329
          *)
1330
            lib_linked=no
1331
            ;;
1332
          esac
1333
 
1334
          if test "$lib_linked" != yes; then
1335
            $echo "$modename: configuration error: unsupported hardcode properties"
1336
            exit 1
1337
          fi
1338
 
1339
          # Finalize command for both is simple: just hardcode it.
1340
          if test "$hardcode_direct" = yes; then
1341
            finalize_command="$finalize_command $libdir/$linklib"
1342
          elif test "$hardcode_minus_L" = yes; then
1343
            case "$finalize_command " in
1344
            *" -L$libdir "*) ;;
1345
            *) finalize_command="$finalize_command -L$libdir";;
1346
            esac
1347
            finalize_command="$finalize_command -l$name"
1348
          elif test "$hardcode_shlibpath_var" = yes; then
1349
            case ":$finalize_shlibpath:" in
1350
            *":$libdir:"*) ;;
1351
            *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1352
            esac
1353
            finalize_command="$finalize_command -l$name"
1354
          else
1355
            # We cannot seem to hardcode it, guess we'll fake it.
1356
            case "$finalize_command " in
1357
            *" -L$dir "*) ;;
1358
            *) finalize_command="$finalize_command -L$libdir";;
1359
            esac
1360
            finalize_command="$finalize_command -l$name"
1361
          fi
1362
        else
1363
          # Transform directly to old archives if we don't build new libraries.
1364
          if test -n "$pic_flag" && test -z "$old_library"; then
1365
            $echo "$modename: cannot find static library for \`$arg'" 1>&2
1366
            exit 1
1367
          fi
1368
 
1369
          # Here we assume that one of hardcode_direct or hardcode_minus_L
1370
          # is not unsupported.  This is valid on all known static and
1371
          # shared platforms.
1372
          if test "$hardcode_direct" != unsupported; then
1373
            test -n "$old_library" && linklib="$old_library"
1374
            compile_command="$compile_command $dir/$linklib"
1375
            finalize_command="$finalize_command $dir/$linklib"
1376
          else
1377
            case "$compile_command " in
1378
            *" -L$dir "*) ;;
1379
            *) compile_command="$compile_command -L$dir";;
1380
            esac
1381
            compile_command="$compile_command -l$name"
1382
            case "$finalize_command " in
1383
            *" -L$dir "*) ;;
1384
            *) finalize_command="$finalize_command -L$dir";;
1385
            esac
1386
            finalize_command="$finalize_command -l$name"
1387
          fi
1388
        fi
1389
 
1390
        # Add in any libraries that this one depends upon.
1391
        compile_command="$compile_command$dependency_libs"
1392
        finalize_command="$finalize_command$dependency_libs"
1393
        continue
1394
        ;;
1395
 
1396
      # Some other compiler argument.
1397
      *)
1398
        # Unknown arguments in both finalize_command and compile_command need
1399
        # to be aesthetically quoted because they are evaled later.
1400
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1401
        case "$arg" in
1402
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
1403
          arg="\"$arg\""
1404
          ;;
1405
        esac
1406
        ;;
1407
      esac
1408
 
1409
      # Now actually substitute the argument into the commands.
1410
      if test -n "$arg"; then
1411
        compile_command="$compile_command $arg"
1412
        finalize_command="$finalize_command $arg"
1413
      fi
1414
    done
1415
 
1416
    if test -n "$prev"; then
1417
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1418
      $echo "$help" 1>&2
1419
      exit 1
1420
    fi
1421
 
1422
    oldlibs=
1423
    # calculate the name of the file, without its directory
1424
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1425
    libobjs_save="$libobjs"
1426
 
1427
    case "$output" in
1428
    "")
1429
      $echo "$modename: you must specify an output file" 1>&2
1430
      $echo "$help" 1>&2
1431
      exit 1
1432
      ;;
1433
 
1434
    *.a | *.lib)
1435
      if test -n "$link_against_libtool_libs"; then
1436
        $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1437
        exit 1
1438
      fi
1439
 
1440
      if test -n "$deplibs"; then
1441
        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1442
      fi
1443
 
1444
      if test -n "$dlfiles$dlprefiles"; then
1445
        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1446
      fi
1447
 
1448
      if test -n "$rpath"; then
1449
        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1450
      fi
1451
 
1452
      if test -n "$xrpath"; then
1453
        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1454
      fi
1455
 
1456
      if test -n "$vinfo"; then
1457
        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1458
      fi
1459
 
1460
      if test -n "$release"; then
1461
        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1462
      fi
1463
 
1464
      if test -n "$export_symbols"; then
1465
        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1466
      fi
1467
 
1468
      # Now set the variables for building old libraries.
1469
      build_libtool_libs=no
1470
      oldlibs="$output"
1471
      ;;
1472
 
1473
    *.la)
1474
      # Make sure we only generate libraries of the form `libNAME.la'.
1475
      case "$outputname" in
1476
      lib*)
1477
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1478
        eval libname=\"$libname_spec\"
1479
        ;;
1480
      *)
1481
        if test "$module" = no; then
1482
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1483
          $echo "$help" 1>&2
1484
          exit 1
1485
        fi
1486
        if test "$need_lib_prefix" != no; then
1487
          # Add the "lib" prefix for modules if required
1488
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1489
          eval libname=\"$libname_spec\"
1490
        else
1491
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1492
        fi
1493
        ;;
1494
      esac
1495
 
1496
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1497
      if test "X$output_objdir" = "X$output"; then
1498
        output_objdir="$objdir"
1499
      else
1500
        output_objdir="$output_objdir/$objdir"
1501
      fi
1502
 
1503
      # All the library-specific variables (install_libdir is set above).
1504
      library_names=
1505
      old_library=
1506
      dlname=
1507
 
1508
      if test -n "$objs"; then
1509
        $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1510
        exit 1
1511
      fi
1512
 
1513
      # How the heck are we supposed to write a wrapper for a shared library?
1514
      if test -n "$link_against_libtool_libs"; then
1515
         $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1516
         exit 1
1517
      fi
1518
 
1519
      if test -n "$dlfiles$dlprefiles"; then
1520
        $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1521
      fi
1522
 
1523
      set dummy $rpath
1524
      if test $# -gt 2; then
1525
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1526
      fi
1527
      install_libdir="$2"
1528
 
1529
      oldlibs=
1530
      if test -z "$rpath"; then
1531
        if test "$build_libtool_libs" = yes; then
1532
          # Building a libtool convenience library.
1533
          libext=al
1534
          oldlibs="$output_objdir/$libname.$libext $oldlibs"
1535
          build_libtool_libs=convenience
1536
          build_old_libs=yes
1537
        fi
1538
        dependency_libs="$deplibs"
1539
 
1540
        if test -n "$vinfo"; then
1541
          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1542
        fi
1543
 
1544
        if test -n "$release"; then
1545
          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1546
        fi
1547
      else
1548
 
1549
        # Parse the version information argument.
1550
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
1551
        set dummy $vinfo 0 0 0
1552
        IFS="$save_ifs"
1553
 
1554
        if test -n "$8"; then
1555
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
1556
          $echo "$help" 1>&2
1557
          exit 1
1558
        fi
1559
 
1560
        current="$2"
1561
        revision="$3"
1562
        age="$4"
1563
 
1564
        # Check that each of the things are valid numbers.
1565
        case "$current" in
1566
 
1567
        *)
1568
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1569
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1570
          exit 1
1571
          ;;
1572
        esac
1573
 
1574
        case "$revision" in
1575
 
1576
        *)
1577
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1578
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1579
          exit 1
1580
          ;;
1581
        esac
1582
 
1583
        case "$age" in
1584
 
1585
        *)
1586
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1587
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1588
          exit 1
1589
          ;;
1590
        esac
1591
 
1592
        if test $age -gt $current; then
1593
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1594
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1595
          exit 1
1596
        fi
1597
 
1598
        # Calculate the version variables.
1599
        major=
1600
        versuffix=
1601
        verstring=
1602
        case "$version_type" in
1603
        none) ;;
1604
 
1605
        irix)
1606
          major=`expr $current - $age + 1`
1607
          versuffix="$major.$revision"
1608
          verstring="sgi$major.$revision"
1609
 
1610
          # Add in all the interfaces that we are compatible with.
1611
          loop=$revision
1612
          while test $loop != 0; do
1613
            iface=`expr $revision - $loop`
1614
            loop=`expr $loop - 1`
1615
            verstring="sgi$major.$iface:$verstring"
1616
          done
1617
          ;;
1618
 
1619
        linux)
1620
          major=.`expr $current - $age`
1621
          versuffix="$major.$age.$revision"
1622
          ;;
1623
 
1624
        osf)
1625
          major=`expr $current - $age`
1626
          versuffix=".$current.$age.$revision"
1627
          verstring="$current.$age.$revision"
1628
 
1629
          # Add in all the interfaces that we are compatible with.
1630
          loop=$age
1631
          while test $loop != 0; do
1632
            iface=`expr $current - $loop`
1633
            loop=`expr $loop - 1`
1634
            verstring="$verstring:${iface}.0"
1635
          done
1636
 
1637
          # Make executables depend on our current version.
1638
          verstring="$verstring:${current}.0"
1639
          ;;
1640
 
1641
        sunos)
1642
          major=".$current"
1643
          versuffix=".$current.$revision"
1644
          ;;
1645
 
1646
        freebsd-aout)
1647
          major=".$current"
1648
          versuffix=".$current.$revision";
1649
          ;;
1650
 
1651
        freebsd-elf)
1652
          major=".$current"
1653
          versuffix=".$current";
1654
          ;;
1655
 
1656
        windows)
1657
          # Like Linux, but with '-' rather than '.', since we only
1658
          # want one extension on Windows 95.
1659
          major=`expr $current - $age`
1660
          versuffix="-$major-$age-$revision"
1661
          ;;
1662
 
1663
        *)
1664
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
1665
          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1666
          exit 1
1667
          ;;
1668
        esac
1669
 
1670
        # Clear the version info if we defaulted, and they specified a release.
1671
        if test -z "$vinfo" && test -n "$release"; then
1672
          major=
1673
          verstring="0.0"
1674
          if test "$need_version" = no; then
1675
            versuffix=
1676
          else
1677
            versuffix=".0.0"
1678
          fi
1679
        fi
1680
 
1681
        # Remove version info from name if versioning should be avoided
1682
        if test "$avoid_version" = yes && test "$need_version" = no; then
1683
          major=
1684
          versuffix=
1685
          verstring=""
1686
        fi
1687
 
1688
        # Check to see if the archive will have undefined symbols.
1689
        if test "$allow_undefined" = yes; then
1690
          if test "$allow_undefined_flag" = unsupported; then
1691
            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1692
            build_libtool_libs=no
1693
            build_old_libs=yes
1694
          fi
1695
        else
1696
          # Don't allow undefined symbols.
1697
          allow_undefined_flag="$no_undefined_flag"
1698
        fi
1699
 
1700
        dependency_libs="$deplibs"
1701
        case "$host" in
1702
        *-*-cygwin* | *-*-mingw* | *-*-os2*)
1703
          # these systems don't actually have a c library (as such)!
1704
          ;;
1705
        *)
1706
          # Add libc to deplibs on all other systems.
1707
          deplibs="$deplibs -lc"
1708
          ;;
1709
        esac
1710
      fi
1711
 
1712
      # Create the output directory, or remove our outputs if we need to.
1713
      if test -d $output_objdir; then
1714
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1715
        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1716
      else
1717
        $show "$mkdir $output_objdir"
1718
        $run $mkdir $output_objdir
1719
        status=$?
1720
        if test $status -ne 0 && test ! -d $output_objdir; then
1721
          exit $status
1722
        fi
1723
      fi
1724
 
1725
      # Now set the variables for building old libraries.
1726
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1727
        oldlibs="$oldlibs $output_objdir/$libname.$libext"
1728
 
1729
        # Transform .lo files to .o files.
1730
        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1731
      fi
1732
 
1733
      if test "$build_libtool_libs" = yes; then
1734
        # Transform deplibs into only deplibs that can be linked in shared.
1735
        name_save=$name
1736
        libname_save=$libname
1737
        release_save=$release
1738
        versuffix_save=$versuffix
1739
        major_save=$major
1740
        # I'm not sure if I'm treating the release correctly.  I think
1741
        # release should show up in the -l (ie -lgmp5) so we don't want to
1742
        # add it in twice.  Is that correct?
1743
        release=""
1744
        versuffix=""
1745
        major=""
1746
        newdeplibs=
1747
        droppeddeps=no
1748
        case "$deplibs_check_method" in
1749
        pass_all)
1750
          newdeplibs=$deplibs
1751
                    ;; # Don't check for shared/static.  Everything works.
1752
                       # This might be a little naive.  We might want to check
1753
                       # whether the library exists or not.  But this is on
1754
                       # osf3 & osf4 and I'm not really sure... Just
1755
                       # implementing what was already the behaviour.
1756
        test_compile)
1757
          # This code stresses the "libraries are programs" paradigm to its
1758
          # limits. Maybe even breaks it.  We compile a program, linking it
1759
          # against the deplibs as a proxy for the library.  Then we can check
1760
          # whether they linked in statically or dynamically with ldd.
1761
          $rm conftest.c
1762
          cat > conftest.c <<EOF
1763
          int main() { return 0; }
1764
EOF
1765
          $rm conftest
1766
          $C_compiler -o conftest conftest.c $deplibs
1767
          if test $? -eq 0 ; then
1768
            ldd_output=`ldd conftest`
1769
            for i in $deplibs; do
1770
              name="`expr $i : '-l\(.*\)'`"
1771
              # If $name is empty we are operating on a -L argument.
1772
              if test "$name" != "" ; then
1773
                libname=`eval \\$echo \"$libname_spec\"`
1774
                deplib_matches=`eval \\$echo \"$library_names_spec\"`
1775
                set dummy $deplib_matches
1776
                deplib_match=$2
1777
                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1778
                  newdeplibs="$newdeplibs $i"
1779
                else
1780
                  droppeddeps=yes
1781
                  echo
1782
                  echo "*** Warning: This library needs some functionality provided by $i."
1783
                  echo "*** I have the capability to make that library automatically link in when"
1784
                  echo "*** you link to this library.  But I can only do this if you have a"
1785
                  echo "*** shared version of the library, which you do not appear to have."
1786
                fi
1787
              else
1788
                newdeplibs="$newdeplibs $i"
1789
              fi
1790
            done
1791
          else
1792
            # Error occured in the first compile.  Let's try to salvage the situation:
1793
            # Compile a seperate program for each library.
1794
            for i in $deplibs; do
1795
              name="`expr $i : '-l\(.*\)'`"
1796
             # If $name is empty we are operating on a -L argument.
1797
              if test "$name" != "" ; then
1798
                $rm conftest
1799
                $C_compiler -o conftest conftest.c $i
1800
                # Did it work?
1801
                if test $? -eq 0 ; then
1802
                  ldd_output=`ldd conftest`
1803
                    libname=`eval \\$echo \"$libname_spec\"`
1804
                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
1805
                    set dummy $deplib_matches
1806
                    deplib_match=$2
1807
                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1808
                      newdeplibs="$newdeplibs $i"
1809
                    else
1810
                      droppeddeps=yes
1811
                      echo
1812
                      echo "*** Warning: This library needs some functionality provided by $i."
1813
                      echo "*** I have the capability to make that library automatically link in when"
1814
                      echo "*** you link to this library.  But I can only do this if you have a"
1815
                      echo "*** shared version of the library, which you do not appear to have."
1816
                    fi
1817
                else
1818
                  droppeddeps=yes
1819
                  echo
1820
                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
1821
                  echo "***  make it link in!  You will probably need to install it or some"
1822
                  echo "*** library that it depends on before this library will be fully"
1823
                  echo "*** functional.  Installing it before continuing would be even better."
1824
                fi
1825
              else
1826
                newdeplibs="$newdeplibs $i"
1827
              fi
1828
            done
1829
          fi
1830
          deplibs=$newdeplibs
1831
          ;;
1832
        file_magic*)
1833
          set dummy $deplibs_check_method
1834
          file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
1835
          for a_deplib in $deplibs; do
1836
            name="`expr $a_deplib : '-l\(.*\)'`"
1837
            # If $name is empty we are operating on a -L argument.
1838
            if test "$name" != "" ; then
1839
              libname=`eval \\$echo \"$libname_spec\"`
1840
              for i in $lib_search_path; do
1841
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1842
                    for potent_lib in $potential_libs; do
1843
                      # Follow soft links.
1844
                      if ls -lLd "$potlib" 2>/dev/null \
1845
                         | grep " -> " >/dev/null; then
1846
                        continue
1847
                      fi
1848
                      # The statement above tries to avoid entering an
1849
                      # endless loop below, in case of cyclic links.
1850
                      # We might still enter an endless loop, since a link
1851
                      # loop can be closed while we follow links,
1852
                      # but so what?
1853
                      potlib="$potent_lib"
1854
                      while test -h "$potlib" 2>/dev/null; do
1855
                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1856
                        case "$potliblink" in
1857
                        /*) potlib="$potliblink";;
1858
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1859
                        esac
1860
                      done
1861
                      if eval $file_magic_cmd \"\$potlib\" \
1862
                         | sed 10q \
1863
                         | egrep "$file_magic_regex" > /dev/null; then
1864
                        newdeplibs="$newdeplibs $a_deplib"
1865
                        a_deplib=""
1866
                        break 2
1867
                      fi
1868
                    done
1869
              done
1870
              if test -n "$a_deplib" ; then
1871
                droppeddeps=yes
1872
                echo
1873
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
1874
                echo "*** I have the capability to make that library automatically link in when"
1875
                echo "*** you link to this library.  But I can only do this if you have a"
1876
                echo "*** shared version of the library, which you do not appear to have."
1877
              fi
1878
            else
1879
              # Add a -L argument.
1880
              newdeplibs="$newdeplibs $a_deplib"
1881
            fi
1882
          done # Gone through all deplibs.
1883
          ;;
1884
        none | unknown | *) newdeplibs=""
1885
          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
1886
               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
1887
             grep . >/dev/null; then
1888
            echo
1889
            if test "X$deplibs_check_method" = "Xnone"; then
1890
              echo "*** Warning: inter-library dependencies are not supported in this platform."
1891
            else
1892
              echo "*** Warning: inter-library dependencies are not known to be supported."
1893
            fi
1894
            echo "*** All declared inter-library dependencies are being dropped."
1895
            droppeddeps=yes
1896
          fi
1897
          ;;
1898
        esac
1899
        versuffix=$versuffix_save
1900
        major=$major_save
1901
        release=$release_save
1902
        libname=$libname_save
1903
        name=$name_save
1904
 
1905
        if test "$droppeddeps" = yes; then
1906
          if test "$module" = yes; then
1907
            echo
1908
            echo "*** Warning: libtool could not satisfy all declared inter-library"
1909
            echo "*** dependencies of module $libname.  Therefore, libtool will create"
1910
            echo "*** a static module, that should work as long as the dlopening"
1911
            echo "*** application is linked with the -dlopen flag."
1912
            if test -z "$global_symbol_pipe"; then
1913
              echo
1914
              echo "*** However, this would only work if libtool was able to extract symbol"
1915
              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1916
              echo "*** not find such a program.  So, this module is probably useless."
1917
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
1918
            fi
1919
            if test "$build_old_libs" = no; then
1920
              oldlibs="$output_objdir/$libname.$libext"
1921
              build_libtool_libs=module
1922
              build_old_libs=yes
1923
            else
1924
              build_libtool_libs=no
1925
            fi
1926
            dlname=
1927
            library_names=
1928
          else
1929
            echo "*** The inter-library dependencies that have been dropped here will be"
1930
            echo "*** automatically added whenever a program is linked with this library"
1931
            echo "*** or is declared to -dlopen it."
1932
          fi
1933
        fi
1934
      fi
1935
 
1936
      # test again, we may have decided not to build it any more
1937
      if test "$build_libtool_libs" = yes; then
1938
        deplibs=$newdeplibs
1939
        # Done checking deplibs!
1940
 
1941
        # Get the real and link names of the library.
1942
        eval library_names=\"$library_names_spec\"
1943
        set dummy $library_names
1944
        realname="$2"
1945
        shift; shift
1946
 
1947
        if test -n "$soname_spec"; then
1948
          eval soname=\"$soname_spec\"
1949
        else
1950
          soname="$realname"
1951
        fi
1952
 
1953
        lib="$output_objdir/$realname"
1954
        for link
1955
        do
1956
          linknames="$linknames $link"
1957
        done
1958
 
1959
        # Ensure that we have .o objects for linkers which dislike .lo
1960
        # (e.g. aix) incase we are running --disable-static
1961
        for obj in $libobjs; do
1962
          oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
1963
          test -f $oldobj || ${LN_S} $obj $oldobj
1964
        done
1965
 
1966
        # Use standard objects if they are pic
1967
        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1968
 
1969
        if test -n "$whole_archive_flag_spec"; then
1970
          if test -n "$convenience"; then
1971
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1972
          fi
1973
        else
1974
          for xlib in $convenience; do
1975
            # Extract the objects.
1976
            xdir="$xlib"x
1977
            generated="$generated $xdir"
1978
            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
1979
 
1980
            $show "${rm}r $xdir"
1981
            $run ${rm}r "$xdir"
1982
            $show "mkdir $xdir"
1983
            $run mkdir "$xdir"
1984
            status=$?
1985
            if test $status -ne 0 && test ! -d "$xdir"; then
1986
              exit $status
1987
            fi
1988
            $show "(cd $xdir && $AR x ../$xlib)"
1989
            $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1990
 
1991
            libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
1992
          done
1993
        fi
1994
 
1995
        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
1996
          eval flag=\"$thread_safe_flag_spec\"
1997
 
1998
          linkopts="$linkopts $flag"
1999
        fi
2000
 
2001
        # Prepare the list of exported symbols
2002
        if test -z "$export_symbols"; then
2003
          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2004
            $show "generating symbol list for \`$libname.la'"
2005
            export_symbols="$objdir/$libname.exp"
2006
            $run $rm $export_symbols
2007
            eval cmds=\"$export_symbols_cmds\"
2008
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
2009
            for cmd in $cmds; do
2010
              IFS="$save_ifs"
2011
              $show "$cmd"
2012
              $run eval "$cmd" || exit $?
2013
            done
2014
            IFS="$save_ifs"
2015
            if test -n "$export_symbols_regex"; then
2016
              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2017
              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2018
              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2019
              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2020
            fi
2021
          fi
2022
        fi
2023
 
2024
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
2025
          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2026
        fi
2027
 
2028
        # Do each of the archive commands.
2029
        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2030
          eval cmds=\"$archive_expsym_cmds\"
2031
        else
2032
          eval cmds=\"$archive_cmds\"
2033
        fi
2034
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
2035
        for cmd in $cmds; do
2036
          IFS="$save_ifs"
2037
          $show "$cmd"
2038
          $run eval "$cmd" || exit $?
2039
        done
2040
        IFS="$save_ifs"
2041
 
2042
        # Create links to the real library.
2043
        for linkname in $linknames; do
2044
          if test "$realname" != "$linkname"; then
2045
            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2046
            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2047
          fi
2048
        done
2049
 
2050
        # If -module or -export-dynamic was specified, set the dlname.
2051
        if test "$module" = yes || test "$export_dynamic" = yes; then
2052
          # On all known operating systems, these are identical.
2053
          dlname="$soname"
2054
        fi
2055
      fi
2056
      ;;
2057
 
2058
    *.lo | *.o | *.obj)
2059
      if test -n "$link_against_libtool_libs"; then
2060
        $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2061
        exit 1
2062
      fi
2063
 
2064
      if test -n "$deplibs"; then
2065
        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2066
      fi
2067
 
2068
      if test -n "$dlfiles$dlprefiles"; then
2069
        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2070
      fi
2071
 
2072
      if test -n "$rpath"; then
2073
        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2074
      fi
2075
 
2076
      if test -n "$xrpath"; then
2077
        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2078
      fi
2079
 
2080
      if test -n "$vinfo"; then
2081
        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2082
      fi
2083
 
2084
      if test -n "$release"; then
2085
        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2086
      fi
2087
 
2088
      case "$output" in
2089
      *.lo)
2090
        if test -n "$objs"; then
2091
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2092
          exit 1
2093
        fi
2094
        libobj="$output"
2095
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2096
        ;;
2097
      *)
2098
        libobj=
2099
        obj="$output"
2100
        ;;
2101
      esac
2102
 
2103
      # Delete the old objects.
2104
      $run $rm $obj $libobj
2105
 
2106
      # Create the old-style object.
2107
      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
2108
 
2109
      output="$obj"
2110
      eval cmds=\"$reload_cmds\"
2111
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
2112
      for cmd in $cmds; do
2113
        IFS="$save_ifs"
2114
        $show "$cmd"
2115
        $run eval "$cmd" || exit $?
2116
      done
2117
      IFS="$save_ifs"
2118
 
2119
      # Exit if we aren't doing a library object file.
2120
      test -z "$libobj" && exit 0
2121
 
2122
      if test "$build_libtool_libs" != yes; then
2123
        # Create an invalid libtool object if no PIC, so that we don't
2124
        # accidentally link it into a program.
2125
        $show "echo timestamp > $libobj"
2126
        $run eval "echo timestamp > $libobj" || exit $?
2127
        exit 0
2128
      fi
2129
 
2130
      if test -n "$pic_flag"; then
2131
        # Only do commands if we really have different PIC objects.
2132
        reload_objs="$libobjs"
2133
        output="$libobj"
2134
        eval cmds=\"$reload_cmds\"
2135
        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
2136
        for cmd in $cmds; do
2137
          IFS="$save_ifs"
2138
          $show "$cmd"
2139
          $run eval "$cmd" || exit $?
2140
        done
2141
        IFS="$save_ifs"
2142
      else
2143
        # Just create a symlink.
2144
        $show $rm $libobj
2145
        $run $rm $libobj
2146
        $show "$LN_S $obj $libobj"
2147
        $run $LN_S $obj $libobj || exit $?
2148
      fi
2149
 
2150
      exit 0
2151
      ;;
2152
 
2153
    # Anything else should be a program.
2154
    *)
2155
      if test -n "$vinfo"; then
2156
        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2157
      fi
2158
 
2159
      if test -n "$release"; then
2160
        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2161
      fi
2162
 
2163
      if test "$preload" = yes; then
2164
        if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2165
           test "$dlopen_self_static" = unknown; then
2166
          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2167
        fi
2168
      fi
2169
 
2170
      if test "$dlself" = yes && test "$export_dynamic" = no; then
2171
        $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2
2172
        exit 1
2173
      fi
2174
 
2175
      if test -n "$rpath$xrpath"; then
2176
        # If the user specified any rpath flags, then add them.
2177
        for libdir in $rpath $xrpath; do
2178
          # This is the magic to use -rpath.
2179
          case "$compile_rpath " in
2180
          *" $libdir "*) ;;
2181
          *) compile_rpath="$compile_rpath $libdir" ;;
2182
          esac
2183
          case "$finalize_rpath " in
2184
          *" $libdir "*) ;;
2185
          *) finalize_rpath="$finalize_rpath $libdir" ;;
2186
          esac
2187
        done
2188
      fi
2189
 
2190
      # Now hardcode the library paths
2191
      rpath=
2192
      hardcode_libdirs=
2193
      for libdir in $compile_rpath $finalize_rpath; do
2194
        if test -n "$hardcode_libdir_flag_spec"; then
2195
          if test -n "$hardcode_libdir_separator"; then
2196
            if test -z "$hardcode_libdirs"; then
2197
              hardcode_libdirs="$libdir"
2198
            else
2199
              # Just accumulate the unique libdirs.
2200
              case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2201
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2202
                ;;
2203
              *)
2204
                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2205
                ;;
2206
              esac
2207
            fi
2208
          else
2209
            eval flag=\"$hardcode_libdir_flag_spec\"
2210
 
2211
            rpath="$rpath $flag"
2212
          fi
2213
        elif test -n "$runpath_var"; then
2214
          case "$perm_rpath " in
2215
          *" $libdir "*) ;;
2216
          *) perm_rpath="$perm_rpath $libdir" ;;
2217
          esac
2218
        fi
2219
      done
2220
      # Substitute the hardcoded libdirs into the rpath.
2221
      if test -n "$hardcode_libdir_separator" &&
2222
         test -n "$hardcode_libdirs"; then
2223
        libdir="$hardcode_libdirs"
2224
        eval rpath=\" $hardcode_libdir_flag_spec\"
2225
      fi
2226
      compile_rpath="$rpath"
2227
 
2228
      rpath=
2229
      hardcode_libdirs=
2230
      for libdir in $finalize_rpath; do
2231
        if test -n "$hardcode_libdir_flag_spec"; then
2232
          if test -n "$hardcode_libdir_separator"; then
2233
            if test -z "$hardcode_libdirs"; then
2234
              hardcode_libdirs="$libdir"
2235
            else
2236
              # Just accumulate the unique libdirs.
2237
              case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2238
              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2239
                ;;
2240
              *)
2241
                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2242
                ;;
2243
              esac
2244
            fi
2245
          else
2246
            eval flag=\"$hardcode_libdir_flag_spec\"
2247
 
2248
            rpath="$rpath $flag"
2249
          fi
2250
        elif test -n "$runpath_var"; then
2251
          case "$finalize_perm_rpath " in
2252
          *" $libdir "*) ;;
2253
          *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2254
          esac
2255
        fi
2256
      done
2257
      # Substitute the hardcoded libdirs into the rpath.
2258
      if test -n "$hardcode_libdir_separator" &&
2259
         test -n "$hardcode_libdirs"; then
2260
        libdir="$hardcode_libdirs"
2261
        eval rpath=\" $hardcode_libdir_flag_spec\"
2262
      fi
2263
      finalize_rpath="$rpath"
2264
 
2265
      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2266
      if test "X$output_objdir" = "X$output"; then
2267
        output_objdir="$objdir"
2268
      else
2269
        output_objdir="$output_objdir/$objdir"
2270
      fi
2271
 
2272
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
2273
        # Transform all the library objects into standard objects.
2274
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2275
        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2276
      fi
2277
 
2278
      dlsyms=
2279
      if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
2280
        if test -n "$NM" && test -n "$global_symbol_pipe"; then
2281
          dlsyms="${outputname}S.c"
2282
        else
2283
          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2284
        fi
2285
      fi
2286
 
2287
      if test -n "$dlsyms"; then
2288
        case "$dlsyms" in
2289
        "") ;;
2290
        *.c)
2291
          # Discover the nlist of each of the dlfiles.
2292
          nlist="$objdir/${output}.nm"
2293
 
2294
          if test -d $objdir; then
2295
            $show "$rm $nlist ${nlist}S ${nlist}T"
2296
            $run $rm "$nlist" "${nlist}S" "${nlist}T"
2297
          else
2298
            $show "$mkdir $objdir"
2299
            $run $mkdir $objdir
2300
            status=$?
2301
            if test $status -ne 0 && test ! -d $objdir; then
2302
              exit $status
2303
            fi
2304
          fi
2305
 
2306
          # Parse the name list into a source file.
2307
          $show "creating $objdir/$dlsyms"
2308
 
2309
          $echo > "$objdir/$dlsyms" "\
2310
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2311
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2312
 
2313
#ifdef __cplusplus
2314
extern \"C\" {
2315
#endif
2316
 
2317
/* Prevent the only kind of declaration conflicts we can make. */
2318
#define lt_preloaded_symbols some_other_symbol
2319
 
2320
/* External symbol declarations for the compiler. */\
2321
"
2322
 
2323
          if test "$dlself" = yes; then
2324
            $show "generating symbol list for \`$output'"
2325
 
2326
            echo ': @PROGRAM@ ' > "$nlist"
2327
 
2328
            # Add our own program objects to the symbol list.
2329
            progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2330
            for arg in $progfiles; do
2331
              $show "extracting global C symbols from \`$arg'"
2332
              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2333
            done
2334
 
2335
            if test -n "$exclude_expsyms"; then
2336
              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2337
              $run eval '$mv "$nlist"T "$nlist"'
2338
            fi
2339
 
2340
            if test -n "$export_symbols_regex"; then
2341
              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2342
              $run eval '$mv "$nlist"T "$nlist"'
2343
            fi
2344
 
2345
            # Prepare the list of exported symbols
2346
            if test -z "$export_symbols"; then
2347
              export_symbols="$objdir/$output.exp"
2348
              $run $rm $export_symbols
2349
              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2350
            else
2351
              $run $rm $export_symbols
2352
              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"'
2353
              $run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T'
2354
              $run eval 'mv "$nlist"T "$nlist"'
2355
            fi
2356
          fi
2357
 
2358
          for arg in $dlprefiles; do
2359
            $show "extracting global C symbols from \`$arg'"
2360
            name=`echo "$arg" | sed -e 's%^.*/%%'`
2361
            $run eval 'echo ": $name " >> "$nlist"'
2362
            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2363
          done
2364
 
2365
          if test -z "$run"; then
2366
            # Make sure we have at least an empty file.
2367
            test -f "$nlist" || : > "$nlist"
2368
 
2369
            if test -n "$exclude_expsyms"; then
2370
              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2371
              $mv "$nlist"T "$nlist"
2372
            fi
2373
 
2374
            # Try sorting and uniquifying the output.
2375
            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2376
              :
2377
            else
2378
              grep -v "^: " < "$nlist" > "$nlist"S
2379
            fi
2380
 
2381
            if test -f "$nlist"S; then
2382
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2383
            else
2384
              echo '/* NONE */' >> "$output_objdir/$dlsyms"
2385
            fi
2386
 
2387
            $echo >> "$output_objdir/$dlsyms" "\
2388
 
2389
#undef lt_preloaded_symbols
2390
 
2391
#if defined (__STDC__) && __STDC__
2392
# define lt_ptr_t void *
2393
#else
2394
# define lt_ptr_t char *
2395
# define const
2396
#endif
2397
 
2398
/* The mapping between symbol names and symbols. */
2399
const struct {
2400
  const char *name;
2401
  lt_ptr_t address;
2402
}
2403
lt_preloaded_symbols[] =
2404
{\
2405
"
2406
 
2407
            sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
2408
                -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
2409
                  < "$nlist" >> "$output_objdir/$dlsyms"
2410
 
2411
            $echo >> "$output_objdir/$dlsyms" "\
2412
  {0, (lt_ptr_t) 0}
2413
};
2414
 
2415
/* This works around a problem in FreeBSD linker */
2416
#ifdef FREEBSD_WORKAROUND
2417
static const void *lt_preloaded_setup() {
2418
  return lt_preloaded_symbols;
2419
}
2420
#endif
2421
 
2422
#ifdef __cplusplus
2423
}
2424
#endif\
2425
"
2426
          fi
2427
 
2428
          pic_flag_for_symtable=
2429
          case "$host" in
2430
          # compiling the symbol table file with pic_flag works around
2431
          # a FreeBSD bug that causes programs to crash when -lm is
2432
          # linked before any other PIC object.  But we must not use
2433
          # pic_flag when linking with -static.  The problem exists in
2434
          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2435
          *-*-freebsd2*|*-*-freebsd3.0*)
2436
            case "$compile_command " in
2437
            *" -static "*) ;;
2438
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2439
            esac
2440
          esac
2441
 
2442
          # Now compile the dynamic symbol file.
2443
          $show "(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2444
          $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2445
 
2446
          # Transform the symbol file into the correct name.
2447
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
2448
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
2449
          ;;
2450
        *)
2451
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2452
          exit 1
2453
          ;;
2454
        esac
2455
      else
2456
        # We keep going just in case the user didn't refer to
2457
        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
2458
        # really was required.
2459
 
2460
        # Nullify the symbol file.
2461
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2462
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2463
      fi
2464
 
2465
      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2466
        # Replace the output file specification.
2467
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2468
        link_command="$compile_command$compile_rpath"
2469
 
2470
        # We have no uninstalled library dependencies, so finalize right now.
2471
        $show "$link_command"
2472
        $run eval "$link_command"
2473
        exit $?
2474
      fi
2475
 
2476
      if test -n "$shlibpath_var"; then
2477
        # We should set the shlibpath_var
2478
        rpath=
2479
        for dir in $temp_rpath; do
2480
          case "$dir" in
2481
          /* | [A-Za-z]:[/\\]*)
2482
            # Absolute path.
2483
            rpath="$rpath$dir:"
2484
            ;;
2485
          *)
2486
            # Relative path: add a thisdir entry.
2487
            rpath="$rpath\$thisdir/$dir:"
2488
            ;;
2489
          esac
2490
        done
2491
        temp_rpath="$rpath"
2492
      fi
2493
 
2494
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
2495
        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2496
      fi
2497
      if test -n "$finalize_shlibpath"; then
2498
        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2499
      fi
2500
 
2501
      compile_var=
2502
      finalize_var=
2503
      if test -n "$runpath_var"; then
2504
        if test -n "$perm_rpath"; then
2505
          # We should set the runpath_var.
2506
          rpath=
2507
          for dir in $perm_rpath; do
2508
            rpath="$rpath$dir:"
2509
          done
2510
          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2511
        fi
2512
        if test -n "$finalize_perm_rpath"; then
2513
          # We should set the runpath_var.
2514
          rpath=
2515
          for dir in $finalize_perm_rpath; do
2516
            rpath="$rpath$dir:"
2517
          done
2518
          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2519
        fi
2520
      fi
2521
 
2522
      if test "$hardcode_action" = relink; then
2523
        # Fast installation is not supported
2524
        link_command="$compile_var$compile_command$compile_rpath"
2525
        relink_command="$finalize_var$finalize_command$finalize_rpath"
2526
 
2527
        # AGH! Flame the AIX and HP-UX people for me, will ya?
2528
        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2529
        $echo "$modename: \`$output' will be relinked during installation" 1>&2
2530
      else
2531
        if test "$fast_install" != no; then
2532
          link_command="$finalize_var$compile_command$finalize_rpath"
2533
          if test "$fast_install" = yes; then
2534
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2535
          else
2536
            # fast_install is set to needless
2537
            relink_command=
2538
          fi
2539
        else
2540
          link_command="$compile_var$compile_command$compile_rpath"
2541
          relink_command="$finalize_var$finalize_command$finalize_rpath"
2542
        fi
2543
      fi
2544
 
2545
      # Replace the output file specification.
2546
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2547
 
2548
      # Create the binary in the object directory, then wrap it.
2549
      if test ! -d $output_objdir; then
2550
        $show "$mkdir $output_objdir"
2551
        $run $mkdir $output_objdir
2552
        status=$?
2553
        if test $status -ne 0 && test ! -d $objdir; then
2554
          exit $status
2555
        fi
2556
      fi
2557
 
2558
      # Delete the old output file.
2559
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2560
 
2561
      $show "$link_command"
2562
      $run eval "$link_command" || exit $?
2563
 
2564
      # Now create the wrapper script.
2565
      $show "creating $output"
2566
 
2567
      # Quote the relink command for shipping.
2568
      if test -n "$relink_command"; then
2569
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2570
      fi
2571
 
2572
      # Quote $echo for shipping.
2573
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2574
        case "$0" in
2575
        /* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";;
2576
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2577
        esac
2578
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2579
      else
2580
        qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2581
      fi
2582
 
2583
      # Only actually do things if our run command is non-null.
2584
      if test -z "$run"; then
2585
        # win32 will think the script is a binary if it has
2586
        # a .exe suffix, so we strip it off here.
2587
        case $output in
2588
          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2589
        esac
2590
        $rm $output
2591
        trap "$rm $output; exit 1" 1 2 15
2592
 
2593
        $echo > $output "\
2594
#! $SHELL
2595
 
2596
# $output - temporary wrapper script for $objdir/$outputname
2597
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2598
#
2599
# The $output program cannot be directly executed until all the libtool
2600
# libraries that it depends on are installed.
2601
#
2602
# This wrapper script should never be moved out of the build directory.
2603
# If it is, it will not operate correctly.
2604
 
2605
# Sed substitution that helps us do robust quoting.  It backslashifies
2606
# metacharacters that are still active within double-quoted strings.
2607
Xsed='sed -e 1s/^X//'
2608
sed_quote_subst='$sed_quote_subst'
2609
 
2610
# The HP-UX ksh and POSIX shell print the target directory to stdout
2611
# if CDPATH is set.
2612
if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
2613
 
2614
relink_command=\"$relink_command\"
2615
 
2616
# This environment variable determines our operation mode.
2617
if test \"\$libtool_install_magic\" = \"$magic\"; then
2618
  # install mode needs the following variable:
2619
  link_against_libtool_libs='$link_against_libtool_libs'
2620
else
2621
  # When we are sourced in execute mode, \$file and \$echo are already set.
2622
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
2623
    echo=\"$qecho\"
2624
    file=\"\$0\"
2625
    # Make sure echo works.
2626
    if test \"X\$1\" = X--no-reexec; then
2627
      # Discard the --no-reexec flag, and continue.
2628
      shift
2629
    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2630
      # Yippee, \$echo works!
2631
      :
2632
    else
2633
      # Restart under the correct shell, and then maybe \$echo will work.
2634
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2635
    fi
2636
  fi\
2637
"
2638
        $echo >> $output "\
2639
 
2640
  # Find the directory that this script lives in.
2641
  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2642
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2643
 
2644
  # Follow symbolic links until we get to the real thisdir.
2645
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2646
  while test -n \"\$file\"; do
2647
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2648
 
2649
    # If there was a directory component, then change thisdir.
2650
    if test \"x\$destdir\" != \"x\$file\"; then
2651
      case \"\$destdir\" in
2652
      /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
2653
      *) thisdir=\"\$thisdir/\$destdir\" ;;
2654
      esac
2655
    fi
2656
 
2657
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2658
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2659
  done
2660
 
2661
  # Try to get the absolute directory name.
2662
  absdir=\`cd \"\$thisdir\" && pwd\`
2663
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
2664
"
2665
 
2666
        if test "$fast_install" = yes; then
2667
          echo >> $output "\
2668
  program=lt-'$outputname'
2669
  progdir=\"\$thisdir/$objdir\"
2670
 
2671
  if test ! -f \"\$progdir/\$program\" || \\
2672
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2673
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2674
 
2675
    file=\"\$\$-\$program\"
2676
 
2677
    if test ! -d \"\$progdir\"; then
2678
      $mkdir \"\$progdir\"
2679
    else
2680
      $rm \"\$progdir/\$file\"
2681
    fi"
2682
 
2683
          echo >> $output "\
2684
 
2685
    # relink executable if necessary
2686
    if test -n \"\$relink_command\"; then
2687
      if (cd \"\$thisdir\" && eval \$relink_command); then :
2688
      else
2689
        $rm \"\$progdir/\$file\"
2690
        exit 1
2691
      fi
2692
    fi
2693
 
2694
    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2695
    { $rm \"\$progdir/\$program\";
2696
      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2697
    $rm \"\$progdir/\$file\"
2698
  fi"
2699
        else
2700
          echo >> $output "\
2701
  program='$outputname'
2702
  progdir=\"\$thisdir/$objdir\"
2703
"
2704
        fi
2705
 
2706
        echo >> $output "\
2707
 
2708
  if test -f \"\$progdir/\$program\"; then"
2709
 
2710
        # Export our shlibpath_var if we have one.
2711
        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2712
          $echo >> $output "\
2713
    # Add our own library path to $shlibpath_var
2714
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2715
 
2716
    # Some systems cannot cope with colon-terminated $shlibpath_var
2717
    # The second colon is a workaround for a bug in BeOS R4 sed
2718
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2719
 
2720
    export $shlibpath_var
2721
"
2722
        fi
2723
 
2724
        # fixup the dll searchpath if we need to.
2725
        if test -n "$dllsearchpath"; then
2726
          $echo >> $output "\
2727
    # Add the dll search path components to the executable PATH
2728
    PATH=$dllsearchpath:\$PATH
2729
"
2730
        fi
2731
 
2732
        $echo >> $output "\
2733
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
2734
      # Run the actual program with our arguments.
2735
"
2736
        case $host in
2737
        *-*-cygwin* | *-*-mingw | *-*-os2*)
2738
          # win32 systems need to use the prog path for dll
2739
          # lookup to work
2740
          $echo >> $output "\
2741
      exec \$progdir\\\\\$program \${1+\"\$@\"}
2742
"
2743
          ;;
2744
        *)
2745
          $echo >> $output "\
2746
      # Export the path to the program.
2747
      PATH=\"\$progdir:\$PATH\"
2748
      export PATH
2749
 
2750
      exec \$program \${1+\"\$@\"}
2751
"
2752
          ;;
2753
        esac
2754
        $echo >> $output "\
2755
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
2756
      exit 1
2757
    fi
2758
  else
2759
    # The program doesn't exist.
2760
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
2761
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
2762
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
2763
    exit 1
2764
  fi
2765
fi\
2766
"
2767
        chmod +x $output
2768
      fi
2769
      exit 0
2770
      ;;
2771
    esac
2772
 
2773
    # See if we need to build an old-fashioned archive.
2774
    for oldlib in $oldlibs; do
2775
 
2776
      if test "$build_libtool_libs" = convenience; then
2777
        oldobjs="$libobjs_save"
2778
        addlibs="$convenience"
2779
        build_libtool_libs=no
2780
      else
2781
        if test "$build_libtool_libs" = module; then
2782
          oldobjs="$libobjs_save"
2783
          build_libtool_libs=no
2784
        else
2785
          oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
2786
        fi
2787
        addlibs="$old_convenience"
2788
      fi
2789
 
2790
      # Add in members from convenience archives.
2791
      for xlib in $addlibs; do
2792
        # Extract the objects.
2793
        xdir="$xlib"x
2794
        generated="$generated $xdir"
2795
        xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2796
 
2797
        $show "${rm}r $xdir"
2798
        $run ${rm}r "$xdir"
2799
        $show "mkdir $xdir"
2800
        $run mkdir "$xdir"
2801
        status=$?
2802
        if test $status -ne 0 && test ! -d "$xdir"; then
2803
          exit $status
2804
        fi
2805
        $show "(cd $xdir && $AR x ../$xlib)"
2806
        $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
2807
 
2808
        oldobjs="$oldobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2809
      done
2810
 
2811
      # Do each command in the archive commands.
2812
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
2813
        eval cmds=\"$old_archive_from_new_cmds\"
2814
      else
2815
        eval cmds=\"$old_archive_cmds\"
2816
      fi
2817
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
2818
      for cmd in $cmds; do
2819
        IFS="$save_ifs"
2820
        $show "$cmd"
2821
        $run eval "$cmd" || exit $?
2822
      done
2823
      IFS="$save_ifs"
2824
    done
2825
 
2826
    if test -n "$generated"; then
2827
      $show "${rm}r$generated"
2828
      $run ${rm}r$generated
2829
    fi
2830
 
2831
    # Now create the libtool archive.
2832
    case "$output" in
2833
    *.la)
2834
      old_library=
2835
      test "$build_old_libs" = yes && old_library="$libname.$libext"
2836
      $show "creating $output"
2837
 
2838
      if test -n "$xrpath"; then
2839
        temp_xrpath=
2840
        for libdir in $xrpath; do
2841
          temp_xrpath="$temp_xrpath -R$libdir"
2842
        done
2843
        dependency_libs="$temp_xrpath $dependency_libs"
2844
      fi
2845
 
2846
      # Only create the output if not a dry run.
2847
      if test -z "$run"; then
2848
        $echo > $output "\
2849
# $output - a libtool library file
2850
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2851
 
2852
# The name that we can dlopen(3).
2853
dlname='$dlname'
2854
 
2855
# Names of this library.
2856
library_names='$library_names'
2857
 
2858
# The name of the static archive.
2859
old_library='$old_library'
2860
 
2861
# Libraries that this one depends upon.
2862
dependency_libs='$dependency_libs'
2863
 
2864
# Version information for $libname.
2865
current=$current
2866
age=$age
2867
revision=$revision
2868
 
2869
# Is this an already installed library?
2870
installed=no
2871
 
2872
# Directory that this library needs to be installed in:
2873
libdir='$install_libdir'\
2874
"
2875
 
2876
        $rm "$output_objdir/$outputname"i
2877
        sed 's/^installed=no$/installed=yes/' \
2878
          < "$output" > "$output_objdir/$outputname"i || exit 1
2879
      fi
2880
 
2881
      # Do a symbolic link so that the libtool archive can be found in
2882
      # LD_LIBRARY_PATH before the program is installed.
2883
      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
2884
      $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
2885
      ;;
2886
    esac
2887
    exit 0
2888
    ;;
2889
 
2890
  # libtool install mode
2891
  install)
2892
    modename="$modename: install"
2893
 
2894
    # There may be an optional sh(1) argument at the beginning of
2895
    # install_prog (especially on Windows NT).
2896
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
2897
      # Aesthetically quote it.
2898
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
2899
      case "$arg" in
2900
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
2901
        arg="\"$arg\""
2902
        ;;
2903
      esac
2904
      install_prog="$arg "
2905
      arg="$1"
2906
      shift
2907
    else
2908
      install_prog=
2909
      arg="$nonopt"
2910
    fi
2911
 
2912
    # The real first argument should be the name of the installation program.
2913
    # Aesthetically quote it.
2914
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2915
    case "$arg" in
2916
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
2917
      arg="\"$arg\""
2918
      ;;
2919
    esac
2920
    install_prog="$install_prog$arg"
2921
 
2922
    # We need to accept at least all the BSD install flags.
2923
    dest=
2924
    files=
2925
    opts=
2926
    prev=
2927
    install_type=
2928
    isdir=no
2929
    stripme=
2930
    for arg
2931
    do
2932
      if test -n "$dest"; then
2933
        files="$files $dest"
2934
        dest="$arg"
2935
        continue
2936
      fi
2937
 
2938
      case "$arg" in
2939
      -d) isdir=yes ;;
2940
      -f) prev="-f" ;;
2941
      -g) prev="-g" ;;
2942
      -m) prev="-m" ;;
2943
      -o) prev="-o" ;;
2944
      -s)
2945
        stripme=" -s"
2946
        continue
2947
        ;;
2948
      -*) ;;
2949
 
2950
      *)
2951
        # If the previous option needed an argument, then skip it.
2952
        if test -n "$prev"; then
2953
          prev=
2954
        else
2955
          dest="$arg"
2956
          continue
2957
        fi
2958
        ;;
2959
      esac
2960
 
2961
      # Aesthetically quote the argument.
2962
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2963
      case "$arg" in
2964
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
2965
        arg="\"$arg\""
2966
        ;;
2967
      esac
2968
      install_prog="$install_prog $arg"
2969
    done
2970
 
2971
    if test -z "$install_prog"; then
2972
      $echo "$modename: you must specify an install program" 1>&2
2973
      $echo "$help" 1>&2
2974
      exit 1
2975
    fi
2976
 
2977
    if test -n "$prev"; then
2978
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
2979
      $echo "$help" 1>&2
2980
      exit 1
2981
    fi
2982
 
2983
    if test -z "$files"; then
2984
      if test -z "$dest"; then
2985
        $echo "$modename: no file or destination specified" 1>&2
2986
      else
2987
        $echo "$modename: you must specify a destination" 1>&2
2988
      fi
2989
      $echo "$help" 1>&2
2990
      exit 1
2991
    fi
2992
 
2993
    # Strip any trailing slash from the destination.
2994
    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
2995
 
2996
    # Check to see that the destination is a directory.
2997
    test -d "$dest" && isdir=yes
2998
    if test "$isdir" = yes; then
2999
      destdir="$dest"
3000
      destname=
3001
    else
3002
      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3003
      test "X$destdir" = "X$dest" && destdir=.
3004
      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3005
 
3006
      # Not a directory, so check to see that there is only one file specified.
3007
      set dummy $files
3008
      if test $# -gt 2; then
3009
        $echo "$modename: \`$dest' is not a directory" 1>&2
3010
        $echo "$help" 1>&2
3011
        exit 1
3012
      fi
3013
    fi
3014
    case "$destdir" in
3015
    /* | [A-Za-z]:[/\\]*) ;;
3016
    *)
3017
      for file in $files; do
3018
        case "$file" in
3019
        *.lo) ;;
3020
        *)
3021
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3022
          $echo "$help" 1>&2
3023
          exit 1
3024
          ;;
3025
        esac
3026
      done
3027
      ;;
3028
    esac
3029
 
3030
    # This variable tells wrapper scripts just to set variables rather
3031
    # than running their programs.
3032
    libtool_install_magic="$magic"
3033
 
3034
    staticlibs=
3035
    future_libdirs=
3036
    current_libdirs=
3037
    for file in $files; do
3038
 
3039
      # Do each installation.
3040
      case "$file" in
3041
      *.a | *.lib)
3042
        # Do the static libraries later.
3043
        staticlibs="$staticlibs $file"
3044
        ;;
3045
 
3046
      *.la)
3047
        # Check to see that this really is a libtool archive.
3048
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3049
        else
3050
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3051
          $echo "$help" 1>&2
3052
          exit 1
3053
        fi
3054
 
3055
        library_names=
3056
        old_library=
3057
        # If there is no directory component, then add one.
3058
        case "$file" in
3059
        */* | *\\*) . $file ;;
3060
        *) . ./$file ;;
3061
        esac
3062
 
3063
        # Add the libdir to current_libdirs if it is the destination.
3064
        if test "X$destdir" = "X$libdir"; then
3065
          case "$current_libdirs " in
3066
          *" $libdir "*) ;;
3067
          *) current_libdirs="$current_libdirs $libdir" ;;
3068
          esac
3069
        else
3070
          # Note the libdir as a future libdir.
3071
          case "$future_libdirs " in
3072
          *" $libdir "*) ;;
3073
          *) future_libdirs="$future_libdirs $libdir" ;;
3074
          esac
3075
        fi
3076
 
3077
        dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3078
        test "X$dir" = "X$file/" && dir=
3079
        dir="$dir$objdir"
3080
 
3081
        # See the names of the shared library.
3082
        set dummy $library_names
3083
        if test -n "$2"; then
3084
          realname="$2"
3085
          shift
3086
          shift
3087
 
3088
          # Install the shared library and build the symlinks.
3089
          $show "$install_prog $dir/$realname $destdir/$realname"
3090
          $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3091
          test "X$dlname" = "X$realname" && dlname=
3092
 
3093
          if test $# -gt 0; then
3094
            # Delete the old symlinks, and create new ones.
3095
            for linkname
3096
            do
3097
              test "X$dlname" = "X$linkname" && dlname=
3098
              if test "$linkname" != "$realname"; then
3099
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3100
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3101
              fi
3102
            done
3103
          fi
3104
 
3105
          if test -n "$dlname"; then
3106
            # Install the dynamically-loadable library.
3107
            $show "$install_prog $dir/$dlname $destdir/$dlname"
3108
            $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
3109
          fi
3110
 
3111
          # Do each command in the postinstall commands.
3112
          lib="$destdir/$realname"
3113
          eval cmds=\"$postinstall_cmds\"
3114
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
3115
          for cmd in $cmds; do
3116
            IFS="$save_ifs"
3117
            $show "$cmd"
3118
            $run eval "$cmd" || exit $?
3119
          done
3120
          IFS="$save_ifs"
3121
        fi
3122
 
3123
        # Install the pseudo-library for information purposes.
3124
        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3125
        instname="$dir/$name"i
3126
        if test ! -f "$instname"; then
3127
          # Just in case it was removed...
3128
          $show "Creating $instname"
3129
          $rm "$instname"
3130
          sed 's/^installed=no$/installed=yes/' "$file" > "$instname"
3131
        fi
3132
        $show "$install_prog $instname $destdir/$name"
3133
        $run eval "$install_prog $instname $destdir/$name" || exit $?
3134
 
3135
        # Maybe install the static library, too.
3136
        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3137
        ;;
3138
 
3139
      *.lo)
3140
        # Install (i.e. copy) a libtool object.
3141
 
3142
        # Figure out destination file name, if it wasn't already specified.
3143
        if test -n "$destname"; then
3144
          destfile="$destdir/$destname"
3145
        else
3146
          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3147
          destfile="$destdir/$destfile"
3148
        fi
3149
 
3150
        # Deduce the name of the destination old-style object file.
3151
        case "$destfile" in
3152
        *.lo)
3153
          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3154
          ;;
3155
        *.o | *.obj)
3156
          staticdest="$destfile"
3157
          destfile=
3158
          ;;
3159
        *)
3160
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3161
          $echo "$help" 1>&2
3162
          exit 1
3163
          ;;
3164
        esac
3165
 
3166
        # Install the libtool object if requested.
3167
        if test -n "$destfile"; then
3168
          $show "$install_prog $file $destfile"
3169
          $run eval "$install_prog $file $destfile" || exit $?
3170
        fi
3171
 
3172
        # Install the old object if enabled.
3173
        if test "$build_old_libs" = yes; then
3174
          # Deduce the name of the old-style object file.
3175
          staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3176
 
3177
          $show "$install_prog $staticobj $staticdest"
3178
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3179
        fi
3180
        exit 0
3181
        ;;
3182
 
3183
      *)
3184
        # Figure out destination file name, if it wasn't already specified.
3185
        if test -n "$destname"; then
3186
          destfile="$destdir/$destname"
3187
        else
3188
          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3189
          destfile="$destdir/$destfile"
3190
        fi
3191
 
3192
        # Do a test to see if this is really a libtool program.
3193
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3194
          link_against_libtool_libs=
3195
          relink_command=
3196
 
3197
          # If there is no directory component, then add one.
3198
          case "$file" in
3199
          */* | *\\*) . $file ;;
3200
          *) . ./$file ;;
3201
          esac
3202
 
3203
          # Check the variables that should have been set.
3204
          if test -z "$link_against_libtool_libs"; then
3205
            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3206
            exit 1
3207
          fi
3208
 
3209
          finalize=yes
3210
          for lib in $link_against_libtool_libs; do
3211
            # Check to see that each library is installed.
3212
            libdir=
3213
            if test -f "$lib"; then
3214
              # If there is no directory component, then add one.
3215
              case "$lib" in
3216
              */* | *\\*) . $lib ;;
3217
              *) . ./$lib ;;
3218
              esac
3219
            fi
3220
            libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3221
            if test -n "$libdir" && test ! -f "$libfile"; then
3222
              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3223
              finalize=no
3224
            fi
3225
          done
3226
 
3227
          outputname=
3228
          if test "$fast_install" = no && test -n "$relink_command"; then
3229
            if test "$finalize" = yes; then
3230
              outputname="/tmp/$$-$file"
3231
              # Replace the output file specification.
3232
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3233
 
3234
              $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
3235
              $show "$relink_command"
3236
              if $run eval "$relink_command"; then :
3237
              else
3238
                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3239
                continue
3240
              fi
3241
              file="$outputname"
3242
            else
3243
              $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
3244
            fi
3245
          else
3246
            # Install the binary that we compiled earlier.
3247
            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3248
          fi
3249
        fi
3250
 
3251
        $show "$install_prog$stripme $file $destfile"
3252
        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3253
        test -n "$outputname" && $rm $outputname
3254
        ;;
3255
      esac
3256
    done
3257
 
3258
    for file in $staticlibs; do
3259
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3260
 
3261
      # Set up the ranlib parameters.
3262
      oldlib="$destdir/$name"
3263
 
3264
      $show "$install_prog $file $oldlib"
3265
      $run eval "$install_prog \$file \$oldlib" || exit $?
3266
 
3267
      # Do each command in the postinstall commands.
3268
      eval cmds=\"$old_postinstall_cmds\"
3269
      IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
3270
      for cmd in $cmds; do
3271
        IFS="$save_ifs"
3272
        $show "$cmd"
3273
        $run eval "$cmd" || exit $?
3274
      done
3275
      IFS="$save_ifs"
3276
    done
3277
 
3278
    if test -n "$future_libdirs"; then
3279
      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3280
    fi
3281
 
3282
    if test -n "$current_libdirs"; then
3283
      # Maybe just do a dry run.
3284
      test -n "$run" && current_libdirs=" -n$current_libdirs"
3285
      exec $SHELL $0 --finish$current_libdirs
3286
      exit 1
3287
    fi
3288
 
3289
    exit 0
3290
    ;;
3291
 
3292
  # libtool finish mode
3293
  finish)
3294
    modename="$modename: finish"
3295
    libdirs="$nonopt"
3296
    admincmds=
3297
 
3298
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3299
      for dir
3300
      do
3301
        libdirs="$libdirs $dir"
3302
      done
3303
 
3304
      for libdir in $libdirs; do
3305
        if test -n "$finish_cmds"; then
3306
          # Do each command in the finish commands.
3307
          eval cmds=\"$finish_cmds\"
3308
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
3309
          for cmd in $cmds; do
3310
            IFS="$save_ifs"
3311
            $show "$cmd"
3312
            $run eval "$cmd" || admincmds="$admincmds
3313
       $cmd"
3314
          done
3315
          IFS="$save_ifs"
3316
        fi
3317
        if test -n "$finish_eval"; then
3318
          # Do the single finish_eval.
3319
          eval cmds=\"$finish_eval\"
3320
          $run eval "$cmds" || admincmds="$admincmds
3321
       $cmds"
3322
        fi
3323
      done
3324
    fi
3325
 
3326
    # Exit here if they wanted silent mode.
3327
    test "$show" = : && exit 0
3328
 
3329
    echo "----------------------------------------------------------------------"
3330
    echo "Libraries have been installed in:"
3331
    for libdir in $libdirs; do
3332
      echo "   $libdir"
3333
    done
3334
    echo
3335
    echo "If you ever happen to want to link against installed libraries"
3336
    echo "in a given directory, LIBDIR, you must either use libtool, and"
3337
    echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3338
    echo "flag during linking and do at least one of the following:"
3339
    if test -n "$shlibpath_var"; then
3340
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
3341
      echo "     during execution"
3342
    fi
3343
    if test -n "$runpath_var"; then
3344
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
3345
      echo "     during linking"
3346
    fi
3347
    if test -n "$hardcode_libdir_flag_spec"; then
3348
      libdir=LIBDIR
3349
      eval flag=\"$hardcode_libdir_flag_spec\"
3350
 
3351
      echo "   - use the \`$flag' linker flag"
3352
    fi
3353
    if test -n "$admincmds"; then
3354
      echo "   - have your system administrator run these commands:$admincmds"
3355
    fi
3356
    if test -f /etc/ld.so.conf; then
3357
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3358
    fi
3359
    echo
3360
    echo "See any operating system documentation about shared libraries for"
3361
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
3362
    echo "----------------------------------------------------------------------"
3363
    exit 0
3364
    ;;
3365
 
3366
  # libtool execute mode
3367
  execute)
3368
    modename="$modename: execute"
3369
 
3370
    # The first argument is the command name.
3371
    cmd="$nonopt"
3372
    if test -z "$cmd"; then
3373
      $echo "$modename: you must specify a COMMAND" 1>&2
3374
      $echo "$help"
3375
      exit 1
3376
    fi
3377
 
3378
    # Handle -dlopen flags immediately.
3379
    for file in $execute_dlfiles; do
3380
      if test ! -f "$file"; then
3381
        $echo "$modename: \`$file' is not a file" 1>&2
3382
        $echo "$help" 1>&2
3383
        exit 1
3384
      fi
3385
 
3386
      dir=
3387
      case "$file" in
3388
      *.la)
3389
        # Check to see that this really is a libtool archive.
3390
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3391
        else
3392
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3393
          $echo "$help" 1>&2
3394
          exit 1
3395
        fi
3396
 
3397
        # Read the libtool library.
3398
        dlname=
3399
        library_names=
3400
 
3401
        # If there is no directory component, then add one.
3402
        case "$file" in
3403
        */* | *\\*) . $file ;;
3404
        *) . ./$file ;;
3405
        esac
3406
 
3407
        # Skip this library if it cannot be dlopened.
3408
        if test -z "$dlname"; then
3409
          # Warn if it was a shared library.
3410
          test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3411
          continue
3412
        fi
3413
 
3414
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3415
        test "X$dir" = "X$file" && dir=.
3416
 
3417
        if test -f "$dir/$objdir/$dlname"; then
3418
          dir="$dir/$objdir"
3419
        else
3420
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3421
          exit 1
3422
        fi
3423
        ;;
3424
 
3425
      *.lo)
3426
        # Just add the directory containing the .lo file.
3427
        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3428
        test "X$dir" = "X$file" && dir=.
3429
        ;;
3430
 
3431
      *)
3432
        $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3433
        continue
3434
        ;;
3435
      esac
3436
 
3437
      # Get the absolute pathname.
3438
      absdir=`cd "$dir" && pwd`
3439
      test -n "$absdir" && dir="$absdir"
3440
 
3441
      # Now add the directory to shlibpath_var.
3442
      if eval "test -z \"\$$shlibpath_var\""; then
3443
        eval "$shlibpath_var=\"\$dir\""
3444
      else
3445
        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3446
      fi
3447
    done
3448
 
3449
    # This variable tells wrapper scripts just to set shlibpath_var
3450
    # rather than running their programs.
3451
    libtool_execute_magic="$magic"
3452
 
3453
    # Check if any of the arguments is a wrapper script.
3454
    args=
3455
    for file
3456
    do
3457
      case "$file" in
3458
      -*) ;;
3459
      *)
3460
        # Do a test to see if this is really a libtool program.
3461
        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3462
          # If there is no directory component, then add one.
3463
          case "$file" in
3464
          */* | *\\*) . $file ;;
3465
          *) . ./$file ;;
3466
          esac
3467
 
3468
          # Transform arg to wrapped name.
3469
          file="$progdir/$program"
3470
        fi
3471
        ;;
3472
      esac
3473
      # Quote arguments (to preserve shell metacharacters).
3474
      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3475
      args="$args \"$file\""
3476
    done
3477
 
3478
    if test -z "$run"; then
3479
      # Export the shlibpath_var.
3480
      eval "export $shlibpath_var"
3481
 
3482
      # Restore saved enviroment variables
3483
      if test "${save_LC_ALL+set}" = set; then
3484
        LC_ALL="$save_LC_ALL"; export LC_ALL
3485
      fi
3486
      if test "${save_LANG+set}" = set; then
3487
        LANG="$save_LANG"; export LANG
3488
      fi
3489
 
3490
      # Now actually exec the command.
3491
      eval "exec \$cmd$args"
3492
 
3493
      $echo "$modename: cannot exec \$cmd$args"
3494
      exit 1
3495
    else
3496
      # Display what would be done.
3497
      eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3498
      $echo "export $shlibpath_var"
3499
      $echo "$cmd$args"
3500
      exit 0
3501
    fi
3502
    ;;
3503
 
3504
  # libtool uninstall mode
3505
  uninstall)
3506
    modename="$modename: uninstall"
3507
    rm="$nonopt"
3508
    files=
3509
 
3510
    for arg
3511
    do
3512
      case "$arg" in
3513
      -*) rm="$rm $arg" ;;
3514
      *) files="$files $arg" ;;
3515
      esac
3516
    done
3517
 
3518
    if test -z "$rm"; then
3519
      $echo "$modename: you must specify an RM program" 1>&2
3520
      $echo "$help" 1>&2
3521
      exit 1
3522
    fi
3523
 
3524
    for file in $files; do
3525
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3526
      test "X$dir" = "X$file" && dir=.
3527
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3528
 
3529
      rmfiles="$file"
3530
 
3531
      case "$name" in
3532
      *.la)
3533
        # Possibly a libtool archive, so verify it.
3534
        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3535
          . $dir/$name
3536
 
3537
          # Delete the libtool libraries and symlinks.
3538
          for n in $library_names; do
3539
            rmfiles="$rmfiles $dir/$n"
3540
            test "X$n" = "X$dlname" && dlname=
3541
          done
3542
          test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
3543
          test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3544
 
3545
          $show "$rm $rmfiles"
3546
          $run $rm $rmfiles
3547
 
3548
          if test -n "$library_names"; then
3549
            # Do each command in the postuninstall commands.
3550
            eval cmds=\"$postuninstall_cmds\"
3551
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3552
            for cmd in $cmds; do
3553
              IFS="$save_ifs"
3554
              $show "$cmd"
3555
              $run eval "$cmd"
3556
            done
3557
            IFS="$save_ifs"
3558
          fi
3559
 
3560
          if test -n "$old_library"; then
3561
            # Do each command in the old_postuninstall commands.
3562
            eval cmds=\"$old_postuninstall_cmds\"
3563
            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
3564
            for cmd in $cmds; do
3565
              IFS="$save_ifs"
3566
              $show "$cmd"
3567
              $run eval "$cmd"
3568
            done
3569
            IFS="$save_ifs"
3570
          fi
3571
 
3572
          # FIXME: should reinstall the best remaining shared library.
3573
        fi
3574
        ;;
3575
 
3576
      *.lo)
3577
        if test "$build_old_libs" = yes; then
3578
          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3579
          rmfiles="$rmfiles $dir/$oldobj"
3580
        fi
3581
        $show "$rm $rmfiles"
3582
        $run $rm $rmfiles
3583
        ;;
3584
 
3585
      *)
3586
        $show "$rm $rmfiles"
3587
        $run $rm $rmfiles
3588
        ;;
3589
      esac
3590
    done
3591
    exit 0
3592
    ;;
3593
 
3594
  "")
3595
    $echo "$modename: you must specify a MODE" 1>&2
3596
    $echo "$generic_help" 1>&2
3597
    exit 1
3598
    ;;
3599
  esac
3600
 
3601
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
3602
  $echo "$generic_help" 1>&2
3603
  exit 1
3604
fi # test -z "$show_help"
3605
 
3606
# We need to display help for each of the modes.
3607
case "$mode" in
3608
"") $echo \
3609
"Usage: $modename [OPTION]... [MODE-ARG]...
3610
 
3611
Provide generalized library-building support services.
3612
 
3613
    --config          show all configuration variables
3614
    --debug           enable verbose shell tracing
3615
-n, --dry-run         display commands without modifying any files
3616
    --features        display basic configuration information and exit
3617
    --finish          same as \`--mode=finish'
3618
    --help            display this help message and exit
3619
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
3620
    --quiet           same as \`--silent'
3621
    --silent          don't print informational messages
3622
    --version         print version information
3623
 
3624
MODE must be one of the following:
3625
 
3626
      compile         compile a source file into a libtool object
3627
      execute         automatically set library path, then run a program
3628
      finish          complete the installation of libtool libraries
3629
      install         install libraries or executables
3630
      link            create a library or an executable
3631
      uninstall       remove libraries from an installed directory
3632
 
3633
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
3634
a more detailed description of MODE."
3635
  exit 0
3636
  ;;
3637
 
3638
compile)
3639
  $echo \
3640
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3641
 
3642
Compile a source file into a libtool library object.
3643
 
3644
This mode accepts the following additional options:
3645
 
3646
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
3647
  -static           always build a \`.o' file suitable for static linking
3648
 
3649
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3650
from the given SOURCEFILE.
3651
 
3652
The output file name is determined by removing the directory component from
3653
SOURCEFILE, then substituting the C source code suffix \`.c' with the
3654
library object suffix, \`.lo'."
3655
  ;;
3656
 
3657
execute)
3658
  $echo \
3659
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
3660
 
3661
Automatically set library path, then run a program.
3662
 
3663
This mode accepts the following additional options:
3664
 
3665
  -dlopen FILE      add the directory containing FILE to the library path
3666
 
3667
This mode sets the library path environment variable according to \`-dlopen'
3668
flags.
3669
 
3670
If any of the ARGS are libtool executable wrappers, then they are translated
3671
into their corresponding uninstalled binary, and any of their required library
3672
directories are added to the library path.
3673
 
3674
Then, COMMAND is executed, with ARGS as arguments."
3675
  ;;
3676
 
3677
finish)
3678
  $echo \
3679
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
3680
 
3681
Complete the installation of libtool libraries.
3682
 
3683
Each LIBDIR is a directory that contains libtool libraries.
3684
 
3685
The commands that this mode executes may require superuser privileges.  Use
3686
the \`--dry-run' option if you just want to see what would be executed."
3687
  ;;
3688
 
3689
install)
3690
  $echo \
3691
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
3692
 
3693
Install executables or libraries.
3694
 
3695
INSTALL-COMMAND is the installation command.  The first component should be
3696
either the \`install' or \`cp' program.
3697
 
3698
The rest of the components are interpreted as arguments to that command (only
3699
BSD-compatible install options are recognized)."
3700
  ;;
3701
 
3702
link)
3703
  $echo \
3704
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
3705
 
3706
Link object files or libraries together to form another library, or to
3707
create an executable program.
3708
 
3709
LINK-COMMAND is a command using the C compiler that you would use to create
3710
a program from several object files.
3711
 
3712
The following components of LINK-COMMAND are treated specially:
3713
 
3714
  -all-static       do not do any dynamic linking at all
3715
  -avoid-version    do not add a version suffix if possible
3716
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
3717
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
3718
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3719
  -export-symbols SYMFILE
3720
                    try to export only the symbols listed in SYMFILE
3721
  -LLIBDIR          search LIBDIR for required installed libraries
3722
  -lNAME            OUTPUT-FILE requires the installed library libNAME
3723
  -module           build a library that can dlopened
3724
  -no-undefined     declare that a library does not refer to external symbols
3725
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
3726
  -release RELEASE  specify package release information
3727
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
3728
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
3729
  -static           do not do any dynamic linking of libtool libraries
3730
  -version-info CURRENT[:REVISION[:AGE]]
3731
                    specify library version info [each variable defaults to 0]
3732
 
3733
All other options (arguments beginning with \`-') are ignored.
3734
 
3735
Every other argument is treated as a filename.  Files ending in \`.la' are
3736
treated as uninstalled libtool libraries, other files are standard or library
3737
object files.
3738
 
3739
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
3740
only library objects (\`.lo' files) may be specified, and \`-rpath' is
3741
required, except when creating a convenience library.
3742
 
3743
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
3744
using \`ar' and \`ranlib', or on Windows using \`lib'.
3745
 
3746
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
3747
is created, otherwise an executable program is created."
3748
  ;;
3749
 
3750
uninstall)
3751
  $echo
3752
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3753
 
3754
Remove libraries from an installation directory.
3755
 
3756
RM is the name of the program to use to delete files associated with each FILE
3757
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
3758
to RM.
3759
 
3760
If FILE is a libtool library, all the files associated with it are deleted.
3761
Otherwise, only FILE itself is deleted using RM."
3762
  ;;
3763
 
3764
*)
3765
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
3766
  $echo "$help" 1>&2
3767
  exit 1
3768
  ;;
3769
esac
3770
 
3771
echo
3772
$echo "Try \`$modename --help' for more information about other modes."
3773
 
3774
exit 0
3775
 
3776
# Local Variables:
3777
# mode:shell-script
3778
# sh-indentation:2
3779
# End:

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.