1 # ltmain.sh - Provide generalized library-building support services.
2 # Generated automatically from ltmain.in by configure.
3 # Copyright (C) 1996, 1997 Free Software Foundation, Inc.
4 # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # As a special exception to the GNU General Public License, if you
21 # distribute this file as part of a program that contains a
22 # configuration script generated by Autoconf, you may include it under
23 # the same distribution terms that you use for the rest of that program.
27 if test "X`$echo '\t'`" = 'X\t'; then :
29 # The Solaris and AIX default echo program unquotes backslashes.
30 # This makes it impossible to quote backslashes using
31 # echo "$something" | sed 's/\\/\\\\/g'
32 # So, we emulate echo with printf '%s\n'
34 if test "X`$echo '\t'`" = 'X\t'; then :
36 # Oops. We have no working printf. Try to find a not-so-buggy echo.
38 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
42 if test -f $dir/echo && test "X`$dir/echo '\t'`" = 'X\t'; then
52 # The name of this program.
53 progname=`$echo "$0" | sed 's%^.*/%%'`
61 help="Try \`$progname --help' for more information."
62 magic="%%%MAGIC variable%%%"
67 # Sed substitution that helps us do robust quoting. It backslashifies
68 # metacharacters that are still active within double-quoted strings.
69 sed_quote_subst='s/\([\\"$\\\\]\)/\\\1/g'
72 # Only set LANG and LC_ALL to C if already set.
73 # These must not be set unconditionally because not all systems understand
74 # e.g. LANG=C (notably SCO).
75 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
76 if test "${LANG+set}" = set; then LANG=C; export LANG; fi
78 if test "$LTCONFIG_VERSION" != "$VERSION"; then
79 $echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
80 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
84 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
85 $echo "$progname: not configured to build any kind of library" 1>&2
86 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
100 # Parse our command line options once, thoroughly.
107 -*=*) optarg=`$echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
111 # If the previous option needs an argument, assign it.
112 if test -n "$prev"; then
115 eval "$prev=\"\$$prev \$arg\""
127 # Have we seen a non-optional argument yet?
134 $echo "$PROGRAM (GNU $PACKAGE) $VERSION"
144 if test "$build_libtool_libs" = yes; then
145 $echo "enable shared libraries"
147 $echo "disable shared libraries"
149 if test "$build_old_libs" = yes; then
150 $echo "enable static libraries"
152 $echo "disable static libraries"
157 --finish) mode="finish" ;;
159 --mode) prevopt="--mode" prev=mode ;;
160 --mode=*) mode="$optarg" ;;
172 $echo "$progname: unrecognized option \`$arg'" 1>&2
184 if test -n "$prevopt"; then
185 $echo "$progname: option \`$prevopt' requires an argument" 1>&2
190 if test -z "$show_help"; then
192 # Infer the operation mode.
193 if test -z "$mode"; then
217 # If we have no mode, but dlfiles were specified, then do execute mode.
218 test -n "$execute_dlfiles" && mode=execute
220 # Just use the default operation mode.
221 if test -z "$mode"; then
222 if test -n "$nonopt"; then
223 $echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
225 $echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
232 # Only execute mode is allowed to have -dlopen flags.
233 if test -n "$execute_dlfiles" && test "$mode" != execute; then
234 $echo "$progname: unrecognized option \`-dlopen'" 1>&2
239 # Change the help message to a mode-specific one.
241 help="Try \`$progname --help --mode=$mode' for more information."
243 # These modes are in order of execution frequency so that they run quickly.
245 # libtool compile mode
247 progname="$progname: compile"
248 # Get the compilation command and the source file.
256 # The only flag that cannot be specified is the output filename.
257 if test "X$arg" = "X-o"; then
258 $echo "$progname: you cannot specify the output filename with \`-o'" 1>&2
263 # Accept the current argument as the source file.
267 # Aesthetically quote the previous argument.
269 # Backslashify any backslashes, double quotes, and dollar signs.
270 # These are the only characters that are still specially
271 # interpreted inside of double-quoted scrings.
272 lastarg=`$echo "$lastarg" | sed "$sed_quote_subst"`
274 # Double-quote args containing other shell metacharacters.
275 # Many Bourne shells cannot handle close brackets correctly in scan
276 # sets, so we specify it separately.
278 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
279 lastarg="\"$lastarg\""
283 # Add the previous argument to base_compile.
284 if test -z "$base_compile"; then
285 base_compile="$lastarg"
287 base_compile="$base_compile $lastarg"
291 # Get the name of the library object.
292 libobj=`$echo "$srcfile" | sed -e 's%^.*/%%'`
294 # Recognize several different file suffixes.
305 libobj=`$echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
308 *.lo) obj=`$echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
310 $echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2
315 if test -z "$base_compile"; then
316 $echo "$progname: you must specify a compilation command" 1>&2
321 # Delete any leftover library objects.
322 if test "$build_old_libs" = yes; then
323 $run $rm $obj $libobj
324 trap "$run $rm $obj $libobj; exit 1" 1 2 15
327 trap "$run $rm $libobj; exit 1" 1 2 15
330 # Only build a PIC object if we are building libtool libraries.
331 if test "$build_libtool_libs" = yes; then
332 # Without this assignment, base_compile gets emptied.
333 fbsd_hideous_sh_bug=$base_compile
335 # All platforms use -DPIC, to notify preprocessed assembler code.
336 $show "$base_compile$pic_flag -DPIC $srcfile"
337 if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
339 test -n "$obj" && $run $rm $obj
343 # If we have no pic_flag, then copy the object into place and finish.
344 if test -z "$pic_flag"; then
345 $show "$LN_S $obj $libobj"
346 $run $LN_S $obj $libobj
350 # Just move the object, then go on to compile the next one
351 $show "$mv $obj $libobj"
352 $run $mv $obj $libobj || exit 1
354 # Allow error messages only from the first compilation.
355 suppress_output=' >/dev/null 2>&1'
358 # Only build a position-dependent object if we build old libraries.
359 if test "$build_old_libs" = yes; then
360 # Suppress compiler output if we already did a PIC compilation.
361 $show "$base_compile $srcfile$suppress_output"
362 if $run eval "$base_compile \$srcfile$suppress_output"; then :
364 $run $rm $obj $libobj
369 # Create an invalid libtool object if no PIC, so that we don't accidentally
370 # link it into a program.
371 if test "$build_libtool_libs" != yes; then
372 $show "$echo timestamp > $libobj"
373 $run eval "\$echo timestamp > \$libobj" || exit $?
381 progname="$progname: link"
384 compile_command="$CC"
385 finalize_command="$CC"
395 link_against_libtool_libs=
405 # We need to know -static, to get the right output filenames.
409 -all-static | -static)
410 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
411 $echo "$progname: warning: complete static linking is impossible in this configuration" 1>&2
413 build_libtool_libs=no
420 # See if our shared archives depend on static archives.
421 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
423 # Go through the arguments, transforming them on the way.
426 # If the previous option needs an argument, assign it.
427 if test -n "$prev"; then
430 compile_command="$compile_command @OUTPUT@"
431 finalize_command="$finalize_command @OUTPUT@"
438 *.la | *.lo) ;; # We handle these cases below.
440 dlprefiles="$dlprefiles $arg"
441 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
452 eval "$prev=\"\$arg\""
463 if test -n "$link_static_flag"; then
464 compile_command="$compile_command $link_static_flag"
465 finalize_command="$finalize_command $link_static_flag"
486 if test "$export_dynamic" != yes; then
488 if test -n "$export_dynamic_flag_spec"; then
489 arg=`eval \\$echo "$export_dynamic_flag_spec"`
494 # Add the symbol object into the linking commands.
495 compile_command="$compile_command @SYMFILE@"
496 finalize_command="$finalize_command @SYMFILE@"
501 dir=`$echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
504 # Add the corresponding hardcode_libdir_flag, if it is not identical.
507 $echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
511 deplibs="$deplibs $arg"
514 -l*) deplibs="$deplibs $arg" ;;
524 # If we have no pic_flag, then this is the same as -all-static.
525 if test -z "$pic_flag" && test -n "$link_static_flag"; then
526 compile_command="$compile_command $link_static_flag"
527 finalize_command="$finalize_command $link_static_flag"
537 # Some other compiler flag.
539 # Unknown arguments in both finalize_command and compile_command need
540 # to be aesthetically quoted because they are evaled later.
541 arg=`$echo "$arg" | sed "$sed_quote_subst"`
543 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
556 if test "$prev" = dlfiles; then
557 dlfiles="$dlfiles $arg"
558 if test "$build_libtool_libs" = yes; then
562 # If libtool objects are unsupported, then we need to preload.
567 if test "$prev" = dlprefiles; then
568 # Preload the old-style object.
569 dlprefiles="$dlprefiles "`$echo "$arg" | sed 's/\.lo$/\.o/'`
572 libobjs="$libobjs $arg"
576 # A libtool-controlled library.
583 # Check to see that this really is a libtool archive.
584 if egrep '^# Generated by ltmain.sh' $arg >/dev/null 2>&1; then :
586 $echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
590 # If there is no directory component, then add one.
596 if test -z "$libdir"; then
597 $echo "$progname: \`$arg' contains no -rpath information" 1>&2
601 # Get the name of the library we link against.
603 for l in $old_library $library_names; do
607 if test -z "$linklib"; then
608 $echo "$progname: cannot find name of link library for \`$arg'" 1>&2
612 # Find the relevant object directory and library name.
613 name=`$echo "$arg" | sed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
614 dir=`$echo "$arg" | sed 's%/[^/]*$%%'`
615 if test "X$dir" = "X$arg"; then
621 # This library was specified with -dlopen.
622 if test "$prev" = dlfiles; then
623 dlfiles="$dlfiles $arg"
624 if test -z "$dlname"; then
625 # If there is no dlname, we need to preload.
628 # We should not create a dependency on this library.
634 # The library was specified with -dlpreopen.
635 if test "$prev" = dlprefiles; then
636 # Prefer using a static library (so that no silly _DYNAMIC symbols
637 # are required to link).
638 if test -n "$old_library"; then
639 dlprefiles="$dlprefiles $dir/$old_library"
641 dlprefiles="$dlprefiles $dir/$linklib"
646 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
647 link_against_libtool_libs="$link_against_libtool_libs $arg"
648 if test -n "$shlibpath_var"; then
649 # Make sure the rpath contains only unique directories.
650 case "$temp_rpath " in
652 *) temp_rpath="$temp_rpath $dir" ;;
656 # This is the magic to use -rpath.
657 if test -n "$hardcode_libdir_flag_spec"; then
658 if test -n "$hardcode_libdir_separator"; then
659 if test -z "$hardcode_libdirs"; then
660 # Put the magic libdir with the hardcode flag.
661 hardcode_libdirs="$libdir"
662 libdir="@HARDCODE_LIBDIRS@"
664 # Just accumulate the unique libdirs.
665 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
666 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
669 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
676 if test -n "$libdir"; then
677 flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
679 compile_command="$compile_command $flag"
680 finalize_command="$finalize_command $flag"
682 elif test "$hardcode_runpath_var" = yes; then
683 # Do the same for the permanent run path.
684 case "$perm_rpath " in
686 *) perm_rpath="$perm_rpath $libdir" ;;
691 case "$hardcode_action" in
693 if test "$hardcode_direct" = no; then
694 compile_command="$compile_command $dir/$linklib"
695 elif test "$hardcode_minus_L" = no; then
696 compile_command="$compile_command -L$dir -l$name"
697 elif test "$hardcode_shlibpath_var" = no; then
698 compile_shlibpath="$compile_shlibpath$dir:"
699 compile_command="$compile_command -l$name"
704 # We need an absolute path.
708 absdir=`cd "$dir" && pwd`
709 if test -z "$absdir"; then
710 $echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
717 if test "$hardcode_direct" = yes; then
718 compile_command="$compile_command $dir/$linklib"
719 elif test "$hardcode_minus_L" = yes; then
720 compile_command="$compile_command -L$dir -l$name"
721 elif test "$hardcode_shlibpath_var" = yes; then
722 compile_shlibpath="$compile_shlibpath$dir:"
723 compile_command="$compile_command -l$name"
728 $echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
733 # Finalize command for both is simple: just hardcode it.
734 if test "$hardcode_direct" = yes; then
735 finalize_command="$finalize_command $libdir/$linklib"
736 elif test "$hardcode_minus_L" = yes; then
737 finalize_command="$finalize_command -L$libdir -l$name"
738 elif test "$hardcode_shlibpath_var" = yes; then
739 finalize_shlibpath="$finalize_shlibpath$libdir:"
740 finalize_command="$finalize_command -l$name"
742 # We can't seem to hardcode it, guess we'll fake it.
743 finalize_command="$finalize_command -L$libdir -l$name"
746 # Transform directly to old archives if we don't build new libraries.
747 if test -n "$pic_flag" && test -z "$old_library"; then
748 $echo "$progname: cannot find static library for \`$arg'" 1>&2
752 # Here we assume that one of hardcode_direct or hardcode_minus_L
753 # is not unsupported. This is valid on all known static and
755 if test "$hardcode_direct" != unsupported; then
756 test -n "$old_library" && linklib="$old_library"
757 compile_command="$compile_command $dir/$linklib"
758 finalize_command="$finalize_command $dir/$linklib"
760 compile_command="$compile_command -L$dir -l$name"
761 finalize_command="$finalize_command -L$dir -l$name"
767 # Some other compiler argument.
769 # Unknown arguments in both finalize_command and compile_command need
770 # to be aesthetically quoted because they are evaled later.
771 arg=`$echo "$arg" | sed "$sed_quote_subst"`
773 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
780 # Now actually substitute the argument into the commands.
781 compile_command="$compile_command $arg"
782 finalize_command="$finalize_command $arg"
785 if test -n "$prev"; then
786 $echo "$progname: the \`$prevarg' option requires an argument" 1>&2
795 $echo "$progname: you must specify an output file" 1>&2
801 $echo "$progname: output file \`$output' must have no directory components" 1>&2
806 # Make sure we only generate libraries of the form `libNAME.la'.
810 $echo "$progname: libtool library \`$arg' must begin with \`lib'" 1>&2
816 name=`$echo "$output" | sed -e 's/\.la$//' -e 's/^lib//'`
817 libname=`eval \\$echo \"$libname_spec\"`
819 # All the library-specific variables (install_libdir is set above).
827 if test -n "$objs"; then
828 $echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
832 # How the heck are we supposed to write a wrapper for a shared library?
833 if test -n "$link_against_libtool_libs"; then
834 $echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
838 # Add libc to deplibs on all systems.
839 deplibs="$deplibs -lc"
841 if test -n "$dlfiles$dlprefiles"; then
842 $echo "$progname: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
843 # Nullify the symbol file.
844 compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
845 finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
848 if test -z "$rpath"; then
849 $echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
855 if test $# -gt 2; then
856 $echo "$progname: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
860 # Parse the version information argument.
861 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
865 if test -n "$5"; then
866 $echo "$progname: too many parameters to \`-version-info'" 1>&2
871 test -n "$2" && current="$2"
872 test -n "$3" && revision="$3"
873 test -n "$4" && age="$4"
875 # Check that each of the things are valid numbers.
877 0 | [1-9] | [1-9][0-9]*) ;;
879 $echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
880 $echo "$progname: \`$vinfo' is not valid version information" 1>&2
886 0 | [1-9] | [1-9][0-9]*) ;;
888 $echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
889 $echo "$progname: \`$vinfo' is not valid version information" 1>&2
895 0 | [1-9] | [1-9][0-9]*) ;;
897 $echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
898 $echo "$progname: \`$vinfo' is not valid version information" 1>&2
903 if test $age -gt $current; then
904 $echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
905 $echo "$progname: \`$vinfo' is not valid version information" 1>&2
909 # Calculate the version variables.
910 version_vars="version_type current age revision"
911 case "$version_type" in
915 version_vars="$version_vars major versuffix"
916 major=`expr $current - $age`
917 versuffix="$major.$age.$revision"
921 version_vars="$version_vars versuffix verstring"
922 major=`expr $current - $age`
923 versuffix="$current.$age.$revision"
924 verstring="$versuffix"
926 # Add in all the interfaces that we are compatible with.
928 while test $loop != 0; do
929 iface=`expr $current - $loop`
930 loop=`expr $loop - 1`
931 verstring="$verstring:${iface}.0"
934 # Make executables depend on our current version.
935 verstring="$verstring:${current}.0"
939 version_vars="$version_vars major versuffix"
941 versuffix="$current.$revision"
945 $echo "$progname: unknown library version type \`$version_type'" 1>&2
946 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
951 # Create the output directory, or remove our outputs if we need to.
952 if test -d $objdir; then
953 $show "$rm $objdir/$output $objdir/$libname.*"
954 $run $rm $objdir/$output $objdir/$libname.*
956 $show "$mkdir $objdir"
959 if test $status -eq 0 || test -d $objdir; then :
965 # Check to see if the archive will have undefined symbols.
966 if test "$allow_undefined" = yes; then
967 if test "$allow_undefined_flag" = unsupported; then
968 $echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
969 build_libtool_libs=no
974 allow_undefined_flag=
977 if test "$build_libtool_libs" = yes; then
978 # Get the real and link names of the library.
979 library_names=`eval \\$echo \"$library_names_spec\"`
980 set dummy $library_names
984 if test -n "$soname_spec"; then
985 soname=`eval \\$echo \"$soname_spec\"`
990 lib="$objdir/$realname"
993 linknames="$linknames $link"
996 # Use standard objects if they are PIC.
997 test -z "$pic_flag" && libobjs=`$echo "$libobjs " | sed -e 's/\.lo /.o /g' -e 's/ $//g'`
999 # Do each of the archive commands.
1000 cmds=`eval \\$echo \"$archive_cmds\"`
1001 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1002 for cmd in $cmds; do
1005 $run eval "$cmd" || exit $?
1009 # Create links to the real library.
1010 for link in $linknames; do
1011 $show "(cd $objdir && $LN_S $realname $link)"
1012 $run eval '(cd $objdir && $LN_S $realname $link)' || exit $?
1015 # If -export-dynamic was specified, set the dlname.
1016 if test "$export_dynamic" = yes; then
1017 # On all known operating systems, these are identical.
1024 if test -n "$link_against_libtool_libs"; then
1025 $echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
1029 if test -n "$deplibs"; then
1030 $echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
1033 if test -n "$dlfiles$dlprefiles"; then
1034 $echo "$progname: warning: \`-dlopen' is ignored while creating objects" 1>&2
1035 # Nullify the symbol file.
1036 compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
1037 finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
1040 if test -n "$rpath"; then
1041 $echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
1044 if test -n "$vinfo"; then
1045 $echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
1050 if test -n "$objs"; then
1051 $echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
1055 obj=`$echo "$output" | sed 's/\.lo$/.o/'`
1063 # Delete the old objects.
1064 $run $rm $obj $libobj
1066 # Create the old-style object.
1067 reload_objs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1070 cmds=`eval \\$echo \"$reload_cmds\"`
1071 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1072 for cmd in $cmds; do
1075 $run eval "$cmd" || exit $?
1079 # Exit if we aren't doing a library object file.
1080 test -z "$libobj" && exit 0
1082 if test "$build_libtool_libs" != yes; then
1083 # Create an invalid libtool object if no PIC, so that we don't
1084 # accidentally link it into a program.
1085 $show "$echo timestamp > $libobj"
1086 $run eval "\$echo timestamp > $libobj" || exit $?
1090 if test -n "$pic_flag"; then
1091 # Only do commands if we really have different PIC objects.
1092 reload_objs="$libobjs"
1094 cmds=`eval \\$echo \"$reload_cmds\"`
1095 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1096 for cmd in $cmds; do
1099 $run eval "$cmd" || exit $?
1103 # Just create a symlink.
1104 $show "$LN_S $obj $libobj"
1105 $run $LN_S $obj $libobj || exit 1
1112 if test -n "$vinfo"; then
1113 $echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2
1116 if test -n "$rpath"; then
1117 # If the user specified any rpath flags, then add them.
1118 for libdir in $rpath; do
1119 if test -n "$hardcode_libdir_flag_spec"; then
1120 if test -n "$hardcode_libdir_separator"; then
1121 if test -z "$hardcode_libdirs"; then
1122 # Put the magic libdir with the hardcode flag.
1123 hardcode_libdirs="$libdir"
1124 libdir="@HARDCODE_LIBDIRS@"
1126 # Just accumulate the unique libdirs.
1127 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1128 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1131 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1138 if test -n "$libdir"; then
1139 flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
1141 compile_command="$compile_command $flag"
1142 finalize_command="$finalize_command $flag"
1144 elif test "$hardcode_runpath_var" = yes; then
1145 case "$perm_rpath " in
1147 *) perm_rpath="$perm_rpath $libdir" ;;
1153 # Substitute the hardcoded libdirs into the compile commands.
1154 if test -n "$hardcode_libdir_separator"; then
1155 compile_command=`$echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1156 finalize_command=`$echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1159 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1160 # Transform all the library objects into standard objects.
1161 compile_command=`$echo "$compile_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
1162 finalize_command=`$echo "$finalize_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
1165 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1166 dlsyms="${output}S.c"
1171 if test -n "$dlsyms"; then
1172 # Add our own program objects to the preloaded list.
1173 dlprefiles=`$echo "$objs$dlprefiles " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
1175 # Discover the nlist of each of the dlfiles.
1176 nlist="$objdir/${output}.nm"
1178 if test -d $objdir; then
1179 $show "$rm $nlist ${nlist}T"
1180 $run $rm "$nlist" "${nlist}T"
1182 $show "$mkdir $objdir"
1185 if test $status -eq 0 || test -d $objdir; then :
1191 for arg in $dlprefiles; do
1192 $show "extracting global C symbols from \`$arg'"
1193 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1196 # Parse the name list into a source file.
1197 $show "creating $objdir/$dlsyms"
1198 if test -z "$run"; then
1199 # Make sure we at least have an empty file.
1200 test -f "$nlist" || : > "$nlist"
1202 # Try sorting and uniquifying the output.
1203 if sort "$nlist" | uniq > "$nlist"T; then
1204 mv -f "$nlist"T "$nlist"
1205 wcout=`wc "$nlist" 2>/dev/null`
1206 count=`$echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
1207 (test "$count" -ge 0) 2>/dev/null || count=-1
1216 cat <<EOF > "$objdir/$dlsyms"
1217 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1218 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1224 /* Prevent the only kind of declaration conflicts we can make. */
1225 #define dld_preloaded_symbol_count some_other_symbol
1226 #define dld_preloaded_symbols some_other_symbol
1228 /* External symbol declarations for the compiler. */
1230 if test -f "$nlist"; then
1231 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1233 $echo '/* NONE */' >> "$objdir/$dlsyms"
1237 cat <<EOF >> "$objdir/$dlsyms"
1239 #undef dld_preloaded_symbol_count
1240 #undef dld_preloaded_symbols
1242 #if defined (__STDC__) && __STDC__
1243 # define __ptr_t void *
1245 # define __ptr_t char *
1248 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1249 int dld_preloaded_symbol_count = $count;
1251 /* The mapping between symbol names and symbols. */
1256 dld_preloaded_symbols[] =
1260 if test -f "$nlist"; then
1261 sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1264 cat <<\EOF >> "$objdir/$dlsyms"
1275 echo "$progname: unknown suffix for \`$dlsyms'" 1>&2
1281 # Now compile the dynamic symbol file.
1282 $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1283 $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1285 # Transform the symbol file into the correct name.
1286 compile_command=`$echo "$compile_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
1287 finalize_command=`$echo "$finalize_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
1288 elif test "$export_dynamic" != yes; then
1289 test -n "$dlfiles$dlprefiles" && $echo "$progname: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1291 # We keep going just in case the user didn't refer to
1292 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1293 # really was required.
1294 $echo "$progname: not configured to extract global symbols from dlpreopened files" 1>&2
1296 # Nullify the symbol file.
1297 compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
1298 finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
1301 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1302 # Replace the output file specification.
1303 compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
1304 finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
1306 # We have no uninstalled library dependencies, so finalize right now.
1307 $show "$compile_command"
1308 $run eval "$compile_command"
1312 # Replace the output file specification.
1313 compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
1314 finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1316 # Create the binary in the object directory, then wrap it.
1317 if test -d $objdir; then :
1319 $show "$mkdir $objdir"
1320 $run $mkdir $objdir || exit $?
1323 if test -n "$shlibpath_var"; then
1324 # We should set the shlibpath_var
1326 for dir in $temp_rpath; do
1333 # Relative path: add a thisdir entry.
1334 rpath="$rpath\$thisdir/$dir:"
1341 # Delete the old output file.
1344 if test -n "$compile_shlibpath"; then
1345 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1347 if test -n "$finalize_shlibpath"; then
1348 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1351 if test -n "$perm_rpath"; then
1352 # We should set the runpath_var.
1354 for dir in $perm_rpath; do
1357 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1358 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1361 case "$hardcode_action" in
1363 # AGH! Flame the AIX and HP-UX people for me, will ya?
1364 $echo "$progname: warning: using a buggy system linker" 1>&2
1365 $echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
1369 $show "$compile_command"
1370 $run eval "$compile_command" || exit $?
1372 # Now create the wrapper script.
1373 $show "creating $output"
1375 # Quote the finalize command for shipping.
1376 finalize_command=`$echo "$finalize_command" | sed "$sed_quote_subst"`
1378 # Only actually do things if our run command is non-null.
1379 if test -z "$run"; then
1381 trap "$rm $output; exit 1" 1 2 15
1386 # $output - temporary wrapper script for $objdir/$output
1387 # Generated by ltmain.sh - GNU $PACKAGE $VERSION
1389 # The $output program cannot be directly executed until all the libtool
1390 # libraries that it depends on are installed.
1392 # This wrapper script should never be moved out of \``pwd`'.
1393 # If it is, it will not operate correctly.
1395 # This environment variable determines our operation mode.
1396 if test "\$libtool_install_magic" = "$magic"; then
1397 # install mode needs the following variables:
1398 link_against_libtool_libs='$link_against_libtool_libs'
1399 finalize_command="$finalize_command"
1401 # When we are sourced in execute mode, \$file and \$echo are already set.
1402 if test "\$libtool_execute_magic" = "$magic"; then :
1408 # Find the directory that this script lives in.
1409 thisdir=\`\$echo "\$file" | sed 's%/[^/]*$%%'\`
1410 test "x\$thisdir" = "x\$file" && thisdir=.
1412 # Follow symbolic links until we get to the real thisdir.
1413 file=\`ls -ld "\$file" | sed -n 's/.*-> //p'\`
1414 while test -n "\$file"; do
1415 destdir=\`\$echo "\$file" | sed 's%/[^/]*\$%%'\`
1417 # If there was a directory component, then change thisdir.
1418 if test "x\$destdir" != "x\$file"; then
1420 /*) thisdir="\$destdir" ;;
1421 *) thisdir="\$thisdir/\$destdir" ;;
1425 file=\`\$echo "\$file" | sed 's%^.*/%%'\`
1426 file=\`ls -ld "\$thisdir/\$file" | sed -n 's/.*-> //p'\`
1429 # Try to get the absolute directory name.
1430 absdir=\`cd "\$thisdir" && pwd\`
1431 test -n "\$absdir" && thisdir="\$absdir"
1433 progdir="\$thisdir/$objdir"
1436 if test -f "\$progdir/\$program"; then
1439 # Export our shlibpath_var if we have one.
1440 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1441 cat >> $output <<EOF
1442 # Add our own library path to $shlibpath_var
1443 $shlibpath_var="$temp_rpath\$$shlibpath_var"
1445 # Some systems cannot cope with colon-terminated $shlibpath_var
1446 $shlibpath_var=\`\$echo \$$shlibpath_var | sed -e 's/:*\$//'\`
1448 export $shlibpath_var
1453 cat >> $output <<EOF
1454 if test "\$libtool_execute_magic" != "$magic"; then
1455 # Run the actual program with our arguments.
1459 # Quote arguments (to preserve shell metacharacters).
1460 sed_quote_subst='$sed_quote_subst'
1461 arg=\`\$echo "\$arg" | sed "\$sed_quote_subst"\`
1462 args="\$args \\"\$arg\\""
1465 # Export the path to the program.
1466 PATH="\$progdir:\$PATH"
1469 eval "exec \$program \$args"
1471 \$echo "\$0: cannot exec \$program \$args"
1475 # The program doesn't exist.
1476 \$echo "\$0: error: \$progdir/\$program does not exist" 1>&2
1477 \$echo "This script is just a wrapper for \$program." 1>&2
1478 \$echo "See the $PACKAGE documentation for more information." 1>&2
1490 # See if we need to build an old-fashioned archive.
1491 if test "$build_old_libs" = "yes"; then
1492 # Now set the variables for building old libraries.
1493 oldlib="$objdir/$libname.a"
1495 # Transform .lo files to .o files.
1496 oldobjs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1498 if test -d "$objdir"; then
1502 $show "$mkdir $objdir"
1506 # Do each command in the archive commands.
1507 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1508 cmds=`eval \\$echo \"$old_archive_from_new_cmds\"`
1510 cmds=`eval \\$echo \"$old_archive_cmds\"`
1512 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1513 for cmd in $cmds; do
1516 $run eval "$cmd" || exit $?
1521 # Now create the libtool archive.
1525 test "$build_old_libs" = yes && old_library="$libname.a"
1527 $show "creating $output"
1529 # Only create the output if not a dry run.
1530 if test -z "$run"; then
1532 # $output - a libtool library file
1533 # Generated by ltmain.sh - GNU $PACKAGE $VERSION
1535 # The name that we can dlopen(3).
1538 # Names of this library.
1539 library_names='$library_names'
1541 # The name of the static archive.
1542 old_library='$old_library'
1544 # Version information for $libname.
1549 # Directory that this library needs to be installed in:
1550 libdir='$install_libdir'
1554 # Do a symbolic link so that the libtool archive can be found in
1555 # LD_LIBRARY_PATH before the program is installed.
1556 $show "(cd $objdir && $LN_S ../$output $output)"
1557 $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
1563 # libtool install mode
1565 progname="$progname: install"
1567 # There may be an optional /bin/sh argument at the beginning of
1568 # install_prog (especially on Windows NT).
1569 if test "$nonopt" = "$SHELL"; then
1570 # Aesthetically quote it.
1571 arg=`$echo "$nonopt" | sed "$sed_quote_subst"`
1573 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1577 install_prog="$arg "
1585 # The real first argument should be the name of the installation program.
1586 # Aesthetically quote it.
1587 arg=`$echo "$arg" | sed "$sed_quote_subst"`
1589 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1593 install_prog="$install_prog$arg"
1595 # We need to accept at least all the BSD install flags.
1605 if test -n "$dest"; then
1606 files="$files $dest"
1624 # If the previous option needed an argument, then skip it.
1625 if test -n "$prev"; then
1634 # Aesthetically quote the argument.
1635 arg=`$echo "$arg" | sed "$sed_quote_subst"`
1637 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1641 install_prog="$install_prog $arg"
1644 if test -z "$install_prog"; then
1645 $echo "$progname: you must specify an install program" 1>&2
1650 if test -n "$prev"; then
1651 $echo "$progname: the \`$prev' option requires an argument" 1>&2
1656 if test -z "$files"; then
1657 if test -z "$dest"; then
1658 $echo "$progname: no file or destination specified" 1>&2
1660 $echo "$progname: you must specify a destination" 1>&2
1666 # Strip any trailing slash from the destination.
1667 dest=`$echo "$dest" | sed 's%/$%%'`
1669 # Check to see that the destination is a directory.
1670 test -d "$dest" && isdir=yes
1671 if test -n "$isdir"; then
1675 destdir=`$echo "$dest" | sed 's%/[^/]*$%%'`
1676 test "X$destdir" = "X$dest" && destdir=.
1677 destname=`$echo "$dest" | sed 's%^.*/%%'`
1679 # Not a directory, so check to see that there is only one file specified.
1681 if test $# -gt 2; then
1682 $echo "$progname: \`$dest' is not a directory" 1>&2
1690 for file in $files; do
1694 $echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
1703 # This variable tells wrapper scripts just to set variables rather
1704 # than running their programs.
1705 libtool_install_magic="$magic"
1710 for file in $files; do
1712 # Do each installation.
1715 # Do the static libraries later.
1716 staticlibs="$staticlibs $file"
1720 # Check to see that this really is a libtool archive.
1721 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then :
1723 $echo "$progname: \`$file' is not a valid libtool archive" 1>&2
1730 # If there is no directory component, then add one.
1736 # Add the libdir to current_libdirs if it is the destination.
1737 if test "X$destdir" = "X$libdir"; then
1738 case "$current_libdirs " in
1740 *) current_libdirs="$current_libdirs $libdir" ;;
1743 # Note the libdir as a future libdir.
1744 case "$future_libdirs " in
1746 *) future_libdirs="$future_libdirs $libdir" ;;
1750 dir="`$echo "$file" | sed 's%/[^/]*$%%'`/"
1751 test "X$dir" = "X$file/" && dir=
1754 # See the names of the shared library.
1755 set dummy $library_names
1756 if test -n "$2"; then
1761 # Install the shared library and build the symlinks.
1762 $show "$install_prog $dir/$realname $destdir/$realname"
1763 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1764 test "X$dlname" = "X$realname" && dlname=
1766 # Support stripping libraries.
1767 if test -n "$stripme"; then
1768 if test -n "$striplib"; then
1769 $show "$striplib $destdir/$realname"
1770 $run $striplib $destdir/$realname || exit $?
1772 $echo "$progname: warning: no library stripping program" 1>&2
1776 if test $# -gt 0; then
1777 # Delete the old symlinks.
1781 rmcmd="$rmcmd $destdir/$linkname"
1786 # ... and create new ones.
1789 test "X$dlname" = "X$linkname" && dlname=
1790 $show "(cd $destdir && $LN_S $realname $linkname)"
1791 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1795 if test -n "$dlname"; then
1796 # Install the dynamically-loadable library.
1797 $show "$install_prog $dir/$dlname $destdir/$dlname"
1798 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1801 # Do each command in the postinstall commands.
1802 lib="$destdir/$realname"
1803 cmds=`eval \\$echo \"$postinstall_cmds\"`
1804 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1805 for cmd in $cmds; do
1808 $run eval "$cmd" || exit $?
1813 # Install the pseudo-library for information purposes.
1814 name=`$echo "$file" | sed 's%^.*/%%'`
1815 $show "$install_prog $file $destdir/$name"
1816 $run eval "$install_prog $file $destdir/$name" || exit $?
1818 # Maybe install the static library, too.
1819 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1823 # Install (i.e. copy) a libtool object.
1825 # Figure out destination file name, if it wasn't already specified.
1826 if test -n "$destname"; then
1827 destfile="$destdir/$destname"
1829 destfile=`$echo "$file" | sed 's%^.*/%%'`
1830 destfile="$destdir/$destfile"
1833 # Deduce the name of the destination old-style object file.
1836 staticdest=`$echo "$destfile" | sed 's/\.lo$/\.o/'`
1839 staticdest="$destfile"
1843 $echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
1849 # Install the libtool object if requested.
1850 if test -n "$destfile"; then
1851 $show "$install_prog $file $destfile"
1852 $run eval "$install_prog $file $destfile" || exit $?
1855 # Install the old object if enabled.
1856 if test "$build_old_libs" = yes; then
1857 # Deduce the name of the old-style object file.
1858 staticobj=`$echo "$file" | sed 's/\.lo$/\.o/'`
1860 $show "$install_prog $staticobj $staticdest"
1861 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
1867 # Do a test to see if this is really a libtool program.
1868 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
1869 link_against_libtool_libs=
1872 # If there is no directory component, then add one.
1878 # Check the variables that should have been set.
1879 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
1880 $echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
1885 for lib in $link_against_libtool_libs; do
1886 # Check to see that each library is installed.
1888 if test -f "$lib"; then
1889 # If there is no directory component, then add one.
1895 libfile="$libdir/`$echo "$lib" | sed 's%^.*/%%g'`"
1896 if test -z "$libdir"; then
1897 $echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
1898 elif test -f "$libfile"; then :
1900 $echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1905 if test "$hardcode_action" = relink; then
1906 if test "$finalize" = yes; then
1907 $echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1908 $show "$finalize_command"
1909 if $run eval "$finalize_command"; then :
1911 $echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
1914 file="$objdir/$file"T
1916 $echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1919 # Install the binary that we compiled earlier.
1920 file=`$echo "$file" | sed "s%\([^/]*\)$%$objdir/\1%"`
1924 $show "$install_prog$stripme $file $dest"
1925 $run eval "$install_prog\$stripme \$file \$dest" || exit $?
1930 for file in $staticlibs; do
1931 name=`$echo "$file" | sed 's%^.*/%%'`
1933 # Set up the ranlib parameters.
1934 oldlib="$destdir/$name"
1936 $show "$install_prog $file $oldlib"
1937 $run eval "$install_prog \$file \$oldlib" || exit $?
1939 # Support stripping libraries.
1940 if test -n "$stripme"; then
1941 if test -n "$old_striplib"; then
1942 $show "$old_striplib $oldlib"
1943 $run $old_striplib $oldlib || exit $?
1945 $echo "$progname: warning: no static library stripping program" 1>&2
1949 # Do each command in the postinstall commands.
1950 cmds=`eval \\$echo \"$old_postinstall_cmds\"`
1951 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1952 for cmd in $cmds; do
1955 $run eval "$cmd" || exit $?
1960 if test -n "$future_libdirs"; then
1961 $echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1964 if test -n "$current_libdirs"; then
1965 # Maybe just do a dry run.
1966 test -n "$run" && current_libdirs=" -n$current_libdirs"
1967 exec $SHELL $0 --finish$current_libdirs
1974 # libtool finish mode
1976 progname="$progname: finish"
1979 if test -n "$finish_cmds" && test -n "$libdirs"; then
1982 libdirs="$libdirs $dir"
1985 for libdir in $libdirs; do
1986 # Do each command in the postinstall commands.
1987 cmds=`eval \\$echo \"$finish_cmds\"`
1988 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1989 for cmd in $cmds; do
1998 $echo "To link against installed libraries in LIBDIR, users may have to:"
1999 if test -n "$shlibpath_var"; then
2000 $echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
2002 $echo " - use the \`-LLIBDIR' linker flag"
2006 # libtool execute mode
2008 progname="$progname: execute"
2010 # The first argument is the command name.
2012 if test -z "$cmd"; then
2013 $echo "$progname: you must specify a COMMAND" 1>&2
2018 # Handle -dlopen flags immediately.
2019 for file in $execute_dlfiles; do
2020 if test -f "$file"; then :
2022 $echo "$progname: \`$file' is not a file" 1>&2
2030 # Check to see that this really is a libtool archive.
2031 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then :
2033 $echo "$progname: \`$lib' is not a valid libtool archive" 1>&2
2038 # Read the libtool library.
2042 # If there is no directory component, then add one.
2048 # Skip this library if it cannot be dlopened.
2049 if test -z "$dlname"; then
2050 # Warn if it was a shared library.
2051 test -n "$library_names" && $echo "$progname: warning: \`$file' was not linked with \`-export-dynamic'"
2055 dir=`$echo "$file" | sed 's%/[^/]*$%%'`
2056 test "X$dir" = "X$file" && dir=.
2058 if test -f "$dir/$objdir/$dlname"; then
2061 $echo "$progname: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2067 # Just add the directory containing the .lo file.
2068 dir=`$echo "$file" | sed 's%/[^/]*$%%'`
2069 test "X$dir" = "X$file" && dir=.
2073 $echo "$progname: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2078 # Get the absolute pathname.
2079 absdir=`cd "$dir" && pwd`
2080 test -n "$absdir" && dir="$absdir"
2082 # Now add the directory to shlibpath_var.
2083 if eval "test -z \"\$$shlibpath_var\""; then
2084 eval "$shlibpath_var=\"\$dir\""
2086 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2090 # This variable tells wrapper scripts just to set shlibpath_var
2091 # rather than running their programs.
2092 libtool_execute_magic="$magic"
2094 # Check if any of the arguments is a wrapper script.
2101 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
2102 # If there is no directory component, then add one.
2108 # Transform arg to wrapped name.
2109 file="$progdir/$program"
2113 # Quote arguments (to preserve shell metacharacters).
2114 file=`$echo "$file" | sed "$sed_quote_subst"`
2115 args="$args \"$file\""
2118 if test -z "$run"; then
2119 # Export the shlibpath_var.
2120 eval "export $shlibpath_var"
2122 # Now actually exec the command.
2123 eval "exec \$cmd$args"
2125 $echo "$progname: cannot exec \$cmd$args"
2128 # Display what would be done.
2129 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2130 $echo "export $shlibpath_var"
2136 # libtool uninstall mode
2138 progname="$progname: uninstall"
2145 -*) rm="$rm $arg" ;;
2146 *) files="$files $arg" ;;
2150 if test -z "$rm"; then
2151 $echo "$progname: you must specify an RM program" 1>&2
2156 for file in $files; do
2157 dir=`$echo "$file" | sed -e 's%/[^/]*$%%'`
2158 test "X$dir" = "X$file" && dir=.
2159 name=`$echo "$file" | sed -e 's%^.*/%%'`
2165 # Possibly a libtool archive, so verify it.
2166 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
2169 # Delete the libtool libraries and symlinks.
2170 for n in $library_names; do
2171 rmfiles="$rmfiles $dir/$n"
2172 test "X$n" = "X$dlname" && dlname=
2174 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2175 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2177 # FIXME: should reinstall the best remaining shared library.
2182 if test "$build_old_libs" = yes; then
2183 oldobj=`$echo "$name" | sed 's/\.lo$/\.o/'`
2184 rmfiles="$rmfiles $dir/$oldobj"
2189 $show "$rm $rmfiles"
2196 $echo "$progname: you must specify a MODE" 1>&2
2197 $echo "$generic_help" 1>&2
2202 $echo "$progname: invalid operation mode \`$mode'" 1>&2
2203 $echo "$generic_help" 1>&2
2205 fi # test -z "$show_help"
2207 # We need to display help for each of the modes.
2210 Usage: $progname [OPTION]... [MODE-ARG]...
2212 Provide generalized library-building support services.
2214 -n, --dry-run display commands without modifying any files
2215 --features display configuration information and exit
2216 --finish same as \`--mode=finish'
2217 --help display this help message and exit
2218 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
2219 --quiet same as \`--silent'
2220 --silent don't print informational messages
2221 --version print version information
2223 MODE must be one of the following:
2225 compile compile a source file into a libtool object
2226 execute automatically set library path, then run a program
2227 finish complete the installation of libtool libraries
2228 install install libraries or executables
2229 link create a library or an executable
2230 uninstall remove libraries from an installed directory
2232 MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
2233 a more detailed description of MODE.
2239 Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2241 Compile a source file into a libtool library object.
2243 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2244 from the given SOURCEFILE.
2246 The output file name is determined by removing the directory component from
2247 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2248 library object suffix, \`.lo'.
2254 Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
2256 Automatically set library path, then run a program.
2258 This mode accepts the following additional options:
2260 -dlopen FILE add the directory containing FILE to the library path
2262 This mode sets the library path environment variable according to \`-dlopen'
2265 If any of the ARGS are libtool executable wrappers, then they are translated
2266 into their corresponding uninstalled binary, and any of their required library
2267 directories are added to the library path.
2269 Then, COMMAND is executed, with ARGS as arguments.
2275 Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
2277 Complete the installation of libtool libraries.
2279 Each LIBDIR is a directory that contains libtool libraries.
2281 The commands that this mode executes may require superuser privileges. Use
2282 the \`--dry-run' option if you just want to see what would be executed.
2288 Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
2290 Install executables or libraries.
2292 INSTALL-COMMAND is the installation command. The first component should be
2293 either the \`install' or \`cp' program.
2295 The rest of the components are interpreted as arguments to that command (only
2296 BSD-compatible install options are recognized).
2302 Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
2304 Link object files or libraries together to form another library, or to
2305 create an executable program.
2307 LINK-COMMAND is a command using the C compiler that you would use to create
2308 a program from several object files.
2310 The following components of LINK-COMMAND are treated specially:
2312 -all-static do not do any dynamic linking at all
2313 -allow-undefined allow a libtool library to reference undefined symbols
2314 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2315 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
2316 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2317 -LLIBDIR search LIBDIR for required installed libraries
2318 -lNAME OUTPUT-FILE requires the installed library libNAME
2319 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2320 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2321 -static do not do any dynamic linking of libtool libraries
2322 -version-info CURRENT[:REVISION[:AGE]]
2323 specify library version info [each variable defaults to 0]
2325 All other options (arguments beginning with \`-') are ignored.
2327 Every other argument is treated as a filename. Files ending in \`.la' are
2328 treated as uninstalled libtool libraries, other files are standard or library
2331 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2332 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2334 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
2337 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
2338 created, otherwise an executable program is created.
2344 Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2346 Remove libraries from an installation directory.
2348 RM is the name of the program to use to delete files associated with each FILE
2349 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2352 If FILE is a libtool library, all the files associated with it are deleted.
2353 Otherwise, only FILE itself is deleted using RM.
2358 $echo "$progname: invalid operation mode \`$mode'" 1>&2
2365 $echo "Try \`$progname --help' for more information about other modes."