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
93 # Parse our command line options once, thoroughly.
100 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
104 # If the previous option needs an argument, assign it.
105 if test -n "$prev"; then
108 eval "$prev=\"\$$prev \$arg\""
120 # Have we seen a non-optional argument yet?
127 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
132 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
137 echo "$progname: enabling shell trace mode"
147 if test "$build_libtool_libs" = yes; then
148 echo "enable shared libraries"
150 echo "disable shared libraries"
152 if test "$build_old_libs" = yes; then
153 echo "enable static libraries"
155 echo "disable static libraries"
160 --finish) mode="finish" ;;
162 --mode) prevopt="--mode" prev=mode ;;
163 --mode=*) mode="$optarg" ;;
175 $echo "$modename: unrecognized option \`$arg'" 1>&2
187 if test -n "$prevopt"; then
188 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
193 if test -z "$show_help"; then
195 # Infer the operation mode.
196 if test -z "$mode"; then
198 *cc | *++ | gcc* | *-gcc*)
210 *db | *dbx | *strace | *truss)
220 # If we have no mode, but dlfiles were specified, then do execute mode.
221 test -n "$execute_dlfiles" && mode=execute
223 # Just use the default operation mode.
224 if test -z "$mode"; then
225 if test -n "$nonopt"; then
226 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
228 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
235 # Only execute mode is allowed to have -dlopen flags.
236 if test -n "$execute_dlfiles" && test "$mode" != execute; then
237 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
242 # Change the help message to a mode-specific one.
244 help="Try \`$modename --help --mode=$mode' for more information."
246 # These modes are in order of execution frequency so that they run quickly.
248 # libtool compile mode
250 modename="$modename: compile"
251 # Get the compilation command and the source file.
259 # Accept any command-line options.
262 $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
273 # Accept the current argument as the source file.
277 # Aesthetically quote the previous argument.
279 # Backslashify any backslashes, double quotes, and dollar signs.
280 # These are the only characters that are still specially
281 # interpreted inside of double-quoted scrings.
282 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
284 # Double-quote args containing other shell metacharacters.
285 # Many Bourne shells cannot handle close brackets correctly in scan
286 # sets, so we specify it separately.
288 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
289 lastarg="\"$lastarg\""
293 # Add the previous argument to base_compile.
294 if test -z "$base_compile"; then
295 base_compile="$lastarg"
297 base_compile="$base_compile $lastarg"
301 # Get the name of the library object.
302 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
304 # Recognize several different file suffixes.
319 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
322 *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
324 $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
329 if test -z "$base_compile"; then
330 $echo "$modename: you must specify a compilation command" 1>&2
335 # Delete any leftover library objects.
336 if test "$build_old_libs" = yes; then
337 $run $rm $obj $libobj
338 trap "$run $rm $obj $libobj; exit 1" 1 2 15
341 trap "$run $rm $libobj; exit 1" 1 2 15
344 # Only build a PIC object if we are building libtool libraries.
345 if test "$build_libtool_libs" = yes; then
346 # Without this assignment, base_compile gets emptied.
347 fbsd_hideous_sh_bug=$base_compile
349 # All platforms use -DPIC, to notify preprocessed assembler code.
350 $show "$base_compile$pic_flag -DPIC $srcfile"
351 if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
353 test -n "$obj" && $run $rm $obj
357 # If we have no pic_flag, then copy the object into place and finish.
358 if test -z "$pic_flag"; then
359 $show "$LN_S $obj $libobj"
360 $run $LN_S $obj $libobj
364 # Just move the object, then go on to compile the next one
365 $show "$mv $obj $libobj"
366 $run $mv $obj $libobj || exit $?
368 # Allow error messages only from the first compilation.
369 suppress_output=' >/dev/null 2>&1'
372 # Only build a position-dependent object if we build old libraries.
373 if test "$build_old_libs" = yes; then
374 # Suppress compiler output if we already did a PIC compilation.
375 $show "$base_compile $srcfile$suppress_output"
376 if $run eval "$base_compile \$srcfile$suppress_output"; then :
378 $run $rm $obj $libobj
383 # Create an invalid libtool object if no PIC, so that we do not
384 # accidentally link it into a program.
385 if test "$build_libtool_libs" != yes; then
386 $show "echo timestamp > $libobj"
387 $run eval "echo timestamp > \$libobj" || exit $?
395 modename="$modename: link"
398 compile_command="$CC"
399 finalize_command="$CC"
412 link_against_libtool_libs=
423 # We need to know -static, to get the right output filenames.
427 -all-static | -static)
428 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
429 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
431 build_libtool_libs=no
438 # See if our shared archives depend on static archives.
439 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
441 # Go through the arguments, transforming them on the way.
442 while test $# -gt 0; do
446 # If the previous option needs an argument, assign it.
447 if test -n "$prev"; then
450 compile_command="$compile_command @OUTPUT@"
451 finalize_command="$finalize_command @OUTPUT@"
458 *.la | *.lo) ;; # We handle these cases below.
460 dlprefiles="$dlprefiles $arg"
461 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
477 eval "$prev=\"\$arg\""
488 if test -n "$link_static_flag"; then
489 compile_command="$compile_command $link_static_flag"
490 finalize_command="$finalize_command $link_static_flag"
496 # FIXME: remove this flag sometime in the future.
497 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
512 if test "$export_dynamic" != yes; then
514 if test -n "$export_dynamic_flag_spec"; then
515 eval arg=\"$export_dynamic_flag_spec\"
520 # Add the symbol object into the linking commands.
521 compile_command="$compile_command @SYMFILE@"
522 finalize_command="$finalize_command @SYMFILE@"
527 dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
529 /* | [A-Za-z]:[/\\]*)
530 # Add the corresponding hardcode_libdir_flag, if it is not identical.
533 $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
537 deplibs="$deplibs $arg"
540 -l*) deplibs="$deplibs $arg" ;;
560 # If we have no pic_flag, then this is the same as -all-static.
561 if test -z "$pic_flag" && test -n "$link_static_flag"; then
562 compile_command="$compile_command $link_static_flag"
563 finalize_command="$finalize_command $link_static_flag"
573 # Some other compiler flag.
575 # Unknown arguments in both finalize_command and compile_command need
576 # to be aesthetically quoted because they are evaled later.
577 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
579 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
592 if test "$prev" = dlfiles; then
593 dlfiles="$dlfiles $arg"
594 if test "$build_libtool_libs" = yes; then
598 # If libtool objects are unsupported, then we need to preload.
603 if test "$prev" = dlprefiles; then
604 # Preload the old-style object.
605 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/.o/'`
608 libobjs="$libobjs $arg"
612 # A libtool-controlled library.
619 # Check to see that this really is a libtool archive.
620 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
622 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
626 # If there is no directory component, then add one.
628 */* | *\\*) . $arg ;;
632 # Get the name of the library we link against.
634 for l in $old_library $library_names; do
638 if test -z "$linklib"; then
639 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
643 # Find the relevant object directory and library name.
644 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
645 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
646 if test "X$dir" = "X$arg"; then
652 if test -z "$libdir"; then
653 # It is a libtool convenience library, so add in its objects.
654 convenience="$convenience $dir/$old_library"l
655 old_convenience="$old_convenience $dir/$old_library"
656 compile_command="$compile_command $dir/$old_library"
657 finalize_command="$finalize_command $dir/$old_library"
661 # This library was specified with -dlopen.
662 if test "$prev" = dlfiles; then
663 dlfiles="$dlfiles $arg"
664 if test -z "$dlname"; then
665 # If there is no dlname, we need to preload.
668 # We should not create a dependency on this library, but we
669 # may need any libraries it requires.
670 compile_command="$compile_command$dependency_libs"
671 finalize_command="$finalize_command$dependency_libs"
677 # The library was specified with -dlpreopen.
678 if test "$prev" = dlprefiles; then
679 # Prefer using a static library (so that no silly _DYNAMIC symbols
680 # are required to link).
681 if test -n "$old_library"; then
682 dlprefiles="$dlprefiles $dir/$old_library"
684 dlprefiles="$dlprefiles $dir/$linklib"
689 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
690 link_against_libtool_libs="$link_against_libtool_libs $arg"
691 if test -n "$shlibpath_var"; then
692 # Make sure the rpath contains only unique directories.
693 case "$temp_rpath " in
695 *) temp_rpath="$temp_rpath $dir" ;;
699 # This is the magic to use -rpath.
700 if test -n "$hardcode_libdir_flag_spec"; then
701 if test -n "$hardcode_libdir_separator"; then
702 if test -z "$hardcode_libdirs"; then
703 # Put the magic libdir with the hardcode flag.
704 hardcode_libdirs="$libdir"
705 libdir="@HARDCODE_LIBDIRS@"
707 # Just accumulate the unique libdirs.
708 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
709 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
712 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
719 if test -n "$libdir"; then
720 eval flag=\"$hardcode_libdir_flag_spec\"
722 compile_command="$compile_command $flag"
723 finalize_command="$finalize_command $flag"
725 elif test -n "$runpath_var"; then
726 # Do the same for the permanent run path.
727 case "$perm_rpath " in
729 *) perm_rpath="$perm_rpath $libdir" ;;
735 case "$hardcode_action" in
736 immediate | unsupported)
737 if test "$hardcode_direct" = no; then
738 compile_command="$compile_command $dir/$linklib"
739 elif test "$hardcode_minus_L" = no; then
740 compile_command="$compile_command -L$dir -l$name"
741 elif test "$hardcode_shlibpath_var" = no; then
742 compile_shlibpath="$compile_shlibpath$dir:"
743 compile_command="$compile_command -l$name"
750 # We need an absolute path.
752 /* | [A-Za-z]:[/\\]*) ;;
754 absdir=`cd "$dir" && pwd`
755 if test -z "$absdir"; then
756 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
763 if test "$hardcode_direct" = yes; then
764 compile_command="$compile_command $dir/$linklib"
765 elif test "$hardcode_minus_L" = yes; then
766 compile_command="$compile_command -L$dir -l$name"
767 elif test "$hardcode_shlibpath_var" = yes; then
768 compile_shlibpath="$compile_shlibpath$dir:"
769 compile_command="$compile_command -l$name"
780 if test "$lib_linked" != yes; then
781 $echo "$modename: configuration error: unsupported hardcode properties"
785 # Finalize command for both is simple: just hardcode it.
786 if test "$hardcode_direct" = yes; then
787 finalize_command="$finalize_command $libdir/$linklib"
788 elif test "$hardcode_minus_L" = yes; then
789 finalize_command="$finalize_command -L$libdir -l$name"
790 elif test "$hardcode_shlibpath_var" = yes; then
791 finalize_shlibpath="$finalize_shlibpath$libdir:"
792 finalize_command="$finalize_command -l$name"
794 # We cannot seem to hardcode it, guess we'll fake it.
795 finalize_command="$finalize_command -L$libdir -l$name"
798 # Transform directly to old archives if we don't build new libraries.
799 if test -n "$pic_flag" && test -z "$old_library"; then
800 $echo "$modename: cannot find static library for \`$arg'" 1>&2
804 # Here we assume that one of hardcode_direct or hardcode_minus_L
805 # is not unsupported. This is valid on all known static and
807 if test "$hardcode_direct" != unsupported; then
808 test -n "$old_library" && linklib="$old_library"
809 compile_command="$compile_command $dir/$linklib"
810 finalize_command="$finalize_command $dir/$linklib"
812 compile_command="$compile_command -L$dir -l$name"
813 finalize_command="$finalize_command -L$dir -l$name"
817 # Add in any libraries that this one depends upon.
818 compile_command="$compile_command$dependency_libs"
819 finalize_command="$finalize_command$dependency_libs"
823 # Some other compiler argument.
825 # Unknown arguments in both finalize_command and compile_command need
826 # to be aesthetically quoted because they are evaled later.
827 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
829 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
836 # Now actually substitute the argument into the commands.
837 if test -n "$arg"; then
838 compile_command="$compile_command $arg"
839 finalize_command="$finalize_command $arg"
843 if test -n "$prev"; then
844 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
852 $echo "$modename: you must specify an output file" 1>&2
858 $echo "$modename: output file \`$output' must have no directory components" 1>&2
864 if test -n "$link_against_libtool_libs"; then
865 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
869 if test -n "$deplibs"; then
870 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
873 if test -n "$dlfiles$dlprefiles"; then
874 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
877 if test -n "$rpath"; then
878 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
881 if test -n "$vinfo"; then
882 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
885 if test -n "$release"; then
886 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
889 # Now set the variables for building old libraries.
890 build_libtool_libs=no
895 # Make sure we only generate libraries of the form `libNAME.la'.
899 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
905 name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
906 eval libname=\"$libname_spec\"
908 # All the library-specific variables (install_libdir is set above).
913 if test -n "$objs"; then
914 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
918 # How the heck are we supposed to write a wrapper for a shared library?
919 if test -n "$link_against_libtool_libs"; then
920 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
924 if test -n "$dlfiles$dlprefiles"; then
925 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
929 if test $# -gt 2; then
930 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
934 # Now set the variables for building old libraries.
935 oldlibs="$objdir/$libname.a"
936 if test -z "$rpath"; then
937 # Building a libtool convenience library.
938 oldlibs="$objdir/$libname.al $oldlibs"
939 build_libtool_libs=convenience
941 if test -n "$vinfo"; then
942 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
945 if test -n "$release"; then
946 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
950 # Parse the version information argument.
951 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
952 set dummy $vinfo 0 0 0
955 if test -n "$8"; then
956 $echo "$modename: too many parameters to \`-version-info'" 1>&2
965 # Check that each of the things are valid numbers.
967 0 | [1-9] | [1-9][0-9]*) ;;
969 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
970 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
976 0 | [1-9] | [1-9][0-9]*) ;;
978 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
979 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
985 0 | [1-9] | [1-9][0-9]*) ;;
987 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
988 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
993 if test $age -gt $current; then
994 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
995 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
999 # Calculate the version variables.
1003 case "$version_type" in
1007 major=.`expr $current - $age`
1008 versuffix="$major.$age.$revision"
1012 major=`expr $current - $age`
1013 versuffix=".$current.$age.$revision"
1014 verstring="$current.$age.$revision"
1016 # Add in all the interfaces that we are compatible with.
1018 while test $loop != 0; do
1019 iface=`expr $current - $loop`
1020 loop=`expr $loop - 1`
1021 verstring="$verstring:${iface}.0"
1024 # Make executables depend on our current version.
1025 verstring="$verstring:${current}.0"
1030 versuffix=".$current.$revision"
1034 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1035 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1040 # Clear the version info if we defaulted, and they specified a release.
1041 if test -z "$vinfo" && test -n "$release"; then
1047 # Check to see if the archive will have undefined symbols.
1048 if test "$allow_undefined" = yes; then
1049 if test "$allow_undefined_flag" = unsupported; then
1050 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1051 build_libtool_libs=no
1055 # Don't allow undefined symbols.
1056 allow_undefined_flag="$no_undefined_flag"
1059 # Add libc to deplibs on all systems.
1060 dependency_libs="$deplibs"
1061 deplibs="$deplibs -lc"
1064 # Create the output directory, or remove our outputs if we need to.
1065 if test -d $objdir; then
1066 $show "${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
1067 $run ${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
1069 $show "$mkdir $objdir"
1072 if test $status -ne 0 && test ! -d $objdir; then
1077 if test "$build_libtool_libs" = yes; then
1078 # Get the real and link names of the library.
1079 eval library_names=\"$library_names_spec\"
1080 set dummy $library_names
1084 if test -n "$soname_spec"; then
1085 eval soname=\"$soname_spec\"
1090 lib="$objdir/$realname"
1093 linknames="$linknames $link"
1096 # Use standard objects if they are PIC.
1097 test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
1099 # Transform .lo files to .o files.
1100 test "$build_old_libs" = yes && oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1102 if test -n "$whole_archive_flag_spec"; then
1103 if test -n "$convenience"; then
1104 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1107 for xlib in $convenience; do
1108 # Extract the objects.
1110 generated="$generated $xdir"
1111 xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1113 $show "${rm}r $xdir"
1118 if test $status -ne 0 && test ! -d "$xdir"; then
1121 $show "(cd $xdir && $AR x ../$xlib)"
1122 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1124 libobjs="$libobjs `echo $xdir/*`"
1128 # Do each of the archive commands.
1129 eval cmds=\"$archive_cmds\"
1130 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1131 for cmd in $cmds; do
1134 $run eval "$cmd" || exit $?
1138 # Create links to the real library.
1139 for linkname in $linknames; do
1140 if test "$realname" != "$linkname"; then
1141 $show "(cd $objdir && $LN_S $realname $linkname)"
1142 $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
1146 # If -export-dynamic was specified, set the dlname.
1147 if test "$export_dynamic" = yes; then
1148 # On all known operating systems, these are identical.
1155 if test -n "$link_against_libtool_libs"; then
1156 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
1160 if test -n "$deplibs"; then
1161 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
1164 if test -n "$dlfiles$dlprefiles"; then
1165 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
1168 if test -n "$rpath"; then
1169 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
1172 if test -n "$vinfo"; then
1173 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
1176 if test -n "$release"; then
1177 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
1182 if test -n "$objs"; then
1183 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1187 obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
1195 # Delete the old objects.
1196 $run $rm $obj $libobj
1198 # Create the old-style object.
1199 reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1202 eval cmds=\"$reload_cmds\"
1203 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1204 for cmd in $cmds; do
1207 $run eval "$cmd" || exit $?
1211 # Exit if we aren't doing a library object file.
1212 test -z "$libobj" && exit 0
1214 if test "$build_libtool_libs" != yes; then
1215 # Create an invalid libtool object if no PIC, so that we don't
1216 # accidentally link it into a program.
1217 $show "echo timestamp > $libobj"
1218 $run eval "echo timestamp > $libobj" || exit $?
1222 if test -n "$pic_flag"; then
1223 # Only do commands if we really have different PIC objects.
1224 reload_objs="$libobjs"
1226 eval cmds=\"$reload_cmds\"
1227 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1228 for cmd in $cmds; do
1231 $run eval "$cmd" || exit $?
1235 # Just create a symlink.
1236 $show "$LN_S $obj $libobj"
1237 $run $LN_S $obj $libobj || exit $?
1244 if test -n "$vinfo"; then
1245 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
1248 if test -n "$release"; then
1249 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
1252 if test -n "$rpath"; then
1253 # If the user specified any rpath flags, then add them.
1254 for libdir in $rpath; do
1255 if test -n "$hardcode_libdir_flag_spec"; then
1256 if test -n "$hardcode_libdir_separator"; then
1257 if test -z "$hardcode_libdirs"; then
1258 # Put the magic libdir with the hardcode flag.
1259 hardcode_libdirs="$libdir"
1260 libdir="@HARDCODE_LIBDIRS@"
1262 # Just accumulate the unique libdirs.
1263 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1264 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1267 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1274 if test -n "$libdir"; then
1275 eval flag=\"$hardcode_libdir_flag_spec\"
1277 compile_command="$compile_command $flag"
1278 finalize_command="$finalize_command $flag"
1280 elif test -n "$runpath_var"; then
1281 case "$perm_rpath " in
1283 *) perm_rpath="$perm_rpath $libdir" ;;
1289 # Substitute the hardcoded libdirs into the compile commands.
1290 if test -n "$hardcode_libdir_separator"; then
1291 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1292 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1295 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1296 # Transform all the library objects into standard objects.
1297 compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1298 finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1301 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1302 dlsyms="${output}S.c"
1307 if test -n "$dlsyms"; then
1308 # Add our own program objects to the preloaded list.
1309 dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1311 # Discover the nlist of each of the dlfiles.
1312 nlist="$objdir/${output}.nm"
1314 if test -d $objdir; then
1315 $show "$rm $nlist ${nlist}T"
1316 $run $rm "$nlist" "${nlist}T"
1318 $show "$mkdir $objdir"
1321 if test $status -ne 0 && test ! -d $objdir; then
1326 for arg in $dlprefiles; do
1327 $show "extracting global C symbols from \`$arg'"
1328 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1331 # Parse the name list into a source file.
1332 $show "creating $objdir/$dlsyms"
1333 if test -z "$run"; then
1334 # Make sure we at least have an empty file.
1335 test -f "$nlist" || : > "$nlist"
1337 # Try sorting and uniquifying the output.
1338 if sort "$nlist" | uniq > "$nlist"T; then
1339 mv -f "$nlist"T "$nlist"
1340 wcout=`wc "$nlist" 2>/dev/null`
1341 count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
1342 (test "$count" -ge 0) 2>/dev/null || count=-1
1351 $echo > "$objdir/$dlsyms" "\
1352 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1353 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1359 /* Prevent the only kind of declaration conflicts we can make. */
1360 #define dld_preloaded_symbol_count some_other_symbol
1361 #define dld_preloaded_symbols some_other_symbol
1363 /* External symbol declarations for the compiler. */\
1366 if test -f "$nlist"; then
1367 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1369 echo '/* NONE */' >> "$objdir/$dlsyms"
1372 $echo >> "$objdir/$dlsyms" "\
1374 #undef dld_preloaded_symbol_count
1375 #undef dld_preloaded_symbols
1377 #if defined (__STDC__) && __STDC__
1378 # define __ptr_t void *
1380 # define __ptr_t char *
1383 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1384 int dld_preloaded_symbol_count = $count;
1386 /* The mapping between symbol names and symbols. */
1391 dld_preloaded_symbols[] =
1395 if test -f "$nlist"; then
1396 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1399 $echo >> "$objdir/$dlsyms" "\
1410 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1416 # Now compile the dynamic symbol file.
1417 $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1418 $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1420 # Transform the symbol file into the correct name.
1421 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1422 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1423 elif test "$export_dynamic" != yes; then
1424 test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1426 # We keep going just in case the user didn't refer to
1427 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1428 # really was required.
1429 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1431 # Nullify the symbol file.
1432 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1433 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1436 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1437 # Replace the output file specification.
1438 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1439 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1441 # We have no uninstalled library dependencies, so finalize right now.
1442 $show "$compile_command"
1443 $run eval "$compile_command"
1447 # Replace the output file specification.
1448 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
1449 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1451 # Create the binary in the object directory, then wrap it.
1452 if test ! -d $objdir; then
1453 $show "$mkdir $objdir"
1456 if test $status -ne 0 && test ! -d $objdir; then
1461 if test -n "$shlibpath_var"; then
1462 # We should set the shlibpath_var
1464 for dir in $temp_rpath; do
1466 /* | [A-Za-z]:[/\\]*)
1471 # Relative path: add a thisdir entry.
1472 rpath="$rpath\$thisdir/$dir:"
1479 # Delete the old output file.
1482 if test -n "$compile_shlibpath"; then
1483 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1485 if test -n "$finalize_shlibpath"; then
1486 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1489 if test -n "$runpath_var" && test -n "$perm_rpath"; then
1490 # We should set the runpath_var.
1492 for dir in $perm_rpath; do
1495 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1496 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1499 if test "$hardcode_action" = relink; then
1500 # AGH! Flame the AIX and HP-UX people for me, will ya?
1501 $echo "$modename: warning: using a buggy system linker" 1>&2
1502 $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
1505 $show "$compile_command"
1506 $run eval "$compile_command" || exit $?
1508 # Now create the wrapper script.
1509 $show "creating $output"
1511 # Quote the finalize command for shipping.
1512 finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1514 # Quote $echo for shipping.
1515 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
1517 # Only actually do things if our run command is non-null.
1518 if test -z "$run"; then
1520 trap "$rm $output; exit 1" 1 2 15
1525 # $output - temporary wrapper script for $objdir/$output
1526 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1528 # The $output program cannot be directly executed until all the libtool
1529 # libraries that it depends on are installed.
1531 # This wrapper script should never be moved out of \``pwd`'.
1532 # If it is, it will not operate correctly.
1534 # Sed substitution that helps us do robust quoting. It backslashifies
1535 # metacharacters that are still active within double-quoted strings.
1536 Xsed='sed -e s/^X//'
1537 sed_quote_subst='$sed_quote_subst'
1539 # The HP-UX ksh and POSIX shell print the target directory to stdout
1541 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
1543 # This environment variable determines our operation mode.
1544 if test \"\$libtool_install_magic\" = \"$magic\"; then
1545 # install mode needs the following variables:
1546 link_against_libtool_libs='$link_against_libtool_libs'
1547 finalize_command=\"$finalize_command\"
1549 # When we are sourced in execute mode, \$file and \$echo are already set.
1550 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1553 # Make sure echo works.
1554 if test \"X\$1\" = X--no-reexec; then
1555 # Discard the --no-reexec flag, and continue.
1557 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
1558 # Yippee, \$echo works!
1561 # Restart under the correct shell, and then maybe \$echo will work.
1562 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
1568 # Find the directory that this script lives in.
1569 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1570 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1572 # Follow symbolic links until we get to the real thisdir.
1573 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
1574 while test -n \"\$file\"; do
1575 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
1577 # If there was a directory component, then change thisdir.
1578 if test \"x\$destdir\" != \"x\$file\"; then
1579 case \"\$destdir\" in
1580 /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
1581 *) thisdir=\"\$thisdir/\$destdir\" ;;
1585 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1586 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
1589 # Try to get the absolute directory name.
1590 absdir=\`cd \"\$thisdir\" && pwd\`
1591 test -n \"\$absdir\" && thisdir=\"\$absdir\"
1593 progdir=\"\$thisdir/$objdir\"
1596 if test -f \"\$progdir/\$program\"; then"
1598 # Export our shlibpath_var if we have one.
1599 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1601 # Add our own library path to $shlibpath_var
1602 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1604 # Some systems cannot cope with colon-terminated $shlibpath_var
1605 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
1607 export $shlibpath_var
1612 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1613 # Run the actual program with our arguments.
1615 # Export the path to the program.
1616 PATH=\"\$progdir:\$PATH\"
1619 exec \$program \${1+\"\$@\"}
1621 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
1625 # The program doesn't exist.
1626 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
1627 \$echo \"This script is just a wrapper for \$program.\" 1>&2
1628 echo \"See the $PACKAGE documentation for more information.\" 1>&2
1639 # See if we need to build an old-fashioned archive.
1640 for oldlib in $oldlibs; do
1642 if test "$build_libtool_libs" = convenience; then
1644 addlibs="$convenience"
1645 build_libtool_libs=no
1647 addlibs="$old_convenience"
1650 # Add in members from convenience archives.
1651 for xlib in $addlibs; do
1652 # Extract the objects.
1654 generated="$generated $xdir"
1655 xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1657 $show "${rm}r $xdir"
1662 if test $status -ne 0 && test ! -d "$xdir"; then
1665 $show "(cd $xdir && $AR x ../$xlib)"
1666 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1668 oldobjs="$oldobjs `echo $xdir/*`"
1671 # Do each command in the archive commands.
1672 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1673 eval cmds=\"$old_archive_from_new_cmds\"
1675 eval cmds=\"$old_archive_cmds\"
1677 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1678 for cmd in $cmds; do
1681 $run eval "$cmd" || exit $?
1686 if test -n "$generated"; then
1687 $show "${rm}r$generated"
1688 $run ${rm}r$generated
1691 # Now create the libtool archive.
1695 test "$build_old_libs" = yes && old_library="$libname.a"
1696 $show "creating $output"
1698 # Only create the output if not a dry run.
1699 if test -z "$run"; then
1701 # $output - a libtool library file
1702 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1704 # The name that we can dlopen(3).
1707 # Names of this library.
1708 library_names='$library_names'
1710 # The name of the static archive.
1711 old_library='$old_library'
1713 # Libraries that this one depends upon.
1714 dependency_libs='$dependency_libs'
1716 # Version information for $libname.
1721 # Directory that this library needs to be installed in:
1722 libdir='$install_libdir'\
1726 # Do a symbolic link so that the libtool archive can be found in
1727 # LD_LIBRARY_PATH before the program is installed.
1728 $show "(cd $objdir && $LN_S ../$output $output)"
1729 $run eval "(cd $objdir && $LN_S ../$output $output)" || exit $?
1735 # libtool install mode
1737 modename="$modename: install"
1739 # There may be an optional sh(1) argument at the beginning of
1740 # install_prog (especially on Windows NT).
1741 if test "$nonopt" = "$SHELL"; then
1742 # Aesthetically quote it.
1743 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
1745 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1749 install_prog="$arg "
1757 # The real first argument should be the name of the installation program.
1758 # Aesthetically quote it.
1759 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1761 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1765 install_prog="$install_prog$arg"
1767 # We need to accept at least all the BSD install flags.
1777 if test -n "$dest"; then
1778 files="$files $dest"
1796 # If the previous option needed an argument, then skip it.
1797 if test -n "$prev"; then
1806 # Aesthetically quote the argument.
1807 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1809 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1813 install_prog="$install_prog $arg"
1816 if test -z "$install_prog"; then
1817 $echo "$modename: you must specify an install program" 1>&2
1822 if test -n "$prev"; then
1823 $echo "$modename: the \`$prev' option requires an argument" 1>&2
1828 if test -z "$files"; then
1829 if test -z "$dest"; then
1830 $echo "$modename: no file or destination specified" 1>&2
1832 $echo "$modename: you must specify a destination" 1>&2
1838 # Strip any trailing slash from the destination.
1839 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
1841 # Check to see that the destination is a directory.
1842 test -d "$dest" && isdir=yes
1843 if test "$isdir" = yes; then
1847 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
1848 test "X$destdir" = "X$dest" && destdir=.
1849 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
1851 # Not a directory, so check to see that there is only one file specified.
1853 if test $# -gt 2; then
1854 $echo "$modename: \`$dest' is not a directory" 1>&2
1860 /* | [A-Za-z]:[/\\]*) ;;
1862 for file in $files; do
1866 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
1875 # This variable tells wrapper scripts just to set variables rather
1876 # than running their programs.
1877 libtool_install_magic="$magic"
1882 for file in $files; do
1884 # Do each installation.
1887 # Do the static libraries later.
1888 staticlibs="$staticlibs $file"
1892 # Check to see that this really is a libtool archive.
1893 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1895 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
1902 # If there is no directory component, then add one.
1904 */* | *\\*) . $file ;;
1908 # Add the libdir to current_libdirs if it is the destination.
1909 if test "X$destdir" = "X$libdir"; then
1910 case "$current_libdirs " in
1912 *) current_libdirs="$current_libdirs $libdir" ;;
1915 # Note the libdir as a future libdir.
1916 case "$future_libdirs " in
1918 *) future_libdirs="$future_libdirs $libdir" ;;
1922 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
1923 test "X$dir" = "X$file/" && dir=
1926 # See the names of the shared library.
1927 set dummy $library_names
1928 if test -n "$2"; then
1933 # Install the shared library and build the symlinks.
1934 $show "$install_prog $dir/$realname $destdir/$realname"
1935 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1936 test "X$dlname" = "X$realname" && dlname=
1938 if test $# -gt 0; then
1939 # Delete the old symlinks.
1943 rmcmd="$rmcmd $destdir/$linkname"
1948 # ... and create new ones.
1951 test "X$dlname" = "X$linkname" && dlname=
1952 $show "(cd $destdir && $LN_S $realname $linkname)"
1953 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1957 if test -n "$dlname"; then
1958 # Install the dynamically-loadable library.
1959 $show "$install_prog $dir/$dlname $destdir/$dlname"
1960 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1963 # Do each command in the postinstall commands.
1964 lib="$destdir/$realname"
1965 eval cmds=\"$postinstall_cmds\"
1966 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1967 for cmd in $cmds; do
1970 $run eval "$cmd" || exit $?
1975 # Install the pseudo-library for information purposes.
1976 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1977 $show "$install_prog $file $destdir/$name"
1978 $run eval "$install_prog $file $destdir/$name" || exit $?
1980 # Maybe install the static library, too.
1981 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1985 # Install (i.e. copy) a libtool object.
1987 # Figure out destination file name, if it wasn't already specified.
1988 if test -n "$destname"; then
1989 destfile="$destdir/$destname"
1991 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1992 destfile="$destdir/$destfile"
1995 # Deduce the name of the destination old-style object file.
1998 staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/.o/'`
2001 staticdest="$destfile"
2005 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
2011 # Install the libtool object if requested.
2012 if test -n "$destfile"; then
2013 $show "$install_prog $file $destfile"
2014 $run eval "$install_prog $file $destfile" || exit $?
2017 # Install the old object if enabled.
2018 if test "$build_old_libs" = yes; then
2019 # Deduce the name of the old-style object file.
2020 staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/.o/'`
2022 $show "$install_prog $staticobj $staticdest"
2023 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
2029 # Figure out destination file name, if it wasn't already specified.
2030 if test -n "$destname"; then
2031 destfile="$destdir/$destname"
2033 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2034 destfile="$destdir/$destfile"
2037 # Do a test to see if this is really a libtool program.
2038 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2039 link_against_libtool_libs=
2042 # If there is no directory component, then add one.
2044 */* | *\\*) . $file ;;
2048 # Check the variables that should have been set.
2049 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
2050 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
2055 for lib in $link_against_libtool_libs; do
2056 # Check to see that each library is installed.
2058 if test -f "$lib"; then
2059 # If there is no directory component, then add one.
2061 */* | *\\*) . $lib ;;
2065 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
2066 if test -n "$libdir" && test ! -f "$libfile"; then
2067 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
2072 if test "$hardcode_action" = relink; then
2073 if test "$finalize" = yes; then
2074 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
2075 $show "$finalize_command"
2076 if $run eval "$finalize_command"; then :
2078 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
2081 file="$objdir/$file"T
2083 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
2086 # Install the binary that we compiled earlier.
2087 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2091 $show "$install_prog$stripme $file $destfile"
2092 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
2097 for file in $staticlibs; do
2098 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2100 # Set up the ranlib parameters.
2101 oldlib="$destdir/$name"
2103 $show "$install_prog $file $oldlib"
2104 $run eval "$install_prog \$file \$oldlib" || exit $?
2106 # Do each command in the postinstall commands.
2107 eval cmds=\"$old_postinstall_cmds\"
2108 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2109 for cmd in $cmds; do
2112 $run eval "$cmd" || exit $?
2117 if test -n "$future_libdirs"; then
2118 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
2121 if test -n "$current_libdirs"; then
2122 # Maybe just do a dry run.
2123 test -n "$run" && current_libdirs=" -n$current_libdirs"
2124 exec $SHELL $0 --finish$current_libdirs
2131 # libtool finish mode
2133 modename="$modename: finish"
2137 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2140 libdirs="$libdirs $dir"
2143 for libdir in $libdirs; do
2144 if test -n "$finish_cmds"; then
2145 # Do each command in the finish commands.
2146 eval cmds=\"$finish_cmds\"
2147 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2148 for cmd in $cmds; do
2151 $run eval "$cmd" || admincmds="$admincmds
2156 if test -n "$finish_eval"; then
2157 # Do the single finish_eval.
2158 eval cmds=\"$finish_eval\"
2159 $run eval "$cmds" || admincmds="$admincmds
2165 echo "----------------------------------------------------------------------"
2166 echo "Libraries have been installed in:"
2167 for libdir in $libdirs; do
2171 echo "To link against installed libraries in a given directory, LIBDIR,"
2172 echo "you must use the \`-LLIBDIR' flag during linking."
2174 echo " You will also need to do at least one of the following:"
2175 if test -n "$shlibpath_var"; then
2176 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2177 echo " during execution"
2179 if test -n "$runpath_var"; then
2180 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2181 echo " during linking"
2183 if test -n "$hardcode_libdir_flag_spec"; then
2185 eval flag=\"$hardcode_libdir_flag_spec\"
2187 echo " - use the \`$flag' linker flag"
2189 if test -n "$admincmds"; then
2190 echo " - have your system administrator run these commands:$admincmds"
2192 if test -f /etc/ld.so.conf; then
2193 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2196 echo "See any operating system documentation about shared libraries for"
2197 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2198 echo "----------------------------------------------------------------------"
2202 # libtool execute mode
2204 modename="$modename: execute"
2206 # The first argument is the command name.
2208 if test -z "$cmd"; then
2209 $echo "$modename: you must specify a COMMAND" 1>&2
2214 # Handle -dlopen flags immediately.
2215 for file in $execute_dlfiles; do
2216 if test ! -f "$file"; then
2217 $echo "$modename: \`$file' is not a file" 1>&2
2225 # Check to see that this really is a libtool archive.
2226 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2228 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2233 # Read the libtool library.
2237 # If there is no directory component, then add one.
2239 */* | *\\*) . $file ;;
2243 # Skip this library if it cannot be dlopened.
2244 if test -z "$dlname"; then
2245 # Warn if it was a shared library.
2246 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2250 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2251 test "X$dir" = "X$file" && dir=.
2253 if test -f "$dir/$objdir/$dlname"; then
2256 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2262 # Just add the directory containing the .lo file.
2263 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2264 test "X$dir" = "X$file" && dir=.
2268 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2273 # Get the absolute pathname.
2274 absdir=`cd "$dir" && pwd`
2275 test -n "$absdir" && dir="$absdir"
2277 # Now add the directory to shlibpath_var.
2278 if eval "test -z \"\$$shlibpath_var\""; then
2279 eval "$shlibpath_var=\"\$dir\""
2281 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2285 # This variable tells wrapper scripts just to set shlibpath_var
2286 # rather than running their programs.
2287 libtool_execute_magic="$magic"
2289 # Check if any of the arguments is a wrapper script.
2296 # Do a test to see if this is really a libtool program.
2297 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2298 # If there is no directory component, then add one.
2300 */* | *\\*) . $file ;;
2304 # Transform arg to wrapped name.
2305 file="$progdir/$program"
2309 # Quote arguments (to preserve shell metacharacters).
2310 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
2311 args="$args \"$file\""
2314 if test -z "$run"; then
2315 # Export the shlibpath_var.
2316 eval "export $shlibpath_var"
2318 # Restore saved enviroment variables
2319 if test "${save_LC_ALL+set}" = set; then
2320 LC_ALL="$save_LC_ALL"; export LC_ALL
2322 if test "${save_LANG+set}" = set; then
2323 LANG="$save_LANG"; export LANG
2326 # Now actually exec the command.
2327 eval "exec \$cmd$args"
2329 $echo "$modename: cannot exec \$cmd$args"
2332 # Display what would be done.
2333 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2334 $echo "export $shlibpath_var"
2340 # libtool uninstall mode
2342 modename="$modename: uninstall"
2349 -*) rm="$rm $arg" ;;
2350 *) files="$files $arg" ;;
2354 if test -z "$rm"; then
2355 $echo "$modename: you must specify an RM program" 1>&2
2360 for file in $files; do
2361 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2362 test "X$dir" = "X$file" && dir=.
2363 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2369 # Possibly a libtool archive, so verify it.
2370 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2373 # Delete the libtool libraries and symlinks.
2374 for n in $library_names; do
2375 rmfiles="$rmfiles $dir/$n"
2376 test "X$n" = "X$dlname" && dlname=
2378 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2379 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2381 $show "$rm $rmfiles"
2384 if test -n "$library_names"; then
2385 # Do each command in the postuninstall commands.
2386 eval cmds=\"$postuninstall_cmds\"
2387 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2388 for cmd in $cmds; do
2396 if test -n "$old_library"; then
2397 # Do each command in the old_postuninstall commands.
2398 eval cmds=\"$old_postuninstall_cmds\"
2399 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2400 for cmd in $cmds; do
2408 # FIXME: should reinstall the best remaining shared library.
2413 if test "$build_old_libs" = yes; then
2414 oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/.o/'`
2415 rmfiles="$rmfiles $dir/$oldobj"
2417 $show "$rm $rmfiles"
2422 $show "$rm $rmfiles"
2431 $echo "$modename: you must specify a MODE" 1>&2
2432 $echo "$generic_help" 1>&2
2437 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2438 $echo "$generic_help" 1>&2
2440 fi # test -z "$show_help"
2442 # We need to display help for each of the modes.
2445 "Usage: $modename [OPTION]... [MODE-ARG]...
2447 Provide generalized library-building support services.
2449 --config show all configuration variables
2450 --debug enable verbose shell tracing
2451 -n, --dry-run display commands without modifying any files
2452 --features display basic configuration information and exit
2453 --finish same as \`--mode=finish'
2454 --help display this help message and exit
2455 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
2456 --quiet same as \`--silent'
2457 --silent don't print informational messages
2458 --version print version information
2460 MODE must be one of the following:
2462 compile compile a source file into a libtool object
2463 execute automatically set library path, then run a program
2464 finish complete the installation of libtool libraries
2465 install install libraries or executables
2466 link create a library or an executable
2467 uninstall remove libraries from an installed directory
2469 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
2470 a more detailed description of MODE."
2476 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2478 Compile a source file into a libtool library object.
2480 This mode accepts the following additional options:
2482 -static always build a \`.o' file suitable for static linking
2484 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2485 from the given SOURCEFILE.
2487 The output file name is determined by removing the directory component from
2488 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2489 library object suffix, \`.lo'."
2494 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2496 Automatically set library path, then run a program.
2498 This mode accepts the following additional options:
2500 -dlopen FILE add the directory containing FILE to the library path
2502 This mode sets the library path environment variable according to \`-dlopen'
2505 If any of the ARGS are libtool executable wrappers, then they are translated
2506 into their corresponding uninstalled binary, and any of their required library
2507 directories are added to the library path.
2509 Then, COMMAND is executed, with ARGS as arguments."
2514 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2516 Complete the installation of libtool libraries.
2518 Each LIBDIR is a directory that contains libtool libraries.
2520 The commands that this mode executes may require superuser privileges. Use
2521 the \`--dry-run' option if you just want to see what would be executed."
2526 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2528 Install executables or libraries.
2530 INSTALL-COMMAND is the installation command. The first component should be
2531 either the \`install' or \`cp' program.
2533 The rest of the components are interpreted as arguments to that command (only
2534 BSD-compatible install options are recognized)."
2539 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
2541 Link object files or libraries together to form another library, or to
2542 create an executable program.
2544 LINK-COMMAND is a command using the C compiler that you would use to create
2545 a program from several object files.
2547 The following components of LINK-COMMAND are treated specially:
2549 -all-static do not do any dynamic linking at all
2550 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2551 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
2552 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2553 -LLIBDIR search LIBDIR for required installed libraries
2554 -lNAME OUTPUT-FILE requires the installed library libNAME
2555 -no-undefined declare that a library does not refer to external symbols
2556 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2557 -release RELEASE specify package release information
2558 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2559 -static do not do any dynamic linking of libtool libraries
2560 -version-info CURRENT[:REVISION[:AGE]]
2561 specify library version info [each variable defaults to 0]
2563 All other options (arguments beginning with \`-') are ignored.
2565 Every other argument is treated as a filename. Files ending in \`.la' are
2566 treated as uninstalled libtool libraries, other files are standard or library
2569 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2570 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2572 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
2575 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
2576 created, otherwise an executable program is created."
2581 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2583 Remove libraries from an installation directory.
2585 RM is the name of the program to use to delete files associated with each FILE
2586 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2589 If FILE is a libtool library, all the files associated with it are deleted.
2590 Otherwise, only FILE itself is deleted using RM."
2594 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2601 $echo "Try \`$modename --help' for more information about other modes."