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 -e "[ ]-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 leftover library objects.
233 if test "$build_old_libs" = yes; then
234 $run $rm $obj $libobj
235 trap "$run $rm $obj $libobj; exit 1" 1 2 15
238 trap "$run $rm $libobj; exit 1" 1 2 15
241 # Only build a PIC object if we are building libtool libraries.
242 if test "$build_libtool_libs" = yes; then
243 # All platforms use -DPIC, to notify preprocessed assembler code.
244 $show "$base_compile$pic_flag -DPIC $srcfile"
245 if eval "$run $base_compile$pic_flag -DPIC $srcfile"; then :
247 test -n "$obj" && $run $rm $obj
251 # If we have no pic_flag, then copy the object into place and finish.
252 if test -z "$pic_flag"; then
253 $show "$ln_s $obj $libobj"
254 $run $ln_s $obj $libobj ||
$run $cp_p $obj $libobj
258 # Just move the object, then go on to compile the next one
259 $show "$mv $obj $libobj"
260 $run $mv $obj $libobj ||
exit 1
263 # Only build a position-dependent object if we build old libraries.
264 if test "$build_old_libs" = yes; then
265 $show "$base_compile $srcfile"
266 if eval "$run $base_compile $srcfile"; then :
268 $run $rm $obj $libobj
273 # Create an invalid libtool object if no PIC, so that we don't accidentally
274 # link it into a program.
275 if test "$build_libtool_libs" != yes; then
276 $show "echo timestamp > $libobj"
277 eval "$run echo timestamp > $libobj" ||
exit $?
285 progname
="$progname: link"
286 # Go through the arguments, transforming them on the way.
290 compile_command
="$cc"
291 finalize_command
="$cc"
299 link_against_libtool_libs
=
309 # We need to know -static, to get the right output filenames.
311 *" -static "*) build_libtool_libs
=no build_old_libs
=yes ;;
316 # If the previous option needs an argument, assign it.
317 if test -n "$prev"; then
320 compile_command
="$compile_command @OUTPUT@"
321 finalize_command
="$finalize_command @OUTPUT@"
336 -allow-undefined) allow_undefined
=yes ;;
340 compile_command
="$compile_command $export_dynamic_flag"
341 finalize_command
="$finalize_command $export_dynamic_flag"
346 dir
=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
351 echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
355 deplibs
="$deplibs $arg"
358 -l*) deplibs
="$deplibs $arg" ;;
368 link_static
="`eval echo \"$link_static_flag\"`"
369 compile_command
="$compile_command $link_static"
374 echo "$progname: \`-version-file' has been replaced by \`-version-info'" 1>&2
384 -*) cc
="$cc $arg" ;; # Some other compiler flag.
392 # Find the relevant object directory and library name.
393 file=`echo "$arg" | sed 's%^.*/%%'`
394 dir
=`echo "$arg" | sed 's%/[^/]*$%/%'`
395 test "$dir" = "$arg" && dir
=
403 libobjs
="$libobjs $arg"
407 # A libtool-controlled library.
413 # Check to see that this really is a libtool archive.
414 if egrep "^# Generated by $PROGRAM" $arg >/dev
/null
2>&1; then :
416 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
420 # If there is no directory component, then add one.
426 if test -z "$libdir"; then
427 echo "$progname: \`$arg' contains no -rpath information" 1>&2
431 # Get the name of the library we link against.
433 for l
in $old_library $library_names; do
437 if test -z "$linklib"; then
438 echo "$progname: cannot find name of link library for \`$arg'" 1>&2
442 # Find the relevant object directory and library name.
443 name
=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'`
444 dir
=`echo "$arg" | sed 's%/[^/]*$%%'`
445 if test "$dir" = "$arg"; then
451 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
452 link_against_libtool_libs
="$link_against_libtool_libs $arg"
453 if test -n "$shlibpath_var"; then
454 # Make sure the rpath contains only unique directories.
455 case "$temp_rpath " in
457 *) temp_rpath
="$temp_rpath $dir" ;;
461 if test -n "$hardcode_libdir_flag_spec"; then
462 if test -n "$hardcode_libdir_separator"; then
463 if test -z "$hardcode_libdirs"; then
464 # Put the magic libdir with the hardcode flag.
465 hardcode_libdirs
="$libdir"
466 libdir
="@HARDCODE_LIBDIRS@"
468 # Just accumulate the libdirs.
469 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
474 if test -n "$libdir"; then
475 hardcode_libdir_flag
=`eval echo \"$hardcode_libdir_flag_spec\"`
476 compile_command
="$compile_command $hardcode_libdir_flag"
477 finalize_command
="$finalize_command $hardcode_libdir_flag"
479 elif test "$hardcode_runpath_var" = yes; then
480 # Do the same for the permanent run path.
481 case "$perm_rpath " in
483 *) perm_rpath
="$perm_rpath $libdir" ;;
488 case "$hardcode_action" in
490 if test "$hardcode_direct" = no
; then
491 compile_command
="$compile_command $dir/$linklib"
492 elif test "$hardcode_minus_L" = no
; then
493 compile_command
="$compile_command -L$dir -l$name"
494 elif test "$hardcode_shlibpath_var" = no
; then
495 compile_shlibpath
="$compile_shlibpath$dir:"
496 compile_command
="$compile_command -l$name"
501 # We need an absolute path.
505 absdir
=`cd "$dir" && pwd`
506 if test -z "$absdir"; then
507 echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
514 if test "$hardcode_direct" = yes; then
515 compile_command
="$compile_command $dir/$linklib"
516 elif test "$hardcode_minus_L" = yes; then
517 compile_command
="$compile_command -L$dir -l$name"
518 elif test "$hardcode_shlibpath_var" = yes; then
519 compile_shlibpath
="$compile_shlibpath$dir:"
520 compile_command
="$compile_command -l$name"
525 echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
530 # Finalize command for both is simple: just hardcode it.
531 if test "$hardcode_direct" = yes; then
532 finalize_command
="$finalize_command $libdir/$linklib"
533 elif test "$hardcode_minus_L" = yes; then
534 finalize_command
="$finalize_command -L$libdir -l$name"
535 elif test "$hardcode_shlibpath_var" = yes; then
536 finalize_shlibpath
="$finalize_shlibpath$libdir:"
537 finalize_command
="$finalize_command -l$name"
539 # We can't seem to hardcode it, guess we'll fake it.
540 finalize_command
="$finalize_command -L$libdir -l$name"
543 # Transform directly to old archives if we don't build new libraries.
544 if test -n "$pic_flag" && test -z "$old_library"; then
545 echo "$progname: cannot find static library for \`$arg'" 1>&2
548 test -n "$old_library" && linklib
="$old_library"
549 compile_command
="$compile_command $dir/$linklib"
550 finalize_command
="$finalize_command $dir/$linklib"
556 echo "$progname: unknown file suffix for \`$arg'" 1>&2
562 compile_command
="$compile_command $arg"
563 finalize_command
="$finalize_command $arg"
566 if test -n "$prev"; then
567 echo "$progname: the \`$prevarg' option requires an argument" 1>&2
572 # Substitute the hardcoded libdirs into the compile commands.
573 if test "$hardcode_libdir_colon_separated" = yes; then
574 compile_command
=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
575 finalize_command
=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
582 echo "$progname: you must specify an output file" 1>&2
588 echo "$progname: output file \`$output' must have no directory components" 1>&2
593 libname
=`echo "$output" | sed 's/\.la$//'`
595 # All the library-specific variables (install_libdir is set above).
603 if test -n "$objs"; then
604 echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
608 # How the heck are we supposed to write a wrapper for a shared library?
609 if test -n "$link_against_libtool_libs"; then
610 echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
614 if test -z "$install_libdir"; then
615 echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
619 # Parse the version information argument.
620 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=':'
624 if test -n "$5"; then
625 echo "$progname: too many parameters to \`-version-info'" 1>&2
630 test -n "$2" && current
="$2"
631 test -n "$3" && revision
="$3"
632 test -n "$4" && age
="$4"
634 # Check that each of the things are valid numbers.
636 0 |
[1-9] |
[1-9][0-9]*) ;;
638 echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
639 echo "$progname: \`$vinfo' is not valid version information" 1>&2
645 0 |
[1-9] |
[1-9][0-9]*) ;;
647 echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
648 echo "$progname: \`$vinfo' is not valid version information" 1>&2
654 0 |
[1-9] |
[1-9][0-9]*) ;;
656 echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
657 echo "$progname: \`$vinfo' is not valid version information" 1>&2
662 if test $age -gt $current; then
663 echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
664 echo "$progname: \`$vinfo' is not valid version information" 1>&2
668 # Calculate the version variables.
669 version_vars
="version_type current age revision"
670 case "$version_type" in
674 version_vars
="$version_vars major versuffix"
675 major
=`expr $current - $age`
676 versuffix
="$major.$age.$revision"
680 version_vars
="$version_vars versuffix verstring"
681 major
=`expr $current - $age`
682 versuffix
="$current.$age.$revision"
683 verstring
="$versuffix"
685 # Add in all the interfaces that we are compatible with.
687 while test $loop != 0; do
688 iface
=`expr $current - $loop`
689 loop
=`expr $loop - 1`
690 verstring
="$verstring:${iface}.0"
693 # Make executables depend on our current version.
694 verstring
="$verstring:${current}.0"
698 version_vars
="$version_vars major versuffix"
700 versuffix
="$current.$revision"
704 echo "$progname: unknown library version type \`$version_type'" 1>&2
705 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
710 # Create the output directory, or remove our outputs if we need to.
711 if test -d $objdir; then
712 $show "$rm $objdir/$libname.*"
713 $run $rm $objdir/$libname.
*
715 $show "$mkdir $objdir"
716 $run $mkdir $objdir ||
exit $?
719 # Check to see if the archive will have undefined symbols.
720 if test "$allow_undefined" = yes; then
721 if "$allow_undefined_flag" = unsupported
; then
722 echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
723 build_libtool_libs
=no
727 allow_undefined_flag
=
730 if test "$build_libtool_libs" = yes; then
731 # Get the real and link names of the library.
732 library_names
=`eval echo \"$library_names_spec\"`
733 set dummy
$library_names
737 if test -n "$soname_spec"; then
738 soname
=`eval echo \"$soname_spec\"`
743 lib
="$objdir/$realname"
747 linknames
="$linknames $objdir/$link"
750 # Use standard objects if they are PIC.
751 test -z "$pic_flag" && libobjs
=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'`
753 # Do each of the archive commands.
754 cmds
=`eval echo \"$archive_cmds\"`
755 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
759 eval "$run $cmd" ||
exit $?
763 # Create links to the real library.
764 for link
in $linknames; do
765 $show "$ln_s $realname $link"
766 $run $ln_s $realname $link ||
exit $?
769 # If -export-dynamic was specified, set the dlname.
770 if test "$export_dynamic" = yes; then
771 # On all known operating systems, these are identical.
778 if test -n "$link_against_libtool_libs"; then
779 echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
783 if test -n "$deplibs"; then
784 echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
787 if test -n "$install_libdir"; then
788 echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
791 if test -n "$vinfo"; then
792 echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
797 if test -n "$objs"; then
798 echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
802 obj
=`echo "$output" | sed 's/\.lo$/.o/'`
810 # Delete the old objects.
811 $run $rm $obj $libobj
813 # Create the old-style object.
814 reload_objs
="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
817 cmds
=`eval echo \"$reload_cmds\"`
818 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
822 eval "$run $cmd" ||
exit $?
826 # Exit if we aren't doing a library object file.
827 test -z "$libobj" && exit 0
829 if test "$build_libtool_libs" != yes; then
830 # Create an invalid libtool object if no PIC, so that we don't
831 # accidentally link it into a program.
832 $show "echo timestamp > $libobj"
833 eval "$run echo timestamp > $libobj" ||
exit $?
837 if test -n "$pic_flag"; then
838 # Only do commands if we really have different PIC objects.
839 reload_objs
="$libobjs"
841 cmds
=`eval echo \"$reload_cmds\"`
842 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
846 eval "$run $cmd" ||
exit $?
850 # Just create a symlink.
851 $show "$ln_s $obj $libobj"
852 $run $ln_s $obj $libobj ||
$run $cp_p $obj $libobj ||
exit 1
859 if test -n "$install_libdir"; then
860 echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2
863 if test -n "$vinfo"; then
864 echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2
867 if test -n "$libobjs"; then
868 # Transform all the library objects into standard objects.
869 compile_command
=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
870 finalize_command
=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'`
873 if test -z "$link_against_libtool_libs" ||
test "$build_libtool_libs" != yes; then
874 # Replace the output file specification.
875 compile_command
=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
876 finalize_command
=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
878 # We have no uninstalled library dependencies, so finalize right now.
879 $show "$compile_command"
880 $run $compile_command
883 # If we failed to link statically, then try again.
884 if test $status -ne 0 && test -n "$link_static"; then
885 echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2
886 compile_command
=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"`
887 $show "$finalize_command"
888 $run $finalize_command
894 # Replace the output file specification.
895 compile_command
=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
896 finalize_command
=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
898 # Create the binary in the object directory, then wrap it.
899 if test -d $objdir; then :
901 $show "$mkdir $objdir"
902 $run $mkdir $objdir ||
exit $?
905 if test -n "$shlibpath_var"; then
906 # We should set the shlibpath_var
908 for dir
in $temp_rpath; do
915 # Relative path: add a thisdir entry.
916 rpath
="$rpath\$thisdir/$dir:"
923 # Delete the old output file.
926 if test -n "$compile_shlibpath"; then
927 compile_command
="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
929 if test -n "$finalize_shlibpath"; then
930 finalize_command
="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
933 if test -n "$perm_rpath"; then
934 # We should set the runpath_var.
936 for dir
in $perm_rpath; do
939 compile_command
="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
940 finalize_command
="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
943 case "$hardcode_action" in
945 # AGH! Flame the AIX and HP-UX people for me, will ya?
946 echo "$progname: warning: using a buggy system linker" 1>&2
947 echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
951 $show "$compile_command"
952 eval "$run $compile_command" ||
exit $?
954 # Now create the wrapper script.
955 echo "creating $output"
957 # Only actually do things if our run command is non-null.
958 if test -z "$run"; then
960 trap "$rm $output; exit 1" 1 2 15
965 # $output - temporary wrapper script for $objdir/$output
966 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
968 # The $output program cannot be directly executed until all the libtool
969 # libraries that it depends on are installed.
971 # This wrapper script should never be moved out of \``pwd`'.
972 # If it is, it will not operate correctly.
974 # This environment variable determines our operation mode.
975 if test "\$libtool_install_magic" = "$magic"; then
976 # install mode needs the following variables:
977 link_against_libtool_libs='$link_against_libtool_libs'
978 finalize_command='$finalize_command'
980 # Find the directory that this script lives in.
981 thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\`
982 test "x\$thisdir" = "x\$0" && thisdir=.
984 # Try to get the absolute directory name.
985 absdir=\`cd "\$thisdir" && pwd\`
986 test -n "\$absdir" && thisdir="\$absdir"
988 progdir="\$thisdir/$objdir"
991 if test -f "\$progdir/\$program"; then
992 # Run the actual program with our arguments.
996 # Quote arguments (to preserve shell metacharacters).
997 args="\$args '\$arg'"
1000 # Export the path to the program.
1001 PATH="\$progdir:\$PATH"
1005 # Export our shlibpath_var if we have one.
1006 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1007 cat >> $output <<EOF
1009 # Add our own library path to $shlibpath_var
1010 $shlibpath_var="$temp_rpath\$$shlibpath_var"
1011 export $shlibpath_var
1015 cat >> $output <<EOF
1017 eval "exec \$program \$args"
1019 echo "\$0: cannot exec \$program \$args"
1022 # The program doesn't exist.
1023 echo "\$0: error: \$progdir/\$program does not exist" 1>&2
1024 echo "This script is just a wrapper for \$program." 1>&2
1025 echo "See the $PACKAGE documentation for more information." 1>&2
1037 # See if we need to build an old-fashioned archive.
1038 if test "$build_old_libs" = "yes"; then
1039 # Now set the variables for building old libraries.
1040 oldlib
="$objdir/$libname.a"
1042 # Transform .lo files to .o files.
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 $?
1064 # Now create the libtool archive.
1068 test "$build_old_libs" = yes && old_library
="$libname.a"
1070 echo "creating $output"
1072 # Only create the output if not a dry run.
1073 if test -z "$run"; then
1075 # $output - a libtool library file
1076 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1078 # The name that we can dlopen(3).
1081 # Names of this library.
1082 library_names='$library_names'
1084 # The name of the static archive.
1085 old_library='$old_library'
1087 # Version information for $libname.
1092 # Directory that this library needs to be installed in:
1093 libdir='$install_libdir'
1097 # Do a symbolic link so that the libtool archive can be found in
1098 # LD_LIBRARY_PATH before the program is installed.
1099 $show "$ln_s ../$output $objdir/$output"
1100 $run $ln_s ..
/$output $objdir/$output ||
$run $cp_p ..
/$output $objdir/$output ||
exit 1
1106 # libtool install mode
1108 progname
="$progname: install"
1110 # The first argument is the name of the installation program.
1111 install_prog
="$nonopt"
1113 # We need to accept at least all the BSD install flags.
1123 if test -n "$dest"; then
1124 files
="$files $dest"
1142 # If the previous option needed an argument, then skip it.
1143 if test -n "$prev"; then
1151 install_prog
="$install_prog $arg"
1154 if test -z "$install_prog"; then
1155 echo "$progname: you must specify an install program" 1>&2
1160 if test -n "$prev"; then
1161 echo "$progname: the \`$prev' option requires an argument" 1>&2
1166 if test -z "$files"; then
1167 if test -z "$dest"; then
1168 echo "$progname: no file or destination specified" 1>&2
1170 echo "$progname: you must specify a destination" 1>&2
1176 # Strip any trailing slash from the destination.
1177 dest
=`echo "$dest" | sed 's%/$%%'`
1179 # Check to see that the destination is a directory.
1180 test -d "$dest" && isdir
=yes
1181 if test -n "$isdir"; then
1185 destdir
=`echo "$dest" | sed 's%/[^/]*$%%'`
1186 test "$destdir" = "$dest" && destdir
=.
1187 destname
=`echo "$dest" | sed 's%^.*/%%'`
1189 # Not a directory, so check to see that there is only one file specified.
1191 if test $# -gt 2; then
1192 echo "$progname: \`$dest' is not a directory" 1>&2
1200 for file in $files; do
1204 echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
1216 for file in $files; do
1218 # Do each installation.
1221 # Do the static libraries later.
1222 staticlibs
="$staticlibs $file"
1226 # Check to see that this really is a libtool archive.
1227 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then :
1229 echo "$progname: \`$file' is not a valid libtool archive" 1>&2
1236 # If there is no directory component, then add one.
1242 # Add the libdir to current_libdirs if it is the destination.
1243 if test "$destdir" = "$libdir"; then
1244 case "$current_libdirs " in
1246 *) current_libdirs
="$current_libdirs $libdir" ;;
1249 # Note the libdir as a future libdir.
1250 case "$future_libdirs " in
1252 *) future_libdirs
="$future_libdirs $libdir" ;;
1256 dir
="`echo "$file" | sed 's%/[^/]*$%%'`/"
1257 test "$dir" = "$file/" && dir
=
1260 # See the names of the shared library.
1261 set dummy
$library_names
1262 if test -n "$2"; then
1267 # Install the shared library and build the symlinks.
1268 $show "$install_prog $dir/$realname $destdir/$realname"
1269 eval "$run $install_prog $dir/$realname $destdir/$realname" ||
exit $?
1270 test "X$dlname" = "X$realname" && dlname
=
1272 # Support stripping libraries.
1273 if test -n "$stripme"; then
1274 if test -n "$striplib"; then
1275 $show "$striplib $destdir/$realname"
1276 $run $striplib $destdir/$realname ||
exit $?
1278 echo "$progname: warning: no library stripping program" 1>&2
1282 if test -n "$1"; then
1283 # Delete the old symlinks.
1287 rmcmd
="$rmcmd $destdir/$linkname"
1292 # ... and create new ones.
1295 test "X$dlname" = "X$linkname" && dlname
=
1296 $show "$ln_s $realname $destdir/$linkname"
1297 $run $ln_s $realname $destdir/$linkname
1301 if test -n "$dlname"; then
1302 # Install the dynamically-loadable library.
1303 $show "$install_prog $dir/$dlname $destdir/$dlname"
1304 eval "$run $install_prog $dir/$dlname $destdir/$dlname" ||
exit $?
1307 # Do each command in the postinstall commands.
1308 lib
="$destdir/$realname"
1309 cmds
=`eval echo \"$postinstall_cmds\"`
1310 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1311 for cmd
in $cmds; do
1314 eval "$run $cmd" ||
exit $?
1319 # Install the pseudo-library for information purposes.
1320 name
=`echo "$file" | sed 's%^.*/%%'`
1321 $show "$install_prog $file $destdir/$name"
1322 $run $install_prog $file $destdir/$name ||
exit $?
1324 # Maybe install the static library, too.
1325 test -n "$old_library" && staticlibs
="$staticlibs $dir/$old_library"
1329 # Install (i.e. copy) a libtool object.
1331 # Figure out destination file name, if it wasn't already specified.
1332 if test -n "$destname"; then
1333 destfile
="$destdir/$destname"
1335 destfile
=`echo "$file" | sed 's%^.*/%%;'`
1336 destfile
="$destdir/$destfile"
1339 # Deduce the name of the destination old-style object file.
1342 staticdest
=`echo "$destfile" | sed 's/\.lo$/\.o/;'`
1345 staticdest
="$destfile"
1349 echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
1355 # Install the libtool object if requested.
1356 if test -n "$destfile"; then
1357 $show "$install_prog $file $destfile"
1358 $run $install_prog $file $destfile ||
exit $?
1361 # Install the old object if enabled.
1362 if test "$build_old_libs" = yes; then
1363 # Deduce the name of the old-style object file.
1364 staticobj
=`echo "$file" | sed 's/\.lo$/\.o/;'`
1366 $show "$install_prog $staticobj $staticdest"
1367 $run $install_prog $staticobj $staticdest ||
exit $?
1373 # Do a test to see if this is really a libtool program.
1374 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then
1375 # This variable tells wrapper scripts just to set variables rather
1376 # than running their programs.
1377 libtool_install_magic
="$magic"
1378 link_against_libtool_libs
=
1381 # If there is no directory component, then add one.
1387 # Check the variables that should have been set.
1388 if test -z "$link_against_libtool_libs" ||
test -z "$finalize_command"; then
1389 echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
1394 for lib
in $link_against_libtool_libs; do
1395 # Check to see that each library is installed.
1397 if test -f "$lib"; then
1398 # If there is no directory component, then add one.
1404 libfile
="$libdir/`echo "$lib" | sed 's%^.*/%%g'`"
1405 if test -z "$libdir"; then
1406 echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
1407 elif test -f "$libfile"; then :
1409 echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1414 if test "$hardcode_action" = relink
; then
1415 if test "$finalize" = no
; then
1416 echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1418 echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1419 $show "$finalize_command"
1420 if $run $finalize_command; then :
1422 echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
1425 file="$objdir/$file"T
1428 # Install the binary that we compiled earlier.
1429 dir
=`echo "$file" | sed 's%/[^/]*$%%'`
1430 if test "$file" = "$dir"; then
1431 file="$objdir/$file"
1433 file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`"
1438 $show "$install_prog$stripme $file $dest"
1439 $run $install_prog$stripme $file $dest ||
exit $?
1444 for file in $staticlibs; do
1445 name
=`echo "$file" | sed 's%^.*/%%'`
1447 # Set up the ranlib parameters.
1448 oldlib
="$destdir/$name"
1450 $show "$install_prog $file $oldlib"
1451 $run $install_prog $file $oldlib ||
exit $?
1453 # Support stripping libraries.
1454 if test -n "$stripme"; then
1455 if test -n "$old_striplib"; then
1456 $show "$old_striplib $oldlib"
1457 $run $old_striplib $oldlib ||
exit $?
1459 echo "$progname: warning: no static library stripping program" 1>&2
1463 # Do each command in the postinstall commands.
1464 cmds
=`eval echo \"$old_postinstall_cmds\"`
1465 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1466 for cmd
in $cmds; do
1469 eval "$run $cmd" ||
exit $?
1474 if test -n "$future_libdirs"; then
1475 echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1478 if test -n "$current_libdirs"; then
1479 # Maybe just do a dry run.
1480 test -n "$run" && current_libdirs
=" -n$current_libdirs"
1481 exec $0 --finish$current_libdirs
1488 # libtool dlname mode
1490 progname
="$progname: dlname"
1494 ltlibs
="$ltlibs $lib"
1497 if test -z "$ltlibs"; then
1498 echo "$progname: you must specify at least one LTLIBRARY" 1>&2
1503 # Now check to make sure each one is a valid libtool library.
1505 for lib
in $ltlibs; do
1510 # Check to see that this really is a libtool archive.
1511 if egrep "^# Generated by $PROGRAM" $arg >/dev
/null
2>&1; then :
1513 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
1518 # If there is no directory component, then add one.
1524 if test -z "$libdir"; then
1525 echo "$progname: \`$arg' contains no -rpath information" 1>&2
1527 elif test -n "$dlname"; then
1528 echo "$libdir/$dlname"
1529 elif test -z "$library_names"; then
1530 echo "$progname: \`$arg' is not a shared library" 1>&2
1533 echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
1540 # libtool finish mode
1542 progname
="$progname: finish"
1545 if test -n "$finish_cmds" && test -n "$libdirs"; then
1548 libdirs
="$libdirs $dir"
1551 for libdir
in $libdirs; do
1552 # Do each command in the postinstall commands.
1553 cmds
=`eval echo \"$finish_cmds\"`
1554 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1555 for cmd
in $cmds; do
1564 echo "To link against installed libraries in LIBDIR, users may have to:"
1565 if test -n "$shlibpath_var"; then
1566 echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
1568 echo " - use the \`-LLIBDIR' linker flag"
1572 # libtool uninstall mode
1574 progname
="$progname: uninstall"
1581 -*) rm="$rm $arg" ;;
1582 *) files
="$files $arg" ;;
1586 if test -z "$rm"; then
1587 echo "$progname: you must specify an RM program" 1>&2
1592 for file in $files; do
1593 dir
=`echo "$file" | sed -e 's%/[^/]*$%%'`
1594 test "$dir" = "$file" && dir
=.
1595 name
=`echo "$file" | sed -e 's%^.*/%%'`
1601 # Possibly a libtool archive, so verify it.
1602 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then
1605 # Delete the libtool libraries and symlinks.
1606 for n
in $library_names; do
1607 rmfiles
="$rmfiles $dir/$n"
1608 test "X$n" = "X$dlname" && dlname
=
1610 test -n "$dlname" && rmfiles
="$rmfiles $dir/$dlname"
1611 test -n "$old_library" && rmfiles
="$rmfiles $dir/$old_library"
1613 # FIXME: should reinstall the best remaining shared library.
1618 if test "$build_old_libs" = yes; then
1619 oldobj
=`echo "$name" | sed 's/\.lo$/\.o/'`
1620 rmfiles
="$rmfiles $dir/$oldobj"
1625 $show "$rm $rmfiles"
1632 echo "$progname: you must specify a MODE" 1>&2
1633 echo "$generic_help" 1>&2
1638 echo "$progname: invalid operation mode \`$mode'" 1>&2
1639 echo "$generic_help" 1>&2
1641 fi # test -z "$show_help"
1643 # We need to display help for each of the modes.
1646 Usage: $progname [OPTION]... [MODE-ARG]...
1648 Provide generalized library-building support services.
1650 -n, --dry-run display commands without modifying any files
1651 --features display configuration information and exit
1652 --finish same as \`--mode=finish'
1653 --help display this help message and exit
1654 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
1655 --version print version information
1657 MODE must be one of the following:
1659 compile compile a source file into a libtool object
1660 dlname print filenames to use to \`dlopen' libtool libraries
1661 finish complete the installation of libtool libraries
1662 install install libraries or executables
1663 link create a library or an executable
1664 uninstall remove libraries from an installed directory
1666 MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
1667 a more detailed description of MODE.
1673 Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1675 Compile a source file into a libtool library object.
1677 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1678 from the given SOURCEFILE.
1680 The output file name is determined by removing the directory component from
1681 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1682 library object suffix, \`.lo'.
1688 Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
1690 Print filenames to use to \`dlopen' libtool libraries.
1692 Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
1693 was linked using the \`-export-dynamic' option).
1695 The names to use are printed to standard output, one per line.
1701 Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1703 Complete the installation of libtool libraries.
1705 Each LIBDIR is a directory that contains libtool libraries.
1707 The commands that this mode executes may require superuser privileges. Use
1708 the \`--dry-run' option if you just want to see what would be executed.
1714 Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1716 Install executables or libraries.
1718 INSTALL-COMMAND is the installation command. The first component should be
1719 either the \`install' or \`cp' program.
1721 The rest of the components are interpreted as arguments to that command (only
1722 BSD-compatible install options are recognized).
1728 Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1730 Link object files or libraries together to form another library, or to
1731 create an executable program.
1733 LINK-COMMAND is a command using the C compiler that you would use to create
1734 a program from several object files.
1736 The following components of LINK-COMMAND are treated specially:
1738 -allow-undefined allow a libtool library to reference undefined symbols
1739 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1740 -LLIBDIR search LIBDIR for required installed libraries
1741 -lNAME OUTPUT-FILE requires the installed library libNAME
1742 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1743 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1744 -static do not do any dynamic linking or shared library creation
1745 -version-info CURRENT[:REVISION[:AGE]]
1746 specify library version info [each variable defaults to 0]
1748 All other options (arguments beginning with \`-') are ignored.
1750 Every other argument is treated as a filename. Files ending in \`.la' are
1751 treated as uninstalled libtool libraries, other files are standard or library
1754 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
1755 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
1757 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
1760 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
1761 created, otherwise an executable program is created.
1767 Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1769 Remove libraries from an installation directory.
1771 RM is the name of the program to use to delete files associated with each FILE
1772 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1775 If FILE is a libtool library, all the files associated with it are deleted.
1776 Otherwise, only FILE itself is deleted using RM.
1781 echo "$progname: invalid operation mode \`$mode'" 1>&2
1790 echo "Try \`$progname --help' for more information about other modes."