source: trunk/third/xalf/ltmain.sh @ 16240

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