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.
25 # The name of this program.
26 progname=`$echo "$0" | sed 's%^.*/%%'`
35 help="Try \`$progname --help' for more information."
36 magic="%%%MAGIC variable%%%"
41 # Sed substitution that helps us do robust quoting. It backslashifies
42 # metacharacters that are still active within double-quoted strings.
43 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
46 # Only set LANG and LC_ALL to C if already set.
47 # These must not be set unconditionally because not all systems understand
48 # e.g. LANG=C (notably SCO).
49 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
50 if test "${LANG+set}" = set; then LANG=C; export LANG; fi
52 if test "$LTCONFIG_VERSION" != "$VERSION"; then
53 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
54 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
58 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
59 echo "$modename: not configured to build any kind of library" 1>&2
60 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
74 # Parse our command line options once, thoroughly.
81 -*=*) optarg=`$echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
85 # If the previous option needs an argument, assign it.
86 if test -n "$prev"; then
89 eval "$prev=\"\$$prev \$arg\""
101 # Have we seen a non-optional argument yet?
108 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
118 if test "$build_libtool_libs" = yes; then
119 echo "enable shared libraries"
121 echo "disable shared libraries"
123 if test "$build_old_libs" = yes; then
124 echo "enable static libraries"
126 echo "disable static libraries"
131 --finish) mode="finish" ;;
133 --mode) prevopt="--mode" prev=mode ;;
134 --mode=*) mode="$optarg" ;;
146 $echo "$modename: unrecognized option \`$arg'" 1>&2
158 if test -n "$prevopt"; then
159 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
164 if test -z "$show_help"; then
166 # Infer the operation mode.
167 if test -z "$mode"; then
191 # If we have no mode, but dlfiles were specified, then do execute mode.
192 test -n "$execute_dlfiles" && mode=execute
194 # Just use the default operation mode.
195 if test -z "$mode"; then
196 if test -n "$nonopt"; then
197 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
199 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
206 # Only execute mode is allowed to have -dlopen flags.
207 if test -n "$execute_dlfiles" && test "$mode" != execute; then
208 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
213 # Change the help message to a mode-specific one.
215 help="Try \`$modename --help --mode=$mode' for more information."
217 # These modes are in order of execution frequency so that they run quickly.
219 # libtool compile mode
221 modename="$modename: compile"
222 # Get the compilation command and the source file.
230 # The only flag that cannot be specified is the output filename.
231 if test "X$arg" = "X-o"; then
232 $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
237 # Accept the current argument as the source file.
241 # Aesthetically quote the previous argument.
243 # Backslashify any backslashes, double quotes, and dollar signs.
244 # These are the only characters that are still specially
245 # interpreted inside of double-quoted scrings.
246 lastarg=`$echo "$lastarg" | sed "$sed_quote_subst"`
248 # Double-quote args containing other shell metacharacters.
249 # Many Bourne shells cannot handle close brackets correctly in scan
250 # sets, so we specify it separately.
252 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
253 lastarg="\"$lastarg\""
257 # Add the previous argument to base_compile.
258 if test -z "$base_compile"; then
259 base_compile="$lastarg"
261 base_compile="$base_compile $lastarg"
265 # Get the name of the library object.
266 libobj=`$echo "$srcfile" | sed -e 's%^.*/%%'`
268 # Recognize several different file suffixes.
279 libobj=`$echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
282 *.lo) obj=`$echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
284 $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
289 if test -z "$base_compile"; then
290 $echo "$modename: you must specify a compilation command" 1>&2
295 # Delete any leftover library objects.
296 if test "$build_old_libs" = yes; then
297 $run $rm $obj $libobj
298 trap "$run $rm $obj $libobj; exit 1" 1 2 15
301 trap "$run $rm $libobj; exit 1" 1 2 15
304 # Only build a PIC object if we are building libtool libraries.
305 if test "$build_libtool_libs" = yes; then
306 # Without this assignment, base_compile gets emptied.
307 fbsd_hideous_sh_bug=$base_compile
309 # All platforms use -DPIC, to notify preprocessed assembler code.
310 $show "$base_compile$pic_flag -DPIC $srcfile"
311 if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
313 test -n "$obj" && $run $rm $obj
317 # If we have no pic_flag, then copy the object into place and finish.
318 if test -z "$pic_flag"; then
319 $show "$LN_S $obj $libobj"
320 $run $LN_S $obj $libobj
324 # Just move the object, then go on to compile the next one
325 $show "$mv $obj $libobj"
326 $run $mv $obj $libobj || exit 1
328 # Allow error messages only from the first compilation.
329 suppress_output=' >/dev/null 2>&1'
332 # Only build a position-dependent object if we build old libraries.
333 if test "$build_old_libs" = yes; then
334 # Suppress compiler output if we already did a PIC compilation.
335 $show "$base_compile $srcfile$suppress_output"
336 if $run eval "$base_compile \$srcfile$suppress_output"; then :
338 $run $rm $obj $libobj
343 # Create an invalid libtool object if no PIC, so that we don't accidentally
344 # link it into a program.
345 if test "$build_libtool_libs" != yes; then
346 $show "echo timestamp > $libobj"
347 $run eval "echo timestamp > \$libobj" || exit $?
355 modename="$modename: link"
358 compile_command="$CC"
359 finalize_command="$CC"
369 link_against_libtool_libs=
379 # We need to know -static, to get the right output filenames.
383 -all-static | -static)
384 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
385 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
387 build_libtool_libs=no
394 # See if our shared archives depend on static archives.
395 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
397 # Go through the arguments, transforming them on the way.
400 # If the previous option needs an argument, assign it.
401 if test -n "$prev"; then
404 compile_command="$compile_command @OUTPUT@"
405 finalize_command="$finalize_command @OUTPUT@"
412 *.la | *.lo) ;; # We handle these cases below.
414 dlprefiles="$dlprefiles $arg"
415 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
426 eval "$prev=\"\$arg\""
437 if test -n "$link_static_flag"; then
438 compile_command="$compile_command $link_static_flag"
439 finalize_command="$finalize_command $link_static_flag"
445 # FIXME: remove this flag sometime in the future.
446 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
461 if test "$export_dynamic" != yes; then
463 if test -n "$export_dynamic_flag_spec"; then
464 arg=`eval \\$echo "$export_dynamic_flag_spec"`
469 # Add the symbol object into the linking commands.
470 compile_command="$compile_command @SYMFILE@"
471 finalize_command="$finalize_command @SYMFILE@"
476 dir=`$echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
479 # Add the corresponding hardcode_libdir_flag, if it is not identical.
482 $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
486 deplibs="$deplibs $arg"
489 -l*) deplibs="$deplibs $arg" ;;
504 # If we have no pic_flag, then this is the same as -all-static.
505 if test -z "$pic_flag" && test -n "$link_static_flag"; then
506 compile_command="$compile_command $link_static_flag"
507 finalize_command="$finalize_command $link_static_flag"
517 # Some other compiler flag.
519 # Unknown arguments in both finalize_command and compile_command need
520 # to be aesthetically quoted because they are evaled later.
521 arg=`$echo "$arg" | sed "$sed_quote_subst"`
523 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
536 if test "$prev" = dlfiles; then
537 dlfiles="$dlfiles $arg"
538 if test "$build_libtool_libs" = yes; then
542 # If libtool objects are unsupported, then we need to preload.
547 if test "$prev" = dlprefiles; then
548 # Preload the old-style object.
549 dlprefiles="$dlprefiles "`$echo "$arg" | sed 's/\.lo$/\.o/'`
552 libobjs="$libobjs $arg"
556 # A libtool-controlled library.
563 # Check to see that this really is a libtool archive.
564 if egrep '^# Generated by ltmain.sh' $arg >/dev/null 2>&1; then :
566 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
570 # If there is no directory component, then add one.
576 if test -z "$libdir"; then
577 $echo "$modename: \`$arg' contains no -rpath information" 1>&2
581 # Get the name of the library we link against.
583 for l in $old_library $library_names; do
587 if test -z "$linklib"; then
588 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
592 # Find the relevant object directory and library name.
593 name=`$echo "$arg" | sed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
594 dir=`$echo "$arg" | sed 's%/[^/]*$%%'`
595 if test "X$dir" = "X$arg"; then
601 # This library was specified with -dlopen.
602 if test "$prev" = dlfiles; then
603 dlfiles="$dlfiles $arg"
604 if test -z "$dlname"; then
605 # If there is no dlname, we need to preload.
608 # We should not create a dependency on this library.
614 # The library was specified with -dlpreopen.
615 if test "$prev" = dlprefiles; then
616 # Prefer using a static library (so that no silly _DYNAMIC symbols
617 # are required to link).
618 if test -n "$old_library"; then
619 dlprefiles="$dlprefiles $dir/$old_library"
621 dlprefiles="$dlprefiles $dir/$linklib"
626 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
627 link_against_libtool_libs="$link_against_libtool_libs $arg"
628 if test -n "$shlibpath_var"; then
629 # Make sure the rpath contains only unique directories.
630 case "$temp_rpath " in
632 *) temp_rpath="$temp_rpath $dir" ;;
636 # This is the magic to use -rpath.
637 if test -n "$hardcode_libdir_flag_spec"; then
638 if test -n "$hardcode_libdir_separator"; then
639 if test -z "$hardcode_libdirs"; then
640 # Put the magic libdir with the hardcode flag.
641 hardcode_libdirs="$libdir"
642 libdir="@HARDCODE_LIBDIRS@"
644 # Just accumulate the unique libdirs.
645 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
646 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
649 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
656 if test -n "$libdir"; then
657 flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
659 compile_command="$compile_command $flag"
660 finalize_command="$finalize_command $flag"
662 elif test "$hardcode_runpath_var" = yes; then
663 # Do the same for the permanent run path.
664 case "$perm_rpath " in
666 *) perm_rpath="$perm_rpath $libdir" ;;
671 case "$hardcode_action" in
673 if test "$hardcode_direct" = no; then
674 compile_command="$compile_command $dir/$linklib"
675 elif test "$hardcode_minus_L" = no; then
676 compile_command="$compile_command -L$dir -l$name"
677 elif test "$hardcode_shlibpath_var" = no; then
678 compile_shlibpath="$compile_shlibpath$dir:"
679 compile_command="$compile_command -l$name"
684 # We need an absolute path.
688 absdir=`cd "$dir" && pwd`
689 if test -z "$absdir"; then
690 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
697 if test "$hardcode_direct" = yes; then
698 compile_command="$compile_command $dir/$linklib"
699 elif test "$hardcode_minus_L" = yes; then
700 compile_command="$compile_command -L$dir -l$name"
701 elif test "$hardcode_shlibpath_var" = yes; then
702 compile_shlibpath="$compile_shlibpath$dir:"
703 compile_command="$compile_command -l$name"
708 $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2
713 # Finalize command for both is simple: just hardcode it.
714 if test "$hardcode_direct" = yes; then
715 finalize_command="$finalize_command $libdir/$linklib"
716 elif test "$hardcode_minus_L" = yes; then
717 finalize_command="$finalize_command -L$libdir -l$name"
718 elif test "$hardcode_shlibpath_var" = yes; then
719 finalize_shlibpath="$finalize_shlibpath$libdir:"
720 finalize_command="$finalize_command -l$name"
722 # We can't seem to hardcode it, guess we'll fake it.
723 finalize_command="$finalize_command -L$libdir -l$name"
726 # Transform directly to old archives if we don't build new libraries.
727 if test -n "$pic_flag" && test -z "$old_library"; then
728 $echo "$modename: cannot find static library for \`$arg'" 1>&2
732 # Here we assume that one of hardcode_direct or hardcode_minus_L
733 # is not unsupported. This is valid on all known static and
735 if test "$hardcode_direct" != unsupported; then
736 test -n "$old_library" && linklib="$old_library"
737 compile_command="$compile_command $dir/$linklib"
738 finalize_command="$finalize_command $dir/$linklib"
740 compile_command="$compile_command -L$dir -l$name"
741 finalize_command="$finalize_command -L$dir -l$name"
747 # Some other compiler argument.
749 # Unknown arguments in both finalize_command and compile_command need
750 # to be aesthetically quoted because they are evaled later.
751 arg=`$echo "$arg" | sed "$sed_quote_subst"`
753 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
760 # Now actually substitute the argument into the commands.
761 if test -n "$arg"; then
762 compile_command="$compile_command $arg"
763 finalize_command="$finalize_command $arg"
767 if test -n "$prev"; then
768 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
777 $echo "$modename: you must specify an output file" 1>&2
783 $echo "$modename: output file \`$output' must have no directory components" 1>&2
788 # Make sure we only generate libraries of the form `libNAME.la'.
792 $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
798 name=`$echo "$output" | sed -e 's/\.la$//' -e 's/^lib//'`
799 libname=`eval \\$echo \"$libname_spec\"`
801 # All the library-specific variables (install_libdir is set above).
809 if test -n "$objs"; then
810 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
814 # How the heck are we supposed to write a wrapper for a shared library?
815 if test -n "$link_against_libtool_libs"; then
816 $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
820 # Add libc to deplibs on all systems.
821 deplibs="$deplibs -lc"
823 if test -n "$dlfiles$dlprefiles"; then
824 $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
825 # Nullify the symbol file.
826 compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
827 finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
830 if test -z "$rpath"; then
831 $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
837 if test $# -gt 2; then
838 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
842 # Parse the version information argument.
843 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
847 if test -n "$5"; then
848 $echo "$modename: too many parameters to \`-version-info'" 1>&2
853 test -n "$2" && current="$2"
854 test -n "$3" && revision="$3"
855 test -n "$4" && age="$4"
857 # Check that each of the things are valid numbers.
859 0 | [1-9] | [1-9][0-9]*) ;;
861 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
862 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
868 0 | [1-9] | [1-9][0-9]*) ;;
870 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
871 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
877 0 | [1-9] | [1-9][0-9]*) ;;
879 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
880 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
885 if test $age -gt $current; then
886 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
887 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
891 # Calculate the version variables.
892 version_vars="version_type current age revision"
893 case "$version_type" in
897 version_vars="$version_vars major versuffix"
898 major=`expr $current - $age`
899 versuffix="$major.$age.$revision"
903 version_vars="$version_vars versuffix verstring"
904 major=`expr $current - $age`
905 versuffix="$current.$age.$revision"
906 verstring="$versuffix"
908 # Add in all the interfaces that we are compatible with.
910 while test $loop != 0; do
911 iface=`expr $current - $loop`
912 loop=`expr $loop - 1`
913 verstring="$verstring:${iface}.0"
916 # Make executables depend on our current version.
917 verstring="$verstring:${current}.0"
921 version_vars="$version_vars major versuffix"
923 versuffix="$current.$revision"
927 $echo "$modename: unknown library version type \`$version_type'" 1>&2
928 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
933 # Create the output directory, or remove our outputs if we need to.
934 if test -d $objdir; then
935 $show "$rm $objdir/$output $objdir/$libname.*"
936 $run $rm $objdir/$output $objdir/$libname.*
938 $show "$mkdir $objdir"
941 if test $status -eq 0 || test -d $objdir; then :
947 # Check to see if the archive will have undefined symbols.
948 if test "$allow_undefined" = yes; then
949 if test "$allow_undefined_flag" = unsupported; then
950 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
951 build_libtool_libs=no
956 allow_undefined_flag=
959 if test "$build_libtool_libs" = yes; then
960 # Get the real and link names of the library.
961 library_names=`eval \\$echo \"$library_names_spec\"`
962 set dummy $library_names
966 if test -n "$soname_spec"; then
967 soname=`eval \\$echo \"$soname_spec\"`
972 lib="$objdir/$realname"
975 linknames="$linknames $link"
978 # Use standard objects if they are PIC.
979 test -z "$pic_flag" && libobjs=`$echo "$libobjs " | sed -e 's/\.lo /.o /g' -e 's/ $//g'`
981 # Do each of the archive commands.
982 cmds=`eval \\$echo \"$archive_cmds\"`
983 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
987 $run eval "$cmd" || exit $?
991 # Create links to the real library.
992 for linkname in $linknames; do
993 $show "(cd $objdir && $LN_S $realname $linkname)"
994 $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
997 # If -export-dynamic was specified, set the dlname.
998 if test "$export_dynamic" = yes; then
999 # On all known operating systems, these are identical.
1006 if test -n "$link_against_libtool_libs"; then
1007 $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
1011 if test -n "$deplibs"; then
1012 $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
1015 if test -n "$dlfiles$dlprefiles"; then
1016 $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
1017 # Nullify the symbol file.
1018 compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
1019 finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
1022 if test -n "$rpath"; then
1023 $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
1026 if test -n "$vinfo"; then
1027 $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
1032 if test -n "$objs"; then
1033 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1037 obj=`$echo "$output" | sed 's/\.lo$/.o/'`
1045 # Delete the old objects.
1046 $run $rm $obj $libobj
1048 # Create the old-style object.
1049 reload_objs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1052 cmds=`eval \\$echo \"$reload_cmds\"`
1053 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1054 for cmd in $cmds; do
1057 $run eval "$cmd" || exit $?
1061 # Exit if we aren't doing a library object file.
1062 test -z "$libobj" && exit 0
1064 if test "$build_libtool_libs" != yes; then
1065 # Create an invalid libtool object if no PIC, so that we don't
1066 # accidentally link it into a program.
1067 $show "echo timestamp > $libobj"
1068 $run eval "echo timestamp > $libobj" || exit $?
1072 if test -n "$pic_flag"; then
1073 # Only do commands if we really have different PIC objects.
1074 reload_objs="$libobjs"
1076 cmds=`eval \\$echo \"$reload_cmds\"`
1077 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1078 for cmd in $cmds; do
1081 $run eval "$cmd" || exit $?
1085 # Just create a symlink.
1086 $show "$LN_S $obj $libobj"
1087 $run $LN_S $obj $libobj || exit 1
1094 if test -n "$vinfo"; then
1095 $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
1098 if test -n "$rpath"; then
1099 # If the user specified any rpath flags, then add them.
1100 for libdir in $rpath; do
1101 if test -n "$hardcode_libdir_flag_spec"; then
1102 if test -n "$hardcode_libdir_separator"; then
1103 if test -z "$hardcode_libdirs"; then
1104 # Put the magic libdir with the hardcode flag.
1105 hardcode_libdirs="$libdir"
1106 libdir="@HARDCODE_LIBDIRS@"
1108 # Just accumulate the unique libdirs.
1109 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1110 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1113 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1120 if test -n "$libdir"; then
1121 flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
1123 compile_command="$compile_command $flag"
1124 finalize_command="$finalize_command $flag"
1126 elif test "$hardcode_runpath_var" = yes; then
1127 case "$perm_rpath " in
1129 *) perm_rpath="$perm_rpath $libdir" ;;
1135 # Substitute the hardcoded libdirs into the compile commands.
1136 if test -n "$hardcode_libdir_separator"; then
1137 compile_command=`$echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1138 finalize_command=`$echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1141 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1142 # Transform all the library objects into standard objects.
1143 compile_command=`$echo "$compile_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
1144 finalize_command=`$echo "$finalize_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
1147 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1148 dlsyms="${output}S.c"
1153 if test -n "$dlsyms"; then
1154 # Add our own program objects to the preloaded list.
1155 dlprefiles=`$echo "$objs$dlprefiles " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
1157 # Discover the nlist of each of the dlfiles.
1158 nlist="$objdir/${output}.nm"
1160 if test -d $objdir; then
1161 $show "$rm $nlist ${nlist}T"
1162 $run $rm "$nlist" "${nlist}T"
1164 $show "$mkdir $objdir"
1167 if test $status -eq 0 || test -d $objdir; then :
1173 for arg in $dlprefiles; do
1174 $show "extracting global C symbols from \`$arg'"
1175 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1178 # Parse the name list into a source file.
1179 $show "creating $objdir/$dlsyms"
1180 if test -z "$run"; then
1181 # Make sure we at least have an empty file.
1182 test -f "$nlist" || : > "$nlist"
1184 # Try sorting and uniquifying the output.
1185 if sort "$nlist" | uniq > "$nlist"T; then
1186 mv -f "$nlist"T "$nlist"
1187 wcout=`wc "$nlist" 2>/dev/null`
1188 count=`echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
1189 (test "$count" -ge 0) 2>/dev/null || count=-1
1198 cat <<EOF > "$objdir/$dlsyms"
1199 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1200 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1206 /* Prevent the only kind of declaration conflicts we can make. */
1207 #define dld_preloaded_symbol_count some_other_symbol
1208 #define dld_preloaded_symbols some_other_symbol
1210 /* External symbol declarations for the compiler. */
1212 if test -f "$nlist"; then
1213 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1215 echo '/* NONE */' >> "$objdir/$dlsyms"
1219 cat <<EOF >> "$objdir/$dlsyms"
1221 #undef dld_preloaded_symbol_count
1222 #undef dld_preloaded_symbols
1224 #if defined (__STDC__) && __STDC__
1225 # define __ptr_t void *
1227 # define __ptr_t char *
1230 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1231 int dld_preloaded_symbol_count = $count;
1233 /* The mapping between symbol names and symbols. */
1238 dld_preloaded_symbols[] =
1242 if test -f "$nlist"; then
1243 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1246 cat <<\EOF >> "$objdir/$dlsyms"
1257 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1263 # Now compile the dynamic symbol file.
1264 $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1265 $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1267 # Transform the symbol file into the correct name.
1268 compile_command=`$echo "$compile_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
1269 finalize_command=`$echo "$finalize_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
1270 elif test "$export_dynamic" != yes; then
1271 test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1273 # We keep going just in case the user didn't refer to
1274 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1275 # really was required.
1276 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1278 # Nullify the symbol file.
1279 compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
1280 finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
1283 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1284 # Replace the output file specification.
1285 compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
1286 finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
1288 # We have no uninstalled library dependencies, so finalize right now.
1289 $show "$compile_command"
1290 $run eval "$compile_command"
1294 # Replace the output file specification.
1295 compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
1296 finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1298 # Create the binary in the object directory, then wrap it.
1299 if test -d $objdir; then :
1301 $show "$mkdir $objdir"
1302 $run $mkdir $objdir || exit $?
1305 if test -n "$shlibpath_var"; then
1306 # We should set the shlibpath_var
1308 for dir in $temp_rpath; do
1315 # Relative path: add a thisdir entry.
1316 rpath="$rpath\$thisdir/$dir:"
1323 # Delete the old output file.
1326 if test -n "$compile_shlibpath"; then
1327 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1329 if test -n "$finalize_shlibpath"; then
1330 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1333 if test -n "$perm_rpath"; then
1334 # We should set the runpath_var.
1336 for dir in $perm_rpath; do
1339 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1340 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1343 case "$hardcode_action" in
1345 # AGH! Flame the AIX and HP-UX people for me, will ya?
1346 $echo "$modename: warning: using a buggy system linker" 1>&2
1347 $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
1351 $show "$compile_command"
1352 $run eval "$compile_command" || exit $?
1354 # Now create the wrapper script.
1355 $show "creating $output"
1357 # Quote the finalize command for shipping.
1358 finalize_command=`$echo "$finalize_command" | sed "$sed_quote_subst"`
1360 # Only actually do things if our run command is non-null.
1361 if test -z "$run"; then
1363 trap "$rm $output; exit 1" 1 2 15
1368 # $output - temporary wrapper script for $objdir/$output
1369 # Generated by ltmain.sh - GNU $PACKAGE $VERSION
1371 # The $output program cannot be directly executed until all the libtool
1372 # libraries that it depends on are installed.
1374 # This wrapper script should never be moved out of \``pwd`'.
1375 # If it is, it will not operate correctly.
1377 # This environment variable determines our operation mode.
1378 if test "\$libtool_install_magic" = "$magic"; then
1379 # install mode needs the following variables:
1380 link_against_libtool_libs='$link_against_libtool_libs'
1381 finalize_command="$finalize_command"
1383 # When we are sourced in execute mode, \$file and \$echo are already set.
1384 if test "\$libtool_execute_magic" = "$magic"; then :
1390 # Find the directory that this script lives in.
1391 thisdir=\`\$echo "\$file" | sed 's%/[^/]*$%%'\`
1392 test "x\$thisdir" = "x\$file" && thisdir=.
1394 # Follow symbolic links until we get to the real thisdir.
1395 file=\`ls -ld "\$file" | sed -n 's/.*-> //p'\`
1396 while test -n "\$file"; do
1397 destdir=\`\$echo "\$file" | sed 's%/[^/]*\$%%'\`
1399 # If there was a directory component, then change thisdir.
1400 if test "x\$destdir" != "x\$file"; then
1402 /*) thisdir="\$destdir" ;;
1403 *) thisdir="\$thisdir/\$destdir" ;;
1407 file=\`\$echo "\$file" | sed 's%^.*/%%'\`
1408 file=\`ls -ld "\$thisdir/\$file" | sed -n 's/.*-> //p'\`
1411 # Try to get the absolute directory name.
1412 absdir=\`cd "\$thisdir" && pwd\`
1413 test -n "\$absdir" && thisdir="\$absdir"
1415 progdir="\$thisdir/$objdir"
1418 if test -f "\$progdir/\$program"; then
1421 # Export our shlibpath_var if we have one.
1422 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1423 cat >> $output <<EOF
1424 # Add our own library path to $shlibpath_var
1425 $shlibpath_var="$temp_rpath\$$shlibpath_var"
1427 # Some systems cannot cope with colon-terminated $shlibpath_var
1428 $shlibpath_var=\`\$echo \$$shlibpath_var | sed -e 's/:*\$//'\`
1430 export $shlibpath_var
1435 cat >> $output <<EOF
1436 if test "\$libtool_execute_magic" != "$magic"; then
1437 # Run the actual program with our arguments.
1441 # Quote arguments (to preserve shell metacharacters).
1442 sed_quote_subst='$sed_quote_subst'
1443 arg=\`\$echo "\$arg" | sed "\$sed_quote_subst"\`
1444 args="\$args \\"\$arg\\""
1447 # Export the path to the program.
1448 PATH="\$progdir:\$PATH"
1451 eval "exec \$program \$args"
1453 \$echo "\$0: cannot exec \$program \$args"
1457 # The program doesn't exist.
1458 \$echo "\$0: error: \$progdir/\$program does not exist" 1>&2
1459 \$echo "This script is just a wrapper for \$program." 1>&2
1460 echo "See the $PACKAGE documentation for more information." 1>&2
1472 # See if we need to build an old-fashioned archive.
1473 if test "$build_old_libs" = "yes"; then
1474 # Now set the variables for building old libraries.
1475 oldlib="$objdir/$libname.a"
1477 # Transform .lo files to .o files.
1478 oldobjs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1480 if test -d "$objdir"; then
1484 $show "$mkdir $objdir"
1488 # Do each command in the archive commands.
1489 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1490 cmds=`eval \\$echo \"$old_archive_from_new_cmds\"`
1492 cmds=`eval \\$echo \"$old_archive_cmds\"`
1494 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1495 for cmd in $cmds; do
1498 $run eval "$cmd" || exit $?
1503 # Now create the libtool archive.
1507 test "$build_old_libs" = yes && old_library="$libname.a"
1509 $show "creating $output"
1511 # Only create the output if not a dry run.
1512 if test -z "$run"; then
1514 # $output - a libtool library file
1515 # Generated by ltmain.sh - GNU $PACKAGE $VERSION
1517 # The name that we can dlopen(3).
1520 # Names of this library.
1521 library_names='$library_names'
1523 # The name of the static archive.
1524 old_library='$old_library'
1526 # Version information for $libname.
1531 # Directory that this library needs to be installed in:
1532 libdir='$install_libdir'
1536 # Do a symbolic link so that the libtool archive can be found in
1537 # LD_LIBRARY_PATH before the program is installed.
1538 $show "(cd $objdir && $LN_S ../$output $output)"
1539 $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
1545 # libtool install mode
1547 modename="$modename: install"
1549 # There may be an optional /bin/sh argument at the beginning of
1550 # install_prog (especially on Windows NT).
1551 if test "$nonopt" = "$SHELL"; then
1552 # Aesthetically quote it.
1553 arg=`$echo "$nonopt" | sed "$sed_quote_subst"`
1555 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1559 install_prog="$arg "
1567 # The real first argument should be the name of the installation program.
1568 # Aesthetically quote it.
1569 arg=`$echo "$arg" | sed "$sed_quote_subst"`
1571 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1575 install_prog="$install_prog$arg"
1577 # We need to accept at least all the BSD install flags.
1587 if test -n "$dest"; then
1588 files="$files $dest"
1606 # If the previous option needed an argument, then skip it.
1607 if test -n "$prev"; then
1616 # Aesthetically quote the argument.
1617 arg=`$echo "$arg" | sed "$sed_quote_subst"`
1619 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1623 install_prog="$install_prog $arg"
1626 if test -z "$install_prog"; then
1627 $echo "$modename: you must specify an install program" 1>&2
1632 if test -n "$prev"; then
1633 $echo "$modename: the \`$prev' option requires an argument" 1>&2
1638 if test -z "$files"; then
1639 if test -z "$dest"; then
1640 $echo "$modename: no file or destination specified" 1>&2
1642 $echo "$modename: you must specify a destination" 1>&2
1648 # Strip any trailing slash from the destination.
1649 dest=`$echo "$dest" | sed 's%/$%%'`
1651 # Check to see that the destination is a directory.
1652 test -d "$dest" && isdir=yes
1653 if test -n "$isdir"; then
1657 destdir=`$echo "$dest" | sed 's%/[^/]*$%%'`
1658 test "X$destdir" = "X$dest" && destdir=.
1659 destname=`$echo "$dest" | sed 's%^.*/%%'`
1661 # Not a directory, so check to see that there is only one file specified.
1663 if test $# -gt 2; then
1664 $echo "$modename: \`$dest' is not a directory" 1>&2
1672 for file in $files; do
1676 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
1685 # This variable tells wrapper scripts just to set variables rather
1686 # than running their programs.
1687 libtool_install_magic="$magic"
1692 for file in $files; do
1694 # Do each installation.
1697 # Do the static libraries later.
1698 staticlibs="$staticlibs $file"
1702 # Check to see that this really is a libtool archive.
1703 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then :
1705 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
1712 # If there is no directory component, then add one.
1718 # Add the libdir to current_libdirs if it is the destination.
1719 if test "X$destdir" = "X$libdir"; then
1720 case "$current_libdirs " in
1722 *) current_libdirs="$current_libdirs $libdir" ;;
1725 # Note the libdir as a future libdir.
1726 case "$future_libdirs " in
1728 *) future_libdirs="$future_libdirs $libdir" ;;
1732 dir="`$echo "$file" | sed 's%/[^/]*$%%'`/"
1733 test "X$dir" = "X$file/" && dir=
1736 # See the names of the shared library.
1737 set dummy $library_names
1738 if test -n "$2"; then
1743 # Install the shared library and build the symlinks.
1744 $show "$install_prog $dir/$realname $destdir/$realname"
1745 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1746 test "X$dlname" = "X$realname" && dlname=
1748 # Support stripping libraries.
1749 if test -n "$stripme"; then
1750 if test -n "$striplib"; then
1751 $show "$striplib $destdir/$realname"
1752 $run $striplib $destdir/$realname || exit $?
1754 $echo "$modename: warning: no library stripping program" 1>&2
1758 if test $# -gt 0; then
1759 # Delete the old symlinks.
1763 rmcmd="$rmcmd $destdir/$linkname"
1768 # ... and create new ones.
1771 test "X$dlname" = "X$linkname" && dlname=
1772 $show "(cd $destdir && $LN_S $realname $linkname)"
1773 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1777 if test -n "$dlname"; then
1778 # Install the dynamically-loadable library.
1779 $show "$install_prog $dir/$dlname $destdir/$dlname"
1780 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1783 # Do each command in the postinstall commands.
1784 lib="$destdir/$realname"
1785 cmds=`eval \\$echo \"$postinstall_cmds\"`
1786 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1787 for cmd in $cmds; do
1790 $run eval "$cmd" || exit $?
1795 # Install the pseudo-library for information purposes.
1796 name=`$echo "$file" | sed 's%^.*/%%'`
1797 $show "$install_prog $file $destdir/$name"
1798 $run eval "$install_prog $file $destdir/$name" || exit $?
1800 # Maybe install the static library, too.
1801 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1805 # Install (i.e. copy) a libtool object.
1807 # Figure out destination file name, if it wasn't already specified.
1808 if test -n "$destname"; then
1809 destfile="$destdir/$destname"
1811 destfile=`$echo "$file" | sed 's%^.*/%%'`
1812 destfile="$destdir/$destfile"
1815 # Deduce the name of the destination old-style object file.
1818 staticdest=`$echo "$destfile" | sed 's/\.lo$/\.o/'`
1821 staticdest="$destfile"
1825 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
1831 # Install the libtool object if requested.
1832 if test -n "$destfile"; then
1833 $show "$install_prog $file $destfile"
1834 $run eval "$install_prog $file $destfile" || exit $?
1837 # Install the old object if enabled.
1838 if test "$build_old_libs" = yes; then
1839 # Deduce the name of the old-style object file.
1840 staticobj=`$echo "$file" | sed 's/\.lo$/\.o/'`
1842 $show "$install_prog $staticobj $staticdest"
1843 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
1849 # Do a test to see if this is really a libtool program.
1850 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
1851 link_against_libtool_libs=
1854 # If there is no directory component, then add one.
1860 # Check the variables that should have been set.
1861 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
1862 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
1867 for lib in $link_against_libtool_libs; do
1868 # Check to see that each library is installed.
1870 if test -f "$lib"; then
1871 # If there is no directory component, then add one.
1877 libfile="$libdir/`$echo "$lib" | sed 's%^.*/%%g'`"
1878 if test -z "$libdir"; then
1879 $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2
1880 elif test -f "$libfile"; then :
1882 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1887 if test "$hardcode_action" = relink; then
1888 if test "$finalize" = yes; then
1889 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1890 $show "$finalize_command"
1891 if $run eval "$finalize_command"; then :
1893 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
1896 file="$objdir/$file"T
1898 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1901 # Install the binary that we compiled earlier.
1902 file=`$echo "$file" | sed "s%\([^/]*\)$%$objdir/\1%"`
1906 $show "$install_prog$stripme $file $dest"
1907 $run eval "$install_prog\$stripme \$file \$dest" || exit $?
1912 for file in $staticlibs; do
1913 name=`$echo "$file" | sed 's%^.*/%%'`
1915 # Set up the ranlib parameters.
1916 oldlib="$destdir/$name"
1918 $show "$install_prog $file $oldlib"
1919 $run eval "$install_prog \$file \$oldlib" || exit $?
1921 # Support stripping libraries.
1922 if test -n "$stripme"; then
1923 if test -n "$old_striplib"; then
1924 $show "$old_striplib $oldlib"
1925 $run $old_striplib $oldlib || exit $?
1927 $echo "$modename: warning: no static library stripping program" 1>&2
1931 # Do each command in the postinstall commands.
1932 cmds=`eval \\$echo \"$old_postinstall_cmds\"`
1933 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1934 for cmd in $cmds; do
1937 $run eval "$cmd" || exit $?
1942 if test -n "$future_libdirs"; then
1943 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1946 if test -n "$current_libdirs"; then
1947 # Maybe just do a dry run.
1948 test -n "$run" && current_libdirs=" -n$current_libdirs"
1949 exec $SHELL $0 --finish$current_libdirs
1956 # libtool finish mode
1958 modename="$modename: finish"
1961 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1964 libdirs="$libdirs $dir"
1967 for libdir in $libdirs; do
1968 if test -n "$finish_cmds"; then
1969 # Do each command in the finish commands.
1970 cmds=`eval \\$echo \"$finish_cmds\"`
1971 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1972 for cmd in $cmds; do
1979 if test -n "$finish_eval"; then
1980 # Do the single finish_eval.
1981 cmds=`eval \\$echo \"$finish_eval\"`
1987 echo "To link against installed libraries in LIBDIR, users may have to:"
1988 if test -n "$shlibpath_var"; then
1989 echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
1991 echo " - use the \`-LLIBDIR' linker flag"
1995 # libtool execute mode
1997 modename="$modename: execute"
1999 # The first argument is the command name.
2001 if test -z "$cmd"; then
2002 $echo "$modename: you must specify a COMMAND" 1>&2
2007 # Handle -dlopen flags immediately.
2008 for file in $execute_dlfiles; do
2009 if test -f "$file"; then :
2011 $echo "$modename: \`$file' is not a file" 1>&2
2019 # Check to see that this really is a libtool archive.
2020 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then :
2022 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2027 # Read the libtool library.
2031 # If there is no directory component, then add one.
2037 # Skip this library if it cannot be dlopened.
2038 if test -z "$dlname"; then
2039 # Warn if it was a shared library.
2040 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2044 dir=`$echo "$file" | sed 's%/[^/]*$%%'`
2045 test "X$dir" = "X$file" && dir=.
2047 if test -f "$dir/$objdir/$dlname"; then
2050 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2056 # Just add the directory containing the .lo file.
2057 dir=`$echo "$file" | sed 's%/[^/]*$%%'`
2058 test "X$dir" = "X$file" && dir=.
2062 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2067 # Get the absolute pathname.
2068 absdir=`cd "$dir" && pwd`
2069 test -n "$absdir" && dir="$absdir"
2071 # Now add the directory to shlibpath_var.
2072 if eval "test -z \"\$$shlibpath_var\""; then
2073 eval "$shlibpath_var=\"\$dir\""
2075 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2079 # This variable tells wrapper scripts just to set shlibpath_var
2080 # rather than running their programs.
2081 libtool_execute_magic="$magic"
2083 # Check if any of the arguments is a wrapper script.
2090 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
2091 # If there is no directory component, then add one.
2097 # Transform arg to wrapped name.
2098 file="$progdir/$program"
2102 # Quote arguments (to preserve shell metacharacters).
2103 file=`$echo "$file" | sed "$sed_quote_subst"`
2104 args="$args \"$file\""
2107 if test -z "$run"; then
2108 # Export the shlibpath_var.
2109 eval "export $shlibpath_var"
2111 # Now actually exec the command.
2112 eval "exec \$cmd$args"
2114 $echo "$modename: cannot exec \$cmd$args"
2117 # Display what would be done.
2118 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2119 $echo "export $shlibpath_var"
2125 # libtool uninstall mode
2127 modename="$modename: uninstall"
2134 -*) rm="$rm $arg" ;;
2135 *) files="$files $arg" ;;
2139 if test -z "$rm"; then
2140 $echo "$modename: you must specify an RM program" 1>&2
2145 for file in $files; do
2146 dir=`$echo "$file" | sed -e 's%/[^/]*$%%'`
2147 test "X$dir" = "X$file" && dir=.
2148 name=`$echo "$file" | sed -e 's%^.*/%%'`
2154 # Possibly a libtool archive, so verify it.
2155 if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
2158 # Delete the libtool libraries and symlinks.
2159 for n in $library_names; do
2160 rmfiles="$rmfiles $dir/$n"
2161 test "X$n" = "X$dlname" && dlname=
2163 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2164 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2166 $show "$rm $rmfiles"
2169 if test -n "$library_names"; then
2170 # Do each command in the postuninstall commands.
2171 cmds=`eval \\$echo \"$postuninstall_cmds\"`
2172 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2173 for cmd in $cmds; do
2181 if test -n "$old_library"; then
2182 # Do each command in the old_postuninstall commands.
2183 cmds=`eval \\$echo \"$old_postuninstall_cmds\"`
2184 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2185 for cmd in $cmds; do
2193 # FIXME: should reinstall the best remaining shared library.
2198 if test "$build_old_libs" = yes; then
2199 oldobj=`$echo "$name" | sed 's/\.lo$/\.o/'`
2200 rmfiles="$rmfiles $dir/$oldobj"
2202 $show "$rm $rmfiles"
2207 $show "$rm $rmfiles"
2216 $echo "$modename: you must specify a MODE" 1>&2
2217 $echo "$generic_help" 1>&2
2222 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2223 $echo "$generic_help" 1>&2
2225 fi # test -z "$show_help"
2227 # We need to display help for each of the modes.
2230 Usage: $modename [OPTION]... [MODE-ARG]...
2232 Provide generalized library-building support services.
2234 -n, --dry-run display commands without modifying any files
2235 --features display configuration information and exit
2236 --finish same as \`--mode=finish'
2237 --help display this help message and exit
2238 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
2239 --quiet same as \`--silent'
2240 --silent don't print informational messages
2241 --version print version information
2243 MODE must be one of the following:
2245 compile compile a source file into a libtool object
2246 execute automatically set library path, then run a program
2247 finish complete the installation of libtool libraries
2248 install install libraries or executables
2249 link create a library or an executable
2250 uninstall remove libraries from an installed directory
2252 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
2253 a more detailed description of MODE.
2259 Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2261 Compile a source file into a libtool library object.
2263 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2264 from the given SOURCEFILE.
2266 The output file name is determined by removing the directory component from
2267 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2268 library object suffix, \`.lo'.
2274 Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2276 Automatically set library path, then run a program.
2278 This mode accepts the following additional options:
2280 -dlopen FILE add the directory containing FILE to the library path
2282 This mode sets the library path environment variable according to \`-dlopen'
2285 If any of the ARGS are libtool executable wrappers, then they are translated
2286 into their corresponding uninstalled binary, and any of their required library
2287 directories are added to the library path.
2289 Then, COMMAND is executed, with ARGS as arguments.
2295 Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2297 Complete the installation of libtool libraries.
2299 Each LIBDIR is a directory that contains libtool libraries.
2301 The commands that this mode executes may require superuser privileges. Use
2302 the \`--dry-run' option if you just want to see what would be executed.
2308 Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2310 Install executables or libraries.
2312 INSTALL-COMMAND is the installation command. The first component should be
2313 either the \`install' or \`cp' program.
2315 The rest of the components are interpreted as arguments to that command (only
2316 BSD-compatible install options are recognized).
2322 Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
2324 Link object files or libraries together to form another library, or to
2325 create an executable program.
2327 LINK-COMMAND is a command using the C compiler that you would use to create
2328 a program from several object files.
2330 The following components of LINK-COMMAND are treated specially:
2332 -all-static do not do any dynamic linking at all
2333 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2334 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
2335 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2336 -LLIBDIR search LIBDIR for required installed libraries
2337 -lNAME OUTPUT-FILE requires the installed library libNAME
2338 -no-undefined declare that a library does not refer to external symbols
2339 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2340 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2341 -static do not do any dynamic linking of libtool libraries
2342 -version-info CURRENT[:REVISION[:AGE]]
2343 specify library version info [each variable defaults to 0]
2345 All other options (arguments beginning with \`-') are ignored.
2347 Every other argument is treated as a filename. Files ending in \`.la' are
2348 treated as uninstalled libtool libraries, other files are standard or library
2351 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2352 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2354 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
2357 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
2358 created, otherwise an executable program is created.
2364 Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2366 Remove libraries from an installation directory.
2368 RM is the name of the program to use to delete files associated with each FILE
2369 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2372 If FILE is a libtool library, all the files associated with it are deleted.
2373 Otherwise, only FILE itself is deleted using RM.
2378 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2385 $echo "Try \`$modename --help' for more information about other modes."