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.
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 # Now set the variables for building old libraries.
1078 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1079 oldlibs="$oldlibs $objdir/$libname.a"
1081 # Transform .lo files to .o files.
1082 oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1085 if test "$build_libtool_libs" = yes; then
1086 # Get the real and link names of the library.
1087 eval library_names=\"$library_names_spec\"
1088 set dummy $library_names
1092 if test -n "$soname_spec"; then
1093 eval soname=\"$soname_spec\"
1098 lib="$objdir/$realname"
1101 linknames="$linknames $link"
1104 # Use standard objects if they are PIC.
1105 test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
1107 if test -n "$whole_archive_flag_spec"; then
1108 if test -n "$convenience"; then
1109 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1112 for xlib in $convenience; do
1113 # Extract the objects.
1115 generated="$generated $xdir"
1116 xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1118 $show "${rm}r $xdir"
1123 if test $status -ne 0 && test ! -d "$xdir"; then
1126 $show "(cd $xdir && $AR x ../$xlib)"
1127 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1129 libobjs="$libobjs `echo $xdir/*`"
1133 # Do each of the archive commands.
1134 eval cmds=\"$archive_cmds\"
1135 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1136 for cmd in $cmds; do
1139 $run eval "$cmd" || exit $?
1143 # Create links to the real library.
1144 for linkname in $linknames; do
1145 if test "$realname" != "$linkname"; then
1146 $show "(cd $objdir && $LN_S $realname $linkname)"
1147 $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
1151 # If -export-dynamic was specified, set the dlname.
1152 if test "$export_dynamic" = yes; then
1153 # On all known operating systems, these are identical.
1160 if test -n "$link_against_libtool_libs"; then
1161 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
1165 if test -n "$deplibs"; then
1166 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
1169 if test -n "$dlfiles$dlprefiles"; then
1170 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
1173 if test -n "$rpath"; then
1174 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
1177 if test -n "$vinfo"; then
1178 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
1181 if test -n "$release"; then
1182 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
1187 if test -n "$objs"; then
1188 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1192 obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
1200 # Delete the old objects.
1201 $run $rm $obj $libobj
1203 # Create the old-style object.
1204 reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1207 eval cmds=\"$reload_cmds\"
1208 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1209 for cmd in $cmds; do
1212 $run eval "$cmd" || exit $?
1216 # Exit if we aren't doing a library object file.
1217 test -z "$libobj" && exit 0
1219 if test "$build_libtool_libs" != yes; then
1220 # Create an invalid libtool object if no PIC, so that we don't
1221 # accidentally link it into a program.
1222 $show "echo timestamp > $libobj"
1223 $run eval "echo timestamp > $libobj" || exit $?
1227 if test -n "$pic_flag"; then
1228 # Only do commands if we really have different PIC objects.
1229 reload_objs="$libobjs"
1231 eval cmds=\"$reload_cmds\"
1232 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1233 for cmd in $cmds; do
1236 $run eval "$cmd" || exit $?
1240 # Just create a symlink.
1241 $show "$LN_S $obj $libobj"
1242 $run $LN_S $obj $libobj || exit $?
1249 if test -n "$vinfo"; then
1250 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
1253 if test -n "$release"; then
1254 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
1257 if test -n "$rpath"; then
1258 # If the user specified any rpath flags, then add them.
1259 for libdir in $rpath; do
1260 if test -n "$hardcode_libdir_flag_spec"; then
1261 if test -n "$hardcode_libdir_separator"; then
1262 if test -z "$hardcode_libdirs"; then
1263 # Put the magic libdir with the hardcode flag.
1264 hardcode_libdirs="$libdir"
1265 libdir="@HARDCODE_LIBDIRS@"
1267 # Just accumulate the unique libdirs.
1268 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1269 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1272 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1279 if test -n "$libdir"; then
1280 eval flag=\"$hardcode_libdir_flag_spec\"
1282 compile_command="$compile_command $flag"
1283 finalize_command="$finalize_command $flag"
1285 elif test -n "$runpath_var"; then
1286 case "$perm_rpath " in
1288 *) perm_rpath="$perm_rpath $libdir" ;;
1294 # Substitute the hardcoded libdirs into the compile commands.
1295 if test -n "$hardcode_libdir_separator"; then
1296 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1297 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1300 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1301 # Transform all the library objects into standard objects.
1302 compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1303 finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1306 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1307 dlsyms="${output}S.c"
1312 if test -n "$dlsyms"; then
1313 # Add our own program objects to the preloaded list.
1314 dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1316 # Discover the nlist of each of the dlfiles.
1317 nlist="$objdir/${output}.nm"
1319 if test -d $objdir; then
1320 $show "$rm $nlist ${nlist}T"
1321 $run $rm "$nlist" "${nlist}T"
1323 $show "$mkdir $objdir"
1326 if test $status -ne 0 && test ! -d $objdir; then
1331 for arg in $dlprefiles; do
1332 $show "extracting global C symbols from \`$arg'"
1333 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1336 # Parse the name list into a source file.
1337 $show "creating $objdir/$dlsyms"
1338 if test -z "$run"; then
1339 # Make sure we at least have an empty file.
1340 test -f "$nlist" || : > "$nlist"
1342 # Try sorting and uniquifying the output.
1343 if sort "$nlist" | uniq > "$nlist"T; then
1344 mv -f "$nlist"T "$nlist"
1345 wcout=`wc "$nlist" 2>/dev/null`
1346 count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
1347 (test "$count" -ge 0) 2>/dev/null || count=-1
1356 $echo > "$objdir/$dlsyms" "\
1357 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1358 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1364 /* Prevent the only kind of declaration conflicts we can make. */
1365 #define dld_preloaded_symbol_count some_other_symbol
1366 #define dld_preloaded_symbols some_other_symbol
1368 /* External symbol declarations for the compiler. */\
1371 if test -f "$nlist"; then
1372 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1374 echo '/* NONE */' >> "$objdir/$dlsyms"
1377 $echo >> "$objdir/$dlsyms" "\
1379 #undef dld_preloaded_symbol_count
1380 #undef dld_preloaded_symbols
1382 #if defined (__STDC__) && __STDC__
1383 # define __ptr_t void *
1385 # define __ptr_t char *
1388 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1389 int dld_preloaded_symbol_count = $count;
1391 /* The mapping between symbol names and symbols. */
1396 dld_preloaded_symbols[] =
1400 if test -f "$nlist"; then
1401 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1404 $echo >> "$objdir/$dlsyms" "\
1415 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1421 # Now compile the dynamic symbol file.
1422 $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1423 $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1425 # Transform the symbol file into the correct name.
1426 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1427 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1428 elif test "$export_dynamic" != yes; then
1429 test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1431 # We keep going just in case the user didn't refer to
1432 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1433 # really was required.
1434 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1436 # Nullify the symbol file.
1437 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1438 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1441 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1442 # Replace the output file specification.
1443 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1444 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1446 # We have no uninstalled library dependencies, so finalize right now.
1447 $show "$compile_command"
1448 $run eval "$compile_command"
1452 # Replace the output file specification.
1453 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
1454 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1456 # Create the binary in the object directory, then wrap it.
1457 if test ! -d $objdir; then
1458 $show "$mkdir $objdir"
1461 if test $status -ne 0 && test ! -d $objdir; then
1466 if test -n "$shlibpath_var"; then
1467 # We should set the shlibpath_var
1469 for dir in $temp_rpath; do
1471 /* | [A-Za-z]:[/\\]*)
1476 # Relative path: add a thisdir entry.
1477 rpath="$rpath\$thisdir/$dir:"
1484 # Delete the old output file.
1487 if test -n "$compile_shlibpath"; then
1488 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1490 if test -n "$finalize_shlibpath"; then
1491 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1494 if test -n "$runpath_var" && test -n "$perm_rpath"; then
1495 # We should set the runpath_var.
1497 for dir in $perm_rpath; do
1500 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1501 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1504 if test "$hardcode_action" = relink; then
1505 # AGH! Flame the AIX and HP-UX people for me, will ya?
1506 $echo "$modename: warning: using a buggy system linker" 1>&2
1507 $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
1510 $show "$compile_command"
1511 $run eval "$compile_command" || exit $?
1513 # Now create the wrapper script.
1514 $show "creating $output"
1516 # Quote the finalize command for shipping.
1517 finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1519 # Quote $echo for shipping.
1520 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
1522 # Only actually do things if our run command is non-null.
1523 if test -z "$run"; then
1525 trap "$rm $output; exit 1" 1 2 15
1530 # $output - temporary wrapper script for $objdir/$output
1531 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1533 # The $output program cannot be directly executed until all the libtool
1534 # libraries that it depends on are installed.
1536 # This wrapper script should never be moved out of \``pwd`'.
1537 # If it is, it will not operate correctly.
1539 # Sed substitution that helps us do robust quoting. It backslashifies
1540 # metacharacters that are still active within double-quoted strings.
1541 Xsed='sed -e s/^X//'
1542 sed_quote_subst='$sed_quote_subst'
1544 # The HP-UX ksh and POSIX shell print the target directory to stdout
1546 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
1548 # This environment variable determines our operation mode.
1549 if test \"\$libtool_install_magic\" = \"$magic\"; then
1550 # install mode needs the following variables:
1551 link_against_libtool_libs='$link_against_libtool_libs'
1552 finalize_command=\"$finalize_command\"
1554 # When we are sourced in execute mode, \$file and \$echo are already set.
1555 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1558 # Make sure echo works.
1559 if test \"X\$1\" = X--no-reexec; then
1560 # Discard the --no-reexec flag, and continue.
1562 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
1563 # Yippee, \$echo works!
1566 # Restart under the correct shell, and then maybe \$echo will work.
1567 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
1573 # Find the directory that this script lives in.
1574 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1575 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1577 # Follow symbolic links until we get to the real thisdir.
1578 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
1579 while test -n \"\$file\"; do
1580 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
1582 # If there was a directory component, then change thisdir.
1583 if test \"x\$destdir\" != \"x\$file\"; then
1584 case \"\$destdir\" in
1585 /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
1586 *) thisdir=\"\$thisdir/\$destdir\" ;;
1590 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1591 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
1594 # Try to get the absolute directory name.
1595 absdir=\`cd \"\$thisdir\" && pwd\`
1596 test -n \"\$absdir\" && thisdir=\"\$absdir\"
1598 progdir=\"\$thisdir/$objdir\"
1601 if test -f \"\$progdir/\$program\"; then"
1603 # Export our shlibpath_var if we have one.
1604 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1606 # Add our own library path to $shlibpath_var
1607 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1609 # Some systems cannot cope with colon-terminated $shlibpath_var
1610 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
1612 export $shlibpath_var
1617 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1618 # Run the actual program with our arguments.
1620 # Export the path to the program.
1621 PATH=\"\$progdir:\$PATH\"
1624 exec \$program \${1+\"\$@\"}
1626 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
1630 # The program doesn't exist.
1631 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
1632 \$echo \"This script is just a wrapper for \$program.\" 1>&2
1633 echo \"See the $PACKAGE documentation for more information.\" 1>&2
1644 # See if we need to build an old-fashioned archive.
1645 for oldlib in $oldlibs; do
1647 if test "$build_libtool_libs" = convenience; then
1649 addlibs="$convenience"
1650 build_libtool_libs=no
1652 addlibs="$old_convenience"
1655 # Add in members from convenience archives.
1656 for xlib in $addlibs; do
1657 # Extract the objects.
1659 generated="$generated $xdir"
1660 xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1662 $show "${rm}r $xdir"
1667 if test $status -ne 0 && test ! -d "$xdir"; then
1670 $show "(cd $xdir && $AR x ../$xlib)"
1671 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1673 oldobjs="$oldobjs `echo $xdir/*`"
1676 # Do each command in the archive commands.
1677 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1678 eval cmds=\"$old_archive_from_new_cmds\"
1680 eval cmds=\"$old_archive_cmds\"
1682 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1683 for cmd in $cmds; do
1686 $run eval "$cmd" || exit $?
1691 if test -n "$generated"; then
1692 $show "${rm}r$generated"
1693 $run ${rm}r$generated
1696 # Now create the libtool archive.
1700 test "$build_old_libs" = yes && old_library="$libname.a"
1701 $show "creating $output"
1703 # Only create the output if not a dry run.
1704 if test -z "$run"; then
1706 # $output - a libtool library file
1707 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1709 # The name that we can dlopen(3).
1712 # Names of this library.
1713 library_names='$library_names'
1715 # The name of the static archive.
1716 old_library='$old_library'
1718 # Libraries that this one depends upon.
1719 dependency_libs='$dependency_libs'
1721 # Version information for $libname.
1726 # Directory that this library needs to be installed in:
1727 libdir='$install_libdir'\
1731 # Do a symbolic link so that the libtool archive can be found in
1732 # LD_LIBRARY_PATH before the program is installed.
1733 $show "(cd $objdir && $LN_S ../$output $output)"
1734 $run eval "(cd $objdir && $LN_S ../$output $output)" || exit $?
1740 # libtool install mode
1742 modename="$modename: install"
1744 # There may be an optional sh(1) argument at the beginning of
1745 # install_prog (especially on Windows NT).
1746 if test "$nonopt" = "$SHELL"; then
1747 # Aesthetically quote it.
1748 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
1750 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1754 install_prog="$arg "
1762 # The real first argument should be the name of the installation program.
1763 # Aesthetically quote it.
1764 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1766 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1770 install_prog="$install_prog$arg"
1772 # We need to accept at least all the BSD install flags.
1782 if test -n "$dest"; then
1783 files="$files $dest"
1801 # If the previous option needed an argument, then skip it.
1802 if test -n "$prev"; then
1811 # Aesthetically quote the argument.
1812 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1814 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1818 install_prog="$install_prog $arg"
1821 if test -z "$install_prog"; then
1822 $echo "$modename: you must specify an install program" 1>&2
1827 if test -n "$prev"; then
1828 $echo "$modename: the \`$prev' option requires an argument" 1>&2
1833 if test -z "$files"; then
1834 if test -z "$dest"; then
1835 $echo "$modename: no file or destination specified" 1>&2
1837 $echo "$modename: you must specify a destination" 1>&2
1843 # Strip any trailing slash from the destination.
1844 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
1846 # Check to see that the destination is a directory.
1847 test -d "$dest" && isdir=yes
1848 if test "$isdir" = yes; then
1852 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
1853 test "X$destdir" = "X$dest" && destdir=.
1854 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
1856 # Not a directory, so check to see that there is only one file specified.
1858 if test $# -gt 2; then
1859 $echo "$modename: \`$dest' is not a directory" 1>&2
1865 /* | [A-Za-z]:[/\\]*) ;;
1867 for file in $files; do
1871 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
1880 # This variable tells wrapper scripts just to set variables rather
1881 # than running their programs.
1882 libtool_install_magic="$magic"
1887 for file in $files; do
1889 # Do each installation.
1892 # Do the static libraries later.
1893 staticlibs="$staticlibs $file"
1897 # Check to see that this really is a libtool archive.
1898 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1900 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
1907 # If there is no directory component, then add one.
1909 */* | *\\*) . $file ;;
1913 # Add the libdir to current_libdirs if it is the destination.
1914 if test "X$destdir" = "X$libdir"; then
1915 case "$current_libdirs " in
1917 *) current_libdirs="$current_libdirs $libdir" ;;
1920 # Note the libdir as a future libdir.
1921 case "$future_libdirs " in
1923 *) future_libdirs="$future_libdirs $libdir" ;;
1927 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
1928 test "X$dir" = "X$file/" && dir=
1931 # See the names of the shared library.
1932 set dummy $library_names
1933 if test -n "$2"; then
1938 # Install the shared library and build the symlinks.
1939 $show "$install_prog $dir/$realname $destdir/$realname"
1940 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1941 test "X$dlname" = "X$realname" && dlname=
1943 if test $# -gt 0; then
1944 # Delete the old symlinks.
1948 rmcmd="$rmcmd $destdir/$linkname"
1953 # ... and create new ones.
1956 test "X$dlname" = "X$linkname" && dlname=
1957 $show "(cd $destdir && $LN_S $realname $linkname)"
1958 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1962 if test -n "$dlname"; then
1963 # Install the dynamically-loadable library.
1964 $show "$install_prog $dir/$dlname $destdir/$dlname"
1965 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1968 # Do each command in the postinstall commands.
1969 lib="$destdir/$realname"
1970 eval cmds=\"$postinstall_cmds\"
1971 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1972 for cmd in $cmds; do
1975 $run eval "$cmd" || exit $?
1980 # Install the pseudo-library for information purposes.
1981 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1982 $show "$install_prog $file $destdir/$name"
1983 $run eval "$install_prog $file $destdir/$name" || exit $?
1985 # Maybe install the static library, too.
1986 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1990 # Install (i.e. copy) a libtool object.
1992 # Figure out destination file name, if it wasn't already specified.
1993 if test -n "$destname"; then
1994 destfile="$destdir/$destname"
1996 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1997 destfile="$destdir/$destfile"
2000 # Deduce the name of the destination old-style object file.
2003 staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/.o/'`
2006 staticdest="$destfile"
2010 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
2016 # Install the libtool object if requested.
2017 if test -n "$destfile"; then
2018 $show "$install_prog $file $destfile"
2019 $run eval "$install_prog $file $destfile" || exit $?
2022 # Install the old object if enabled.
2023 if test "$build_old_libs" = yes; then
2024 # Deduce the name of the old-style object file.
2025 staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/.o/'`
2027 $show "$install_prog $staticobj $staticdest"
2028 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
2034 # Figure out destination file name, if it wasn't already specified.
2035 if test -n "$destname"; then
2036 destfile="$destdir/$destname"
2038 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2039 destfile="$destdir/$destfile"
2042 # Do a test to see if this is really a libtool program.
2043 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2044 link_against_libtool_libs=
2047 # If there is no directory component, then add one.
2049 */* | *\\*) . $file ;;
2053 # Check the variables that should have been set.
2054 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
2055 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
2060 for lib in $link_against_libtool_libs; do
2061 # Check to see that each library is installed.
2063 if test -f "$lib"; then
2064 # If there is no directory component, then add one.
2066 */* | *\\*) . $lib ;;
2070 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
2071 if test -n "$libdir" && test ! -f "$libfile"; then
2072 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
2077 if test "$hardcode_action" = relink; then
2078 if test "$finalize" = yes; then
2079 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
2080 $show "$finalize_command"
2081 if $run eval "$finalize_command"; then :
2083 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
2086 file="$objdir/$file"T
2088 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
2091 # Install the binary that we compiled earlier.
2092 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2096 $show "$install_prog$stripme $file $destfile"
2097 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
2102 for file in $staticlibs; do
2103 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2105 # Set up the ranlib parameters.
2106 oldlib="$destdir/$name"
2108 $show "$install_prog $file $oldlib"
2109 $run eval "$install_prog \$file \$oldlib" || exit $?
2111 # Do each command in the postinstall commands.
2112 eval cmds=\"$old_postinstall_cmds\"
2113 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2114 for cmd in $cmds; do
2117 $run eval "$cmd" || exit $?
2122 if test -n "$future_libdirs"; then
2123 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
2126 if test -n "$current_libdirs"; then
2127 # Maybe just do a dry run.
2128 test -n "$run" && current_libdirs=" -n$current_libdirs"
2129 exec $SHELL $0 --finish$current_libdirs
2136 # libtool finish mode
2138 modename="$modename: finish"
2142 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2145 libdirs="$libdirs $dir"
2148 for libdir in $libdirs; do
2149 if test -n "$finish_cmds"; then
2150 # Do each command in the finish commands.
2151 eval cmds=\"$finish_cmds\"
2152 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2153 for cmd in $cmds; do
2156 $run eval "$cmd" || admincmds="$admincmds
2161 if test -n "$finish_eval"; then
2162 # Do the single finish_eval.
2163 eval cmds=\"$finish_eval\"
2164 $run eval "$cmds" || admincmds="$admincmds
2170 echo "----------------------------------------------------------------------"
2171 echo "Libraries have been installed in:"
2172 for libdir in $libdirs; do
2176 echo "To link against installed libraries in a given directory, LIBDIR,"
2177 echo "you must use the \`-LLIBDIR' flag during linking."
2179 echo " You will also need to do at least one of the following:"
2180 if test -n "$shlibpath_var"; then
2181 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2182 echo " during execution"
2184 if test -n "$runpath_var"; then
2185 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2186 echo " during linking"
2188 if test -n "$hardcode_libdir_flag_spec"; then
2190 eval flag=\"$hardcode_libdir_flag_spec\"
2192 echo " - use the \`$flag' linker flag"
2194 if test -n "$admincmds"; then
2195 echo " - have your system administrator run these commands:$admincmds"
2197 if test -f /etc/ld.so.conf; then
2198 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2201 echo "See any operating system documentation about shared libraries for"
2202 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2203 echo "----------------------------------------------------------------------"
2207 # libtool execute mode
2209 modename="$modename: execute"
2211 # The first argument is the command name.
2213 if test -z "$cmd"; then
2214 $echo "$modename: you must specify a COMMAND" 1>&2
2219 # Handle -dlopen flags immediately.
2220 for file in $execute_dlfiles; do
2221 if test ! -f "$file"; then
2222 $echo "$modename: \`$file' is not a file" 1>&2
2230 # Check to see that this really is a libtool archive.
2231 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2233 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2238 # Read the libtool library.
2242 # If there is no directory component, then add one.
2244 */* | *\\*) . $file ;;
2248 # Skip this library if it cannot be dlopened.
2249 if test -z "$dlname"; then
2250 # Warn if it was a shared library.
2251 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2255 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2256 test "X$dir" = "X$file" && dir=.
2258 if test -f "$dir/$objdir/$dlname"; then
2261 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2267 # Just add the directory containing the .lo file.
2268 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2269 test "X$dir" = "X$file" && dir=.
2273 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2278 # Get the absolute pathname.
2279 absdir=`cd "$dir" && pwd`
2280 test -n "$absdir" && dir="$absdir"
2282 # Now add the directory to shlibpath_var.
2283 if eval "test -z \"\$$shlibpath_var\""; then
2284 eval "$shlibpath_var=\"\$dir\""
2286 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2290 # This variable tells wrapper scripts just to set shlibpath_var
2291 # rather than running their programs.
2292 libtool_execute_magic="$magic"
2294 # Check if any of the arguments is a wrapper script.
2301 # Do a test to see if this is really a libtool program.
2302 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2303 # If there is no directory component, then add one.
2305 */* | *\\*) . $file ;;
2309 # Transform arg to wrapped name.
2310 file="$progdir/$program"
2314 # Quote arguments (to preserve shell metacharacters).
2315 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
2316 args="$args \"$file\""
2319 if test -z "$run"; then
2320 # Export the shlibpath_var.
2321 eval "export $shlibpath_var"
2323 # Restore saved enviroment variables
2324 if test "${save_LC_ALL+set}" = set; then
2325 LC_ALL="$save_LC_ALL"; export LC_ALL
2327 if test "${save_LANG+set}" = set; then
2328 LANG="$save_LANG"; export LANG
2331 # Now actually exec the command.
2332 eval "exec \$cmd$args"
2334 $echo "$modename: cannot exec \$cmd$args"
2337 # Display what would be done.
2338 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2339 $echo "export $shlibpath_var"
2345 # libtool uninstall mode
2347 modename="$modename: uninstall"
2354 -*) rm="$rm $arg" ;;
2355 *) files="$files $arg" ;;
2359 if test -z "$rm"; then
2360 $echo "$modename: you must specify an RM program" 1>&2
2365 for file in $files; do
2366 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2367 test "X$dir" = "X$file" && dir=.
2368 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2374 # Possibly a libtool archive, so verify it.
2375 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2378 # Delete the libtool libraries and symlinks.
2379 for n in $library_names; do
2380 rmfiles="$rmfiles $dir/$n"
2381 test "X$n" = "X$dlname" && dlname=
2383 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2384 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2386 $show "$rm $rmfiles"
2389 if test -n "$library_names"; then
2390 # Do each command in the postuninstall commands.
2391 eval cmds=\"$postuninstall_cmds\"
2392 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2393 for cmd in $cmds; do
2401 if test -n "$old_library"; then
2402 # Do each command in the old_postuninstall commands.
2403 eval cmds=\"$old_postuninstall_cmds\"
2404 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2405 for cmd in $cmds; do
2413 # FIXME: should reinstall the best remaining shared library.
2418 if test "$build_old_libs" = yes; then
2419 oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/.o/'`
2420 rmfiles="$rmfiles $dir/$oldobj"
2422 $show "$rm $rmfiles"
2427 $show "$rm $rmfiles"
2436 $echo "$modename: you must specify a MODE" 1>&2
2437 $echo "$generic_help" 1>&2
2442 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2443 $echo "$generic_help" 1>&2
2445 fi # test -z "$show_help"
2447 # We need to display help for each of the modes.
2450 "Usage: $modename [OPTION]... [MODE-ARG]...
2452 Provide generalized library-building support services.
2454 --config show all configuration variables
2455 --debug enable verbose shell tracing
2456 -n, --dry-run display commands without modifying any files
2457 --features display basic configuration information and exit
2458 --finish same as \`--mode=finish'
2459 --help display this help message and exit
2460 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
2461 --quiet same as \`--silent'
2462 --silent don't print informational messages
2463 --version print version information
2465 MODE must be one of the following:
2467 compile compile a source file into a libtool object
2468 execute automatically set library path, then run a program
2469 finish complete the installation of libtool libraries
2470 install install libraries or executables
2471 link create a library or an executable
2472 uninstall remove libraries from an installed directory
2474 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
2475 a more detailed description of MODE."
2481 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2483 Compile a source file into a libtool library object.
2485 This mode accepts the following additional options:
2487 -static always build a \`.o' file suitable for static linking
2489 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2490 from the given SOURCEFILE.
2492 The output file name is determined by removing the directory component from
2493 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2494 library object suffix, \`.lo'."
2499 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2501 Automatically set library path, then run a program.
2503 This mode accepts the following additional options:
2505 -dlopen FILE add the directory containing FILE to the library path
2507 This mode sets the library path environment variable according to \`-dlopen'
2510 If any of the ARGS are libtool executable wrappers, then they are translated
2511 into their corresponding uninstalled binary, and any of their required library
2512 directories are added to the library path.
2514 Then, COMMAND is executed, with ARGS as arguments."
2519 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2521 Complete the installation of libtool libraries.
2523 Each LIBDIR is a directory that contains libtool libraries.
2525 The commands that this mode executes may require superuser privileges. Use
2526 the \`--dry-run' option if you just want to see what would be executed."
2531 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2533 Install executables or libraries.
2535 INSTALL-COMMAND is the installation command. The first component should be
2536 either the \`install' or \`cp' program.
2538 The rest of the components are interpreted as arguments to that command (only
2539 BSD-compatible install options are recognized)."
2544 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
2546 Link object files or libraries together to form another library, or to
2547 create an executable program.
2549 LINK-COMMAND is a command using the C compiler that you would use to create
2550 a program from several object files.
2552 The following components of LINK-COMMAND are treated specially:
2554 -all-static do not do any dynamic linking at all
2555 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2556 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
2557 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2558 -LLIBDIR search LIBDIR for required installed libraries
2559 -lNAME OUTPUT-FILE requires the installed library libNAME
2560 -no-undefined declare that a library does not refer to external symbols
2561 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2562 -release RELEASE specify package release information
2563 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2564 -static do not do any dynamic linking of libtool libraries
2565 -version-info CURRENT[:REVISION[:AGE]]
2566 specify library version info [each variable defaults to 0]
2568 All other options (arguments beginning with \`-') are ignored.
2570 Every other argument is treated as a filename. Files ending in \`.la' are
2571 treated as uninstalled libtool libraries, other files are standard or library
2574 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2575 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2577 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
2580 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
2581 created, otherwise an executable program is created."
2586 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2588 Remove libraries from an installation directory.
2590 RM is the name of the program to use to delete files associated with each FILE
2591 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2594 If FILE is a libtool library, all the files associated with it are deleted.
2595 Otherwise, only FILE itself is deleted using RM."
2599 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2606 $echo "Try \`$modename --help' for more information about other modes."