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."
35 magic
="%%%MAGIC variable%%%"
41 if test "$LTCONFIG_VERSION" != "$VERSION"; then
42 echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
43 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
48 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
49 echo "$progname: not configured to build any kind of library" 1>&2
50 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
63 # Parse our command line options once, thoroughly.
70 -*=*) optarg
=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
74 # If the previous option needs an argument, assign it.
75 if test -n "$prev"; then
82 # Have we seen a non-optional argument yet?
89 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
99 if test "$build_libtool_libs" = yes; then
100 echo "enable shared libraries"
102 echo "disable shared libraries"
104 if test "$build_old_libs" = yes; then
105 echo "enable static libraries"
107 echo "disable static libraries"
112 --finish) mode
="finish" ;;
114 --mode) prevopt
="--mode" prev
=mode
;;
115 --mode=*) mode
="$optarg" ;;
118 echo "$progname: unrecognized option \`$arg'" 1>&2
131 if test -n "$prevopt"; then
132 echo "$progname: option \`$prevopt' requires an argument" 1>&2
138 if test -z "$show_help"; then
140 # Infer the operation mode.
141 if test -z "$mode"; then
165 # Just use the default operation mode.
166 if test -z "$mode"; then
167 if test -n "$nonopt"; then
168 echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
170 echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
177 # Change the help message to a mode-specific one.
179 help="Try \`$progname --help --mode=$mode' for more information."
181 # These modes are in order of execution frequency so that they run quickly.
183 # libtool compile mode
185 progname
="$progname: compile"
186 # Get the compilation command and the source file.
187 base_compile
="$nonopt"
193 # Quote any args containing shell metacharacters.
195 *" "*|
*" "*|
*[\
[\
]\~\
#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*|*\"*)
196 quote_arg
="'$arg'" ;;
197 *) quote_arg
="$arg" ;;
200 base_compile
="$base_compile$lastarg"
205 # Get the name of the library object.
206 libobj
=`echo "$srcfile" | sed -e 's%^.*/%%'`
208 # Recognize several different file suffixes.
211 *.c
++) xform
='c++' ;;
216 *.
for) xform
='for' ;;
219 libobj
=`echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
222 *.lo
) obj
=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
224 echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2
229 if test -z "$base_compile"; then
230 echo "$progname: you must specify a compilation command" 1>&2
235 # Delete any leftover library objects.
236 if test "$build_old_libs" = yes; then
237 $run $rm $obj $libobj
238 trap "$run $rm $obj $libobj; exit 1" 1 2 15
241 trap "$run $rm $libobj; exit 1" 1 2 15
244 # Only build a PIC object if we are building libtool libraries.
245 if test "$build_libtool_libs" = yes; then
246 # All platforms use -DPIC, to notify preprocessed assembler code.
247 $show "$base_compile$pic_flag -DPIC $srcfile"
248 if $run eval "$base_compile$pic_flag -DPIC $srcfile"; then :
250 test -n "$obj" && $run $rm $obj
254 # If we have no pic_flag, then copy the object into place and finish.
255 if test -z "$pic_flag"; then
256 $show "$LN_S $obj $libobj"
257 $run $LN_S $obj $libobj
261 # Just move the object, then go on to compile the next one
262 $show "$mv $obj $libobj"
263 $run $mv $obj $libobj ||
exit 1
266 # Only build a position-dependent object if we build old libraries.
267 if test "$build_old_libs" = yes; then
268 $show "$base_compile $srcfile"
269 if $run eval "$base_compile $srcfile"; then :
271 $run $rm $obj $libobj
276 # Create an invalid libtool object if no PIC, so that we don't accidentally
277 # link it into a program.
278 if test "$build_libtool_libs" != yes; then
279 $show "echo timestamp > $libobj"
280 $run eval "echo timestamp > $libobj" ||
exit $?
288 progname
="$progname: link"
289 # Go through the arguments, transforming them on the way.
293 compile_command
="$cc"
294 finalize_command
="$cc"
302 link_against_libtool_libs
=
312 # We need to know -static, to get the right output filenames.
317 build_libtool_libs
=no
326 # If the previous option needs an argument, assign it.
327 if test -n "$prev"; then
330 compile_command
="$compile_command @OUTPUT@"
331 finalize_command
="$finalize_command @OUTPUT@"
346 -allow-undefined) allow_undefined
=yes ;;
350 compile_command
="$compile_command $export_dynamic_flag"
351 finalize_command
="$finalize_command $export_dynamic_flag"
356 dir
=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
361 echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
365 deplibs
="$deplibs $arg"
368 -l*) deplibs
="$deplibs $arg" ;;
378 link_static
="`eval echo \"$link_static_flag\"`"
379 compile_command
="$compile_command $link_static"
384 echo "$progname: \`-version-file' has been replaced by \`-version-info'" 1>&2
394 -*) cc
="$cc $arg" ;; # Some other compiler flag.
402 # Find the relevant object directory and library name.
403 file=`echo "$arg" | sed 's%^.*/%%'`
404 dir
=`echo "$arg" | sed 's%/[^/]*$%/%'`
405 test "$dir" = "$arg" && dir
=
413 libobjs
="$libobjs $arg"
417 # A libtool-controlled library.
423 # Check to see that this really is a libtool archive.
424 if egrep "^# Generated by $PROGRAM" $arg >/dev
/null
2>&1; then :
426 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
430 # If there is no directory component, then add one.
436 if test -z "$libdir"; then
437 echo "$progname: \`$arg' contains no -rpath information" 1>&2
441 # Get the name of the library we link against.
443 for l
in $old_library $library_names; do
447 if test -z "$linklib"; then
448 echo "$progname: cannot find name of link library for \`$arg'" 1>&2
452 # Find the relevant object directory and library name.
453 name
=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'`
454 dir
=`echo "$arg" | sed 's%/[^/]*$%%'`
455 if test "$dir" = "$arg"; then
461 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
462 link_against_libtool_libs
="$link_against_libtool_libs $arg"
463 if test -n "$shlibpath_var"; then
464 # Make sure the rpath contains only unique directories.
465 case "$temp_rpath " in
467 *) temp_rpath
="$temp_rpath $dir" ;;
471 if test -n "$hardcode_libdir_flag_spec"; then
472 if test -n "$hardcode_libdir_separator"; then
473 if test -z "$hardcode_libdirs"; then
474 # Put the magic libdir with the hardcode flag.
475 hardcode_libdirs
="$libdir"
476 libdir
="@HARDCODE_LIBDIRS@"
478 # Just accumulate the libdirs.
479 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
484 if test -n "$libdir"; then
485 hardcode_libdir_flag
=`eval echo \"$hardcode_libdir_flag_spec\"`
486 compile_command
="$compile_command $hardcode_libdir_flag"
487 finalize_command
="$finalize_command $hardcode_libdir_flag"
489 elif test "$hardcode_runpath_var" = yes; then
490 # Do the same for the permanent run path.
491 case "$perm_rpath " in
493 *) perm_rpath
="$perm_rpath $libdir" ;;
498 case "$hardcode_action" in
500 if test "$hardcode_direct" = no
; then
501 compile_command
="$compile_command $dir/$linklib"
502 elif test "$hardcode_minus_L" = no
; then
503 compile_command
="$compile_command -L$dir -l$name"
504 elif test "$hardcode_shlibpath_var" = no
; then
505 compile_shlibpath
="$compile_shlibpath$dir:"
506 compile_command
="$compile_command -l$name"
511 # We need an absolute path.
515 absdir
=`cd "$dir" && pwd`
516 if test -z "$absdir"; then
517 echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
524 if test "$hardcode_direct" = yes; then
525 compile_command
="$compile_command $dir/$linklib"
526 elif test "$hardcode_minus_L" = yes; then
527 compile_command
="$compile_command -L$dir -l$name"
528 elif test "$hardcode_shlibpath_var" = yes; then
529 compile_shlibpath
="$compile_shlibpath$dir:"
530 compile_command
="$compile_command -l$name"
535 echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
540 # Finalize command for both is simple: just hardcode it.
541 if test "$hardcode_direct" = yes; then
542 finalize_command
="$finalize_command $libdir/$linklib"
543 elif test "$hardcode_minus_L" = yes; then
544 finalize_command
="$finalize_command -L$libdir -l$name"
545 elif test "$hardcode_shlibpath_var" = yes; then
546 finalize_shlibpath
="$finalize_shlibpath$libdir:"
547 finalize_command
="$finalize_command -l$name"
549 # We can't seem to hardcode it, guess we'll fake it.
550 finalize_command
="$finalize_command -L$libdir -l$name"
553 # Transform directly to old archives if we don't build new libraries.
554 if test -n "$pic_flag" && test -z "$old_library"; then
555 echo "$progname: cannot find static library for \`$arg'" 1>&2
558 test -n "$old_library" && linklib
="$old_library"
559 compile_command
="$compile_command $dir/$linklib"
560 finalize_command
="$finalize_command $dir/$linklib"
566 echo "$progname: unknown file suffix for \`$arg'" 1>&2
572 compile_command
="$compile_command $arg"
573 finalize_command
="$finalize_command $arg"
576 if test -n "$prev"; then
577 echo "$progname: the \`$prevarg' option requires an argument" 1>&2
582 # Substitute the hardcoded libdirs into the compile commands.
583 if test "$hardcode_libdir_colon_separated" = yes; then
584 compile_command
=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
585 finalize_command
=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
592 echo "$progname: you must specify an output file" 1>&2
598 echo "$progname: output file \`$output' must have no directory components" 1>&2
603 libname
=`echo "$output" | sed 's/\.la$//'`
605 # All the library-specific variables (install_libdir is set above).
613 if test -n "$objs"; then
614 echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
618 # How the heck are we supposed to write a wrapper for a shared library?
619 if test -n "$link_against_libtool_libs"; then
620 echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
624 if test -z "$install_libdir"; then
625 echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
629 # Parse the version information argument.
630 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=':'
634 if test -n "$5"; then
635 echo "$progname: too many parameters to \`-version-info'" 1>&2
640 test -n "$2" && current
="$2"
641 test -n "$3" && revision
="$3"
642 test -n "$4" && age
="$4"
644 # Check that each of the things are valid numbers.
646 0 |
[1-9] |
[1-9][0-9]*) ;;
648 echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
649 echo "$progname: \`$vinfo' is not valid version information" 1>&2
655 0 |
[1-9] |
[1-9][0-9]*) ;;
657 echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
658 echo "$progname: \`$vinfo' is not valid version information" 1>&2
664 0 |
[1-9] |
[1-9][0-9]*) ;;
666 echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
667 echo "$progname: \`$vinfo' is not valid version information" 1>&2
672 if test $age -gt $current; then
673 echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
674 echo "$progname: \`$vinfo' is not valid version information" 1>&2
678 # Calculate the version variables.
679 version_vars
="version_type current age revision"
680 case "$version_type" in
684 version_vars
="$version_vars major versuffix"
685 major
=`expr $current - $age`
686 versuffix
="$major.$age.$revision"
690 version_vars
="$version_vars versuffix verstring"
691 major
=`expr $current - $age`
692 versuffix
="$current.$age.$revision"
693 verstring
="$versuffix"
695 # Add in all the interfaces that we are compatible with.
697 while test $loop != 0; do
698 iface
=`expr $current - $loop`
699 loop
=`expr $loop - 1`
700 verstring
="$verstring:${iface}.0"
703 # Make executables depend on our current version.
704 verstring
="$verstring:${current}.0"
708 version_vars
="$version_vars major versuffix"
710 versuffix
="$current.$revision"
714 echo "$progname: unknown library version type \`$version_type'" 1>&2
715 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
720 # Create the output directory, or remove our outputs if we need to.
721 if test -d $objdir; then
722 $show "$rm $objdir/$libname.*"
723 $run $rm $objdir/$libname.
*
725 $show "$mkdir $objdir"
726 $run $mkdir $objdir ||
exit $?
729 # Check to see if the archive will have undefined symbols.
730 if test "$allow_undefined" = yes; then
731 if test "$allow_undefined_flag" = unsupported
; then
732 echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
733 build_libtool_libs
=no
737 allow_undefined_flag
=
740 if test "$build_libtool_libs" = yes; then
741 # Get the real and link names of the library.
742 library_names
=`eval echo \"$library_names_spec\"`
743 set dummy
$library_names
747 if test -n "$soname_spec"; then
748 soname
=`eval echo \"$soname_spec\"`
753 lib
="$objdir/$realname"
757 linknames
="$linknames $link"
760 # Use standard objects if they are PIC.
761 test -z "$pic_flag" && libobjs
=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'`
763 # Do each of the archive commands.
764 cmds
=`eval echo \"$archive_cmds\"`
765 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
769 $run eval "$cmd" ||
exit $?
773 # Create links to the real library.
774 for link
in $linknames; do
775 $show "(cd $objdir && $LN_S $realname $link)"
776 $run eval "(cd $objdir && $LN_S $realname $link)" ||
exit $?
779 # If -export-dynamic was specified, set the dlname.
780 if test "$export_dynamic" = yes; then
781 # On all known operating systems, these are identical.
788 if test -n "$link_against_libtool_libs"; then
789 echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
793 if test -n "$deplibs"; then
794 echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
797 if test -n "$install_libdir"; then
798 echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
801 if test -n "$vinfo"; then
802 echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
807 if test -n "$objs"; then
808 echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
812 obj
=`echo "$output" | sed 's/\.lo$/.o/'`
820 # Delete the old objects.
821 $run $rm $obj $libobj
823 # Create the old-style object.
824 reload_objs
="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
827 cmds
=`eval echo \"$reload_cmds\"`
828 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
832 $run eval "$cmd" ||
exit $?
836 # Exit if we aren't doing a library object file.
837 test -z "$libobj" && exit 0
839 if test "$build_libtool_libs" != yes; then
840 # Create an invalid libtool object if no PIC, so that we don't
841 # accidentally link it into a program.
842 $show "echo timestamp > $libobj"
843 $run eval "echo timestamp > $libobj" ||
exit $?
847 if 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 $run eval "$cmd" ||
exit $?
860 # Just create a symlink.
861 $show "$LN_S $obj $libobj"
862 $run $LN_S $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/ $//'`
880 finalize_command
=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'`
883 if test -z "$link_against_libtool_libs" ||
test "$build_libtool_libs" != yes; then
884 # Replace the output file specification.
885 compile_command
=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
886 finalize_command
=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
888 # We have no uninstalled library dependencies, so finalize right now.
889 $show "$compile_command"
890 $run $compile_command
893 # If we failed to link statically, then try again.
894 if test $status -ne 0 && test -n "$link_static"; then
895 echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2
896 compile_command
=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"`
897 $show "$finalize_command"
898 $run $finalize_command
904 # Replace the output file specification.
905 compile_command
=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
906 finalize_command
=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
908 # Create the binary in the object directory, then wrap it.
909 if test -d $objdir; then :
911 $show "$mkdir $objdir"
912 $run $mkdir $objdir ||
exit $?
915 if test -n "$shlibpath_var"; then
916 # We should set the shlibpath_var
918 for dir
in $temp_rpath; do
925 # Relative path: add a thisdir entry.
926 rpath
="$rpath\$thisdir/$dir:"
933 # Delete the old output file.
936 if test -n "$compile_shlibpath"; then
937 compile_command
="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
939 if test -n "$finalize_shlibpath"; then
940 finalize_command
="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
943 if test -n "$perm_rpath"; then
944 # We should set the runpath_var.
946 for dir
in $perm_rpath; do
949 compile_command
="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
950 finalize_command
="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
953 case "$hardcode_action" in
955 # AGH! Flame the AIX and HP-UX people for me, will ya?
956 echo "$progname: warning: using a buggy system linker" 1>&2
957 echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
961 $show "$compile_command"
962 $run eval "$compile_command" ||
exit $?
964 # Now create the wrapper script.
965 echo "creating $output"
967 # Only actually do things if our run command is non-null.
968 if test -z "$run"; then
970 trap "$rm $output; exit 1" 1 2 15
975 # $output - temporary wrapper script for $objdir/$output
976 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
978 # The $output program cannot be directly executed until all the libtool
979 # libraries that it depends on are installed.
981 # This wrapper script should never be moved out of \``pwd`'.
982 # If it is, it will not operate correctly.
984 # This environment variable determines our operation mode.
985 if test "\$libtool_install_magic" = "$magic"; then
986 # install mode needs the following variables:
987 link_against_libtool_libs='$link_against_libtool_libs'
988 finalize_command='$finalize_command'
990 # Find the directory that this script lives in.
991 thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\`
992 test "x\$thisdir" = "x\$0" && thisdir=.
994 # Try to get the absolute directory name.
995 absdir=\`cd "\$thisdir" && pwd\`
996 test -n "\$absdir" && thisdir="\$absdir"
998 progdir="\$thisdir/$objdir"
1001 if test -f "\$progdir/\$program"; then
1002 # Run the actual program with our arguments.
1006 # Quote arguments (to preserve shell metacharacters).
1007 args="\$args '\$arg'"
1010 # Export the path to the program.
1011 PATH="\$progdir:\$PATH"
1015 # Export our shlibpath_var if we have one.
1016 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1017 cat >> $output <<EOF
1019 # Add our own library path to $shlibpath_var
1020 $shlibpath_var="$temp_rpath\$$shlibpath_var"
1022 # Some systems cannot cope with colon-terminated $shlibpath_var
1023 $shlibpath_var=\`echo \$$shlibpath_var | sed -e 's/:*\$//'\`
1025 export $shlibpath_var
1029 cat >> $output <<EOF
1031 eval "exec \$program \$args"
1033 echo "\$0: cannot exec \$program \$args"
1036 # The program doesn't exist.
1037 echo "\$0: error: \$progdir/\$program does not exist" 1>&2
1038 echo "This script is just a wrapper for \$program." 1>&2
1039 echo "See the $PACKAGE documentation for more information." 1>&2
1051 # See if we need to build an old-fashioned archive.
1052 if test "$build_old_libs" = "yes"; then
1053 # Now set the variables for building old libraries.
1054 oldlib
="$objdir/$libname.a"
1056 # Transform .lo files to .o files.
1057 oldobjs
="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
1059 if test -d "$objdir"; then
1063 $show "$mkdir $objdir"
1067 # Do each command in the archive commands.
1068 cmds
=`eval echo \"$old_archive_cmds\"`
1069 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1070 for cmd
in $cmds; do
1073 $run eval "$cmd" ||
exit $?
1078 # Now create the libtool archive.
1082 test "$build_old_libs" = yes && old_library
="$libname.a"
1084 echo "creating $output"
1086 # Only create the output if not a dry run.
1087 if test -z "$run"; then
1089 # $output - a libtool library file
1090 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1092 # The name that we can dlopen(3).
1095 # Names of this library.
1096 library_names='$library_names'
1098 # The name of the static archive.
1099 old_library='$old_library'
1101 # Version information for $libname.
1106 # Directory that this library needs to be installed in:
1107 libdir='$install_libdir'
1111 # Do a symbolic link so that the libtool archive can be found in
1112 # LD_LIBRARY_PATH before the program is installed.
1113 $show "(cd $objdir && $LN_S ../$output $output)"
1114 $run eval "(cd $objdir && $LN_S ../$output $output)" ||
exit 1
1120 # libtool install mode
1122 progname
="$progname: install"
1124 # The first argument is the name of the installation program.
1125 install_prog
="$nonopt"
1126 install_prog_shell
=""
1128 # CYGNUS LOCAL: Handle /bin/sh at the start.
1129 if test "$install_prog" = "${CONFIG_SHELL}"; then
1130 install_prog_shell
="$install_prog "
1135 # We need to accept at least all the BSD install flags.
1145 if test -n "$dest"; then
1146 files
="$files $dest"
1164 # If the previous option needed an argument, then skip it.
1165 if test -n "$prev"; then
1173 install_prog
="$install_prog $arg"
1176 if test -z "$install_prog"; then
1177 echo "$progname: you must specify an install program" 1>&2
1182 if test -n "$prev"; then
1183 echo "$progname: the \`$prev' option requires an argument" 1>&2
1188 if test -z "$files"; then
1189 if test -z "$dest"; then
1190 echo "$progname: no file or destination specified" 1>&2
1192 echo "$progname: you must specify a destination" 1>&2
1198 # Strip any trailing slash from the destination.
1199 dest
=`echo "$dest" | sed 's%/$%%'`
1201 # Check to see that the destination is a directory.
1202 test -d "$dest" && isdir
=yes
1203 if test -n "$isdir"; then
1207 destdir
=`echo "$dest" | sed 's%/[^/]*$%%'`
1208 test "$destdir" = "$dest" && destdir
=.
1209 destname
=`echo "$dest" | sed 's%^.*/%%'`
1211 # Not a directory, so check to see that there is only one file specified.
1213 if test $# -gt 2; then
1214 echo "$progname: \`$dest' is not a directory" 1>&2
1222 for file in $files; do
1226 echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
1238 for file in $files; do
1240 # Do each installation.
1243 # Do the static libraries later.
1244 staticlibs
="$staticlibs $file"
1248 # Check to see that this really is a libtool archive.
1249 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then :
1251 echo "$progname: \`$file' is not a valid libtool archive" 1>&2
1258 # If there is no directory component, then add one.
1264 # Add the libdir to current_libdirs if it is the destination.
1265 if test "$destdir" = "$libdir"; then
1266 case "$current_libdirs " in
1268 *) current_libdirs
="$current_libdirs $libdir" ;;
1271 # Note the libdir as a future libdir.
1272 case "$future_libdirs " in
1274 *) future_libdirs
="$future_libdirs $libdir" ;;
1278 dir
="`echo "$file" | sed 's%/[^/]*$%%'`/"
1279 test "$dir" = "$file/" && dir
=
1282 # See the names of the shared library.
1283 set dummy
$library_names
1284 if test -n "$2"; then
1289 # Install the shared library and build the symlinks.
1290 $show "$install_prog_shell$install_prog $dir/$realname $destdir/$realname"
1291 $run eval "$install_prog_shell$install_prog $dir/$realname $destdir/$realname" ||
exit $?
1292 test "X$dlname" = "X$realname" && dlname
=
1294 # Support stripping libraries.
1295 if test -n "$stripme"; then
1296 if test -n "$striplib"; then
1297 $show "$striplib $destdir/$realname"
1298 $run $striplib $destdir/$realname ||
exit $?
1300 echo "$progname: warning: no library stripping program" 1>&2
1304 if test $# -gt 0; then
1305 # Delete the old symlinks.
1309 rmcmd
="$rmcmd $destdir/$linkname"
1314 # ... and create new ones.
1317 test "X$dlname" = "X$linkname" && dlname
=
1318 $show "(cd $destdir && $LN_S $realname $linkname)"
1319 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1323 if test -n "$dlname"; then
1324 # Install the dynamically-loadable library.
1325 $show "$install_prog_shell$install_prog $dir/$dlname $destdir/$dlname"
1326 $run eval "$install_prog_shell$install_prog $dir/$dlname $destdir/$dlname" ||
exit $?
1329 # Do each command in the postinstall commands.
1330 lib
="$destdir/$realname"
1331 cmds
=`eval echo \"$postinstall_cmds\"`
1332 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1333 for cmd
in $cmds; do
1336 $run eval "$cmd" ||
exit $?
1341 # Install the pseudo-library for information purposes.
1342 name
=`echo "$file" | sed 's%^.*/%%'`
1343 $show "$install_prog_shell$install_prog $file $destdir/$name"
1344 $run $install_prog_shell$install_prog $file $destdir/$name ||
exit $?
1346 # Maybe install the static library, too.
1347 test -n "$old_library" && staticlibs
="$staticlibs $dir/$old_library"
1351 # Install (i.e. copy) a libtool object.
1353 # Figure out destination file name, if it wasn't already specified.
1354 if test -n "$destname"; then
1355 destfile
="$destdir/$destname"
1357 destfile
=`echo "$file" | sed 's%^.*/%%;'`
1358 destfile
="$destdir/$destfile"
1361 # Deduce the name of the destination old-style object file.
1364 staticdest
=`echo "$destfile" | sed 's/\.lo$/\.o/;'`
1367 staticdest
="$destfile"
1371 echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
1377 # Install the libtool object if requested.
1378 if test -n "$destfile"; then
1379 $show "$install_prog_shell$install_prog $file $destfile"
1380 $run $install_prog_shell$install_prog $file $destfile ||
exit $?
1383 # Install the old object if enabled.
1384 if test "$build_old_libs" = yes; then
1385 # Deduce the name of the old-style object file.
1386 staticobj
=`echo "$file" | sed 's/\.lo$/\.o/;'`
1388 $show "$install_prog_shell$install_prog $staticobj $staticdest"
1389 $run $install_prog_shell$install_prog $staticobj $staticdest ||
exit $?
1395 # Do a test to see if this is really a libtool program.
1396 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then
1397 # This variable tells wrapper scripts just to set variables rather
1398 # than running their programs.
1399 libtool_install_magic
="$magic"
1400 link_against_libtool_libs
=
1403 # If there is no directory component, then add one.
1409 # Check the variables that should have been set.
1410 if test -z "$link_against_libtool_libs" ||
test -z "$finalize_command"; then
1411 echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
1416 for lib
in $link_against_libtool_libs; do
1417 # Check to see that each library is installed.
1419 if test -f "$lib"; then
1420 # If there is no directory component, then add one.
1426 libfile
="$libdir/`echo "$lib" | sed 's%^.*/%%g'`"
1427 if test -z "$libdir"; then
1428 echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
1429 elif test -f "$libfile"; then :
1431 echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1436 if test "$hardcode_action" = relink
; then
1437 if test "$finalize" = yes; then
1438 echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1439 $show "$finalize_command"
1440 if $run $finalize_command; then :
1442 echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
1445 file="$objdir/$file"T
1447 echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1450 # Install the binary that we compiled earlier.
1451 dir
=`echo "$file" | sed 's%/[^/]*$%%'`
1452 if test "$file" = "$dir"; then
1453 file="$objdir/$file"
1455 file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`"
1460 $show "$install_prog_shell$install_prog$stripme $file $dest"
1461 $run $install_prog_shell$install_prog$stripme $file $dest ||
exit $?
1466 for file in $staticlibs; do
1467 name
=`echo "$file" | sed 's%^.*/%%'`
1469 # Set up the ranlib parameters.
1470 oldlib
="$destdir/$name"
1472 $show "$install_prog_shell$install_prog $file $oldlib"
1473 $run $install_prog_shell$install_prog $file $oldlib ||
exit $?
1475 # Support stripping libraries.
1476 if test -n "$stripme"; then
1477 if test -n "$old_striplib"; then
1478 $show "$old_striplib $oldlib"
1479 $run $old_striplib $oldlib ||
exit $?
1481 echo "$progname: warning: no static library stripping program" 1>&2
1485 # Do each command in the postinstall commands.
1486 cmds
=`eval echo \"$old_postinstall_cmds\"`
1487 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1488 for cmd
in $cmds; do
1491 $run eval "$cmd" ||
exit $?
1496 if test -n "$future_libdirs"; then
1497 echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1500 if test -n "$current_libdirs"; then
1501 # Maybe just do a dry run.
1502 test -n "$run" && current_libdirs
=" -n$current_libdirs"
1503 ${CONFIG_SHELL} $0 --finish$current_libdirs
1510 # libtool dlname mode
1512 progname
="$progname: dlname"
1516 ltlibs
="$ltlibs $lib"
1519 if test -z "$ltlibs"; then
1520 echo "$progname: you must specify at least one LTLIBRARY" 1>&2
1525 # Now check to make sure each one is a valid libtool library.
1527 for lib
in $ltlibs; do
1532 # Check to see that this really is a libtool archive.
1533 if egrep "^# Generated by $PROGRAM" $arg >/dev
/null
2>&1; then :
1535 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
1540 # If there is no directory component, then add one.
1546 if test -z "$libdir"; then
1547 echo "$progname: \`$arg' contains no -rpath information" 1>&2
1549 elif test -n "$dlname"; then
1550 echo "$libdir/$dlname"
1551 elif test -z "$library_names"; then
1552 echo "$progname: \`$arg' is not a shared library" 1>&2
1555 echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
1562 # libtool finish mode
1564 progname
="$progname: finish"
1567 if test -n "$finish_cmds" && test -n "$libdirs"; then
1570 libdirs
="$libdirs $dir"
1573 for libdir
in $libdirs; do
1574 # Do each command in the postinstall commands.
1575 cmds
=`eval echo \"$finish_cmds\"`
1576 IFS
="${IFS= }"; save_ifs
="$IFS"; IFS
=';'
1577 for cmd
in $cmds; do
1586 echo "To link against installed libraries in LIBDIR, users may have to:"
1587 if test -n "$shlibpath_var"; then
1588 echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
1590 echo " - use the \`-LLIBDIR' linker flag"
1594 # libtool uninstall mode
1596 progname
="$progname: uninstall"
1603 -*) rm="$rm $arg" ;;
1604 *) files
="$files $arg" ;;
1608 if test -z "$rm"; then
1609 echo "$progname: you must specify an RM program" 1>&2
1614 for file in $files; do
1615 dir
=`echo "$file" | sed -e 's%/[^/]*$%%'`
1616 test "$dir" = "$file" && dir
=.
1617 name
=`echo "$file" | sed -e 's%^.*/%%'`
1623 # Possibly a libtool archive, so verify it.
1624 if egrep "^# Generated by $PROGRAM" $file >/dev
/null
2>&1; then
1627 # Delete the libtool libraries and symlinks.
1628 for n
in $library_names; do
1629 rmfiles
="$rmfiles $dir/$n"
1630 test "X$n" = "X$dlname" && dlname
=
1632 test -n "$dlname" && rmfiles
="$rmfiles $dir/$dlname"
1633 test -n "$old_library" && rmfiles
="$rmfiles $dir/$old_library"
1635 # FIXME: should reinstall the best remaining shared library.
1640 if test "$build_old_libs" = yes; then
1641 oldobj
=`echo "$name" | sed 's/\.lo$/\.o/'`
1642 rmfiles
="$rmfiles $dir/$oldobj"
1647 $show "$rm $rmfiles"
1654 echo "$progname: you must specify a MODE" 1>&2
1655 echo "$generic_help" 1>&2
1660 echo "$progname: invalid operation mode \`$mode'" 1>&2
1661 echo "$generic_help" 1>&2
1663 fi # test -z "$show_help"
1665 # We need to display help for each of the modes.
1668 Usage: $progname [OPTION]... [MODE-ARG]...
1670 Provide generalized library-building support services.
1672 -n, --dry-run display commands without modifying any files
1673 --features display configuration information and exit
1674 --finish same as \`--mode=finish'
1675 --help display this help message and exit
1676 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
1677 --version print version information
1679 MODE must be one of the following:
1681 compile compile a source file into a libtool object
1682 dlname print filenames to use to \`dlopen' libtool libraries
1683 finish complete the installation of libtool libraries
1684 install install libraries or executables
1685 link create a library or an executable
1686 uninstall remove libraries from an installed directory
1688 MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
1689 a more detailed description of MODE.
1695 Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1697 Compile a source file into a libtool library object.
1699 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1700 from the given SOURCEFILE.
1702 The output file name is determined by removing the directory component from
1703 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1704 library object suffix, \`.lo'.
1710 Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
1712 Print filenames to use to \`dlopen' libtool libraries.
1714 Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
1715 was linked using the \`-export-dynamic' option).
1717 The names to use are printed to standard output, one per line.
1723 Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1725 Complete the installation of libtool libraries.
1727 Each LIBDIR is a directory that contains libtool libraries.
1729 The commands that this mode executes may require superuser privileges. Use
1730 the \`--dry-run' option if you just want to see what would be executed.
1736 Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1738 Install executables or libraries.
1740 INSTALL-COMMAND is the installation command. The first component should be
1741 either the \`install' or \`cp' program.
1743 The rest of the components are interpreted as arguments to that command (only
1744 BSD-compatible install options are recognized).
1750 Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1752 Link object files or libraries together to form another library, or to
1753 create an executable program.
1755 LINK-COMMAND is a command using the C compiler that you would use to create
1756 a program from several object files.
1758 The following components of LINK-COMMAND are treated specially:
1760 -allow-undefined allow a libtool library to reference undefined symbols
1761 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1762 -LLIBDIR search LIBDIR for required installed libraries
1763 -lNAME OUTPUT-FILE requires the installed library libNAME
1764 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1765 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1766 -static do not do any dynamic linking or shared library creation
1767 -version-info CURRENT[:REVISION[:AGE]]
1768 specify library version info [each variable defaults to 0]
1770 All other options (arguments beginning with \`-') are ignored.
1772 Every other argument is treated as a filename. Files ending in \`.la' are
1773 treated as uninstalled libtool libraries, other files are standard or library
1776 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
1777 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
1779 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
1782 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
1783 created, otherwise an executable program is created.
1789 Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1791 Remove libraries from an installation directory.
1793 RM is the name of the program to use to delete files associated with each FILE
1794 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1797 If FILE is a libtool library, all the files associated with it are deleted.
1798 Otherwise, only FILE itself is deleted using RM.
1803 echo "$progname: invalid operation mode \`$mode'" 1>&2
1812 echo "Try \`$progname --help' for more information about other modes."