1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
51 # The name of this program.
52 progname=`$echo "$0" | sed 's%^.*/%%'`
59 TIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)"
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
73 NL2SP='tr \015\012 \040\040'
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
83 if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
87 if test "$LTCONFIG_VERSION" != "$VERSION"; then
88 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
93 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
94 echo "$modename: not configured to build any kind of library" 1>&2
95 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
108 lo2o="s/\\.lo\$/.${objext}/"
109 o2lo="s/\\.${objext}\$/.lo/"
112 # Parse our command line options once, thoroughly.
119 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
123 # If the previous option needs an argument, assign it.
124 if test -n "$prev"; then
127 execute_dlfiles="$execute_dlfiles $arg"
132 # Check whether tagname contains only valid characters
135 echo "$progname: invalid tag name: $tagname" 1>&2
142 # Don't test for the "default" C tag, as we know, it's there, but
143 # not specially marked.
144 taglist="$taglist $tagname"
147 if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
148 taglist="$taglist $tagname"
149 # Evaluate the configuration.
150 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
152 echo "$progname: ignoring unknown tag $tagname" 1>&2
167 # Have we seen a non-optional argument yet?
174 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
179 sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0"
180 # Now print the configurations for the tags.
181 for tagname in $taglist; do
182 sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
188 echo "$progname: enabling shell trace mode"
198 if test "$build_libtool_libs" = yes; then
199 echo "enable shared libraries"
201 echo "disable shared libraries"
203 if test "$build_old_libs" = yes; then
204 echo "enable static libraries"
206 echo "disable static libraries"
211 --finish) mode="finish" ;;
213 --mode) prevopt="--mode" prev=mode ;;
214 --mode=*) mode="$optarg" ;;
220 --tag) prevopt="--tag" prev=tag ;;
222 set tag "$optarg" ${1+"$@"}
233 $echo "$modename: unrecognized option \`$arg'" 1>&2
245 if test -n "$prevopt"; then
246 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
251 # If this variable is set in any of the actions, the command in it
252 # will be execed at the end. This prevents here-documents from being
253 # left over by shells.
256 if test -z "$show_help"; then
258 # Infer the operation mode.
259 if test -z "$mode"; then
261 *cc | *++ | gcc* | *-gcc*)
273 *db | *dbx | *strace | *truss)
283 # If we have no mode, but dlfiles were specified, then do execute mode.
284 test -n "$execute_dlfiles" && mode=execute
286 # Just use the default operation mode.
287 if test -z "$mode"; then
288 if test -n "$nonopt"; then
289 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
291 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
298 # Only execute mode is allowed to have -dlopen flags.
299 if test -n "$execute_dlfiles" && test "$mode" != execute; then
300 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
305 # Change the help message to a mode-specific one.
307 help="Try \`$modename --help --mode=$mode' for more information."
309 # These modes are in order of execution frequency so that they run quickly.
311 # libtool compile mode
313 modename="$modename: compile"
314 # Get the compilation command and the source file.
327 # Aesthetically quote the previous argument.
329 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
332 # Double-quote args containing other shell metacharacters.
333 # Many Bourne shells cannot handle close brackets correctly
334 # in scan sets, so we specify it separately.
335 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
340 # Add the previous argument to base_compile.
341 if test -z "$base_compile"; then
342 base_compile="$lastarg"
344 base_compile="$base_compile $lastarg"
350 # Accept any command-line options.
353 if test "$user_target" != "no"; then
354 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
381 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
383 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
387 # Double-quote args containing other shell metacharacters.
388 # Many Bourne shells cannot handle close brackets correctly
389 # in scan sets, so we specify it separately.
391 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
395 lastarg="$lastarg $arg"
398 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
400 # Add the arguments to base_compile.
401 if test -z "$base_compile"; then
402 base_compile="$lastarg"
404 base_compile="$base_compile $lastarg"
412 # The next one is the -o target name
417 # We got the output file
424 # Accept the current argument as the source file.
428 # Aesthetically quote the previous argument.
430 # Backslashify any backslashes, double quotes, and dollar signs.
431 # These are the only characters that are still specially
432 # interpreted inside of double-quoted scrings.
433 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
435 # Double-quote args containing other shell metacharacters.
436 # Many Bourne shells cannot handle close brackets correctly
437 # in scan sets, so we specify it separately.
439 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
440 lastarg="\"$lastarg\""
444 # Add the previous argument to base_compile.
445 if test -z "$base_compile"; then
446 base_compile="$lastarg"
448 base_compile="$base_compile $lastarg"
456 # Get the name of the library object.
457 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
460 $echo "$modename: you must specify a target with \`-o'" 1>&2
465 # Recognize several different file suffixes.
466 # If the user specifies -o file.o, it is replaced with file.lo
475 *.class) xform=class ;;
480 *.java) xform=java ;;
483 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
486 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
488 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
493 # Infer tagged configuration to use if any are available and
494 # if one wasn't chosen via the "--tag" command line option.
495 # Only attempt this if the compiler in the base compile
496 # command doesn't match the default compiler.
497 if test -n "$available_tags" && test -z "$tagname"; then
498 case $base_compile in
500 # Blanks in the command may have been stripped by the calling shell,
501 # but not from the CC environment variable when ltconfig was run.
504 for z in $available_tags; do
505 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
506 # Evaluate the configuration.
507 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
508 case $base_compile in
510 # The compiler in the base compile command matches
511 # the one in the tagged configuration.
512 # Assume this is the tagged configuration we want.
523 # If $tagname still isn't set, then no tagged configuration
524 # was found and let the user know that the "--tag" command
525 # line option must be used.
526 if test -z "$tagname"; then
527 echo "$modename: unable to infer tagged configuration"
528 echo "$modename: specify a tag with \`--tag'" 1>&2
531 # echo "$modename: using $tagname tagged configuration"
537 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
538 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
539 if test "X$xdir" = "X$obj"; then
544 lobj=${xdir}$objdir/$objname
546 if test -z "$base_compile"; then
547 $echo "$modename: you must specify a compilation command" 1>&2
552 # Delete any leftover library objects.
553 if test "$build_old_libs" = yes; then
554 removelist="$obj $lobj $libobj ${libobj}T"
556 removelist="$lobj $libobj ${libobj}T"
560 trap "$run $rm $removelist; exit 1" 1 2 15
562 # On Cygwin there's no "real" PIC flag so we must build both object types
564 cygwin* | mingw* | pw32* | os2*)
568 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
569 # non-PIC code in shared libraries is not supported
573 # Calculate the filename of the output object if compiler does
574 # not support -o with -c
575 if test "$compiler_c_o" = no; then
576 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
577 lockfile="$output_obj.lock"
578 removelist="$removelist $output_obj $lockfile"
579 trap "$run $rm $removelist; exit 1" 1 2 15
586 # Lock this critical section if it is needed
587 # We use this script file to make the link, it avoids creating a new file
588 if test "$need_locks" = yes; then
589 until $run ln "$0" "$lockfile" 2>/dev/null; do
590 $show "Waiting for $lockfile to be removed"
593 elif test "$need_locks" = warn; then
594 if test -f "$lockfile"; then
596 *** ERROR, $lockfile exists and contains:
597 `cat $lockfile 2>/dev/null`
599 This indicates that another process is trying to use the same
600 temporary object file, and libtool could not work around it because
601 your compiler does not support \`-c' and \`-o' together. If you
602 repeat this compilation, it may succeed, by chance, but you had better
603 avoid parallel builds (make -j) in this platform, or get a better
609 echo $srcfile > "$lockfile"
612 if test -n "$fix_srcfile_path"; then
613 eval srcfile=\"$fix_srcfile_path\"
616 $run $rm "$libobj" "${libobj}T"
618 # Create a libtool object file (analogous to a ".la" file),
619 # but don't create it if we're doing a dry run.
620 test -z "$run" && cat > ${libobj}T <<EOF
621 # $libobj - a libtool object file
622 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
624 # Please DO NOT delete this file!
625 # It is necessary for linking the library.
627 # Name of the PIC object.
630 # Only build a PIC object if we are building libtool libraries.
631 if test "$build_libtool_libs" = yes; then
632 # Without this assignment, base_compile gets emptied.
633 fbsd_hideous_sh_bug=$base_compile
635 if test "$pic_mode" != no; then
636 command="$base_compile $srcfile $pic_flag"
638 # Don't build PIC code
639 command="$base_compile $srcfile"
642 if test ! -d ${xdir}$objdir; then
643 $show "$mkdir ${xdir}$objdir"
644 $run $mkdir ${xdir}$objdir
646 if test $status -ne 0 && test ! -d ${xdir}$objdir; then
651 if test -z "$output_obj"; then
652 # Place PIC objects in $objdir
653 command="$command -o $lobj"
656 $run $rm "$lobj" "$output_obj"
659 if $run eval "$command"; then :
661 test -n "$output_obj" && $run $rm $removelist
665 if test "$need_locks" = warn &&
666 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
668 *** ERROR, $lockfile contains:
669 `cat $lockfile 2>/dev/null`
671 but it should contain:
674 This indicates that another process is trying to use the same
675 temporary object file, and libtool could not work around it because
676 your compiler does not support \`-c' and \`-o' together. If you
677 repeat this compilation, it may succeed, by chance, but you had better
678 avoid parallel builds (make -j) in this platform, or get a better
685 # Just move the object if needed, then go on to compile the next one
686 if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
687 $show "$mv $output_obj $lobj"
688 if $run $mv $output_obj $lobj; then :
696 # Append the name of the PIC object to the libtool object file.
697 test -z "$run" && cat >> ${libobj}T <<EOF
698 pic_object='$objdir/$objname'
702 # Allow error messages only from the first compilation.
703 suppress_output=' >/dev/null 2>&1'
705 # No PIC object so indicate it doesn't exist in the libtool
707 test -z "$run" && cat >> ${libobj}T <<EOF
713 # Only build a position-dependent object if we build old libraries.
714 if test "$build_old_libs" = yes; then
715 if test "$pic_mode" != yes; then
716 # Don't build PIC code
717 command="$base_compile $srcfile"
719 command="$base_compile $srcfile $pic_flag"
721 if test "$compiler_c_o" = yes; then
722 command="$command -o $obj"
725 # Suppress compiler output if we already did a PIC compilation.
726 command="$command$suppress_output"
727 $run $rm "$obj" "$output_obj"
729 if $run eval "$command"; then :
735 if test "$need_locks" = warn &&
736 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
738 *** ERROR, $lockfile contains:
739 `cat $lockfile 2>/dev/null`
741 but it should contain:
744 This indicates that another process is trying to use the same
745 temporary object file, and libtool could not work around it because
746 your compiler does not support \`-c' and \`-o' together. If you
747 repeat this compilation, it may succeed, by chance, but you had better
748 avoid parallel builds (make -j) in this platform, or get a better
755 # Just move the object if needed
756 if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
757 $show "$mv $output_obj $obj"
758 if $run $mv $output_obj $obj; then :
766 # Append the name of the non-PIC object the libtool object file.
767 # Only append if the libtool object file exists.
768 test -z "$run" && cat >> ${libobj}T <<EOF
769 # Name of the non-PIC object.
770 non_pic_object='$objname'
774 # Append the name of the non-PIC object the libtool object file.
775 # Only append if the libtool object file exists.
776 test -z "$run" && cat >> ${libobj}T <<EOF
777 # Name of the non-PIC object.
783 $run $mv "${libobj}T" "${libobj}"
785 # Unlock the critical section if it was locked
786 if test "$need_locks" != no; then
795 modename="$modename: link"
797 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
798 # It is impossible to link a dll without this setting, and
799 # we shouldn't force the makefile maintainer to figure out
800 # which system we are compiling for in order to pass an extra
801 # flag for every libtool invokation.
804 # FIXME: Unfortunately, there are problems with the above when trying
805 # to make a dll which has undefined symbols, in which case not
806 # even a static library is built. For now, we need to specify
807 # -no-undefined on the libtool link line when we can be certain
808 # that all symbols are satisfied, otherwise we get a static library.
815 libtool_args="$nonopt"
816 base_compile="$nonopt"
817 compile_command="$nonopt"
818 finalize_command="$nonopt"
831 lib_search_path=`pwd`
839 export_symbols_regex=
847 prefer_static_libs=no
859 # We need to know -static, to get the right output filenames.
863 -all-static | -static)
864 if test "X$arg" = "X-all-static"; then
865 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
866 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
868 if test -n "$link_static_flag"; then
869 dlopen_self=$dlopen_self_static
872 if test -z "$pic_flag" && test -n "$link_static_flag"; then
873 dlopen_self=$dlopen_self_static
876 build_libtool_libs=no
878 prefer_static_libs=yes
884 # See if our shared archives depend on static archives.
885 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
887 # Go through the arguments, transforming them on the way.
888 while test $# -gt 0; do
890 base_compile="$base_compile $arg"
893 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
894 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
898 libtool_args="$libtool_args $qarg"
900 # If the previous option needs an argument, assign it.
901 if test -n "$prev"; then
904 compile_command="$compile_command @OUTPUT@"
905 finalize_command="$finalize_command @OUTPUT@"
911 if test "$preload" = no; then
912 # Add the symbol object into the linking commands.
913 compile_command="$compile_command @SYMFILE@"
914 finalize_command="$finalize_command @SYMFILE@"
918 *.la | *.lo) ;; # We handle these cases below.
920 if test "$dlself" = no; then
928 if test "$prev" = dlprefiles; then
930 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
940 if test "$prev" = dlfiles; then
941 dlfiles="$dlfiles $arg"
943 dlprefiles="$dlprefiles $arg"
951 export_symbols="$arg"
952 if test ! -f "$arg"; then
953 $echo "$modename: symbol file \`$arg' does not exist"
960 export_symbols_regex="$arg"
970 if test -f "$arg"; then
973 for fil in `cat $save_arg`
975 # moreargs="$moreargs $fil"
977 # A libtool-controlled object.
979 # Check to see that this really is a libtool object.
980 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
985 # If there is no directory component, then add one.
987 */* | *\\*) . $arg ;;
991 if test -z "$pic_object" || \
992 test -z "$non_pic_object" ||
993 test "$pic_object" = none && \
994 test "$non_pic_object" = none; then
995 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
999 # Extract subdirectory from the argument.
1000 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1001 if test "X$xdir" = "X$arg"; then
1007 if test "$pic_object" != none; then
1008 # Prepend the subdirectory the object is found in.
1009 pic_object="$xdir$pic_object"
1011 if test "$prev" = dlfiles; then
1012 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1013 dlfiles="$dlfiles $pic_object"
1017 # If libtool objects are unsupported, then we need to preload.
1022 # CHECK ME: I think I busted this. -Ossama
1023 if test "$prev" = dlprefiles; then
1024 # Preload the old-style object.
1025 dlprefiles="$dlprefiles $pic_object"
1030 libobjs="$libobjs $pic_object"
1035 if test "$non_pic_object" != none; then
1036 # Prepend the subdirectory the object is found in.
1037 non_pic_object="$xdir$non_pic_object"
1039 # A standard non-PIC object
1040 non_pic_objects="$non_pic_objects $non_pic_object"
1041 if test -z "$pic_object" || test "$pic_object" = none ; then
1042 arg="$non_pic_object"
1046 # Only an error if not doing a dry-run.
1047 if test -z "$run"; then
1048 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1053 # Extract subdirectory from the argument.
1054 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1055 if test "X$xdir" = "X$arg"; then
1061 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1062 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1063 libobjs="$libobjs $pic_object"
1064 non_pic_objects="$non_pic_objects $non_pic_object"
1069 $echo "$modename: link input file \`$save_arg' does not exist"
1077 # We need an absolute path.
1079 [\\/]* | [A-Za-z]:[\\/]*) ;;
1081 $echo "$modename: only absolute run-paths are allowed" 1>&2
1085 if test "$prev" = rpath; then
1088 *) rpath="$rpath $arg" ;;
1093 *) xrpath="$xrpath $arg" ;;
1100 compiler_flags="$compiler_flags $qarg"
1102 compile_command="$compile_command $qarg"
1103 finalize_command="$finalize_command $qarg"
1107 linker_flags="$linker_flags $qarg"
1108 compiler_flags="$compiler_flags $wl$qarg"
1110 compile_command="$compile_command $wl$qarg"
1111 finalize_command="$finalize_command $wl$qarg"
1118 *" $qarg.framework "*) ;;
1119 *) deplibs="$deplibs $qarg.framework" # this is fixed later
1128 eval "$prev=\"\$arg\""
1139 if test -n "$link_static_flag"; then
1140 compile_command="$compile_command $link_static_flag"
1141 finalize_command="$finalize_command $link_static_flag"
1147 # FIXME: remove this flag sometime in the future.
1148 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1172 -export-symbols | -export-symbols-regex)
1173 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1174 $echo "$modename: more than one -exported-symbols argument is not allowed"
1177 if test "X$arg" = "X-export-symbols"; then
1185 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1186 # so, if we see these flags be careful not to treat them like -L
1188 case $with_gcc/$host in
1190 compile_command="$compile_command $arg"
1191 finalize_command="$finalize_command $arg"
1198 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1199 # We need an absolute path.
1201 [\\/]* | [A-Za-z]:[\\/]*) ;;
1203 absdir=`cd "$dir" && pwd`
1204 if test -z "$absdir"; then
1205 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1214 deplibs="$deplibs -L$dir"
1215 lib_search_path="$lib_search_path $dir"
1219 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1220 case :$dllsearchpath: in
1222 *) dllsearchpath="$dllsearchpath:$dir";;
1230 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1232 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1233 # These systems don't actually have a C or math library (as such)
1236 *-*-mingw* | *-*-os2*)
1237 # These systems don't actually have a C library (as such)
1238 test "X$arg" = "X-lc" && continue
1242 deplibs="$deplibs $arg"
1258 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1259 # The PATH hackery in wrapper scripts is required on Windows
1260 # in order for the loader to find any dlls it needs.
1261 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1262 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1265 *) no_install=yes ;;
1298 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1299 # We need an absolute path.
1301 [\\/]* | [A-Za-z]:[\\/]*) ;;
1303 $echo "$modename: only absolute run-paths are allowed" 1>&2
1309 *) xrpath="$xrpath $dir" ;;
1315 # The effects of -static are defined in a previous loop.
1316 # We used to do the same as -all-static on platforms that
1317 # didn't have a PIC flag, but the assumption that the effects
1318 # would be equivalent was wrong. It would break on at least
1319 # Digital Unix and AIX.
1334 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1336 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1337 for flag in $args; do
1340 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1345 compiler_flags="$compiler_flags $flag"
1348 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1352 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1354 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1355 for flag in $args; do
1358 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1363 compiler_flags="$compiler_flags $wl$flag"
1364 linker_flags="$linker_flags $flag"
1367 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1384 # Some other compiler flag.
1386 # Unknown arguments in both finalize_command and compile_command need
1387 # to be aesthetically quoted because they are evaled later.
1388 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1390 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1397 # A standard object.
1402 # A libtool-controlled object.
1404 # Check to see that this really is a libtool object.
1405 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1410 # If there is no directory component, then add one.
1412 */* | *\\*) . $arg ;;
1416 if test -z "$pic_object" || \
1417 test -z "$non_pic_object" ||
1418 test "$pic_object" = none && \
1419 test "$non_pic_object" = none; then
1420 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1424 # Extract subdirectory from the argument.
1425 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1426 if test "X$xdir" = "X$arg"; then
1432 if test "$pic_object" != none; then
1433 # Prepend the subdirectory the object is found in.
1434 pic_object="$xdir$pic_object"
1436 if test "$prev" = dlfiles; then
1437 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1438 dlfiles="$dlfiles $pic_object"
1442 # If libtool objects are unsupported, then we need to preload.
1447 # CHECK ME: I think I busted this. -Ossama
1448 if test "$prev" = dlprefiles; then
1449 # Preload the old-style object.
1450 dlprefiles="$dlprefiles $pic_object"
1455 libobjs="$libobjs $pic_object"
1460 if test "$non_pic_object" != none; then
1461 # Prepend the subdirectory the object is found in.
1462 non_pic_object="$xdir$non_pic_object"
1464 # A standard non-PIC object
1465 non_pic_objects="$non_pic_objects $non_pic_object"
1466 if test -z "$pic_object" || test "$pic_object" = none ; then
1467 arg="$non_pic_object"
1471 # Only an error if not doing a dry-run.
1472 if test -z "$run"; then
1473 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1478 # Extract subdirectory from the argument.
1479 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1480 if test "X$xdir" = "X$arg"; then
1486 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1487 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1488 libobjs="$libobjs $pic_object"
1489 non_pic_objects="$non_pic_objects $non_pic_object"
1496 deplibs="$deplibs $arg"
1497 old_deplibs="$old_deplibs $arg"
1502 # A libtool-controlled library.
1504 if test "$prev" = dlfiles; then
1505 # This library was specified with -dlopen.
1506 dlfiles="$dlfiles $arg"
1508 elif test "$prev" = dlprefiles; then
1509 # The library was specified with -dlpreopen.
1510 dlprefiles="$dlprefiles $arg"
1513 deplibs="$deplibs $arg"
1518 # Some other compiler argument.
1520 # Unknown arguments in both finalize_command and compile_command need
1521 # to be aesthetically quoted because they are evaled later.
1522 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1524 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1531 # Now actually substitute the argument into the commands.
1532 if test -n "$arg"; then
1533 compile_command="$compile_command $arg"
1534 finalize_command="$finalize_command $arg"
1536 done # argument parsing loop
1538 if test -n "$prev"; then
1539 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1544 # Infer tagged configuration to use if any are available and
1545 # if one wasn't chosen via the "--tag" command line option.
1546 # Only attempt this if the compiler in the base link
1547 # command doesn't match the default compiler.
1548 if test -n "$available_tags" && test -z "$tagname"; then
1549 case $base_compile in
1551 # Blanks in the command may have been stripped by the calling shell,
1552 # but not from the CC environment variable when ltconfig was run.
1555 for z in $available_tags; do
1556 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1557 # Evaluate the configuration.
1558 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1559 case $base_compile in
1561 # The compiler in $compile_command matches
1562 # the one in the tagged configuration.
1563 # Assume this is the tagged configuration we want.
1574 # If $tagname still isn't set, then no tagged configuration
1575 # was found and let the user know that the "--tag" command
1576 # line option must be used.
1577 if test -z "$tagname"; then
1578 echo "$modename: unable to infer tagged configuration"
1579 echo "$modename: specify a tag with \`--tag'" 1>&2
1582 # echo "$modename: using $tagname tagged configuration"
1588 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1589 eval arg=\"$export_dynamic_flag_spec\"
1590 compile_command="$compile_command $arg"
1591 finalize_command="$finalize_command $arg"
1594 # calculate the name of the file, without its directory
1595 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1596 libobjs_save="$libobjs"
1598 if test -n "$shlibpath_var"; then
1599 # get the directories listed in $shlibpath_var
1600 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1604 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1605 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1607 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1608 if test "X$output_objdir" = "X$output"; then
1609 output_objdir="$objdir"
1611 output_objdir="$output_objdir/$objdir"
1613 # Create the object directory.
1614 if test ! -d $output_objdir; then
1615 $show "$mkdir $output_objdir"
1616 $run $mkdir $output_objdir
1618 if test $status -ne 0 && test ! -d $output_objdir; then
1623 # Determine the type of output
1626 $echo "$modename: you must specify an output file" 1>&2
1630 *.$libext) linkmode=oldlib ;;
1631 *.lo | *.$objext) linkmode=obj ;;
1632 *.la) linkmode=lib ;;
1633 *) linkmode=prog ;; # Anything else should be a program.
1638 # Find all interdependent deplibs by searching for libraries
1639 # that are linked more than once (e.g. -la -lb -la)
1640 for deplib in $deplibs; do
1642 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1644 libs="$libs $deplib"
1647 if test $linkmode = lib; then
1648 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1650 # Compute libraries that are listed more than once in $predeps
1651 # $postdeps and mark them as special (i.e., whose duplicates are
1652 # not to be eliminated).
1654 for pre_post_dep in $predeps $postdeps; do
1655 case "$pre_post_deps " in
1656 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1658 pre_post_deps="$pre_post_deps $pre_post_dep"
1666 need_relink=no # whether we're linking any uninstalled libtool libraries
1667 notinst_deplibs= # not-installed libtool libraries
1668 notinst_path= # paths that contain not-installed libtool libraries
1672 for file in $dlfiles $dlprefiles; do
1676 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1688 passes="conv scan dlopen dlpreopen link"
1693 for pass in $passes; do
1694 if test $linkmode = prog; then
1695 # Determine which files to process
1699 save_deplibs="$deplibs" # Collect dlpreopened libraries
1702 dlpreopen) libs="$dlprefiles" ;;
1703 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1706 for deplib in $libs; do
1711 if test $linkmode = oldlib && test $linkmode = obj; then
1712 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1715 if test $pass = conv; then
1716 deplibs="$deplib $deplibs"
1719 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1720 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1721 # Search the libtool library
1722 lib="$searchdir/lib${name}.la"
1723 if test -f "$lib"; then
1728 if test "$found" != yes; then
1729 # deplib doesn't seem to be a libtool library
1730 if test "$linkmode,$pass" = "prog,link"; then
1731 compile_deplibs="$deplib $compile_deplibs"
1732 finalize_deplibs="$deplib $finalize_deplibs"
1734 deplibs="$deplib $deplibs"
1735 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1743 deplibs="$deplib $deplibs"
1744 test $pass = conv && continue
1745 newdependency_libs="$deplib $newdependency_libs"
1746 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1749 if test $pass = conv; then
1750 deplibs="$deplib $deplibs"
1753 if test $pass = scan; then
1754 deplibs="$deplib $deplibs"
1755 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1757 compile_deplibs="$deplib $compile_deplibs"
1758 finalize_deplibs="$deplib $finalize_deplibs"
1762 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1768 if test $pass = link; then
1769 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1770 # Make sure the xrpath contains only unique directories.
1773 *) xrpath="$xrpath $dir" ;;
1776 deplibs="$deplib $deplibs"
1779 *.la) lib="$deplib" ;;
1781 if test $pass = conv; then
1782 deplibs="$deplib $deplibs"
1787 if test "$deplibs_check_method" != pass_all; then
1789 echo "*** Warning: This library needs some functionality provided by $deplib."
1790 echo "*** I have the capability to make that library automatically link in when"
1791 echo "*** you link to this library. But I can only do this if you have a"
1792 echo "*** shared version of the library, which you do not appear to have."
1795 echo "*** Warning: Linking the shared library $output against the"
1796 echo "*** static library $deplib is not portable!"
1797 deplibs="$deplib $deplibs"
1802 if test $pass != link; then
1803 deplibs="$deplib $deplibs"
1805 compile_deplibs="$deplib $compile_deplibs"
1806 finalize_deplibs="$deplib $finalize_deplibs"
1813 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1814 # If there is no dlopen support or we're linking statically,
1815 # we need to preload.
1816 newdlprefiles="$newdlprefiles $deplib"
1817 compile_deplibs="$deplib $compile_deplibs"
1818 finalize_deplibs="$deplib $finalize_deplibs"
1820 newdlfiles="$newdlfiles $deplib"
1829 if test $found = yes || test -f "$lib"; then :
1831 $echo "$modename: cannot find the library \`$lib'" 1>&2
1835 # Check to see that this really is a libtool archive.
1836 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1838 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1842 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1843 test "X$ladir" = "X$lib" && ladir="."
1851 # If the library was installed with an old release of libtool,
1852 # it will not redefine variable installed.
1857 */* | *\\*) . $lib ;;
1863 # Convert "-framework foo" to "foo.framework" in dependency_libs
1864 test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
1868 if test "$linkmode,$pass" = "lib,link" ||
1869 test "$linkmode,$pass" = "prog,scan" ||
1870 { test $linkmode = oldlib && test $linkmode = obj; }; then
1871 # Add dl[pre]opened files of deplib
1872 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1873 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1876 if test $pass = conv; then
1877 # Only check for convenience libraries
1878 deplibs="$lib $deplibs"
1879 if test -z "$libdir"; then
1880 if test -z "$old_library"; then
1881 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1884 # It is a libtool convenience library, so add in its objects.
1885 convenience="$convenience $ladir/$objdir/$old_library"
1886 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1888 for deplib in $dependency_libs; do
1889 deplibs="$deplib $deplibs"
1890 case "$tmp_libs " in
1891 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1893 tmp_libs="$tmp_libs $deplib"
1895 elif test $linkmode != prog && test $linkmode != lib; then
1896 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1902 # Get the name of the library we link against.
1904 for l in $old_library $library_names; do
1907 if test -z "$linklib"; then
1908 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1912 # This library was specified with -dlopen.
1913 if test $pass = dlopen; then
1914 if test -z "$libdir"; then
1915 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1918 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1919 # If there is no dlname, no dlopen support or we're linking
1920 # statically, we need to preload.
1921 dlprefiles="$dlprefiles $lib"
1923 newdlfiles="$newdlfiles $lib"
1928 # We need an absolute path.
1930 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1932 abs_ladir=`cd "$ladir" && pwd`
1933 if test -z "$abs_ladir"; then
1934 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1935 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1940 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1942 # Find the relevant object directory and library name.
1943 if test "X$installed" = Xyes; then
1944 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1945 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1954 dir="$ladir/$objdir"
1955 absdir="$abs_ladir/$objdir"
1956 # Remove this search path later
1957 notinst_path="$notinst_path $abs_ladir"
1958 fi # $installed = yes
1959 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1961 # This library was specified with -dlpreopen.
1962 if test $pass = dlpreopen; then
1963 if test -z "$libdir"; then
1964 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1967 # Prefer using a static library (so that no silly _DYNAMIC symbols
1968 # are required to link).
1969 if test -n "$old_library"; then
1970 newdlprefiles="$newdlprefiles $dir/$old_library"
1971 # Otherwise, use the dlname, so that lt_dlopen finds it.
1972 elif test -n "$dlname"; then
1973 newdlprefiles="$newdlprefiles $dir/$dlname"
1975 newdlprefiles="$newdlprefiles $dir/$linklib"
1977 fi # $pass = dlpreopen
1979 if test -z "$libdir"; then
1980 # Link the convenience library
1981 if test $linkmode = lib; then
1982 deplibs="$dir/$old_library $deplibs"
1983 elif test "$linkmode,$pass" = "prog,link"; then
1984 compile_deplibs="$dir/$old_library $compile_deplibs"
1985 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1987 deplibs="$lib $deplibs"
1992 if test $linkmode = prog && test $pass != link; then
1993 newlib_search_path="$newlib_search_path $ladir"
1994 deplibs="$lib $deplibs"
1997 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1998 test "$build_libtool_libs" = no; then
2003 for deplib in $dependency_libs; do
2005 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2007 # Need to link against all dependency_libs?
2008 if test $linkalldeplibs = yes; then
2009 deplibs="$deplib $deplibs"
2011 # Need to hardcode shared library paths
2012 # or/and link against static libraries
2013 newdependency_libs="$deplib $newdependency_libs"
2015 case "$tmp_libs " in
2016 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2018 tmp_libs="$tmp_libs $deplib"
2021 fi # $linkmode = prog...
2023 link_static=no # Whether the deplib will be linked statically
2024 if test -n "$library_names" &&
2025 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2026 # Link against this shared library
2028 if test "$linkmode,$pass" = "prog,link" ||
2029 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
2030 # Hardcode the library path.
2031 # Skip directories that are in the system default run-time
2033 case " $sys_lib_dlsearch_path " in
2036 case "$compile_rpath " in
2038 *) compile_rpath="$compile_rpath $absdir"
2042 case " $sys_lib_dlsearch_path " in
2045 case "$finalize_rpath " in
2047 *) finalize_rpath="$finalize_rpath $libdir"
2051 if test $linkmode = prog; then
2052 # We need to hardcode the library path
2053 if test -n "$shlibpath_var"; then
2054 # Make sure the rpath contains only unique directories.
2055 case "$temp_rpath " in
2058 *) temp_rpath="$temp_rpath $dir" ;;
2062 fi # $linkmode,$pass = prog,link...
2064 if test "$alldeplibs" = yes &&
2065 { test "$deplibs_check_method" = pass_all ||
2066 { test "$build_libtool_libs" = yes &&
2067 test -n "$library_names"; }; }; then
2068 # We only need to search for static libraries
2072 if test "$installed" = no; then
2073 notinst_deplibs="$notinst_deplibs $lib"
2077 if test -n "$old_archive_from_expsyms_cmds"; then
2078 # figure out the soname
2079 set dummy $library_names
2082 libname=`eval \\$echo \"$libname_spec\"`
2083 # use dlname if we got it. it's perfectly good, no?
2084 if test -n "$dlname"; then
2086 elif test -n "$soname_spec"; then
2090 major=`expr $current - $age`
2094 eval soname=\"$soname_spec\"
2099 # Make a new name for the extract_expsyms_cmds to use
2101 soname=`echo $soroot | sed -e 's/^.*\///'`
2102 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2104 # If the library has no export list, then create one now
2105 if test -f "$output_objdir/$soname-def"; then :
2107 $show "extracting exported symbol list from \`$soname'"
2108 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2109 cmds=$extract_expsyms_cmds
2110 for cmd in $cmds; do
2114 $run eval "$cmd" || exit $?
2120 if test -f "$output_objdir/$newlib"; then :; else
2121 $show "generating import library for \`$soname'"
2122 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2123 cmds=$old_archive_from_expsyms_cmds
2124 for cmd in $cmds; do
2128 $run eval "$cmd" || exit $?
2132 # make sure the library variables are pointing to the new library
2135 fi # test -n $old_archive_from_expsyms_cmds
2137 if test $linkmode = prog || test "$mode" != relink; then
2142 case $hardcode_action in
2143 immediate | unsupported)
2144 if test "$hardcode_direct" = no; then
2146 elif test "$hardcode_minus_L" = no; then
2148 *-*-sunos*) add_shlibpath="$dir" ;;
2152 elif test "$hardcode_shlibpath_var" = no; then
2153 add_shlibpath="$dir"
2160 if test "$hardcode_direct" = yes; then
2162 elif test "$hardcode_minus_L" = yes; then
2165 elif test "$hardcode_shlibpath_var" = yes; then
2166 add_shlibpath="$dir"
2175 if test "$lib_linked" != yes; then
2176 $echo "$modename: configuration error: unsupported hardcode properties"
2180 if test -n "$add_shlibpath"; then
2181 case :$compile_shlibpath: in
2182 *":$add_shlibpath:"*) ;;
2183 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2186 if test $linkmode = prog; then
2187 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2188 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2190 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2191 test -n "$add" && deplibs="$add $deplibs"
2192 if test "$hardcode_direct" != yes && \
2193 test "$hardcode_minus_L" != yes && \
2194 test "$hardcode_shlibpath_var" = yes; then
2195 case :$finalize_shlibpath: in
2197 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2203 if test $linkmode = prog || test "$mode" = relink; then
2207 # Finalize command for both is simple: just hardcode it.
2208 if test "$hardcode_direct" = yes; then
2209 add="$libdir/$linklib"
2210 elif test "$hardcode_minus_L" = yes; then
2213 elif test "$hardcode_shlibpath_var" = yes; then
2214 case :$finalize_shlibpath: in
2216 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2220 # We cannot seem to hardcode it, guess we'll fake it.
2225 if test $linkmode = prog; then
2226 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2227 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2229 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2230 test -n "$add" && deplibs="$add $deplibs"
2233 elif test $linkmode = prog; then
2234 if test "$alldeplibs" = yes &&
2235 { test "$deplibs_check_method" = pass_all ||
2236 { test "$build_libtool_libs" = yes &&
2237 test -n "$library_names"; }; }; then
2238 # We only need to search for static libraries
2242 # Try to link the static library
2243 # Here we assume that one of hardcode_direct or hardcode_minus_L
2244 # is not unsupported. This is valid on all known static and
2246 if test "$hardcode_direct" != unsupported; then
2247 test -n "$old_library" && linklib="$old_library"
2248 compile_deplibs="$dir/$linklib $compile_deplibs"
2249 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2251 compile_deplibs="-l$name -L$dir $compile_deplibs"
2252 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2254 elif test "$build_libtool_libs" = yes; then
2255 # Not a shared library
2256 if test "$deplibs_check_method" != pass_all; then
2257 # We're trying link a shared library against a static one
2258 # but the system doesn't support it.
2260 # Just print a warning and add the library to dependency_libs so
2261 # that the program can be linked against the static library.
2263 echo "*** Warning: This library needs some functionality provided by $lib."
2264 echo "*** I have the capability to make that library automatically link in when"
2265 echo "*** you link to this library. But I can only do this if you have a"
2266 echo "*** shared version of the library, which you do not appear to have."
2267 if test "$module" = yes; then
2268 echo "*** Therefore, libtool will create a static module, that should work "
2269 echo "*** as long as the dlopening application is linked with the -dlopen flag."
2270 if test -z "$global_symbol_pipe"; then
2272 echo "*** However, this would only work if libtool was able to extract symbol"
2273 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2274 echo "*** not find such a program. So, this module is probably useless."
2275 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2277 if test "$build_old_libs" = no; then
2278 build_libtool_libs=module
2281 build_libtool_libs=no
2285 convenience="$convenience $dir/$old_library"
2286 old_convenience="$old_convenience $dir/$old_library"
2287 deplibs="$dir/$old_library $deplibs"
2290 fi # link shared/static library?
2292 if test $linkmode = lib; then
2293 if test -n "$dependency_libs" &&
2294 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2295 test $link_static = yes; }; then
2296 # Extract -R from dependency_libs
2298 for libdir in $dependency_libs; do
2300 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2302 *" $temp_xrpath "*) ;;
2303 *) xrpath="$xrpath $temp_xrpath";;
2305 *) temp_deplibs="$temp_deplibs $libdir";;
2308 dependency_libs="$temp_deplibs"
2311 newlib_search_path="$newlib_search_path $absdir"
2312 # Link against this library
2313 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2314 # ... and its dependency_libs
2316 for deplib in $dependency_libs; do
2317 newdependency_libs="$deplib $newdependency_libs"
2318 case "$tmp_libs " in
2319 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2321 tmp_libs="$tmp_libs $deplib"
2324 if test $link_all_deplibs != no; then
2325 # Add the search paths of all dependency libraries
2326 for deplib in $dependency_libs; do
2328 -L*) path="$deplib" ;;
2330 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2331 test "X$dir" = "X$deplib" && dir="."
2332 # We need an absolute path.
2334 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2336 absdir=`cd "$dir" && pwd`
2337 if test -z "$absdir"; then
2338 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2343 if grep "^installed=no" $deplib > /dev/null; then
2344 path="-L$absdir/$objdir"
2346 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2347 if test -z "$libdir"; then
2348 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2351 if test "$absdir" != "$libdir"; then
2352 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2359 case " $deplibs " in
2361 *) deplibs="$path $deplibs" ;;
2364 fi # link_all_deplibs != no
2366 done # for deplib in $libs
2367 if test $pass = dlpreopen; then
2368 # Link the dlpreopened libraries before other libraries
2369 for deplib in $save_deplibs; do
2370 deplibs="$deplib $deplibs"
2373 if test $pass != dlopen; then
2374 test $pass != scan && dependency_libs="$newdependency_libs"
2375 if test $pass != conv; then
2376 # Make sure lib_search_path contains only unique directories.
2378 for dir in $newlib_search_path; do
2379 case "$lib_search_path " in
2381 *) lib_search_path="$lib_search_path $dir" ;;
2387 if test "$linkmode,$pass" != "prog,link"; then
2390 vars="compile_deplibs finalize_deplibs"
2392 for var in $vars dependency_libs; do
2393 # Add libraries to $var in reverse order
2394 eval tmp_libs=\"\$$var\"
2396 for deplib in $tmp_libs; do
2398 -L*) new_libs="$deplib $new_libs" ;;
2400 case " $specialdeplibs " in
2401 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2403 case " $new_libs " in
2405 *) new_libs="$deplib $new_libs" ;;
2413 for deplib in $new_libs; do
2416 case " $tmp_libs " in
2418 *) tmp_libs="$tmp_libs $deplib" ;;
2421 *) tmp_libs="$tmp_libs $deplib" ;;
2424 eval $var=\"$tmp_libs\"
2427 if test "$pass" = "conv" &&
2428 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2429 libs="$deplibs" # reset libs
2433 if test $linkmode = prog; then
2434 dlfiles="$newdlfiles"
2435 dlprefiles="$newdlprefiles"
2440 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2441 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2444 if test -n "$rpath"; then
2445 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2448 if test -n "$xrpath"; then
2449 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2452 if test -n "$vinfo"; then
2453 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2456 if test -n "$release"; then
2457 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2460 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2461 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2464 # Now set the variables for building old libraries.
2465 build_libtool_libs=no
2467 objs="$objs$old_deplibs"
2471 # Make sure we only generate libraries of the form `libNAME.la'.
2474 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2475 eval shared_ext=\"$shrext\"
2476 eval libname=\"$libname_spec\"
2479 if test "$module" = no; then
2480 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2484 if test "$need_lib_prefix" != no; then
2485 # Add the "lib" prefix for modules if required
2486 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2487 eval shared_ext=\"$shrext\"
2488 eval libname=\"$libname_spec\"
2490 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2495 if test -n "$objs"; then
2496 if test "$deplibs_check_method" != pass_all; then
2497 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2501 echo "*** Warning: Linking the shared library $output against the non-libtool"
2502 echo "*** objects $objs is not portable!"
2503 libobjs="$libobjs $objs"
2507 if test "$dlself" != no; then
2508 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2512 if test $# -gt 2; then
2513 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2518 if test -z "$rpath"; then
2519 if test "$build_libtool_libs" = yes; then
2520 # Building a libtool convenience library.
2521 # Some compilers have problems with a `.al' extension so
2522 # convenience libraries should have the same extension an
2523 # archive normally would.
2524 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2525 build_libtool_libs=convenience
2529 if test -n "$vinfo"; then
2530 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2533 if test -n "$release"; then
2534 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2538 # Parse the version information argument.
2539 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2540 set dummy $vinfo 0 0 0
2543 if test -n "$8"; then
2544 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2553 # Check that each of the things are valid numbers.
2555 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2557 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2558 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2564 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2566 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2567 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2573 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2575 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2576 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2581 if test $age -gt $current; then
2582 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2583 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2587 # Calculate the version variables.
2591 case $version_type in
2595 # Like Linux, but with the current version available in
2596 # verstring for coding it into the library header
2597 major=.`expr $current - $age`
2598 versuffix="$major.$age.$revision"
2599 # Darwin ld doesn't like 0 for these options...
2600 minor_current=`expr $current + 1`
2601 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2606 versuffix=".$current.$revision";
2611 versuffix=".$current";
2615 major=`expr $current - $age + 1`
2616 verstring="sgi$major.$revision"
2618 # Add in all the interfaces that we are compatible with.
2620 while test $loop != 0; do
2621 iface=`expr $revision - $loop`
2622 loop=`expr $loop - 1`
2623 verstring="sgi$major.$iface:$verstring"
2626 # Before this point, $major must not contain `.'.
2628 versuffix="$major.$revision"
2632 major=.`expr $current - $age`
2633 versuffix="$major.$age.$revision"
2637 major=.`expr $current - $age`
2638 versuffix=".$current.$age.$revision"
2639 verstring="$current.$age.$revision"
2641 # Add in all the interfaces that we are compatible with.
2643 while test $loop != 0; do
2644 iface=`expr $current - $loop`
2645 loop=`expr $loop - 1`
2646 verstring="$verstring:${iface}.0"
2649 # Make executables depend on our current version.
2650 verstring="$verstring:${current}.0"
2655 versuffix=".$current.$revision"
2659 # Use '-' rather than '.', since we only want one
2660 # extension on DOS 8.3 filesystems.
2661 major=`expr $current - $age`
2666 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2667 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2672 # Clear the version info if we defaulted, and they specified a release.
2673 if test -z "$vinfo" && test -n "$release"; then
2675 case $version_type in
2677 # we can't check for "0.0" in archive_cmds due to quoting
2678 # problems, so we reset it completely
2685 if test "$need_version" = no; then
2692 # Remove version info from name if versioning should be avoided
2693 if test "$avoid_version" = yes && test "$need_version" = no; then
2699 # Check to see if the archive will have undefined symbols.
2700 if test "$allow_undefined" = yes; then
2701 if test "$allow_undefined_flag" = unsupported; then
2702 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2703 build_libtool_libs=no
2707 # Don't allow undefined symbols.
2708 allow_undefined_flag="$no_undefined_flag"
2712 if test "$mode" != relink; then
2713 # Remove our outputs, but don't remove object files since they
2714 # may have been created when compiling PIC objects.
2716 tempremovelist=`echo "$output_objdir/*"`
2717 for p in $tempremovelist; do
2721 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2722 removelist="$removelist $p"
2727 if test -n "$removelist"; then
2728 $show "${rm}r $removelist"
2729 $run ${rm}r $removelist
2733 # Now set the variables for building old libraries.
2734 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2735 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2737 # Transform .lo files to .o files.
2738 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2741 # Eliminate all temporary directories.
2742 for path in $notinst_path; do
2743 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2744 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2745 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2748 if test -n "$xrpath"; then
2749 # If the user specified any rpath flags, then add them.
2751 for libdir in $xrpath; do
2752 temp_xrpath="$temp_xrpath -R$libdir"
2753 case "$finalize_rpath " in
2755 *) finalize_rpath="$finalize_rpath $libdir" ;;
2758 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2759 dependency_libs="$temp_xrpath $dependency_libs"
2763 # Make sure dlfiles contains only unique files that won't be dlpreopened
2764 old_dlfiles="$dlfiles"
2766 for lib in $old_dlfiles; do
2767 case " $dlprefiles $dlfiles " in
2769 *) dlfiles="$dlfiles $lib" ;;
2773 # Make sure dlprefiles contains only unique files
2774 old_dlprefiles="$dlprefiles"
2776 for lib in $old_dlprefiles; do
2777 case "$dlprefiles " in
2779 *) dlprefiles="$dlprefiles $lib" ;;
2783 if test "$build_libtool_libs" = yes; then
2784 if test -n "$rpath"; then
2786 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2787 # these systems don't actually have a c library (as such)!
2789 *-*-rhapsody* | *-*-darwin1.[012])
2790 # Rhapsody C library is in the System framework
2791 deplibs="$deplibs -framework System"
2794 # Don't link with libc until the a.out ld.so is fixed.
2797 # Add libc to deplibs on all other systems if necessary.
2798 if test $build_libtool_need_lc = "yes"; then
2799 deplibs="$deplibs -lc"
2805 # Transform deplibs into only deplibs that can be linked in shared.
2807 libname_save=$libname
2808 release_save=$release
2809 versuffix_save=$versuffix
2811 # I'm not sure if I'm treating the release correctly. I think
2812 # release should show up in the -l (ie -lgmp5) so we don't want to
2813 # add it in twice. Is that correct?
2819 case $deplibs_check_method in
2821 # Don't check for shared/static. Everything works.
2822 # This might be a little naive. We might want to check
2823 # whether the library exists or not. But this is on
2824 # osf3 & osf4 and I'm not really sure... Just
2825 # implementing what was already the behaviour.
2829 # This code stresses the "libraries are programs" paradigm to its
2830 # limits. Maybe even breaks it. We compile a program, linking it
2831 # against the deplibs as a proxy for the library. Then we can check
2832 # whether they linked in statically or dynamically with ldd.
2834 cat > conftest.c <<EOF
2835 int main() { return 0; }
2838 $LTCC -o conftest conftest.c $deplibs
2839 if test $? -eq 0 ; then
2840 ldd_output=`ldd conftest`
2841 for i in $deplibs; do
2842 name="`expr $i : '-l\(.*\)'`"
2843 # If $name is empty we are operating on a -L argument.
2844 if test -n "$name" && test "$name" != "0"; then
2845 libname=`eval \\$echo \"$libname_spec\"`
2846 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2847 set dummy $deplib_matches
2849 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2850 newdeplibs="$newdeplibs $i"
2854 echo "*** Warning: This library needs some functionality provided by $i."
2855 echo "*** I have the capability to make that library automatically link in when"
2856 echo "*** you link to this library. But I can only do this if you have a"
2857 echo "*** shared version of the library, which you do not appear to have."
2860 newdeplibs="$newdeplibs $i"
2864 # Error occured in the first compile. Let's try to salvage the situation:
2865 # Compile a seperate program for each library.
2866 for i in $deplibs; do
2867 name="`expr $i : '-l\(.*\)'`"
2868 # If $name is empty we are operating on a -L argument.
2869 if test -n "$name" && test "$name" != "0"; then
2871 $LTCC -o conftest conftest.c $i
2873 if test $? -eq 0 ; then
2874 ldd_output=`ldd conftest`
2875 libname=`eval \\$echo \"$libname_spec\"`
2876 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2877 set dummy $deplib_matches
2879 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2880 newdeplibs="$newdeplibs $i"
2884 echo "*** Warning: This library needs some functionality provided by $i."
2885 echo "*** I have the capability to make that library automatically link in when"
2886 echo "*** you link to this library. But I can only do this if you have a"
2887 echo "*** shared version of the library, which you do not appear to have."
2892 echo "*** Warning! Library $i is needed by this library but I was not able to"
2893 echo "*** make it link in! You will probably need to install it or some"
2894 echo "*** library that it depends on before this library will be fully"
2895 echo "*** functional. Installing it before continuing would be even better."
2898 newdeplibs="$newdeplibs $i"
2904 set dummy $deplibs_check_method
2905 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2906 for a_deplib in $deplibs; do
2907 name="`expr $a_deplib : '-l\(.*\)'`"
2908 # If $name is empty we are operating on a -L argument.
2909 if test -n "$name" && test "$name" != "0"; then
2910 libname=`eval \\$echo \"$libname_spec\"`
2911 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2912 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2913 for potent_lib in $potential_libs; do
2914 # Follow soft links.
2915 if ls -lLd "$potent_lib" 2>/dev/null \
2916 | grep " -> " >/dev/null; then
2919 # The statement above tries to avoid entering an
2920 # endless loop below, in case of cyclic links.
2921 # We might still enter an endless loop, since a link
2922 # loop can be closed while we follow links,
2924 potlib="$potent_lib"
2925 while test -h "$potlib" 2>/dev/null; do
2926 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2928 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2929 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2932 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2934 | egrep "$file_magic_regex" > /dev/null; then
2935 newdeplibs="$newdeplibs $a_deplib"
2941 if test -n "$a_deplib" ; then
2944 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2945 echo "*** I have the capability to make that library automatically link in when"
2946 echo "*** you link to this library. But I can only do this if you have a"
2947 echo "*** shared version of the library, which you do not appear to have."
2950 # Add a -L argument.
2951 newdeplibs="$newdeplibs $a_deplib"
2953 done # Gone through all deplibs.
2956 set dummy $deplibs_check_method
2957 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2958 for a_deplib in $deplibs; do
2959 name="`expr $a_deplib : '-l\(.*\)'`"
2960 # If $name is empty we are operating on a -L argument.
2961 if test -n "$name" && test "$name" != "0"; then
2962 libname=`eval \\$echo \"$libname_spec\"`
2963 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2964 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2965 for potent_lib in $potential_libs; do
2966 if eval echo \"$potent_lib\" 2>/dev/null \
2968 | egrep "$match_pattern_regex" > /dev/null; then
2969 newdeplibs="$newdeplibs $a_deplib"
2975 if test -n "$a_deplib" ; then
2978 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2979 echo "*** I have the capability to make that library automatically link in when"
2980 echo "*** you link to this library. But I can only do this if you have a"
2981 echo "*** shared version of the library, which you do not appear to have."
2984 # Add a -L argument.
2985 newdeplibs="$newdeplibs $a_deplib"
2987 done # Gone through all deplibs.
2991 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2992 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2993 grep . >/dev/null; then
2995 if test "X$deplibs_check_method" = "Xnone"; then
2996 echo "*** Warning: inter-library dependencies are not supported in this platform."
2998 echo "*** Warning: inter-library dependencies are not known to be supported."
3000 echo "*** All declared inter-library dependencies are being dropped."
3005 versuffix=$versuffix_save
3007 release=$release_save
3008 libname=$libname_save
3012 *-*-rhapsody* | *-*-darwin1.[012])
3013 # On Rhapsody replace the C library is the System framework
3014 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3018 if test "$droppeddeps" = yes; then
3019 if test "$module" = yes; then
3021 echo "*** Warning: libtool could not satisfy all declared inter-library"
3022 echo "*** dependencies of module $libname. Therefore, libtool will create"
3023 echo "*** a static module, that should work as long as the dlopening"
3024 echo "*** application is linked with the -dlopen flag."
3025 if test -z "$global_symbol_pipe"; then
3027 echo "*** However, this would only work if libtool was able to extract symbol"
3028 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3029 echo "*** not find such a program. So, this module is probably useless."
3030 echo "*** \`nm' from GNU binutils and a full rebuild may help."
3032 if test "$build_old_libs" = no; then
3033 oldlibs="$output_objdir/$libname.$libext"
3034 build_libtool_libs=module
3037 build_libtool_libs=no
3040 echo "*** The inter-library dependencies that have been dropped here will be"
3041 echo "*** automatically added whenever a program is linked with this library"
3042 echo "*** or is declared to -dlopen it."
3044 if test $allow_undefined = no; then
3046 echo "*** Since this library must not contain undefined symbols,"
3047 echo "*** because either the platform does not support them or"
3048 echo "*** it was explicitly requested with -no-undefined,"
3049 echo "*** libtool will only create a static version of it."
3050 if test "$build_old_libs" = no; then
3051 oldlibs="$output_objdir/$libname.$libext"
3052 build_libtool_libs=module
3055 build_libtool_libs=no
3060 # Time to change all our "foo.framework" stuff back to "-framework foo"
3063 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3064 dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3067 # Done checking deplibs!
3068 # Done checking deplibs!
3072 # All the library-specific variables (install_libdir is set above).
3077 # Test again, we may have decided not to build it any more
3078 if test "$build_libtool_libs" = yes; then
3079 if test $hardcode_into_libs = yes; then
3080 # Hardcode the library paths
3083 rpath="$finalize_rpath"
3084 test "$mode" != relink && rpath="$compile_rpath$rpath"
3085 for libdir in $rpath; do
3086 if test -n "$hardcode_libdir_flag_spec"; then
3087 if test -n "$hardcode_libdir_separator"; then
3088 if test -z "$hardcode_libdirs"; then
3089 hardcode_libdirs="$libdir"
3091 # Just accumulate the unique libdirs.
3092 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3093 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3096 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3101 eval flag=\"$hardcode_libdir_flag_spec\"
3102 dep_rpath="$dep_rpath $flag"
3104 elif test -n "$runpath_var"; then
3105 case "$perm_rpath " in
3107 *) perm_rpath="$perm_rpath $libdir" ;;
3111 # Substitute the hardcoded libdirs into the rpath.
3112 if test -n "$hardcode_libdir_separator" &&
3113 test -n "$hardcode_libdirs"; then
3114 libdir="$hardcode_libdirs"
3115 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3117 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3118 # We should set the runpath_var.
3120 for dir in $perm_rpath; do
3123 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3125 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3128 shlibpath="$finalize_shlibpath"
3129 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3130 if test -n "$shlibpath"; then
3131 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3134 # Get the real and link names of the library.
3135 eval library_names=\"$library_names_spec\"
3136 eval shared_ext=\"$shrext\"
3137 set dummy $library_names
3141 if test -n "$soname_spec"; then
3142 eval soname=\"$soname_spec\"
3146 test -z "$dlname" && dlname=$soname
3148 lib="$output_objdir/$realname"
3151 linknames="$linknames $link"
3154 # # Ensure that we have .o objects for linkers which dislike .lo
3155 # # (e.g. aix) in case we are running --disable-static
3156 # for obj in $libobjs; do
3157 # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3158 # if test "X$xdir" = "X$obj"; then
3163 # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3164 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3165 # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
3166 # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3167 # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3171 # Use standard objects if they are pic
3172 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3174 # Prepare the list of exported symbols
3175 if test -z "$export_symbols"; then
3176 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3177 $show "generating symbol list for \`$libname.la'"
3178 export_symbols="$output_objdir/$libname.exp"
3179 $run $rm $export_symbols
3180 eval cmds=\"$export_symbols_cmds\"
3181 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3182 for cmd in $cmds; do
3185 $run eval "$cmd" || exit $?
3188 if test -n "$export_symbols_regex"; then
3189 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3190 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3191 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3192 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3197 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3198 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3201 if test -n "$convenience"; then
3202 if test -n "$whole_archive_flag_spec"; then
3203 save_libobjs=$libobjs
3204 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3206 gentop="$output_objdir/${outputname}x"
3207 $show "${rm}r $gentop"
3208 $run ${rm}r "$gentop"
3209 $show "$mkdir $gentop"
3210 $run $mkdir "$gentop"
3212 if test $status -ne 0 && test ! -d "$gentop"; then
3215 generated="$generated $gentop"
3217 for xlib in $convenience; do
3218 # Extract the objects.
3220 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3221 *) xabs=`pwd`"/$xlib" ;;
3223 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3224 xdir="$gentop/$xlib"
3226 $show "${rm}r $xdir"
3228 $show "$mkdir $xdir"
3231 if test $status -ne 0 && test ! -d "$xdir"; then
3234 $show "(cd $xdir && $AR x $xabs)"
3235 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3237 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3242 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3243 eval flag=\"$thread_safe_flag_spec\"
3244 linker_flags="$linker_flags $flag"
3247 # Make a backup of the uninstalled library when relinking
3248 if test "$mode" = relink; then
3249 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3252 # Do each of the archive commands.
3253 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3254 eval test_cmds=\"$archive_expsym_cmds\"
3255 cmds=$archive_expsym_cmds
3257 eval test_cmds=\"$archive_cmds\"
3260 if len=`expr "X$test_cmds" : ".*"` &&
3261 test $len -le $max_cmd_len; then
3264 # The command line is too long to link in one step, link piecewise.
3265 $echo "creating reloadable object files..."
3267 # Save the value of $output and $libobjs because we want to
3268 # use them later. If we have whole_archive_flag_spec, we
3269 # want to use save_libobjs as it was before
3270 # whole_archive_flag_spec was expanded, because we can't
3271 # assume the linker understands whole_archive_flag_spec.
3272 # This may have to be revisited, in case too many
3273 # convenience libraries get linked in and end up exceeding
3275 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3276 save_libobjs=$libobjs
3280 # Clear the reloadable object creation command queue and
3281 # initialize k to one.
3288 output=$output_objdir/$save_output-${k}.$objext
3289 # Loop over the list of objects to be linked.
3290 for obj in $save_libobjs
3292 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3293 if test "X$objlist" = X ||
3294 { len=`expr "X$test_cmds" : ".*"` &&
3295 test $len -le $max_cmd_len; }; then
3296 objlist="$objlist $obj"
3298 # The command $test_cmds is almost too long, add a
3299 # command to the queue.
3300 if test $k -eq 1 ; then
3301 # The first file doesn't have a previous command to add.
3302 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3304 # All subsequent reloadable object files will link in
3305 # the last one created.
3306 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3308 last_robj=$output_objdir/$save_output-${k}.$objext
3310 output=$output_objdir/$save_output-${k}.$objext
3315 # Handle the remaining objects by creating one last
3316 # reloadable object file. All subsequent reloadable object
3317 # files will link in the last one created.
3318 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3319 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3321 # Set up a command to remove the reloadale object files
3322 # after they are used.
3324 while test $i -lt $k
3327 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3330 $echo "creating a temporary reloadable object file: $output"
3332 # Loop through the commands generated above and execute them.
3333 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3334 for cmd in $concat_cmds; do
3338 $run eval "$cmd" || exit $?
3343 # Restore the value of output.
3346 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3347 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3349 # Expand the library linking commands again to reset the
3350 # value of $libobjs for piecewise linking.
3352 # Do each of the archive commands.
3353 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3354 cmds=$archive_expsym_cmds
3359 # Append the command to remove the reloadable object files
3360 # to the just-reset $cmds.
3361 eval cmds=\"\$cmds~$rm $delfiles\"
3363 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3364 for cmd in $cmds; do
3368 $run eval "$cmd" || exit $?
3372 # Restore the uninstalled library and exit
3373 if test "$mode" = relink; then
3374 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3378 # Create links to the real library.
3379 for linkname in $linknames; do
3380 if test "$realname" != "$linkname"; then
3381 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3382 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3386 # If -module or -export-dynamic was specified, set the dlname.
3387 if test "$module" = yes || test "$export_dynamic" = yes; then
3388 # On all known operating systems, these are identical.
3395 if test -n "$deplibs"; then
3396 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3399 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3400 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2