1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
4 # Copyright (C) 1996-1998 Free Software Foundation, Inc.
5 # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
26 # The name of this program.
27 progname=`$echo "$0" | sed 's%^.*/%%'`
36 help="Try \`$progname --help' for more information."
37 magic="%%%MAGIC variable%%%"
42 # Sed substitution that helps us do robust quoting. It backslashifies
43 # metacharacters that are still active within double-quoted strings.
45 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
48 # Only set LANG and LC_ALL to C if already set.
49 # These must not be set unconditionally because not all systems understand
50 # e.g. LANG=C (notably SCO).
51 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
52 if test "${LANG+set}" = set; then LANG=C; export LANG; fi
54 if test "$LTCONFIG_VERSION" != "$VERSION"; then
55 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
56 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
60 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
61 echo "$modename: not configured to build any kind of library" 1>&2
62 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
76 # Parse our command line options once, thoroughly.
83 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
87 # If the previous option needs an argument, assign it.
88 if test -n "$prev"; then
91 eval "$prev=\"\$$prev \$arg\""
103 # Have we seen a non-optional argument yet?
110 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
120 if test "$build_libtool_libs" = yes; then
121 echo "enable shared libraries"
123 echo "disable shared libraries"
125 if test "$build_old_libs" = yes; then
126 echo "enable static libraries"
128 echo "disable static libraries"
133 --finish) mode="finish" ;;
135 --mode) prevopt="--mode" prev=mode ;;
136 --mode=*) mode="$optarg" ;;
148 $echo "$modename: unrecognized option \`$arg'" 1>&2
160 if test -n "$prevopt"; then
161 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
166 case "$show $MFLAGS -$MAKEFLAGS" in
169 # Be silent inside 'make -s'
170 expr " $MFLAGS -$MAKEFLAGS" : '.* -[a-zA-Z]*s' >/dev/null && show=: ;;
173 if test -z "$show_help"; then
175 # Infer the operation mode.
176 if test -z "$mode"; then
178 *cc | *++ | gcc* | *-gcc*)
200 # If we have no mode, but dlfiles were specified, then do execute mode.
201 test -n "$execute_dlfiles" && mode=execute
203 # Just use the default operation mode.
204 if test -z "$mode"; then
205 if test -n "$nonopt"; then
206 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
208 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
215 # Only execute mode is allowed to have -dlopen flags.
216 if test -n "$execute_dlfiles" && test "$mode" != execute; then
217 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
222 # Change the help message to a mode-specific one.
224 help="Try \`$modename --help --mode=$mode' for more information."
226 # These modes are in order of execution frequency so that they run quickly.
228 # libtool compile mode
230 modename="$modename: compile"
231 # Get the compilation command and the source file.
239 # Accept any command-line options.
242 $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
248 build_libtool_libs=no
254 # Accept the current argument as the source file.
258 # Aesthetically quote the previous argument.
260 # Backslashify any backslashes, double quotes, and dollar signs.
261 # These are the only characters that are still specially
262 # interpreted inside of double-quoted scrings.
263 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
265 # Double-quote args containing other shell metacharacters.
266 # Many Bourne shells cannot handle close brackets correctly in scan
267 # sets, so we specify it separately.
269 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
270 lastarg="\"$lastarg\""
274 # Add the previous argument to base_compile.
275 if test -z "$base_compile"; then
276 base_compile="$lastarg"
278 base_compile="$base_compile $lastarg"
282 # Get the name of the library object.
283 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
285 # Recognize several different file suffixes.
300 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
303 *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
305 $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
310 if test -z "$base_compile"; then
311 $echo "$modename: you must specify a compilation command" 1>&2
316 # Delete any leftover library objects.
317 if test "$build_old_libs" = yes; then
318 $run $rm $obj $libobj
319 trap "$run $rm $obj $libobj; exit 1" 1 2 15
322 trap "$run $rm $libobj; exit 1" 1 2 15
325 # Only build a PIC object if we are building libtool libraries.
326 if test "$build_libtool_libs" = yes; then
327 # Without this assignment, base_compile gets emptied.
328 fbsd_hideous_sh_bug=$base_compile
330 # All platforms use -DPIC, to notify preprocessed assembler code.
331 $show "$base_compile$pic_flag -DPIC $srcfile"
332 if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
334 test -n "$obj" && $run $rm $obj
338 # If we have no pic_flag, then copy the object into place and finish.
339 if test -z "$pic_flag"; then
340 $show "$LN_S $obj $libobj"
341 $run $LN_S $obj $libobj
345 # Just move the object, then go on to compile the next one
346 $show "$mv $obj $libobj"
347 $run $mv $obj $libobj || exit 1
349 # Allow error messages only from the first compilation.
350 suppress_output=' >/dev/null 2>&1'
353 # Only build a position-dependent object if we build old libraries.
354 if test "$build_old_libs" = yes; then
355 # Suppress compiler output if we already did a PIC compilation.
356 $show "$base_compile $srcfile$suppress_output"
357 if $run eval "$base_compile \$srcfile$suppress_output"; then :
359 $run $rm $obj $libobj
364 # Create an invalid libtool object if no PIC, so that we do not
365 # accidentally link it into a program.
366 if test "$build_libtool_libs" != yes; then
367 $show "echo timestamp > $libobj"
368 $run eval "echo timestamp > \$libobj" || exit $?
376 modename="$modename: link"
379 compile_command="$CC"
380 finalize_command="$CC"
390 link_against_libtool_libs=
401 # We need to know -static, to get the right output filenames.
405 -all-static | -static)
406 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
407 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
409 build_libtool_libs=no
416 # See if our shared archives depend on static archives.
417 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
419 # Go through the arguments, transforming them on the way.
422 # If the previous option needs an argument, assign it.
423 if test -n "$prev"; then
426 compile_command="$compile_command @OUTPUT@"
427 finalize_command="$finalize_command @OUTPUT@"
434 *.la | *.lo) ;; # We handle these cases below.
436 dlprefiles="$dlprefiles $arg"
437 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
453 eval "$prev=\"\$arg\""
464 if test -n "$link_static_flag"; then
465 compile_command="$compile_command $link_static_flag"
466 finalize_command="$finalize_command $link_static_flag"
472 # FIXME: remove this flag sometime in the future.
473 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
488 if test "$export_dynamic" != yes; then
490 if test -n "$export_dynamic_flag_spec"; then
491 eval arg=\"$export_dynamic_flag_spec\"
496 # Add the symbol object into the linking commands.
497 compile_command="$compile_command @SYMFILE@"
498 finalize_command="$finalize_command @SYMFILE@"
503 dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
506 # Add the corresponding hardcode_libdir_flag, if it is not identical.
509 $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
513 deplibs="$deplibs $arg"
516 -l*) deplibs="$deplibs $arg" ;;
536 # If we have no pic_flag, then this is the same as -all-static.
537 if test -z "$pic_flag" && test -n "$link_static_flag"; then
538 compile_command="$compile_command $link_static_flag"
539 finalize_command="$finalize_command $link_static_flag"
549 # Some other compiler flag.
551 # Unknown arguments in both finalize_command and compile_command need
552 # to be aesthetically quoted because they are evaled later.
553 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
555 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
568 if test "$prev" = dlfiles; then
569 dlfiles="$dlfiles $arg"
570 if test "$build_libtool_libs" = yes; then
574 # If libtool objects are unsupported, then we need to preload.
579 if test "$prev" = dlprefiles; then
580 # Preload the old-style object.
581 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
584 libobjs="$libobjs $arg"
588 # A libtool-controlled library.
595 # Check to see that this really is a libtool archive.
596 if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
598 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
602 # If there is no directory component, then add one.
604 */* | *\\*) . $arg ;;
608 if test -z "$libdir"; then
609 $echo "$modename: \`$arg' contains no -rpath information" 1>&2
613 # Get the name of the library we link against.
615 for l in $old_library $library_names; do
619 if test -z "$linklib"; then
620 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
624 # Find the relevant object directory and library name.
625 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
626 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
627 if test "X$dir" = "X$arg"; then
633 # This library was specified with -dlopen.
634 if test "$prev" = dlfiles; then
635 dlfiles="$dlfiles $arg"
636 if test -z "$dlname"; then
637 # If there is no dlname, we need to preload.
640 # We should not create a dependency on this library, but we
641 # may need any libraries it requires.
642 compile_command="$compile_command$dependency_libs"
643 finalize_command="$finalize_command$dependency_libs"
649 # The library was specified with -dlpreopen.
650 if test "$prev" = dlprefiles; then
651 # Prefer using a static library (so that no silly _DYNAMIC symbols
652 # are required to link).
653 if test -n "$old_library"; then
654 dlprefiles="$dlprefiles $dir/$old_library"
656 dlprefiles="$dlprefiles $dir/$linklib"
661 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
662 link_against_libtool_libs="$link_against_libtool_libs $arg"
663 if test -n "$shlibpath_var"; then
664 # Make sure the rpath contains only unique directories.
665 case "$temp_rpath " in
667 *) temp_rpath="$temp_rpath $dir" ;;
671 # This is the magic to use -rpath.
672 if test -n "$hardcode_libdir_flag_spec"; then
673 if test -n "$hardcode_libdir_separator"; then
674 if test -z "$hardcode_libdirs"; then
675 # Put the magic libdir with the hardcode flag.
676 hardcode_libdirs="$libdir"
677 libdir="@HARDCODE_LIBDIRS@"
679 # Just accumulate the unique libdirs.
680 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
681 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
684 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
691 if test -n "$libdir"; then
692 eval flag=\"$hardcode_libdir_flag_spec\"
694 compile_command="$compile_command $flag"
695 finalize_command="$finalize_command $flag"
697 elif test -n "$runpath_var"; then
698 # Do the same for the permanent run path.
699 case "$perm_rpath " in
701 *) perm_rpath="$perm_rpath $libdir" ;;
706 case "$hardcode_action" in
708 if test "$hardcode_direct" = no; then
709 compile_command="$compile_command $dir/$linklib"
710 elif test "$hardcode_minus_L" = no; then
711 compile_command="$compile_command -L$dir -l$name"
712 elif test "$hardcode_shlibpath_var" = no; then
713 compile_shlibpath="$compile_shlibpath$dir:"
714 compile_command="$compile_command -l$name"
719 # We need an absolute path.
721 /* | [A-Za-z]:\\*) ;;
723 absdir=`cd "$dir" && pwd`
724 if test -z "$absdir"; then
725 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
732 if test "$hardcode_direct" = yes; then
733 compile_command="$compile_command $dir/$linklib"
734 elif test "$hardcode_minus_L" = yes; then
735 compile_command="$compile_command -L$dir -l$name"
736 elif test "$hardcode_shlibpath_var" = yes; then
737 compile_shlibpath="$compile_shlibpath$dir:"
738 compile_command="$compile_command -l$name"
743 $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2
748 # Finalize command for both is simple: just hardcode it.
749 if test "$hardcode_direct" = yes; then
750 finalize_command="$finalize_command $libdir/$linklib"
751 elif test "$hardcode_minus_L" = yes; then
752 finalize_command="$finalize_command -L$libdir -l$name"
753 elif test "$hardcode_shlibpath_var" = yes; then
754 finalize_shlibpath="$finalize_shlibpath$libdir:"
755 finalize_command="$finalize_command -l$name"
757 # We cannot seem to hardcode it, guess we'll fake it.
758 finalize_command="$finalize_command -L$libdir -l$name"
761 # Transform directly to old archives if we don't build new libraries.
762 if test -n "$pic_flag" && test -z "$old_library"; then
763 $echo "$modename: cannot find static library for \`$arg'" 1>&2
767 # Here we assume that one of hardcode_direct or hardcode_minus_L
768 # is not unsupported. This is valid on all known static and
770 if test "$hardcode_direct" != unsupported; then
771 test -n "$old_library" && linklib="$old_library"
772 compile_command="$compile_command $dir/$linklib"
773 finalize_command="$finalize_command $dir/$linklib"
775 compile_command="$compile_command -L$dir -l$name"
776 finalize_command="$finalize_command -L$dir -l$name"
780 # Add in any libraries that this one depends upon.
781 compile_command="$compile_command$dependency_libs"
782 finalize_command="$finalize_command$dependency_libs"
786 # Some other compiler argument.
788 # Unknown arguments in both finalize_command and compile_command need
789 # to be aesthetically quoted because they are evaled later.
790 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
792 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
799 # Now actually substitute the argument into the commands.
800 if test -n "$arg"; then
801 compile_command="$compile_command $arg"
802 finalize_command="$finalize_command $arg"
806 if test -n "$prev"; then
807 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
812 if test -n "$vinfo" && test -n "$release"; then
813 $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2
822 $echo "$modename: you must specify an output file" 1>&2
828 $echo "$modename: output file \`$output' must have no directory components" 1>&2
833 # Now set the variables for building old libraries.
834 build_libtool_libs=no
842 # Make sure we only generate libraries of the form `libNAME.la'.
846 $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
852 name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
853 eval libname=\"$libname_spec\"
855 # All the library-specific variables (install_libdir is set above).
863 if test -n "$objs"; then
864 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
868 # How the heck are we supposed to write a wrapper for a shared library?
869 if test -n "$link_against_libtool_libs"; then
870 $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
874 if test -n "$dlfiles$dlprefiles"; then
875 $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
876 # Nullify the symbol file.
877 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
878 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
881 if test -z "$rpath"; then
882 $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
888 if test $# -gt 2; then
889 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
893 # Parse the version information argument.
894 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
898 if test -n "$5"; then
899 $echo "$modename: too many parameters to \`-version-info'" 1>&2
904 test -n "$2" && current="$2"
905 test -n "$3" && revision="$3"
906 test -n "$4" && age="$4"
908 # Check that each of the things are valid numbers.
910 0 | [1-9] | [1-9][0-9]*) ;;
912 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
913 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
919 0 | [1-9] | [1-9][0-9]*) ;;
921 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
922 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
928 0 | [1-9] | [1-9][0-9]*) ;;
930 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
931 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
936 if test $age -gt $current; then
937 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
938 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
942 # Calculate the version variables.
943 version_vars="version_type current age revision"
944 case "$version_type" in
948 version_vars="$version_vars major versuffix"
949 major=`expr $current - $age`
950 versuffix="$major.$age.$revision"
954 version_vars="$version_vars versuffix verstring"
955 major=`expr $current - $age`
956 versuffix="$current.$age.$revision"
957 verstring="$versuffix"
959 # Add in all the interfaces that we are compatible with.
961 while test $loop != 0; do
962 iface=`expr $current - $loop`
963 loop=`expr $loop - 1`
964 verstring="$verstring:${iface}.0"
967 # Make executables depend on our current version.
968 verstring="$verstring:${current}.0"
972 version_vars="$version_vars major versuffix"
974 versuffix="$current.$revision"
978 version_vars="$version_vars major versuffix"
981 if [ X"$OBJFORMAT" = X ]; then
982 if [ -x /usr/bin/objformat ]; then
983 OBJECTFORMAT=`objformat`
987 if [ "$OBJFORMAT" = elf ]; then
988 versuffix="$current";
990 versuffix="$current.$revision";
995 $echo "$modename: unknown library version type \`$version_type'" 1>&2
996 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1001 # Create the output directory, or remove our outputs if we need to.
1002 if test -d $objdir; then
1003 $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
1004 $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
1006 $show "$mkdir $objdir"
1009 if test $status -eq 0 || test -d $objdir; then :
1015 # Check to see if the archive will have undefined symbols.
1016 if test "$allow_undefined" = yes; then
1017 if test "$allow_undefined_flag" = unsupported; then
1018 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1019 build_libtool_libs=no
1023 # Don't allow undefined symbols.
1024 allow_undefined_flag="$no_undefined_flag"
1027 # Add libc to deplibs on all systems.
1028 dependency_libs="$deplibs"
1029 deplibs="$deplibs -lc"
1031 if test "$build_libtool_libs" = yes; then
1032 # Get the real and link names of the library.
1033 eval library_names=\"$library_names_spec\"
1034 set dummy $library_names
1038 if test -n "$soname_spec"; then
1039 eval soname=\"$soname_spec\"
1044 lib="$objdir/$realname"
1047 linknames="$linknames $link"
1050 # Use standard objects if they are PIC.
1051 test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
1053 # Do each of the archive commands.
1054 eval cmds=\"$archive_cmds\"
1055 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1056 for cmd in $cmds; do
1059 $run eval "$cmd" || exit $?
1063 # Create links to the real library.
1064 for linkname in $linknames; do
1065 $show "(cd $objdir && $LN_S $realname $linkname)"
1066 $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
1069 # If -export-dynamic was specified, set the dlname.
1070 if test "$export_dynamic" = yes; then
1071 # On all known operating systems, these are identical.
1076 # Now set the variables for building old libraries.
1077 oldlib="$objdir/$libname.a"
1081 if test -n "$link_against_libtool_libs"; then
1082 $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
1086 if test -n "$deplibs"; then
1087 $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
1090 if test -n "$dlfiles$dlprefiles"; then
1091 $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
1092 # Nullify the symbol file.
1093 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1094 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1097 if test -n "$rpath"; then
1098 $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
1101 if test -n "$vinfo"; then
1102 $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
1105 if test -n "$release"; then
1106 $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
1111 if test -n "$objs"; then
1112 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1116 obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
1124 # Delete the old objects.
1125 $run $rm $obj $libobj
1127 # Create the old-style object.
1128 reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1131 eval cmds=\"$reload_cmds\"
1132 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1133 for cmd in $cmds; do
1136 $run eval "$cmd" || exit $?
1140 # Exit if we aren't doing a library object file.
1141 test -z "$libobj" && exit 0
1143 if test "$build_libtool_libs" != yes; then
1144 # Create an invalid libtool object if no PIC, so that we don't
1145 # accidentally link it into a program.
1146 $show "echo timestamp > $libobj"
1147 $run eval "echo timestamp > $libobj" || exit $?
1151 if test -n "$pic_flag"; then
1152 # Only do commands if we really have different PIC objects.
1153 reload_objs="$libobjs"
1155 eval cmds=\"$reload_cmds\"
1156 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1157 for cmd in $cmds; do
1160 $run eval "$cmd" || exit $?
1164 # Just create a symlink.
1165 $show "$LN_S $obj $libobj"
1166 $run $LN_S $obj $libobj || exit 1
1173 if test -n "$vinfo"; then
1174 $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
1177 if test -n "$release"; then
1178 $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
1181 if test -n "$rpath"; then
1182 # If the user specified any rpath flags, then add them.
1183 for libdir in $rpath; do
1184 if test -n "$hardcode_libdir_flag_spec"; then
1185 if test -n "$hardcode_libdir_separator"; then
1186 if test -z "$hardcode_libdirs"; then
1187 # Put the magic libdir with the hardcode flag.
1188 hardcode_libdirs="$libdir"
1189 libdir="@HARDCODE_LIBDIRS@"
1191 # Just accumulate the unique libdirs.
1192 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1193 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1196 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1203 if test -n "$libdir"; then
1204 eval flag=\"$hardcode_libdir_flag_spec\"
1206 compile_command="$compile_command $flag"
1207 finalize_command="$finalize_command $flag"
1209 elif test -n "$runpath_var"; then
1210 case "$perm_rpath " in
1212 *) perm_rpath="$perm_rpath $libdir" ;;
1218 # Substitute the hardcoded libdirs into the compile commands.
1219 if test -n "$hardcode_libdir_separator"; then
1220 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1221 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1224 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1225 # Transform all the library objects into standard objects.
1226 compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1227 finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1230 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1231 dlsyms="${output}S.c"
1236 if test -n "$dlsyms"; then
1237 # Add our own program objects to the preloaded list.
1238 dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1240 # Discover the nlist of each of the dlfiles.
1241 nlist="$objdir/${output}.nm"
1243 if test -d $objdir; then
1244 $show "$rm $nlist ${nlist}T"
1245 $run $rm "$nlist" "${nlist}T"
1247 $show "$mkdir $objdir"
1250 if test $status -eq 0 || test -d $objdir; then :
1256 for arg in $dlprefiles; do
1257 $show "extracting global C symbols from \`$arg'"
1258 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1261 # Parse the name list into a source file.
1262 $show "creating $objdir/$dlsyms"
1263 if test -z "$run"; then
1264 # Make sure we at least have an empty file.
1265 test -f "$nlist" || : > "$nlist"
1267 # Try sorting and uniquifying the output.
1268 if sort "$nlist" | uniq > "$nlist"T; then
1269 mv -f "$nlist"T "$nlist"
1270 wcout=`wc "$nlist" 2>/dev/null`
1271 count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
1272 (test "$count" -ge 0) 2>/dev/null || count=-1
1281 $echo > "$objdir/$dlsyms" "\
1282 /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1283 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1289 /* Prevent the only kind of declaration conflicts we can make. */
1290 #define dld_preloaded_symbol_count some_other_symbol
1291 #define dld_preloaded_symbols some_other_symbol
1293 /* External symbol declarations for the compiler. */\
1296 if test -f "$nlist"; then
1297 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1299 echo '/* NONE */' >> "$objdir/$dlsyms"
1302 $echo >> "$objdir/$dlsyms" "\
1304 #undef dld_preloaded_symbol_count
1305 #undef dld_preloaded_symbols
1307 #if defined (__STDC__) && __STDC__
1308 # define __ptr_t void *
1310 # define __ptr_t char *
1313 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1314 int dld_preloaded_symbol_count = $count;
1316 /* The mapping between symbol names and symbols. */
1321 dld_preloaded_symbols[] =
1325 if test -f "$nlist"; then
1326 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1329 $echo >> "$objdir/$dlsyms" "\
1340 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1346 # Now compile the dynamic symbol file.
1347 $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1348 $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
1350 # Transform the symbol file into the correct name.
1351 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1352 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1353 elif test "$export_dynamic" != yes; then
1354 test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1356 # We keep going just in case the user didn't refer to
1357 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1358 # really was required.
1359 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1361 # Nullify the symbol file.
1362 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1363 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1366 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1367 # Replace the output file specification.
1368 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1369 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1371 # We have no uninstalled library dependencies, so finalize right now.
1372 $show "$compile_command"
1373 $run eval "$compile_command"
1377 # Replace the output file specification.
1378 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
1379 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
1381 # Create the binary in the object directory, then wrap it.
1382 if test -d $objdir; then :
1384 $show "$mkdir $objdir"
1387 if test $status -eq 0 || test -d $objdir; then :
1393 if test -n "$shlibpath_var"; then
1394 # We should set the shlibpath_var
1396 for dir in $temp_rpath; do
1403 # Relative path: add a thisdir entry.
1404 rpath="$rpath\$thisdir/$dir:"
1411 # Delete the old output file.
1414 if test -n "$compile_shlibpath"; then
1415 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1417 if test -n "$finalize_shlibpath"; then
1418 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1421 if test -n "$runpath_var" && test -n "$perm_rpath"; then
1422 # We should set the runpath_var.
1424 for dir in $perm_rpath; do
1427 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1428 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1431 case "$hardcode_action" in
1433 # AGH! Flame the AIX and HP-UX people for me, will ya?
1434 $echo "$modename: warning: using a buggy system linker" 1>&2
1435 $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
1439 $show "$compile_command"
1440 $run eval "$compile_command" || exit $?
1442 # Now create the wrapper script.
1443 $show "creating $output"
1445 # Quote the finalize command for shipping.
1446 finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1448 # Quote $echo for shipping.
1449 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
1451 # Only actually do things if our run command is non-null.
1452 if test -z "$run"; then
1454 trap "$rm $output; exit 1" 1 2 15
1459 # $output - temporary wrapper script for $objdir/$output
1460 # Generated by ltmain.sh - GNU $PACKAGE $VERSION
1462 # The $output program cannot be directly executed until all the libtool
1463 # libraries that it depends on are installed.
1465 # This wrapper script should never be moved out of \``pwd`'.
1466 # If it is, it will not operate correctly.
1468 # Sed substitution that helps us do robust quoting. It backslashifies
1469 # metacharacters that are still active within double-quoted strings.
1470 Xsed='sed -e s/^X//'
1471 sed_quote_subst='$sed_quote_subst'
1473 # The HP-UX ksh and POSIX shell print the target directory to stdout
1475 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
1477 # This environment variable determines our operation mode.
1478 if test \"\$libtool_install_magic\" = \"$magic\"; then
1479 # install mode needs the following variables:
1480 link_against_libtool_libs='$link_against_libtool_libs'
1481 finalize_command=\"$finalize_command\"
1483 # When we are sourced in execute mode, \$file and \$echo are already set.
1484 if test \"\$libtool_execute_magic\" = \"$magic\"; then :
1492 # Find the directory that this script lives in.
1493 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1494 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1496 # Follow symbolic links until we get to the real thisdir.
1497 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
1498 while test -n \"\$file\"; do
1499 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
1501 # If there was a directory component, then change thisdir.
1502 if test \"x\$destdir\" != \"x\$file\"; then
1503 case \"\$destdir\" in
1504 /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;;
1505 *) thisdir=\"\$thisdir/\$destdir\" ;;
1509 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1510 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
1513 # Try to get the absolute directory name.
1514 absdir=\`cd \"\$thisdir\" && pwd\`
1515 test -n \"\$absdir\" && thisdir=\"\$absdir\"
1517 progdir=\"\$thisdir/$objdir\"
1520 if test -f \"\$progdir/\$program\"; then"
1522 # Export our shlibpath_var if we have one.
1523 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1525 # Add our own library path to $shlibpath_var
1526 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1528 # Some systems cannot cope with colon-terminated $shlibpath_var
1529 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
1531 export $shlibpath_var
1536 if test \"\$libtool_execute_magic\" != \"$magic\"; then
1537 # Run the actual program with our arguments.
1539 # Export the path to the program.
1540 PATH=\"\$progdir:\$PATH\"
1543 exec \$program \${1+\"\$@\"}
1545 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
1549 # The program doesn't exist.
1550 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
1551 \$echo \"This script is just a wrapper for \$program.\" 1>&2
1552 echo \"See the $PACKAGE documentation for more information.\" 1>&2
1563 # See if we need to build an old-fashioned archive.
1564 if test "$build_old_libs" = "yes"; then
1565 # Transform .lo files to .o files.
1566 oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
1568 # Do each command in the archive commands.
1569 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1570 eval cmds=\"$old_archive_from_new_cmds\"
1572 eval cmds=\"$old_archive_cmds\"
1574 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1575 for cmd in $cmds; do
1578 $run eval "$cmd" || exit $?
1583 # Now create the libtool archive.
1587 test "$build_old_libs" = yes && old_library="$libname.a"
1589 $show "creating $output"
1591 # Only create the output if not a dry run.
1592 if test -z "$run"; then
1594 # $output - a libtool library file
1595 # Generated by ltmain.sh - GNU $PACKAGE $VERSION
1597 # The name that we can dlopen(3).
1600 # Names of this library.
1601 library_names='$library_names'
1603 # The name of the static archive.
1604 old_library='$old_library'
1606 # Libraries that this one depends upon.
1607 dependency_libs='$dependency_libs'
1609 # Version information for $libname.
1614 # Directory that this library needs to be installed in:
1615 libdir='$install_libdir'\
1619 # Do a symbolic link so that the libtool archive can be found in
1620 # LD_LIBRARY_PATH before the program is installed.
1621 $show "(cd $objdir && $LN_S ../$output $output)"
1622 $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
1628 # libtool install mode
1630 modename="$modename: install"
1632 # There may be an optional /bin/sh argument at the beginning of
1633 # install_prog (especially on Windows NT).
1634 if test "$nonopt" = "$SHELL"; then
1635 # Aesthetically quote it.
1636 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
1638 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1642 install_prog="$arg "
1650 # The real first argument should be the name of the installation program.
1651 # Aesthetically quote it.
1652 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1654 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1658 install_prog="$install_prog$arg"
1660 # We need to accept at least all the BSD install flags.
1670 if test -n "$dest"; then
1671 files="$files $dest"
1689 # If the previous option needed an argument, then skip it.
1690 if test -n "$prev"; then
1699 # Aesthetically quote the argument.
1700 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1702 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1706 install_prog="$install_prog $arg"
1709 if test -z "$install_prog"; then
1710 $echo "$modename: you must specify an install program" 1>&2
1715 if test -n "$prev"; then
1716 $echo "$modename: the \`$prev' option requires an argument" 1>&2
1721 if test -z "$files"; then
1722 if test -z "$dest"; then
1723 $echo "$modename: no file or destination specified" 1>&2
1725 $echo "$modename: you must specify a destination" 1>&2
1731 # Strip any trailing slash from the destination.
1732 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
1734 # Check to see that the destination is a directory.
1735 test -d "$dest" && isdir=yes
1736 if test -n "$isdir"; then
1740 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
1741 test "X$destdir" = "X$dest" && destdir=.
1742 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
1744 # Not a directory, so check to see that there is only one file specified.
1746 if test $# -gt 2; then
1747 $echo "$modename: \`$dest' is not a directory" 1>&2
1753 /* | [A-Za-z]:\\*) ;;
1755 for file in $files; do
1759 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
1768 # This variable tells wrapper scripts just to set variables rather
1769 # than running their programs.
1770 libtool_install_magic="$magic"
1775 for file in $files; do
1777 # Do each installation.
1780 # Do the static libraries later.
1781 staticlibs="$staticlibs $file"
1785 # Check to see that this really is a libtool archive.
1786 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
1788 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
1795 # If there is no directory component, then add one.
1797 */* | *\\*) . $file ;;
1801 # Add the libdir to current_libdirs if it is the destination.
1802 if test "X$destdir" = "X$libdir"; then
1803 case "$current_libdirs " in
1805 *) current_libdirs="$current_libdirs $libdir" ;;
1808 # Note the libdir as a future libdir.
1809 case "$future_libdirs " in
1811 *) future_libdirs="$future_libdirs $libdir" ;;
1815 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
1816 test "X$dir" = "X$file/" && dir=
1819 # See the names of the shared library.
1820 set dummy $library_names
1821 if test -n "$2"; then
1826 # Install the shared library and build the symlinks.
1827 $show "$install_prog $dir/$realname $destdir/$realname"
1828 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1829 test "X$dlname" = "X$realname" && dlname=
1831 if test $# -gt 0; then
1832 # Delete the old symlinks.
1836 rmcmd="$rmcmd $destdir/$linkname"
1841 # ... and create new ones.
1844 test "X$dlname" = "X$linkname" && dlname=
1845 $show "(cd $destdir && $LN_S $realname $linkname)"
1846 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1850 if test -n "$dlname"; then
1851 # Install the dynamically-loadable library.
1852 $show "$install_prog $dir/$dlname $destdir/$dlname"
1853 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1856 # Do each command in the postinstall commands.
1857 lib="$destdir/$realname"
1858 eval cmds=\"$postinstall_cmds\"
1859 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1860 for cmd in $cmds; do
1863 $run eval "$cmd" || exit $?
1868 # Install the pseudo-library for information purposes.
1869 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1870 $show "$install_prog $file $destdir/$name"
1871 $run eval "$install_prog $file $destdir/$name" || exit $?
1873 # Maybe install the static library, too.
1874 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1878 # Install (i.e. copy) a libtool object.
1880 # Figure out destination file name, if it wasn't already specified.
1881 if test -n "$destname"; then
1882 destfile="$destdir/$destname"
1884 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1885 destfile="$destdir/$destfile"
1888 # Deduce the name of the destination old-style object file.
1891 staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'`
1894 staticdest="$destfile"
1898 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
1904 # Install the libtool object if requested.
1905 if test -n "$destfile"; then
1906 $show "$install_prog $file $destfile"
1907 $run eval "$install_prog $file $destfile" || exit $?
1910 # Install the old object if enabled.
1911 if test "$build_old_libs" = yes; then
1912 # Deduce the name of the old-style object file.
1913 staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'`
1915 $show "$install_prog $staticobj $staticdest"
1916 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
1922 # Do a test to see if this is really a libtool program.
1923 if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
1924 link_against_libtool_libs=
1927 # If there is no directory component, then add one.
1929 */* | *\\*) . $file ;;
1933 # Check the variables that should have been set.
1934 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
1935 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
1940 for lib in $link_against_libtool_libs; do
1941 # Check to see that each library is installed.
1943 if test -f "$lib"; then
1944 # If there is no directory component, then add one.
1946 */* | *\\*) . $lib ;;
1950 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
1951 if test -z "$libdir"; then
1952 $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2
1953 elif test -f "$libfile"; then :
1955 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1960 if test "$hardcode_action" = relink; then
1961 if test "$finalize" = yes; then
1962 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1963 $show "$finalize_command"
1964 if $run eval "$finalize_command"; then :
1966 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
1969 file="$objdir/$file"T
1971 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1974 # Install the binary that we compiled earlier.
1975 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
1979 $show "$install_prog$stripme $file $dest"
1980 $run eval "$install_prog\$stripme \$file \$dest" || exit $?
1985 for file in $staticlibs; do
1986 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1988 # Set up the ranlib parameters.
1989 oldlib="$destdir/$name"
1991 $show "$install_prog $file $oldlib"
1992 $run eval "$install_prog \$file \$oldlib" || exit $?
1994 # Do each command in the postinstall commands.
1995 eval cmds=\"$old_postinstall_cmds\"
1996 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1997 for cmd in $cmds; do
2000 $run eval "$cmd" || exit $?
2005 if test -n "$future_libdirs"; then
2006 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
2009 if test -n "$current_libdirs"; then
2010 # Maybe just do a dry run.
2011 test -n "$run" && current_libdirs=" -n$current_libdirs"
2012 exec $SHELL $0 --finish$current_libdirs
2019 # libtool finish mode
2021 modename="$modename: finish"
2024 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2027 libdirs="$libdirs $dir"
2030 for libdir in $libdirs; do
2031 if test -n "$finish_cmds"; then
2032 # Do each command in the finish commands.
2033 eval cmds=\"$finish_cmds\"
2034 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2035 for cmd in $cmds; do
2042 if test -n "$finish_eval"; then
2043 # Do the single finish_eval.
2044 eval cmds=\"$finish_eval\"
2050 echo "------------------------------------------------------------------------------"
2051 echo "Libraries have been installed in:"
2052 for libdir in $libdirs; do
2056 echo "To link against installed libraries in a given directory, LIBDIR,"
2057 echo "you must use the \`-LLIBDIR' flag during linking."
2059 echo " You will also need to do one of the following:"
2060 if test -n "$shlibpath_var"; then
2061 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2062 echo " during execution"
2064 if test -n "$runpath_var"; then
2065 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2066 echo " during linking"
2068 if test -n "$hardcode_libdir_flag_spec"; then
2070 eval flag=\"$hardcode_libdir_flag_spec\"
2072 echo " - use the \`$flag' linker flag"
2074 if test -f /etc/ld.so.conf; then
2075 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2078 echo "See any operating system documentation about shared libraries for"
2079 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2080 echo "------------------------------------------------------------------------------"
2084 # libtool execute mode
2086 modename="$modename: execute"
2088 # The first argument is the command name.
2090 if test -z "$cmd"; then
2091 $echo "$modename: you must specify a COMMAND" 1>&2
2096 # Handle -dlopen flags immediately.
2097 for file in $execute_dlfiles; do
2098 if test -f "$file"; then :
2100 $echo "$modename: \`$file' is not a file" 1>&2
2108 # Check to see that this really is a libtool archive.
2109 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
2111 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2116 # Read the libtool library.
2120 # If there is no directory component, then add one.
2122 */* | *\\*) . $file ;;
2126 # Skip this library if it cannot be dlopened.
2127 if test -z "$dlname"; then
2128 # Warn if it was a shared library.
2129 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2133 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2134 test "X$dir" = "X$file" && dir=.
2136 if test -f "$dir/$objdir/$dlname"; then
2139 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2145 # Just add the directory containing the .lo file.
2146 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2147 test "X$dir" = "X$file" && dir=.
2151 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2156 # Get the absolute pathname.
2157 absdir=`cd "$dir" && pwd`
2158 test -n "$absdir" && dir="$absdir"
2160 # Now add the directory to shlibpath_var.
2161 if eval "test -z \"\$$shlibpath_var\""; then
2162 eval "$shlibpath_var=\"\$dir\""
2164 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2168 # This variable tells wrapper scripts just to set shlibpath_var
2169 # rather than running their programs.
2170 libtool_execute_magic="$magic"
2172 # Check if any of the arguments is a wrapper script.
2179 # Do a test to see if this is really a libtool program.
2180 if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
2181 # If there is no directory component, then add one.
2183 */* | *\\*) . $file ;;
2187 # Transform arg to wrapped name.
2188 file="$progdir/$program"
2192 # Quote arguments (to preserve shell metacharacters).
2193 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
2194 args="$args \"$file\""
2197 if test -z "$run"; then
2198 # Export the shlibpath_var.
2199 eval "export $shlibpath_var"
2201 # Now actually exec the command.
2202 eval "exec \$cmd$args"
2204 $echo "$modename: cannot exec \$cmd$args"
2207 # Display what would be done.
2208 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2209 $echo "export $shlibpath_var"
2215 # libtool uninstall mode
2217 modename="$modename: uninstall"
2224 -*) rm="$rm $arg" ;;
2225 *) files="$files $arg" ;;
2229 if test -z "$rm"; then
2230 $echo "$modename: you must specify an RM program" 1>&2
2235 for file in $files; do
2236 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2237 test "X$dir" = "X$file" && dir=.
2238 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2244 # Possibly a libtool archive, so verify it.
2245 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
2248 # Delete the libtool libraries and symlinks.
2249 for n in $library_names; do
2250 rmfiles="$rmfiles $dir/$n"
2251 test "X$n" = "X$dlname" && dlname=
2253 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2254 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2256 $show "$rm $rmfiles"
2259 if test -n "$library_names"; then
2260 # Do each command in the postuninstall commands.
2261 eval cmds=\"$postuninstall_cmds\"
2262 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2263 for cmd in $cmds; do
2271 if test -n "$old_library"; then
2272 # Do each command in the old_postuninstall commands.
2273 eval cmds=\"$old_postuninstall_cmds\"
2274 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2275 for cmd in $cmds; do
2283 # FIXME: should reinstall the best remaining shared library.
2288 if test "$build_old_libs" = yes; then
2289 oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'`
2290 rmfiles="$rmfiles $dir/$oldobj"
2292 $show "$rm $rmfiles"
2297 $show "$rm $rmfiles"
2306 $echo "$modename: you must specify a MODE" 1>&2
2307 $echo "$generic_help" 1>&2
2312 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2313 $echo "$generic_help" 1>&2
2315 fi # test -z "$show_help"
2317 # We need to display help for each of the modes.
2320 "Usage: $modename [OPTION]... [MODE-ARG]...
2322 Provide generalized library-building support services.
2324 -n, --dry-run display commands without modifying any files
2325 --features display configuration information and exit
2326 --finish same as \`--mode=finish'
2327 --help display this help message and exit
2328 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
2329 --quiet same as \`--silent'
2330 --silent don't print informational messages
2331 --version print version information
2333 MODE must be one of the following:
2335 compile compile a source file into a libtool object
2336 execute automatically set library path, then run a program
2337 finish complete the installation of libtool libraries
2338 install install libraries or executables
2339 link create a library or an executable
2340 uninstall remove libraries from an installed directory
2342 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
2343 a more detailed description of MODE."
2349 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2351 Compile a source file into a libtool library object.
2353 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2354 from the given SOURCEFILE.
2356 The output file name is determined by removing the directory component from
2357 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2358 library object suffix, \`.lo'."
2363 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2365 Automatically set library path, then run a program.
2367 This mode accepts the following additional options:
2369 -dlopen FILE add the directory containing FILE to the library path
2371 This mode sets the library path environment variable according to \`-dlopen'
2374 If any of the ARGS are libtool executable wrappers, then they are translated
2375 into their corresponding uninstalled binary, and any of their required library
2376 directories are added to the library path.
2378 Then, COMMAND is executed, with ARGS as arguments."
2383 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2385 Complete the installation of libtool libraries.
2387 Each LIBDIR is a directory that contains libtool libraries.
2389 The commands that this mode executes may require superuser privileges. Use
2390 the \`--dry-run' option if you just want to see what would be executed."
2395 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2397 Install executables or libraries.
2399 INSTALL-COMMAND is the installation command. The first component should be
2400 either the \`install' or \`cp' program.
2402 The rest of the components are interpreted as arguments to that command (only
2403 BSD-compatible install options are recognized)."
2408 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
2410 Link object files or libraries together to form another library, or to
2411 create an executable program.
2413 LINK-COMMAND is a command using the C compiler that you would use to create
2414 a program from several object files.
2416 The following components of LINK-COMMAND are treated specially:
2418 -all-static do not do any dynamic linking at all
2419 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2420 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
2421 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
2422 -LLIBDIR search LIBDIR for required installed libraries
2423 -lNAME OUTPUT-FILE requires the installed library libNAME
2424 -no-undefined declare that a library does not refer to external symbols
2425 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
2426 -release RELEASE specify package release information
2427 -rpath LIBDIR the created library will eventually be installed in LIBDIR
2428 -static do not do any dynamic linking of libtool libraries
2429 -version-info CURRENT[:REVISION[:AGE]]
2430 specify library version info [each variable defaults to 0]
2432 All other options (arguments beginning with \`-') are ignored.
2434 Every other argument is treated as a filename. Files ending in \`.la' are
2435 treated as uninstalled libtool libraries, other files are standard or library
2438 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
2439 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
2441 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
2444 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
2445 created, otherwise an executable program is created."
2450 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
2452 Remove libraries from an installation directory.
2454 RM is the name of the program to use to delete files associated with each FILE
2455 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2458 If FILE is a libtool library, all the files associated with it are deleted.
2459 Otherwise, only FILE itself is deleted using RM."
2463 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2470 $echo "Try \`$modename --help' for more information about other modes."