1 # ltmain.sh - Provide generalized library-building support services.
2 # Generated automatically from ltmain.sh.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%^.*/%%'`
34 help="Try \`$progname --help' for more information."
37 magic
="%%%MAGIC variable%%%"
43 if test "$LTCONFIG_VERSION" != "$VERSION"; then
44 echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
45 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
50 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
51 echo "$progname: not configured to build any kind of library" 1>&2
52 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
65 # Parse our command line options once, thoroughly.
72 -*=*) optarg
=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
76 # If the previous option needs an argument, assign it.
77 if test -n "$prev"; then
84 # Have we seen a non-optional argument yet?
91 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
101 if test "$build_libtool_libs" = yes; then
102 echo "enable shared libraries"
104 echo "disable shared libraries"
106 if test "$build_old_libs" = yes; then
107 echo "enable static libraries"
109 echo "disable static libraries"
114 --finish) mode
="finish" ;;
116 --mode) prevopt
="--mode" prev
=mode
;;
117 --mode=*) mode
="$optarg" ;;
120 echo "$progname: unrecognized option \`$arg'" 1>&2
133 if test -n "$prevopt"; then
134 echo "$progname: option \`$prevopt' requires an argument" 1>&2
140 if test -z "$show_help"; then
142 # Infer the operation mode.
143 if test "$mode" = NONE
; then
146 if echo " $@ " |
egrep "[ ]-c[ ]" > /dev
/null
2>&1; then
162 # Just use the default operation mode.
163 if test "$mode" = NONE
; then
164 if test -n "$nonopt"; then
165 echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
167 echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
174 # Change the help message to a mode-specific one.
176 help="Try \`$progname --help --mode=$mode' for more information."
178 # These modes are in order of execution frequency so that they run quickly.
180 # libtool compile mode
182 progname
="$progname: compile"
183 # Get the compilation command and the source file.
184 base_compile
="$nonopt"
190 # Quote any args containing shell metacharacters.
192 *" "*|
*" "*|
*[\
[\
]\~\
#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*|*\"*)
193 quote_arg
="'$arg'" ;;
194 *) quote_arg
="$arg" ;;
197 base_compile
="$base_compile$lastarg"
202 # Get the name of the library object.
203 libobj
=`echo "$srcfile" | sed -e 's%^.*/%%'`
205 # Recognize several different file suffixes.
208 *.c
++) xform
='c++' ;;
213 *.
for) xform
='for' ;;
216 libobj
=`echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
219 *.lo
) obj
=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
221 echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2
226 if test -z "$base_compile"; then
227 echo "$progname: you must specify a compilation command" 1>&2
232 # Delete any old library objects.
233 $run $rm $obj $libobj
234 trap "$run $rm $obj $libobj; exit 1" 1 2 15
236 # Only build a PIC object if we are building libtool libraries.
237 if test "$build_libtool_libs" = yes; then
238 # All platforms use -DPIC, to notify preprocessed assembler code.
239 $show "$base_compile$pic_flag -DPIC $srcfile"
240 if eval "$run $base_compile$pic_flag -DPIC $srcfile"; then :
246 # If we have no pic_flag, then copy the object into place and finish.
247 if test -z "$pic_flag"; then
248 $show "$ln_s $obj $libobj"
249 $run $ln_s $obj $libobj ||
$run $cp_p $obj $libobj
253 # Just move the object, then go on to compile the next one
254 $show "$mv $obj $libobj"
255 $run $mv $obj $libobj ||
exit 1
258 # Compile the position-dependent object.
259 $show "$base_compile $srcfile"
260 if eval "$run $base_compile $srcfile"; then :
262 $run $rm $obj $libobj
266 # Symlink or copy the object file into library object, if no PIC.
267 if test "$build_libtool_libs" != yes; then
268 $show "$ln_s $obj $libobj"
269 $run $ln_s $obj $libobj ||
$run $cp_p $obj $libobj
278 progname
="$progname: link"
279 # Go through the arguments, transforming them on the way.
282 compile_command
="$cc"
283 finalize_command
="$cc"
291 link_against_libtool_libs
=
302 # We need to know -static, to get the right output filenames.
304 *" -static "*) build_libtool_libs
=no build_old_libs
=yes ;;
309 # If the previous option needs an argument, assign it.
310 if test -n "$prev"; then
313 compile_command
="$compile_command @OUTPUT@"
314 finalize_command
="$finalize_command @OUTPUT@"
331 compile_command
="$compile_command $export_dynamic_flag"
332 finalize_command
="$finalize_command $export_dynamic_flag"
337 dir
=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
342 echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
346 deplibs
="$deplibs $arg"
349 -l*) deplibs
="$deplibs $arg" ;;
351 -no-whole-archive) whole_archive
=no
;;
361 link_static
="`eval echo \"$link_static_flag\"`"
362 compile_command
="$compile_command $link_static"
367 echo "$progname: \`-version-file' has been replaced by \`-version-info'" 1>&2
377 -whole-archive) whole_archive
=yes ;;
379 -*) cc
="$cc $arg" ;; # Some other compiler flag.
387 # Find the relevant object directory and library name.
388 file=`echo "$arg" | sed 's%^.*/%%'`
389 dir
=`echo "$arg" | sed 's%/[^/]*$%/%'`
390 test "$dir" = "$arg" && dir
=
392 # If -whole-archive was specified, we need to link all the members.
393 if test "$whole_archive" = yes; then
394 if test -f $arg; then :
396 echo "$progname: \`$arg' does not exist" 1>&2
401 # Get the names of the members of the archive.
402 members
=`$AR t $arg 2>/dev/null`
403 for m
in $members; do
405 *.lo
) libobjs
="$libobjs $dir$m" ;;
407 if test "$build_libtool_libs" = yes; then
410 libobjs
="$libobjs $dir$m"
415 elif test -f "$dir$objdir/$file"; then
416 # .libs/libfoo.a exists, so this is an archive of libobjects.
417 libobjs
="$libobjs $arg"
426 libobjs
="$libobjs $arg"
430 # A libtool-controlled library.
436 # Check to see that this really is a libtool archive.
437 if egrep "^# Generated by $PROGRAM" $arg >/dev
/null
2>&1; then :
439 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
443 # If there is no directory component, then add one.
449 if test -z "$libdir"; then
450 echo "$progname: \`$arg' contains no -rpath information" 1>&2
454 # Get the name of the library we link against.
456 for l
in $old_library $library_names; do
460 if test -z "$linklib"; then
461 echo "$progname: cannot find name of link library for \`$arg'" 1>&2
465 # Find the relevant object directory and library name.
466 name
=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'`
467 dir
=`echo "$arg" | sed 's%/[^/]*$%%'`
468 if test "$dir" = "$arg"; then
474 link_against_libtool_libs
="$link_against_libtool_libs $arg"
476 if test "$build_libtool_libs" = yes; then
477 if test -n "$shlibpath_var"; then
478 # Make sure the rpath contains only unique directories.
479 case "$temp_rpath " in
481 *) temp_rpath
="$temp_rpath $dir" ;;
485 if test -n "$hardcode_libdir_flag_spec"; then
486 if test -n "$hardcode_libdir_separator"; then
487 if test -z "$hardcode_libdirs"; then
488 # Put the magic libdir with the hardcode flag.
489 hardcode_libdirs
="$libdir"
490 libdir
="@HARDCODE_LIBDIRS@"
492 # Just accumulate the libdirs.
493 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
498 if test -n "$libdir"; then
499 hardcode_libdir_flag
=`eval echo \"$hardcode_libdir_flag_spec\"`
500 compile_command
="$compile_command $hardcode_libdir_flag"
501 finalize_command
="$finalize_command $hardcode_libdir_flag"
505 case "$hardcode_action" in
507 if test "$hardcode_direct" = no
; then
508 compile_command
="$compile_command $dir/$linklib"
509 elif test "$hardcode_minus_L" = no
; then
510 compile_command
="$compile_command -L$dir -l$name"
511 elif test "$hardcode_shlibpath_var" = no
; then
512 compile_shlibpath
="$compile_shlibpath$dir:"
513 compile_command
="$compile_command -l$name"
518 # We need an absolute path.
522 absdir
=`cd "$dir" && pwd`
523 if test -z "$absdir"; then
524 echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
531 if test "$hardcode_direct" = yes; then
532 compile_command
="$compile_command $dir/$linklib"
533 elif test "$hardcode_minus_L" = yes; then
534 compile_command
="$compile_command -L$dir -l$name"
535 elif test "$hardcode_shlibpath_var" = yes; then
536 compile_shlibpath
="$compile_shlibpath$dir:"
537 compile_command
="$compile_command -l$name"
542 echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
547 # Finalize command for both is simple: just hardcode it.
548 if test "$hardcode_direct" = yes; then
549 finalize_command
="$finalize_command $libdir/$linklib"
550 elif test "$hardcode_minus_L" = yes; then
551 finalize_command
="$finalize_command -L$libdir -l$name"
552 elif test "$hardcode_shlibpath_var" = yes; then
553 finalize_shlibpath
="$finalize_shlibpath$libdir:"
554 finalize_command
="$finalize_command -l$name"
556 # We can't seem to hardcode it, guess we'll fake it.
557 finalize_command
="$finalize_command -L$libdir -l$name"
560 # Transform directly to old archives if we don't build new libraries.
561 test -z "$old_library" || linklib
="$old_library"
562 compile_command
="$compile_command $dir/$linklib"
563 finalize_command
="$finalize_command $dir/$linklib"
569 echo "$progname: unknown file suffix for \`$arg'" 1>&2
575 compile_command
="$compile_command $arg"
576 finalize_command
="$finalize_command $arg"
579 if test -n "$prev"; then
580 echo "$progname: the \`$prevarg' option requires an argument" 1>&2
585 # Substitute the hardcoded libdirs into the compile commands.
586 if test "$hardcode_libdir_colon_separated" = yes; then
587 compile_command
=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
588 finalize_command
=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
595 echo "$progname: you must specify an output file" 1>&2
601 echo "$progname: output file \`$output' must have no directory components" 1>&2
607 libname
=`echo "$output" | sed 's/\.a$//'`
610 if test -n "$install_libdir"; then
611 echo "$progname: warning: \`-rpath' is ignored while linking old-style libraries" 1>&2
614 if test -n "$vinfo"; then
615 echo "$progname: warning: \`-version-info' is ignored while linking old-style libraries" 1>&2
620 libname
=`echo "$output" | sed 's/\.la$//'`
622 # All the library-specific variables (install_libdir is set above).
630 if test -n "$objs"; then
631 echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
635 # How the heck are we supposed to write a wrapper for a shared library?
636 if test -n "$link_against_libtool_libs"; then
637 echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
641 if test -z "$install_libdir"; then
642 echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
646 # Parse the version information argument.
647 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=':'
651 if test -n "$5"; then
652 echo "$progname: too many parameters to \`-version-info'" 1>&2
657 test -n "$2" && current
="$2"
658 test -n "$3" && revision
="$3"
659 test -n "$4" && age
="$4"
661 # Check that each of the things are valid numbers.
663 0 |
[1-9] |
[1-9][0-9]*) ;;
665 echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
666 echo "$progname: \`$vinfo' is not valid version information" 1>&2
672 0 |
[1-9] |
[1-9][0-9]*) ;;
674 echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
675 echo "$progname: \`$vinfo' is not valid version information" 1>&2
681 0 |
[1-9] |
[1-9][0-9]*) ;;
683 echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
684 echo "$progname: \`$vinfo' is not valid version information" 1>&2
689 if test $age -gt $current; then
690 echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
691 echo "$progname: \`$vinfo' is not valid version information" 1>&2
695 # Calculate the version variables.
696 version_vars
="version_type current age revision"
697 case "$version_type" in
701 version_vars
="$version_vars major versuffix"
702 major
=`expr $current - $age`
703 versuffix
="$major.$age.$revision"
707 version_vars
="$version_vars versuffix verstring"
708 major
=`expr $current - $age`
709 versuffix
="$current.$age.$revision"
710 verstring
="$versuffix"
712 # Add in all the interfaces that we are compatible with.
714 while test $loop != 0; do
715 iface
=`expr $current - $loop`
716 loop
=`expr $loop - 1`
717 verstring
="$verstring:${iface}.0"
720 # Make executables depend on our current version.
721 verstring
="$verstring:${current}.0"
725 version_vars
="$version_vars major versuffix"
727 versuffix
="$current.$revision"
731 echo "$progname: unknown library version type \`$version_type'" 1>&2
732 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
737 # Create the output directory, or remove our outputs if we need to.
738 if test -d $objdir; then
739 $show "$rm $objdir/$libname.*"
740 $run $rm $objdir/$libname.
*
742 $show "$mkdir $objdir"
743 $run $mkdir $objdir ||
exit $?
746 if test "$build_libtool_libs" = yes; then
747 # Get the real and link names of the library.
748 library_names
=`eval echo \"$library_names_spec\"`
749 set dummy
$library_names
753 if test -n "$soname_spec"; then
754 soname
=`eval echo \"$soname_spec\"`
759 lib
="$objdir/$realname"
763 linknames
="$linknames $objdir/$link"
766 # Use standard objects if they are PIC.
767 test -z "$pic_flag" && libobjs
=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'`
769 # Do each of the archive commands.
770 cmds
=`eval echo \"$archive_cmds\"`
771 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
775 eval "$run $cmd" ||
exit $?
779 # Create links to the real library.
780 for link
in $linknames; do
781 $show "$ln_s $realname $link"
782 $run $ln_s $realname $link ||
exit $?
785 # If -export-dynamic was specified, set the dlname.
786 if test "$export_dynamic" = yes; then
787 # On all known operating systems, these are identical.
794 if test -n "$link_against_libtool_libs"; then
795 echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
799 if test -n "$deplibs"; then
800 echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
803 if test -n "$install_libdir"; then
804 echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
807 if test -n "$vinfo"; then
808 echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
813 if test -n "$objs"; then
814 echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
818 obj
=`echo "$output" | sed 's/\.lo$/.o/'`
826 # Delete the old objects.
827 $run $rm $obj $libobj
829 # Create the old-style object (skipping any convenience libraries).
830 # FIXME: skipping them is simplistic. We should determine which members
831 # are actually needed to resolve symbols.
832 reload_objs
="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
835 cmds
=`eval echo \"$reload_cmds\"`
836 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
840 eval "$run $cmd" ||
exit $?
844 # Exit if we aren't doing a library object file.
845 test -z "$libobj" && exit 0
847 if test "$build_libtool_libs" = yes && test -n "$pic_flag"; then
848 # Only do commands if we really have different PIC objects.
849 reload_objs
="$libobjs"
851 cmds
=`eval echo \"$reload_cmds\"`
852 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
856 eval "$run $cmd" ||
exit $?
860 # Just create a symlink.
861 $show "$ln_s $obj $libobj"
862 $run $ln_s $obj $libobj ||
$run $cp_p $obj $libobj ||
exit 1
869 if test -n "$install_libdir"; then
870 echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2
873 if test -n "$vinfo"; then
874 echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2
877 if test -n "$libobjs"; then
878 # Transform all the library objects into standard objects.
879 compile_command
=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
882 if test -z "$link_against_libtool_libs" ||
test "$build_libtool_libs" != yes; then
883 # Replace the output file specification.
884 compile_command
=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
885 finalize_command
=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
887 # We have no uninstalled library dependencies, so finalize right now.
888 $show "$compile_command"
889 $run $compile_command
892 # If we failed to link statically, then try again.
893 if test $status -ne 0 && test -n "$link_static"; then
894 echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2
895 compile_command
=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"`
896 $show "$finalize_command"
897 $run $finalize_command
903 # Replace the output file specification.
904 compile_command
=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
905 finalize_command
=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
907 # Create the binary in the object directory, then wrap it.
908 if test -d $objdir; then :
910 $show "$mkdir $objdir"
911 $run $mkdir $objdir ||
exit $?
914 if test -n "$shlibpath_var"; then
915 # We should set the shlibpath_var
917 for dir
in $temp_rpath; do
924 # Relative path: add a thisdir entry.
925 rpath
="$rpath\$thisdir/$dir:"
931 # Delete the old output file.
934 if test -n "$compile_shlibpath"; then
935 compile_command
="$shlibpath_var=$compile_shlibpath\$$shlibpath_var $compile_command"
937 if test -n "$finalize_shlibpath"; then
938 finalize_command
="$shlibpath_var=$finalize_shlibpath\$$shlibpath_var $finalize_command"
941 case "$hardcode_action" in
943 # AGH! Flame the AIX and HP-UX people for me, will ya?
944 echo "$progname: warning: using a buggy system linker" 1>&2
945 echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
949 $show "$compile_command"
950 eval "$run $compile_command" ||
exit $?
952 # Now create the wrapper script.
953 echo "creating $output"
955 # Only actually do things if our run command is non-null.
956 if test -z "$run"; then
958 trap "$rm $output; exit 1" 1 2 15
963 # $output - temporary wrapper script for $objdir/$output
964 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
966 # The $output program cannot be directly executed until all the libtool
967 # libraries that it depends on are installed.
969 # This wrapper script should never be moved out of \``pwd`'.
970 # If it is, it will not operate correctly.
972 # This environment variable determines our operation mode.
973 if test "\$libtool_install_magic" = "$magic"; then
974 # install mode needs the following variables:
975 link_against_libtool_libs="$link_against_libtool_libs"
976 finalize_command="$finalize_command"
978 # Find the directory that this script lives in.
979 thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\`
980 test "x\$thisdir" = "x\$0" && thisdir=.
982 # Try to get the absolute directory name.
983 absdir=\`cd "\$thisdir" && pwd\`
984 test -n "\$absdir" && thisdir="\$absdir"
986 progdir="\$thisdir/$objdir"
989 if test -f "\$progdir/\$program"; then
990 # Run the actual program with our arguments.
994 # Quote arguments (to preserve shell metacharacters).
995 args="\$args '\$arg'"
998 # Export the path to the program.
999 PATH="\$progdir:\$PATH"
1003 # Export our shlibpath_var if we have one.
1004 if test -n "$shlibpath_var" && test -n "$rpath"; then
1005 cat >> $output <<EOF
1007 # Add our own library path to $shlibpath_var
1008 $shlibpath_var="$rpath\$$shlibpath_var"
1009 export $shlibpath_var
1013 cat >> $output <<EOF
1015 eval "exec \$program \$args"
1017 echo "\$0: cannot exec \$program \$args"
1020 # The program doesn't exist.
1021 echo "\$0: error: \$progdir/\$program does not exist" 1>&2
1022 echo "This script is just a wrapper for \$program." 1>&2
1023 echo "See the $PACKAGE documentation for more information." 1>&2
1035 # See if we need to build an old-fashioned archive.
1036 if test "$build_old_libs" = "yes"; then
1037 # Now set the variables for building old libraries.
1038 oldlib
="$objdir/$libname.a"
1040 # Transform .lo files to .o (skipping convenience libraries).
1041 # FIXME: skipping them is simplistic. We should determine which members
1042 # are actually needed to resolve symbols.
1043 oldobjs
="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
1045 if test -d "$objdir"; then
1049 $show "$mkdir $objdir"
1053 # Do each command in the archive commands.
1054 cmds
=`eval echo \"$old_archive_cmds\"`
1055 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1056 for cmd
in $cmds; do
1059 eval "$run $cmd" ||
exit $?
1065 # Just move into place if there were any non-libtool objects.
1066 if test -n "$objs"; then
1067 $show "$mv $oldlib $output"
1068 $run $mv $oldlib $output
1070 elif test -z "$pic_flag" ||
test "$build_libtool_libs" != yes; then
1071 # Just symlink if libtool objects are the same.
1074 $show "$ln_s $oldlib $output"
1075 $run $ln_s $oldlib $output
1078 # Create an archive of libtool objects.
1082 # Do each command in the archive commands.
1083 cmds
=`eval echo \"$old_archive_cmds\"`
1084 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1085 for cmd
in $cmds; do
1088 eval "$run $cmd" ||
exit $?
1096 # Now create the libtool archive.
1100 test "$build_old_libs" = yes && old_library
="$libname.a"
1102 echo "creating $output"
1104 # Only create the output if not a dry run.
1105 if test -z "$run"; then
1107 # $output - a libtool library file
1108 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1110 # Names of this library.
1111 library_names='$library_names'
1113 # The name of the static archive.
1114 old_library='$old_library'
1116 # The name that we can dlopen(3).
1119 # Version information for $libname.
1124 # Directory that this library needs to be installed in:
1125 libdir='$install_libdir'
1133 # libtool install mode
1135 progname
="$progname: install"
1137 # The first argument is the name of the installation program.
1138 install_prog
="$nonopt"
1140 # We need to accept at least all the BSD install flags.
1150 if test -n "$dest"; then
1151 files
="$files $dest"
1169 # If the previous option needed an argument, then skip it.
1170 if test -n "$prev"; then
1178 install_prog
="$install_prog $arg"
1181 if test -z "$install_prog"; then
1182 echo "$progname: you must specify an install program" 1>&2
1187 if test -n "$prev"; then
1188 echo "$progname: the \`$prev' option requires an argument" 1>&2
1193 if test -z "$files"; then
1194 if test -z "$dest"; then
1195 echo "$progname: no file or destination specified" 1>&2
1197 echo "$progname: you must specify a destination" 1>&2
1203 # Strip any trailing slash from the destination.
1204 dest
=`echo "$dest" | sed 's%/$%%'`
1206 # Check to see that the destination is a directory.
1207 test -d "$dest" && isdir
=yes
1208 if test -n "$isdir"; then
1211 destdir
=`echo "$dest" | sed 's%/[^/]*$%%'`
1216 echo "$progname: $destdir must be an absolute directory name" 1>&2
1224 for file in $files; do
1226 # Do each installation.
1229 # Do the static libraries later.
1230 staticlibs
="$staticlibs $file"
1234 # Check to see that this really is a libtool archive.
1235 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then :
1237 echo "$progname: \`$file' is not a valid libtool archive" 1>&2
1244 # If there is no directory component, then add one.
1250 # Add the libdir to current_libdirs if it is the destination.
1251 if test "$destdir" = "$libdir"; then
1252 case "$current_libdirs " in
1254 *) current_libdirs
="$current_libdirs $libdir" ;;
1257 # Note the libdir as a future libdir.
1258 case "$future_libdirs " in
1260 *) future_libdirs
="$future_libdirs $libdir" ;;
1264 dir
="`echo "$file" | sed 's%/[^/]*$%%'`/"
1265 test "$dir" = "$file/" && dir
=
1268 # See the names of the shared library.
1269 set dummy
$library_names
1270 if test -n "$2"; then
1275 # Install the shared library and build the symlinks.
1276 $show "$install_prog $dir/$realname $destdir/$realname"
1277 eval "$run $install_prog $dir/$realname $destdir/$realname" ||
exit $?
1278 test "X$dlname" = "X$realname" && dlname
=
1280 # Support stripping libraries.
1281 if test -n "$stripme"; then
1282 if test -n "$striplib"; then
1283 $show "$striplib $destdir/$realname"
1284 $run $striplib $destdir/$realname ||
exit $?
1286 echo "$progname: warning: no library stripping program" 1>&2
1290 if test -n "$1"; then
1291 # Delete the old symlinks.
1295 rmcmd
="$rmcmd $destdir/$linkname"
1300 # ... and create new ones.
1303 test "X$dlname" = "X$linkname" && dlname
=
1304 $show "$ln_s $realname $destdir/$linkname"
1305 $run $ln_s $realname $destdir/$linkname
1309 if test -n "$dlname"; then
1310 # Install the dynamically-loadable library.
1311 $show "$install_prog $dir/$dlname $destdir/$dlname"
1312 eval "$run $install_prog $dir/$dlname $destdir/$dlname" ||
exit $?
1315 # Do each command in the postinstall commands.
1316 lib
="$destdir/$realname"
1317 cmds
=`eval echo \"$postinstall_cmds\"`
1318 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1319 for cmd
in $cmds; do
1322 eval "$run $cmd" ||
exit $?
1327 # Install the pseudo-library for information purposes.
1328 name
=`echo "$file" | sed 's%^.*/%%'`
1329 $show "$install_prog $file $destdir/$name"
1330 $run $install_prog $file $destdir/$name ||
exit $?
1332 # Maybe install the static library, too.
1333 test -n "$old_library" && staticlibs
="$staticlibs $dir/$old_library"
1337 # Do a test to see if this is really a libtool program.
1338 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then
1339 # This variable tells wrapper scripts just to set variables rather
1340 # than running their programs.
1341 libtool_install_magic
="$magic"
1342 link_against_libtool_libs
=
1345 # If there is no directory component, then add one.
1351 # Check the variables that should have been set.
1352 if test -z "$link_against_libtool_libs" ||
test -z "$finalize_command"; then
1353 echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
1358 for lib
in $link_against_libtool_libs; do
1359 # Check to see that each library is installed.
1361 if test -f "$lib"; then
1362 # If there is no directory component, then add one.
1368 libfile
="$libdir/`echo "$lib" | sed 's%^.*/%%g'`"
1369 if test -z "$libdir"; then
1370 echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
1371 elif test -f "$libfile"; then :
1373 echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1378 if test "$hardcode_direct" != no
&& test "$hardcode_minus_L" != no
&& test "$hardcode_shlibpath_var" != no
; then
1379 if test "$finalize" = no
; then
1380 echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1382 echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1383 $show "$finalize_command"
1384 if $run $finalize_command; then :
1386 echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
1389 file="$objdir/$file"T
1392 # Install the binary that we compiled earlier.
1393 dir
=`echo "$file" | sed 's%/[^/]*$%%'`
1394 if test "$file" = "$dir"; then
1395 file="$objdir/$file"
1397 file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`"
1402 $show "$install_prog$stripme $file $dest"
1403 $run $install_prog$stripme $file $dest ||
exit $?
1408 for file in $staticlibs; do
1409 name
=`echo "$file" | sed 's%^.*/%%'`
1411 # Set up the ranlib parameters.
1412 oldlib
="$destdir/$name"
1414 $show "$install_prog $file $oldlib"
1415 $run $install_prog $file $oldlib ||
exit $?
1417 # Support stripping libraries.
1418 if test -n "$stripme"; then
1419 if test -n "$old_striplib"; then
1420 $show "$old_striplib $oldlib"
1421 $run $old_striplib $oldlib ||
exit $?
1423 echo "$progname: warning: no static library stripping program" 1>&2
1427 # Do each command in the postinstall commands.
1428 cmds
=`eval echo \"$old_postinstall_cmds\"`
1429 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1430 for cmd
in $cmds; do
1433 eval "$run $cmd" ||
exit $?
1438 if test -n "$future_libdirs"; then
1439 echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1442 if test -n "$current_libdirs"; then
1443 # Maybe just do a dry run.
1444 test -n "$run" && current_libdirs
=" -n$current_libdirs"
1445 exec $0 --finish$current_libdirs
1452 # libtool dlname mode
1454 progname
="$progname: dlname"
1458 ltlibs
="$ltlibs $lib"
1461 # Now check to make sure each one is a valid libtool library.
1463 for lib
in $ltlibs; do
1467 # Check to see that this really is a libtool archive.
1468 if egrep "^# Generated by $PROGRAM" $arg >/dev
/null
2>&1; then :
1470 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
1475 # If there is no directory component, then add one.
1481 if test -z "$libdir"; then
1482 echo "$progname: \`$arg' contains no -rpath information" 1>&2
1484 elif test -n "$dlname"; then
1485 echo "$libdir/$dlname"
1487 echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
1494 # libtool finish mode
1496 progname
="$progname: finish"
1499 if test -n "$finish_cmds" && test -n "$libdirs"; then
1502 libdirs
="$libdirs $dir"
1505 for libdir
in $libdirs; do
1506 # Do each command in the postinstall commands.
1507 cmds
=`eval echo \"$finish_cmds\"`
1508 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1509 for cmd
in $cmds; do
1518 echo "To link against installed libraries in LIBDIR, users may have to:"
1519 if test -n "$shlibpath_var"; then
1520 echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
1522 echo " - use the \`-LLIBDIR' linker flag"
1526 # libtool uninstall mode
1528 progname
="$progname: uninstall"
1535 -*) rm="$rm $arg" ;;
1536 *) files
="$files $arg" ;;
1540 if test -z "$rm"; then
1541 echo "$progname: you must specify an RM program" 1>&2
1546 for file in $files; do
1547 dir
=`echo "$file" | sed -e 's%/[^/]*$%%'`
1548 test "$dir" = "$file" && dir
=.
1549 name
=`echo "$file" | sed -e 's%^.*/%%'`
1555 # Possibly a libtool archive, so verify it.
1556 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then
1559 # Delete the libtool libraries and symlinks.
1560 for n
in $library_names; do
1561 rmfiles
="$rmfiles $dir/$n"
1562 test "X$n" = "X$dlname" && dlname
=
1564 test -n "$dlname" && rmfiles
="$rmfiles $dir/$dlname"
1565 test -n "$old_library" && rmfiles
="$rmfiles $dir/$old_library"
1567 # FIXME: should reinstall the best remaining shared library.
1572 $show "$rm $rmfiles"
1579 echo "$progname: you must specify a MODE" 1>&2
1580 echo "$generic_help" 1>&2
1585 echo "$progname: invalid operation mode \`$mode'" 1>&2
1586 echo "$generic_help" 1>&2
1588 fi # test -z "$show_help"
1590 # We need to display help for each of the modes.
1593 Usage: $progname [OPTION]... [MODE-ARG]...
1595 Provide generalized library-building support services.
1597 -n, --dry-run display commands without modifying any files
1598 --features display configuration information and exit
1599 --finish same as \`--mode=finish'
1600 --help display this help message and exit
1601 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
1602 --version print version information
1604 MODE must be one of the following:
1606 compile compile a source file into a libtool object
1607 dlname print filenames to use to \`dlopen' libtool libraries
1608 finish complete the installation of libtool libraries
1609 install install libraries or executables
1610 link create a library or an executable
1611 uninstall remove libraries from an installed directory
1613 MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
1614 a more detailed description of MODE.
1620 Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1622 Compile a source file into a libtool library object.
1624 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1625 from the given SOURCEFILE.
1627 The output file name is determined by removing the directory component from
1628 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1629 library object suffix, \`.lo'.
1635 Usage: $progname [OPTION]... --mode=dlname LTLIBRARY [LTLIBRARY]...
1637 Print filenames to use to \`dlopen' libtool libraries.
1639 Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
1640 was linked using the \`-export-dynamic' option).
1642 The names to use are printed to standard output, one per line.
1648 Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1650 Complete the installation of libtool libraries.
1652 Each LIBDIR is a directory that contains libtool libraries.
1654 The commands that this mode executes may require superuser privileges. Use
1655 the \`--dry-run' option if you just want to see what would be executed.
1661 Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1663 Install executables or libraries.
1665 INSTALL-COMMAND is the installation command. The first component should be
1666 either the \`install' or \`cp' program.
1668 The rest of the components are interpreted as arguments to that command (only
1669 BSD-compatible install options are recognized).
1675 Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1677 Link object files or libraries together to form another library, or to
1678 create an executable program.
1680 LINK-COMMAND is a command using the C compiler that you would use to create
1681 a program from several object files.
1683 The following components of LINK-COMMAND are treated specially:
1685 -export-dynamic allow the output file to be loaded with dlopen(3)
1686 -LLIBDIR search LIBDIR for required installed libraries
1687 -lNAME OUTPUT-FILE requires the installed library libNAME
1688 -no-whole-archive turn off \`-whole-archive'
1689 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1690 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1691 -static do not do any dynamic linking or shared library creation
1692 -version-info CURRENT[:REVISION[:AGE]]
1693 specify library version info [each variable defaults to 0]
1694 -whole-archive use all members from subsequent \`.a' files
1696 All other options (arguments beginning with \`-') are ignored.
1698 Every other argument is treated as a filename. Files ending in \`.la' are
1699 treated as uninstalled libtool libraries, other files are standard or library
1702 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
1703 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
1705 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
1706 and \`ranlib'. If only libtool objects are specified, then the output file
1707 may be used in the creation of other libtool archives.
1709 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
1710 created, otherwise an executable program is created.
1716 Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1718 Remove libraries from an installation directory.
1720 RM is the name of the program to use to delete files associated with each FILE
1721 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1724 If FILE is a libtool library, all the files associated with it are deleted.
1725 Otherwise, only FILE itself is deleted using RM.
1730 echo "$progname: invalid operation mode \`$mode'" 1>&2
1739 echo "Try \`$progname --help' for more information about other modes."