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 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.
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!
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
50 # The name of this program.
51 progname=`$echo "$0" | sed 's%^.*/%%'`
58 TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
61 help="Try \`$progname --help' for more information."
62 magic="%%%MAGIC variable%%%"
67 # Sed substitution that helps us do robust quoting. It backslashifies
68 # metacharacters that are still active within double-quoted strings.
70 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
71 # test EBCDIC or ASCII
72 case `echo '' | od -x` in
73 *15*) # EBCDIC based system
77 *) # Assume ASCII based system
79 NL2SP='tr \015\012 \040\040'
84 # Only set LANG and LC_ALL to C if already set.
85 # These must not be set unconditionally because not all systems understand
86 # e.g. LANG=C (notably SCO).
87 # We save the old values to restore during execute mode.
88 if test "${LC_ALL+set}" = set; then
89 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
91 if test "${LANG+set}" = set; then
92 save_LANG="$LANG"; LANG=C; export LANG
95 if test "$LTCONFIG_VERSION" != "$VERSION"; then
96 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
97 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
101 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
102 echo "$modename: not configured to build any kind of library" 1>&2
103 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
116 lo2o="s/\\.lo\$/.${objext}/"
117 o2lo="s/\\.${objext}\$/.lo/"
119 # Parse our command line options once, thoroughly.
126 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
130 # If the previous option needs an argument, assign it.
131 if test -n "$prev"; then
134 eval "$prev=\"\$$prev \$arg\""
146 # Have we seen a non-optional argument yet?
153 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
158 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
163 echo "$progname: enabling shell trace mode"
173 if test "$build_libtool_libs" = yes; then
174 echo "enable shared libraries"
176 echo "disable shared libraries"
178 if test "$build_old_libs" = yes; then
179 echo "enable static libraries"
181 echo "disable static libraries"
186 --finish) mode="finish" ;;
188 --mode) prevopt="--mode" prev=mode ;;
189 --mode=*) mode="$optarg" ;;
201 $echo "$modename: unrecognized option \`$arg'" 1>&2
213 if test -n "$prevopt"; then
214 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
219 if test -z "$show_help"; then
221 # Infer the operation mode.
222 if test -z "$mode"; then
224 *cc | *++ | gcc* | *-gcc*)
236 *db | *dbx | *strace | *truss)
246 # If we have no mode, but dlfiles were specified, then do execute mode.
247 test -n "$execute_dlfiles" && mode=execute
249 # Just use the default operation mode.
250 if test -z "$mode"; then
251 if test -n "$nonopt"; then
252 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
254 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
261 # Only execute mode is allowed to have -dlopen flags.
262 if test -n "$execute_dlfiles" && test "$mode" != execute; then
263 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
268 # Change the help message to a mode-specific one.
270 help="Try \`$modename --help --mode=$mode' for more information."
272 # These modes are in order of execution frequency so that they run quickly.
274 # libtool compile mode
276 modename="$modename: compile"
277 # Get the compilation command and the source file.
286 # Accept any command-line options.
289 if test "$user_target" != "no"; then
290 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
302 case "$user_target" in
304 # The next one is the -o target name
309 # We got the output file
316 # Accept the current argument as the source file.
320 # Aesthetically quote the previous argument.
322 # Backslashify any backslashes, double quotes, and dollar signs.
323 # These are the only characters that are still specially
324 # interpreted inside of double-quoted scrings.
325 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
327 # Double-quote args containing other shell metacharacters.
328 # Many Bourne shells cannot handle close brackets correctly in scan
329 # sets, so we specify it separately.
331 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
332 lastarg="\"$lastarg\""
336 # Add the previous argument to base_compile.
337 if test -z "$base_compile"; then
338 base_compile="$lastarg"
340 base_compile="$base_compile $lastarg"
344 case "$user_target" in
348 # Get the name of the library object.
349 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
352 $echo "$modename: you must specify a target with \`-o'" 1>&2
357 # Recognize several different file suffixes.
358 # If the user specifies -o file.o, it is replaced with file.lo
373 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
376 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
378 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
383 if test -z "$base_compile"; then
384 $echo "$modename: you must specify a compilation command" 1>&2
389 # Delete any leftover library objects.
390 if test "$build_old_libs" = yes; then
391 removelist="$obj $libobj"
397 trap "$run $rm $removelist; exit 1" 1 2 15
399 # Calculate the filename of the output object if compiler does
400 # not support -o with -c
401 if test "$compiler_c_o" = no; then
402 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
403 lockfile="$output_obj.lock"
404 removelist="$removelist $output_obj $lockfile"
405 trap "$run $rm $removelist; exit 1" 1 2 15
411 # Lock this critical section if it is needed
412 # We use this script file to make the link, it avoids creating a new file
413 if test "$need_locks" = yes; then
414 until ln "$0" "$lockfile" 2>/dev/null; do
415 $show "Waiting for $lockfile to be removed"
418 elif test "$need_locks" = warn; then
419 if test -f "$lockfile"; then
421 *** ERROR, $lockfile exists and contains:
422 `cat $lockfile 2>/dev/null`
424 This indicates that another process is trying to use the same
425 temporary object file, and libtool could not work around it because
426 your compiler does not support \`-c' and \`-o' together. If you
427 repeat this compilation, it may succeed, by chance, but you had better
428 avoid parallel builds (make -j) in this platform, or get a better
434 echo $srcfile > "$lockfile"
437 if test -n "$fix_srcfile_path"; then
438 eval srcfile=\"$fix_srcfile_path\"
441 # Only build a PIC object if we are building libtool libraries.
442 if test "$build_libtool_libs" = yes; then
443 # Without this assignment, base_compile gets emptied.
444 fbsd_hideous_sh_bug=$base_compile
446 # All platforms use -DPIC, to notify preprocessed assembler code.
447 command="$base_compile $srcfile $pic_flag -DPIC"
448 if test "$build_old_libs" = yes; then
450 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
451 if test "X$dir" = "X$libobj"; then
456 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
458 if test -d "$dir"; then
465 if test $status -ne 0 && test ! -d $dir; then
470 if test "$compiler_o_lo" = yes; then
472 command="$command -o $output_obj"
473 elif test "$compiler_c_o" = yes; then
475 command="$command -o $output_obj"
478 $run $rm "$output_obj"
480 if $run eval "$command"; then :
482 test -n "$output_obj" && $run $rm $removelist
486 if test "$need_locks" = warn &&
487 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
489 *** ERROR, $lockfile contains:
490 `cat $lockfile 2>/dev/null`
492 but it should contain:
495 This indicates that another process is trying to use the same
496 temporary object file, and libtool could not work around it because
497 your compiler does not support \`-c' and \`-o' together. If you
498 repeat this compilation, it may succeed, by chance, but you had better
499 avoid parallel builds (make -j) in this platform, or get a better
506 # Just move the object if needed, then go on to compile the next one
507 if test x"$output_obj" != x"$libobj"; then
508 $show "$mv $output_obj $libobj"
509 if $run $mv $output_obj $libobj; then :
517 # If we have no pic_flag, then copy the object into place and finish.
518 if test -z "$pic_flag" && test "$build_old_libs" = yes; then
519 # Rename the .lo from within objdir to obj
520 if test -f $obj; then
525 $show "$mv $libobj $obj"
526 if $run $mv $libobj $obj; then :
533 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
534 if test "X$xdir" = "X$obj"; then
539 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
540 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
541 # Now arrange that obj and lo_libobj become the same file
542 $show "(cd $xdir && $LN_S $baseobj $libobj)"
543 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
552 # Allow error messages only from the first compilation.
553 suppress_output=' >/dev/null 2>&1'
556 # Only build a position-dependent object if we build old libraries.
557 if test "$build_old_libs" = yes; then
558 command="$base_compile $srcfile"
559 if test "$compiler_c_o" = yes; then
560 command="$command -o $obj"
564 # Suppress compiler output if we already did a PIC compilation.
565 command="$command$suppress_output"
566 $run $rm "$output_obj"
568 if $run eval "$command"; then :
574 if test "$need_locks" = warn &&
575 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
577 *** ERROR, $lockfile contains:
578 `cat $lockfile 2>/dev/null`
580 but it should contain:
583 This indicates that another process is trying to use the same
584 temporary object file, and libtool could not work around it because
585 your compiler does not support \`-c' and \`-o' together. If you
586 repeat this compilation, it may succeed, by chance, but you had better
587 avoid parallel builds (make -j) in this platform, or get a better
594 # Just move the object if needed
595 if test x"$output_obj" != x"$obj"; then
596 $show "$mv $output_obj $obj"
597 if $run $mv $output_obj $obj; then :
605 # Create an invalid libtool object if no PIC, so that we do not
606 # accidentally link it into a program.
607 if test "$build_libtool_libs" != yes; then
608 $show "echo timestamp > $libobj"
609 $run eval "echo timestamp > \$libobj" || exit $?
611 # Move the .lo from within objdir
612 $show "$mv $libobj $lo_libobj"
613 if $run $mv $libobj $lo_libobj; then :
622 # Unlock the critical section if it was locked
623 if test "$need_locks" != no; then
632 modename="$modename: link"
634 *-*-cygwin* | *-*-mingw* | *-*-os2*)
635 # It is impossible to link a dll without this setting, and
636 # we shouldn't force the makefile maintainer to figure out
637 # which system we are compiling for in order to pass an extra
638 # flag for every libtool invokation.
641 # FIXME: Unfortunately, there are problems with the above when trying
642 # to make a dll which has undefined symbols, in which case not
643 # even a static library is built. For now, we need to specify
644 # -no-undefined on the libtool link line when we can be certain
645 # that all symbols are satisfied, otherwise we get a static library.
648 # This is a source program that is used to create dlls on Windows
649 # Don't remove nor modify the starting and closing comments
650 # /* ltdll.c starts here */
651 # #define WIN32_LEAN_AND_MEAN
652 # #include <windows.h>
653 # #undef WIN32_LEAN_AND_MEAN
657 # # ifdef __CYGWIN32__
658 # # define __CYGWIN__ __CYGWIN32__
665 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
671 # #include <cygwin/cygwin_dll.h>
672 # DECLARE_CYGWIN_DLL( DllMain );
674 # HINSTANCE __hDllInstance_base;
677 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
679 # __hDllInstance_base = hInst;
682 # /* ltdll.c ends here */
683 # This is a source program that is used to create import libraries
684 # on Windows for dlls which lack them. Don't remove nor modify the
685 # starting and closing comments
686 # /* impgen.c starts here */
687 # /* Copyright (C) 1999 Free Software Foundation, Inc.
689 # This file is part of GNU libtool.
691 # This program is free software; you can redistribute it and/or modify
692 # it under the terms of the GNU General Public License as published by
693 # the Free Software Foundation; either version 2 of the License, or
694 # (at your option) any later version.
696 # This program is distributed in the hope that it will be useful,
697 # but WITHOUT ANY WARRANTY; without even the implied warranty of
698 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
699 # GNU General Public License for more details.
701 # You should have received a copy of the GNU General Public License
702 # along with this program; if not, write to the Free Software
703 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
706 # #include <stdio.h> /* for printf() */
707 # #include <unistd.h> /* for open(), lseek(), read() */
708 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
709 # #include <string.h> /* for strdup() */
711 # static unsigned int
712 # pe_get16 (fd, offset)
716 # unsigned char b[2];
717 # lseek (fd, offset, SEEK_SET);
719 # return b[0] + (b[1]<<8);
722 # static unsigned int
723 # pe_get32 (fd, offset)
727 # unsigned char b[4];
728 # lseek (fd, offset, SEEK_SET);
730 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
733 # static unsigned int
737 # unsigned char *b = ptr;
738 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
747 # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
748 # unsigned long export_rva, export_size, nsections, secptr, expptr;
749 # unsigned long name_rvas, nexp;
750 # unsigned char *expdata, *erva;
751 # char *filename, *dll_name;
753 # filename = argv[1];
755 # dll = open(filename, O_RDONLY|O_BINARY);
759 # dll_name = filename;
761 # for (i=0; filename[i]; i++)
762 # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
763 # dll_name = filename + i +1;
765 # pe_header_offset = pe_get32 (dll, 0x3c);
766 # opthdr_ofs = pe_header_offset + 4 + 20;
767 # num_entries = pe_get32 (dll, opthdr_ofs + 92);
769 # if (num_entries < 1) /* no exports */
772 # export_rva = pe_get32 (dll, opthdr_ofs + 96);
773 # export_size = pe_get32 (dll, opthdr_ofs + 100);
774 # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
775 # secptr = (pe_header_offset + 4 + 20 +
776 # pe_get16 (dll, pe_header_offset + 4 + 16));
779 # for (i = 0; i < nsections; i++)
782 # unsigned long secptr1 = secptr + 40 * i;
783 # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
784 # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
785 # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
786 # lseek(dll, secptr1, SEEK_SET);
787 # read(dll, sname, 8);
788 # if (vaddr <= export_rva && vaddr+vsize > export_rva)
790 # expptr = fptr + (export_rva - vaddr);
791 # if (export_rva + export_size > vaddr + vsize)
792 # export_size = vsize - (export_rva - vaddr);
797 # expdata = (unsigned char*)malloc(export_size);
798 # lseek (dll, expptr, SEEK_SET);
799 # read (dll, expdata, export_size);
800 # erva = expdata - export_rva;
802 # nexp = pe_as32 (expdata+24);
803 # name_rvas = pe_as32 (expdata+32);
805 # printf ("EXPORTS\n");
806 # for (i = 0; i<nexp; i++)
808 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
809 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
814 # /* impgen.c ends here */
820 compile_command="$nonopt"
821 finalize_command="$nonopt"
832 if test -n "$shlibpath_var"; then
833 # get the directories listed in $shlibpath_var
834 eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
838 # now prepend the system-specific ones
839 eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
840 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
848 export_symbols_regex=
851 link_against_libtool_libs=
855 prefer_static_libs=no
867 # We need to know -static, to get the right output filenames.
871 -all-static | -static)
872 if test "X$arg" = "X-all-static"; then
873 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
874 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
876 if test -n "$link_static_flag"; then
877 dlopen_self=$dlopen_self_static
880 if test -z "$pic_flag" && test -n "$link_static_flag"; then
881 dlopen_self=$dlopen_self_static
884 build_libtool_libs=no
886 prefer_static_libs=yes
892 # See if our shared archives depend on static archives.
893 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
895 # Go through the arguments, transforming them on the way.
896 while test $# -gt 0; do
900 # If the previous option needs an argument, assign it.
901 if test -n "$prev"; then
904 compile_command="$compile_command @OUTPUT@"
905 finalize_command="$finalize_command @OUTPUT@"
911 if test "$preload" = no; then
912 # Add the symbol object into the linking commands.
913 compile_command="$compile_command @SYMFILE@"
914 finalize_command="$finalize_command @SYMFILE@"
918 *.la | *.lo) ;; # We handle these cases below.
920 if test "$dlself" = no; then
928 if test "$prev" = dlprefiles; then
930 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
940 if test "$prev" = dlfiles; then
941 dlfiles="$dlfiles $arg"
943 dlprefiles="$dlprefiles $arg"
950 export_symbols="$arg"
951 if test ! -f "$arg"; then
952 $echo "$modename: symbol file \`$arg' does not exist"
959 export_symbols_regex="$arg"
969 # We need an absolute path.
971 [\\/]* | [A-Za-z]:[\\/]*) ;;
973 $echo "$modename: only absolute run-paths are allowed" 1>&2
977 if test "$prev" = rpath; then
980 *) rpath="$rpath $arg" ;;
985 *) xrpath="$xrpath $arg" ;;
992 eval "$prev=\"\$arg\""
1003 if test -n "$link_static_flag"; then
1004 compile_command="$compile_command $link_static_flag"
1005 finalize_command="$finalize_command $link_static_flag"
1011 # FIXME: remove this flag sometime in the future.
1012 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1036 -export-symbols | -export-symbols-regex)
1037 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1038 $echo "$modename: not more than one -exported-symbols argument allowed"
1041 if test "X$arg" = "X-export-symbols"; then
1050 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1051 # We need an absolute path.
1053 [\\/]* | [A-Za-z]:[\\/]*) ;;
1055 absdir=`cd "$dir" && pwd`
1056 if test -z "$absdir"; then
1057 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1058 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1064 case " $deplibs " in
1066 *) deplibs="$deplibs $arg";;
1068 case " $lib_search_path " in
1070 *) lib_search_path="$lib_search_path $dir";;
1073 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1074 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1075 case ":$dllsearchpath:" in
1076 ::) dllsearchpath="$dllsearchdir";;
1077 *":$dllsearchdir:"*) ;;
1078 *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1085 if test "$arg" = "-lc"; then
1087 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1088 # These systems don't actually have c library (as such)
1091 *-*-rhapsody* | *-*-darwin1.[012])
1092 # Rhapsody C library is in the System framework
1093 deplibs="$deplibs -framework System"
1097 elif test "$arg" = "-lm"; then
1099 *-*-cygwin* | *-*-beos*)
1100 # These systems don't actually have math library (as such)
1103 *-*-rhapsody* | *-*-darwin1.[012])
1104 # Rhapsody math library is in the System framework
1105 deplibs="$deplibs -framework System"
1110 deplibs="$deplibs $arg"
1141 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1142 # We need an absolute path.
1144 [\\/]* | [A-Za-z]:[\\/]*) ;;
1146 $echo "$modename: only absolute run-paths are allowed" 1>&2
1152 *) xrpath="$xrpath $dir" ;;
1158 # If we have no pic_flag, then this is the same as -all-static.
1159 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1160 compile_command="$compile_command $link_static_flag"
1161 finalize_command="$finalize_command $link_static_flag"
1176 # Some other compiler flag.
1178 # Unknown arguments in both finalize_command and compile_command need
1179 # to be aesthetically quoted because they are evaled later.
1180 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1182 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1188 *.o | *.obj | *.a | *.lib)
1189 # A standard object.
1195 if test "$prev" = dlfiles; then
1196 dlfiles="$dlfiles $arg"
1197 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1201 # If libtool objects are unsupported, then we need to preload.
1206 if test "$prev" = dlprefiles; then
1207 # Preload the old-style object.
1208 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1211 libobjs="$libobjs $arg"
1215 # A libtool-controlled library.
1222 # Check to see that this really is a libtool archive.
1223 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1225 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1229 # If the library was installed with an old release of libtool,
1230 # it will not redefine variable installed.
1234 # If there is no directory component, then add one.
1236 */* | *\\*) . $arg ;;
1240 # Get the name of the library we link against.
1242 for l in $old_library $library_names; do
1246 if test -z "$linklib"; then
1247 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1251 # Find the relevant object directory and library name.
1252 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1254 if test "X$installed" = Xyes; then
1257 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1258 if test "X$dir" = "X$arg"; then
1265 if test -n "$dependency_libs"; then
1266 # Extract -R and -L from dependency_libs
1268 for deplib in $dependency_libs; do
1270 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1271 case " $rpath $xrpath " in
1272 *" $temp_xrpath "*) ;;
1273 *) xrpath="$xrpath $temp_xrpath";;
1275 -L*) case "$compile_command $temp_deplibs " in
1277 *) temp_deplibs="$temp_deplibs $deplib";;
1279 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1280 case " $lib_search_path " in
1282 *) lib_search_path="$lib_search_path $temp_dir";;
1285 *) temp_deplibs="$temp_deplibs $deplib";;
1288 dependency_libs="$temp_deplibs"
1291 if test -z "$libdir"; then
1292 # It is a libtool convenience library, so add in its objects.
1293 convenience="$convenience $dir/$old_library"
1294 old_convenience="$old_convenience $dir/$old_library"
1295 deplibs="$deplibs$dependency_libs"
1296 compile_command="$compile_command $dir/$old_library$dependency_libs"
1297 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1301 # This library was specified with -dlopen.
1302 if test "$prev" = dlfiles; then
1303 dlfiles="$dlfiles $arg"
1304 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1305 # If there is no dlname, no dlopen support or we're linking statically,
1306 # we need to preload.
1309 # We should not create a dependency on this library, but we
1310 # may need any libraries it requires.
1311 compile_command="$compile_command$dependency_libs"
1312 finalize_command="$finalize_command$dependency_libs"
1318 # The library was specified with -dlpreopen.
1319 if test "$prev" = dlprefiles; then
1320 # Prefer using a static library (so that no silly _DYNAMIC symbols
1321 # are required to link).
1322 if test -n "$old_library"; then
1323 dlprefiles="$dlprefiles $dir/$old_library"
1325 dlprefiles="$dlprefiles $dir/$linklib"
1330 if test -n "$library_names" &&
1331 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1332 link_against_libtool_libs="$link_against_libtool_libs $arg"
1333 if test -n "$shlibpath_var"; then
1334 # Make sure the rpath contains only unique directories.
1335 case "$temp_rpath " in
1337 *) temp_rpath="$temp_rpath $dir" ;;
1341 # We need an absolute path.
1343 [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1345 absdir=`cd "$dir" && pwd`
1346 if test -z "$absdir"; then
1347 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1348 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1354 # This is the magic to use -rpath.
1355 # Skip directories that are in the system default run-time
1356 # search path, unless they have been requested with -R.
1357 case " $sys_lib_dlsearch_path " in
1360 case "$compile_rpath " in
1362 *) compile_rpath="$compile_rpath $absdir"
1367 case " $sys_lib_dlsearch_path " in
1370 case "$finalize_rpath " in
1372 *) finalize_rpath="$finalize_rpath $libdir"
1378 case "$hardcode_action" in
1379 immediate | unsupported)
1380 if test "$hardcode_direct" = no; then
1381 compile_command="$compile_command $dir/$linklib"
1382 deplibs="$deplibs $dir/$linklib"
1384 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1385 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1386 if test -n "$dllsearchpath"; then
1387 dllsearchpath="$dllsearchpath:$dllsearchdir"
1389 dllsearchpath="$dllsearchdir"
1393 elif test "$hardcode_minus_L" = no; then
1396 compile_shlibpath="$compile_shlibpath$dir:"
1399 case "$compile_command " in
1401 *) compile_command="$compile_command -L$dir";;
1403 compile_command="$compile_command -l$name"
1404 deplibs="$deplibs -L$dir -l$name"
1405 elif test "$hardcode_shlibpath_var" = no; then
1406 case ":$compile_shlibpath:" in
1408 *) compile_shlibpath="$compile_shlibpath$dir:";;
1410 compile_command="$compile_command -l$name"
1411 deplibs="$deplibs -l$name"
1418 if test "$hardcode_direct" = yes; then
1419 compile_command="$compile_command $absdir/$linklib"
1420 deplibs="$deplibs $absdir/$linklib"
1421 elif test "$hardcode_minus_L" = yes; then
1422 case "$compile_command " in
1424 *) compile_command="$compile_command -L$absdir";;
1426 compile_command="$compile_command -l$name"
1427 deplibs="$deplibs -L$absdir -l$name"
1428 elif test "$hardcode_shlibpath_var" = yes; then
1429 case ":$compile_shlibpath:" in
1431 *) compile_shlibpath="$compile_shlibpath$absdir:";;
1433 compile_command="$compile_command -l$name"
1434 deplibs="$deplibs -l$name"
1445 if test "$lib_linked" != yes; then
1446 $echo "$modename: configuration error: unsupported hardcode properties"
1450 # Finalize command for both is simple: just hardcode it.
1451 if test "$hardcode_direct" = yes; then
1452 finalize_command="$finalize_command $libdir/$linklib"
1453 elif test "$hardcode_minus_L" = yes; then
1454 case "$finalize_command " in
1456 *) finalize_command="$finalize_command -L$libdir";;
1458 finalize_command="$finalize_command -l$name"
1459 elif test "$hardcode_shlibpath_var" = yes; then
1460 case ":$finalize_shlibpath:" in
1462 *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1464 finalize_command="$finalize_command -l$name"
1466 # We cannot seem to hardcode it, guess we'll fake it.
1467 case "$finalize_command " in
1469 *) finalize_command="$finalize_command -L$libdir";;
1471 finalize_command="$finalize_command -l$name"
1474 # Transform directly to old archives if we don't build new libraries.
1475 if test -n "$pic_flag" && test -z "$old_library"; then
1476 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1480 # Here we assume that one of hardcode_direct or hardcode_minus_L
1481 # is not unsupported. This is valid on all known static and
1483 if test "$hardcode_direct" != unsupported; then
1484 test -n "$old_library" && linklib="$old_library"
1485 compile_command="$compile_command $dir/$linklib"
1486 finalize_command="$finalize_command $dir/$linklib"
1488 case "$compile_command " in
1490 *) compile_command="$compile_command -L$dir";;
1492 compile_command="$compile_command -l$name"
1493 case "$finalize_command " in
1495 *) finalize_command="$finalize_command -L$dir";;
1497 finalize_command="$finalize_command -l$name"
1501 # Add in any libraries that this one depends upon.
1502 compile_command="$compile_command$dependency_libs"
1503 finalize_command="$finalize_command$dependency_libs"
1507 # Some other compiler argument.
1509 # Unknown arguments in both finalize_command and compile_command need
1510 # to be aesthetically quoted because they are evaled later.
1511 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1513 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1520 # Now actually substitute the argument into the commands.
1521 if test -n "$arg"; then
1522 compile_command="$compile_command $arg"
1523 finalize_command="$finalize_command $arg"
1527 if test -n "$prev"; then
1528 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1533 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1534 eval arg=\"$export_dynamic_flag_spec\"
1535 compile_command="$compile_command $arg"
1536 finalize_command="$finalize_command $arg"
1540 # calculate the name of the file, without its directory
1541 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1542 libobjs_save="$libobjs"
1546 $echo "$modename: you must specify an output file" 1>&2
1552 if test -n "$link_against_libtool_libs"; then
1553 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1557 if test -n "$deplibs"; then
1558 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1561 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1562 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1565 if test -n "$rpath"; then
1566 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1569 if test -n "$xrpath"; then
1570 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1573 if test -n "$vinfo"; then
1574 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1577 if test -n "$release"; then
1578 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1581 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1582 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1585 # Now set the variables for building old libraries.
1586 build_libtool_libs=no
1591 # Make sure we only generate libraries of the form `libNAME.la'.
1592 case "$outputname" in
1594 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1595 eval libname=\"$libname_spec\"
1598 if test "$module" = no; then
1599 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1603 if test "$need_lib_prefix" != no; then
1604 # Add the "lib" prefix for modules if required
1605 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1606 eval libname=\"$libname_spec\"
1608 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1613 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1614 if test "X$output_objdir" = "X$output"; then
1615 output_objdir="$objdir"
1617 output_objdir="$output_objdir/$objdir"
1620 if test -n "$objs"; then
1621 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1625 # How the heck are we supposed to write a wrapper for a shared library?
1626 if test -n "$link_against_libtool_libs"; then
1627 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1631 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1632 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1636 if test $# -gt 2; then
1637 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1642 if test -z "$rpath"; then
1643 if test "$build_libtool_libs" = yes; then
1644 # Building a libtool convenience library.
1646 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1647 build_libtool_libs=convenience
1650 dependency_libs="$deplibs"
1652 if test -n "$vinfo"; then
1653 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1656 if test -n "$release"; then
1657 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1661 # Parse the version information argument.
1662 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
1663 set dummy $vinfo 0 0 0
1666 if test -n "$8"; then
1667 $echo "$modename: too many parameters to \`-version-info'" 1>&2
1676 # Check that each of the things are valid numbers.
1678 0 | [1-9] | [1-9][0-9]*) ;;
1680 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1681 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1687 0 | [1-9] | [1-9][0-9]*) ;;
1689 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1690 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1696 0 | [1-9] | [1-9][0-9]*) ;;
1698 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1699 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1704 if test $age -gt $current; then
1705 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1706 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1710 # Calculate the version variables.
1714 case "$version_type" in
1718 major=`expr $current - $age + 1`
1719 versuffix="$major.$revision"
1720 verstring="sgi$major.$revision"
1722 # Add in all the interfaces that we are compatible with.
1724 while test $loop != 0; do
1725 iface=`expr $revision - $loop`
1726 loop=`expr $loop - 1`
1727 verstring="sgi$major.$iface:$verstring"
1732 major=.`expr $current - $age`
1733 versuffix="$major.$age.$revision"
1737 major=`expr $current - $age`
1738 versuffix=".$current.$age.$revision"
1739 verstring="$current.$age.$revision"
1741 # Add in all the interfaces that we are compatible with.
1743 while test $loop != 0; do
1744 iface=`expr $current - $loop`
1745 loop=`expr $loop - 1`
1746 verstring="$verstring:${iface}.0"
1749 # Make executables depend on our current version.
1750 verstring="$verstring:${current}.0"
1755 versuffix=".$current.$revision"
1760 versuffix=".$current.$revision";
1765 versuffix=".$current";
1769 # Like Linux, but with '-' rather than '.', since we only
1770 # want one extension on Windows 95.
1771 major=`expr $current - $age`
1772 versuffix="-$major-$age-$revision"
1776 # Like Linux, but with the current version available in
1777 # verstring for coding it into the library header
1778 major=.`expr $current - $age`
1779 versuffix="$major.$age.$revision"
1780 # Darwin ld doesn't like 0 for these options...
1781 minor_current=`expr $current + 1`
1782 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
1786 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1787 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1792 # Clear the version info if we defaulted, and they specified a release.
1793 if test -z "$vinfo" && test -n "$release"; then
1796 if test "$need_version" = no; then
1803 # Remove version info from name if versioning should be avoided
1804 if test "$avoid_version" = yes && test "$need_version" = no; then
1810 # Check to see if the archive will have undefined symbols.
1811 if test "$allow_undefined" = yes; then
1812 if test "$allow_undefined_flag" = unsupported; then
1813 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1814 build_libtool_libs=no
1818 # Don't allow undefined symbols.
1819 allow_undefined_flag="$no_undefined_flag"
1822 dependency_libs="$deplibs"
1824 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1825 # these systems don't actually have a c library (as such)!
1827 *-*-rhapsody* | *-*-darwin1.[012])
1828 # Rhapsody C library is in the System framework
1829 deplibs="$deplibs -framework System"
1832 # Add libc to deplibs on all other systems.
1833 deplibs="$deplibs -lc"
1838 # Create the output directory, or remove our outputs if we need to.
1839 if test -d $output_objdir; then
1840 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1841 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1843 $show "$mkdir $output_objdir"
1844 $run $mkdir $output_objdir
1846 if test $status -ne 0 && test ! -d $output_objdir; then
1851 # Now set the variables for building old libraries.
1852 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1853 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1855 # Transform .lo files to .o files.
1856 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1859 if test "$build_libtool_libs" = yes; then
1860 # Transform deplibs into only deplibs that can be linked in shared.
1862 libname_save=$libname
1863 release_save=$release
1864 versuffix_save=$versuffix
1866 # I'm not sure if I'm treating the release correctly. I think
1867 # release should show up in the -l (ie -lgmp5) so we don't want to
1868 # add it in twice. Is that correct?
1874 case "$deplibs_check_method" in
1876 # Don't check for shared/static. Everything works.
1877 # This might be a little naive. We might want to check
1878 # whether the library exists or not. But this is on
1879 # osf3 & osf4 and I'm not really sure... Just
1880 # implementing what was already the behaviour.
1884 # This code stresses the "libraries are programs" paradigm to its
1885 # limits. Maybe even breaks it. We compile a program, linking it
1886 # against the deplibs as a proxy for the library. Then we can check
1887 # whether they linked in statically or dynamically with ldd.
1889 cat > conftest.c <<EOF
1890 int main() { return 0; }
1893 $CC -o conftest conftest.c $deplibs
1894 if test $? -eq 0 ; then
1895 ldd_output=`ldd conftest`
1896 for i in $deplibs; do
1897 name="`expr X$i : 'X-l\(.*\)'`"
1898 # If $name is empty we are operating on a -L argument.
1899 if test "$name" != "" ; then
1900 libname=`eval \\$echo \"$libname_spec\"`
1901 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1902 set dummy $deplib_matches
1904 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1905 newdeplibs="$newdeplibs $i"
1909 echo "*** Warning: This library needs some functionality provided by $i."
1910 echo "*** I have the capability to make that library automatically link in when"
1911 echo "*** you link to this library. But I can only do this if you have a"
1912 echo "*** shared version of the library, which you do not appear to have."
1915 newdeplibs="$newdeplibs $i"
1919 # Error occured in the first compile. Let's try to salvage the situation:
1920 # Compile a seperate program for each library.
1921 for i in $deplibs; do
1922 name="`expr X$i : 'X-l\(.*\)'`"
1923 # If $name is empty we are operating on a -L argument.
1924 if test "$name" != "" ; then
1926 $CC -o conftest conftest.c $i
1928 if test $? -eq 0 ; then
1929 ldd_output=`ldd conftest`
1930 libname=`eval \\$echo \"$libname_spec\"`
1931 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1932 set dummy $deplib_matches
1934 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1935 newdeplibs="$newdeplibs $i"
1939 echo "*** Warning: This library needs some functionality provided by $i."
1940 echo "*** I have the capability to make that library automatically link in when"
1941 echo "*** you link to this library. But I can only do this if you have a"
1942 echo "*** shared version of the library, which you do not appear to have."
1947 echo "*** Warning! Library $i is needed by this library but I was not able to"
1948 echo "*** make it link in! You will probably need to install it or some"
1949 echo "*** library that it depends on before this library will be fully"
1950 echo "*** functional. Installing it before continuing would be even better."
1953 newdeplibs="$newdeplibs $i"
1959 set dummy $deplibs_check_method
1960 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
1961 for a_deplib in $deplibs; do
1962 name="`expr X$a_deplib : 'X-l\(.*\)'`"
1963 # If $name is empty we are operating on a -L argument.
1964 if test "$name" != "" ; then
1965 libname=`eval \\$echo \"$libname_spec\"`
1966 for i in $lib_search_path; do
1967 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1968 for potent_lib in $potential_libs; do
1969 # Follow soft links.
1970 if ls -lLd "$potent_lib" 2>/dev/null \
1971 | grep " -> " >/dev/null; then
1974 # The statement above tries to avoid entering an
1975 # endless loop below, in case of cyclic links.
1976 # We might still enter an endless loop, since a link
1977 # loop can be closed while we follow links,
1979 potlib="$potent_lib"
1980 while test -h "$potlib" 2>/dev/null; do
1981 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1982 case "$potliblink" in
1983 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
1984 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1987 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
1989 | egrep "$file_magic_regex" > /dev/null; then
1990 newdeplibs="$newdeplibs $a_deplib"
1996 if test -n "$a_deplib" ; then
1999 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2000 echo "*** I have the capability to make that library automatically link in when"
2001 echo "*** you link to this library. But I can only do this if you have a"
2002 echo "*** shared version of the library, which you do not appear to have."
2005 # Add a -L argument.
2006 newdeplibs="$newdeplibs $a_deplib"
2008 done # Gone through all deplibs.
2012 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2013 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2014 grep . >/dev/null; then
2016 if test "X$deplibs_check_method" = "Xnone"; then
2017 echo "*** Warning: inter-library dependencies are not supported in this platform."
2019 echo "*** Warning: inter-library dependencies are not known to be supported."
2021 echo "*** All declared inter-library dependencies are being dropped."
2026 versuffix=$versuffix_save
2028 release=$release_save
2029 libname=$libname_save
2032 if test "$droppeddeps" = yes; then
2033 if test "$module" = yes; then
2035 echo "*** Warning: libtool could not satisfy all declared inter-library"
2036 echo "*** dependencies of module $libname. Therefore, libtool will create"
2037 echo "*** a static module, that should work as long as the dlopening"
2038 echo "*** application is linked with the -dlopen flag."
2039 if test -z "$global_symbol_pipe"; then
2041 echo "*** However, this would only work if libtool was able to extract symbol"
2042 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2043 echo "*** not find such a program. So, this module is probably useless."
2044 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2046 if test "$build_old_libs" = no; then
2047 oldlibs="$output_objdir/$libname.$libext"
2048 build_libtool_libs=module
2051 build_libtool_libs=no
2054 echo "*** The inter-library dependencies that have been dropped here will be"
2055 echo "*** automatically added whenever a program is linked with this library"
2056 echo "*** or is declared to -dlopen it."
2059 # Done checking deplibs!
2063 # All the library-specific variables (install_libdir is set above).
2068 # Test again, we may have decided not to build it any more
2069 if test "$build_libtool_libs" = yes; then
2070 # Get the real and link names of the library.
2071 eval library_names=\"$library_names_spec\"
2072 set dummy $library_names
2076 if test -n "$soname_spec"; then
2077 eval soname=\"$soname_spec\"
2082 lib="$output_objdir/$realname"
2085 linknames="$linknames $link"
2088 # Ensure that we have .o objects for linkers which dislike .lo
2089 # (e.g. aix) in case we are running --disable-static
2090 for obj in $libobjs; do
2091 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2092 if test "X$xdir" = "X$obj"; then
2097 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2098 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2099 if test ! -f $xdir/$oldobj; then
2100 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2101 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2105 # Use standard objects if they are pic
2106 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2108 # Prepare the list of exported symbols
2109 if test -z "$export_symbols"; then
2110 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2111 $show "generating symbol list for \`$libname.la'"
2112 export_symbols="$output_objdir/$libname.exp"
2113 $run $rm $export_symbols
2114 eval cmds=\"$export_symbols_cmds\"
2115 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2116 for cmd in $cmds; do
2119 $run eval "$cmd" || exit $?
2122 if test -n "$export_symbols_regex"; then
2123 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2124 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2125 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2126 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2131 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2132 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2135 if test -n "$convenience"; then
2136 if test -n "$whole_archive_flag_spec"; then
2137 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2139 gentop="$output_objdir/${outputname}x"
2140 $show "${rm}r $gentop"
2141 $run ${rm}r "$gentop"
2142 $show "mkdir $gentop"
2143 $run mkdir "$gentop"
2145 if test $status -ne 0 && test ! -d "$gentop"; then
2148 generated="$generated $gentop"
2150 for xlib in $convenience; do
2151 # Extract the objects.
2153 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2154 *) xabs=`pwd`"/$xlib" ;;
2156 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2157 xdir="$gentop/$xlib"
2159 $show "${rm}r $xdir"
2164 if test $status -ne 0 && test ! -d "$xdir"; then
2167 $show "(cd $xdir && $AR x $xabs)"
2168 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2170 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2175 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2176 eval flag=\"$thread_safe_flag_spec\"
2177 linkopts="$linkopts $flag"
2180 # Do each of the archive commands.
2181 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2182 eval cmds=\"$archive_expsym_cmds\"
2184 if test "x$verstring" = "x0.0"; then
2187 tmp_verstring="$verstring"
2189 eval cmds=\"$archive_cmds\"
2191 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2192 for cmd in $cmds; do
2195 $run eval "$cmd" || exit $?
2199 # Create links to the real library.
2200 for linkname in $linknames; do
2201 if test "$realname" != "$linkname"; then
2202 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2203 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2207 # If -module or -export-dynamic was specified, set the dlname.
2208 if test "$module" = yes || test "$export_dynamic" = yes; then
2209 # On all known operating systems, these are identical.
2216 if test -n "$link_against_libtool_libs"; then
2217 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2221 if test -n "$deplibs"; then
2222 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2225 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2226 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2229 if test -n "$rpath"; then
2230 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2233 if test -n "$xrpath"; then
2234 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2237 if test -n "$vinfo"; then
2238 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2241 if test -n "$release"; then
2242 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2247 if test -n "$objs"; then
2248 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2252 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2260 # Delete the old objects.
2261 $run $rm $obj $libobj
2263 # Objects from convenience libraries. This assumes
2264 # single-version convenience libraries. Whenever we create
2265 # different ones for PIC/non-PIC, this we'll have to duplicate
2269 # reload_cmds runs $LD directly, so let us get rid of
2270 # -Wl from whole_archive_flag_spec
2273 if test -n "$convenience"; then
2274 if test -n "$whole_archive_flag_spec"; then
2275 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2277 gentop="$output_objdir/${obj}x"
2278 $show "${rm}r $gentop"
2279 $run ${rm}r "$gentop"
2280 $show "mkdir $gentop"
2281 $run mkdir "$gentop"
2283 if test $status -ne 0 && test ! -d "$gentop"; then
2286 generated="$generated $gentop"
2288 for xlib in $convenience; do
2289 # Extract the objects.
2291 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2292 *) xabs=`pwd`"/$xlib" ;;
2294 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2295 xdir="$gentop/$xlib"
2297 $show "${rm}r $xdir"
2302 if test $status -ne 0 && test ! -d "$xdir"; then
2305 $show "(cd $xdir && $AR x $xabs)"
2306 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2308 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2313 # Create the old-style object.
2314 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
2317 eval cmds=\"$reload_cmds\"
2318 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2319 for cmd in $cmds; do
2322 $run eval "$cmd" || exit $?
2326 # Exit if we aren't doing a library object file.
2327 if test -z "$libobj"; then
2328 if test -n "$gentop"; then
2329 $show "${rm}r $gentop"
2336 if test "$build_libtool_libs" != yes; then
2337 if test -n "$gentop"; then
2338 $show "${rm}r $gentop"
2342 # Create an invalid libtool object if no PIC, so that we don't
2343 # accidentally link it into a program.
2344 $show "echo timestamp > $libobj"
2345 $run eval "echo timestamp > $libobj" || exit $?
2349 if test -n "$pic_flag"; then
2350 # Only do commands if we really have different PIC objects.
2351 reload_objs="$libobjs $reload_conv_objs"
2353 eval cmds=\"$reload_cmds\"
2354 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2355 for cmd in $cmds; do
2358 $run eval "$cmd" || exit $?
2362 # Just create a symlink.
2365 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
2366 if test "X$xdir" = "X$libobj"; then
2371 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
2372 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2373 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
2374 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
2377 if test -n "$gentop"; then
2378 $show "${rm}r $gentop"
2385 # Anything else should be a program.
2387 if test -n "$vinfo"; then
2388 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2391 if test -n "$release"; then
2392 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2395 if test "$preload" = yes; then
2396 if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2397 test "$dlopen_self_static" = unknown; then
2398 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2402 if test -n "$rpath$xrpath"; then
2403 # If the user specified any rpath flags, then add them.
2404 for libdir in $rpath $xrpath; do
2405 # This is the magic to use -rpath.
2406 case "$compile_rpath " in
2408 *) compile_rpath="$compile_rpath $libdir" ;;
2410 case "$finalize_rpath " in
2412 *) finalize_rpath="$finalize_rpath $libdir" ;;
2417 # Now hardcode the library paths
2420 for libdir in $compile_rpath $finalize_rpath; do
2421 if test -n "$hardcode_libdir_flag_spec"; then
2422 if test -n "$hardcode_libdir_separator"; then
2423 if test -z "$hardcode_libdirs"; then
2424 hardcode_libdirs="$libdir"
2426 # Just accumulate the unique libdirs.
2427 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2428 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2431 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2436 eval flag=\"$hardcode_libdir_flag_spec\"
2437 rpath="$rpath $flag"
2439 elif test -n "$runpath_var"; then
2440 case "$perm_rpath " in
2442 *) perm_rpath="$perm_rpath $libdir" ;;
2446 # Substitute the hardcoded libdirs into the rpath.
2447 if test -n "$hardcode_libdir_separator" &&
2448 test -n "$hardcode_libdirs"; then
2449 libdir="$hardcode_libdirs"
2450 eval rpath=\" $hardcode_libdir_flag_spec\"
2452 compile_rpath="$rpath"
2456 for libdir in $finalize_rpath; do
2457 if test -n "$hardcode_libdir_flag_spec"; then
2458 if test -n "$hardcode_libdir_separator"; then
2459 if test -z "$hardcode_libdirs"; then
2460 hardcode_libdirs="$libdir"
2462 # Just accumulate the unique libdirs.
2463 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2464 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2467 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2472 eval flag=\"$hardcode_libdir_flag_spec\"
2473 rpath="$rpath $flag"
2475 elif test -n "$runpath_var"; then
2476 case "$finalize_perm_rpath " in
2478 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2482 # Substitute the hardcoded libdirs into the rpath.
2483 if test -n "$hardcode_libdir_separator" &&
2484 test -n "$hardcode_libdirs"; then
2485 libdir="$hardcode_libdirs"
2486 eval rpath=\" $hardcode_libdir_flag_spec\"
2488 finalize_rpath="$rpath"
2490 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2491 if test "X$output_objdir" = "X$output"; then
2492 output_objdir="$objdir"
2494 output_objdir="$output_objdir/$objdir"
2497 # Create the binary in the object directory, then wrap it.
2498 if test ! -d $output_objdir; then
2499 $show "$mkdir $output_objdir"
2500 $run $mkdir $output_objdir
2502 if test $status -ne 0 && test ! -d $output_objdir; then
2507 if test -n "$libobjs" && test "$build_old_libs" = yes; then
2508 # Transform all the library objects into standard objects.
2509 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2510 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2514 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2515 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2516 dlsyms="${outputname}S.c"
2518 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2522 if test -n "$dlsyms"; then
2526 # Discover the nlist of each of the dlfiles.
2527 nlist="$output_objdir/${outputname}.nm"
2529 $show "$rm $nlist ${nlist}S ${nlist}T"
2530 $run $rm "$nlist" "${nlist}S" "${nlist}T"
2532 # Parse the name list into a source file.
2533 $show "creating $output_objdir/$dlsyms"
2535 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
2536 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2537 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2543 /* Prevent the only kind of declaration conflicts we can make. */
2544 #define lt_preloaded_symbols some_other_symbol
2546 /* External symbol declarations for the compiler. */\
2549 if test "$dlself" = yes; then
2550 $show "generating symbol list for \`$output'"
2552 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2554 # Add our own program objects to the symbol list.
2555 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2556 for arg in $progfiles; do
2557 $show "extracting global C symbols from \`$arg'"
2558 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2561 if test -n "$exclude_expsyms"; then
2562 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2563 $run eval '$mv "$nlist"T "$nlist"'
2566 if test -n "$export_symbols_regex"; then
2567 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2568 $run eval '$mv "$nlist"T "$nlist"'
2571 # Prepare the list of exported symbols
2572 if test -z "$export_symbols"; then
2573 export_symbols="$output_objdir/$output.exp"
2574 $run $rm $export_symbols
2575 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2577 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2578 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2579 $run eval 'mv "$nlist"T "$nlist"'
2583 for arg in $dlprefiles; do
2584 $show "extracting global C symbols from \`$arg'"
2585 name=`echo "$arg" | sed -e 's%^.*/%%'`
2586 $run eval 'echo ": $name " >> "$nlist"'
2587 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2590 if test -z "$run"; then
2591 # Make sure we have at least an empty file.
2592 test -f "$nlist" || : > "$nlist"
2594 if test -n "$exclude_expsyms"; then
2595 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2596 $mv "$nlist"T "$nlist"
2599 # Try sorting and uniquifying the output.
2600 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2603 grep -v "^: " < "$nlist" > "$nlist"S
2606 if test -f "$nlist"S; then
2607 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2609 echo '/* NONE */' >> "$output_objdir/$dlsyms"
2612 $echo >> "$output_objdir/$dlsyms" "\
2614 #undef lt_preloaded_symbols
2616 #if defined (__STDC__) && __STDC__
2617 # define lt_ptr_t void *
2619 # define lt_ptr_t char *
2623 /* The mapping between symbol names and symbols. */
2628 lt_preloaded_symbols[] =
2632 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
2633 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
2634 < "$nlist" >> "$output_objdir/$dlsyms"
2636 $echo >> "$output_objdir/$dlsyms" "\
2640 /* This works around a problem in FreeBSD linker */
2641 #ifdef FREEBSD_WORKAROUND
2642 static const void *lt_preloaded_setup() {
2643 return lt_preloaded_symbols;
2653 pic_flag_for_symtable=
2655 # compiling the symbol table file with pic_flag works around
2656 # a FreeBSD bug that causes programs to crash when -lm is
2657 # linked before any other PIC object. But we must not use
2658 # pic_flag when linking with -static. The problem exists in
2659 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2660 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2661 case "$compile_command " in
2663 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2666 case "$compile_command " in
2668 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
2672 # Now compile the dynamic symbol file.
2673 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2674 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2676 # Clean up the generated files.
2677 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2678 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
2680 # Transform the symbol file into the correct name.
2681 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2682 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2685 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2690 # We keep going just in case the user didn't refer to
2691 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2692 # really was required.
2694 # Nullify the symbol file.
2695 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2696 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2699 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2700 # Replace the output file specification.
2701 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2702 link_command="$compile_command$compile_rpath"
2704 # We have no uninstalled library dependencies, so finalize right now.
2705 $show "$link_command"
2706 $run eval "$link_command"
2709 # Delete the generated files.
2710 if test -n "$dlsyms"; then
2711 $show "$rm $output_objdir/${outputname}S.${objext}"
2712 $run $rm "$output_objdir/${outputname}S.${objext}"
2718 if test -n "$shlibpath_var"; then
2719 # We should set the shlibpath_var
2721 for dir in $temp_rpath; do
2723 [\\/]* | [A-Za-z]:[\\/]*)
2728 # Relative path: add a thisdir entry.
2729 rpath="$rpath\$thisdir/$dir:"
2736 if test -n "$compile_shlibpath$finalize_shlibpath"; then
2737 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2739 if test -n "$finalize_shlibpath"; then
2740 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2745 if test -n "$runpath_var"; then
2746 if test -n "$perm_rpath"; then
2747 # We should set the runpath_var.
2749 for dir in $perm_rpath; do
2752 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2754 if test -n "$finalize_perm_rpath"; then
2755 # We should set the runpath_var.
2757 for dir in $finalize_perm_rpath; do
2760 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2764 if test "$hardcode_action" = relink; then
2765 # Fast installation is not supported
2766 link_command="$compile_var$compile_command$compile_rpath"
2767 relink_command="$finalize_var$finalize_command$finalize_rpath"
2769 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2770 $echo "$modename: \`$output' will be relinked during installation" 1>&2
2772 if test "$fast_install" != no; then
2773 link_command="$finalize_var$compile_command$finalize_rpath"
2774 if test "$fast_install" = yes; then
2775 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2777 # fast_install is set to needless
2781 link_command="$compile_var$compile_command$compile_rpath"
2782 relink_command="$finalize_var$finalize_command$finalize_rpath"
2786 # Replace the output file specification.
2787 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2789 # Delete the old output files.
2790 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2792 $show "$link_command"
2793 $run eval "$link_command" || exit $?
2795 # Now create the wrapper script.
2796 $show "creating $output"
2798 # Quote the relink command for shipping.
2799 if test -n "$relink_command"; then
2800 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2803 # Quote $echo for shipping.
2804 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2806 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2807 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2809 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2811 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2814 # Only actually do things if our run command is non-null.
2815 if test -z "$run"; then
2816 # win32 will think the script is a binary if it has
2817 # a .exe suffix, so we strip it off here.
2819 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2822 trap "$rm $output; exit 1" 1 2 15
2827 # $output - temporary wrapper script for $objdir/$outputname
2828 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2830 # The $output program cannot be directly executed until all the libtool
2831 # libraries that it depends on are installed.
2833 # This wrapper script should never be moved out of the build directory.
2834 # If it is, it will not operate correctly.
2836 # Sed substitution that helps us do robust quoting. It backslashifies
2837 # metacharacters that are still active within double-quoted strings.
2838 Xsed='sed -e 1s/^X//'
2839 sed_quote_subst='$sed_quote_subst'
2841 # The HP-UX ksh and POSIX shell print the target directory to stdout
2843 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
2845 relink_command=\"$relink_command\"
2847 # This environment variable determines our operation mode.
2848 if test \"\$libtool_install_magic\" = \"$magic\"; then
2849 # install mode needs the following variable:
2850 link_against_libtool_libs='$link_against_libtool_libs'
2852 # When we are sourced in execute mode, \$file and \$echo are already set.
2853 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2856 # Make sure echo works.
2857 if test \"X\$1\" = X--no-reexec; then
2858 # Discard the --no-reexec flag, and continue.
2860 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2861 # Yippee, \$echo works!
2864 # Restart under the correct shell, and then maybe \$echo will work.
2865 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2871 # Find the directory that this script lives in.
2872 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2873 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2875 # Follow symbolic links until we get to the real thisdir.
2876 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2877 while test -n \"\$file\"; do
2878 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2880 # If there was a directory component, then change thisdir.
2881 if test \"x\$destdir\" != \"x\$file\"; then
2882 case \"\$destdir\" in
2883 [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
2884 *) thisdir=\"\$thisdir/\$destdir\" ;;
2888 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2889 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2892 # Try to get the absolute directory name.
2893 absdir=\`cd \"\$thisdir\" && pwd\`
2894 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2897 if test "$fast_install" = yes; then
2899 program=lt-'$outputname'
2900 progdir=\"\$thisdir/$objdir\"
2902 if test ! -f \"\$progdir/\$program\" || \\
2903 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2904 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2906 file=\"\$\$-\$program\"
2908 if test ! -d \"\$progdir\"; then
2909 $mkdir \"\$progdir\"
2911 $rm \"\$progdir/\$file\"
2916 # relink executable if necessary
2917 if test -n \"\$relink_command\"; then
2918 if (cd \"\$thisdir\" && eval \$relink_command); then :
2920 $rm \"\$progdir/\$file\"
2925 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2926 { $rm \"\$progdir/\$program\";
2927 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2928 $rm \"\$progdir/\$file\"
2932 program='$outputname'
2933 progdir=\"\$thisdir/$objdir\"
2939 if test -f \"\$progdir/\$program\"; then"
2941 # Export our shlibpath_var if we have one.
2942 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2944 # Add our own library path to $shlibpath_var
2945 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2947 # Some systems cannot cope with colon-terminated $shlibpath_var
2948 # The second colon is a workaround for a bug in BeOS R4 sed
2949 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2951 export $shlibpath_var
2955 # fixup the dll searchpath if we need to.
2956 if test -n "$dllsearchpath"; then
2958 # Add the dll search path components to the executable PATH
2959 PATH=$dllsearchpath:\$PATH
2964 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2965 # Run the actual program with our arguments.
2968 # win32 systems need to use the prog path for dll
2972 exec \$progdir/\$program \${1+\"\$@\"}
2976 # Backslashes separate directories on plain windows
2977 *-*-mingw | *-*-os2*)
2979 exec \$progdir\\\\\$program \${1+\"\$@\"}
2985 # Export the path to the program.
2986 PATH=\"\$progdir:\$PATH\"
2989 exec \$program \${1+\"\$@\"}
2994 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
2998 # The program doesn't exist.
2999 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3000 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3001 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3012 # See if we need to build an old-fashioned archive.
3013 for oldlib in $oldlibs; do
3015 if test "$build_libtool_libs" = convenience; then
3016 oldobjs="$libobjs_save"
3017 addlibs="$convenience"
3018 build_libtool_libs=no
3020 if test "$build_libtool_libs" = module; then
3021 oldobjs="$libobjs_save"
3022 build_libtool_libs=no
3024 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3026 addlibs="$old_convenience"
3029 if test -n "$addlibs"; then
3030 gentop="$output_objdir/${outputname}x"
3031 $show "${rm}r $gentop"
3032 $run ${rm}r "$gentop"
3033 $show "mkdir $gentop"
3034 $run mkdir "$gentop"
3036 if test $status -ne 0 && test ! -d "$gentop"; then
3039 generated="$generated $gentop"
3041 # Add in members from convenience archives.
3042 for xlib in $addlibs; do
3043 # Extract the objects.
3045 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3046 *) xabs=`pwd`"/$xlib" ;;
3048 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3049 xdir="$gentop/$xlib"
3051 $show "${rm}r $xdir"
3056 if test $status -ne 0 && test ! -d "$xdir"; then
3059 $show "(cd $xdir && $AR x $xabs)"
3060 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3062 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3066 # Do each command in the archive commands.
3067 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3068 eval cmds=\"$old_archive_from_new_cmds\"
3070 # Ensure that we have .o objects in place in case we decided
3071 # not to build a shared library, and have fallen back to building
3072 # static libs even though --disable-static was passed!
3073 for oldobj in $oldobjs; do
3074 if test ! -f $oldobj; then
3075 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3076 if test "X$xdir" = "X$oldobj"; then
3081 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3082 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3083 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3084 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3088 eval cmds=\"$old_archive_cmds\"
3090 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3091 for cmd in $cmds; do
3094 $run eval "$cmd" || exit $?
3099 if test -n "$generated"; then
3100 $show "${rm}r$generated"
3101 $run ${rm}r$generated
3104 # Now create the libtool archive.
3108 test "$build_old_libs" = yes && old_library="$libname.$libext"
3109 $show "creating $output"
3111 if test -n "$xrpath"; then
3113 for libdir in $xrpath; do
3114 temp_xrpath="$temp_xrpath -R$libdir"
3116 dependency_libs="$temp_xrpath $dependency_libs"
3119 # Only create the output if not a dry run.
3120 if test -z "$run"; then
3121 for installed in no yes; do
3122 if test "$installed" = yes; then
3123 if test -z "$install_libdir"; then
3126 output="$output_objdir/$outputname"i
3130 # $outputname - a libtool library file
3131 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3133 # Please DO NOT delete this file!
3134 # It is necessary for linking the library.
3136 # The name that we can dlopen(3).
3139 # Names of this library.
3140 library_names='$library_names'
3142 # The name of the static archive.
3143 old_library='$old_library'
3145 # Libraries that this one depends upon.
3146 dependency_libs='$dependency_libs'
3148 # Version information for $libname.
3153 # Is this an already installed library?
3154 installed=$installed
3156 # Directory that this library needs to be installed in:
3157 libdir='$install_libdir'\
3162 # Do a symbolic link so that the libtool archive can be found in
3163 # LD_LIBRARY_PATH before the program is installed.
3164 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3165 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
3171 # libtool install mode
3173 modename="$modename: install"
3175 # There may be an optional sh(1) argument at the beginning of
3176 # install_prog (especially on Windows NT).
3177 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
3178 # Aesthetically quote it.
3179 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3181 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3185 install_prog="$arg "
3193 # The real first argument should be the name of the installation program.
3194 # Aesthetically quote it.
3195 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3197 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3201 install_prog="$install_prog$arg"
3203 # We need to accept at least all the BSD install flags.
3213 if test -n "$dest"; then
3214 files="$files $dest"
3232 # If the previous option needed an argument, then skip it.
3233 if test -n "$prev"; then
3242 # Aesthetically quote the argument.
3243 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3245 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3249 install_prog="$install_prog $arg"
3252 if test -z "$install_prog"; then
3253 $echo "$modename: you must specify an install program" 1>&2
3258 if test -n "$prev"; then
3259 $echo "$modename: the \`$prev' option requires an argument" 1>&2
3264 if test -z "$files"; then
3265 if test -z "$dest"; then
3266 $echo "$modename: no file or destination specified" 1>&2
3268 $echo "$modename: you must specify a destination" 1>&2
3274 # Strip any trailing slash from the destination.
3275 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
3277 # Check to see that the destination is a directory.
3278 test -d "$dest" && isdir=yes
3279 if test "$isdir" = yes; then
3283 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3284 test "X$destdir" = "X$dest" && destdir=.
3285 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3287 # Not a directory, so check to see that there is only one file specified.
3289 if test $# -gt 2; then
3290 $echo "$modename: \`$dest' is not a directory" 1>&2
3296 [\\/]* | [A-Za-z]:[\\/]*) ;;
3298 for file in $files; do
3302 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3311 # This variable tells wrapper scripts just to set variables rather
3312 # than running their programs.
3313 libtool_install_magic="$magic"
3318 for file in $files; do
3320 # Do each installation.
3323 # Do the static libraries later.
3324 staticlibs="$staticlibs $file"
3328 # Check to see that this really is a libtool archive.
3329 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3331 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3338 # If there is no directory component, then add one.
3340 */* | *\\*) . $file ;;
3344 # Add the libdir to current_libdirs if it is the destination.
3345 if test "X$destdir" = "X$libdir"; then
3346 case "$current_libdirs " in
3348 *) current_libdirs="$current_libdirs $libdir" ;;
3351 # Note the libdir as a future libdir.
3352 case "$future_libdirs " in
3354 *) future_libdirs="$future_libdirs $libdir" ;;
3358 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3359 test "X$dir" = "X$file/" && dir=
3362 # See the names of the shared library.
3363 set dummy $library_names
3364 if test -n "$2"; then
3369 # Install the shared library and build the symlinks.
3370 $show "$install_prog $dir/$realname $destdir/$realname"
3371 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3373 if test $# -gt 0; then
3374 # Delete the old symlinks, and create new ones.
3377 if test "$linkname" != "$realname"; then
3378 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3379 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3384 # Do each command in the postinstall commands.
3385 lib="$destdir/$realname"
3386 eval cmds=\"$postinstall_cmds\"
3387 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3388 for cmd in $cmds; do
3391 $run eval "$cmd" || exit $?
3396 # Install the pseudo-library for information purposes.
3397 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3398 instname="$dir/$name"i
3399 $show "$install_prog $instname $destdir/$name"
3400 $run eval "$install_prog $instname $destdir/$name" || exit $?
3402 # Maybe install the static library, too.
3403 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3407 # Install (i.e. copy) a libtool object.
3409 # Figure out destination file name, if it wasn't already specified.
3410 if test -n "$destname"; then
3411 destfile="$destdir/$destname"
3413 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3414 destfile="$destdir/$destfile"
3417 # Deduce the name of the destination old-style object file.
3420 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3423 staticdest="$destfile"
3427 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3433 # Install the libtool object if requested.
3434 if test -n "$destfile"; then
3435 $show "$install_prog $file $destfile"
3436 $run eval "$install_prog $file $destfile" || exit $?
3439 # Install the old object if enabled.
3440 if test "$build_old_libs" = yes; then
3441 # Deduce the name of the old-style object file.
3442 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3444 $show "$install_prog $staticobj $staticdest"
3445 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3451 # Figure out destination file name, if it wasn't already specified.
3452 if test -n "$destname"; then
3453 destfile="$destdir/$destname"
3455 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3456 destfile="$destdir/$destfile"
3459 # Do a test to see if this is really a libtool program.
3460 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3461 link_against_libtool_libs=
3464 # If there is no directory component, then add one.
3466 */* | *\\*) . $file ;;
3470 # Check the variables that should have been set.
3471 if test -z "$link_against_libtool_libs"; then
3472 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3477 for lib in $link_against_libtool_libs; do
3478 # Check to see that each library is installed.
3480 if test -f "$lib"; then
3481 # If there is no directory component, then add one.
3483 */* | *\\*) . $lib ;;
3487 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3488 if test -n "$libdir" && test ! -f "$libfile"; then
3489 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3495 if test "$fast_install" = no && test -n "$relink_command"; then
3496 if test "$finalize" = yes && test -z "$run"; then
3498 test -n "$TMPDIR" && tmpdir="$TMPDIR"
3499 tmpdir="$tmpdir/libtool-$$"
3500 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3502 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3505 outputname="$tmpdir/$file"
3506 # Replace the output file specification.
3507 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3509 $show "$relink_command"
3510 if $run eval "$relink_command"; then :
3512 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3518 $echo "$modename: warning: cannot relink \`$file'" 1>&2
3521 # Install the binary that we compiled earlier.
3522 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3526 $show "$install_prog$stripme $file $destfile"
3527 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3528 test -n "$outputname" && ${rm}r "$tmpdir"
3533 for file in $staticlibs; do
3534 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3536 # Set up the ranlib parameters.
3537 oldlib="$destdir/$name"
3539 $show "$install_prog $file $oldlib"
3540 $run eval "$install_prog \$file \$oldlib" || exit $?
3542 # Do each command in the postinstall commands.
3543 eval cmds=\"$old_postinstall_cmds\"
3544 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3545 for cmd in $cmds; do
3548 $run eval "$cmd" || exit $?
3553 if test -n "$future_libdirs"; then
3554 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3557 if test -n "$current_libdirs"; then
3558 # Maybe just do a dry run.
3559 test -n "$run" && current_libdirs=" -n$current_libdirs"
3560 exec $SHELL $0 --finish$current_libdirs
3567 # libtool finish mode
3569 modename="$modename: finish"
3573 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3576 libdirs="$libdirs $dir"
3579 for libdir in $libdirs; do
3580 if test -n "$finish_cmds"; then
3581 # Do each command in the finish commands.
3582 eval cmds=\"$finish_cmds\"
3583 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3584 for cmd in $cmds; do
3587 $run eval "$cmd" || admincmds="$admincmds
3592 if test -n "$finish_eval"; then
3593 # Do the single finish_eval.
3594 eval cmds=\"$finish_eval\"
3595 $run eval "$cmds" || admincmds="$admincmds
3601 # Exit here if they wanted silent mode.
3602 test "$show" = : && exit 0
3604 echo "----------------------------------------------------------------------"
3605 echo "Libraries have been installed in:"
3606 for libdir in $libdirs; do
3610 echo "If you ever happen to want to link against installed libraries"
3611 echo "in a given directory, LIBDIR, you must either use libtool, and"
3612 echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3613 echo "flag during linking and do at least one of the following:"
3614 if test -n "$shlibpath_var"; then
3615 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3616 echo " during execution"
3618 if test -n "$runpath_var"; then
3619 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3620 echo " during linking"
3622 if test -n "$hardcode_libdir_flag_spec"; then
3624 eval flag=\"$hardcode_libdir_flag_spec\"
3626 echo " - use the \`$flag' linker flag"
3628 if test -n "$admincmds"; then
3629 echo " - have your system administrator run these commands:$admincmds"
3631 if test -f /etc/ld.so.conf; then
3632 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3635 echo "See any operating system documentation about shared libraries for"
3636 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3637 echo "----------------------------------------------------------------------"
3641 # libtool execute mode
3643 modename="$modename: execute"
3645 # The first argument is the command name.
3647 if test -z "$cmd"; then
3648 $echo "$modename: you must specify a COMMAND" 1>&2
3653 # Handle -dlopen flags immediately.
3654 for file in $execute_dlfiles; do
3655 if test ! -f "$file"; then
3656 $echo "$modename: \`$file' is not a file" 1>&2
3664 # Check to see that this really is a libtool archive.
3665 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3667 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3672 # Read the libtool library.
3676 # If there is no directory component, then add one.
3678 */* | *\\*) . $file ;;
3682 # Skip this library if it cannot be dlopened.
3683 if test -z "$dlname"; then
3684 # Warn if it was a shared library.
3685 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3689 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3690 test "X$dir" = "X$file" && dir=.
3692 if test -f "$dir/$objdir/$dlname"; then
3695 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3701 # Just add the directory containing the .lo file.
3702 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3703 test "X$dir" = "X$file" && dir=.
3707 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3712 # Get the absolute pathname.
3713 absdir=`cd "$dir" && pwd`
3714 test -n "$absdir" && dir="$absdir"
3716 # Now add the directory to shlibpath_var.
3717 if eval "test -z \"\$$shlibpath_var\""; then
3718 eval "$shlibpath_var=\"\$dir\""
3720 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3724 # This variable tells wrapper scripts just to set shlibpath_var
3725 # rather than running their programs.
3726 libtool_execute_magic="$magic"
3728 # Check if any of the arguments is a wrapper script.
3735 # Do a test to see if this is really a libtool program.
3736 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3737 # If there is no directory component, then add one.
3739 */* | *\\*) . $file ;;
3743 # Transform arg to wrapped name.
3744 file="$progdir/$program"
3748 # Quote arguments (to preserve shell metacharacters).
3749 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3750 args="$args \"$file\""
3753 if test -z "$run"; then
3754 if test -n "$shlibpath_var"; then
3755 # Export the shlibpath_var.
3756 eval "export $shlibpath_var"
3759 # Restore saved enviroment variables
3760 if test "${save_LC_ALL+set}" = set; then
3761 LC_ALL="$save_LC_ALL"; export LC_ALL
3763 if test "${save_LANG+set}" = set; then
3764 LANG="$save_LANG"; export LANG
3767 # Now actually exec the command.
3768 eval "exec \$cmd$args"
3770 $echo "$modename: cannot exec \$cmd$args"
3773 # Display what would be done.
3774 if test -n "$shlibpath_var"; then
3775 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3776 $echo "export $shlibpath_var"
3783 # libtool uninstall mode
3785 modename="$modename: uninstall"
3792 -*) rm="$rm $arg" ;;
3793 *) files="$files $arg" ;;
3797 if test -z "$rm"; then
3798 $echo "$modename: you must specify an RM program" 1>&2
3803 for file in $files; do
3804 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3805 test "X$dir" = "X$file" && dir=.
3806 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3812 # Possibly a libtool archive, so verify it.
3813 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3816 # Delete the libtool libraries and symlinks.
3817 for n in $library_names; do
3818 rmfiles="$rmfiles $dir/$n"
3820 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3822 $show "$rm $rmfiles"
3825 if test -n "$library_names"; then
3826 # Do each command in the postuninstall commands.
3827 eval cmds=\"$postuninstall_cmds\"
3828 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3829 for cmd in $cmds; do
3837 if test -n "$old_library"; then
3838 # Do each command in the old_postuninstall commands.
3839 eval cmds=\"$old_postuninstall_cmds\"
3840 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3841 for cmd in $cmds; do
3849 # FIXME: should reinstall the best remaining shared library.
3854 if test "$build_old_libs" = yes; then
3855 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3856 rmfiles="$rmfiles $dir/$oldobj"
3858 $show "$rm $rmfiles"
3863 $show "$rm $rmfiles"
3872 $echo "$modename: you must specify a MODE" 1>&2
3873 $echo "$generic_help" 1>&2
3878 $echo "$modename: invalid operation mode \`$mode'" 1>&2
3879 $echo "$generic_help" 1>&2
3881 fi # test -z "$show_help"
3883 # We need to display help for each of the modes.
3886 "Usage: $modename [OPTION]... [MODE-ARG]...
3888 Provide generalized library-building support services.
3890 --config show all configuration variables
3891 --debug enable verbose shell tracing
3892 -n, --dry-run display commands without modifying any files
3893 --features display basic configuration information and exit
3894 --finish same as \`--mode=finish'
3895 --help display this help message and exit
3896 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
3897 --quiet same as \`--silent'
3898 --silent don't print informational messages
3899 --version print version information
3901 MODE must be one of the following:
3903 compile compile a source file into a libtool object
3904 execute automatically set library path, then run a program
3905 finish complete the installation of libtool libraries
3906 install install libraries or executables
3907 link create a library or an executable
3908 uninstall remove libraries from an installed directory
3910 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
3911 a more detailed description of MODE."
3917 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3919 Compile a source file into a libtool library object.
3921 This mode accepts the following additional options:
3923 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3924 -static always build a \`.o' file suitable for static linking
3926 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3927 from the given SOURCEFILE.
3929 The output file name is determined by removing the directory component from
3930 SOURCEFILE, then substituting the C source code suffix \`.c' with the
3931 library object suffix, \`.lo'."
3936 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
3938 Automatically set library path, then run a program.
3940 This mode accepts the following additional options:
3942 -dlopen FILE add the directory containing FILE to the library path
3944 This mode sets the library path environment variable according to \`-dlopen'
3947 If any of the ARGS are libtool executable wrappers, then they are translated
3948 into their corresponding uninstalled binary, and any of their required library
3949 directories are added to the library path.
3951 Then, COMMAND is executed, with ARGS as arguments."
3956 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
3958 Complete the installation of libtool libraries.
3960 Each LIBDIR is a directory that contains libtool libraries.
3962 The commands that this mode executes may require superuser privileges. Use
3963 the \`--dry-run' option if you just want to see what would be executed."
3968 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
3970 Install executables or libraries.
3972 INSTALL-COMMAND is the installation command. The first component should be
3973 either the \`install' or \`cp' program.
3975 The rest of the components are interpreted as arguments to that command (only
3976 BSD-compatible install options are recognized)."
3981 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
3983 Link object files or libraries together to form another library, or to
3984 create an executable program.
3986 LINK-COMMAND is a command using the C compiler that you would use to create
3987 a program from several object files.
3989 The following components of LINK-COMMAND are treated specially:
3991 -all-static do not do any dynamic linking at all
3992 -avoid-version do not add a version suffix if possible
3993 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
3994 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3995 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3996 -export-symbols SYMFILE
3997 try to export only the symbols listed in SYMFILE
3998 -export-symbols-regex REGEX
3999 try to export only the symbols matching REGEX
4000 -LLIBDIR search LIBDIR for required installed libraries
4001 -lNAME OUTPUT-FILE requires the installed library libNAME
4002 -module build a library that can dlopened
4003 -no-undefined declare that a library does not refer to external symbols
4004 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4005 -release RELEASE specify package release information
4006 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4007 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4008 -static do not do any dynamic linking of libtool libraries
4009 -version-info CURRENT[:REVISION[:AGE]]
4010 specify library version info [each variable defaults to 0]
4012 All other options (arguments beginning with \`-') are ignored.
4014 Every other argument is treated as a filename. Files ending in \`.la' are
4015 treated as uninstalled libtool libraries, other files are standard or library
4018 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4019 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4020 required, except when creating a convenience library.
4022 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4023 using \`ar' and \`ranlib', or on Windows using \`lib'.
4025 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4026 is created, otherwise an executable program is created."
4031 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4033 Remove libraries from an installation directory.
4035 RM is the name of the program to use to delete files associated with each FILE
4036 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4039 If FILE is a libtool library, all the files associated with it are deleted.
4040 Otherwise, only FILE itself is deleted using RM."
4044 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4051 $echo "Try \`$modename --help' for more information about other modes."