* disassemble.c (disassembler_usage): Don't use a prototype. Mark
[binutils.git] / ltmain.sh
blobc32939ee8333d4a09f9f90078d47b0cbb8a4e8db
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
4 # Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
5 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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.
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.
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.
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.
26 # Check that we have a working $echo.
27 if test "X$1" = X--no-reexec; then
28 # Discard the --no-reexec flag, and continue.
29 shift
30 elif test "X$1" = X--fallback-echo; then
31 # Avoid inline document here, it may be left over
33 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
34 # Yippee, $echo works!
36 else
37 # Restart under the correct shell, and then maybe $echo will work.
38 exec $SHELL "$0" --no-reexec ${1+"$@"}
41 if test "X$1" = X--fallback-echo; then
42 # used as fallback echo
43 shift
44 cat <<EOF
46 EOF
47 exit 0
50 # The name of this program.
51 progname=`$echo "$0" | sed 's%^.*/%%'`
52 modename="$progname"
54 # Constants.
55 PROGRAM=ltmain.sh
56 PACKAGE=libtool
57 VERSION=1.3.4
58 TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
60 default_mode=
61 help="Try \`$progname --help' for more information."
62 magic="%%%MAGIC variable%%%"
63 mkdir="mkdir"
64 mv="mv -f"
65 rm="rm -f"
67 # Sed substitution that helps us do robust quoting. It backslashifies
68 # metacharacters that are still active within double-quoted strings.
69 Xsed='sed -e 1s/^X//'
70 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
71 SP2NL='tr \040 \012'
72 NL2SP='tr \015\012 \040\040'
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.
79 if test "${LC_ALL+set}" = set; then
80 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
82 if test "${LANG+set}" = set; then
83 save_LANG="$LANG"; LANG=C; export LANG
86 if 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
92 if 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
98 # Global variables.
99 mode=$default_mode
100 nonopt=
101 prev=
102 prevopt=
103 run=
104 show="$echo"
105 show_help=
106 execute_dlfiles=
107 lo2o="s/\\.lo\$/.${objext}/"
108 o2lo="s/\\.${objext}\$/.lo/"
110 # Parse our command line options once, thoroughly.
111 while test $# -gt 0
113 arg="$1"
114 shift
116 case "$arg" in
117 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
118 *) optarg= ;;
119 esac
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\""
128 eval "$prev=\$arg"
130 esac
132 prev=
133 prevopt=
134 continue
137 # Have we seen a non-optional argument yet?
138 case "$arg" in
139 --help)
140 show_help=yes
143 --version)
144 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
145 exit 0
148 --config)
149 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
150 exit 0
153 --debug)
154 echo "$progname: enabling shell trace mode"
155 set -x
158 --dry-run | -n)
159 run=:
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"
169 if test "$build_old_libs" = yes; then
170 echo "enable static libraries"
171 else
172 echo "disable static libraries"
174 exit 0
177 --finish) mode="finish" ;;
179 --mode) prevopt="--mode" prev=mode ;;
180 --mode=*) mode="$optarg" ;;
182 --quiet | --silent)
183 show=:
186 -dlopen)
187 prevopt="-dlopen"
188 prev=execute_dlfiles
192 $echo "$modename: unrecognized option \`$arg'" 1>&2
193 $echo "$help" 1>&2
194 exit 1
198 nonopt="$arg"
199 break
201 esac
202 done
204 if test -n "$prevopt"; then
205 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
206 $echo "$help" 1>&2
207 exit 1
210 if test -z "$show_help"; then
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
219 case "$arg" in
221 mode=compile
222 break
224 esac
225 done
227 *db | *dbx | *strace | *truss)
228 mode=execute
230 *install*|cp|mv)
231 mode=install
233 *rm)
234 mode=uninstall
237 # If we have no mode, but dlfiles were specified, then do execute mode.
238 test -n "$execute_dlfiles" && mode=execute
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
249 esac
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
259 # Change the help message to a mode-specific one.
260 generic_help="$help"
261 help="Try \`$modename --help --mode=$mode' for more information."
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=
274 user_target=no
275 for arg
277 # Accept any command-line options.
278 case "$arg" in
280 if test "$user_target" != "no"; then
281 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
282 exit 1
284 user_target=next
287 -static)
288 build_old_libs=yes
289 continue
291 esac
293 case "$user_target" in
294 next)
295 # The next one is the -o target name
296 user_target=yes
297 continue
299 yes)
300 # We got the output file
301 user_target=set
302 libobj="$arg"
303 continue
305 esac
307 # Accept the current argument as the source file.
308 lastarg="$srcfile"
309 srcfile="$arg"
311 # Aesthetically quote the previous argument.
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"`
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\""
325 esac
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"
333 done
335 case "$user_target" in
336 set)
339 # Get the name of the library object.
340 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
343 $echo "$modename: you must specify a target with \`-o'" 1>&2
344 exit 1
346 esac
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
364 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
366 case "$libobj" in
367 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
369 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
370 exit 1
372 esac
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
380 # Delete any leftover library objects.
381 if test "$build_old_libs" = yes; then
382 removelist="$obj $libobj"
383 else
384 removelist="$libobj"
387 $run $rm $removelist
388 trap "$run $rm $removelist; exit 1" 1 2 15
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=
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`
415 This indicates that another process is trying to use the same
416 temporary object file, and libtool could not work around it because
417 your compiler does not support \`-c' and \`-o' together. If you
418 repeat this compilation, it may succeed, by chance, but you had better
419 avoid parallel builds (make -j) in this platform, or get a better
420 compiler."
422 $run $rm $removelist
423 exit 1
425 echo $srcfile > "$lockfile"
428 if test -n "$fix_srcfile_path"; then
429 eval srcfile=\"$fix_srcfile_path\"
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
437 # All platforms use -DPIC, to notify preprocessed assembler code.
438 # However, make sure we only set it for non-Java code.
439 case "$srcfile" in
440 *.java|*.class)
441 command="$base_compile $pic_flag $srcfile";;
443 command="$base_compile $srcfile $pic_flag -DPIC";;
444 esac
445 if test "$build_old_libs" = yes; then
446 lo_libobj="$libobj"
447 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
448 if test "X$dir" = "X$libobj"; then
449 dir="$objdir"
450 else
451 dir="$dir/$objdir"
453 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
455 if test -d "$dir"; then
456 $show "$rm $libobj"
457 $run $rm $libobj
458 else
459 $show "$mkdir $dir"
460 $run $mkdir $dir
461 status=$?
462 if test $status -ne 0 && test ! -d $dir; then
463 exit $status
467 if test "$compiler_o_lo" = yes; then
468 output_obj="$libobj"
469 command="$command -o $output_obj"
470 elif test "$compiler_c_o" = yes; then
471 output_obj="$obj"
472 command="$command -o $output_obj"
475 $run $rm "$output_obj"
476 $show "$command"
477 if $run eval "$command"; then :
478 else
479 test -n "$output_obj" && $run $rm $removelist
480 exit 1
483 if test "$need_locks" = warn &&
484 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
485 echo "\
486 *** ERROR, $lockfile contains:
487 `cat $lockfile 2>/dev/null`
489 but it should contain:
490 $srcfile
492 This indicates that another process is trying to use the same
493 temporary object file, and libtool could not work around it because
494 your compiler does not support \`-c' and \`-o' together. If you
495 repeat this compilation, it may succeed, by chance, but you had better
496 avoid parallel builds (make -j) in this platform, or get a better
497 compiler."
499 $run $rm $removelist
500 exit 1
503 # Just move the object if needed, then go on to compile the next one
504 if test x"$output_obj" != x"$libobj"; then
505 $show "$mv $output_obj $libobj"
506 if $run $mv $output_obj $libobj; then :
507 else
508 error=$?
509 $run $rm $removelist
510 exit $error
514 # If we have no pic_flag, then copy the object into place and finish.
515 if test -z "$pic_flag" && test "$build_old_libs" = yes; then
516 # Rename the .lo from within objdir to obj
517 if test -f $obj; then
518 $show $rm $obj
519 $run $rm $obj
522 $show "$mv $libobj $obj"
523 if $run $mv $libobj $obj; then :
524 else
525 error=$?
526 $run $rm $removelist
527 exit $error
530 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
531 if test "X$xdir" = "X$obj"; then
532 xdir="."
533 else
534 xdir="$xdir"
536 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
537 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
538 # Now arrange that obj and lo_libobj become the same file
539 $show "(cd $xdir && $LN_S $baseobj $libobj)"
540 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
541 exit 0
542 else
543 error=$?
544 $run $rm $removelist
545 exit $error
549 # Allow error messages only from the first compilation.
550 suppress_output=' >/dev/null 2>&1'
553 # Only build a position-dependent object if we build old libraries.
554 if test "$build_old_libs" = yes; then
555 command="$base_compile $srcfile"
556 if test "$compiler_c_o" = yes; then
557 command="$command -o $obj"
558 output_obj="$obj"
561 # Suppress compiler output if we already did a PIC compilation.
562 command="$command$suppress_output"
563 $run $rm "$output_obj"
564 $show "$command"
565 if $run eval "$command"; then :
566 else
567 $run $rm $removelist
568 exit 1
571 if test "$need_locks" = warn &&
572 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
573 echo "\
574 *** ERROR, $lockfile contains:
575 `cat $lockfile 2>/dev/null`
577 but it should contain:
578 $srcfile
580 This indicates that another process is trying to use the same
581 temporary object file, and libtool could not work around it because
582 your compiler does not support \`-c' and \`-o' together. If you
583 repeat this compilation, it may succeed, by chance, but you had better
584 avoid parallel builds (make -j) in this platform, or get a better
585 compiler."
587 $run $rm $removelist
588 exit 1
591 # Just move the object if needed
592 if test x"$output_obj" != x"$obj"; then
593 $show "$mv $output_obj $obj"
594 if $run $mv $output_obj $obj; then :
595 else
596 error=$?
597 $run $rm $removelist
598 exit $error
602 # Create an invalid libtool object if no PIC, so that we do not
603 # accidentally link it into a program.
604 if test "$build_libtool_libs" != yes; then
605 $show "echo timestamp > $libobj"
606 $run eval "echo timestamp > \$libobj" || exit $?
607 else
608 # Move the .lo from within objdir
609 $show "$mv $libobj $lo_libobj"
610 if $run $mv $libobj $lo_libobj; then :
611 else
612 error=$?
613 $run $rm $removelist
614 exit $error
619 # Unlock the critical section if it was locked
620 if test "$need_locks" != no; then
621 $rm "$lockfile"
624 exit 0
627 # libtool link mode
628 link)
629 modename="$modename: link"
630 C_compiler="$CC" # save it, to compile generated C sources
631 # Always respect the CC configured in by ltconfig.
632 CC="$nonopt"
633 # CYGNUS LOCAL: tromey/java
634 # Add -B options to link line.
635 for arg
637 case "$arg" in
638 -B*)
639 CC="$CC $arg"
641 esac
642 done
643 # END CYGNUS LOCAL
644 case "$host" in
645 *-*-cygwin* | *-*-mingw* | *-*-os2*)
646 # It is impossible to link a dll without this setting, and
647 # we shouldn't force the makefile maintainer to figure out
648 # which system we are compiling for in order to pass an extra
649 # flag for every libtool invokation.
650 # allow_undefined=no
652 # FIXME: Unfortunately, there are problems with the above when trying
653 # to make a dll which has undefined symbols, in which case not
654 # even a static library is built. For now, we need to specify
655 # -no-undefined on the libtool link line when we can be certain
656 # that all symbols are satisfied, otherwise we get a static library.
657 allow_undefined=yes
659 # This is a source program that is used to create dlls on Windows
660 # Don't remove nor modify the starting and closing comments
661 # /* ltdll.c starts here */
662 # #define WIN32_LEAN_AND_MEAN
663 # #include <windows.h>
664 # #undef WIN32_LEAN_AND_MEAN
665 # #include <stdio.h>
667 # #ifndef __CYGWIN__
668 # # ifdef __CYGWIN32__
669 # # define __CYGWIN__ __CYGWIN32__
670 # # endif
671 # #endif
673 # #ifdef __cplusplus
674 # extern "C" {
675 # #endif
676 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
677 # #ifdef __cplusplus
679 # #endif
681 # #ifdef __CYGWIN__
682 # #include <cygwin/cygwin_dll.h>
683 # DECLARE_CYGWIN_DLL( DllMain );
684 # #endif
685 # HINSTANCE __hDllInstance_base;
687 # BOOL APIENTRY
688 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
690 # __hDllInstance_base = hInst;
691 # return TRUE;
693 # /* ltdll.c ends here */
694 # This is a source program that is used to create import libraries
695 # on Windows for dlls which lack them. Don't remove nor modify the
696 # starting and closing comments
697 # /* impgen.c starts here */
698 # /* Copyright (C) 1999 Free Software Foundation, Inc.
700 # This file is part of GNU libtool.
702 # This program is free software; you can redistribute it and/or modify
703 # it under the terms of the GNU General Public License as published by
704 # the Free Software Foundation; either version 2 of the License, or
705 # (at your option) any later version.
707 # This program is distributed in the hope that it will be useful,
708 # but WITHOUT ANY WARRANTY; without even the implied warranty of
709 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
710 # GNU General Public License for more details.
712 # You should have received a copy of the GNU General Public License
713 # along with this program; if not, write to the Free Software
714 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
715 # */
717 # #include <stdio.h> /* for printf() */
718 # #include <unistd.h> /* for open(), lseek(), read() */
719 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
720 # #include <string.h> /* for strdup() */
722 # static unsigned int
723 # pe_get16 (fd, offset)
724 # int fd;
725 # int offset;
727 # unsigned char b[2];
728 # lseek (fd, offset, SEEK_SET);
729 # read (fd, b, 2);
730 # return b[0] + (b[1]<<8);
733 # static unsigned int
734 # pe_get32 (fd, offset)
735 # int fd;
736 # int offset;
738 # unsigned char b[4];
739 # lseek (fd, offset, SEEK_SET);
740 # read (fd, b, 4);
741 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
744 # static unsigned int
745 # pe_as32 (ptr)
746 # void *ptr;
748 # unsigned char *b = ptr;
749 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
752 # int
753 # main (argc, argv)
754 # int argc;
755 # char *argv[];
757 # int dll;
758 # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
759 # unsigned long export_rva, export_size, nsections, secptr, expptr;
760 # unsigned long name_rvas, nexp;
761 # unsigned char *expdata, *erva;
762 # char *filename, *dll_name;
764 # filename = argv[1];
766 # dll = open(filename, O_RDONLY|O_BINARY);
767 # if (!dll)
768 # return 1;
770 # dll_name = filename;
772 # for (i=0; filename[i]; i++)
773 # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
774 # dll_name = filename + i +1;
776 # pe_header_offset = pe_get32 (dll, 0x3c);
777 # opthdr_ofs = pe_header_offset + 4 + 20;
778 # num_entries = pe_get32 (dll, opthdr_ofs + 92);
780 # if (num_entries < 1) /* no exports */
781 # return 1;
783 # export_rva = pe_get32 (dll, opthdr_ofs + 96);
784 # export_size = pe_get32 (dll, opthdr_ofs + 100);
785 # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
786 # secptr = (pe_header_offset + 4 + 20 +
787 # pe_get16 (dll, pe_header_offset + 4 + 16));
789 # expptr = 0;
790 # for (i = 0; i < nsections; i++)
792 # char sname[8];
793 # unsigned long secptr1 = secptr + 40 * i;
794 # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
795 # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
796 # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
797 # lseek(dll, secptr1, SEEK_SET);
798 # read(dll, sname, 8);
799 # if (vaddr <= export_rva && vaddr+vsize > export_rva)
801 # expptr = fptr + (export_rva - vaddr);
802 # if (export_rva + export_size > vaddr + vsize)
803 # export_size = vsize - (export_rva - vaddr);
804 # break;
808 # expdata = (unsigned char*)malloc(export_size);
809 # lseek (dll, expptr, SEEK_SET);
810 # read (dll, expdata, export_size);
811 # erva = expdata - export_rva;
813 # nexp = pe_as32 (expdata+24);
814 # name_rvas = pe_as32 (expdata+32);
816 # printf ("EXPORTS\n");
817 # for (i = 0; i<nexp; i++)
819 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
820 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
823 # return 0;
825 # /* impgen.c ends here */
828 allow_undefined=yes
830 esac
831 compile_command="$nonopt"
832 finalize_command="$nonopt"
834 compile_rpath=
835 finalize_rpath=
836 compile_shlibpath=
837 finalize_shlibpath=
838 convenience=
839 old_convenience=
840 deplibs=
841 linkopts=
843 if test -n "$shlibpath_var"; then
844 # get the directories listed in $shlibpath_var
845 eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
846 else
847 lib_search_path=
849 # now prepend the system-specific ones
850 eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
851 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
853 avoid_version=no
854 dlfiles=
855 dlprefiles=
856 dlself=no
857 export_dynamic=no
858 export_symbols=
859 export_symbols_regex=
860 generated=
861 libobjs=
862 link_against_libtool_libs=
863 ltlibs=
864 module=no
865 objs=
866 prefer_static_libs=no
867 preload=no
868 prev=
869 prevarg=
870 release=
871 rpath=
872 xrpath=
873 perm_rpath=
874 temp_rpath=
875 thread_safe=no
876 vinfo=
878 # We need to know -static, to get the right output filenames.
879 for arg
881 case "$arg" in
882 -all-static | -static)
883 if test "X$arg" = "X-all-static"; then
884 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
885 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
887 if test -n "$link_static_flag"; then
888 dlopen_self=$dlopen_self_static
890 else
891 if test -z "$pic_flag" && test -n "$link_static_flag"; then
892 dlopen_self=$dlopen_self_static
895 build_libtool_libs=no
896 build_old_libs=yes
897 prefer_static_libs=yes
898 break
900 esac
901 done
903 # See if our shared archives depend on static archives.
904 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
906 # Go through the arguments, transforming them on the way.
907 while test $# -gt 0; do
908 arg="$1"
909 shift
911 # If the previous option needs an argument, assign it.
912 if test -n "$prev"; then
913 case "$prev" in
914 output)
915 compile_command="$compile_command @OUTPUT@"
916 finalize_command="$finalize_command @OUTPUT@"
918 esac
920 case "$prev" in
921 dlfiles|dlprefiles)
922 if test "$preload" = no; then
923 # Add the symbol object into the linking commands.
924 compile_command="$compile_command @SYMFILE@"
925 finalize_command="$finalize_command @SYMFILE@"
926 preload=yes
928 case "$arg" in
929 *.la | *.lo) ;; # We handle these cases below.
930 force)
931 if test "$dlself" = no; then
932 dlself=needless
933 export_dynamic=yes
935 prev=
936 continue
938 self)
939 if test "$prev" = dlprefiles; then
940 dlself=yes
941 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
942 dlself=yes
943 else
944 dlself=needless
945 export_dynamic=yes
947 prev=
948 continue
951 if test "$prev" = dlfiles; then
952 dlfiles="$dlfiles $arg"
953 else
954 dlprefiles="$dlprefiles $arg"
956 prev=
958 esac
960 expsyms)
961 export_symbols="$arg"
962 if test ! -f "$arg"; then
963 $echo "$modename: symbol file \`$arg' does not exist"
964 exit 1
966 prev=
967 continue
969 expsyms_regex)
970 export_symbols_regex="$arg"
971 prev=
972 continue
974 release)
975 release="-$arg"
976 prev=
977 continue
979 rpath | xrpath)
980 # We need an absolute path.
981 case "$arg" in
982 [\\/]* | [A-Za-z]:[\\/]*) ;;
984 $echo "$modename: only absolute run-paths are allowed" 1>&2
985 exit 1
987 esac
988 if test "$prev" = rpath; then
989 case "$rpath " in
990 *" $arg "*) ;;
991 *) rpath="$rpath $arg" ;;
992 esac
993 else
994 case "$xrpath " in
995 *" $arg "*) ;;
996 *) xrpath="$xrpath $arg" ;;
997 esac
999 prev=
1000 continue
1003 eval "$prev=\"\$arg\""
1004 prev=
1005 continue
1007 esac
1010 prevarg="$arg"
1012 case "$arg" in
1013 -all-static)
1014 if test -n "$link_static_flag"; then
1015 compile_command="$compile_command $link_static_flag"
1016 finalize_command="$finalize_command $link_static_flag"
1018 continue
1021 -allow-undefined)
1022 # FIXME: remove this flag sometime in the future.
1023 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1024 continue
1027 -avoid-version)
1028 avoid_version=yes
1029 continue
1032 -dlopen)
1033 prev=dlfiles
1034 continue
1037 -dlpreopen)
1038 prev=dlprefiles
1039 continue
1042 -export-dynamic)
1043 export_dynamic=yes
1044 continue
1047 -export-symbols | -export-symbols-regex)
1048 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1049 $echo "$modename: not more than one -exported-symbols argument allowed"
1050 exit 1
1052 if test "X$arg" = "X-export-symbols"; then
1053 prev=expsyms
1054 else
1055 prev=expsyms_regex
1057 continue
1060 -L*)
1061 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1062 # We need an absolute path.
1063 case "$dir" in
1064 [\\/]* | [A-Za-z]:[\\/]*) ;;
1066 absdir=`cd "$dir" && pwd`
1067 if test -z "$absdir"; then
1068 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1069 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1070 absdir="$dir"
1072 dir="$absdir"
1074 esac
1075 case " $deplibs " in
1076 *" $arg "*) ;;
1077 *) deplibs="$deplibs $arg";;
1078 esac
1079 case " $lib_search_path " in
1080 *" $dir "*) ;;
1081 *) lib_search_path="$lib_search_path $dir";;
1082 esac
1083 case "$host" in
1084 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1085 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1086 case ":$dllsearchpath:" in
1087 ::) dllsearchpath="$dllsearchdir";;
1088 *":$dllsearchdir:"*) ;;
1089 *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1090 esac
1092 esac
1095 -l*)
1096 if test "$arg" = "-lc"; then
1097 case "$host" in
1098 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1099 # These systems don't actually have c library (as such)
1100 continue
1102 esac
1103 elif test "$arg" = "-lm"; then
1104 case "$host" in
1105 *-*-cygwin* | *-*-beos*)
1106 # These systems don't actually have math library (as such)
1107 continue
1109 esac
1111 deplibs="$deplibs $arg"
1114 -module)
1115 module=yes
1116 continue
1119 -no-undefined)
1120 allow_undefined=no
1121 continue
1124 -o) prev=output ;;
1126 -release)
1127 prev=release
1128 continue
1131 -rpath)
1132 prev=rpath
1133 continue
1137 prev=xrpath
1138 continue
1141 -R*)
1142 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1143 # We need an absolute path.
1144 case "$dir" in
1145 [\\/]* | [A-Za-z]:[\\/]*) ;;
1147 $echo "$modename: only absolute run-paths are allowed" 1>&2
1148 exit 1
1150 esac
1151 case "$xrpath " in
1152 *" $dir "*) ;;
1153 *) xrpath="$xrpath $dir" ;;
1154 esac
1155 continue
1158 -static)
1159 # If we have no pic_flag, then this is the same as -all-static.
1160 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1161 compile_command="$compile_command $link_static_flag"
1162 finalize_command="$finalize_command $link_static_flag"
1164 continue
1167 -thread-safe)
1168 thread_safe=yes
1169 continue
1172 -version-info)
1173 prev=vinfo
1174 continue
1177 # Some other compiler flag.
1178 -* | +*)
1179 # Unknown arguments in both finalize_command and compile_command need
1180 # to be aesthetically quoted because they are evaled later.
1181 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1182 case "$arg" in
1183 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1184 arg="\"$arg\""
1186 esac
1189 *.o | *.obj | *.a | *.lib)
1190 # A standard object.
1191 objs="$objs $arg"
1194 *.lo)
1195 # A library object.
1196 if test "$prev" = dlfiles; then
1197 dlfiles="$dlfiles $arg"
1198 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1199 prev=
1200 continue
1201 else
1202 # If libtool objects are unsupported, then we need to preload.
1203 prev=dlprefiles
1207 if test "$prev" = dlprefiles; then
1208 # Preload the old-style object.
1209 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1210 prev=
1212 libobjs="$libobjs $arg"
1215 *.la)
1216 # A libtool-controlled library.
1218 dlname=
1219 libdir=
1220 library_names=
1221 old_library=
1223 # Check to see that this really is a libtool archive.
1224 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1225 else
1226 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1227 exit 1
1230 # If the library was installed with an old release of libtool,
1231 # it will not redefine variable installed.
1232 installed=yes
1234 # Read the .la file
1235 # If there is no directory component, then add one.
1236 case "$arg" in
1237 */* | *\\*) . $arg ;;
1238 *) . ./$arg ;;
1239 esac
1241 # Get the name of the library we link against.
1242 linklib=
1243 for l in $old_library $library_names; do
1244 linklib="$l"
1245 done
1247 if test -z "$linklib"; then
1248 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1249 exit 1
1252 # Find the relevant object directory and library name.
1253 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1255 if test "X$installed" = Xyes; then
1256 dir="$libdir"
1257 else
1258 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1259 if test "X$dir" = "X$arg"; then
1260 dir="$objdir"
1261 else
1262 dir="$dir/$objdir"
1266 if test -n "$dependency_libs"; then
1267 # Extract -R and -L from dependency_libs
1268 temp_deplibs=
1269 for deplib in $dependency_libs; do
1270 case "$deplib" in
1271 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1272 case " $rpath $xrpath " in
1273 *" $temp_xrpath "*) ;;
1274 *) xrpath="$xrpath $temp_xrpath";;
1275 esac;;
1276 -L*) case "$compile_command $temp_deplibs " in
1277 *" $deplib "*) ;;
1278 *) temp_deplibs="$temp_deplibs $deplib";;
1279 esac
1280 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1281 case " $lib_search_path " in
1282 *" $temp_dir "*) ;;
1283 *) lib_search_path="$lib_search_path $temp_dir";;
1284 esac
1286 *) temp_deplibs="$temp_deplibs $deplib";;
1287 esac
1288 done
1289 dependency_libs="$temp_deplibs"
1292 if test -z "$libdir"; then
1293 # It is a libtool convenience library, so add in its objects.
1294 convenience="$convenience $dir/$old_library"
1295 old_convenience="$old_convenience $dir/$old_library"
1296 deplibs="$deplibs$dependency_libs"
1297 compile_command="$compile_command $dir/$old_library$dependency_libs"
1298 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1299 continue
1302 # This library was specified with -dlopen.
1303 if test "$prev" = dlfiles; then
1304 dlfiles="$dlfiles $arg"
1305 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1306 # If there is no dlname, no dlopen support or we're linking statically,
1307 # we need to preload.
1308 prev=dlprefiles
1309 else
1310 # We should not create a dependency on this library, but we
1311 # may need any libraries it requires.
1312 compile_command="$compile_command$dependency_libs"
1313 finalize_command="$finalize_command$dependency_libs"
1314 prev=
1315 continue
1319 # The library was specified with -dlpreopen.
1320 if test "$prev" = dlprefiles; then
1321 # Prefer using a static library (so that no silly _DYNAMIC symbols
1322 # are required to link).
1323 if test -n "$old_library"; then
1324 dlprefiles="$dlprefiles $dir/$old_library"
1325 else
1326 dlprefiles="$dlprefiles $dir/$linklib"
1328 prev=
1331 if test -n "$library_names" &&
1332 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1333 link_against_libtool_libs="$link_against_libtool_libs $arg"
1334 if test -n "$shlibpath_var"; then
1335 # Make sure the rpath contains only unique directories.
1336 case "$temp_rpath " in
1337 *" $dir "*) ;;
1338 *) temp_rpath="$temp_rpath $dir" ;;
1339 esac
1342 # We need an absolute path.
1343 case "$dir" in
1344 [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1346 absdir=`cd "$dir" && pwd`
1347 if test -z "$absdir"; then
1348 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1349 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1350 absdir="$dir"
1353 esac
1355 # This is the magic to use -rpath.
1356 # Skip directories that are in the system default run-time
1357 # search path, unless they have been requested with -R.
1358 case " $sys_lib_dlsearch_path " in
1359 *" $absdir "*) ;;
1361 case "$compile_rpath " in
1362 *" $absdir "*) ;;
1363 *) compile_rpath="$compile_rpath $absdir"
1364 esac
1366 esac
1368 case " $sys_lib_dlsearch_path " in
1369 *" $libdir "*) ;;
1371 case "$finalize_rpath " in
1372 *" $libdir "*) ;;
1373 *) finalize_rpath="$finalize_rpath $libdir"
1374 esac
1376 esac
1378 lib_linked=yes
1379 case "$hardcode_action" in
1380 immediate | unsupported)
1381 if test "$hardcode_direct" = no; then
1382 compile_command="$compile_command $dir/$linklib"
1383 deplibs="$deplibs $dir/$linklib"
1384 case "$host" in
1385 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1386 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1387 if test -n "$dllsearchpath"; then
1388 dllsearchpath="$dllsearchpath:$dllsearchdir"
1389 else
1390 dllsearchpath="$dllsearchdir"
1393 esac
1394 elif test "$hardcode_minus_L" = no; then
1395 case "$host" in
1396 *-*-sunos*)
1397 compile_shlibpath="$compile_shlibpath$dir:"
1399 esac
1400 case "$compile_command " in
1401 *" -L$dir "*) ;;
1402 *) compile_command="$compile_command -L$dir";;
1403 esac
1404 compile_command="$compile_command -l$name"
1405 deplibs="$deplibs -L$dir -l$name"
1406 elif test "$hardcode_shlibpath_var" = no; then
1407 case ":$compile_shlibpath:" in
1408 *":$dir:"*) ;;
1409 *) compile_shlibpath="$compile_shlibpath$dir:";;
1410 esac
1411 compile_command="$compile_command -l$name"
1412 deplibs="$deplibs -l$name"
1413 else
1414 lib_linked=no
1418 relink)
1419 if test "$hardcode_direct" = yes; then
1420 compile_command="$compile_command $absdir/$linklib"
1421 deplibs="$deplibs $absdir/$linklib"
1422 elif test "$hardcode_minus_L" = yes; then
1423 case "$compile_command " in
1424 *" -L$absdir "*) ;;
1425 *) compile_command="$compile_command -L$absdir";;
1426 esac
1427 compile_command="$compile_command -l$name"
1428 deplibs="$deplibs -L$absdir -l$name"
1429 elif test "$hardcode_shlibpath_var" = yes; then
1430 case ":$compile_shlibpath:" in
1431 *":$absdir:"*) ;;
1432 *) compile_shlibpath="$compile_shlibpath$absdir:";;
1433 esac
1434 compile_command="$compile_command -l$name"
1435 deplibs="$deplibs -l$name"
1436 else
1437 lib_linked=no
1442 lib_linked=no
1444 esac
1446 if test "$lib_linked" != yes; then
1447 $echo "$modename: configuration error: unsupported hardcode properties"
1448 exit 1
1451 # Finalize command for both is simple: just hardcode it.
1452 if test "$hardcode_direct" = yes; then
1453 finalize_command="$finalize_command $libdir/$linklib"
1454 elif test "$hardcode_minus_L" = yes; then
1455 case "$finalize_command " in
1456 *" -L$libdir "*) ;;
1457 *) finalize_command="$finalize_command -L$libdir";;
1458 esac
1459 finalize_command="$finalize_command -l$name"
1460 elif test "$hardcode_shlibpath_var" = yes; then
1461 case ":$finalize_shlibpath:" in
1462 *":$libdir:"*) ;;
1463 *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1464 esac
1465 finalize_command="$finalize_command -l$name"
1466 else
1467 # We cannot seem to hardcode it, guess we'll fake it.
1468 case "$finalize_command " in
1469 *" -L$dir "*) ;;
1470 *) finalize_command="$finalize_command -L$libdir";;
1471 esac
1472 finalize_command="$finalize_command -l$name"
1474 else
1475 # Transform directly to old archives if we don't build new libraries.
1476 if test -n "$pic_flag" && test -z "$old_library"; then
1477 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1478 exit 1
1481 # Here we assume that one of hardcode_direct or hardcode_minus_L
1482 # is not unsupported. This is valid on all known static and
1483 # shared platforms.
1484 if test "$hardcode_direct" != unsupported; then
1485 test -n "$old_library" && linklib="$old_library"
1486 compile_command="$compile_command $dir/$linklib"
1487 finalize_command="$finalize_command $dir/$linklib"
1488 else
1489 case "$compile_command " in
1490 *" -L$dir "*) ;;
1491 *) compile_command="$compile_command -L$dir";;
1492 esac
1493 compile_command="$compile_command -l$name"
1494 case "$finalize_command " in
1495 *" -L$dir "*) ;;
1496 *) finalize_command="$finalize_command -L$dir";;
1497 esac
1498 finalize_command="$finalize_command -l$name"
1502 # Add in any libraries that this one depends upon.
1503 compile_command="$compile_command$dependency_libs"
1504 finalize_command="$finalize_command$dependency_libs"
1505 continue
1508 # Some other compiler argument.
1510 # Unknown arguments in both finalize_command and compile_command need
1511 # to be aesthetically quoted because they are evaled later.
1512 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1513 case "$arg" in
1514 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1515 arg="\"$arg\""
1517 esac
1519 esac
1521 # Now actually substitute the argument into the commands.
1522 if test -n "$arg"; then
1523 compile_command="$compile_command $arg"
1524 finalize_command="$finalize_command $arg"
1526 done
1528 if test -n "$prev"; then
1529 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1530 $echo "$help" 1>&2
1531 exit 1
1534 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1535 eval arg=\"$export_dynamic_flag_spec\"
1536 compile_command="$compile_command $arg"
1537 finalize_command="$finalize_command $arg"
1540 oldlibs=
1541 # calculate the name of the file, without its directory
1542 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1543 libobjs_save="$libobjs"
1545 case "$output" in
1547 $echo "$modename: you must specify an output file" 1>&2
1548 $echo "$help" 1>&2
1549 exit 1
1552 *.a | *.lib)
1553 if test -n "$link_against_libtool_libs"; then
1554 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1555 exit 1
1558 if test -n "$deplibs"; then
1559 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1562 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1563 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1566 if test -n "$rpath"; then
1567 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1570 if test -n "$xrpath"; then
1571 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1574 if test -n "$vinfo"; then
1575 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1578 if test -n "$release"; then
1579 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1582 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1583 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1586 # Now set the variables for building old libraries.
1587 build_libtool_libs=no
1588 oldlibs="$output"
1591 *.la)
1592 # Make sure we only generate libraries of the form `libNAME.la'.
1593 case "$outputname" in
1594 lib*)
1595 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1596 eval libname=\"$libname_spec\"
1599 if test "$module" = no; then
1600 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1601 $echo "$help" 1>&2
1602 exit 1
1604 if test "$need_lib_prefix" != no; then
1605 # Add the "lib" prefix for modules if required
1606 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1607 eval libname=\"$libname_spec\"
1608 else
1609 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1612 esac
1614 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1615 if test "X$output_objdir" = "X$output"; then
1616 output_objdir="$objdir"
1617 else
1618 output_objdir="$output_objdir/$objdir"
1621 if test -n "$objs"; then
1622 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1623 exit 1
1626 # How the heck are we supposed to write a wrapper for a shared library?
1627 if test -n "$link_against_libtool_libs"; then
1628 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1629 exit 1
1632 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1633 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1636 set dummy $rpath
1637 if test $# -gt 2; then
1638 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1640 install_libdir="$2"
1642 oldlibs=
1643 if test -z "$rpath"; then
1644 if test "$build_libtool_libs" = yes; then
1645 # Building a libtool convenience library.
1646 libext=al
1647 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1648 build_libtool_libs=convenience
1649 build_old_libs=yes
1651 dependency_libs="$deplibs"
1653 if test -n "$vinfo"; then
1654 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1657 if test -n "$release"; then
1658 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1660 else
1662 # Parse the version information argument.
1663 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
1664 set dummy $vinfo 0 0 0
1665 IFS="$save_ifs"
1667 if test -n "$8"; then
1668 $echo "$modename: too many parameters to \`-version-info'" 1>&2
1669 $echo "$help" 1>&2
1670 exit 1
1673 current="$2"
1674 revision="$3"
1675 age="$4"
1677 # Check that each of the things are valid numbers.
1678 case "$current" in
1679 0 | [1-9] | [1-9][0-9]*) ;;
1681 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1682 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1683 exit 1
1685 esac
1687 case "$revision" in
1688 0 | [1-9] | [1-9][0-9]*) ;;
1690 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1691 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1692 exit 1
1694 esac
1696 case "$age" in
1697 0 | [1-9] | [1-9][0-9]*) ;;
1699 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1700 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1701 exit 1
1703 esac
1705 if test $age -gt $current; then
1706 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1707 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1708 exit 1
1711 # Calculate the version variables.
1712 major=
1713 versuffix=
1714 verstring=
1715 case "$version_type" in
1716 none) ;;
1718 irix)
1719 major=`expr $current - $age + 1`
1720 versuffix="$major.$revision"
1721 verstring="sgi$major.$revision"
1723 # Add in all the interfaces that we are compatible with.
1724 loop=$revision
1725 while test $loop != 0; do
1726 iface=`expr $revision - $loop`
1727 loop=`expr $loop - 1`
1728 verstring="sgi$major.$iface:$verstring"
1729 done
1732 linux)
1733 major=.`expr $current - $age`
1734 versuffix="$major.$age.$revision"
1737 osf)
1738 major=`expr $current - $age`
1739 versuffix=".$current.$age.$revision"
1740 verstring="$current.$age.$revision"
1742 # Add in all the interfaces that we are compatible with.
1743 loop=$age
1744 while test $loop != 0; do
1745 iface=`expr $current - $loop`
1746 loop=`expr $loop - 1`
1747 verstring="$verstring:${iface}.0"
1748 done
1750 # Make executables depend on our current version.
1751 verstring="$verstring:${current}.0"
1754 sunos)
1755 major=".$current"
1756 versuffix=".$current.$revision"
1759 freebsd-aout)
1760 major=".$current"
1761 versuffix=".$current.$revision";
1764 freebsd-elf)
1765 major=".$current"
1766 versuffix=".$current";
1769 windows)
1770 # Like Linux, but with '-' rather than '.', since we only
1771 # want one extension on Windows 95.
1772 major=`expr $current - $age`
1773 versuffix="-$major-$age-$revision"
1777 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1778 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1779 exit 1
1781 esac
1783 # Clear the version info if we defaulted, and they specified a release.
1784 if test -z "$vinfo" && test -n "$release"; then
1785 major=
1786 verstring="0.0"
1787 if test "$need_version" = no; then
1788 versuffix=
1789 else
1790 versuffix=".0.0"
1794 # Remove version info from name if versioning should be avoided
1795 if test "$avoid_version" = yes && test "$need_version" = no; then
1796 major=
1797 versuffix=
1798 verstring=""
1801 # Check to see if the archive will have undefined symbols.
1802 if test "$allow_undefined" = yes; then
1803 if test "$allow_undefined_flag" = unsupported; then
1804 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1805 build_libtool_libs=no
1806 build_old_libs=yes
1808 else
1809 # Don't allow undefined symbols.
1810 allow_undefined_flag="$no_undefined_flag"
1813 dependency_libs="$deplibs"
1814 case "$host" in
1815 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1816 # these systems don't actually have a c library (as such)!
1819 # Add libc to deplibs on all other systems.
1820 deplibs="$deplibs -lc"
1822 esac
1825 # Create the output directory, or remove our outputs if we need to.
1826 if test -d $output_objdir; then
1827 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1828 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1829 else
1830 $show "$mkdir $output_objdir"
1831 $run $mkdir $output_objdir
1832 status=$?
1833 if test $status -ne 0 && test ! -d $output_objdir; then
1834 exit $status
1838 # Now set the variables for building old libraries.
1839 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1840 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1842 # Transform .lo files to .o files.
1843 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1846 if test "$build_libtool_libs" = yes; then
1847 # Transform deplibs into only deplibs that can be linked in shared.
1848 name_save=$name
1849 libname_save=$libname
1850 release_save=$release
1851 versuffix_save=$versuffix
1852 major_save=$major
1853 # I'm not sure if I'm treating the release correctly. I think
1854 # release should show up in the -l (ie -lgmp5) so we don't want to
1855 # add it in twice. Is that correct?
1856 release=""
1857 versuffix=""
1858 major=""
1859 newdeplibs=
1860 droppeddeps=no
1861 case "$deplibs_check_method" in
1862 pass_all)
1863 # Don't check for shared/static. Everything works.
1864 # This might be a little naive. We might want to check
1865 # whether the library exists or not. But this is on
1866 # osf3 & osf4 and I'm not really sure... Just
1867 # implementing what was already the behaviour.
1868 newdeplibs=$deplibs
1870 test_compile)
1871 # This code stresses the "libraries are programs" paradigm to its
1872 # limits. Maybe even breaks it. We compile a program, linking it
1873 # against the deplibs as a proxy for the library. Then we can check
1874 # whether they linked in statically or dynamically with ldd.
1875 $rm conftest.c
1876 cat > conftest.c <<EOF
1877 int main() { return 0; }
1879 $rm conftest
1880 $CC -o conftest conftest.c $deplibs
1881 if test $? -eq 0 ; then
1882 ldd_output=`ldd conftest`
1883 for i in $deplibs; do
1884 name="`expr $i : '-l\(.*\)'`"
1885 # If $name is empty we are operating on a -L argument.
1886 if test "$name" != "" ; then
1887 libname=`eval \\$echo \"$libname_spec\"`
1888 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1889 set dummy $deplib_matches
1890 deplib_match=$2
1891 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1892 newdeplibs="$newdeplibs $i"
1893 else
1894 droppeddeps=yes
1895 echo
1896 echo "*** Warning: This library needs some functionality provided by $i."
1897 echo "*** I have the capability to make that library automatically link in when"
1898 echo "*** you link to this library. But I can only do this if you have a"
1899 echo "*** shared version of the library, which you do not appear to have."
1901 else
1902 newdeplibs="$newdeplibs $i"
1904 done
1905 else
1906 # Error occured in the first compile. Let's try to salvage the situation:
1907 # Compile a seperate program for each library.
1908 for i in $deplibs; do
1909 name="`expr $i : '-l\(.*\)'`"
1910 # If $name is empty we are operating on a -L argument.
1911 if test "$name" != "" ; then
1912 $rm conftest
1913 $CC -o conftest conftest.c $i
1914 # Did it work?
1915 if test $? -eq 0 ; then
1916 ldd_output=`ldd conftest`
1917 libname=`eval \\$echo \"$libname_spec\"`
1918 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1919 set dummy $deplib_matches
1920 deplib_match=$2
1921 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1922 newdeplibs="$newdeplibs $i"
1923 else
1924 droppeddeps=yes
1925 echo
1926 echo "*** Warning: This library needs some functionality provided by $i."
1927 echo "*** I have the capability to make that library automatically link in when"
1928 echo "*** you link to this library. But I can only do this if you have a"
1929 echo "*** shared version of the library, which you do not appear to have."
1931 else
1932 droppeddeps=yes
1933 echo
1934 echo "*** Warning! Library $i is needed by this library but I was not able to"
1935 echo "*** make it link in! You will probably need to install it or some"
1936 echo "*** library that it depends on before this library will be fully"
1937 echo "*** functional. Installing it before continuing would be even better."
1939 else
1940 newdeplibs="$newdeplibs $i"
1942 done
1945 file_magic*)
1946 set dummy $deplibs_check_method
1947 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
1948 for a_deplib in $deplibs; do
1949 name="`expr $a_deplib : '-l\(.*\)'`"
1950 # If $name is empty we are operating on a -L argument.
1951 if test "$name" != "" ; then
1952 libname=`eval \\$echo \"$libname_spec\"`
1953 for i in $lib_search_path; do
1954 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1955 for potent_lib in $potential_libs; do
1956 # Follow soft links.
1957 if ls -lLd "$potent_lib" 2>/dev/null \
1958 | grep " -> " >/dev/null; then
1959 continue
1961 # The statement above tries to avoid entering an
1962 # endless loop below, in case of cyclic links.
1963 # We might still enter an endless loop, since a link
1964 # loop can be closed while we follow links,
1965 # but so what?
1966 potlib="$potent_lib"
1967 while test -h "$potlib" 2>/dev/null; do
1968 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1969 case "$potliblink" in
1970 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
1971 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1972 esac
1973 done
1974 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
1975 | sed 10q \
1976 | egrep "$file_magic_regex" > /dev/null; then
1977 newdeplibs="$newdeplibs $a_deplib"
1978 a_deplib=""
1979 break 2
1981 done
1982 done
1983 if test -n "$a_deplib" ; then
1984 droppeddeps=yes
1985 echo
1986 echo "*** Warning: This library needs some functionality provided by $a_deplib."
1987 echo "*** I have the capability to make that library automatically link in when"
1988 echo "*** you link to this library. But I can only do this if you have a"
1989 echo "*** shared version of the library, which you do not appear to have."
1991 else
1992 # Add a -L argument.
1993 newdeplibs="$newdeplibs $a_deplib"
1995 done # Gone through all deplibs.
1997 none | unknown | *)
1998 newdeplibs=""
1999 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2000 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2001 grep . >/dev/null; then
2002 echo
2003 if test "X$deplibs_check_method" = "Xnone"; then
2004 echo "*** Warning: inter-library dependencies are not supported in this platform."
2005 else
2006 echo "*** Warning: inter-library dependencies are not known to be supported."
2008 echo "*** All declared inter-library dependencies are being dropped."
2009 droppeddeps=yes
2012 esac
2013 versuffix=$versuffix_save
2014 major=$major_save
2015 release=$release_save
2016 libname=$libname_save
2017 name=$name_save
2019 if test "$droppeddeps" = yes; then
2020 if test "$module" = yes; then
2021 echo
2022 echo "*** Warning: libtool could not satisfy all declared inter-library"
2023 echo "*** dependencies of module $libname. Therefore, libtool will create"
2024 echo "*** a static module, that should work as long as the dlopening"
2025 echo "*** application is linked with the -dlopen flag."
2026 if test -z "$global_symbol_pipe"; then
2027 echo
2028 echo "*** However, this would only work if libtool was able to extract symbol"
2029 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2030 echo "*** not find such a program. So, this module is probably useless."
2031 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2033 if test "$build_old_libs" = no; then
2034 oldlibs="$output_objdir/$libname.$libext"
2035 build_libtool_libs=module
2036 build_old_libs=yes
2037 else
2038 build_libtool_libs=no
2040 else
2041 echo "*** The inter-library dependencies that have been dropped here will be"
2042 echo "*** automatically added whenever a program is linked with this library"
2043 echo "*** or is declared to -dlopen it."
2046 # Done checking deplibs!
2047 deplibs=$newdeplibs
2050 # All the library-specific variables (install_libdir is set above).
2051 library_names=
2052 old_library=
2053 dlname=
2055 # Test again, we may have decided not to build it any more
2056 if test "$build_libtool_libs" = yes; then
2057 # Get the real and link names of the library.
2058 eval library_names=\"$library_names_spec\"
2059 set dummy $library_names
2060 realname="$2"
2061 shift; shift
2063 if test -n "$soname_spec"; then
2064 eval soname=\"$soname_spec\"
2065 else
2066 soname="$realname"
2069 lib="$output_objdir/$realname"
2070 for link
2072 linknames="$linknames $link"
2073 done
2075 # Ensure that we have .o objects for linkers which dislike .lo
2076 # (e.g. aix) in case we are running --disable-static
2077 for obj in $libobjs; do
2078 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2079 if test "X$xdir" = "X$obj"; then
2080 xdir="."
2081 else
2082 xdir="$xdir"
2084 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2085 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2086 if test ! -f $xdir/$oldobj; then
2087 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2088 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2090 done
2092 # Use standard objects if they are pic
2093 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2095 # Prepare the list of exported symbols
2096 if test -z "$export_symbols"; then
2097 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2098 $show "generating symbol list for \`$libname.la'"
2099 export_symbols="$output_objdir/$libname.exp"
2100 $run $rm $export_symbols
2101 eval cmds=\"$export_symbols_cmds\"
2102 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2103 for cmd in $cmds; do
2104 IFS="$save_ifs"
2105 $show "$cmd"
2106 $run eval "$cmd" || exit $?
2107 done
2108 IFS="$save_ifs"
2109 if test -n "$export_symbols_regex"; then
2110 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2111 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2112 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2113 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2118 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2119 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2122 if test -n "$convenience"; then
2123 if test -n "$whole_archive_flag_spec"; then
2124 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2125 else
2126 gentop="$output_objdir/${outputname}x"
2127 $show "${rm}r $gentop"
2128 $run ${rm}r "$gentop"
2129 $show "mkdir $gentop"
2130 $run mkdir "$gentop"
2131 status=$?
2132 if test $status -ne 0 && test ! -d "$gentop"; then
2133 exit $status
2135 generated="$generated $gentop"
2137 for xlib in $convenience; do
2138 # Extract the objects.
2139 case "$xlib" in
2140 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2141 *) xabs=`pwd`"/$xlib" ;;
2142 esac
2143 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2144 xdir="$gentop/$xlib"
2146 $show "${rm}r $xdir"
2147 $run ${rm}r "$xdir"
2148 $show "mkdir $xdir"
2149 $run mkdir "$xdir"
2150 status=$?
2151 if test $status -ne 0 && test ! -d "$xdir"; then
2152 exit $status
2154 $show "(cd $xdir && $AR x $xabs)"
2155 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2157 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2158 done
2162 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2163 eval flag=\"$thread_safe_flag_spec\"
2164 linkopts="$linkopts $flag"
2167 # Do each of the archive commands.
2168 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2169 eval cmds=\"$archive_expsym_cmds\"
2170 else
2171 eval cmds=\"$archive_cmds\"
2173 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2174 for cmd in $cmds; do
2175 IFS="$save_ifs"
2176 $show "$cmd"
2177 $run eval "$cmd" || exit $?
2178 done
2179 IFS="$save_ifs"
2181 # Create links to the real library.
2182 for linkname in $linknames; do
2183 if test "$realname" != "$linkname"; then
2184 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2185 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2187 done
2189 # If -module or -export-dynamic was specified, set the dlname.
2190 if test "$module" = yes || test "$export_dynamic" = yes; then
2191 # On all known operating systems, these are identical.
2192 dlname="$soname"
2197 *.lo | *.o | *.obj)
2198 if test -n "$link_against_libtool_libs"; then
2199 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2200 exit 1
2203 if test -n "$deplibs"; then
2204 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2207 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2208 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2211 if test -n "$rpath"; then
2212 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2215 if test -n "$xrpath"; then
2216 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2219 if test -n "$vinfo"; then
2220 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2223 if test -n "$release"; then
2224 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2227 case "$output" in
2228 *.lo)
2229 if test -n "$objs"; then
2230 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2231 exit 1
2233 libobj="$output"
2234 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2237 libobj=
2238 obj="$output"
2240 esac
2242 # Delete the old objects.
2243 $run $rm $obj $libobj
2245 # Objects from convenience libraries. This assumes
2246 # single-version convenience libraries. Whenever we create
2247 # different ones for PIC/non-PIC, this we'll have to duplicate
2248 # the extraction.
2249 reload_conv_objs=
2250 gentop=
2251 # reload_cmds runs $LD directly, so let us get rid of
2252 # -Wl from whole_archive_flag_spec
2253 wl=
2255 if test -n "$convenience"; then
2256 if test -n "$whole_archive_flag_spec"; then
2257 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2258 else
2259 gentop="$output_objdir/${obj}x"
2260 $show "${rm}r $gentop"
2261 $run ${rm}r "$gentop"
2262 $show "mkdir $gentop"
2263 $run mkdir "$gentop"
2264 status=$?
2265 if test $status -ne 0 && test ! -d "$gentop"; then
2266 exit $status
2268 generated="$generated $gentop"
2270 for xlib in $convenience; do
2271 # Extract the objects.
2272 case "$xlib" in
2273 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2274 *) xabs=`pwd`"/$xlib" ;;
2275 esac
2276 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2277 xdir="$gentop/$xlib"
2279 $show "${rm}r $xdir"
2280 $run ${rm}r "$xdir"
2281 $show "mkdir $xdir"
2282 $run mkdir "$xdir"
2283 status=$?
2284 if test $status -ne 0 && test ! -d "$xdir"; then
2285 exit $status
2287 $show "(cd $xdir && $AR x $xabs)"
2288 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2290 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2291 done
2295 # Create the old-style object.
2296 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
2298 output="$obj"
2299 eval cmds=\"$reload_cmds\"
2300 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2301 for cmd in $cmds; do
2302 IFS="$save_ifs"
2303 $show "$cmd"
2304 $run eval "$cmd" || exit $?
2305 done
2306 IFS="$save_ifs"
2308 # Exit if we aren't doing a library object file.
2309 if test -z "$libobj"; then
2310 if test -n "$gentop"; then
2311 $show "${rm}r $gentop"
2312 $run ${rm}r $gentop
2315 exit 0
2318 if test "$build_libtool_libs" != yes; then
2319 if test -n "$gentop"; then
2320 $show "${rm}r $gentop"
2321 $run ${rm}r $gentop
2324 # Create an invalid libtool object if no PIC, so that we don't
2325 # accidentally link it into a program.
2326 $show "echo timestamp > $libobj"
2327 $run eval "echo timestamp > $libobj" || exit $?
2328 exit 0
2331 if test -n "$pic_flag"; then
2332 # Only do commands if we really have different PIC objects.
2333 reload_objs="$libobjs $reload_conv_objs"
2334 output="$libobj"
2335 eval cmds=\"$reload_cmds\"
2336 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2337 for cmd in $cmds; do
2338 IFS="$save_ifs"
2339 $show "$cmd"
2340 $run eval "$cmd" || exit $?
2341 done
2342 IFS="$save_ifs"
2343 else
2344 # Just create a symlink.
2345 $show $rm $libobj
2346 $run $rm $libobj
2347 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
2348 if test "X$xdir" = "X$libobj"; then
2349 xdir="."
2350 else
2351 xdir="$xdir"
2353 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
2354 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2355 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
2356 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
2359 if test -n "$gentop"; then
2360 $show "${rm}r $gentop"
2361 $run ${rm}r $gentop
2364 exit 0
2367 # Anything else should be a program.
2369 if test -n "$vinfo"; then
2370 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2373 if test -n "$release"; then
2374 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2377 if test "$preload" = yes; then
2378 if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2379 test "$dlopen_self_static" = unknown; then
2380 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2384 if test -n "$rpath$xrpath"; then
2385 # If the user specified any rpath flags, then add them.
2386 for libdir in $rpath $xrpath; do
2387 # This is the magic to use -rpath.
2388 case "$compile_rpath " in
2389 *" $libdir "*) ;;
2390 *) compile_rpath="$compile_rpath $libdir" ;;
2391 esac
2392 case "$finalize_rpath " in
2393 *" $libdir "*) ;;
2394 *) finalize_rpath="$finalize_rpath $libdir" ;;
2395 esac
2396 done
2399 # Now hardcode the library paths
2400 rpath=
2401 hardcode_libdirs=
2402 for libdir in $compile_rpath $finalize_rpath; do
2403 if test -n "$hardcode_libdir_flag_spec"; then
2404 if test -n "$hardcode_libdir_separator"; then
2405 if test -z "$hardcode_libdirs"; then
2406 hardcode_libdirs="$libdir"
2407 else
2408 # Just accumulate the unique libdirs.
2409 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2410 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2413 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2415 esac
2417 else
2418 eval flag=\"$hardcode_libdir_flag_spec\"
2419 rpath="$rpath $flag"
2421 elif test -n "$runpath_var"; then
2422 case "$perm_rpath " in
2423 *" $libdir "*) ;;
2424 *) perm_rpath="$perm_rpath $libdir" ;;
2425 esac
2427 done
2428 # Substitute the hardcoded libdirs into the rpath.
2429 if test -n "$hardcode_libdir_separator" &&
2430 test -n "$hardcode_libdirs"; then
2431 libdir="$hardcode_libdirs"
2432 eval rpath=\" $hardcode_libdir_flag_spec\"
2434 compile_rpath="$rpath"
2436 rpath=
2437 hardcode_libdirs=
2438 for libdir in $finalize_rpath; do
2439 if test -n "$hardcode_libdir_flag_spec"; then
2440 if test -n "$hardcode_libdir_separator"; then
2441 if test -z "$hardcode_libdirs"; then
2442 hardcode_libdirs="$libdir"
2443 else
2444 # Just accumulate the unique libdirs.
2445 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2446 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2449 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2451 esac
2453 else
2454 eval flag=\"$hardcode_libdir_flag_spec\"
2455 rpath="$rpath $flag"
2457 elif test -n "$runpath_var"; then
2458 case "$finalize_perm_rpath " in
2459 *" $libdir "*) ;;
2460 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2461 esac
2463 done
2464 # Substitute the hardcoded libdirs into the rpath.
2465 if test -n "$hardcode_libdir_separator" &&
2466 test -n "$hardcode_libdirs"; then
2467 libdir="$hardcode_libdirs"
2468 eval rpath=\" $hardcode_libdir_flag_spec\"
2470 finalize_rpath="$rpath"
2472 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2473 if test "X$output_objdir" = "X$output"; then
2474 output_objdir="$objdir"
2475 else
2476 output_objdir="$output_objdir/$objdir"
2479 # Create the binary in the object directory, then wrap it.
2480 if test ! -d $output_objdir; then
2481 $show "$mkdir $output_objdir"
2482 $run $mkdir $output_objdir
2483 status=$?
2484 if test $status -ne 0 && test ! -d $output_objdir; then
2485 exit $status
2489 if test -n "$libobjs" && test "$build_old_libs" = yes; then
2490 # Transform all the library objects into standard objects.
2491 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2492 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2495 dlsyms=
2496 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2497 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2498 dlsyms="${outputname}S.c"
2499 else
2500 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2504 if test -n "$dlsyms"; then
2505 case "$dlsyms" in
2506 "") ;;
2507 *.c)
2508 # Discover the nlist of each of the dlfiles.
2509 nlist="$output_objdir/${outputname}.nm"
2511 $show "$rm $nlist ${nlist}S ${nlist}T"
2512 $run $rm "$nlist" "${nlist}S" "${nlist}T"
2514 # Parse the name list into a source file.
2515 $show "creating $output_objdir/$dlsyms"
2517 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
2518 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2519 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2521 #ifdef __cplusplus
2522 extern \"C\" {
2523 #endif
2525 /* Prevent the only kind of declaration conflicts we can make. */
2526 #define lt_preloaded_symbols some_other_symbol
2528 /* External symbol declarations for the compiler. */\
2531 if test "$dlself" = yes; then
2532 $show "generating symbol list for \`$output'"
2534 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2536 # Add our own program objects to the symbol list.
2537 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2538 for arg in $progfiles; do
2539 $show "extracting global C symbols from \`$arg'"
2540 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2541 done
2543 if test -n "$exclude_expsyms"; then
2544 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2545 $run eval '$mv "$nlist"T "$nlist"'
2548 if test -n "$export_symbols_regex"; then
2549 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2550 $run eval '$mv "$nlist"T "$nlist"'
2553 # Prepare the list of exported symbols
2554 if test -z "$export_symbols"; then
2555 export_symbols="$output_objdir/$output.exp"
2556 $run $rm $export_symbols
2557 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2558 else
2559 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2560 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2561 $run eval 'mv "$nlist"T "$nlist"'
2565 for arg in $dlprefiles; do
2566 $show "extracting global C symbols from \`$arg'"
2567 name=`echo "$arg" | sed -e 's%^.*/%%'`
2568 $run eval 'echo ": $name " >> "$nlist"'
2569 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2570 done
2572 if test -z "$run"; then
2573 # Make sure we have at least an empty file.
2574 test -f "$nlist" || : > "$nlist"
2576 if test -n "$exclude_expsyms"; then
2577 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2578 $mv "$nlist"T "$nlist"
2581 # Try sorting and uniquifying the output.
2582 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2584 else
2585 grep -v "^: " < "$nlist" > "$nlist"S
2588 if test -f "$nlist"S; then
2589 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2590 else
2591 echo '/* NONE */' >> "$output_objdir/$dlsyms"
2594 $echo >> "$output_objdir/$dlsyms" "\
2596 #undef lt_preloaded_symbols
2598 #if defined (__STDC__) && __STDC__
2599 # define lt_ptr_t void *
2600 #else
2601 # define lt_ptr_t char *
2602 # define const
2603 #endif
2605 /* The mapping between symbol names and symbols. */
2606 const struct {
2607 const char *name;
2608 lt_ptr_t address;
2610 lt_preloaded_symbols[] =
2614 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
2615 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
2616 < "$nlist" >> "$output_objdir/$dlsyms"
2618 $echo >> "$output_objdir/$dlsyms" "\
2619 {0, (lt_ptr_t) 0}
2622 /* This works around a problem in FreeBSD linker */
2623 #ifdef FREEBSD_WORKAROUND
2624 static const void *lt_preloaded_setup() {
2625 return lt_preloaded_symbols;
2627 #endif
2629 #ifdef __cplusplus
2631 #endif\
2635 pic_flag_for_symtable=
2636 case "$host" in
2637 # compiling the symbol table file with pic_flag works around
2638 # a FreeBSD bug that causes programs to crash when -lm is
2639 # linked before any other PIC object. But we must not use
2640 # pic_flag when linking with -static. The problem exists in
2641 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2642 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2643 case "$compile_command " in
2644 *" -static "*) ;;
2645 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2646 esac;;
2647 *-*-hpux*)
2648 case "$compile_command " in
2649 *" -static "*) ;;
2650 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
2651 esac
2652 esac
2654 # Now compile the dynamic symbol file.
2655 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2656 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2658 # Clean up the generated files.
2659 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2660 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
2662 # Transform the symbol file into the correct name.
2663 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2664 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2667 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2668 exit 1
2670 esac
2671 else
2672 # We keep going just in case the user didn't refer to
2673 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2674 # really was required.
2676 # Nullify the symbol file.
2677 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2678 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2681 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2682 # Replace the output file specification.
2683 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2684 link_command="$compile_command$compile_rpath"
2686 # We have no uninstalled library dependencies, so finalize right now.
2687 $show "$link_command"
2688 $run eval "$link_command"
2689 status=$?
2691 # Delete the generated files.
2692 if test -n "$dlsyms"; then
2693 $show "$rm $output_objdir/${outputname}S.${objext}"
2694 $run $rm "$output_objdir/${outputname}S.${objext}"
2697 exit $status
2700 if test -n "$shlibpath_var"; then
2701 # We should set the shlibpath_var
2702 rpath=
2703 for dir in $temp_rpath; do
2704 case "$dir" in
2705 [\\/]* | [A-Za-z]:[\\/]*)
2706 # Absolute path.
2707 rpath="$rpath$dir:"
2710 # Relative path: add a thisdir entry.
2711 rpath="$rpath\$thisdir/$dir:"
2713 esac
2714 done
2715 temp_rpath="$rpath"
2718 if test -n "$compile_shlibpath$finalize_shlibpath"; then
2719 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2721 if test -n "$finalize_shlibpath"; then
2722 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2725 compile_var=
2726 finalize_var=
2727 if test -n "$runpath_var"; then
2728 if test -n "$perm_rpath"; then
2729 # We should set the runpath_var.
2730 rpath=
2731 for dir in $perm_rpath; do
2732 rpath="$rpath$dir:"
2733 done
2734 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2736 if test -n "$finalize_perm_rpath"; then
2737 # We should set the runpath_var.
2738 rpath=
2739 for dir in $finalize_perm_rpath; do
2740 rpath="$rpath$dir:"
2741 done
2742 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2746 if test "$hardcode_action" = relink; then
2747 # Fast installation is not supported
2748 link_command="$compile_var$compile_command$compile_rpath"
2749 relink_command="$finalize_var$finalize_command$finalize_rpath"
2751 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2752 $echo "$modename: \`$output' will be relinked during installation" 1>&2
2753 else
2754 if test "$fast_install" != no; then
2755 link_command="$finalize_var$compile_command$finalize_rpath"
2756 if test "$fast_install" = yes; then
2757 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2758 else
2759 # fast_install is set to needless
2760 relink_command=
2762 else
2763 link_command="$compile_var$compile_command$compile_rpath"
2764 relink_command="$finalize_var$finalize_command$finalize_rpath"
2768 # Replace the output file specification.
2769 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2771 # Delete the old output files.
2772 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2774 $show "$link_command"
2775 $run eval "$link_command" || exit $?
2777 # Now create the wrapper script.
2778 $show "creating $output"
2780 # Quote the relink command for shipping.
2781 if test -n "$relink_command"; then
2782 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2785 # Quote $echo for shipping.
2786 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2787 case "$0" in
2788 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2789 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2790 esac
2791 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2792 else
2793 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2796 # Only actually do things if our run command is non-null.
2797 if test -z "$run"; then
2798 # win32 will think the script is a binary if it has
2799 # a .exe suffix, so we strip it off here.
2800 case $output in
2801 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2802 esac
2803 $rm $output
2804 trap "$rm $output; exit 1" 1 2 15
2806 $echo > $output "\
2807 #! $SHELL
2809 # $output - temporary wrapper script for $objdir/$outputname
2810 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2812 # The $output program cannot be directly executed until all the libtool
2813 # libraries that it depends on are installed.
2815 # This wrapper script should never be moved out of the build directory.
2816 # If it is, it will not operate correctly.
2818 # Sed substitution that helps us do robust quoting. It backslashifies
2819 # metacharacters that are still active within double-quoted strings.
2820 Xsed='sed -e 1s/^X//'
2821 sed_quote_subst='$sed_quote_subst'
2823 # The HP-UX ksh and POSIX shell print the target directory to stdout
2824 # if CDPATH is set.
2825 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
2827 relink_command=\"$relink_command\"
2829 # This environment variable determines our operation mode.
2830 if test \"\$libtool_install_magic\" = \"$magic\"; then
2831 # install mode needs the following variable:
2832 link_against_libtool_libs='$link_against_libtool_libs'
2833 else
2834 # When we are sourced in execute mode, \$file and \$echo are already set.
2835 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2836 echo=\"$qecho\"
2837 file=\"\$0\"
2838 # Make sure echo works.
2839 if test \"X\$1\" = X--no-reexec; then
2840 # Discard the --no-reexec flag, and continue.
2841 shift
2842 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2843 # Yippee, \$echo works!
2845 else
2846 # Restart under the correct shell, and then maybe \$echo will work.
2847 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2851 $echo >> $output "\
2853 # Find the directory that this script lives in.
2854 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2855 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2857 # Follow symbolic links until we get to the real thisdir.
2858 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2859 while test -n \"\$file\"; do
2860 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2862 # If there was a directory component, then change thisdir.
2863 if test \"x\$destdir\" != \"x\$file\"; then
2864 case \"\$destdir\" in
2865 [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
2866 *) thisdir=\"\$thisdir/\$destdir\" ;;
2867 esac
2870 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2871 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2872 done
2874 # Try to get the absolute directory name.
2875 absdir=\`cd \"\$thisdir\" && pwd\`
2876 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2879 if test "$fast_install" = yes; then
2880 echo >> $output "\
2881 program=lt-'$outputname'
2882 progdir=\"\$thisdir/$objdir\"
2884 if test ! -f \"\$progdir/\$program\" || \\
2885 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2886 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2888 file=\"\$\$-\$program\"
2890 if test ! -d \"\$progdir\"; then
2891 $mkdir \"\$progdir\"
2892 else
2893 $rm \"\$progdir/\$file\"
2896 echo >> $output "\
2898 # relink executable if necessary
2899 if test -n \"\$relink_command\"; then
2900 if (cd \"\$thisdir\" && eval \$relink_command); then :
2901 else
2902 $rm \"\$progdir/\$file\"
2903 exit 1
2907 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2908 { $rm \"\$progdir/\$program\";
2909 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2910 $rm \"\$progdir/\$file\"
2912 else
2913 echo >> $output "\
2914 program='$outputname'
2915 progdir=\"\$thisdir/$objdir\"
2919 echo >> $output "\
2921 if test -f \"\$progdir/\$program\"; then"
2923 # Export our shlibpath_var if we have one.
2924 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2925 $echo >> $output "\
2926 # Add our own library path to $shlibpath_var
2927 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2929 # Some systems cannot cope with colon-terminated $shlibpath_var
2930 # The second colon is a workaround for a bug in BeOS R4 sed
2931 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2933 export $shlibpath_var
2937 # fixup the dll searchpath if we need to.
2938 if test -n "$dllsearchpath"; then
2939 $echo >> $output "\
2940 # Add the dll search path components to the executable PATH
2941 PATH=$dllsearchpath:\$PATH
2945 $echo >> $output "\
2946 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2947 # Run the actual program with our arguments.
2949 case $host in
2950 *-*-cygwin* | *-*-mingw | *-*-os2*)
2951 # win32 systems need to use the prog path for dll
2952 # lookup to work
2953 $echo >> $output "\
2954 exec \$progdir\\\\\$program \${1+\"\$@\"}
2958 $echo >> $output "\
2959 # Export the path to the program.
2960 PATH=\"\$progdir:\$PATH\"
2961 export PATH
2963 exec \$program \${1+\"\$@\"}
2966 esac
2967 $echo >> $output "\
2968 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
2969 exit 1
2971 else
2972 # The program doesn't exist.
2973 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
2974 \$echo \"This script is just a wrapper for \$program.\" 1>&2
2975 echo \"See the $PACKAGE documentation for more information.\" 1>&2
2976 exit 1
2980 chmod +x $output
2982 exit 0
2984 esac
2986 # See if we need to build an old-fashioned archive.
2987 for oldlib in $oldlibs; do
2989 if test "$build_libtool_libs" = convenience; then
2990 oldobjs="$libobjs_save"
2991 addlibs="$convenience"
2992 build_libtool_libs=no
2993 else
2994 if test "$build_libtool_libs" = module; then
2995 oldobjs="$libobjs_save"
2996 build_libtool_libs=no
2997 else
2998 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3000 addlibs="$old_convenience"
3003 if test -n "$addlibs"; then
3004 gentop="$output_objdir/${outputname}x"
3005 $show "${rm}r $gentop"
3006 $run ${rm}r "$gentop"
3007 $show "mkdir $gentop"
3008 $run mkdir "$gentop"
3009 status=$?
3010 if test $status -ne 0 && test ! -d "$gentop"; then
3011 exit $status
3013 generated="$generated $gentop"
3015 # Add in members from convenience archives.
3016 for xlib in $addlibs; do
3017 # Extract the objects.
3018 case "$xlib" in
3019 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3020 *) xabs=`pwd`"/$xlib" ;;
3021 esac
3022 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3023 xdir="$gentop/$xlib"
3025 $show "${rm}r $xdir"
3026 $run ${rm}r "$xdir"
3027 $show "mkdir $xdir"
3028 $run mkdir "$xdir"
3029 status=$?
3030 if test $status -ne 0 && test ! -d "$xdir"; then
3031 exit $status
3033 $show "(cd $xdir && $AR x $xabs)"
3034 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3036 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3037 done
3040 # Do each command in the archive commands.
3041 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3042 eval cmds=\"$old_archive_from_new_cmds\"
3043 else
3044 # Ensure that we have .o objects in place in case we decided
3045 # not to build a shared library, and have fallen back to building
3046 # static libs even though --disable-static was passed!
3047 for oldobj in $oldobjs; do
3048 if test ! -f $oldobj; then
3049 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3050 if test "X$xdir" = "X$oldobj"; then
3051 xdir="."
3052 else
3053 xdir="$xdir"
3055 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3056 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3057 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3058 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3060 done
3062 eval cmds=\"$old_archive_cmds\"
3064 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3065 for cmd in $cmds; do
3066 IFS="$save_ifs"
3067 $show "$cmd"
3068 $run eval "$cmd" || exit $?
3069 done
3070 IFS="$save_ifs"
3071 done
3073 if test -n "$generated"; then
3074 $show "${rm}r$generated"
3075 $run ${rm}r$generated
3078 # Now create the libtool archive.
3079 case "$output" in
3080 *.la)
3081 old_library=
3082 test "$build_old_libs" = yes && old_library="$libname.$libext"
3083 $show "creating $output"
3085 if test -n "$xrpath"; then
3086 temp_xrpath=
3087 for libdir in $xrpath; do
3088 temp_xrpath="$temp_xrpath -R$libdir"
3089 done
3090 dependency_libs="$temp_xrpath $dependency_libs"
3093 # Only create the output if not a dry run.
3094 if test -z "$run"; then
3095 for installed in no yes; do
3096 if test "$installed" = yes; then
3097 if test -z "$install_libdir"; then
3098 break
3100 output="$output_objdir/$outputname"i
3102 $rm $output
3103 $echo > $output "\
3104 # $outputname - a libtool library file
3105 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3107 # Please DO NOT delete this file!
3108 # It is necessary for linking the library.
3110 # The name that we can dlopen(3).
3111 dlname='$dlname'
3113 # Names of this library.
3114 library_names='$library_names'
3116 # The name of the static archive.
3117 old_library='$old_library'
3119 # Libraries that this one depends upon.
3120 dependency_libs='$dependency_libs'
3122 # Version information for $libname.
3123 current=$current
3124 age=$age
3125 revision=$revision
3127 # Is this an already installed library?
3128 installed=$installed
3130 # Directory that this library needs to be installed in:
3131 libdir='$install_libdir'\
3133 done
3136 # Do a symbolic link so that the libtool archive can be found in
3137 # LD_LIBRARY_PATH before the program is installed.
3138 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3139 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
3141 esac
3142 exit 0
3145 # libtool install mode
3146 install)
3147 modename="$modename: install"
3149 # There may be an optional sh(1) argument at the beginning of
3150 # install_prog (especially on Windows NT).
3151 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
3152 # Aesthetically quote it.
3153 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3154 case "$arg" in
3155 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3156 arg="\"$arg\""
3158 esac
3159 install_prog="$arg "
3160 arg="$1"
3161 shift
3162 else
3163 install_prog=
3164 arg="$nonopt"
3167 # The real first argument should be the name of the installation program.
3168 # Aesthetically quote it.
3169 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3170 case "$arg" in
3171 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3172 arg="\"$arg\""
3174 esac
3175 install_prog="$install_prog$arg"
3177 # We need to accept at least all the BSD install flags.
3178 dest=
3179 files=
3180 opts=
3181 prev=
3182 install_type=
3183 isdir=no
3184 stripme=
3185 for arg
3187 if test -n "$dest"; then
3188 files="$files $dest"
3189 dest="$arg"
3190 continue
3193 case "$arg" in
3194 -d) isdir=yes ;;
3195 -f) prev="-f" ;;
3196 -g) prev="-g" ;;
3197 -m) prev="-m" ;;
3198 -o) prev="-o" ;;
3200 stripme=" -s"
3201 continue
3203 -*) ;;
3206 # If the previous option needed an argument, then skip it.
3207 if test -n "$prev"; then
3208 prev=
3209 else
3210 dest="$arg"
3211 continue
3214 esac
3216 # Aesthetically quote the argument.
3217 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3218 case "$arg" in
3219 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3220 arg="\"$arg\""
3222 esac
3223 install_prog="$install_prog $arg"
3224 done
3226 if test -z "$install_prog"; then
3227 $echo "$modename: you must specify an install program" 1>&2
3228 $echo "$help" 1>&2
3229 exit 1
3232 if test -n "$prev"; then
3233 $echo "$modename: the \`$prev' option requires an argument" 1>&2
3234 $echo "$help" 1>&2
3235 exit 1
3238 if test -z "$files"; then
3239 if test -z "$dest"; then
3240 $echo "$modename: no file or destination specified" 1>&2
3241 else
3242 $echo "$modename: you must specify a destination" 1>&2
3244 $echo "$help" 1>&2
3245 exit 1
3248 # Strip any trailing slash from the destination.
3249 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
3251 # Check to see that the destination is a directory.
3252 test -d "$dest" && isdir=yes
3253 if test "$isdir" = yes; then
3254 destdir="$dest"
3255 destname=
3256 else
3257 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3258 test "X$destdir" = "X$dest" && destdir=.
3259 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3261 # Not a directory, so check to see that there is only one file specified.
3262 set dummy $files
3263 if test $# -gt 2; then
3264 $echo "$modename: \`$dest' is not a directory" 1>&2
3265 $echo "$help" 1>&2
3266 exit 1
3269 case "$destdir" in
3270 [\\/]* | [A-Za-z]:[\\/]*) ;;
3272 for file in $files; do
3273 case "$file" in
3274 *.lo) ;;
3276 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3277 $echo "$help" 1>&2
3278 exit 1
3280 esac
3281 done
3283 esac
3285 # This variable tells wrapper scripts just to set variables rather
3286 # than running their programs.
3287 libtool_install_magic="$magic"
3289 staticlibs=
3290 future_libdirs=
3291 current_libdirs=
3292 for file in $files; do
3294 # Do each installation.
3295 case "$file" in
3296 *.a | *.lib)
3297 # Do the static libraries later.
3298 staticlibs="$staticlibs $file"
3301 *.la)
3302 # Check to see that this really is a libtool archive.
3303 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3304 else
3305 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3306 $echo "$help" 1>&2
3307 exit 1
3310 library_names=
3311 old_library=
3312 # If there is no directory component, then add one.
3313 case "$file" in
3314 */* | *\\*) . $file ;;
3315 *) . ./$file ;;
3316 esac
3318 # Add the libdir to current_libdirs if it is the destination.
3319 if test "X$destdir" = "X$libdir"; then
3320 case "$current_libdirs " in
3321 *" $libdir "*) ;;
3322 *) current_libdirs="$current_libdirs $libdir" ;;
3323 esac
3324 else
3325 # Note the libdir as a future libdir.
3326 case "$future_libdirs " in
3327 *" $libdir "*) ;;
3328 *) future_libdirs="$future_libdirs $libdir" ;;
3329 esac
3332 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3333 test "X$dir" = "X$file/" && dir=
3334 dir="$dir$objdir"
3336 # See the names of the shared library.
3337 set dummy $library_names
3338 if test -n "$2"; then
3339 realname="$2"
3340 shift
3341 shift
3343 # Install the shared library and build the symlinks.
3344 $show "$install_prog $dir/$realname $destdir/$realname"
3345 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3347 if test $# -gt 0; then
3348 # Delete the old symlinks, and create new ones.
3349 for linkname
3351 if test "$linkname" != "$realname"; then
3352 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3353 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3355 done
3358 # Do each command in the postinstall commands.
3359 lib="$destdir/$realname"
3360 eval cmds=\"$postinstall_cmds\"
3361 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3362 for cmd in $cmds; do
3363 IFS="$save_ifs"
3364 $show "$cmd"
3365 $run eval "$cmd" || exit $?
3366 done
3367 IFS="$save_ifs"
3370 # Install the pseudo-library for information purposes.
3371 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3372 instname="$dir/$name"i
3373 $show "$install_prog $instname $destdir/$name"
3374 $run eval "$install_prog $instname $destdir/$name" || exit $?
3376 # Maybe install the static library, too.
3377 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3380 *.lo)
3381 # Install (i.e. copy) a libtool object.
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"
3391 # Deduce the name of the destination old-style object file.
3392 case "$destfile" in
3393 *.lo)
3394 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3396 *.o | *.obj)
3397 staticdest="$destfile"
3398 destfile=
3401 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3402 $echo "$help" 1>&2
3403 exit 1
3405 esac
3407 # Install the libtool object if requested.
3408 if test -n "$destfile"; then
3409 $show "$install_prog $file $destfile"
3410 $run eval "$install_prog $file $destfile" || exit $?
3413 # Install the old object if enabled.
3414 if test "$build_old_libs" = yes; then
3415 # Deduce the name of the old-style object file.
3416 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3418 $show "$install_prog $staticobj $staticdest"
3419 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3421 exit 0
3425 # Figure out destination file name, if it wasn't already specified.
3426 if test -n "$destname"; then
3427 destfile="$destdir/$destname"
3428 else
3429 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3430 destfile="$destdir/$destfile"
3433 # Do a test to see if this is really a libtool program.
3434 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3435 link_against_libtool_libs=
3436 relink_command=
3438 # If there is no directory component, then add one.
3439 case "$file" in
3440 */* | *\\*) . $file ;;
3441 *) . ./$file ;;
3442 esac
3444 # Check the variables that should have been set.
3445 if test -z "$link_against_libtool_libs"; then
3446 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3447 exit 1
3450 finalize=yes
3451 for lib in $link_against_libtool_libs; do
3452 # Check to see that each library is installed.
3453 libdir=
3454 if test -f "$lib"; then
3455 # If there is no directory component, then add one.
3456 case "$lib" in
3457 */* | *\\*) . $lib ;;
3458 *) . ./$lib ;;
3459 esac
3461 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3462 if test -n "$libdir" && test ! -f "$libfile"; then
3463 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3464 finalize=no
3466 done
3468 outputname=
3469 if test "$fast_install" = no && test -n "$relink_command"; then
3470 if test "$finalize" = yes && test -z "$run"; then
3471 tmpdir="/tmp"
3472 test -n "$TMPDIR" && tmpdir="$TMPDIR"
3473 tmpdir="$tmpdir/libtool-$$"
3474 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3475 else
3476 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3477 continue
3479 outputname="$tmpdir/$file"
3480 # Replace the output file specification.
3481 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3483 $show "$relink_command"
3484 if $run eval "$relink_command"; then :
3485 else
3486 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3487 ${rm}r "$tmpdir"
3488 continue
3490 file="$outputname"
3491 else
3492 $echo "$modename: warning: cannot relink \`$file'" 1>&2
3494 else
3495 # Install the binary that we compiled earlier.
3496 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3500 $show "$install_prog$stripme $file $destfile"
3501 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3502 test -n "$outputname" && ${rm}r "$tmpdir"
3504 esac
3505 done
3507 for file in $staticlibs; do
3508 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3510 # Set up the ranlib parameters.
3511 oldlib="$destdir/$name"
3513 $show "$install_prog $file $oldlib"
3514 $run eval "$install_prog \$file \$oldlib" || exit $?
3516 # Do each command in the postinstall commands.
3517 eval cmds=\"$old_postinstall_cmds\"
3518 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3519 for cmd in $cmds; do
3520 IFS="$save_ifs"
3521 $show "$cmd"
3522 $run eval "$cmd" || exit $?
3523 done
3524 IFS="$save_ifs"
3525 done
3527 if test -n "$future_libdirs"; then
3528 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3531 if test -n "$current_libdirs"; then
3532 # Maybe just do a dry run.
3533 test -n "$run" && current_libdirs=" -n$current_libdirs"
3534 exec $SHELL $0 --finish$current_libdirs
3535 exit 1
3538 exit 0
3541 # libtool finish mode
3542 finish)
3543 modename="$modename: finish"
3544 libdirs="$nonopt"
3545 admincmds=
3547 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3548 for dir
3550 libdirs="$libdirs $dir"
3551 done
3553 for libdir in $libdirs; do
3554 if test -n "$finish_cmds"; then
3555 # Do each command in the finish commands.
3556 eval cmds=\"$finish_cmds\"
3557 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3558 for cmd in $cmds; do
3559 IFS="$save_ifs"
3560 $show "$cmd"
3561 $run eval "$cmd" || admincmds="$admincmds
3562 $cmd"
3563 done
3564 IFS="$save_ifs"
3566 if test -n "$finish_eval"; then
3567 # Do the single finish_eval.
3568 eval cmds=\"$finish_eval\"
3569 $run eval "$cmds" || admincmds="$admincmds
3570 $cmds"
3572 done
3575 # Exit here if they wanted silent mode.
3576 test "$show" = : && exit 0
3578 echo "----------------------------------------------------------------------"
3579 echo "Libraries have been installed in:"
3580 for libdir in $libdirs; do
3581 echo " $libdir"
3582 done
3583 echo
3584 echo "If you ever happen to want to link against installed libraries"
3585 echo "in a given directory, LIBDIR, you must either use libtool, and"
3586 echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3587 echo "flag during linking and do at least one of the following:"
3588 if test -n "$shlibpath_var"; then
3589 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3590 echo " during execution"
3592 if test -n "$runpath_var"; then
3593 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3594 echo " during linking"
3596 if test -n "$hardcode_libdir_flag_spec"; then
3597 libdir=LIBDIR
3598 eval flag=\"$hardcode_libdir_flag_spec\"
3600 echo " - use the \`$flag' linker flag"
3602 if test -n "$admincmds"; then
3603 echo " - have your system administrator run these commands:$admincmds"
3605 if test -f /etc/ld.so.conf; then
3606 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3608 echo
3609 echo "See any operating system documentation about shared libraries for"
3610 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3611 echo "----------------------------------------------------------------------"
3612 exit 0
3615 # libtool execute mode
3616 execute)
3617 modename="$modename: execute"
3619 # The first argument is the command name.
3620 cmd="$nonopt"
3621 if test -z "$cmd"; then
3622 $echo "$modename: you must specify a COMMAND" 1>&2
3623 $echo "$help"
3624 exit 1
3627 # Handle -dlopen flags immediately.
3628 for file in $execute_dlfiles; do
3629 if test ! -f "$file"; then
3630 $echo "$modename: \`$file' is not a file" 1>&2
3631 $echo "$help" 1>&2
3632 exit 1
3635 dir=
3636 case "$file" in
3637 *.la)
3638 # Check to see that this really is a libtool archive.
3639 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3640 else
3641 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3642 $echo "$help" 1>&2
3643 exit 1
3646 # Read the libtool library.
3647 dlname=
3648 library_names=
3650 # If there is no directory component, then add one.
3651 case "$file" in
3652 */* | *\\*) . $file ;;
3653 *) . ./$file ;;
3654 esac
3656 # Skip this library if it cannot be dlopened.
3657 if test -z "$dlname"; then
3658 # Warn if it was a shared library.
3659 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3660 continue
3663 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3664 test "X$dir" = "X$file" && dir=.
3666 if test -f "$dir/$objdir/$dlname"; then
3667 dir="$dir/$objdir"
3668 else
3669 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3670 exit 1
3674 *.lo)
3675 # Just add the directory containing the .lo file.
3676 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3677 test "X$dir" = "X$file" && dir=.
3681 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3682 continue
3684 esac
3686 # Get the absolute pathname.
3687 absdir=`cd "$dir" && pwd`
3688 test -n "$absdir" && dir="$absdir"
3690 # Now add the directory to shlibpath_var.
3691 if eval "test -z \"\$$shlibpath_var\""; then
3692 eval "$shlibpath_var=\"\$dir\""
3693 else
3694 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3696 done
3698 # This variable tells wrapper scripts just to set shlibpath_var
3699 # rather than running their programs.
3700 libtool_execute_magic="$magic"
3702 # Check if any of the arguments is a wrapper script.
3703 args=
3704 for file
3706 case "$file" in
3707 -*) ;;
3709 # Do a test to see if this is really a libtool program.
3710 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3711 # If there is no directory component, then add one.
3712 case "$file" in
3713 */* | *\\*) . $file ;;
3714 *) . ./$file ;;
3715 esac
3717 # Transform arg to wrapped name.
3718 file="$progdir/$program"
3721 esac
3722 # Quote arguments (to preserve shell metacharacters).
3723 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3724 args="$args \"$file\""
3725 done
3727 if test -z "$run"; then
3728 if test -n "$shlibpath_var"; then
3729 # Export the shlibpath_var.
3730 eval "export $shlibpath_var"
3733 # Restore saved enviroment variables
3734 if test "${save_LC_ALL+set}" = set; then
3735 LC_ALL="$save_LC_ALL"; export LC_ALL
3737 if test "${save_LANG+set}" = set; then
3738 LANG="$save_LANG"; export LANG
3741 # Now actually exec the command.
3742 eval "exec \$cmd$args"
3744 $echo "$modename: cannot exec \$cmd$args"
3745 exit 1
3746 else
3747 # Display what would be done.
3748 if test -n "$shlibpath_var"; then
3749 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3750 $echo "export $shlibpath_var"
3752 $echo "$cmd$args"
3753 exit 0
3757 # libtool uninstall mode
3758 uninstall)
3759 modename="$modename: uninstall"
3760 rm="$nonopt"
3761 files=
3763 for arg
3765 case "$arg" in
3766 -*) rm="$rm $arg" ;;
3767 *) files="$files $arg" ;;
3768 esac
3769 done
3771 if test -z "$rm"; then
3772 $echo "$modename: you must specify an RM program" 1>&2
3773 $echo "$help" 1>&2
3774 exit 1
3777 for file in $files; do
3778 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3779 test "X$dir" = "X$file" && dir=.
3780 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3782 rmfiles="$file"
3784 case "$name" in
3785 *.la)
3786 # Possibly a libtool archive, so verify it.
3787 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3788 . $dir/$name
3790 # Delete the libtool libraries and symlinks.
3791 for n in $library_names; do
3792 rmfiles="$rmfiles $dir/$n"
3793 done
3794 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3796 $show "$rm $rmfiles"
3797 $run $rm $rmfiles
3799 if test -n "$library_names"; then
3800 # Do each command in the postuninstall commands.
3801 eval cmds=\"$postuninstall_cmds\"
3802 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3803 for cmd in $cmds; do
3804 IFS="$save_ifs"
3805 $show "$cmd"
3806 $run eval "$cmd"
3807 done
3808 IFS="$save_ifs"
3811 if test -n "$old_library"; then
3812 # Do each command in the old_postuninstall commands.
3813 eval cmds=\"$old_postuninstall_cmds\"
3814 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3815 for cmd in $cmds; do
3816 IFS="$save_ifs"
3817 $show "$cmd"
3818 $run eval "$cmd"
3819 done
3820 IFS="$save_ifs"
3823 # FIXME: should reinstall the best remaining shared library.
3827 *.lo)
3828 if test "$build_old_libs" = yes; then
3829 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3830 rmfiles="$rmfiles $dir/$oldobj"
3832 $show "$rm $rmfiles"
3833 $run $rm $rmfiles
3837 $show "$rm $rmfiles"
3838 $run $rm $rmfiles
3840 esac
3841 done
3842 exit 0
3846 $echo "$modename: you must specify a MODE" 1>&2
3847 $echo "$generic_help" 1>&2
3848 exit 1
3850 esac
3852 $echo "$modename: invalid operation mode \`$mode'" 1>&2
3853 $echo "$generic_help" 1>&2
3854 exit 1
3855 fi # test -z "$show_help"
3857 # We need to display help for each of the modes.
3858 case "$mode" in
3859 "") $echo \
3860 "Usage: $modename [OPTION]... [MODE-ARG]...
3862 Provide generalized library-building support services.
3864 --config show all configuration variables
3865 --debug enable verbose shell tracing
3866 -n, --dry-run display commands without modifying any files
3867 --features display basic configuration information and exit
3868 --finish same as \`--mode=finish'
3869 --help display this help message and exit
3870 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
3871 --quiet same as \`--silent'
3872 --silent don't print informational messages
3873 --version print version information
3875 MODE must be one of the following:
3877 compile compile a source file into a libtool object
3878 execute automatically set library path, then run a program
3879 finish complete the installation of libtool libraries
3880 install install libraries or executables
3881 link create a library or an executable
3882 uninstall remove libraries from an installed directory
3884 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
3885 a more detailed description of MODE."
3886 exit 0
3889 compile)
3890 $echo \
3891 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3893 Compile a source file into a libtool library object.
3895 This mode accepts the following additional options:
3897 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3898 -static always build a \`.o' file suitable for static linking
3900 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3901 from the given SOURCEFILE.
3903 The output file name is determined by removing the directory component from
3904 SOURCEFILE, then substituting the C source code suffix \`.c' with the
3905 library object suffix, \`.lo'."
3908 execute)
3909 $echo \
3910 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
3912 Automatically set library path, then run a program.
3914 This mode accepts the following additional options:
3916 -dlopen FILE add the directory containing FILE to the library path
3918 This mode sets the library path environment variable according to \`-dlopen'
3919 flags.
3921 If any of the ARGS are libtool executable wrappers, then they are translated
3922 into their corresponding uninstalled binary, and any of their required library
3923 directories are added to the library path.
3925 Then, COMMAND is executed, with ARGS as arguments."
3928 finish)
3929 $echo \
3930 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
3932 Complete the installation of libtool libraries.
3934 Each LIBDIR is a directory that contains libtool libraries.
3936 The commands that this mode executes may require superuser privileges. Use
3937 the \`--dry-run' option if you just want to see what would be executed."
3940 install)
3941 $echo \
3942 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
3944 Install executables or libraries.
3946 INSTALL-COMMAND is the installation command. The first component should be
3947 either the \`install' or \`cp' program.
3949 The rest of the components are interpreted as arguments to that command (only
3950 BSD-compatible install options are recognized)."
3953 link)
3954 $echo \
3955 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
3957 Link object files or libraries together to form another library, or to
3958 create an executable program.
3960 LINK-COMMAND is a command using the C compiler that you would use to create
3961 a program from several object files.
3963 The following components of LINK-COMMAND are treated specially:
3965 -all-static do not do any dynamic linking at all
3966 -avoid-version do not add a version suffix if possible
3967 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
3968 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3969 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3970 -export-symbols SYMFILE
3971 try to export only the symbols listed in SYMFILE
3972 -export-symbols-regex REGEX
3973 try to export only the symbols matching REGEX
3974 -LLIBDIR search LIBDIR for required installed libraries
3975 -lNAME OUTPUT-FILE requires the installed library libNAME
3976 -module build a library that can dlopened
3977 -no-undefined declare that a library does not refer to external symbols
3978 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3979 -release RELEASE specify package release information
3980 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3981 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3982 -static do not do any dynamic linking of libtool libraries
3983 -version-info CURRENT[:REVISION[:AGE]]
3984 specify library version info [each variable defaults to 0]
3986 All other options (arguments beginning with \`-') are ignored.
3988 Every other argument is treated as a filename. Files ending in \`.la' are
3989 treated as uninstalled libtool libraries, other files are standard or library
3990 object files.
3992 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
3993 only library objects (\`.lo' files) may be specified, and \`-rpath' is
3994 required, except when creating a convenience library.
3996 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
3997 using \`ar' and \`ranlib', or on Windows using \`lib'.
3999 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4000 is created, otherwise an executable program is created."
4003 uninstall)
4004 $echo \
4005 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4007 Remove libraries from an installation directory.
4009 RM is the name of the program to use to delete files associated with each FILE
4010 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4011 to RM.
4013 If FILE is a libtool library, all the files associated with it are deleted.
4014 Otherwise, only FILE itself is deleted using RM."
4018 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4019 $echo "$help" 1>&2
4020 exit 1
4022 esac
4024 echo
4025 $echo "Try \`$modename --help' for more information about other modes."
4027 exit 0
4029 # Local Variables:
4030 # mode:shell-script
4031 # sh-indentation:2
4032 # End: