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 # The name of this program.
27 progname=`$echo "$0" | sed 's%^.*/%%'`
36 help="Try \`$progname --help' for more information."
37 magic="%%%MAGIC variable%%%"
42 # Sed substitution that helps us do robust quoting. It backslashifies
43 # metacharacters that are still active within double-quoted strings.
45 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
48 # Only set LANG and LC_ALL to C if already set.
49 # These must not be set unconditionally because not all systems understand
50 # e.g. LANG=C (notably SCO).
51 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
52 if test "${LANG+set}" = set; then LANG=C; export LANG; fi
54 if test "$LTCONFIG_VERSION" != "$VERSION"; then
55 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
56 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
60 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
61 echo "$modename: not configured to build any kind of library" 1>&2
62 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
76 # Parse our command line options once, thoroughly.
83 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
87 # If the previous option needs an argument, assign it.
88 if test -n "$prev"; then
91 eval "$prev=\"\$$prev \$arg\""
103 # Have we seen a non-optional argument yet?
110 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
120 if test "$build_libtool_libs" = yes; then
121 echo "enable shared libraries"
123 echo "disable shared libraries"
125 if test "$build_old_libs" = yes; then
126 echo "enable static libraries"
128 echo "disable static libraries"
133 --finish) mode="finish" ;;
135 --mode) prevopt="--mode" prev=mode ;;
136 --mode=*) mode="$optarg" ;;
148 $echo "$modename: unrecognized option \`$arg'" 1>&2
160 if test -n "$prevopt"; then
161 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
166 if test -z "$show_help"; then
168 # Infer the operation mode.
169 if test -z "$mode"; then
171 *cc | *++ | gcc* | *-gcc*)
193 # If we have no mode, but dlfiles were specified, then do execute mode.
194 test -n "$execute_dlfiles" && mode=execute
196 # Just use the default operation mode.
197 if test -z "$mode"; then
198 if test -n "$nonopt"; then
199 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
201 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
208 # Only execute mode is allowed to have -dlopen flags.
209 if test -n "$execute_dlfiles" && test "$mode" != execute; then
210 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
215 # Change the help message to a mode-specific one.
217 help="Try \`$modename --help --mode=$mode' for more information."
219 # These modes are in order of execution frequency so that they run quickly.
221 # libtool compile mode
223 modename="$modename: compile"
224 # Get the compilation command and the source file.
232 # Accept any command-line options.
235 $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
241 build_libtool_libs=no
247 # Accept the current argument as the source file.
251 # Aesthetically quote the previous argument.
253 # Backslashify any backslashes, double quotes, and dollar signs.
254 # These are the only characters that are still specially
255 # interpreted inside of double-quoted scrings.
256 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
258 # Double-quote args containing other shell metacharacters.
259 # Many Bourne shells cannot handle close brackets correctly in scan
260 # sets, so we specify it separately.
262 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
263 lastarg="\"$lastarg\""
267 # Add the previous argument to base_compile.
268 if test -z "$base_compile"; then
269 base_compile="$lastarg"
271 base_compile="$base_compile $lastarg"
275 # Get the name of the library object.
276 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
278 # Recognize several different file suffixes.
293 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
296 *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
298 $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
303 if test -z "$base_compile"; then
304 $echo "$modename: you must specify a compilation command" 1>&2
309 # Delete any leftover library objects.
310 if test "$build_old_libs" = yes; then
311 $run $rm $obj $libobj
312 trap "$run $rm $obj $libobj; exit 1" 1 2 15
315 trap "$run $rm $libobj; exit 1" 1 2 15
318 # Only build a PIC object if we are building libtool libraries.
319 if test "$build_libtool_libs" = yes; then
320 # Without this assignment, base_compile gets emptied.
321 fbsd_hideous_sh_bug=$base_compile
323 # All platforms use -DPIC, to notify preprocessed assembler code.
324 $show "$base_compile$pic_flag -DPIC $srcfile"
325 if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
327 test -n "$obj" && $run $rm $obj
331 # If we have no pic_flag, then copy the object into place and finish.
332 if test -z "$pic_flag"; then
333 $show "$LN_S $obj $libobj"
334 $run $LN_S $obj $libobj
338 # Just move the object, then go on to compile the next one
339 $show "$mv $obj $libobj"
340 $run $mv $obj $libobj || exit 1
342 # Allow error messages only from the first compilation.
343 suppress_output=' >/dev/null 2>&1'
346 # Only build a position-dependent object if we build old libraries.
347 if test "$build_old_libs" = yes; then
348 # Suppress compiler output if we already did a PIC compilation.
349 $show "$base_compile $srcfile$suppress_output"
350 if $run eval "$base_compile \$srcfile$suppress_output"; then :
352 $run $rm $obj $libobj
357 # Create an invalid libtool object if no PIC, so that we do not
358 # accidentally link it into a program.
359 if test "$build_libtool_libs" != yes; then
360 $show "echo timestamp > $libobj"
361 $run eval "echo timestamp > \$libobj" || exit $?
369 modename="$modename: link"
372 compile_command="$CC"
373 finalize_command="$CC"
383 link_against_libtool_libs=
394 # We need to know -static, to get the right output filenames.
398 -all-static | -static)
399 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
400 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
402 build_libtool_libs=no
409 # See if our shared archives depend on static archives.
410 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
412 # Go through the arguments, transforming them on the way.
415 # If the previous option needs an argument, assign it.
416 if test -n "$prev"; then
419 compile_command="$compile_command @OUTPUT@"
420 finalize_command="$finalize_command @OUTPUT@"
427 *.la | *.lo) ;; # We handle these cases below.
429 dlprefiles="$dlprefiles $arg"
430 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
446 eval "$prev=\"\$arg\""
457 if test -n "$link_static_flag"; then
458 compile_command="$compile_command $link_static_flag"
459 finalize_command="$finalize_command $link_static_flag"
465 # FIXME: remove this flag sometime in the future.
466 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
481 if test "$export_dynamic" != yes; then
483 if test -n "$export_dynamic_flag_spec"; then
484 eval arg=\"$export_dynamic_flag_spec\"
489 # Add the symbol object into the linking commands.
490 compile_command="$compile_command @SYMFILE@"
491 finalize_command="$finalize_command @SYMFILE@"
496 dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
499 # Add the corresponding hardcode_libdir_flag, if it is not identical.
502 $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
506 deplibs="$deplibs $arg"
509 -l*) deplibs="$deplibs $arg" ;;
529 # If we have no pic_flag, then this is the same as -all-static.
530 if test -z "$pic_flag" && test -n "$link_static_flag"; then
531 compile_command="$compile_command $link_static_flag"
532 finalize_command="$finalize_command $link_static_flag"
542 # Some other compiler flag.
544 # Unknown arguments in both finalize_command and compile_command need
545 # to be aesthetically quoted because they are evaled later.
546 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
548 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
561 if test "$prev" = dlfiles; then
562 dlfiles="$dlfiles $arg"
563 if test "$build_libtool_libs" = yes; then
567 # If libtool objects are unsupported, then we need to preload.
572 if test "$prev" = dlprefiles; then
573 # Preload the old-style object.
574 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
577 libobjs="$libobjs $arg"
581 # A libtool-controlled library.
588 # Check to see that this really is a libtool archive.
589 if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
591 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
595 # If there is no directory component, then add one.
597 */* | *\\*) . $arg ;;
601 if test -z "$libdir"; then
602 $echo "$modename: \`$arg' contains no -rpath information" 1>&2
606 # Get the name of the library we link against.
608 for l in $old_library $library_names; do
612 if test -z "$linklib"; then
613 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
617 # Find the relevant object directory and library name.
618 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
619 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
620 if test "X$dir" = "X$arg"; then
626 # This library was specified with -dlopen.
627 if test "$prev" = dlfiles; then
628 dlfiles="$dlfiles $arg"
629 if test -z "$dlname"; then
630 # If there is no dlname, we need to preload.
633 # We should not create a dependency on this library, but we
634 # may need any libraries it requires.
635 compile_command="$compile_command$dependency_libs"
636 finalize_command="$finalize_command$dependency_libs"
642 # The library was specified with -dlpreopen.
643 if test "$prev" = dlprefiles; then
644 # Prefer using a static library (so that no silly _DYNAMIC symbols
645 # are required to link).
646 if test -n "$old_library"; then
647 dlprefiles="$dlprefiles $dir/$old_library"
649 dlprefiles="$dlprefiles $dir/$linklib"
654 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
655 link_against_libtool_libs="$link_against_libtool_libs $arg"
656 if test -n "$shlibpath_var"; then
657 # Make sure the rpath contains only unique directories.
658 case "$temp_rpath " in
660 *) temp_rpath="$temp_rpath $dir" ;;
664 # This is the magic to use -rpath.
665 if test -n "$hardcode_libdir_flag_spec"; then
666 if test -n "$hardcode_libdir_separator"; then
667 if test -z "$hardcode_libdirs"; then
668 # Put the magic libdir with the hardcode flag.
669 hardcode_libdirs="$libdir"
670 libdir="@HARDCODE_LIBDIRS@"
672 # Just accumulate the unique libdirs.
673 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
674 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
677 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
684 if test -n "$libdir"; then
685 eval flag=\"$hardcode_libdir_flag_spec\"
687 compile_command="$compile_command $flag"
688 finalize_command="$finalize_command $flag"
690 elif test -n "$runpath_var"; then
691 # Do the same for the permanent run path.
692 case "$perm_rpath " in
694 *) perm_rpath="$perm_rpath $libdir" ;;
699 case "$hardcode_action" in
701 if test "$hardcode_direct" = no; then
702 compile_command="$compile_command $dir/$linklib"
703 elif test "$hardcode_minus_L" = no; then
704 compile_command="$compile_command -L$dir -l$name"
705 elif test "$hardcode_shlibpath_var" = no; then
706 compile_shlibpath="$compile_shlibpath$dir:"
707 compile_command="$compile_command -l$name"
712 # We need an absolute path.
714 /* | [A-Za-z]:\\*) ;;
716 absdir=`cd "$dir" && pwd`
717 if test -z "$absdir"; then
718 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
725 if test "$hardcode_direct" = yes; then
726 compile_command="$compile_command $dir/$linklib"
727 elif test "$hardcode_minus_L" = yes; then
728 compile_command="$compile_command -L$dir -l$name"
729 elif test "$hardcode_shlibpath_var" = yes; then
730 compile_shlibpath="$compile_shlibpath$dir:"
731 compile_command="$compile_command -l$name"
736 $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2
741 # Finalize command for both is simple: just hardcode it.
742 if test "$hardcode_direct" = yes; then
743 finalize_command="$finalize_command $libdir/$linklib"
744 elif test "$hardcode_minus_L" = yes; then
745 finalize_command="$finalize_command -L$libdir -l$name"
746 elif test "$hardcode_shlibpath_var" = yes; then
747 finalize_shlibpath="$finalize_shlibpath$libdir:"
748 finalize_command="$finalize_command -l$name"
750 # We cannot seem to hardcode it, guess we'll fake it.
751 finalize_command="$finalize_command -L$libdir -l$name"
754 # Transform directly to old archives if we don't build new libraries.
755 if test -n "$pic_flag" && test -z "$old_library"; then
756 $echo "$modename: cannot find static library for \`$arg'" 1>&2
760 # Here we assume that one of hardcode_direct or hardcode_minus_L
761 # is not unsupported. This is valid on all known static and
763 if test "$hardcode_direct" != unsupported; then
764 test -n "$old_library" && linklib="$old_library"
765 compile_command="$compile_command $dir/$linklib"
766 finalize_command="$finalize_command $dir/$linklib"
768 compile_command="$compile_command -L$dir -l$name"
769 finalize_command="$finalize_command -L$dir -l$name"
773 # Add in any libraries that this one depends upon.
774 compile_command="$compile_command$dependency_libs"
775 finalize_command="$finalize_command$dependency_libs"
779 # Some other compiler argument.
781 # Unknown arguments in both finalize_command and compile_command need
782 # to be aesthetically quoted because they are evaled later.
783 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
785 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
792 # Now actually substitute the argument into the commands.
793 if test -n "$arg"; then
794 compile_command="$compile_command $arg"
795 finalize_command="$finalize_command $arg"
799 if test -n "$prev"; then
800 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
805 if test -n "$vinfo" && test -n "$release"; then
806 $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2
815 $echo "$modename: you must specify an output file" 1>&2
821 $echo "$modename: output file \`$output' must have no directory components" 1>&2
826 # Now set the variables for building old libraries.
827 build_libtool_libs=no
835 # Make sure we only generate libraries of the form `libNAME.la'.
839 $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
845 name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
846 eval libname=\"$libname_spec\"
848 # All the library-specific variables (install_libdir is set above).
856 if test -n "$objs"; then
857 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
861 # How the heck are we supposed to write a wrapper for a shared library?
862 if test -n "$link_against_libtool_libs"; then
863 $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
867 if test -n "$dlfiles$dlprefiles"; then
868 $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
869 # Nullify the symbol file.
870 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
871 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
874 if test -z "$rpath"; then
875 $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
881 if test $# -gt 2; then
882 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
886 # Parse the version information argument.
887 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
891 if test -n "$5"; then
892 $echo "$modename: too many parameters to \`-version-info'" 1>&2
897 test -n "$2" && current="$2"
898 test -n "$3" && revision="$3"
899 test -n "$4" && age="$4"
901 # Check that each of the things are valid numbers.
903 0 | [1-9] | [1-9][0-9]*) ;;
905 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
906 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
912 0 | [1-9] | [1-9][0-9]*) ;;
914 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
915 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
921 0 | [1-9] | [1-9][0-9]*) ;;
923 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
924 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
929 if test $age -gt $current; then
930 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
931 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
935 # Calculate the version variables.
936 version_vars="version_type current age revision"
937 case "$version_type" in
941 version_vars="$version_vars major versuffix"
942 major=`expr $current - $age`
943 versuffix="$major.$age.$revision"
947 version_vars="$version_vars versuffix verstring"
948 major=`expr $current - $age`
949 versuffix="$current.$age.$revision"
950 verstring="$versuffix"
952 # Add in all the interfaces that we are compatible with.
954 while test $loop != 0; do
955 iface=`expr $current - $loop`
956 loop=`expr $loop - 1`
957 verstring="$verstring:${iface}.0"
960 # Make executables depend on our current version.
961 verstring="$verstring:${current}.0"
965 version_vars="$version_vars major versuffix"
967 versuffix="$current.$revision"
971 version_vars="$version_vars major versuffix"
973 if [ $PORTOBJFORMAT = elf ]; then
974 versuffix="$current";
976 versuffix="$current.$revision";
981 $echo "$modename: unknown library version type \`$version_type'" 1>&2
982 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
987 # Create the output directory, or remove our outputs if we need to.
988 if test -d $objdir; then
989 $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
990 $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
992 $show "$mkdir $objdir"
995 if test $status -eq 0 || test -d $objdir; then :
1001 # Check to see if the archive will have undefined symbols.
1002 if test "$allow_undefined" = yes; then
1003 if test "$allow_undefined_flag" = unsupported; then
1004 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1005 build_libtool_libs=no
1009 # Don't allow undefined symbols.
1010 allow_undefined_flag="$no_undefined_flag"
1013 # Add libc to deplibs on all systems.
1014 dependency_libs="$deplibs"
1015 deplibs="$deplibs -lc"
1017 if test "$build_libtool_libs" = yes; then
1018 # Get the real and link names of the library.
1019 eval library_names=\"$library_names_spec\"
1020 set dummy $library_names
1024 if test -n "$soname_spec"; then
1025 eval soname=\"$soname_spec\"
1030 lib="$objdir/$realname"
1033 linknames="$linknames $link"
1036 # Use standard objects if they are PIC.
1037 test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
1039 # Do each of the archive commands.
1040 eval cmds=\"$archive_cmds\"
1041 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1042 for cmd in $cmds; do
1045 $run eval "$cmd" || exit $?
1049 # Create links to the real library.
1050 for linkname in $linknames; do
1051 $show "(cd $objdir && $LN_S $realname $linkname)"
1052 $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
1055 # If -export-dynamic was specified, set the dlname.
1056 if test "$export_dynamic" = yes; then
1057 # On all known operating systems, these are identical.
1062 # Now set the variables for building old libraries.
1063 oldlib="$objdir/$libname.a"
1067 if test -n "$link_against_libtool_libs"; then
1068 $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
1072 if test -n "$deplibs"; then
1073 $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
1076 if test -n "$dlfiles$dlprefiles"; then
1077 $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
1078 # Nullify the symbol file.
1079 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1080 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1083 if test -n "$rpath"; then
1084 $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
1087 if test -n "$vinfo"; then
1088 $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
1091 if test -n "$release"; then
1092 $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
1097 if test -n "$objs"; then
1098 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1102 obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
1110 # Delete the old objects.
1111 $run $rm $obj $libobj
1113 # Create the old-style object.
1114 reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1117 eval cmds=\"$reload_cmds\"
1118 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1119 for cmd in $cmds; do
1122 $run eval "$cmd" || exit $?
1126 # Exit if we aren't doing a library object file.
1127 test -z "$libobj" && exit 0
1129 if test "$build_libtool_libs" != yes; then
1130 # Create an invalid libtool object if no PIC, so that we don't
1131 # accidentally link it into a program.
1132 $show "echo timestamp > $libobj"
1133 $run eval "echo timestamp > $libobj" || exit $?
1137 if test -n "$pic_flag"; then
1138 # Only do commands if we really have different PIC objects.
1139 reload_objs="$libobjs"
1141 eval cmds=\"$reload_cmds\"
1142 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1143 for cmd in $cmds; do
1146 $run eval "$cmd" || exit $?
1150 # Just create a symlink.
1151 $show "$LN_S $obj $libobj"
1152 $run $LN_S $obj $libobj || exit 1
1159 if test -n "$vinfo"; then
1160 $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
1163 if test -n "$release"; then
1164 $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
1167 if test -n "$rpath"; then
1168 # If the user specified any rpath flags, then add them.
1169 for libdir in $rpath; do
1170 if test -n "$hardcode_libdir_flag_spec"; then
1171 if test -n "$hardcode_libdir_separator"; then
1172 if test -z "$hardcode_libdirs"; then
1173 # Put the magic libdir with the hardcode flag.
1174 hardcode_libdirs="$libdir"
1175 libdir="@HARDCODE_LIBDIRS@"
1177 # Just accumulate the unique libdirs.
1178 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1179 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1182 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1189 if test -n "$libdir"; then
1190 eval flag=\"$hardcode_libdir_flag_spec\"
1192 compile_command="$compile_command $flag"
1193 finalize_command="$finalize_command $flag"
1195 elif test -n "$runpath_var"; then
1196 case "$perm_rpath " in
1198 *) perm_rpath="$perm_rpath $libdir" ;;
1204 # Substitute the hardcoded libdirs into the compile commands.
1205 if test -n "$hardcode_libdir_separator"; then
1206 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1207 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1210 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1211 # Transform all the library objects into standard objects.
1212 compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1213 finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1216 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1217 dlsyms="${output}S.c"
1222 if test -n "$dlsyms"; then
1223 # Add our own program objects to the preloaded list.
1224 dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1226 # Discover the nlist of each of the dlfiles.
1227 nlist="$objdir/${output}.nm"
1229 if test -d $objdir; then
1230 $show "$rm $nlist ${nlist}T"
1231 $run $rm "$nlist" "${nlist}T"
1233 $show "$mkdir $objdir"
1236 if test $status -eq 0 || test -d $objdir; then :
1242 for arg in $dlprefiles; do
1243 $show "extracting global C symbols from \`$arg'"
1244 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1247 # Parse the name list into a source file.
1248 $show "creating $objdir/$dlsyms"
1249 if test -z "$run"; then
1250 # Make sure we at least have an empty file.
1251 test -f "$nlist" || : > "$nlist"
1253 # Try sorting and uniquifying the output.
1254 if sort "$nlist" | uniq > "$nlist"T; then
1255 mv -f "$nlist"T "$nlist"
1256 wcout=`wc "$nlist" 2>/dev/null`
1257 count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
1258 (test "$count" -ge 0) 2>/dev/null || count=-1
1267 $echo > "$objdir/$dlsyms" "\
1268 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1269 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1275 /* Prevent the only kind of declaration conflicts we can make. */
1276 #define dld_preloaded_symbol_count some_other_symbol
1277 #define dld_preloaded_symbols some_other_symbol
1279 /* External symbol declarations for the compiler. */\
1282 if test -f "$nlist"; then
1283 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1285 echo '/* NONE */' >> "$objdir/$dlsyms"
1288 $echo >> "$objdir/$dlsyms" "\
1290 #undef dld_preloaded_symbol_count
1291 #undef dld_preloaded_symbols
1293 #if defined (__STDC__) && __STDC__
1294 # define __ptr_t void *
1296 # define __ptr_t char *
1299 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1300 int dld_preloaded_symbol_count = $count;
1302 /* The mapping between symbol names and symbols. */
1307 dld_preloaded_symbols[] =
1311 if test -f "$nlist"; then
1312 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1315 $echo >> "$objdir/$dlsyms" "\
1326 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1332 # Now compile the dynamic symbol file.
1333 $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1334 $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1336 # Transform the symbol file into the correct name.
1337 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1338 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1339 elif test "$export_dynamic" != yes; then
1340 test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1342 # We keep going just in case the user didn't refer to
1343 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1344 # really was required.
1345 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1347 # Nullify the symbol file.
1348 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1349 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1352 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1353 # Replace the output file specification.
1354 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1355 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1357 # We have no uninstalled library dependencies, so finalize right now.
1358 $show "$compile_command"
1359 $run eval "$compile_command"
1363 # Replace the output file specification.
1364 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
1365 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1367 # Create the binary in the object directory, then wrap it.
1368 if test -d $objdir; then :
1370 $show "$mkdir $objdir"
1373 if test $status -eq 0 || test -d $objdir; then :
1379 if test -n "$shlibpath_var"; then
1380 # We should set the shlibpath_var
1382 for dir in $temp_rpath; do
1389 # Relative path: add a thisdir entry.
1390 rpath="$rpath\$thisdir/$dir:"
1397 # Delete the old output file.
1400 if test -n "$compile_shlibpath"; then
1401 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1403 if test -n "$finalize_shlibpath"; then
1404 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1407 if test -n "$runpath_var" && test -n "$perm_rpath"; then
1408 # We should set the runpath_var.
1410 for dir in $perm_rpath; do
1413 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1414 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1417 case "$hardcode_action" in
1419 # AGH! Flame the AIX and HP-UX people for me, will ya?
1420 $echo "$modename: warning: using a buggy system linker" 1>&2
1421 $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
1425 $show "$compile_command"
1426 $run eval "$compile_command" || exit $?
1428 # Now create the wrapper script.
1429 $show "creating $output"
1431 # Quote the finalize command for shipping.
1432 finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1434 # Quote $echo for shipping.
1435 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
1437 # Only actually do things if our run command is non-null.
1438 if test -z "$run"; then
1440 trap "$rm $output; exit 1" 1 2 15
1445 # $output - temporary wrapper script for $objdir/$output
1446 # Generated by ltmain.sh - GNU $PACKAGE $VERSION
1448 # The $output program cannot be directly executed until all the libtool
1449 # libraries that it depends on are installed.
1451 # This wrapper script should never be moved out of \``pwd`'.
1452 # If it is, it will not operate correctly.
1454 # Sed substitution that helps us do robust quoting. It backslashifies
1455 # metacharacters that are still active within double-quoted strings.
1456 Xsed='sed -e s/^X//'
1457 sed_quote_subst='$sed_quote_subst'
1459 # The HP-UX ksh and POSIX shell print the target directory to stdout
1461 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
1463 # This environment variable determines our operation mode.
1464 if test \"\$libtool_install_magic\" = \"$magic\"; then
1465 # install mode needs the following variables:
1466 link_against_libtool_libs='$link_against_libtool_libs'
1467 finalize_command=\"$finalize_command\"
1469 # When we are sourced in execute mode, \$file and \$echo are already set.
1470 if test \"\$libtool_execute_magic\" = \"$magic\"; then :
1478 # Find the directory that this script lives in.
1479 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1480 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1482 # Follow symbolic links until we get to the real thisdir.
1483 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
1484 while test -n \"\$file\"; do
1485 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
1487 # If there was a directory component, then change thisdir.
1488 if test \"x\$destdir\" != \"x\$file\"; then
1489 case \"\$destdir\" in
1490 /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;;
1491 *) thisdir=\"\$thisdir/\$destdir\" ;;
1495 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1496 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
1499 # Try to get the absolute directory name.
1500 absdir=\`cd \"\$thisdir\" && pwd\`
1501 test -n \"\$absdir\" && thisdir=\"\$absdir\"
1503 progdir=\"\$thisdir/$objdir\"
1506 if test -f \"\$progdir/\$program\"; then"
1508 # Export our shlibpath_var if we have one.
1509 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1511 # Add our own library path to $shlibpath_var
1512 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1514 # Some systems cannot cope with colon-terminated $shlibpath_var
1515 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
1517 export $shlibpath_var
1522 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1523 # Run the actual program with our arguments.
1525 # Export the path to the program.
1526 PATH=\"\$progdir:\$PATH\"
1529 exec \$program \${1+\"\$@\"}
1531 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
1535 # The program doesn't exist.
1536 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
1537 \$echo \"This script is just a wrapper for \$program.\" 1>&2
1538 echo \"See the $PACKAGE documentation for more information.\" 1>&2
1549 # See if we need to build an old-fashioned archive.
1550 if test "$build_old_libs" = "yes"; then
1551 # Transform .lo files to .o files.
1552 oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1554 # Do each command in the archive commands.
1555 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1556 eval cmds=\"$old_archive_from_new_cmds\"
1558 eval cmds=\"$old_archive_cmds\"
1560 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1561 for cmd in $cmds; do
1564 $run eval "$cmd" || exit $?
1569 # Now create the libtool archive.
1573 test "$build_old_libs" = yes && old_library="$libname.a"
1575 $show "creating $output"
1577 # Only create the output if not a dry run.
1578 if test -z "$run"; then
1580 # $output - a libtool library file
1581 # Generated by ltmain.sh - GNU $PACKAGE $VERSION
1583 # The name that we can dlopen(3).
1586 # Names of this library.
1587 library_names='$library_names'
1589 # The name of the static archive.
1590 old_library='$old_library'
1592 # Libraries that this one depends upon.
1593 dependency_libs='$dependency_libs'
1595 # Version information for $libname.
1600 # Directory that this library needs to be installed in:
1601 libdir='$install_libdir'\
1605 # Do a symbolic link so that the libtool archive can be found in
1606 # LD_LIBRARY_PATH before the program is installed.
1607 $show "(cd $objdir && $LN_S ../$output $output)"
1608 $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
1614 # libtool install mode
1616 modename="$modename: install"
1618 # There may be an optional /bin/sh argument at the beginning of
1619 # install_prog (especially on Windows NT).
1620 if test "$nonopt" = "$SHELL"; then
1621 # Aesthetically quote it.
1622 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
1624 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1628 install_prog="$arg "
1636 # The real first argument should be the name of the installation program.
1637 # Aesthetically quote it.
1638 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1640 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1644 install_prog="$install_prog$arg"
1646 # We need to accept at least all the BSD install flags.
1656 if test -n "$dest"; then
1657 files="$files $dest"
1675 # If the previous option needed an argument, then skip it.
1676 if test -n "$prev"; then
1685 # Aesthetically quote the argument.
1686 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1688 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1692 install_prog="$install_prog $arg"
1695 if test -z "$install_prog"; then
1696 $echo "$modename: you must specify an install program" 1>&2
1701 if test -n "$prev"; then
1702 $echo "$modename: the \`$prev' option requires an argument" 1>&2
1707 if test -z "$files"; then
1708 if test -z "$dest"; then
1709 $echo "$modename: no file or destination specified" 1>&2
1711 $echo "$modename: you must specify a destination" 1>&2
1717 # Strip any trailing slash from the destination.
1718 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
1720 # Check to see that the destination is a directory.
1721 test -d "$dest" && isdir=yes
1722 if test -n "$isdir"; then
1726 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
1727 test "X$destdir" = "X$dest" && destdir=.
1728 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
1730 # Not a directory, so check to see that there is only one file specified.
1732 if test $# -gt 2; then
1733 $echo "$modename: \`$dest' is not a directory" 1>&2
1739 /* | [A-Za-z]:\\*) ;;
1741 for file in $files; do
1745 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
1754 # This variable tells wrapper scripts just to set variables rather
1755 # than running their programs.
1756 libtool_install_magic="$magic"
1761 for file in $files; do
1763 # Do each installation.
1766 # Do the static libraries later.
1767 staticlibs="$staticlibs $file"
1771 # Check to see that this really is a libtool archive.
1772 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
1774 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
1781 # If there is no directory component, then add one.
1783 */* | *\\*) . $file ;;
1787 # Add the libdir to current_libdirs if it is the destination.
1788 if test "X$destdir" = "X$libdir"; then
1789 case "$current_libdirs " in
1791 *) current_libdirs="$current_libdirs $libdir" ;;
1794 # Note the libdir as a future libdir.
1795 case "$future_libdirs " in
1797 *) future_libdirs="$future_libdirs $libdir" ;;
1801 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
1802 test "X$dir" = "X$file/" && dir=
1805 # See the names of the shared library.
1806 set dummy $library_names
1807 if test -n "$2"; then
1812 # Install the shared library and build the symlinks.
1813 $show "$install_prog $dir/$realname $destdir/$realname"
1814 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1815 test "X$dlname" = "X$realname" && dlname=
1817 if test $# -gt 0; then
1818 # Delete the old symlinks.
1822 rmcmd="$rmcmd $destdir/$linkname"
1827 # ... and create new ones.
1830 test "X$dlname" = "X$linkname" && dlname=
1831 $show "(cd $destdir && $LN_S $realname $linkname)"
1832 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1836 if test -n "$dlname"; then
1837 # Install the dynamically-loadable library.
1838 $show "$install_prog $dir/$dlname $destdir/$dlname"
1839 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1842 # Do each command in the postinstall commands.
1843 lib="$destdir/$realname"
1844 eval cmds=\"$postinstall_cmds\"
1845 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1846 for cmd in $cmds; do
1849 $run eval "$cmd" || exit $?
1854 # Install the pseudo-library for information purposes.
1855 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1856 $show "$install_prog $file $destdir/$name"
1857 $run eval "$install_prog $file $destdir/$name" || exit $?
1859 # Maybe install the static library, too.
1860 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1864 # Install (i.e. copy) a libtool object.
1866 # Figure out destination file name, if it wasn't already specified.
1867 if test -n "$destname"; then
1868 destfile="$destdir/$destname"
1870 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1871 destfile="$destdir/$destfile"
1874 # Deduce the name of the destination old-style object file.
1877 staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'`
1880 staticdest="$destfile"
1884 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
1890 # Install the libtool object if requested.
1891 if test -n "$destfile"; then
1892 $show "$install_prog $file $destfile"
1893 $run eval "$install_prog $file $destfile" || exit $?
1896 # Install the old object if enabled.
1897 if test "$build_old_libs" = yes; then
1898 # Deduce the name of the old-style object file.
1899 staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'`
1901 $show "$install_prog $staticobj $staticdest"
1902 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
1908 # Do a test to see if this is really a libtool program.
1909 if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
1910 link_against_libtool_libs=
1913 # If there is no directory component, then add one.
1915 */* | *\\*) . $file ;;
1919 # Check the variables that should have been set.
1920 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
1921 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
1926 for lib in $link_against_libtool_libs; do
1927 # Check to see that each library is installed.
1929 if test -f "$lib"; then
1930 # If there is no directory component, then add one.
1932 */* | *\\*) . $lib ;;
1936 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
1937 if test -z "$libdir"; then
1938 $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2
1939 elif test -f "$libfile"; then :
1941 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1946 if test "$hardcode_action" = relink; then
1947 if test "$finalize" = yes; then
1948 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1949 $show "$finalize_command"
1950 if $run eval "$finalize_command"; then :
1952 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
1955 file="$objdir/$file"T
1957 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1960 # Install the binary that we compiled earlier.
1961 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
1965 $show "$install_prog$stripme $file $dest"
1966 $run eval "$install_prog\$stripme \$file \$dest" || exit $?
1971 for file in $staticlibs; do
1972 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1974 # Set up the ranlib parameters.
1975 oldlib="$destdir/$name"
1977 $show "$install_prog $file $oldlib"
1978 $run eval "$install_prog \$file \$oldlib" || exit $?
1980 # Do each command in the postinstall commands.
1981 eval cmds=\"$old_postinstall_cmds\"
1982 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1983 for cmd in $cmds; do
1986 $run eval "$cmd" || exit $?
1991 if test -n "$future_libdirs"; then
1992 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1995 if test -n "$current_libdirs"; then
1996 # Maybe just do a dry run.
1997 test -n "$run" && current_libdirs=" -n$current_libdirs"
1998 exec $SHELL $0 --finish$current_libdirs
2005 # libtool finish mode
2007 modename="$modename: finish"
2010 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2013 libdirs="$libdirs $dir"
2016 for libdir in $libdirs; do
2017 if test -n "$finish_cmds"; then
2018 # Do each command in the finish commands.
2019 eval cmds=\"$finish_cmds\"
2020 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2021 for cmd in $cmds; do
2028 if test -n "$finish_eval"; then
2029 # Do the single finish_eval.
2030 eval cmds=\"$finish_eval\"
2036 echo "------------------------------------------------------------------------------"
2037 echo "Libraries have been installed in:"
2038 for libdir in $libdirs; do
2042 echo "To link against installed libraries in a given directory, LIBDIR,"
2043 echo "you must use the \`-LLIBDIR' flag during linking."
2045 echo " You will also need to do one of the following:"
2046 if test -n "$shlibpath_var"; then
2047 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2048 echo " during execution"
2050 if test -n "$runpath_var"; then
2051 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2052 echo " during linking"
2054 if test -n "$hardcode_libdir_flag_spec"; then
2056 eval flag=\"$hardcode_libdir_flag_spec\"
2058 echo " - use the \`$flag' linker flag"
2060 if test -f /etc/ld.so.conf; then
2061 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2064 echo "See any operating system documentation about shared libraries for"
2065 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2066 echo "------------------------------------------------------------------------------"
2070 # libtool execute mode
2072 modename="$modename: execute"
2074 # The first argument is the command name.
2076 if test -z "$cmd"; then
2077 $echo "$modename: you must specify a COMMAND" 1>&2
2082 # Handle -dlopen flags immediately.
2083 for file in $execute_dlfiles; do
2084 if test -f "$file"; then :
2086 $echo "$modename: \`$file' is not a file" 1>&2
2094 # Check to see that this really is a libtool archive.
2095 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
2097 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2102 # Read the libtool library.
2106 # If there is no directory component, then add one.
2108 */* | *\\*) . $file ;;
2112 # Skip this library if it cannot be dlopened.
2113 if test -z "$dlname"; then
2114 # Warn if it was a shared library.
2115 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2119 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2120 test "X$dir" = "X$file" && dir=.
2122 if test -f "$dir/$objdir/$dlname"; then
2125 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2131 # Just add the directory containing the .lo file.
2132 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2133 test "X$dir" = "X$file" && dir=.
2137 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2142 # Get the absolute pathname.
2143 absdir=`cd "$dir" && pwd`
2144 test -n "$absdir" && dir="$absdir"
2146 # Now add the directory to shlibpath_var.
2147 if eval "test -z \"\$$shlibpath_var\""; then
2148 eval "$shlibpath_var=\"\$dir\""
2150 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2154 # This variable tells wrapper scripts just to set shlibpath_var
2155 # rather than running their programs.
2156 libtool_execute_magic="$magic"
2158 # Check if any of the arguments is a wrapper script.
2165 # Do a test to see if this is really a libtool program.
2166 if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
2167 # If there is no directory component, then add one.
2169 */* | *\\*) . $file ;;
2173 # Transform arg to wrapped name.
2174 file="$progdir/$program"
2178 # Quote arguments (to preserve shell metacharacters).
2179 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
2180 args="$args \"$file\""
2183 if test -z "$run"; then
2184 # Export the shlibpath_var.
2185 eval "export $shlibpath_var"
2187 # Now actually exec the command.
2188 eval "exec \$cmd$args"
2190 $echo "$modename: cannot exec \$cmd$args"
2193 # Display what would be done.
2194 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2195 $echo "export $shlibpath_var"
2201 # libtool uninstall mode
2203 modename="$modename: uninstall"
2210 -*) rm="$rm $arg" ;;
2211 *) files="$files $arg" ;;
2215 if test -z "$rm"; then
2216 $echo "$modename: you must specify an RM program" 1>&2
2221 for file in $files; do
2222 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2223 test "X$dir" = "X$file" && dir=.
2224 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2230 # Possibly a libtool archive, so verify it.
2231 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
2234 # Delete the libtool libraries and symlinks.
2235 for n in $library_names; do
2236 rmfiles="$rmfiles $dir/$n"
2237 test "X$n" = "X$dlname" && dlname=
2239 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2240 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2242 $show "$rm $rmfiles"
2245 if test -n "$library_names"; then
2246 # Do each command in the postuninstall commands.
2247 eval cmds=\"$postuninstall_cmds\"
2248 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2249 for cmd in $cmds; do
2257 if test -n "$old_library"; then
2258 # Do each command in the old_postuninstall commands.
2259 eval cmds=\"$old_postuninstall_cmds\"
2260 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2261 for cmd in $cmds; do
2269 # FIXME: should reinstall the best remaining shared library.
2274 if test "$build_old_libs" = yes; then
2275 oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'`
2276 rmfiles="$rmfiles $dir/$oldobj"
2278 $show "$rm $rmfiles"
2283 $show "$rm $rmfiles"
2292 $echo "$modename: you must specify a MODE" 1>&2
2293 $echo "$generic_help" 1>&2
2298 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2299 $echo "$generic_help" 1>&2
2301 fi # test -z "$show_help"
2303 # We need to display help for each of the modes.
2306 "Usage: $modename [OPTION]... [MODE-ARG]...
2308 Provide generalized library-building support services.
2310 -n, --dry-run display commands without modifying any files
2311 --features display configuration information and exit
2312 --finish same as \`--mode=finish'
2313 --help display this help message and exit
2314 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
2315 --quiet same as \`--silent'
2316 --silent don't print informational messages
2317 --version print version information
2319 MODE must be one of the following:
2321 compile compile a source file into a libtool object
2322 execute automatically set library path, then run a program
2323 finish complete the installation of libtool libraries
2324 install install libraries or executables
2325 link create a library or an executable
2326 uninstall remove libraries from an installed directory
2328 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
2329 a more detailed description of MODE."
2335 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2337 Compile a source file into a libtool library object.
2339 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2340 from the given SOURCEFILE.
2342 The output file name is determined by removing the directory component from
2343 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2344 library object suffix, \`.lo'."
2349 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2351 Automatically set library path, then run a program.
2353 This mode accepts the following additional options:
2355 -dlopen FILE add the directory containing FILE to the library path
2357 This mode sets the library path environment variable according to \`-dlopen'
2360 If any of the ARGS are libtool executable wrappers, then they are translated
2361 into their corresponding uninstalled binary, and any of their required library
2362 directories are added to the library path.
2364 Then, COMMAND is executed, with ARGS as arguments."
2369 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2371 Complete the installation of libtool libraries.
2373 Each LIBDIR is a directory that contains libtool libraries.
2375 The commands that this mode executes may require superuser privileges. Use
2376 the \`--dry-run' option if you just want to see what would be executed."
2381 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2383 Install executables or libraries.
2385 INSTALL-COMMAND is the installation command. The first component should be
2386 either the \`install' or \`cp' program.
2388 The rest of the components are interpreted as arguments to that command (only
2389 BSD-compatible install options are recognized)."
2394 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
2396 Link object files or libraries together to form another library, or to
2397 create an executable program.
2399 LINK-COMMAND is a command using the C compiler that you would use to create
2400 a program from several object files.
2402 The following components of LINK-COMMAND are treated specially:
2404 -all-static do not do any dynamic linking at all
2405 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2406 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
2407 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2408 -LLIBDIR search LIBDIR for required installed libraries
2409 -lNAME OUTPUT-FILE requires the installed library libNAME
2410 -no-undefined declare that a library does not refer to external symbols
2411 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2412 -release RELEASE specify package release information
2413 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2414 -static do not do any dynamic linking of libtool libraries
2415 -version-info CURRENT[:REVISION[:AGE]]
2416 specify library version info [each variable defaults to 0]
2418 All other options (arguments beginning with \`-') are ignored.
2420 Every other argument is treated as a filename. Files ending in \`.la' are
2421 treated as uninstalled libtool libraries, other files are standard or library
2424 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2425 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2427 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
2430 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
2431 created, otherwise an executable program is created."
2436 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2438 Remove libraries from an installation directory.
2440 RM is the name of the program to use to delete files associated with each FILE
2441 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2444 If FILE is a libtool library, all the files associated with it are deleted.
2445 Otherwise, only FILE itself is deleted using RM."
2449 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2456 $echo "Try \`$modename --help' for more information about other modes."