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 # Some systems cannot cope with colon-terminated $shlibpath_var
1012 $shlibpath_var=\`echo \$$shlibpath_var | sed -e 's/:\$//'\`
1014 export $shlibpath_var
1018 cat >> $output <<EOF
1020 eval "exec \$program \$args"
1022 echo "\$0: cannot exec \$program \$args"
1025 # The program doesn't exist.
1026 echo "\$0: error: \$progdir/\$program does not exist" 1>&2
1027 echo "This script is just a wrapper for \$program." 1>&2
1028 echo "See the $PACKAGE documentation for more information." 1>&2
1040 # See if we need to build an old-fashioned archive.
1041 if test "$build_old_libs" = "yes"; then
1042 # Now set the variables for building old libraries.
1043 oldlib
="$objdir/$libname.a"
1045 # Transform .lo files to .o files.
1046 oldobjs
="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
1048 if test -d "$objdir"; then
1052 $show "$mkdir $objdir"
1056 # Do each command in the archive commands.
1057 cmds
=`eval echo \"$old_archive_cmds\"`
1058 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1059 for cmd
in $cmds; do
1062 eval "$run $cmd" ||
exit $?
1067 # Now create the libtool archive.
1071 test "$build_old_libs" = yes && old_library
="$libname.a"
1073 echo "creating $output"
1075 # Only create the output if not a dry run.
1076 if test -z "$run"; then
1078 # $output - a libtool library file
1079 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1081 # The name that we can dlopen(3).
1084 # Names of this library.
1085 library_names='$library_names'
1087 # The name of the static archive.
1088 old_library='$old_library'
1090 # Version information for $libname.
1095 # Directory that this library needs to be installed in:
1096 libdir='$install_libdir'
1100 # Do a symbolic link so that the libtool archive can be found in
1101 # LD_LIBRARY_PATH before the program is installed.
1102 $show "$ln_s ../$output $objdir/$output"
1103 $run $ln_s ..
/$output $objdir/$output ||
$run $cp_p ..
/$output $objdir/$output ||
exit 1
1109 # libtool install mode
1111 progname
="$progname: install"
1113 # The first argument is the name of the installation program.
1114 install_prog
="$nonopt"
1116 # We need to accept at least all the BSD install flags.
1126 if test -n "$dest"; then
1127 files
="$files $dest"
1145 # If the previous option needed an argument, then skip it.
1146 if test -n "$prev"; then
1154 install_prog
="$install_prog $arg"
1157 if test -z "$install_prog"; then
1158 echo "$progname: you must specify an install program" 1>&2
1163 if test -n "$prev"; then
1164 echo "$progname: the \`$prev' option requires an argument" 1>&2
1169 if test -z "$files"; then
1170 if test -z "$dest"; then
1171 echo "$progname: no file or destination specified" 1>&2
1173 echo "$progname: you must specify a destination" 1>&2
1179 # Strip any trailing slash from the destination.
1180 dest
=`echo "$dest" | sed 's%/$%%'`
1182 # Check to see that the destination is a directory.
1183 test -d "$dest" && isdir
=yes
1184 if test -n "$isdir"; then
1188 destdir
=`echo "$dest" | sed 's%/[^/]*$%%'`
1189 test "$destdir" = "$dest" && destdir
=.
1190 destname
=`echo "$dest" | sed 's%^.*/%%'`
1192 # Not a directory, so check to see that there is only one file specified.
1194 if test $# -gt 2; then
1195 echo "$progname: \`$dest' is not a directory" 1>&2
1203 for file in $files; do
1207 echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
1219 for file in $files; do
1221 # Do each installation.
1224 # Do the static libraries later.
1225 staticlibs
="$staticlibs $file"
1229 # Check to see that this really is a libtool archive.
1230 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then :
1232 echo "$progname: \`$file' is not a valid libtool archive" 1>&2
1239 # If there is no directory component, then add one.
1245 # Add the libdir to current_libdirs if it is the destination.
1246 if test "$destdir" = "$libdir"; then
1247 case "$current_libdirs " in
1249 *) current_libdirs
="$current_libdirs $libdir" ;;
1252 # Note the libdir as a future libdir.
1253 case "$future_libdirs " in
1255 *) future_libdirs
="$future_libdirs $libdir" ;;
1259 dir
="`echo "$file" | sed 's%/[^/]*$%%'`/"
1260 test "$dir" = "$file/" && dir
=
1263 # See the names of the shared library.
1264 set dummy
$library_names
1265 if test -n "$2"; then
1270 # Install the shared library and build the symlinks.
1271 $show "$install_prog $dir/$realname $destdir/$realname"
1272 eval "$run $install_prog $dir/$realname $destdir/$realname" ||
exit $?
1273 test "X$dlname" = "X$realname" && dlname
=
1275 # Support stripping libraries.
1276 if test -n "$stripme"; then
1277 if test -n "$striplib"; then
1278 $show "$striplib $destdir/$realname"
1279 $run $striplib $destdir/$realname ||
exit $?
1281 echo "$progname: warning: no library stripping program" 1>&2
1285 if test -n "$1"; then
1286 # Delete the old symlinks.
1290 rmcmd
="$rmcmd $destdir/$linkname"
1295 # ... and create new ones.
1298 test "X$dlname" = "X$linkname" && dlname
=
1299 $show "$ln_s $realname $destdir/$linkname"
1300 $run $ln_s $realname $destdir/$linkname
1304 if test -n "$dlname"; then
1305 # Install the dynamically-loadable library.
1306 $show "$install_prog $dir/$dlname $destdir/$dlname"
1307 eval "$run $install_prog $dir/$dlname $destdir/$dlname" ||
exit $?
1310 # Do each command in the postinstall commands.
1311 lib
="$destdir/$realname"
1312 cmds
=`eval echo \"$postinstall_cmds\"`
1313 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1314 for cmd
in $cmds; do
1317 eval "$run $cmd" ||
exit $?
1322 # Install the pseudo-library for information purposes.
1323 name
=`echo "$file" | sed 's%^.*/%%'`
1324 $show "$install_prog $file $destdir/$name"
1325 $run $install_prog $file $destdir/$name ||
exit $?
1327 # Maybe install the static library, too.
1328 test -n "$old_library" && staticlibs
="$staticlibs $dir/$old_library"
1332 # Install (i.e. copy) a libtool object.
1334 # Figure out destination file name, if it wasn't already specified.
1335 if test -n "$destname"; then
1336 destfile
="$destdir/$destname"
1338 destfile
=`echo "$file" | sed 's%^.*/%%;'`
1339 destfile
="$destdir/$destfile"
1342 # Deduce the name of the destination old-style object file.
1345 staticdest
=`echo "$destfile" | sed 's/\.lo$/\.o/;'`
1348 staticdest
="$destfile"
1352 echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
1358 # Install the libtool object if requested.
1359 if test -n "$destfile"; then
1360 $show "$install_prog $file $destfile"
1361 $run $install_prog $file $destfile ||
exit $?
1364 # Install the old object if enabled.
1365 if test "$build_old_libs" = yes; then
1366 # Deduce the name of the old-style object file.
1367 staticobj
=`echo "$file" | sed 's/\.lo$/\.o/;'`
1369 $show "$install_prog $staticobj $staticdest"
1370 $run $install_prog $staticobj $staticdest ||
exit $?
1376 # Do a test to see if this is really a libtool program.
1377 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then
1378 # This variable tells wrapper scripts just to set variables rather
1379 # than running their programs.
1380 libtool_install_magic
="$magic"
1381 link_against_libtool_libs
=
1384 # If there is no directory component, then add one.
1390 # Check the variables that should have been set.
1391 if test -z "$link_against_libtool_libs" ||
test -z "$finalize_command"; then
1392 echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
1397 for lib
in $link_against_libtool_libs; do
1398 # Check to see that each library is installed.
1400 if test -f "$lib"; then
1401 # If there is no directory component, then add one.
1407 libfile
="$libdir/`echo "$lib" | sed 's%^.*/%%g'`"
1408 if test -z "$libdir"; then
1409 echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
1410 elif test -f "$libfile"; then :
1412 echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1417 if test "$hardcode_action" = relink
; then
1418 if test "$finalize" = no
; then
1419 echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1421 echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1422 $show "$finalize_command"
1423 if $run $finalize_command; then :
1425 echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
1428 file="$objdir/$file"T
1431 # Install the binary that we compiled earlier.
1432 dir
=`echo "$file" | sed 's%/[^/]*$%%'`
1433 if test "$file" = "$dir"; then
1434 file="$objdir/$file"
1436 file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`"
1441 $show "$install_prog$stripme $file $dest"
1442 $run $install_prog$stripme $file $dest ||
exit $?
1447 for file in $staticlibs; do
1448 name
=`echo "$file" | sed 's%^.*/%%'`
1450 # Set up the ranlib parameters.
1451 oldlib
="$destdir/$name"
1453 $show "$install_prog $file $oldlib"
1454 $run $install_prog $file $oldlib ||
exit $?
1456 # Support stripping libraries.
1457 if test -n "$stripme"; then
1458 if test -n "$old_striplib"; then
1459 $show "$old_striplib $oldlib"
1460 $run $old_striplib $oldlib ||
exit $?
1462 echo "$progname: warning: no static library stripping program" 1>&2
1466 # Do each command in the postinstall commands.
1467 cmds
=`eval echo \"$old_postinstall_cmds\"`
1468 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1469 for cmd
in $cmds; do
1472 eval "$run $cmd" ||
exit $?
1477 if test -n "$future_libdirs"; then
1478 echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1481 if test -n "$current_libdirs"; then
1482 # Maybe just do a dry run.
1483 test -n "$run" && current_libdirs
=" -n$current_libdirs"
1484 exec $0 --finish$current_libdirs
1491 # libtool dlname mode
1493 progname
="$progname: dlname"
1497 ltlibs
="$ltlibs $lib"
1500 if test -z "$ltlibs"; then
1501 echo "$progname: you must specify at least one LTLIBRARY" 1>&2
1506 # Now check to make sure each one is a valid libtool library.
1508 for lib
in $ltlibs; do
1513 # Check to see that this really is a libtool archive.
1514 if egrep "^# Generated by $PROGRAM" $arg >/dev
/null
2>&1; then :
1516 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
1521 # If there is no directory component, then add one.
1527 if test -z "$libdir"; then
1528 echo "$progname: \`$arg' contains no -rpath information" 1>&2
1530 elif test -n "$dlname"; then
1531 echo "$libdir/$dlname"
1532 elif test -z "$library_names"; then
1533 echo "$progname: \`$arg' is not a shared library" 1>&2
1536 echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
1543 # libtool finish mode
1545 progname
="$progname: finish"
1548 if test -n "$finish_cmds" && test -n "$libdirs"; then
1551 libdirs
="$libdirs $dir"
1554 for libdir
in $libdirs; do
1555 # Do each command in the postinstall commands.
1556 cmds
=`eval echo \"$finish_cmds\"`
1557 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1558 for cmd
in $cmds; do
1567 echo "To link against installed libraries in LIBDIR, users may have to:"
1568 if test -n "$shlibpath_var"; then
1569 echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
1571 echo " - use the \`-LLIBDIR' linker flag"
1575 # libtool uninstall mode
1577 progname
="$progname: uninstall"
1584 -*) rm="$rm $arg" ;;
1585 *) files
="$files $arg" ;;
1589 if test -z "$rm"; then
1590 echo "$progname: you must specify an RM program" 1>&2
1595 for file in $files; do
1596 dir
=`echo "$file" | sed -e 's%/[^/]*$%%'`
1597 test "$dir" = "$file" && dir
=.
1598 name
=`echo "$file" | sed -e 's%^.*/%%'`
1604 # Possibly a libtool archive, so verify it.
1605 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then
1608 # Delete the libtool libraries and symlinks.
1609 for n
in $library_names; do
1610 rmfiles
="$rmfiles $dir/$n"
1611 test "X$n" = "X$dlname" && dlname
=
1613 test -n "$dlname" && rmfiles
="$rmfiles $dir/$dlname"
1614 test -n "$old_library" && rmfiles
="$rmfiles $dir/$old_library"
1616 # FIXME: should reinstall the best remaining shared library.
1621 if test "$build_old_libs" = yes; then
1622 oldobj
=`echo "$name" | sed 's/\.lo$/\.o/'`
1623 rmfiles
="$rmfiles $dir/$oldobj"
1628 $show "$rm $rmfiles"
1635 echo "$progname: you must specify a MODE" 1>&2
1636 echo "$generic_help" 1>&2
1641 echo "$progname: invalid operation mode \`$mode'" 1>&2
1642 echo "$generic_help" 1>&2
1644 fi # test -z "$show_help"
1646 # We need to display help for each of the modes.
1649 Usage: $progname [OPTION]... [MODE-ARG]...
1651 Provide generalized library-building support services.
1653 -n, --dry-run display commands without modifying any files
1654 --features display configuration information and exit
1655 --finish same as \`--mode=finish'
1656 --help display this help message and exit
1657 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
1658 --version print version information
1660 MODE must be one of the following:
1662 compile compile a source file into a libtool object
1663 dlname print filenames to use to \`dlopen' libtool libraries
1664 finish complete the installation of libtool libraries
1665 install install libraries or executables
1666 link create a library or an executable
1667 uninstall remove libraries from an installed directory
1669 MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
1670 a more detailed description of MODE.
1676 Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1678 Compile a source file into a libtool library object.
1680 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1681 from the given SOURCEFILE.
1683 The output file name is determined by removing the directory component from
1684 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1685 library object suffix, \`.lo'.
1691 Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
1693 Print filenames to use to \`dlopen' libtool libraries.
1695 Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
1696 was linked using the \`-export-dynamic' option).
1698 The names to use are printed to standard output, one per line.
1704 Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1706 Complete the installation of libtool libraries.
1708 Each LIBDIR is a directory that contains libtool libraries.
1710 The commands that this mode executes may require superuser privileges. Use
1711 the \`--dry-run' option if you just want to see what would be executed.
1717 Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1719 Install executables or libraries.
1721 INSTALL-COMMAND is the installation command. The first component should be
1722 either the \`install' or \`cp' program.
1724 The rest of the components are interpreted as arguments to that command (only
1725 BSD-compatible install options are recognized).
1731 Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1733 Link object files or libraries together to form another library, or to
1734 create an executable program.
1736 LINK-COMMAND is a command using the C compiler that you would use to create
1737 a program from several object files.
1739 The following components of LINK-COMMAND are treated specially:
1741 -allow-undefined allow a libtool library to reference undefined symbols
1742 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1743 -LLIBDIR search LIBDIR for required installed libraries
1744 -lNAME OUTPUT-FILE requires the installed library libNAME
1745 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1746 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1747 -static do not do any dynamic linking or shared library creation
1748 -version-info CURRENT[:REVISION[:AGE]]
1749 specify library version info [each variable defaults to 0]
1751 All other options (arguments beginning with \`-') are ignored.
1753 Every other argument is treated as a filename. Files ending in \`.la' are
1754 treated as uninstalled libtool libraries, other files are standard or library
1757 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
1758 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
1760 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
1763 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
1764 created, otherwise an executable program is created.
1770 Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1772 Remove libraries from an installation directory.
1774 RM is the name of the program to use to delete files associated with each FILE
1775 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1778 If FILE is a libtool library, all the files associated with it are deleted.
1779 Otherwise, only FILE itself is deleted using RM.
1784 echo "$progname: invalid operation mode \`$mode'" 1>&2
1793 echo "Try \`$progname --help' for more information about other modes."