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-1998 Free Software Foundation, Inc.
5 # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
26 # Check that we have a working $echo.
27 if test "X$1" = X--no-reexec; then
28 # Discard the --no-reexec flag, and continue.
30 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
31 # Yippee, $echo works!
34 # Restart under the correct shell, and then maybe $echo will work.
35 exec $SHELL "$0" --no-reexec ${1+"$@"}
38 # The name of this program.
39 progname=`$echo "$0" | sed 's%^.*/%%'`
48 help="Try \`$progname --help' for more information."
49 magic="%%%MAGIC variable%%%"
54 # Sed substitution that helps us do robust quoting. It backslashifies
55 # metacharacters that are still active within double-quoted strings.
57 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
60 # Only set LANG and LC_ALL to C if already set.
61 # These must not be set unconditionally because not all systems understand
62 # e.g. LANG=C (notably SCO).
63 # We save the old values to restore during execute mode.
64 if test "${LC_ALL+set}" = set; then
65 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
67 if test "${LANG+set}" = set; then
68 save_LANG="$LANG"; LANG=C; export LANG
71 if test "$LTCONFIG_VERSION" != "$VERSION"; then
72 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
73 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
77 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
78 echo "$modename: not configured to build any kind of library" 1>&2
79 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
92 lo2o="s/\\.lo\$/.${objext}/"
93 los2o="s/\\.lo /.${objext} /g"
95 # Parse our command line options once, thoroughly.
102 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
106 # If the previous option needs an argument, assign it.
107 if test -n "$prev"; then
110 eval "$prev=\"\$$prev \$arg\""
122 # Have we seen a non-optional argument yet?
129 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
134 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
139 echo "$progname: enabling shell trace mode"
149 if test "$build_libtool_libs" = yes; then
150 echo "enable shared libraries"
152 echo "disable shared libraries"
154 if test "$build_old_libs" = yes; then
155 echo "enable static libraries"
157 echo "disable static libraries"
162 --finish) mode="finish" ;;
164 --mode) prevopt="--mode" prev=mode ;;
165 --mode=*) mode="$optarg" ;;
177 $echo "$modename: unrecognized option \`$arg'" 1>&2
189 if test -n "$prevopt"; then
190 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
195 if test -z "$show_help"; then
197 # Infer the operation mode.
198 if test -z "$mode"; then
200 *cc | *++ | gcc* | *-gcc*)
212 *db | *dbx | *strace | *truss)
222 # If we have no mode, but dlfiles were specified, then do execute mode.
223 test -n "$execute_dlfiles" && mode=execute
225 # Just use the default operation mode.
226 if test -z "$mode"; then
227 if test -n "$nonopt"; then
228 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
230 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
237 # Only execute mode is allowed to have -dlopen flags.
238 if test -n "$execute_dlfiles" && test "$mode" != execute; then
239 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
244 # Change the help message to a mode-specific one.
246 help="Try \`$modename --help --mode=$mode' for more information."
248 # These modes are in order of execution frequency so that they run quickly.
250 # libtool compile mode
252 modename="$modename: compile"
253 # Get the compilation command and the source file.
261 # Accept any command-line options.
264 $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
275 # Accept the current argument as the source file.
279 # Aesthetically quote the previous argument.
281 # Backslashify any backslashes, double quotes, and dollar signs.
282 # These are the only characters that are still specially
283 # interpreted inside of double-quoted scrings.
284 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
286 # Double-quote args containing other shell metacharacters.
287 # Many Bourne shells cannot handle close brackets correctly in scan
288 # sets, so we specify it separately.
290 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
291 lastarg="\"$lastarg\""
295 # Add the previous argument to base_compile.
296 if test -z "$base_compile"; then
297 base_compile="$lastarg"
299 base_compile="$base_compile $lastarg"
303 # Get the name of the library object.
304 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
306 # Recognize several different file suffixes.
321 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
324 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
326 $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
331 if test -z "$base_compile"; then
332 $echo "$modename: you must specify a compilation command" 1>&2
337 # Delete any leftover library objects.
338 if test "$build_old_libs" = yes; then
339 $run $rm $obj $libobj
340 trap "$run $rm $obj $libobj; exit 1" 1 2 15
343 trap "$run $rm $libobj; exit 1" 1 2 15
346 if test -n "$fix_srcfile_path"; then
347 eval srcfile=\"$fix_srcfile_path\"
350 # Only build a PIC object if we are building libtool libraries.
351 if test "$build_libtool_libs" = yes; then
352 # Without this assignment, base_compile gets emptied.
353 fbsd_hideous_sh_bug=$base_compile
355 # All platforms use -DPIC, to notify preprocessed assembler code.
356 $show "$base_compile$pic_flag -DPIC $srcfile"
357 if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
359 test -n "$obj" && $run $rm $obj
363 # If we have no pic_flag, then copy the object into place and finish.
364 if test -z "$pic_flag"; then
365 $show "$LN_S $obj $libobj"
366 $run $LN_S $obj $libobj
370 # Just move the object, then go on to compile the next one
371 $show "$mv $obj $libobj"
372 $run $mv $obj $libobj || exit $?
374 # Allow error messages only from the first compilation.
375 suppress_output=' >/dev/null 2>&1'
378 # Only build a position-dependent object if we build old libraries.
379 if test "$build_old_libs" = yes; then
380 # Suppress compiler output if we already did a PIC compilation.
381 $show "$base_compile $srcfile$suppress_output"
382 if $run eval "$base_compile \$srcfile$suppress_output"; then :
384 $run $rm $obj $libobj
389 # Create an invalid libtool object if no PIC, so that we do not
390 # accidentally link it into a program.
391 if test "$build_libtool_libs" != yes; then
392 $show "echo timestamp > $libobj"
393 $run eval "echo timestamp > \$libobj" || exit $?
401 modename="$modename: link"
404 compile_command="$CC"
405 finalize_command="$CC"
418 link_against_libtool_libs=
429 # We need to know -static, to get the right output filenames.
433 -all-static | -static)
434 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
435 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
437 build_libtool_libs=no
444 # See if our shared archives depend on static archives.
445 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
447 # Go through the arguments, transforming them on the way.
448 while test $# -gt 0; do
452 # If the previous option needs an argument, assign it.
453 if test -n "$prev"; then
456 compile_command="$compile_command @OUTPUT@"
457 finalize_command="$finalize_command @OUTPUT@"
464 *.la | *.lo) ;; # We handle these cases below.
466 dlprefiles="$dlprefiles $arg"
467 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
483 eval "$prev=\"\$arg\""
494 if test -n "$link_static_flag"; then
495 compile_command="$compile_command $link_static_flag"
496 finalize_command="$finalize_command $link_static_flag"
502 # FIXME: remove this flag sometime in the future.
503 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
518 if test "$export_dynamic" != yes; then
520 if test -n "$export_dynamic_flag_spec"; then
521 eval arg=\"$export_dynamic_flag_spec\"
526 # Add the symbol object into the linking commands.
527 compile_command="$compile_command @SYMFILE@"
528 finalize_command="$finalize_command @SYMFILE@"
533 dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
535 /* | [A-Za-z]:[/\\]*)
536 # Add the corresponding hardcode_libdir_flag, if it is not identical.
539 $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
543 deplibs="$deplibs $arg"
546 -l*) deplibs="$deplibs $arg" ;;
566 # If we have no pic_flag, then this is the same as -all-static.
567 if test -z "$pic_flag" && test -n "$link_static_flag"; then
568 compile_command="$compile_command $link_static_flag"
569 finalize_command="$finalize_command $link_static_flag"
579 # Some other compiler flag.
581 # Unknown arguments in both finalize_command and compile_command need
582 # to be aesthetically quoted because they are evaled later.
583 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
585 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
591 *.o | *.obj | *.a | *.lib)
598 if test "$prev" = dlfiles; then
599 dlfiles="$dlfiles $arg"
600 if test "$build_libtool_libs" = yes; then
604 # If libtool objects are unsupported, then we need to preload.
609 if test "$prev" = dlprefiles; then
610 # Preload the old-style object.
611 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
614 libobjs="$libobjs $arg"
618 # A libtool-controlled library.
625 # Check to see that this really is a libtool archive.
626 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
628 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
632 # If there is no directory component, then add one.
634 */* | *\\*) . $arg ;;
638 # Get the name of the library we link against.
640 for l in $old_library $library_names; do
644 if test -z "$linklib"; then
645 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
649 # Find the relevant object directory and library name.
650 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
651 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
652 if test "X$dir" = "X$arg"; then
658 if test -z "$libdir"; then
659 # It is a libtool convenience library, so add in its objects.
660 convenience="$convenience $dir/$old_library"l
661 old_convenience="$old_convenience $dir/$old_library"
662 compile_command="$compile_command $dir/$old_library"
663 finalize_command="$finalize_command $dir/$old_library"
667 # This library was specified with -dlopen.
668 if test "$prev" = dlfiles; then
669 dlfiles="$dlfiles $arg"
670 if test -z "$dlname"; then
671 # If there is no dlname, we need to preload.
674 # We should not create a dependency on this library, but we
675 # may need any libraries it requires.
676 compile_command="$compile_command$dependency_libs"
677 finalize_command="$finalize_command$dependency_libs"
683 # The library was specified with -dlpreopen.
684 if test "$prev" = dlprefiles; then
685 # Prefer using a static library (so that no silly _DYNAMIC symbols
686 # are required to link).
687 if test -n "$old_library"; then
688 dlprefiles="$dlprefiles $dir/$old_library"
690 dlprefiles="$dlprefiles $dir/$linklib"
695 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
696 link_against_libtool_libs="$link_against_libtool_libs $arg"
697 if test -n "$shlibpath_var"; then
698 # Make sure the rpath contains only unique directories.
699 case "$temp_rpath " in
701 *) temp_rpath="$temp_rpath $dir" ;;
705 # This is the magic to use -rpath.
706 if test -n "$hardcode_libdir_flag_spec"; then
707 if test -n "$hardcode_libdir_separator"; then
708 if test -z "$hardcode_libdirs"; then
709 # Put the magic libdir with the hardcode flag.
710 hardcode_libdirs="$libdir"
711 libdir="@HARDCODE_LIBDIRS@"
713 # Just accumulate the unique libdirs.
714 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
715 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
718 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
725 if test -n "$libdir"; then
726 eval flag=\"$hardcode_libdir_flag_spec\"
728 compile_command="$compile_command $flag"
729 finalize_command="$finalize_command $flag"
731 elif test -n "$runpath_var"; then
732 # Do the same for the permanent run path.
733 case "$perm_rpath " in
735 *) perm_rpath="$perm_rpath $libdir" ;;
741 case "$hardcode_action" in
742 immediate | unsupported)
743 if test "$hardcode_direct" = no; then
744 compile_command="$compile_command $dir/$linklib"
745 elif test "$hardcode_minus_L" = no; then
746 compile_command="$compile_command -L$dir -l$name"
747 elif test "$hardcode_shlibpath_var" = no; then
748 compile_shlibpath="$compile_shlibpath$dir:"
749 compile_command="$compile_command -l$name"
756 # We need an absolute path.
758 /* | [A-Za-z]:[/\\]*) ;;
760 absdir=`cd "$dir" && pwd`
761 if test -z "$absdir"; then
762 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
769 if test "$hardcode_direct" = yes; then
770 compile_command="$compile_command $dir/$linklib"
771 elif test "$hardcode_minus_L" = yes; then
772 compile_command="$compile_command -L$dir -l$name"
773 elif test "$hardcode_shlibpath_var" = yes; then
774 compile_shlibpath="$compile_shlibpath$dir:"
775 compile_command="$compile_command -l$name"
786 if test "$lib_linked" != yes; then
787 $echo "$modename: configuration error: unsupported hardcode properties"
791 # Finalize command for both is simple: just hardcode it.
792 if test "$hardcode_direct" = yes; then
793 finalize_command="$finalize_command $libdir/$linklib"
794 elif test "$hardcode_minus_L" = yes; then
795 finalize_command="$finalize_command -L$libdir -l$name"
796 elif test "$hardcode_shlibpath_var" = yes; then
797 finalize_shlibpath="$finalize_shlibpath$libdir:"
798 finalize_command="$finalize_command -l$name"
800 # We cannot seem to hardcode it, guess we'll fake it.
801 finalize_command="$finalize_command -L$libdir -l$name"
804 # Transform directly to old archives if we don't build new libraries.
805 if test -n "$pic_flag" && test -z "$old_library"; then
806 $echo "$modename: cannot find static library for \`$arg'" 1>&2
810 # Here we assume that one of hardcode_direct or hardcode_minus_L
811 # is not unsupported. This is valid on all known static and
813 if test "$hardcode_direct" != unsupported; then
814 test -n "$old_library" && linklib="$old_library"
815 compile_command="$compile_command $dir/$linklib"
816 finalize_command="$finalize_command $dir/$linklib"
818 compile_command="$compile_command -L$dir -l$name"
819 finalize_command="$finalize_command -L$dir -l$name"
823 # Add in any libraries that this one depends upon.
824 compile_command="$compile_command$dependency_libs"
825 finalize_command="$finalize_command$dependency_libs"
829 # Some other compiler argument.
831 # Unknown arguments in both finalize_command and compile_command need
832 # to be aesthetically quoted because they are evaled later.
833 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
835 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
842 # Now actually substitute the argument into the commands.
843 if test -n "$arg"; then
844 compile_command="$compile_command $arg"
845 finalize_command="$finalize_command $arg"
849 if test -n "$prev"; then
850 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
858 $echo "$modename: you must specify an output file" 1>&2
864 $echo "$modename: output file \`$output' must have no directory components" 1>&2
870 if test -n "$link_against_libtool_libs"; then
871 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
875 if test -n "$deplibs"; then
876 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
879 if test -n "$dlfiles$dlprefiles"; then
880 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
883 if test -n "$rpath"; then
884 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
887 if test -n "$vinfo"; then
888 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
891 if test -n "$release"; then
892 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
895 # Now set the variables for building old libraries.
896 build_libtool_libs=no
901 # Make sure we only generate libraries of the form `libNAME.la'.
905 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
911 name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
912 eval libname=\"$libname_spec\"
914 # All the library-specific variables (install_libdir is set above).
919 if test -n "$objs"; then
920 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
924 # How the heck are we supposed to write a wrapper for a shared library?
925 if test -n "$link_against_libtool_libs"; then
926 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
930 if test -n "$dlfiles$dlprefiles"; then
931 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
935 if test $# -gt 2; then
936 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
940 # Now set the variables for building old libraries.
941 oldlibs="$objdir/$libname.$libext"
942 if test -z "$rpath"; then
943 # Building a libtool convenience library.
944 oldlibs="$objdir/$libname.al $oldlibs"
945 build_libtool_libs=convenience
947 if test -n "$vinfo"; then
948 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
951 if test -n "$release"; then
952 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
956 # Parse the version information argument.
957 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
958 set dummy $vinfo 0 0 0
961 if test -n "$8"; then
962 $echo "$modename: too many parameters to \`-version-info'" 1>&2
971 # Check that each of the things are valid numbers.
973 0 | [1-9] | [1-9][0-9]*) ;;
975 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
976 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
982 0 | [1-9] | [1-9][0-9]*) ;;
984 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
985 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
991 0 | [1-9] | [1-9][0-9]*) ;;
993 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
994 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
999 if test $age -gt $current; then
1000 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1001 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1005 # Calculate the version variables.
1009 case "$version_type" in
1013 major=.`expr $current - $age`
1014 versuffix="$major.$age.$revision"
1018 major=`expr $current - $age`
1019 versuffix=".$current.$age.$revision"
1020 verstring="$current.$age.$revision"
1022 # Add in all the interfaces that we are compatible with.
1024 while test $loop != 0; do
1025 iface=`expr $current - $loop`
1026 loop=`expr $loop - 1`
1027 verstring="$verstring:${iface}.0"
1030 # Make executables depend on our current version.
1031 verstring="$verstring:${current}.0"
1036 versuffix=".$current.$revision"
1040 # Like Linux, but with '-' rather than '.', since we only
1041 # want one extension on Windows 95.
1042 major=`expr $current - $age`
1043 versuffix="-$major-$age-$revision"
1047 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1048 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1053 # Clear the version info if we defaulted, and they specified a release.
1054 if test -z "$vinfo" && test -n "$release"; then
1060 # Check to see if the archive will have undefined symbols.
1061 if test "$allow_undefined" = yes; then
1062 if test "$allow_undefined_flag" = unsupported; then
1063 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1064 build_libtool_libs=no
1068 # Don't allow undefined symbols.
1069 allow_undefined_flag="$no_undefined_flag"
1072 # Add libc to deplibs on all systems.
1073 dependency_libs="$deplibs"
1074 deplibs="$deplibs -lc"
1077 # Create the output directory, or remove our outputs if we need to.
1078 if test -d $objdir; then
1079 $show "${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
1080 $run ${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
1082 $show "$mkdir $objdir"
1085 if test $status -ne 0 && test ! -d $objdir; then
1090 if test "$build_libtool_libs" = yes; then
1091 # Get the real and link names of the library.
1092 eval library_names=\"$library_names_spec\"
1093 set dummy $library_names
1097 if test -n "$soname_spec"; then
1098 eval soname=\"$soname_spec\"
1103 lib="$objdir/$realname"
1106 linknames="$linknames $link"
1109 # Use standard objects if they are PIC.
1110 test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e "$los2o" -e 's/ $//g'`
1112 # Transform .lo files to .o files.
1113 test "$build_old_libs" = yes && oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
1115 if test -n "$whole_archive_flag_spec"; then
1116 if test -n "$convenience"; then
1117 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1120 for xlib in $convenience; do
1121 # Extract the objects.
1123 generated="$generated $xdir"
1124 xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1126 $show "${rm}r $xdir"
1131 if test $status -ne 0 && test ! -d "$xdir"; then
1134 $show "(cd $xdir && $AR x ../$xlib)"
1135 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1137 libobjs="$libobjs `echo $xdir/*`"
1141 # Do each of the archive commands.
1142 eval cmds=\"$archive_cmds\"
1143 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1144 for cmd in $cmds; do
1147 $run eval "$cmd" || exit $?
1151 # Create links to the real library.
1152 for linkname in $linknames; do
1153 if test "$realname" != "$linkname"; then
1154 $show "(cd $objdir && $LN_S $realname $linkname)"
1155 $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
1159 # If -export-dynamic was specified, set the dlname.
1160 if test "$export_dynamic" = yes; then
1161 # On all known operating systems, these are identical.
1168 if test -n "$link_against_libtool_libs"; then
1169 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
1173 if test -n "$deplibs"; then
1174 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
1177 if test -n "$dlfiles$dlprefiles"; then
1178 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
1181 if test -n "$rpath"; then
1182 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
1185 if test -n "$vinfo"; then
1186 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
1189 if test -n "$release"; then
1190 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
1195 if test -n "$objs"; then
1196 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1200 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
1208 # Delete the old objects.
1209 $run $rm $obj $libobj
1211 # Create the old-style object.
1212 reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
1215 eval cmds=\"$reload_cmds\"
1216 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1217 for cmd in $cmds; do
1220 $run eval "$cmd" || exit $?
1224 # Exit if we aren't doing a library object file.
1225 test -z "$libobj" && exit 0
1227 if test "$build_libtool_libs" != yes; then
1228 # Create an invalid libtool object if no PIC, so that we don't
1229 # accidentally link it into a program.
1230 $show "echo timestamp > $libobj"
1231 $run eval "echo timestamp > $libobj" || exit $?
1235 if test -n "$pic_flag"; then
1236 # Only do commands if we really have different PIC objects.
1237 reload_objs="$libobjs"
1239 eval cmds=\"$reload_cmds\"
1240 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1241 for cmd in $cmds; do
1244 $run eval "$cmd" || exit $?
1248 # Just create a symlink.
1249 $show "$LN_S $obj $libobj"
1250 $run $LN_S $obj $libobj || exit $?
1257 if test -n "$vinfo"; then
1258 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
1261 if test -n "$release"; then
1262 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
1265 if test -n "$rpath"; then
1266 # If the user specified any rpath flags, then add them.
1267 for libdir in $rpath; do
1268 if test -n "$hardcode_libdir_flag_spec"; then
1269 if test -n "$hardcode_libdir_separator"; then
1270 if test -z "$hardcode_libdirs"; then
1271 # Put the magic libdir with the hardcode flag.
1272 hardcode_libdirs="$libdir"
1273 libdir="@HARDCODE_LIBDIRS@"
1275 # Just accumulate the unique libdirs.
1276 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1277 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1280 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1287 if test -n "$libdir"; then
1288 eval flag=\"$hardcode_libdir_flag_spec\"
1290 compile_command="$compile_command $flag"
1291 finalize_command="$finalize_command $flag"
1293 elif test -n "$runpath_var"; then
1294 case "$perm_rpath " in
1296 *) perm_rpath="$perm_rpath $libdir" ;;
1302 # Substitute the hardcoded libdirs into the compile commands.
1303 if test -n "$hardcode_libdir_separator"; then
1304 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1305 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1308 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1309 # Transform all the library objects into standard objects.
1310 compile_command=`$echo "X$compile_command " | $Xsed -e "$los2o" -e 's/ $//'`
1311 finalize_command=`$echo "X$finalize_command " | $Xsed -e "$los2o" -e 's/ $//'`
1314 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1315 dlsyms="${output}S.c"
1320 if test -n "$dlsyms"; then
1321 # Add our own program objects to the preloaded list.
1322 dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e "$los2o" -e 's/ $//'`
1324 # Discover the nlist of each of the dlfiles.
1325 nlist="$objdir/${output}.nm"
1327 if test -d $objdir; then
1328 $show "$rm $nlist ${nlist}T"
1329 $run $rm "$nlist" "${nlist}T"
1331 $show "$mkdir $objdir"
1334 if test $status -ne 0 && test ! -d $objdir; then
1339 for arg in $dlprefiles; do
1340 $show "extracting global C symbols from \`$arg'"
1341 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1344 # Parse the name list into a source file.
1345 $show "creating $objdir/$dlsyms"
1346 if test -z "$run"; then
1347 # Make sure we at least have an empty file.
1348 test -f "$nlist" || : > "$nlist"
1350 # Try sorting and uniquifying the output.
1351 if sort "$nlist" | uniq > "$nlist"T; then
1352 mv -f "$nlist"T "$nlist"
1353 wcout=`wc "$nlist" 2>/dev/null`
1354 count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
1355 (test "$count" -ge 0) 2>/dev/null || count=-1
1364 $echo > "$objdir/$dlsyms" "\
1365 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1366 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1372 /* Prevent the only kind of declaration conflicts we can make. */
1373 #define dld_preloaded_symbol_count some_other_symbol
1374 #define dld_preloaded_symbols some_other_symbol
1376 /* External symbol declarations for the compiler. */\
1379 if test -f "$nlist"; then
1380 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1382 echo '/* NONE */' >> "$objdir/$dlsyms"
1385 $echo >> "$objdir/$dlsyms" "\
1387 #undef dld_preloaded_symbol_count
1388 #undef dld_preloaded_symbols
1390 #if defined (__STDC__) && __STDC__
1391 # define __ptr_t void *
1393 # define __ptr_t char *
1396 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1397 int dld_preloaded_symbol_count = $count;
1399 /* The mapping between symbol names and symbols. */
1404 dld_preloaded_symbols[] =
1408 if test -f "$nlist"; then
1409 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1412 $echo >> "$objdir/$dlsyms" "\
1423 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1429 # Now compile the dynamic symbol file.
1430 $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1431 $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1433 # Transform the symbol file into the correct name.
1434 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
1435 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
1436 elif test "$export_dynamic" != yes; then
1437 test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1439 # We keep going just in case the user didn't refer to
1440 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1441 # really was required.
1442 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1444 # Nullify the symbol file.
1445 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1446 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1449 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1450 # Replace the output file specification.
1451 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1452 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1454 # We have no uninstalled library dependencies, so finalize right now.
1455 $show "$compile_command"
1456 $run eval "$compile_command"
1460 # Replace the output file specification.
1461 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
1462 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1464 # Create the binary in the object directory, then wrap it.
1465 if test ! -d $objdir; then
1466 $show "$mkdir $objdir"
1469 if test $status -ne 0 && test ! -d $objdir; then
1474 if test -n "$shlibpath_var"; then
1475 # We should set the shlibpath_var
1477 for dir in $temp_rpath; do
1479 /* | [A-Za-z]:[/\\]*)
1484 # Relative path: add a thisdir entry.
1485 rpath="$rpath\$thisdir/$dir:"
1492 # Delete the old output file.
1495 if test -n "$compile_shlibpath"; then
1496 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1498 if test -n "$finalize_shlibpath"; then
1499 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1502 if test -n "$runpath_var" && test -n "$perm_rpath"; then
1503 # We should set the runpath_var.
1505 for dir in $perm_rpath; do
1508 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1509 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1512 if test "$hardcode_action" = relink; then
1513 # AGH! Flame the AIX and HP-UX people for me, will ya?
1514 $echo "$modename: warning: using a buggy system linker" 1>&2
1515 $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
1518 $show "$compile_command"
1519 $run eval "$compile_command" || exit $?
1521 # Now create the wrapper script.
1522 $show "creating $output"
1524 # Quote the finalize command for shipping.
1525 finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1527 # Quote $echo for shipping.
1528 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
1530 # Only actually do things if our run command is non-null.
1531 if test -z "$run"; then
1533 trap "$rm $output; exit 1" 1 2 15
1538 # $output - temporary wrapper script for $objdir/$output
1539 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1541 # The $output program cannot be directly executed until all the libtool
1542 # libraries that it depends on are installed.
1544 # This wrapper script should never be moved out of \``pwd`'.
1545 # If it is, it will not operate correctly.
1547 # Sed substitution that helps us do robust quoting. It backslashifies
1548 # metacharacters that are still active within double-quoted strings.
1549 Xsed='sed -e s/^X//'
1550 sed_quote_subst='$sed_quote_subst'
1552 # The HP-UX ksh and POSIX shell print the target directory to stdout
1554 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
1556 # This environment variable determines our operation mode.
1557 if test \"\$libtool_install_magic\" = \"$magic\"; then
1558 # install mode needs the following variables:
1559 link_against_libtool_libs='$link_against_libtool_libs'
1560 finalize_command=\"$finalize_command\"
1562 # When we are sourced in execute mode, \$file and \$echo are already set.
1563 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1566 # Make sure echo works.
1567 if test \"X\$1\" = X--no-reexec; then
1568 # Discard the --no-reexec flag, and continue.
1570 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
1571 # Yippee, \$echo works!
1574 # Restart under the correct shell, and then maybe \$echo will work.
1575 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
1581 # Find the directory that this script lives in.
1582 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1583 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1585 # Follow symbolic links until we get to the real thisdir.
1586 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
1587 while test -n \"\$file\"; do
1588 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
1590 # If there was a directory component, then change thisdir.
1591 if test \"x\$destdir\" != \"x\$file\"; then
1592 case \"\$destdir\" in
1593 /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
1594 *) thisdir=\"\$thisdir/\$destdir\" ;;
1598 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1599 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
1602 # Try to get the absolute directory name.
1603 absdir=\`cd \"\$thisdir\" && pwd\`
1604 test -n \"\$absdir\" && thisdir=\"\$absdir\"
1606 progdir=\"\$thisdir/$objdir\"
1609 if test -f \"\$progdir/\$program\"; then"
1611 # Export our shlibpath_var if we have one.
1612 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1614 # Add our own library path to $shlibpath_var
1615 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1617 # Some systems cannot cope with colon-terminated $shlibpath_var
1618 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
1620 export $shlibpath_var
1625 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1626 # Run the actual program with our arguments.
1628 # Export the path to the program.
1629 PATH=\"\$progdir:\$PATH\"
1632 exec \$program \${1+\"\$@\"}
1634 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
1638 # The program doesn't exist.
1639 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
1640 \$echo \"This script is just a wrapper for \$program.\" 1>&2
1641 echo \"See the $PACKAGE documentation for more information.\" 1>&2
1652 # See if we need to build an old-fashioned archive.
1653 for oldlib in $oldlibs; do
1655 if test "$build_libtool_libs" = convenience; then
1657 addlibs="$convenience"
1658 build_libtool_libs=no
1660 addlibs="$old_convenience"
1663 # Add in members from convenience archives.
1664 for xlib in $addlibs; do
1665 # Extract the objects.
1667 generated="$generated $xdir"
1668 xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1670 $show "${rm}r $xdir"
1675 if test $status -ne 0 && test ! -d "$xdir"; then
1678 $show "(cd $xdir && $AR x ../$xlib)"
1679 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1681 oldobjs="$oldobjs `echo $xdir/*`"
1684 # Do each command in the archive commands.
1685 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1686 eval cmds=\"$old_archive_from_new_cmds\"
1688 eval cmds=\"$old_archive_cmds\"
1690 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1691 for cmd in $cmds; do
1694 $run eval "$cmd" || exit $?
1699 if test -n "$generated"; then
1700 $show "${rm}r$generated"
1701 $run ${rm}r$generated
1704 # Now create the libtool archive.
1708 test "$build_old_libs" = yes && old_library="$libname.$libext"
1709 $show "creating $output"
1711 # Only create the output if not a dry run.
1712 if test -z "$run"; then
1714 # $output - a libtool library file
1715 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1717 # The name that we can dlopen(3).
1720 # Names of this library.
1721 library_names='$library_names'
1723 # The name of the static archive.
1724 old_library='$old_library'
1726 # Libraries that this one depends upon.
1727 dependency_libs='$dependency_libs'
1729 # Version information for $libname.
1734 # Directory that this library needs to be installed in:
1735 libdir='$install_libdir'\
1739 # Do a symbolic link so that the libtool archive can be found in
1740 # LD_LIBRARY_PATH before the program is installed.
1741 $show "(cd $objdir && $LN_S ../$output $output)"
1742 $run eval "(cd $objdir && $LN_S ../$output $output)" || exit $?
1748 # libtool install mode
1750 modename="$modename: install"
1752 # There may be an optional sh(1) argument at the beginning of
1753 # install_prog (especially on Windows NT).
1754 if test "$nonopt" = "$SHELL"; then
1755 # Aesthetically quote it.
1756 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
1758 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1762 install_prog="$arg "
1770 # The real first argument should be the name of the installation program.
1771 # Aesthetically quote it.
1772 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1774 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1778 install_prog="$install_prog$arg"
1780 # We need to accept at least all the BSD install flags.
1790 if test -n "$dest"; then
1791 files="$files $dest"
1809 # If the previous option needed an argument, then skip it.
1810 if test -n "$prev"; then
1819 # Aesthetically quote the argument.
1820 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1822 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1826 install_prog="$install_prog $arg"
1829 if test -z "$install_prog"; then
1830 $echo "$modename: you must specify an install program" 1>&2
1835 if test -n "$prev"; then
1836 $echo "$modename: the \`$prev' option requires an argument" 1>&2
1841 if test -z "$files"; then
1842 if test -z "$dest"; then
1843 $echo "$modename: no file or destination specified" 1>&2
1845 $echo "$modename: you must specify a destination" 1>&2
1851 # Strip any trailing slash from the destination.
1852 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
1854 # Check to see that the destination is a directory.
1855 test -d "$dest" && isdir=yes
1856 if test "$isdir" = yes; then
1860 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
1861 test "X$destdir" = "X$dest" && destdir=.
1862 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
1864 # Not a directory, so check to see that there is only one file specified.
1866 if test $# -gt 2; then
1867 $echo "$modename: \`$dest' is not a directory" 1>&2
1873 /* | [A-Za-z]:[/\\]*) ;;
1875 for file in $files; do
1879 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
1888 # This variable tells wrapper scripts just to set variables rather
1889 # than running their programs.
1890 libtool_install_magic="$magic"
1895 for file in $files; do
1897 # Do each installation.
1900 # Do the static libraries later.
1901 staticlibs="$staticlibs $file"
1905 # Check to see that this really is a libtool archive.
1906 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1908 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
1915 # If there is no directory component, then add one.
1917 */* | *\\*) . $file ;;
1921 # Add the libdir to current_libdirs if it is the destination.
1922 if test "X$destdir" = "X$libdir"; then
1923 case "$current_libdirs " in
1925 *) current_libdirs="$current_libdirs $libdir" ;;
1928 # Note the libdir as a future libdir.
1929 case "$future_libdirs " in
1931 *) future_libdirs="$future_libdirs $libdir" ;;
1935 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
1936 test "X$dir" = "X$file/" && dir=
1939 # See the names of the shared library.
1940 set dummy $library_names
1941 if test -n "$2"; then
1946 # Install the shared library and build the symlinks.
1947 $show "$install_prog $dir/$realname $destdir/$realname"
1948 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1949 test "X$dlname" = "X$realname" && dlname=
1951 if test $# -gt 0; then
1952 # Delete the old symlinks.
1956 if test "X$linkname" != "X$realname"; then
1957 rmcmd="$rmcmd $destdir/$linkname"
1963 # ... and create new ones.
1966 if test "X$linkname" != "X$realname"; then
1967 test "X$dlname" = "X$linkname" && dlname=
1968 $show "(cd $destdir && $LN_S $realname $linkname)"
1969 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1974 if test -n "$dlname"; then
1975 # Install the dynamically-loadable library.
1976 $show "$install_prog $dir/$dlname $destdir/$dlname"
1977 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1980 # Do each command in the postinstall commands.
1981 lib="$destdir/$realname"
1982 eval cmds=\"$postinstall_cmds\"
1983 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1984 for cmd in $cmds; do
1987 $run eval "$cmd" || exit $?
1992 # Install the pseudo-library for information purposes.
1993 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1994 $show "$install_prog $file $destdir/$name"
1995 $run eval "$install_prog $file $destdir/$name" || exit $?
1997 # Maybe install the static library, too.
1998 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2002 # Install (i.e. copy) a libtool object.
2004 # Figure out destination file name, if it wasn't already specified.
2005 if test -n "$destname"; then
2006 destfile="$destdir/$destname"
2008 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2009 destfile="$destdir/$destfile"
2012 # Deduce the name of the destination old-style object file.
2015 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
2018 staticdest="$destfile"
2022 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
2028 # Install the libtool object if requested.
2029 if test -n "$destfile"; then
2030 $show "$install_prog $file $destfile"
2031 $run eval "$install_prog $file $destfile" || exit $?
2034 # Install the old object if enabled.
2035 if test "$build_old_libs" = yes; then
2036 # Deduce the name of the old-style object file.
2037 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
2039 $show "$install_prog $staticobj $staticdest"
2040 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
2046 # Figure out destination file name, if it wasn't already specified.
2047 if test -n "$destname"; then
2048 destfile="$destdir/$destname"
2050 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2051 destfile="$destdir/$destfile"
2054 # Do a test to see if this is really a libtool program.
2055 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2056 link_against_libtool_libs=
2059 # If there is no directory component, then add one.
2061 */* | *\\*) . $file ;;
2065 # Check the variables that should have been set.
2066 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
2067 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
2072 for lib in $link_against_libtool_libs; do
2073 # Check to see that each library is installed.
2075 if test -f "$lib"; then
2076 # If there is no directory component, then add one.
2078 */* | *\\*) . $lib ;;
2082 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
2083 if test -n "$libdir" && test ! -f "$libfile"; then
2084 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
2089 if test "$hardcode_action" = relink; then
2090 if test "$finalize" = yes; then
2091 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
2092 $show "$finalize_command"
2093 if $run eval "$finalize_command"; then :
2095 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
2098 file="$objdir/$file"T
2100 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
2103 # Install the binary that we compiled earlier.
2104 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2108 $show "$install_prog$stripme $file $destfile"
2109 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
2114 for file in $staticlibs; do
2115 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2117 # Set up the ranlib parameters.
2118 oldlib="$destdir/$name"
2120 $show "$install_prog $file $oldlib"
2121 $run eval "$install_prog \$file \$oldlib" || exit $?
2123 # Do each command in the postinstall commands.
2124 eval cmds=\"$old_postinstall_cmds\"
2125 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2126 for cmd in $cmds; do
2129 $run eval "$cmd" || exit $?
2134 if test -n "$future_libdirs"; then
2135 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
2138 if test -n "$current_libdirs"; then
2139 # Maybe just do a dry run.
2140 test -n "$run" && current_libdirs=" -n$current_libdirs"
2141 exec $SHELL $0 --finish$current_libdirs
2148 # libtool finish mode
2150 modename="$modename: finish"
2154 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2157 libdirs="$libdirs $dir"
2160 for libdir in $libdirs; do
2161 if test -n "$finish_cmds"; then
2162 # Do each command in the finish commands.
2163 eval cmds=\"$finish_cmds\"
2164 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2165 for cmd in $cmds; do
2168 $run eval "$cmd" || admincmds="$admincmds
2173 if test -n "$finish_eval"; then
2174 # Do the single finish_eval.
2175 eval cmds=\"$finish_eval\"
2176 $run eval "$cmds" || admincmds="$admincmds
2182 echo "----------------------------------------------------------------------"
2183 echo "Libraries have been installed in:"
2184 for libdir in $libdirs; do
2188 echo "To link against installed libraries in a given directory, LIBDIR,"
2189 echo "you must use the \`-LLIBDIR' flag during linking."
2191 echo " You will also need to do at least one of the following:"
2192 if test -n "$shlibpath_var"; then
2193 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2194 echo " during execution"
2196 if test -n "$runpath_var"; then
2197 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2198 echo " during linking"
2200 if test -n "$hardcode_libdir_flag_spec"; then
2202 eval flag=\"$hardcode_libdir_flag_spec\"
2204 echo " - use the \`$flag' linker flag"
2206 if test -n "$admincmds"; then
2207 echo " - have your system administrator run these commands:$admincmds"
2209 if test -f /etc/ld.so.conf; then
2210 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2213 echo "See any operating system documentation about shared libraries for"
2214 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2215 echo "----------------------------------------------------------------------"
2219 # libtool execute mode
2221 modename="$modename: execute"
2223 # The first argument is the command name.
2225 if test -z "$cmd"; then
2226 $echo "$modename: you must specify a COMMAND" 1>&2
2231 # Handle -dlopen flags immediately.
2232 for file in $execute_dlfiles; do
2233 if test ! -f "$file"; then
2234 $echo "$modename: \`$file' is not a file" 1>&2
2242 # Check to see that this really is a libtool archive.
2243 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2245 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2250 # Read the libtool library.
2254 # If there is no directory component, then add one.
2256 */* | *\\*) . $file ;;
2260 # Skip this library if it cannot be dlopened.
2261 if test -z "$dlname"; then
2262 # Warn if it was a shared library.
2263 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2267 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2268 test "X$dir" = "X$file" && dir=.
2270 if test -f "$dir/$objdir/$dlname"; then
2273 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2279 # Just add the directory containing the .lo file.
2280 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2281 test "X$dir" = "X$file" && dir=.
2285 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2290 # Get the absolute pathname.
2291 absdir=`cd "$dir" && pwd`
2292 test -n "$absdir" && dir="$absdir"
2294 # Now add the directory to shlibpath_var.
2295 if eval "test -z \"\$$shlibpath_var\""; then
2296 eval "$shlibpath_var=\"\$dir\""
2298 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2302 # This variable tells wrapper scripts just to set shlibpath_var
2303 # rather than running their programs.
2304 libtool_execute_magic="$magic"
2306 # Check if any of the arguments is a wrapper script.
2313 # Do a test to see if this is really a libtool program.
2314 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2315 # If there is no directory component, then add one.
2317 */* | *\\*) . $file ;;
2321 # Transform arg to wrapped name.
2322 file="$progdir/$program"
2326 # Quote arguments (to preserve shell metacharacters).
2327 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
2328 args="$args \"$file\""
2331 if test -z "$run"; then
2332 # Export the shlibpath_var.
2333 eval "export $shlibpath_var"
2335 # Restore saved enviroment variables
2336 if test "${save_LC_ALL+set}" = set; then
2337 LC_ALL="$save_LC_ALL"; export LC_ALL
2339 if test "${save_LANG+set}" = set; then
2340 LANG="$save_LANG"; export LANG
2343 # Now actually exec the command.
2344 eval "exec \$cmd$args"
2346 $echo "$modename: cannot exec \$cmd$args"
2349 # Display what would be done.
2350 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2351 $echo "export $shlibpath_var"
2357 # libtool uninstall mode
2359 modename="$modename: uninstall"
2366 -*) rm="$rm $arg" ;;
2367 *) files="$files $arg" ;;
2371 if test -z "$rm"; then
2372 $echo "$modename: you must specify an RM program" 1>&2
2377 for file in $files; do
2378 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2379 test "X$dir" = "X$file" && dir=.
2380 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2386 # Possibly a libtool archive, so verify it.
2387 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2390 # Delete the libtool libraries and symlinks.
2391 for n in $library_names; do
2392 rmfiles="$rmfiles $dir/$n"
2393 test "X$n" = "X$dlname" && dlname=
2395 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2396 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2398 $show "$rm $rmfiles"
2401 if test -n "$library_names"; then
2402 # Do each command in the postuninstall commands.
2403 eval cmds=\"$postuninstall_cmds\"
2404 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2405 for cmd in $cmds; do
2413 if test -n "$old_library"; then
2414 # Do each command in the old_postuninstall commands.
2415 eval cmds=\"$old_postuninstall_cmds\"
2416 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2417 for cmd in $cmds; do
2425 # FIXME: should reinstall the best remaining shared library.
2430 if test "$build_old_libs" = yes; then
2431 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
2432 rmfiles="$rmfiles $dir/$oldobj"
2434 $show "$rm $rmfiles"
2439 $show "$rm $rmfiles"
2448 $echo "$modename: you must specify a MODE" 1>&2
2449 $echo "$generic_help" 1>&2
2454 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2455 $echo "$generic_help" 1>&2
2457 fi # test -z "$show_help"
2459 # We need to display help for each of the modes.
2462 "Usage: $modename [OPTION]... [MODE-ARG]...
2464 Provide generalized library-building support services.
2466 --config show all configuration variables
2467 --debug enable verbose shell tracing
2468 -n, --dry-run display commands without modifying any files
2469 --features display basic configuration information and exit
2470 --finish same as \`--mode=finish'
2471 --help display this help message and exit
2472 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
2473 --quiet same as \`--silent'
2474 --silent don't print informational messages
2475 --version print version information
2477 MODE must be one of the following:
2479 compile compile a source file into a libtool object
2480 execute automatically set library path, then run a program
2481 finish complete the installation of libtool libraries
2482 install install libraries or executables
2483 link create a library or an executable
2484 uninstall remove libraries from an installed directory
2486 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
2487 a more detailed description of MODE."
2493 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2495 Compile a source file into a libtool library object.
2497 This mode accepts the following additional options:
2499 -static always build a \`.o' file suitable for static linking
2501 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2502 from the given SOURCEFILE.
2504 The output file name is determined by removing the directory component from
2505 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2506 library object suffix, \`.lo'."
2511 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2513 Automatically set library path, then run a program.
2515 This mode accepts the following additional options:
2517 -dlopen FILE add the directory containing FILE to the library path
2519 This mode sets the library path environment variable according to \`-dlopen'
2522 If any of the ARGS are libtool executable wrappers, then they are translated
2523 into their corresponding uninstalled binary, and any of their required library
2524 directories are added to the library path.
2526 Then, COMMAND is executed, with ARGS as arguments."
2531 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2533 Complete the installation of libtool libraries.
2535 Each LIBDIR is a directory that contains libtool libraries.
2537 The commands that this mode executes may require superuser privileges. Use
2538 the \`--dry-run' option if you just want to see what would be executed."
2543 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2545 Install executables or libraries.
2547 INSTALL-COMMAND is the installation command. The first component should be
2548 either the \`install' or \`cp' program.
2550 The rest of the components are interpreted as arguments to that command (only
2551 BSD-compatible install options are recognized)."
2556 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
2558 Link object files or libraries together to form another library, or to
2559 create an executable program.
2561 LINK-COMMAND is a command using the C compiler that you would use to create
2562 a program from several object files.
2564 The following components of LINK-COMMAND are treated specially:
2566 -all-static do not do any dynamic linking at all
2567 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2568 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
2569 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2570 -LLIBDIR search LIBDIR for required installed libraries
2571 -lNAME OUTPUT-FILE requires the installed library libNAME
2572 -no-undefined declare that a library does not refer to external symbols
2573 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2574 -release RELEASE specify package release information
2575 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2576 -static do not do any dynamic linking of libtool libraries
2577 -version-info CURRENT[:REVISION[:AGE]]
2578 specify library version info [each variable defaults to 0]
2580 All other options (arguments beginning with \`-') are ignored.
2582 Every other argument is treated as a filename. Files ending in \`.la' are
2583 treated as uninstalled libtool libraries, other files are standard or library
2586 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2587 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2589 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2590 using \`ar' and \`ranlib', or on WIndows using \`lib'.
2592 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
2593 is created, otherwise an executable program is created."
2598 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2600 Remove libraries from an installation directory.
2602 RM is the name of the program to use to delete files associated with each FILE
2603 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2606 If FILE is a libtool library, all the files associated with it are deleted.
2607 Otherwise, only FILE itself is deleted using RM."
2611 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2618 $echo "Try \`$modename --help' for more information about other modes."