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

Subversion Repositories or1k

[/] [or1k/] [branches/] [newlib/] [newlib/] [ltmain.sh] - Blame information for rev 56

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

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

powered by: WebSVN 2.1.0

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