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.
29 # Check that we have a working $echo.
30 if test "X$1" = X--no-reexec; then
31 # Discard the --no-reexec flag, and continue.
33 elif test "X$1" = X--fallback-echo; then
34 # Avoid inline document here, it may be left over
36 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
37 # Yippee, $echo works!
40 # Restart under the correct shell, and then maybe $echo will work.
41 exec $SHELL "$0" --no-reexec ${1+"$@"}
44 if test "X$1" = X--fallback-echo; then
45 # used as fallback echo
53 # The name of this program.
54 progname=`$echo "$0" | sed 's%^.*/%%'`
60 VERSION=1.3.5-freebsd-ports
61 TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
64 help="Try \`$progname --help' for more information."
65 magic="%%%MAGIC variable%%%"
70 # Sed substitution that helps us do robust quoting. It backslashifies
71 # metacharacters that are still active within double-quoted strings.
73 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
75 NL2SP='tr \015\012 \040\040'
78 # Only set LANG and LC_ALL to C if already set.
79 # These must not be set unconditionally because not all systems understand
80 # e.g. LANG=C (notably SCO).
81 # We save the old values to restore during execute mode.
82 if test "${LC_ALL+set}" = set; then
83 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
85 if test "${LANG+set}" = set; then
86 save_LANG="$LANG"; LANG=C; export LANG
89 if test "$LTCONFIG_VERSION" != "$VERSION"; then
90 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
91 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
95 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
96 echo "$modename: not configured to build any kind of library" 1>&2
97 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
110 lo2o="s/\\.lo\$/.${objext}/"
111 o2lo="s/\\.${objext}\$/.lo/"
113 # Parse our command line options once, thoroughly.
120 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
124 # If the previous option needs an argument, assign it.
125 if test -n "$prev"; then
128 eval "$prev=\"\$$prev \$arg\""
140 # Have we seen a non-optional argument yet?
147 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
152 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
157 echo "$progname: enabling shell trace mode"
167 if test "$build_libtool_libs" = yes; then
168 echo "enable shared libraries"
170 echo "disable shared libraries"
172 if test "$build_old_libs" = yes; then
173 echo "enable static libraries"
175 echo "disable static libraries"
180 --finish) mode="finish" ;;
182 --mode) prevopt="--mode" prev=mode ;;
183 --mode=*) mode="$optarg" ;;
195 $echo "$modename: unrecognized option \`$arg'" 1>&2
207 if test -n "$prevopt"; then
208 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
213 if test -z "$show_help"; then
215 # Infer the operation mode.
216 if test -z "$mode"; then
218 *cc | *++ | gcc* | *-gcc*)
230 *db | *dbx | *strace | *truss)
240 # If we have no mode, but dlfiles were specified, then do execute mode.
241 test -n "$execute_dlfiles" && mode=execute
243 # Just use the default operation mode.
244 if test -z "$mode"; then
245 if test -n "$nonopt"; then
246 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
248 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
255 # Only execute mode is allowed to have -dlopen flags.
256 if test -n "$execute_dlfiles" && test "$mode" != execute; then
257 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
262 # Change the help message to a mode-specific one.
264 help="Try \`$modename --help --mode=$mode' for more information."
266 # These modes are in order of execution frequency so that they run quickly.
268 # libtool compile mode
270 modename="$modename: compile"
271 # Get the compilation command and the source file.
280 # Accept any command-line options.
283 if test "$user_target" != "no"; then
284 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
296 case "$user_target" in
298 # The next one is the -o target name
303 # We got the output file
310 # Accept the current argument as the source file.
314 # Aesthetically quote the previous argument.
316 # Backslashify any backslashes, double quotes, and dollar signs.
317 # These are the only characters that are still specially
318 # interpreted inside of double-quoted scrings.
319 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
321 # Double-quote args containing other shell metacharacters.
322 # Many Bourne shells cannot handle close brackets correctly in scan
323 # sets, so we specify it separately.
325 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
326 lastarg="\"$lastarg\""
330 # Add the previous argument to base_compile.
331 if test -z "$base_compile"; then
332 base_compile="$lastarg"
334 base_compile="$base_compile $lastarg"
338 case "$user_target" in
342 # Get the name of the library object.
343 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
346 $echo "$modename: you must specify a target with \`-o'" 1>&2
351 # Recognize several different file suffixes.
352 # If the user specifies -o file.o, it is replaced with file.lo
367 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
370 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
372 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
377 if test -z "$base_compile"; then
378 $echo "$modename: you must specify a compilation command" 1>&2
383 # Delete any leftover library objects.
384 if test "$build_old_libs" = yes; then
385 removelist="$obj $libobj"
391 trap "$run $rm $removelist; exit 1" 1 2 15
393 # Calculate the filename of the output object if compiler does
394 # not support -o with -c
395 if test "$compiler_c_o" = no; then
396 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
397 lockfile="$output_obj.lock"
398 removelist="$removelist $output_obj $lockfile"
399 trap "$run $rm $removelist; exit 1" 1 2 15
405 # Lock this critical section if it is needed
406 # We use this script file to make the link, it avoids creating a new file
407 if test "$need_locks" = yes; then
408 until ln "$0" "$lockfile" 2>/dev/null; do
409 $show "Waiting for $lockfile to be removed"
412 elif test "$need_locks" = warn; then
413 if test -f "$lockfile"; then
415 *** ERROR, $lockfile exists and contains:
416 `cat $lockfile 2>/dev/null`
418 This indicates that another process is trying to use the same
419 temporary object file, and libtool could not work around it because
420 your compiler does not support \`-c' and \`-o' together. If you
421 repeat this compilation, it may succeed, by chance, but you had better
422 avoid parallel builds (make -j) in this platform, or get a better
428 echo $srcfile > "$lockfile"
431 if test -n "$fix_srcfile_path"; then
432 eval srcfile=\"$fix_srcfile_path\"
435 # Only build a PIC object if we are building libtool libraries.
436 if test "$build_libtool_libs" = yes; then
437 # Without this assignment, base_compile gets emptied.
438 fbsd_hideous_sh_bug=$base_compile
440 # All platforms use -DPIC, to notify preprocessed assembler code.
441 command="$base_compile $srcfile $pic_flag -DPIC"
442 if test "$build_old_libs" = yes; then
444 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
445 if test "X$dir" = "X$libobj"; then
450 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
452 if test -d "$dir"; then
459 if test $status -ne 0 && test ! -d $dir; then
464 if test "$compiler_o_lo" = yes; then
466 command="$command -o $output_obj"
467 elif test "$compiler_c_o" = yes; then
469 command="$command -o $output_obj"
472 $run $rm "$output_obj"
474 if $run eval "$command"; then :
476 test -n "$output_obj" && $run $rm $removelist
480 if test "$need_locks" = warn &&
481 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
483 *** ERROR, $lockfile contains:
484 `cat $lockfile 2>/dev/null`
486 but it should contain:
489 This indicates that another process is trying to use the same
490 temporary object file, and libtool could not work around it because
491 your compiler does not support \`-c' and \`-o' together. If you
492 repeat this compilation, it may succeed, by chance, but you had better
493 avoid parallel builds (make -j) in this platform, or get a better
500 # Just move the object if needed, then go on to compile the next one
501 if test x"$output_obj" != x"$libobj"; then
502 $show "$mv $output_obj $libobj"
503 if $run $mv $output_obj $libobj; then :
511 # If we have no pic_flag, then copy the object into place and finish.
512 if test -z "$pic_flag" && test "$build_old_libs" = yes; then
513 # Rename the .lo from within objdir to obj
514 if test -f $obj; then
519 $show "$mv $libobj $obj"
520 if $run $mv $libobj $obj; then :
527 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
528 if test "X$xdir" = "X$obj"; then
533 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
534 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
535 # Now arrange that obj and lo_libobj become the same file
536 $show "(cd $xdir && $LN_S $baseobj $libobj)"
537 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
546 # Allow error messages only from the first compilation.
547 suppress_output=' >/dev/null 2>&1'
550 # Only build a position-dependent object if we build old libraries.
551 if test "$build_old_libs" = yes; then
552 command="$base_compile $srcfile"
553 if test "$compiler_c_o" = yes; then
554 command="$command -o $obj"
558 # Suppress compiler output if we already did a PIC compilation.
559 command="$command$suppress_output"
560 $run $rm "$output_obj"
562 if $run eval "$command"; then :
568 if test "$need_locks" = warn &&
569 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
571 *** ERROR, $lockfile contains:
572 `cat $lockfile 2>/dev/null`
574 but it should contain:
577 This indicates that another process is trying to use the same
578 temporary object file, and libtool could not work around it because
579 your compiler does not support \`-c' and \`-o' together. If you
580 repeat this compilation, it may succeed, by chance, but you had better
581 avoid parallel builds (make -j) in this platform, or get a better
588 # Just move the object if needed
589 if test x"$output_obj" != x"$obj"; then
590 $show "$mv $output_obj $obj"
591 if $run $mv $output_obj $obj; then :
599 # Create an invalid libtool object if no PIC, so that we do not
600 # accidentally link it into a program.
601 if test "$build_libtool_libs" != yes; then
602 $show "echo timestamp > $libobj"
603 $run eval "echo timestamp > \$libobj" || exit $?
605 # Move the .lo from within objdir
606 $show "$mv $libobj $lo_libobj"
607 if $run $mv $libobj $lo_libobj; then :
616 # Unlock the critical section if it was locked
617 if test "$need_locks" != no; then
626 modename="$modename: link"
628 *-*-cygwin* | *-*-mingw* | *-*-os2*)
629 # It is impossible to link a dll without this setting, and
630 # we shouldn't force the makefile maintainer to figure out
631 # which system we are compiling for in order to pass an extra
632 # flag for every libtool invokation.
635 # FIXME: Unfortunately, there are problems with the above when trying
636 # to make a dll which has undefined symbols, in which case not
637 # even a static library is built. For now, we need to specify
638 # -no-undefined on the libtool link line when we can be certain
639 # that all symbols are satisfied, otherwise we get a static library.
642 # This is a source program that is used to create dlls on Windows
643 # Don't remove nor modify the starting and closing comments
644 # /* ltdll.c starts here */
645 # #define WIN32_LEAN_AND_MEAN
646 # #include <windows.h>
647 # #undef WIN32_LEAN_AND_MEAN
651 # # ifdef __CYGWIN32__
652 # # define __CYGWIN__ __CYGWIN32__
659 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
665 # #include <cygwin/cygwin_dll.h>
666 # DECLARE_CYGWIN_DLL( DllMain );
668 # HINSTANCE __hDllInstance_base;
671 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
673 # __hDllInstance_base = hInst;
676 # /* ltdll.c ends here */
677 # This is a source program that is used to create import libraries
678 # on Windows for dlls which lack them. Don't remove nor modify the
679 # starting and closing comments
680 # /* impgen.c starts here */
681 # /* Copyright (C) 1999 Free Software Foundation, Inc.
683 # This file is part of GNU libtool.
685 # This program is free software; you can redistribute it and/or modify
686 # it under the terms of the GNU General Public License as published by
687 # the Free Software Foundation; either version 2 of the License, or
688 # (at your option) any later version.
690 # This program is distributed in the hope that it will be useful,
691 # but WITHOUT ANY WARRANTY; without even the implied warranty of
692 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
693 # GNU General Public License for more details.
695 # You should have received a copy of the GNU General Public License
696 # along with this program; if not, write to the Free Software
697 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
700 # #include <stdio.h> /* for printf() */
701 # #include <unistd.h> /* for open(), lseek(), read() */
702 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
703 # #include <string.h> /* for strdup() */
705 # static unsigned int
706 # pe_get16 (fd, offset)
710 # unsigned char b[2];
711 # lseek (fd, offset, SEEK_SET);
713 # return b[0] + (b[1]<<8);
716 # static unsigned int
717 # pe_get32 (fd, offset)
721 # unsigned char b[4];
722 # lseek (fd, offset, SEEK_SET);
724 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
727 # static unsigned int
731 # unsigned char *b = ptr;
732 # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
741 # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
742 # unsigned long export_rva, export_size, nsections, secptr, expptr;
743 # unsigned long name_rvas, nexp;
744 # unsigned char *expdata, *erva;
745 # char *filename, *dll_name;
747 # filename = argv[1];
749 # dll = open(filename, O_RDONLY|O_BINARY);
753 # dll_name = filename;
755 # for (i=0; filename[i]; i++)
756 # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
757 # dll_name = filename + i +1;
759 # pe_header_offset = pe_get32 (dll, 0x3c);
760 # opthdr_ofs = pe_header_offset + 4 + 20;
761 # num_entries = pe_get32 (dll, opthdr_ofs + 92);
763 # if (num_entries < 1) /* no exports */
766 # export_rva = pe_get32 (dll, opthdr_ofs + 96);
767 # export_size = pe_get32 (dll, opthdr_ofs + 100);
768 # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
769 # secptr = (pe_header_offset + 4 + 20 +
770 # pe_get16 (dll, pe_header_offset + 4 + 16));
773 # for (i = 0; i < nsections; i++)
776 # unsigned long secptr1 = secptr + 40 * i;
777 # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
778 # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
779 # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
780 # lseek(dll, secptr1, SEEK_SET);
781 # read(dll, sname, 8);
782 # if (vaddr <= export_rva && vaddr+vsize > export_rva)
784 # expptr = fptr + (export_rva - vaddr);
785 # if (export_rva + export_size > vaddr + vsize)
786 # export_size = vsize - (export_rva - vaddr);
791 # expdata = (unsigned char*)malloc(export_size);
792 # lseek (dll, expptr, SEEK_SET);
793 # read (dll, expdata, export_size);
794 # erva = expdata - export_rva;
796 # nexp = pe_as32 (expdata+24);
797 # name_rvas = pe_as32 (expdata+32);
799 # printf ("EXPORTS\n");
800 # for (i = 0; i<nexp; i++)
802 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
803 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
808 # /* impgen.c ends here */
814 compile_command="$nonopt"
815 finalize_command="$nonopt"
826 if test -n "$shlibpath_var"; then
827 # get the directories listed in $shlibpath_var
828 eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
832 # now prepend the system-specific ones
833 eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
834 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
842 export_symbols_regex=
845 link_against_libtool_libs=
849 prefer_static_libs=no
861 # We need to know -static, to get the right output filenames.
865 -all-static | -static)
866 if test "X$arg" = "X-all-static"; then
867 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
868 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
870 if test -n "$link_static_flag"; then
871 dlopen_self=$dlopen_self_static
874 if test -z "$pic_flag" && test -n "$link_static_flag"; then
875 dlopen_self=$dlopen_self_static
878 build_libtool_libs=no
880 prefer_static_libs=yes
886 # See if our shared archives depend on static archives.
887 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
889 # Go through the arguments, transforming them on the way.
890 while test $# -gt 0; do
894 # If the previous option needs an argument, assign it.
895 if test -n "$prev"; then
898 compile_command="$compile_command @OUTPUT@"
899 finalize_command="$finalize_command @OUTPUT@"
905 if test "$preload" = no; then
906 # Add the symbol object into the linking commands.
907 compile_command="$compile_command @SYMFILE@"
908 finalize_command="$finalize_command @SYMFILE@"
912 *.la | *.lo) ;; # We handle these cases below.
914 if test "$dlself" = no; then
922 if test "$prev" = dlprefiles; then
924 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
934 if test "$prev" = dlfiles; then
935 dlfiles="$dlfiles $arg"
937 dlprefiles="$dlprefiles $arg"
944 export_symbols="$arg"
945 if test ! -f "$arg"; then
946 $echo "$modename: symbol file \`$arg' does not exist"
953 export_symbols_regex="$arg"
958 if test "$release_suffix" = all; then
960 elif test "$release_suffix" = yes; then
967 # We need an absolute path.
969 [\\/]* | [A-Za-z]:[\\/]*) ;;
971 $echo "$modename: only absolute run-paths are allowed" 1>&2
975 if test "$prev" = rpath; then
978 *) rpath="$rpath $arg" ;;
983 *) xrpath="$xrpath $arg" ;;
990 eval "$prev=\"\$arg\""
1001 if test -n "$link_static_flag"; then
1002 compile_command="$compile_command $link_static_flag"
1003 finalize_command="$finalize_command $link_static_flag"
1009 # FIXME: remove this flag sometime in the future.
1010 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1035 -export-symbols | -export-symbols-regex)
1036 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1037 $echo "$modename: not more than one -exported-symbols argument allowed"
1040 if test "X$arg" = "X-export-symbols"; then
1049 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1050 # We need an absolute path.
1052 [\\/]* | [A-Za-z]:[\\/]*) ;;
1054 absdir=`cd "$dir" && pwd`
1055 if test -z "$absdir"; then
1056 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1057 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1063 case " $deplibs " in
1065 *) deplibs="$deplibs $arg";;
1067 case " $lib_search_path " in
1069 *) lib_search_path="$lib_search_path $dir";;
1072 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1073 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1074 case ":$dllsearchpath:" in
1075 ::) dllsearchpath="$dllsearchdir";;
1076 *":$dllsearchdir:"*) ;;
1077 *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1084 if test "$arg" = "-lc"; then
1086 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1087 # These systems don't actually have c library (as such)
1091 elif test "$arg" = "-lm"; then
1093 *-*-cygwin* | *-*-beos*)
1094 # These systems don't actually have math library (as such)
1099 deplibs="$deplibs $arg"
1103 deplibs="$deplibs $arg"
1134 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1135 # We need an absolute path.
1137 [\\/]* | [A-Za-z]:[\\/]*) ;;
1139 $echo "$modename: only absolute run-paths are allowed" 1>&2
1145 *) xrpath="$xrpath $dir" ;;
1151 # If we have no pic_flag, then this is the same as -all-static.
1152 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1153 compile_command="$compile_command $link_static_flag"
1154 finalize_command="$finalize_command $link_static_flag"
1169 # Some other compiler flag.
1171 # Unknown arguments in both finalize_command and compile_command need
1172 # to be aesthetically quoted because they are evaled later.
1173 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1175 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1181 *.o | *.obj | *.a | *.lib)
1182 # A standard object.
1183 libobjs="$libobjs $arg"
1188 if test "$prev" = dlfiles; then
1189 dlfiles="$dlfiles $arg"
1190 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1194 # If libtool objects are unsupported, then we need to preload.
1199 if test "$prev" = dlprefiles; then
1200 # Preload the old-style object.
1201 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1204 libobjs="$libobjs $arg"
1208 # A libtool-controlled library.
1215 # Check to see that this really is a libtool archive.
1216 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1218 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1222 # If the library was installed with an old release of libtool,
1223 # it will not redefine variable installed.
1227 # If there is no directory component, then add one.
1229 */* | *\\*) . $arg ;;
1233 # Get the name of the library we link against.
1235 for l in $old_library $library_names; do
1239 if test -z "$linklib"; then
1240 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
1244 # Find the relevant object directory and library name.
1245 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1247 if test "X$installed" = Xyes; then
1250 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1251 if test "X$dir" = "X$arg"; then
1258 if test -n "$dependency_libs"; then
1259 # Extract -R and -L from dependency_libs
1261 for deplib in $dependency_libs; do
1263 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1264 case " $rpath $xrpath " in
1265 *" $temp_xrpath "*) ;;
1266 *) xrpath="$xrpath $temp_xrpath";;
1268 -L*) case "$compile_command $temp_deplibs " in
1270 *) temp_deplibs="$temp_deplibs $deplib";;
1272 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1273 case " $lib_search_path " in
1275 *) lib_search_path="$lib_search_path $temp_dir";;
1278 *) temp_deplibs="$temp_deplibs $deplib";;
1281 dependency_libs="$temp_deplibs"
1284 if test -z "$libdir"; then
1285 # It is a libtool convenience library, so add in its objects.
1286 convenience="$convenience $dir/$old_library"
1287 old_convenience="$old_convenience $dir/$old_library"
1288 deplibs="$deplibs$dependency_libs"
1289 compile_command="$compile_command $dir/$old_library$dependency_libs"
1290 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1294 # This library was specified with -dlopen.
1295 if test "$prev" = dlfiles; then
1296 dlfiles="$dlfiles $arg"
1297 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1298 # If there is no dlname, no dlopen support or we're linking statically,
1299 # we need to preload.
1302 # We should not create a dependency on this library, but we
1303 # may need any libraries it requires.
1304 compile_command="$compile_command$dependency_libs"
1305 finalize_command="$finalize_command$dependency_libs"
1311 # The library was specified with -dlpreopen.
1312 if test "$prev" = dlprefiles; then
1313 # Prefer using a static library (so that no silly _DYNAMIC symbols
1314 # are required to link).
1315 if test -n "$old_library"; then
1316 dlprefiles="$dlprefiles $dir/$old_library"
1318 dlprefiles="$dlprefiles $dir/$linklib"
1323 if test -n "$library_names" &&
1324 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1325 link_against_libtool_libs="$link_against_libtool_libs $arg"
1326 if test -n "$shlibpath_var"; then
1327 # Make sure the rpath contains only unique directories.
1328 case "$temp_rpath " in
1330 *) temp_rpath="$temp_rpath $dir" ;;
1334 # We need an absolute path.
1336 [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1338 absdir=`cd "$dir" && pwd`
1339 if test -z "$absdir"; then
1340 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1341 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1347 # This is the magic to use -rpath.
1348 # Skip directories that are in the system default run-time
1349 # search path, unless they have been requested with -R.
1350 case " $sys_lib_dlsearch_path " in
1353 case "$compile_rpath " in
1355 *) compile_rpath="$compile_rpath $absdir"
1360 case " $sys_lib_dlsearch_path " in
1363 case "$finalize_rpath " in
1365 *) finalize_rpath="$finalize_rpath $libdir"
1371 case "$hardcode_action" in
1372 immediate | unsupported)
1373 if test "$hardcode_direct" = no; then
1374 compile_command="$compile_command $dir/$linklib"
1375 deplibs="$deplibs $dir/$linklib"
1377 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1378 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1379 if test -n "$dllsearchpath"; then
1380 dllsearchpath="$dllsearchpath:$dllsearchdir"
1382 dllsearchpath="$dllsearchdir"
1386 elif test "$hardcode_minus_L" = no; then
1389 compile_shlibpath="$compile_shlibpath$dir:"
1392 case "$compile_command " in
1394 *) compile_command="$compile_command -L$dir";;
1396 compile_command="$compile_command -l$name"
1397 deplibs="$deplibs -L$dir -l$name"
1398 elif test "$hardcode_shlibpath_var" = no; then
1399 case ":$compile_shlibpath:" in
1401 *) compile_shlibpath="$compile_shlibpath$dir:";;
1403 compile_command="$compile_command -l$name"
1404 deplibs="$deplibs -l$name"
1411 if test "$hardcode_direct" = yes; then
1412 compile_command="$compile_command $absdir/$linklib"
1413 deplibs="$deplibs $absdir/$linklib"
1414 elif test "$hardcode_minus_L" = yes; then
1415 case "$compile_command " in
1417 *) compile_command="$compile_command -L$absdir";;
1419 compile_command="$compile_command -l$name"
1420 deplibs="$deplibs -L$absdir -l$name"
1421 elif test "$hardcode_shlibpath_var" = yes; then
1422 case ":$compile_shlibpath:" in
1424 *) compile_shlibpath="$compile_shlibpath$absdir:";;
1426 compile_command="$compile_command -l$name"
1427 deplibs="$deplibs -l$name"
1438 if test "$lib_linked" != yes; then
1439 $echo "$modename: configuration error: unsupported hardcode properties"
1443 # Finalize command for both is simple: just hardcode it.
1444 if test "$hardcode_direct" = yes; then
1445 finalize_command="$finalize_command $libdir/$linklib"
1446 elif test "$hardcode_minus_L" = yes; then
1447 case "$finalize_command " in
1449 *) finalize_command="$finalize_command -L$libdir";;
1451 finalize_command="$finalize_command -l$name"
1452 elif test "$hardcode_shlibpath_var" = yes; then
1453 case ":$finalize_shlibpath:" in
1455 *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1457 finalize_command="$finalize_command -l$name"
1459 # We cannot seem to hardcode it, guess we'll fake it.
1460 case "$finalize_command " in
1462 *) finalize_command="$finalize_command -L$libdir";;
1464 finalize_command="$finalize_command -l$name"
1467 # Transform directly to old archives if we don't build new libraries.
1468 if test -n "$pic_flag" && test -z "$old_library"; then
1469 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1473 # Here we assume that one of hardcode_direct or hardcode_minus_L
1474 # is not unsupported. This is valid on all known static and
1476 if test "$hardcode_direct" != unsupported; then
1477 test -n "$old_library" && linklib="$old_library"
1478 compile_command="$compile_command $dir/$linklib"
1479 finalize_command="$finalize_command $dir/$linklib"
1481 case "$compile_command " in
1483 *) compile_command="$compile_command -L$dir";;
1485 compile_command="$compile_command -l$name"
1486 case "$finalize_command " in
1488 *) finalize_command="$finalize_command -L$dir";;
1490 finalize_command="$finalize_command -l$name"
1494 # Add in any libraries that this one depends upon.
1495 compile_command="$compile_command$dependency_libs"
1496 finalize_command="$finalize_command$dependency_libs"
1500 # Some other compiler argument.
1502 # Unknown arguments in both finalize_command and compile_command need
1503 # to be aesthetically quoted because they are evaled later.
1504 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1506 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1513 # Now actually substitute the argument into the commands.
1514 if test -n "$arg"; then
1515 compile_command="$compile_command $arg"
1516 finalize_command="$finalize_command $arg"
1520 if test -n "$prev"; then
1521 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1526 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1527 eval arg=\"$export_dynamic_flag_spec\"
1528 compile_command="$compile_command $arg"
1529 finalize_command="$finalize_command $arg"
1533 # calculate the name of the file, without its directory
1534 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1535 libobjs_save="$libobjs"
1539 $echo "$modename: you must specify an output file" 1>&2
1545 if test -n "$link_against_libtool_libs"; then
1546 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1550 if test -n "$deplibs"; then
1551 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1554 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1555 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1558 if test -n "$rpath"; then
1559 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1562 if test -n "$xrpath"; then
1563 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1566 if test -n "$vinfo"; then
1567 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1570 if test -n "$release"; then
1571 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1574 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1575 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1578 # Now set the variables for building old libraries.
1579 build_libtool_libs=no
1584 # Make sure we only generate libraries of the form `libNAME.la'.
1585 case "$outputname" in
1587 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1588 eval libname=\"$libname_spec\"
1591 if test "$module" = no; then
1592 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1596 if test "$need_lib_prefix" != no; then
1597 # Add the "lib" prefix for modules if required
1598 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1599 eval libname=\"$libname_spec\"
1601 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1606 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1607 if test "X$output_objdir" = "X$output"; then
1608 output_objdir="$objdir"
1610 output_objdir="$output_objdir/$objdir"
1613 if test -n "$objs"; then
1614 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1618 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1619 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1623 if test $# -gt 2; then
1624 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1629 if test -z "$rpath"; then
1630 if test "$build_libtool_libs" = yes; then
1631 # Building a libtool convenience library.
1633 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1634 build_libtool_libs=convenience
1637 dependency_libs="$deplibs"
1639 if test -n "$vinfo"; then
1640 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1643 if test -n "$release"; then
1644 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1648 # Parse the version information argument.
1649 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
1650 set dummy $vinfo 0 0 0
1653 if test -n "$8"; then
1654 $echo "$modename: too many parameters to \`-version-info'" 1>&2
1663 # Check that each of the things are valid numbers.
1665 0 | [1-9] | [1-9][0-9]*) ;;
1667 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1668 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1674 0 | [1-9] | [1-9][0-9]*) ;;
1676 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1677 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1683 0 | [1-9] | [1-9][0-9]*) ;;
1685 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1686 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1691 if test $age -gt $current; then
1692 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1693 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1697 # Calculate the version variables.
1701 case "$version_type" in
1705 major=`expr $current - $age + 1`
1706 versuffix="$major.$revision"
1707 verstring="sgi$major.$revision"
1709 # Add in all the interfaces that we are compatible with.
1711 while test $loop != 0; do
1712 iface=`expr $revision - $loop`
1713 loop=`expr $loop - 1`
1714 verstring="sgi$major.$iface:$verstring"
1719 major=.`expr $current - $age`
1720 versuffix="$major.$age.$revision"
1724 major=`expr $current - $age`
1725 versuffix=".$current.$age.$revision"
1726 verstring="$current.$age.$revision"
1728 # Add in all the interfaces that we are compatible with.
1730 while test $loop != 0; do
1731 iface=`expr $current - $loop`
1732 loop=`expr $loop - 1`
1733 verstring="$verstring:${iface}.0"
1736 # Make executables depend on our current version.
1737 verstring="$verstring:${current}.0"
1742 versuffix=".$current.$revision"
1747 versuffix=".$current.$revision";
1752 versuffix=".$current";
1756 # Like Linux, but with '-' rather than '.', since we only
1757 # want one extension on Windows 95.
1758 major=`expr $current - $age`
1759 versuffix="-$major-$age-$revision"
1763 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1764 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1769 # Clear the version info if we defaulted, and they specified a release.
1770 if test -z "$vinfo" && test -n "$release"; then
1773 if test "$need_version" = no; then
1780 # Remove version info from name if versioning should be avoided
1781 if test "$avoid_version" = yes && test "$need_version" = no; then
1787 # Check to see if the archive will have undefined symbols.
1788 if test "$allow_undefined" = yes; then
1789 if test "$allow_undefined_flag" = unsupported; then
1790 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1791 build_libtool_libs=no
1795 # Don't allow undefined symbols.
1796 allow_undefined_flag="$no_undefined_flag"
1799 dependency_libs="$deplibs"
1801 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1802 # these systems don't actually have a c library (as such)!
1805 # rhapsody is a little odd...
1806 deplibs="$deplibs -framework System"
1809 # FreeBSD doesn't need this...
1812 # Add libc to deplibs on all other systems.
1813 deplibs="$deplibs -lc"
1818 if test -n "$rpath$xrpath"; then
1819 # If the user specified any rpath flags, then add them.
1820 for libdir in $rpath $xrpath; do
1821 # This is the magic to use -rpath.
1822 case "$compile_rpath " in
1824 *) compile_rpath="$compile_rpath $libdir" ;;
1826 case "$finalize_rpath " in
1828 *) finalize_rpath="$finalize_rpath $libdir" ;;
1833 # Now hardcode the library paths
1836 for libdir in $compile_rpath; do
1837 if test -n "$hardcode_libdir_flag_spec"; then
1838 if test -n "$hardcode_libdir_separator"; then
1839 if test -z "$hardcode_libdirs"; then
1840 hardcode_libdirs="$libdir"
1842 # Just accumulate the unique libdirs.
1843 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1844 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1847 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1852 eval flag=\"$hardcode_libdir_flag_spec\"
1853 rpath="$rpath $flag"
1855 elif test -n "$runpath_var"; then
1856 case "$perm_rpath " in
1858 *) perm_rpath="$perm_rpath $libdir" ;;
1862 # Substitute the hardcoded libdirs into the rpath.
1863 if test -n "$hardcode_libdir_separator" &&
1864 test -n "$hardcode_libdirs"; then
1865 libdir="$hardcode_libdirs"
1866 eval rpath=\" $hardcode_libdir_flag_spec\"
1868 compile_rpath="$rpath"
1872 for libdir in $finalize_rpath; do
1873 if test -n "$hardcode_libdir_flag_spec"; then
1874 if test -n "$hardcode_libdir_separator"; then
1875 if test -z "$hardcode_libdirs"; then
1876 hardcode_libdirs="$libdir"
1878 # Just accumulate the unique libdirs.
1879 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1880 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1883 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1888 eval flag=\"$hardcode_libdir_flag_spec\"
1889 rpath="$rpath $flag"
1891 elif test -n "$runpath_var"; then
1892 case "$finalize_perm_rpath " in
1894 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
1898 # Substitute the hardcoded libdirs into the rpath.
1899 if test -n "$hardcode_libdir_separator" &&
1900 test -n "$hardcode_libdirs"; then
1901 libdir="$hardcode_libdirs"
1902 eval rpath=\" $hardcode_libdir_flag_spec\"
1904 finalize_rpath="$rpath"
1906 # Create the output directory, or remove our outputs if we need to.
1907 if test -d $output_objdir; then
1908 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1909 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1911 $show "$mkdir $output_objdir"
1912 $run $mkdir $output_objdir
1914 if test $status -ne 0 && test ! -d $output_objdir; then
1919 # Now set the variables for building old libraries.
1920 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1921 if test "$release_suffix" = all; then
1922 oldlibs="$oldlibs $output_objdir/$libname$release.$libext"
1924 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1927 # Transform .lo files to .o files.
1928 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1931 if test "$build_libtool_libs" = yes; then
1932 # Transform deplibs into only deplibs that can be linked in shared.
1934 libname_save=$libname
1935 release_save=$release
1936 versuffix_save=$versuffix
1938 # I'm not sure if I'm treating the release correctly. I think
1939 # release should show up in the -l (ie -lgmp5) so we don't want to
1940 # add it in twice. Is that correct?
1946 case "$deplibs_check_method" in
1948 # Don't check for shared/static. Everything works.
1949 # This might be a little naive. We might want to check
1950 # whether the library exists or not. But this is on
1951 # osf3 & osf4 and I'm not really sure... Just
1952 # implementing what was already the behaviour.
1956 # This code stresses the "libraries are programs" paradigm to its
1957 # limits. Maybe even breaks it. We compile a program, linking it
1958 # against the deplibs as a proxy for the library. Then we can check
1959 # whether they linked in statically or dynamically with ldd.
1961 cat > conftest.c <<EOF
1962 int main() { return 0; }
1965 $CC -o conftest conftest.c $deplibs
1966 if test $? -eq 0 ; then
1967 ldd_output=`ldd conftest`
1968 for i in $deplibs; do
1969 name="`expr $i : '-l\(.*\)'`"
1970 # If $name is empty we are operating on a -L argument.
1971 if test "$name" != "" ; then
1972 libname=`eval \\$echo \"$libname_spec\"`
1973 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1974 set dummy $deplib_matches
1976 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1977 newdeplibs="$newdeplibs $i"
1981 echo "*** Warning: This library needs some functionality provided by $i."
1982 echo "*** I have the capability to make that library automatically link in when"
1983 echo "*** you link to this library. But I can only do this if you have a"
1984 echo "*** shared version of the library, which you do not appear to have."
1987 newdeplibs="$newdeplibs $i"
1991 # Error occured in the first compile. Let's try to salvage the situation:
1992 # Compile a seperate program for each library.
1993 for i in $deplibs; do
1994 name="`expr $i : '-l\(.*\)'`"
1995 # If $name is empty we are operating on a -L argument.
1996 if test "$name" != "" ; then
1998 $CC -o conftest conftest.c $i
2000 if test $? -eq 0 ; then
2001 ldd_output=`ldd conftest`
2002 libname=`eval \\$echo \"$libname_spec\"`
2003 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2004 set dummy $deplib_matches
2006 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2007 newdeplibs="$newdeplibs $i"
2011 echo "*** Warning: This library needs some functionality provided by $i."
2012 echo "*** I have the capability to make that library automatically link in when"
2013 echo "*** you link to this library. But I can only do this if you have a"
2014 echo "*** shared version of the library, which you do not appear to have."
2019 echo "*** Warning! Library $i is needed by this library but I was not able to"
2020 echo "*** make it link in! You will probably need to install it or some"
2021 echo "*** library that it depends on before this library will be fully"
2022 echo "*** functional. Installing it before continuing would be even better."
2025 newdeplibs="$newdeplibs $i"
2031 set dummy $deplibs_check_method
2032 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
2033 for a_deplib in $deplibs; do
2034 name="`expr $a_deplib : '-l\(.*\)'`"
2035 # If $name is empty we are operating on a -L argument.
2036 if test "$name" != "" ; then
2037 libname=`eval \\$echo \"$libname_spec\"`
2038 for i in $lib_search_path; do
2039 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2040 for potent_lib in $potential_libs; do
2041 # Follow soft links.
2042 if ls -lLd "$potent_lib" 2>/dev/null \
2043 | grep " -> " >/dev/null; then
2046 # The statement above tries to avoid entering an
2047 # endless loop below, in case of cyclic links.
2048 # We might still enter an endless loop, since a link
2049 # loop can be closed while we follow links,
2051 potlib="$potent_lib"
2052 while test -h "$potlib" 2>/dev/null; do
2053 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2054 case "$potliblink" in
2055 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2056 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2059 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2061 | egrep "$file_magic_regex" > /dev/null; then
2062 newdeplibs="$newdeplibs $a_deplib"
2068 if test -n "$a_deplib" ; then
2071 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2072 echo "*** I have the capability to make that library automatically link in when"
2073 echo "*** you link to this library. But I can only do this if you have a"
2074 echo "*** shared version of the library, which you do not appear to have."
2077 # Add a -L argument.
2078 newdeplibs="$newdeplibs $a_deplib"
2080 done # Gone through all deplibs.
2084 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2085 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2086 grep . >/dev/null; then
2088 if test "X$deplibs_check_method" = "Xnone"; then
2089 echo "*** Warning: inter-library dependencies are not supported in this platform."
2091 echo "*** Warning: inter-library dependencies are not known to be supported."
2093 echo "*** All declared inter-library dependencies are being dropped."
2098 versuffix=$versuffix_save
2100 release=$release_save
2101 libname=$libname_save
2104 if test "$droppeddeps" = yes; then
2105 if test "$module" = yes; then
2107 echo "*** Warning: libtool could not satisfy all declared inter-library"
2108 echo "*** dependencies of module $libname. Therefore, libtool will create"
2109 echo "*** a static module, that should work as long as the dlopening"
2110 echo "*** application is linked with the -dlopen flag."
2111 if test -z "$global_symbol_pipe"; then
2113 echo "*** However, this would only work if libtool was able to extract symbol"
2114 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2115 echo "*** not find such a program. So, this module is probably useless."
2116 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2118 if test "$build_old_libs" = no; then
2119 if test "$release_suffix" = all; then
2120 oldlibs="$output_objdir/$libname$release.$libext"
2122 oldlibs="$output_objdir/$libname.$libext"
2124 build_libtool_libs=module
2127 build_libtool_libs=no
2130 echo "*** The inter-library dependencies that have been dropped here will be"
2131 echo "*** automatically added whenever a program is linked with this library"
2132 echo "*** or is declared to -dlopen it."
2135 # Done checking deplibs!
2139 # All the library-specific variables (install_libdir is set above).
2144 # Test again, we may have decided not to build it any more
2145 if test "$build_libtool_libs" = yes; then
2146 # Get the real and link names of the library.
2147 eval library_names=\"$library_names_spec\"
2148 set dummy $library_names
2152 if test -n "$soname_spec"; then
2153 eval soname=\"$soname_spec\"
2158 lib="$output_objdir/$realname"
2161 linknames="$linknames $link"
2164 # Ensure that we have .o objects for linkers which dislike .lo
2165 # (e.g. aix) in case we are running --disable-static
2166 for obj in $libobjs; do
2167 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2168 if test "X$xdir" = "X$obj"; then
2173 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2174 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2175 if test ! -f $xdir/$oldobj; then
2176 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2177 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2181 # Use standard objects if they are pic
2182 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2184 # Prepare the list of exported symbols
2185 if test -z "$export_symbols"; then
2186 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2187 $show "generating symbol list for \`$libname.la'"
2188 export_symbols="$output_objdir/$libname.exp"
2189 $run $rm $export_symbols
2190 eval cmds=\"$export_symbols_cmds\"
2191 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2192 for cmd in $cmds; do
2195 $run eval "$cmd" || exit $?
2198 if test -n "$export_symbols_regex"; then
2199 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2200 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2201 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2202 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2207 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2208 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2211 if test -n "$convenience"; then
2212 if test -n "$whole_archive_flag_spec"; then
2213 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2215 gentop="$output_objdir/${outputname}x"
2216 $show "${rm}r $gentop"
2217 $run ${rm}r "$gentop"
2218 $show "mkdir $gentop"
2219 $run mkdir "$gentop"
2221 if test $status -ne 0 && test ! -d "$gentop"; then
2224 generated="$generated $gentop"
2226 for xlib in $convenience; do
2227 # Extract the objects.
2229 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2230 *) xabs=`pwd`"/$xlib" ;;
2232 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2233 xdir="$gentop/$xlib"
2235 $show "${rm}r $xdir"
2240 if test $status -ne 0 && test ! -d "$xdir"; then
2243 $show "(cd $xdir && $AR x $xabs)"
2244 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2246 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2251 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2252 eval flag=\"$thread_safe_flag_spec\"
2253 linkopts="$linkopts $flag"
2256 # Do each of the archive commands.
2257 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2258 eval cmds=\"$archive_expsym_cmds\"
2260 eval cmds=\"$archive_cmds\"
2262 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2263 for cmd in $cmds; do
2266 $run eval "$cmd" || exit $?
2270 # Create links to the real library.
2271 for linkname in $linknames; do
2272 if test "$realname" != "$linkname"; then
2273 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2274 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2278 # If -module or -export-dynamic was specified, set the dlname.
2279 if test "$module" = yes || test "$export_dynamic" = yes; then
2280 # On all known operating systems, these are identical.
2287 if test -n "$link_against_libtool_libs"; then
2288 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2292 if test -n "$deplibs"; then
2293 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2296 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2297 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2300 if test -n "$rpath"; then
2301 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2304 if test -n "$xrpath"; then
2305 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2308 if test -n "$vinfo"; then
2309 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2312 if test -n "$release"; then
2313 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2318 if test -n "$objs"; then
2319 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2323 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2331 # Delete the old objects.
2332 $run $rm $obj $libobj
2334 # Objects from convenience libraries. This assumes
2335 # single-version convenience libraries. Whenever we create
2336 # different ones for PIC/non-PIC, this we'll have to duplicate
2340 # reload_cmds runs $LD directly, so let us get rid of
2341 # -Wl from whole_archive_flag_spec
2344 if test -n "$convenience"; then
2345 if test -n "$whole_archive_flag_spec"; then
2346 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2348 gentop="$output_objdir/${obj}x"
2349 $show "${rm}r $gentop"
2350 $run ${rm}r "$gentop"
2351 $show "mkdir $gentop"
2352 $run mkdir "$gentop"
2354 if test $status -ne 0 && test ! -d "$gentop"; then
2357 generated="$generated $gentop"
2359 for xlib in $convenience; do
2360 # Extract the objects.
2362 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2363 *) xabs=`pwd`"/$xlib" ;;
2365 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2366 xdir="$gentop/$xlib"
2368 $show "${rm}r $xdir"
2373 if test $status -ne 0 && test ! -d "$xdir"; then
2376 $show "(cd $xdir && $AR x $xabs)"
2377 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2379 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2384 # Create the old-style object.
2385 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
2388 eval cmds=\"$reload_cmds\"
2389 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2390 for cmd in $cmds; do
2393 $run eval "$cmd" || exit $?
2397 # Exit if we aren't doing a library object file.
2398 if test -z "$libobj"; then
2399 if test -n "$gentop"; then
2400 $show "${rm}r $gentop"
2407 if test "$build_libtool_libs" != yes; then
2408 if test -n "$gentop"; then
2409 $show "${rm}r $gentop"
2413 # Create an invalid libtool object if no PIC, so that we don't
2414 # accidentally link it into a program.
2415 $show "echo timestamp > $libobj"
2416 $run eval "echo timestamp > $libobj" || exit $?
2420 if test -n "$pic_flag"; then
2421 # Only do commands if we really have different PIC objects.
2422 reload_objs="$libobjs $reload_conv_objs"
2424 eval cmds=\"$reload_cmds\"
2425 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2426 for cmd in $cmds; do
2429 $run eval "$cmd" || exit $?
2433 # Just create a symlink.
2436 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
2437 if test "X$xdir" = "X$libobj"; then
2442 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
2443 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2444 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
2445 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
2448 if test -n "$gentop"; then
2449 $show "${rm}r $gentop"
2456 # Anything else should be a program.
2458 if test -n "$vinfo"; then
2459 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2462 if test -n "$release"; then
2463 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2466 if test "$preload" = yes; then
2467 if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
2468 test "$dlopen_self_static" = unknown; then
2469 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2473 if test -n "$rpath$xrpath"; then
2474 # If the user specified any rpath flags, then add them.
2475 for libdir in $rpath $xrpath; do
2476 # This is the magic to use -rpath.
2477 case "$compile_rpath " in
2479 *) compile_rpath="$compile_rpath $libdir" ;;
2481 case "$finalize_rpath " in
2483 *) finalize_rpath="$finalize_rpath $libdir" ;;
2488 # Now hardcode the library paths
2491 for libdir in $compile_rpath $finalize_rpath; do
2492 if test -n "$hardcode_libdir_flag_spec"; then
2493 if test -n "$hardcode_libdir_separator"; then
2494 if test -z "$hardcode_libdirs"; then
2495 hardcode_libdirs="$libdir"
2497 # Just accumulate the unique libdirs.
2498 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2499 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2502 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2507 eval flag=\"$hardcode_libdir_flag_spec\"
2508 rpath="$rpath $flag"
2510 elif test -n "$runpath_var"; then
2511 case "$perm_rpath " in
2513 *) perm_rpath="$perm_rpath $libdir" ;;
2517 # Substitute the hardcoded libdirs into the rpath.
2518 if test -n "$hardcode_libdir_separator" &&
2519 test -n "$hardcode_libdirs"; then
2520 libdir="$hardcode_libdirs"
2521 eval rpath=\" $hardcode_libdir_flag_spec\"
2523 compile_rpath="$rpath"
2527 for libdir in $finalize_rpath; do
2528 if test -n "$hardcode_libdir_flag_spec"; then
2529 if test -n "$hardcode_libdir_separator"; then
2530 if test -z "$hardcode_libdirs"; then
2531 hardcode_libdirs="$libdir"
2533 # Just accumulate the unique libdirs.
2534 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2535 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2538 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2543 eval flag=\"$hardcode_libdir_flag_spec\"
2544 rpath="$rpath $flag"
2546 elif test -n "$runpath_var"; then
2547 case "$finalize_perm_rpath " in
2549 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
2553 # Substitute the hardcoded libdirs into the rpath.
2554 if test -n "$hardcode_libdir_separator" &&
2555 test -n "$hardcode_libdirs"; then
2556 libdir="$hardcode_libdirs"
2557 eval rpath=\" $hardcode_libdir_flag_spec\"
2559 finalize_rpath="$rpath"
2561 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2562 if test "X$output_objdir" = "X$output"; then
2563 output_objdir="$objdir"
2565 output_objdir="$output_objdir/$objdir"
2568 # Create the binary in the object directory, then wrap it.
2569 if test ! -d $output_objdir; then
2570 $show "$mkdir $output_objdir"
2571 $run $mkdir $output_objdir
2573 if test $status -ne 0 && test ! -d $output_objdir; then
2578 if test -n "$libobjs" && test "$build_old_libs" = yes; then
2579 # Transform all the library objects into standard objects.
2580 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2581 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2585 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2586 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2587 dlsyms="${outputname}S.c"
2589 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2593 if test -n "$dlsyms"; then
2597 # Discover the nlist of each of the dlfiles.
2598 nlist="$output_objdir/${outputname}.nm"
2600 $show "$rm $nlist ${nlist}S ${nlist}T"
2601 $run $rm "$nlist" "${nlist}S" "${nlist}T"
2603 # Parse the name list into a source file.
2604 $show "creating $output_objdir/$dlsyms"
2606 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
2607 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
2608 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
2614 /* Prevent the only kind of declaration conflicts we can make. */
2615 #define lt_preloaded_symbols some_other_symbol
2617 /* External symbol declarations for the compiler. */\
2620 if test "$dlself" = yes; then
2621 $show "generating symbol list for \`$output'"
2623 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2625 # Add our own program objects to the symbol list.
2626 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2627 for arg in $progfiles; do
2628 $show "extracting global C symbols from \`$arg'"
2629 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2632 if test -n "$exclude_expsyms"; then
2633 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2634 $run eval '$mv "$nlist"T "$nlist"'
2637 if test -n "$export_symbols_regex"; then
2638 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2639 $run eval '$mv "$nlist"T "$nlist"'
2642 # Prepare the list of exported symbols
2643 if test -z "$export_symbols"; then
2644 export_symbols="$output_objdir/$output.exp"
2645 $run $rm $export_symbols
2646 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2648 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
2649 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
2650 $run eval 'mv "$nlist"T "$nlist"'
2654 for arg in $dlprefiles; do
2655 $show "extracting global C symbols from \`$arg'"
2656 name=`echo "$arg" | sed -e 's%^.*/%%'`
2657 $run eval 'echo ": $name " >> "$nlist"'
2658 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2661 if test -z "$run"; then
2662 # Make sure we have at least an empty file.
2663 test -f "$nlist" || : > "$nlist"
2665 if test -n "$exclude_expsyms"; then
2666 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2667 $mv "$nlist"T "$nlist"
2670 # Try sorting and uniquifying the output.
2671 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
2674 grep -v "^: " < "$nlist" > "$nlist"S
2677 if test -f "$nlist"S; then
2678 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
2680 echo '/* NONE */' >> "$output_objdir/$dlsyms"
2683 $echo >> "$output_objdir/$dlsyms" "\
2685 #undef lt_preloaded_symbols
2687 #if defined (__STDC__) && __STDC__
2688 # define lt_ptr_t void *
2690 # define lt_ptr_t char *
2694 /* The mapping between symbol names and symbols. */
2699 lt_preloaded_symbols[] =
2703 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
2704 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
2705 < "$nlist" >> "$output_objdir/$dlsyms"
2707 $echo >> "$output_objdir/$dlsyms" "\
2711 /* This works around a problem in FreeBSD linker */
2712 #ifdef FREEBSD_WORKAROUND
2713 static const void *lt_preloaded_setup() {
2714 return lt_preloaded_symbols;
2724 pic_flag_for_symtable=
2726 # compiling the symbol table file with pic_flag works around
2727 # a FreeBSD bug that causes programs to crash when -lm is
2728 # linked before any other PIC object. But we must not use
2729 # pic_flag when linking with -static. The problem exists in
2730 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2731 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
\r
2732 case "$compile_command " in
2734 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
2737 case "$compile_command " in
2739 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
2743 # Now compile the dynamic symbol file.
2744 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2745 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2747 # Clean up the generated files.
2748 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2749 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
2751 # Transform the symbol file into the correct name.
2752 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2753 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
2756 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
2761 # We keep going just in case the user didn't refer to
2762 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2763 # really was required.
2765 # Nullify the symbol file.
2766 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2767 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2770 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
2771 # Replace the output file specification.
2772 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2773 link_command="$compile_command$compile_rpath"
2775 # We have no uninstalled library dependencies, so finalize right now.
2776 $show "$link_command"
2777 $run eval "$link_command"
2780 # Delete the generated files.
2781 if test -n "$dlsyms"; then
2782 $show "$rm $output_objdir/${outputname}S.${objext}"
2783 $run $rm "$output_objdir/${outputname}S.${objext}"
2789 if test -n "$shlibpath_var"; then
2790 # We should set the shlibpath_var
2792 for dir in $temp_rpath; do
2794 [\\/]* | [A-Za-z]:[\\/]*)
2799 # Relative path: add a thisdir entry.
2800 rpath="$rpath\$thisdir/$dir:"
2807 if test -n "$compile_shlibpath$finalize_shlibpath"; then
2808 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
2810 if test -n "$finalize_shlibpath"; then
2811 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
2816 if test -n "$runpath_var"; then
2817 if test -n "$perm_rpath"; then
2818 # We should set the runpath_var.
2820 for dir in $perm_rpath; do
2823 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
2825 if test -n "$finalize_perm_rpath"; then
2826 # We should set the runpath_var.
2828 for dir in $finalize_perm_rpath; do
2831 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2835 if test "$hardcode_action" = relink; then
2836 # Fast installation is not supported
2837 link_command="$compile_var$compile_command$compile_rpath"
2838 relink_command="$finalize_var$finalize_command$finalize_rpath"
2840 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2841 $echo "$modename: \`$output' will be relinked during installation" 1>&2
2843 if test "$fast_install" != no; then
2844 link_command="$finalize_var$compile_command$finalize_rpath"
2845 if test "$fast_install" = yes; then
2846 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
2848 # fast_install is set to needless
2852 link_command="$compile_var$compile_command$compile_rpath"
2853 relink_command="$finalize_var$finalize_command$finalize_rpath"
2857 # Replace the output file specification.
2858 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2860 # Delete the old output files.
2861 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2863 $show "$link_command"
2864 $run eval "$link_command" || exit $?
2866 # Now create the wrapper script.
2867 $show "creating $output"
2869 # Quote the relink command for shipping.
2870 if test -n "$relink_command"; then
2871 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2874 # Quote $echo for shipping.
2875 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2877 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2878 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2880 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2882 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
2885 # Only actually do things if our run command is non-null.
2886 if test -z "$run"; then
2887 # win32 will think the script is a binary if it has
2888 # a .exe suffix, so we strip it off here.
2890 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
2893 trap "$rm $output; exit 1" 1 2 15
2898 # $output - temporary wrapper script for $objdir/$outputname
2899 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
2901 # The $output program cannot be directly executed until all the libtool
2902 # libraries that it depends on are installed.
2904 # This wrapper script should never be moved out of the build directory.
2905 # If it is, it will not operate correctly.
2907 # Sed substitution that helps us do robust quoting. It backslashifies
2908 # metacharacters that are still active within double-quoted strings.
2909 Xsed='sed -e 1s/^X//'
2910 sed_quote_subst='$sed_quote_subst'
2912 # The HP-UX ksh and POSIX shell print the target directory to stdout
2914 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
2916 relink_command=\"$relink_command\"
2918 # This environment variable determines our operation mode.
2919 if test \"\$libtool_install_magic\" = \"$magic\"; then
2920 # install mode needs the following variable:
2921 link_against_libtool_libs='$link_against_libtool_libs'
2923 # When we are sourced in execute mode, \$file and \$echo are already set.
2924 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2927 # Make sure echo works.
2928 if test \"X\$1\" = X--no-reexec; then
2929 # Discard the --no-reexec flag, and continue.
2931 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2932 # Yippee, \$echo works!
2935 # Restart under the correct shell, and then maybe \$echo will work.
2936 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2942 # Find the directory that this script lives in.
2943 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2944 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2946 # Follow symbolic links until we get to the real thisdir.
2947 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2948 while test -n \"\$file\"; do
2949 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2951 # If there was a directory component, then change thisdir.
2952 if test \"x\$destdir\" != \"x\$file\"; then
2953 case \"\$destdir\" in
2954 [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
2955 *) thisdir=\"\$thisdir/\$destdir\" ;;
2959 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2960 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2963 # Try to get the absolute directory name.
2964 absdir=\`cd \"\$thisdir\" && pwd\`
2965 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2968 if test "$fast_install" = yes; then
2970 program=lt-'$outputname'
2971 progdir=\"\$thisdir/$objdir\"
2973 if test ! -f \"\$progdir/\$program\" || \\
2974 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2975 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2977 file=\"\$\$-\$program\"
2979 if test ! -d \"\$progdir\"; then
2980 $mkdir \"\$progdir\"
2982 $rm \"\$progdir/\$file\"
2987 # relink executable if necessary
2988 if test -n \"\$relink_command\"; then
2989 if (cd \"\$thisdir\" && eval \$relink_command); then :
2991 $rm \"\$progdir/\$file\"
2996 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2997 { $rm \"\$progdir/\$program\";
2998 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2999 $rm \"\$progdir/\$file\"
3003 program='$outputname'
3004 progdir=\"\$thisdir/$objdir\"
3010 if test -f \"\$progdir/\$program\"; then"
3012 # Export our shlibpath_var if we have one.
3013 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3015 # Add our own library path to $shlibpath_var
3016 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3018 # Some systems cannot cope with colon-terminated $shlibpath_var
3019 # The second colon is a workaround for a bug in BeOS R4 sed
3020 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3022 export $shlibpath_var
3026 # fixup the dll searchpath if we need to.
3027 if test -n "$dllsearchpath"; then
3029 # Add the dll search path components to the executable PATH
3030 PATH=$dllsearchpath:\$PATH
3035 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3036 # Run the actual program with our arguments.
3039 # win32 systems need to use the prog path for dll
3043 exec \$progdir/\$program \${1+\"\$@\"}
3047 # Backslashes separate directories on plain windows
3048 *-*-mingw | *-*-os2*)
3050 exec \$progdir\\\\\$program \${1+\"\$@\"}
3056 # Export the path to the program.
3057 PATH=\"\$progdir:\$PATH\"
3060 exec \$program \${1+\"\$@\"}
3065 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3069 # The program doesn't exist.
3070 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3071 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3072 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3083 # See if we need to build an old-fashioned archive.
3084 for oldlib in $oldlibs; do
3086 if test "$build_libtool_libs" = convenience; then
3087 oldobjs="$libobjs_save"
3088 addlibs="$convenience"
3089 build_libtool_libs=no
3091 if test "$build_libtool_libs" = module; then
3092 oldobjs="$libobjs_save"
3093 build_libtool_libs=no
3095 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3097 addlibs="$old_convenience"
3100 if test -n "$addlibs"; then
3101 gentop="$output_objdir/${outputname}x"
3102 $show "${rm}r $gentop"
3103 $run ${rm}r "$gentop"
3104 $show "mkdir $gentop"
3105 $run mkdir "$gentop"
3107 if test $status -ne 0 && test ! -d "$gentop"; then
3110 generated="$generated $gentop"
3112 # Add in members from convenience archives.
3113 for xlib in $addlibs; do
3114 # Extract the objects.
3116 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3117 *) xabs=`pwd`"/$xlib" ;;
3119 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3120 xdir="$gentop/$xlib"
3122 $show "${rm}r $xdir"
3127 if test $status -ne 0 && test ! -d "$xdir"; then
3130 $show "(cd $xdir && $AR x $xabs)"
3131 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3133 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3137 # Do each command in the archive commands.
3138 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3139 eval cmds=\"$old_archive_from_new_cmds\"
3141 # Ensure that we have .o objects in place in case we decided
3142 # not to build a shared library, and have fallen back to building
3143 # static libs even though --disable-static was passed!
3144 for oldobj in $oldobjs; do
3145 if test ! -f $oldobj; then
3146 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3147 if test "X$xdir" = "X$oldobj"; then
3152 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3153 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3154 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3155 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3159 eval cmds=\"$old_archive_cmds\"
3161 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3162 for cmd in $cmds; do
3165 $run eval "$cmd" || exit $?
3170 if test -n "$generated"; then
3171 $show "${rm}r$generated"
3172 $run ${rm}r$generated
3175 # Now create the libtool archive.
3179 if test "$release_suffix" = all; then
3180 test "$build_old_libs" = yes && old_library="$libname$release.$libext"
3182 test "$build_old_libs" = yes && old_library="$libname.$libext"
3184 $show "creating $output"
3186 if test -n "$xrpath"; then
3188 for libdir in $xrpath; do
3189 temp_xrpath="$temp_xrpath -R$libdir"
3191 dependency_libs="$temp_xrpath $dependency_libs"
3194 # Only create the output if not a dry run.
3195 if test -z "$run"; then
3196 for installed in no yes; do
3197 if test "$installed" = yes; then
3198 if test -z "$install_libdir"; then
3201 output="$output_objdir/$outputname"i
3205 # $outputname - a libtool library file
3206 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3208 # Please DO NOT delete this file!
3209 # It is necessary for linking the library.
3211 # The name that we can dlopen(3).
3214 # Names of this library.
3215 library_names='$library_names'
3217 # The name of the static archive.
3218 old_library='$old_library'
3220 # Libraries that this one depends upon.
3221 dependency_libs='$dependency_libs'
3223 # Version information for $libname.
3228 # Is this an already installed library?
3229 installed=$installed
3231 # Directory that this library needs to be installed in:
3232 libdir='$install_libdir'\
3237 # Do a symbolic link so that the libtool archive can be found in
3238 # LD_LIBRARY_PATH before the program is installed.
3239 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3240 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
3246 # libtool install mode
3248 modename="$modename: install"
3250 # There may be an optional sh(1) argument at the beginning of
3251 # install_prog (especially on Windows NT).
3252 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
3253 # Aesthetically quote it.
3254 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3256 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3260 install_prog="$arg "
3268 # The real first argument should be the name of the installation program.
3269 # Aesthetically quote it.
3270 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3272 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3276 install_prog="$install_prog$arg"
3278 # We need to accept at least all the BSD install flags.
3288 if test -n "$dest"; then
3289 files="$files $dest"
3307 # If the previous option needed an argument, then skip it.
3308 if test -n "$prev"; then
3317 # Aesthetically quote the argument.
3318 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3320 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3324 install_prog="$install_prog $arg"
3327 if test -z "$install_prog"; then
3328 $echo "$modename: you must specify an install program" 1>&2
3333 if test -n "$prev"; then
3334 $echo "$modename: the \`$prev' option requires an argument" 1>&2
3339 if test -z "$files"; then
3340 if test -z "$dest"; then
3341 $echo "$modename: no file or destination specified" 1>&2
3343 $echo "$modename: you must specify a destination" 1>&2
3349 # Strip any trailing slash from the destination.
3350 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
3352 # Check to see that the destination is a directory.
3353 test -d "$dest" && isdir=yes
3354 if test "$isdir" = yes; then
3358 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
3359 test "X$destdir" = "X$dest" && destdir=.
3360 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
3362 # Not a directory, so check to see that there is only one file specified.
3364 if test $# -gt 2; then
3365 $echo "$modename: \`$dest' is not a directory" 1>&2
3371 [\\/]* | [A-Za-z]:[\\/]*) ;;
3373 for file in $files; do
3377 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3386 # This variable tells wrapper scripts just to set variables rather
3387 # than running their programs.
3388 libtool_install_magic="$magic"
3393 for file in $files; do
3395 # Do each installation.
3398 # Do the static libraries later.
3399 staticlibs="$staticlibs $file"
3403 # Check to see that this really is a libtool archive.
3404 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3406 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
3413 # If there is no directory component, then add one.
3415 */* | *\\*) . $file ;;
3419 # Add the libdir to current_libdirs if it is the destination.
3420 if test "X$destdir" = "X$libdir"; then
3421 case "$current_libdirs " in
3423 *) current_libdirs="$current_libdirs $libdir" ;;
3426 # Note the libdir as a future libdir.
3427 case "$future_libdirs " in
3429 *) future_libdirs="$future_libdirs $libdir" ;;
3433 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
3434 test "X$dir" = "X$file/" && dir=
3437 # See the names of the shared library.
3438 set dummy $library_names
3439 if test -n "$2"; then
3444 # Install the shared library and build the symlinks.
3445 $show "$install_prog $dir/$realname $destdir/$realname"
3446 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
3448 if test $# -gt 0; then
3449 # Delete the old symlinks, and create new ones.
3452 if test "$linkname" != "$realname"; then
3453 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3454 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
3459 # Do each command in the postinstall commands.
3460 lib="$destdir/$realname"
3461 eval cmds=\"$postinstall_cmds\"
3462 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3463 for cmd in $cmds; do
3466 $run eval "$cmd" || exit $?
3471 # Install the pseudo-library for information purposes.
3472 if test "$install_ltlibs" = yes; then
3473 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3474 instname="$dir/$name"i
3475 $show "$install_prog $instname $destdir/$name"
3476 $run eval "$install_prog $instname $destdir/$name" || exit $?
3479 # Maybe install the static library, too.
3480 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
3484 # Install (i.e. copy) a libtool object.
3486 # Figure out destination file name, if it wasn't already specified.
3487 if test -n "$destname"; then
3488 destfile="$destdir/$destname"
3490 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3491 destfile="$destdir/$destfile"
3494 # Deduce the name of the destination old-style object file.
3497 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3500 staticdest="$destfile"
3504 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3510 # Install the libtool object if requested.
3511 if test -n "$destfile"; then
3512 $show "$install_prog $file $destfile"
3513 $run eval "$install_prog $file $destfile" || exit $?
3516 # Install the old object if enabled.
3517 if test "$build_old_libs" = yes; then
3518 # Deduce the name of the old-style object file.
3519 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
3521 $show "$install_prog $staticobj $staticdest"
3522 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
3528 # Figure out destination file name, if it wasn't already specified.
3529 if test -n "$destname"; then
3530 destfile="$destdir/$destname"
3532 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3533 destfile="$destdir/$destfile"
3536 # Do a test to see if this is really a libtool program.
3537 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3538 link_against_libtool_libs=
3541 # If there is no directory component, then add one.
3543 */* | *\\*) . $file ;;
3547 # Check the variables that should have been set.
3548 if test -z "$link_against_libtool_libs"; then
3549 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3554 for lib in $link_against_libtool_libs; do
3555 # Check to see that each library is installed.
3557 if test -f "$lib"; then
3558 # If there is no directory component, then add one.
3560 */* | *\\*) . $lib ;;
3564 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
3565 if test -n "$libdir" && test ! -f "$libfile"; then
3571 if test "$fast_install" = no && test -n "$relink_command"; then
3572 if test "$finalize" = yes && test -z "$run"; then
3574 test -n "$TMPDIR" && tmpdir="$TMPDIR"
3575 tmpdir="$tmpdir/libtool-$$"
3576 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3578 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3581 outputname="$tmpdir/$file"
3582 # Replace the output file specification.
3583 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3585 $show "$relink_command"
3586 if $run eval "$relink_command"; then :
3588 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
3594 $echo "$modename: warning: cannot relink \`$file'" 1>&2
3597 # Install the binary that we compiled earlier.
3598 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3602 $show "$install_prog$stripme $file $destfile"
3603 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3604 test -n "$outputname" && ${rm}r "$tmpdir"
3609 for file in $staticlibs; do
3610 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3612 # Set up the ranlib parameters.
3613 oldlib="$destdir/$name"
3615 $show "$install_prog $file $oldlib"
3616 $run eval "$install_prog \$file \$oldlib" || exit $?
3618 # Do each command in the postinstall commands.
3619 eval cmds=\"$old_postinstall_cmds\"
3620 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3621 for cmd in $cmds; do
3624 $run eval "$cmd" || exit $?
3629 if test -n "$future_libdirs"; then
3630 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
3633 if test -n "$current_libdirs"; then
3634 # Maybe just do a dry run.
3635 test -n "$run" && current_libdirs=" -n$current_libdirs"
3636 exec $SHELL $0 --finish$current_libdirs
3643 # libtool finish mode
3645 modename="$modename: finish"
3649 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
3652 libdirs="$libdirs $dir"
3655 for libdir in $libdirs; do
3656 if test -n "$finish_cmds"; then
3657 # Do each command in the finish commands.
3658 eval cmds=\"$finish_cmds\"
3659 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3660 for cmd in $cmds; do
3663 $run eval "$cmd" || admincmds="$admincmds
3668 if test -n "$finish_eval"; then
3669 # Do the single finish_eval.
3670 eval cmds=\"$finish_eval\"
3671 $run eval "$cmds" || admincmds="$admincmds
3677 # Exit here if they wanted silent mode.
3678 test "$show" = : && exit 0
3680 echo "----------------------------------------------------------------------"
3681 echo "Libraries have been installed in:"
3682 for libdir in $libdirs; do
3686 echo "If you ever happen to want to link against installed libraries"
3687 echo "in a given directory, LIBDIR, you must either use libtool, and"
3688 echo "specify the full pathname of the library, or use \`-LLIBDIR'"
3689 echo "flag during linking and do at least one of the following:"
3690 if test -n "$shlibpath_var"; then
3691 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3692 echo " during execution"
3694 if test -n "$runpath_var"; then
3695 echo " - add LIBDIR to the \`$runpath_var' environment variable"
3696 echo " during linking"
3698 if test -n "$hardcode_libdir_flag_spec"; then
3700 eval flag=\"$hardcode_libdir_flag_spec\"
3702 echo " - use the \`$flag' linker flag"
3704 if test -n "$admincmds"; then
3705 echo " - have your system administrator run these commands:$admincmds"
3707 if test -f /etc/ld.so.conf; then
3708 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
3711 echo "See any operating system documentation about shared libraries for"
3712 echo "more information, such as the ld(1) and ld.so(8) manual pages."
3713 echo "----------------------------------------------------------------------"
3717 # libtool execute mode
3719 modename="$modename: execute"
3721 # The first argument is the command name.
3723 if test -z "$cmd"; then
3724 $echo "$modename: you must specify a COMMAND" 1>&2
3729 # Handle -dlopen flags immediately.
3730 for file in $execute_dlfiles; do
3731 if test ! -f "$file"; then
3732 $echo "$modename: \`$file' is not a file" 1>&2
3740 # Check to see that this really is a libtool archive.
3741 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3743 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3748 # Read the libtool library.
3752 # If there is no directory component, then add one.
3754 */* | *\\*) . $file ;;
3758 # Skip this library if it cannot be dlopened.
3759 if test -z "$dlname"; then
3760 # Warn if it was a shared library.
3761 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
3765 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3766 test "X$dir" = "X$file" && dir=.
3768 if test -f "$dir/$objdir/$dlname"; then
3771 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
3777 # Just add the directory containing the .lo file.
3778 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3779 test "X$dir" = "X$file" && dir=.
3783 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
3788 # Get the absolute pathname.
3789 absdir=`cd "$dir" && pwd`
3790 test -n "$absdir" && dir="$absdir"
3792 # Now add the directory to shlibpath_var.
3793 if eval "test -z \"\$$shlibpath_var\""; then
3794 eval "$shlibpath_var=\"\$dir\""
3796 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3800 # This variable tells wrapper scripts just to set shlibpath_var
3801 # rather than running their programs.
3802 libtool_execute_magic="$magic"
3804 # Check if any of the arguments is a wrapper script.
3811 # Do a test to see if this is really a libtool program.
3812 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3813 # If there is no directory component, then add one.
3815 */* | *\\*) . $file ;;
3819 # Transform arg to wrapped name.
3820 file="$progdir/$program"
3824 # Quote arguments (to preserve shell metacharacters).
3825 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3826 args="$args \"$file\""
3829 if test -z "$run"; then
3830 if test -n "$shlibpath_var"; then
3831 # Export the shlibpath_var.
3832 eval "export $shlibpath_var"
3835 # Restore saved enviroment variables
3836 if test "${save_LC_ALL+set}" = set; then
3837 LC_ALL="$save_LC_ALL"; export LC_ALL
3839 if test "${save_LANG+set}" = set; then
3840 LANG="$save_LANG"; export LANG
3843 # Now actually exec the command.
3844 eval "exec \$cmd$args"
3846 $echo "$modename: cannot exec \$cmd$args"
3849 # Display what would be done.
3850 if test -n "$shlibpath_var"; then
3851 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3852 $echo "export $shlibpath_var"
3859 # libtool uninstall mode
3861 modename="$modename: uninstall"
3868 -*) rm="$rm $arg" ;;
3869 *) files="$files $arg" ;;
3873 if test -z "$rm"; then
3874 $echo "$modename: you must specify an RM program" 1>&2
3879 for file in $files; do
3880 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3881 test "X$dir" = "X$file" && dir=.
3882 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3888 # Possibly a libtool archive, so verify it.
3889 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3892 # Delete the libtool libraries and symlinks.
3893 for n in $library_names; do
3894 rmfiles="$rmfiles $dir/$n"
3896 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
3898 $show "$rm $rmfiles"
3901 if test -n "$library_names"; then
3902 # Do each command in the postuninstall commands.
3903 eval cmds=\"$postuninstall_cmds\"
3904 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3905 for cmd in $cmds; do
3913 if test -n "$old_library"; then
3914 # Do each command in the old_postuninstall commands.
3915 eval cmds=\"$old_postuninstall_cmds\"
3916 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3917 for cmd in $cmds; do
3925 # FIXME: should reinstall the best remaining shared library.
3930 if test "$build_old_libs" = yes; then
3931 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3932 rmfiles="$rmfiles $dir/$oldobj"
3934 $show "$rm $rmfiles"
3939 $show "$rm $rmfiles"
3948 $echo "$modename: you must specify a MODE" 1>&2
3949 $echo "$generic_help" 1>&2
3954 $echo "$modename: invalid operation mode \`$mode'" 1>&2
3955 $echo "$generic_help" 1>&2
3957 fi # test -z "$show_help"
3959 # We need to display help for each of the modes.
3962 "Usage: $modename [OPTION]... [MODE-ARG]...
3964 Provide generalized library-building support services.
3966 --config show all configuration variables
3967 --debug enable verbose shell tracing
3968 -n, --dry-run display commands without modifying any files
3969 --features display basic configuration information and exit
3970 --finish same as \`--mode=finish'
3971 --help display this help message and exit
3972 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
3973 --quiet same as \`--silent'
3974 --silent don't print informational messages
3975 --version print version information
3977 MODE must be one of the following:
3979 compile compile a source file into a libtool object
3980 execute automatically set library path, then run a program
3981 finish complete the installation of libtool libraries
3982 install install libraries or executables
3983 link create a library or an executable
3984 uninstall remove libraries from an installed directory
3986 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
3987 a more detailed description of MODE."
3993 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3995 Compile a source file into a libtool library object.
3997 This mode accepts the following additional options:
3999 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4000 -static always build a \`.o' file suitable for static linking
4002 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4003 from the given SOURCEFILE.
4005 The output file name is determined by removing the directory component from
4006 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4007 library object suffix, \`.lo'."
4012 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4014 Automatically set library path, then run a program.
4016 This mode accepts the following additional options:
4018 -dlopen FILE add the directory containing FILE to the library path
4020 This mode sets the library path environment variable according to \`-dlopen'
4023 If any of the ARGS are libtool executable wrappers, then they are translated
4024 into their corresponding uninstalled binary, and any of their required library
4025 directories are added to the library path.
4027 Then, COMMAND is executed, with ARGS as arguments."
4032 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4034 Complete the installation of libtool libraries.
4036 Each LIBDIR is a directory that contains libtool libraries.
4038 The commands that this mode executes may require superuser privileges. Use
4039 the \`--dry-run' option if you just want to see what would be executed."
4044 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4046 Install executables or libraries.
4048 INSTALL-COMMAND is the installation command. The first component should be
4049 either the \`install' or \`cp' program.
4051 The rest of the components are interpreted as arguments to that command (only
4052 BSD-compatible install options are recognized)."
4057 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4059 Link object files or libraries together to form another library, or to
4060 create an executable program.
4062 LINK-COMMAND is a command using the C compiler that you would use to create
4063 a program from several object files.
4065 The following components of LINK-COMMAND are treated specially:
4067 -all-static do not do any dynamic linking at all
4068 -avoid-version do not add a version suffix if possible
4069 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4070 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4071 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4072 -export-symbols SYMFILE
4073 try to export only the symbols listed in SYMFILE
4074 -export-symbols-regex REGEX
4075 try to export only the symbols matching REGEX
4076 -LLIBDIR search LIBDIR for required installed libraries
4077 -lNAME OUTPUT-FILE requires the installed library libNAME
4078 -module build a library that can dlopened
4079 -no-undefined declare that a library does not refer to external symbols
4080 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4081 -release RELEASE specify package release information
4082 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4083 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4084 -static do not do any dynamic linking of libtool libraries
4085 -version-info CURRENT[:REVISION[:AGE]]
4086 specify library version info [each variable defaults to 0]
4088 All other options (arguments beginning with \`-') are ignored.
4090 Every other argument is treated as a filename. Files ending in \`.la' are
4091 treated as uninstalled libtool libraries, other files are standard or library
4094 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4095 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4096 required, except when creating a convenience library.
4098 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4099 using \`ar' and \`ranlib', or on Windows using \`lib'.
4101 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4102 is created, otherwise an executable program is created."
4107 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4109 Remove libraries from an installation directory.
4111 RM is the name of the program to use to delete files associated with each FILE
4112 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4115 If FILE is a libtool library, all the files associated with it are deleted.
4116 Otherwise, only FILE itself is deleted using RM."
4120 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4127 $echo "Try \`$modename --help' for more information about other modes."