* gcc.c (default_compilers): Add missing initializers.
[official-gcc.git] / ltmain.sh
blobc1ef9974d0e8e0a1c866e6a6bdeb615b9ec6ec50
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.
30 shift
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!
37 else
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
44 shift
45 cat <<EOF
47 EOF
48 exit 0
51 # The name of this program.
52 progname=`$echo "$0" | sed 's%^.*/%%'`
53 modename="$progname"
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.4a-GCC3.0
59 TIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)"
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed='sed -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 SP2NL='tr \040 \012'
73 NL2SP='tr \015\012 \040\040'
75 # NLS nuisances.
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
90 exit 1
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
96 exit 1
99 # Global variables.
100 mode=$default_mode
101 nonopt=
102 prev=
103 prevopt=
104 run=
105 show="$echo"
106 show_help=
107 execute_dlfiles=
108 lo2o="s/\\.lo\$/.${objext}/"
109 o2lo="s/\\.${objext}\$/.lo/"
110 taglist=
112 # Parse our command line options once, thoroughly.
113 while test $# -gt 0
115 arg="$1"
116 shift
118 case $arg in
119 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
120 *) optarg= ;;
121 esac
123 # If the previous option needs an argument, assign it.
124 if test -n "$prev"; then
125 case $prev in
126 execute_dlfiles)
127 execute_dlfiles="$execute_dlfiles $arg"
129 tag)
130 tagname="$arg"
132 # Check whether tagname contains only valid characters
133 case $tagname in
134 *[!-_A-Za-z0-9,/]*)
135 echo "$progname: invalid tag name: $tagname" 1>&2
136 exit 1
138 esac
140 case $tagname in
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`"
151 else
152 echo "$progname: ignoring unknown tag $tagname" 1>&2
155 esac
158 eval "$prev=\$arg"
160 esac
162 prev=
163 prevopt=
164 continue
167 # Have we seen a non-optional argument yet?
168 case $arg in
169 --help)
170 show_help=yes
173 --version)
174 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
175 exit 0
178 --config)
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"
183 done
184 exit 0
187 --debug)
188 echo "$progname: enabling shell trace mode"
189 set -x
192 --dry-run | -n)
193 run=:
196 --features)
197 echo "host: $host"
198 if test "$build_libtool_libs" = yes; then
199 echo "enable shared libraries"
200 else
201 echo "disable shared libraries"
203 if test "$build_old_libs" = yes; then
204 echo "enable static libraries"
205 else
206 echo "disable static libraries"
208 exit 0
211 --finish) mode="finish" ;;
213 --mode) prevopt="--mode" prev=mode ;;
214 --mode=*) mode="$optarg" ;;
216 --quiet | --silent)
217 show=:
220 --tag) prevopt="--tag" prev=tag ;;
221 --tag=*)
222 set tag "$optarg" ${1+"$@"}
223 shift
224 prev=tag
227 -dlopen)
228 prevopt="-dlopen"
229 prev=execute_dlfiles
233 $echo "$modename: unrecognized option \`$arg'" 1>&2
234 $echo "$help" 1>&2
235 exit 1
239 nonopt="$arg"
240 break
242 esac
243 done
245 if test -n "$prevopt"; then
246 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
247 $echo "$help" 1>&2
248 exit 1
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.
254 exec_cmd=
256 if test -z "$show_help"; then
258 # Infer the operation mode.
259 if test -z "$mode"; then
260 case $nonopt in
261 *cc | *++ | gcc* | *-gcc*)
262 mode=link
263 for arg
265 case $arg in
267 mode=compile
268 break
270 esac
271 done
273 *db | *dbx | *strace | *truss)
274 mode=execute
276 *install*|cp|mv)
277 mode=install
279 *rm)
280 mode=uninstall
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
290 else
291 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
295 esac
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
301 $echo "$help" 1>&2
302 exit 1
305 # Change the help message to a mode-specific one.
306 generic_help="$help"
307 help="Try \`$modename --help --mode=$mode' for more information."
309 # These modes are in order of execution frequency so that they run quickly.
310 case $mode in
311 # libtool compile mode
312 compile)
313 modename="$modename: compile"
314 # Get the compilation command and the source file.
315 base_compile=
316 prev=
317 lastarg=
318 srcfile="$nonopt"
319 suppress_output=
321 user_target=no
322 for arg
324 case $prev in
325 "") ;;
326 xcompiler)
327 # Aesthetically quote the previous argument.
328 prev=
329 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
331 case $arg in
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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
336 arg="\"$arg\""
338 esac
340 # Add the previous argument to base_compile.
341 if test -z "$base_compile"; then
342 base_compile="$lastarg"
343 else
344 base_compile="$base_compile $lastarg"
346 continue
348 esac
350 # Accept any command-line options.
351 case $arg in
353 if test "$user_target" != "no"; then
354 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
355 exit 1
357 user_target=next
360 -static)
361 build_old_libs=yes
362 continue
365 -prefer-pic)
366 pic_mode=yes
367 continue
370 -prefer-non-pic)
371 pic_mode=no
372 continue
375 -Xcompiler)
376 prev=xcompiler
377 continue
380 -Wc,*)
381 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
382 lastarg=
383 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
384 for arg in $args; do
385 IFS="$save_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.
390 case $arg in
391 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
392 arg="\"$arg\""
394 esac
395 lastarg="$lastarg $arg"
396 done
397 IFS="$save_ifs"
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"
403 else
404 base_compile="$base_compile $lastarg"
406 continue
408 esac
410 case $user_target in
411 next)
412 # The next one is the -o target name
413 user_target=yes
414 continue
416 yes)
417 # We got the output file
418 user_target=set
419 libobj="$arg"
420 continue
422 esac
424 # Accept the current argument as the source file.
425 lastarg="$srcfile"
426 srcfile="$arg"
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.
438 case $lastarg in
439 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
440 lastarg="\"$lastarg\""
442 esac
444 # Add the previous argument to base_compile.
445 if test -z "$base_compile"; then
446 base_compile="$lastarg"
447 else
448 base_compile="$base_compile $lastarg"
450 done
452 case $user_target in
453 set)
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
461 exit 1
463 esac
465 # Recognize several different file suffixes.
466 # If the user specifies -o file.o, it is replaced with file.lo
467 xform='[cCFSfmso]'
468 case $libobj in
469 *.ada) xform=ada ;;
470 *.adb) xform=adb ;;
471 *.ads) xform=ads ;;
472 *.asm) xform=asm ;;
473 *.c++) xform=c++ ;;
474 *.cc) xform=cc ;;
475 *.class) xform=class ;;
476 *.cpp) xform=cpp ;;
477 *.cxx) xform=cxx ;;
478 *.f90) xform=f90 ;;
479 *.for) xform=for ;;
480 *.java) xform=java ;;
481 esac
483 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
485 case $libobj in
486 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
488 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
489 exit 1
491 esac
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
499 "$CC "*) ;;
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.
502 "`$echo $CC` "*) ;;
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
509 "$CC "*)
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.
513 tagname=$z
514 break
516 "`$echo $CC` "*)
517 tagname=$z
518 break
520 esac
522 done
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
529 exit 1
530 # else
531 # echo "$modename: using $tagname tagged configuration"
534 esac
537 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
538 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
539 if test "X$xdir" = "X$obj"; then
540 xdir=
541 else
542 xdir=$xdir/
544 lobj=${xdir}$objdir/$objname
546 if test -z "$base_compile"; then
547 $echo "$modename: you must specify a compilation command" 1>&2
548 $echo "$help" 1>&2
549 exit 1
552 # Delete any leftover library objects.
553 if test "$build_old_libs" = yes; then
554 removelist="$obj $lobj $libobj ${libobj}T"
555 else
556 removelist="$lobj $libobj ${libobj}T"
559 $run $rm $removelist
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
563 case $host_os in
564 cygwin* | mingw* | pw32* | os2*)
565 pic_mode=default
567 esac
568 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
569 # non-PIC code in shared libraries is not supported
570 pic_mode=default
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
580 else
581 output_obj=
582 need_locks=no
583 lockfile=
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"
591 sleep 2
592 done
593 elif test "$need_locks" = warn; then
594 if test -f "$lockfile"; then
595 echo "\
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
604 compiler."
606 $run $rm $removelist
607 exit 1
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"
637 else
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
645 status=$?
646 if test $status -ne 0 && test ! -d ${xdir}$objdir; then
647 exit $status
651 if test -z "$output_obj"; then
652 # Place PIC objects in $objdir
653 command="$command -o $lobj"
656 $run $rm "$lobj" "$output_obj"
658 $show "$command"
659 if $run eval "$command"; then :
660 else
661 test -n "$output_obj" && $run $rm $removelist
662 exit 1
665 if test "$need_locks" = warn &&
666 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
667 echo "\
668 *** ERROR, $lockfile contains:
669 `cat $lockfile 2>/dev/null`
671 but it should contain:
672 $srcfile
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
679 compiler."
681 $run $rm $removelist
682 exit 1
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 :
689 else
690 error=$?
691 $run $rm $removelist
692 exit $error
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'
704 else
705 # No PIC object so indicate it doesn't exist in the libtool
706 # object file.
707 test -z "$run" && cat >> ${libobj}T <<EOF
708 pic_object=none
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"
718 else
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"
728 $show "$command"
729 if $run eval "$command"; then :
730 else
731 $run $rm $removelist
732 exit 1
735 if test "$need_locks" = warn &&
736 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
737 echo "\
738 *** ERROR, $lockfile contains:
739 `cat $lockfile 2>/dev/null`
741 but it should contain:
742 $srcfile
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
749 compiler."
751 $run $rm $removelist
752 exit 1
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 :
759 else
760 error=$?
761 $run $rm $removelist
762 exit $error
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'
773 else
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.
778 non_pic_object=none
783 $run $mv "${libobj}T" "${libobj}"
785 # Unlock the critical section if it was locked
786 if test "$need_locks" != no; then
787 $run $rm "$lockfile"
790 exit 0
793 # libtool link mode
794 link | relink)
795 modename="$modename: link"
796 case $host in
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.
802 # allow_undefined=no
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.
809 allow_undefined=yes
812 allow_undefined=yes
814 esac
815 libtool_args="$nonopt"
816 base_compile="$nonopt"
817 compile_command="$nonopt"
818 finalize_command="$nonopt"
820 compile_rpath=
821 finalize_rpath=
822 compile_shlibpath=
823 finalize_shlibpath=
824 convenience=
825 old_convenience=
826 deplibs=
827 old_deplibs=
828 compiler_flags=
829 linker_flags=
830 dllsearchpath=
831 lib_search_path=`pwd`
833 avoid_version=no
834 dlfiles=
835 dlprefiles=
836 dlself=no
837 export_dynamic=no
838 export_symbols=
839 export_symbols_regex=
840 generated=
841 libobjs=
842 ltlibs=
843 module=no
844 no_install=no
845 objs=
846 non_pic_objects=
847 prefer_static_libs=no
848 preload=no
849 prev=
850 prevarg=
851 release=
852 rpath=
853 xrpath=
854 perm_rpath=
855 temp_rpath=
856 thread_safe=no
857 vinfo=
859 # We need to know -static, to get the right output filenames.
860 for arg
862 case $arg in
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
871 else
872 if test -z "$pic_flag" && test -n "$link_static_flag"; then
873 dlopen_self=$dlopen_self_static
876 build_libtool_libs=no
877 build_old_libs=yes
878 prefer_static_libs=yes
879 break
881 esac
882 done
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
889 arg="$1"
890 base_compile="$base_compile $arg"
891 shift
892 case $arg in
893 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
894 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
896 *) qarg=$arg ;;
897 esac
898 libtool_args="$libtool_args $qarg"
900 # If the previous option needs an argument, assign it.
901 if test -n "$prev"; then
902 case $prev in
903 output)
904 compile_command="$compile_command @OUTPUT@"
905 finalize_command="$finalize_command @OUTPUT@"
907 esac
909 case $prev in
910 dlfiles|dlprefiles)
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@"
915 preload=yes
917 case $arg in
918 *.la | *.lo) ;; # We handle these cases below.
919 force)
920 if test "$dlself" = no; then
921 dlself=needless
922 export_dynamic=yes
924 prev=
925 continue
927 self)
928 if test "$prev" = dlprefiles; then
929 dlself=yes
930 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
931 dlself=yes
932 else
933 dlself=needless
934 export_dynamic=yes
936 prev=
937 continue
940 if test "$prev" = dlfiles; then
941 dlfiles="$dlfiles $arg"
942 else
943 dlprefiles="$dlprefiles $arg"
945 prev=
946 continue
948 esac
950 expsyms)
951 export_symbols="$arg"
952 if test ! -f "$arg"; then
953 $echo "$modename: symbol file \`$arg' does not exist"
954 exit 1
956 prev=
957 continue
959 expsyms_regex)
960 export_symbols_regex="$arg"
961 prev=
962 continue
964 release)
965 release="-$arg"
966 prev=
967 continue
969 objectlist)
970 if test -f "$arg"; then
971 save_arg=$arg
972 moreargs=
973 for fil in `cat $save_arg`
975 # moreargs="$moreargs $fil"
976 arg=$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
981 pic_object=
982 non_pic_object=
984 # Read the .lo file
985 # If there is no directory component, then add one.
986 case $arg in
987 */* | *\\*) . $arg ;;
988 *) . ./$arg ;;
989 esac
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
996 exit 1
999 # Extract subdirectory from the argument.
1000 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1001 if test "X$xdir" = "X$arg"; then
1002 xdir=
1003 else
1004 xdir="$xdir/"
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"
1014 prev=
1015 continue
1016 else
1017 # If libtool objects are unsupported, then we need to preload.
1018 prev=dlprefiles
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"
1026 prev=
1029 # A PIC object.
1030 libobjs="$libobjs $pic_object"
1031 arg="$pic_object"
1034 # Non-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"
1045 else
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
1049 exit 1
1050 else
1051 # Dry-run case.
1053 # Extract subdirectory from the argument.
1054 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1055 if test "X$xdir" = "X$arg"; then
1056 xdir=
1057 else
1058 xdir="$xdir/"
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"
1067 done
1068 else
1069 $echo "$modename: link input file \`$save_arg' does not exist"
1070 exit 1
1072 arg=$save_arg
1073 prev=
1074 continue
1076 rpath | xrpath)
1077 # We need an absolute path.
1078 case $arg in
1079 [\\/]* | [A-Za-z]:[\\/]*) ;;
1081 $echo "$modename: only absolute run-paths are allowed" 1>&2
1082 exit 1
1084 esac
1085 if test "$prev" = rpath; then
1086 case "$rpath " in
1087 *" $arg "*) ;;
1088 *) rpath="$rpath $arg" ;;
1089 esac
1090 else
1091 case "$xrpath " in
1092 *" $arg "*) ;;
1093 *) xrpath="$xrpath $arg" ;;
1094 esac
1096 prev=
1097 continue
1099 xcompiler)
1100 compiler_flags="$compiler_flags $qarg"
1101 prev=
1102 compile_command="$compile_command $qarg"
1103 finalize_command="$finalize_command $qarg"
1104 continue
1106 xlinker)
1107 linker_flags="$linker_flags $qarg"
1108 compiler_flags="$compiler_flags $wl$qarg"
1109 prev=
1110 compile_command="$compile_command $wl$qarg"
1111 finalize_command="$finalize_command $wl$qarg"
1112 continue
1114 framework)
1115 case $host in
1116 *-*-darwin*)
1117 case "$deplibs " in
1118 *" $qarg.framework "*) ;;
1119 *) deplibs="$deplibs $qarg.framework" # this is fixed later
1121 esac
1123 esac
1124 prev=
1125 continue
1128 eval "$prev=\"\$arg\""
1129 prev=
1130 continue
1132 esac
1133 fi # test -n $prev
1135 prevarg="$arg"
1137 case $arg in
1138 -all-static)
1139 if test -n "$link_static_flag"; then
1140 compile_command="$compile_command $link_static_flag"
1141 finalize_command="$finalize_command $link_static_flag"
1143 continue
1146 -allow-undefined)
1147 # FIXME: remove this flag sometime in the future.
1148 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1149 continue
1152 -avoid-version)
1153 avoid_version=yes
1154 continue
1157 -dlopen)
1158 prev=dlfiles
1159 continue
1162 -dlpreopen)
1163 prev=dlprefiles
1164 continue
1167 -export-dynamic)
1168 export_dynamic=yes
1169 continue
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"
1175 exit 1
1177 if test "X$arg" = "X-export-symbols"; then
1178 prev=expsyms
1179 else
1180 prev=expsyms_regex
1182 continue
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
1187 -L[A-Z][A-Z]*:*)
1188 case $with_gcc/$host in
1189 no/*-*-irix*)
1190 compile_command="$compile_command $arg"
1191 finalize_command="$finalize_command $arg"
1193 esac
1194 continue
1197 -L*)
1198 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1199 # We need an absolute path.
1200 case $dir in
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
1206 exit 1
1208 dir="$absdir"
1210 esac
1211 case "$deplibs " in
1212 *" -L$dir "*) ;;
1214 deplibs="$deplibs -L$dir"
1215 lib_search_path="$lib_search_path $dir"
1217 esac
1218 case $host in
1219 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1220 case :$dllsearchpath: in
1221 *":$dir:"*) ;;
1222 *) dllsearchpath="$dllsearchpath:$dir";;
1223 esac
1225 esac
1226 continue
1229 -l*)
1230 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1231 case $host in
1232 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1233 # These systems don't actually have a C or math library (as such)
1234 continue
1236 *-*-mingw* | *-*-os2*)
1237 # These systems don't actually have a C library (as such)
1238 test "X$arg" = "X-lc" && continue
1240 esac
1242 deplibs="$deplibs $arg"
1243 continue
1246 -module)
1247 module=yes
1248 continue
1251 -no-fast-install)
1252 fast_install=no
1253 continue
1256 -no-install)
1257 case $host in
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
1263 fast_install=no
1265 *) no_install=yes ;;
1266 esac
1267 continue
1270 -no-undefined)
1271 allow_undefined=no
1272 continue
1275 -objectlist)
1276 prev=objectlist
1277 continue
1280 -o) prev=output ;;
1282 -release)
1283 prev=release
1284 continue
1287 -rpath)
1288 prev=rpath
1289 continue
1293 prev=xrpath
1294 continue
1297 -R*)
1298 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1299 # We need an absolute path.
1300 case $dir in
1301 [\\/]* | [A-Za-z]:[\\/]*) ;;
1303 $echo "$modename: only absolute run-paths are allowed" 1>&2
1304 exit 1
1306 esac
1307 case "$xrpath " in
1308 *" $dir "*) ;;
1309 *) xrpath="$xrpath $dir" ;;
1310 esac
1311 continue
1314 -static)
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.
1320 continue
1323 -thread-safe)
1324 thread_safe=yes
1325 continue
1328 -version-info)
1329 prev=vinfo
1330 continue
1333 -Wc,*)
1334 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1335 arg=
1336 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1337 for flag in $args; do
1338 IFS="$save_ifs"
1339 case $flag in
1340 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1341 flag="\"$flag\""
1343 esac
1344 arg="$arg $wl$flag"
1345 compiler_flags="$compiler_flags $flag"
1346 done
1347 IFS="$save_ifs"
1348 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1351 -Wl,*)
1352 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1353 arg=
1354 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1355 for flag in $args; do
1356 IFS="$save_ifs"
1357 case $flag in
1358 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1359 flag="\"$flag\""
1361 esac
1362 arg="$arg $wl$flag"
1363 compiler_flags="$compiler_flags $wl$flag"
1364 linker_flags="$linker_flags $flag"
1365 done
1366 IFS="$save_ifs"
1367 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1370 -Xcompiler)
1371 prev=xcompiler
1372 continue
1375 -Xlinker)
1376 prev=xlinker
1377 continue
1379 -framework)
1380 prev=framework
1381 continue
1384 # Some other compiler flag.
1385 -* | +*)
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"`
1389 case $arg in
1390 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1391 arg="\"$arg\""
1393 esac
1396 *.$objext)
1397 # A standard object.
1398 objs="$objs $arg"
1401 *.lo)
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
1406 pic_object=
1407 non_pic_object=
1409 # Read the .lo file
1410 # If there is no directory component, then add one.
1411 case $arg in
1412 */* | *\\*) . $arg ;;
1413 *) . ./$arg ;;
1414 esac
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
1421 exit 1
1424 # Extract subdirectory from the argument.
1425 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1426 if test "X$xdir" = "X$arg"; then
1427 xdir=
1428 else
1429 xdir="$xdir/"
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"
1439 prev=
1440 continue
1441 else
1442 # If libtool objects are unsupported, then we need to preload.
1443 prev=dlprefiles
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"
1451 prev=
1454 # A PIC object.
1455 libobjs="$libobjs $pic_object"
1456 arg="$pic_object"
1459 # Non-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"
1470 else
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
1474 exit 1
1475 else
1476 # Dry-run case.
1478 # Extract subdirectory from the argument.
1479 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1480 if test "X$xdir" = "X$arg"; then
1481 xdir=
1482 else
1483 xdir="$xdir/"
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"
1494 *.$libext)
1495 # An archive.
1496 deplibs="$deplibs $arg"
1497 old_deplibs="$old_deplibs $arg"
1498 continue
1501 *.la)
1502 # A libtool-controlled library.
1504 if test "$prev" = dlfiles; then
1505 # This library was specified with -dlopen.
1506 dlfiles="$dlfiles $arg"
1507 prev=
1508 elif test "$prev" = dlprefiles; then
1509 # The library was specified with -dlpreopen.
1510 dlprefiles="$dlprefiles $arg"
1511 prev=
1512 else
1513 deplibs="$deplibs $arg"
1515 continue
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"`
1523 case $arg in
1524 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1525 arg="\"$arg\""
1527 esac
1529 esac # arg
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
1540 $echo "$help" 1>&2
1541 exit 1
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
1550 "$CC "*) ;;
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.
1553 "`$echo $CC` "*) ;;
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
1560 "$CC "*)
1561 # The compiler in $compile_command matches
1562 # the one in the tagged configuration.
1563 # Assume this is the tagged configuration we want.
1564 tagname=$z
1565 break
1567 "`$echo $CC` "*)
1568 tagname=$z
1569 break
1571 esac
1573 done
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
1580 exit 1
1581 # else
1582 # echo "$modename: using $tagname tagged configuration"
1585 esac
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\'\`
1601 else
1602 shlib_search_path=
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"
1610 else
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
1617 status=$?
1618 if test $status -ne 0 && test ! -d $output_objdir; then
1619 exit $status
1623 # Determine the type of output
1624 case $output in
1626 $echo "$modename: you must specify an output file" 1>&2
1627 $echo "$help" 1>&2
1628 exit 1
1630 *.$libext) linkmode=oldlib ;;
1631 *.lo | *.$objext) linkmode=obj ;;
1632 *.la) linkmode=lib ;;
1633 *) linkmode=prog ;; # Anything else should be a program.
1634 esac
1636 specialdeplibs=
1637 libs=
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
1641 case "$libs " in
1642 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1643 esac
1644 libs="$libs $deplib"
1645 done
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).
1653 pre_post_deps=
1654 for pre_post_dep in $predeps $postdeps; do
1655 case "$pre_post_deps " in
1656 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1657 esac
1658 pre_post_deps="$pre_post_deps $pre_post_dep"
1659 done
1660 pre_post_deps=
1663 deplibs=
1664 newdependency_libs=
1665 newlib_search_path=
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
1669 case $linkmode in
1670 lib)
1671 passes="conv link"
1672 for file in $dlfiles $dlprefiles; do
1673 case $file in
1674 *.la) ;;
1676 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1677 exit 1
1679 esac
1680 done
1682 prog)
1683 compile_deplibs=
1684 finalize_deplibs=
1685 alldeplibs=no
1686 newdlfiles=
1687 newdlprefiles=
1688 passes="conv scan dlopen dlpreopen link"
1690 *) passes="conv"
1692 esac
1693 for pass in $passes; do
1694 if test $linkmode = prog; then
1695 # Determine which files to process
1696 case $pass in
1697 dlopen)
1698 libs="$dlfiles"
1699 save_deplibs="$deplibs" # Collect dlpreopened libraries
1700 deplibs=
1702 dlpreopen) libs="$dlprefiles" ;;
1703 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1704 esac
1706 for deplib in $libs; do
1707 lib=
1708 found=no
1709 case $deplib in
1710 -l*)
1711 if test $linkmode = oldlib && test $linkmode = obj; then
1712 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1713 continue
1715 if test $pass = conv; then
1716 deplibs="$deplib $deplibs"
1717 continue
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
1724 found=yes
1725 break
1727 done
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"
1733 else
1734 deplibs="$deplib $deplibs"
1735 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1737 continue
1739 ;; # -l
1740 -L*)
1741 case $linkmode in
1742 lib)
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//'`
1748 prog)
1749 if test $pass = conv; then
1750 deplibs="$deplib $deplibs"
1751 continue
1753 if test $pass = scan; then
1754 deplibs="$deplib $deplibs"
1755 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1756 else
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
1764 esac # linkmode
1765 continue
1766 ;; # -L
1767 -R*)
1768 if test $pass = link; then
1769 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1770 # Make sure the xrpath contains only unique directories.
1771 case "$xrpath " in
1772 *" $dir "*) ;;
1773 *) xrpath="$xrpath $dir" ;;
1774 esac
1776 deplibs="$deplib $deplibs"
1777 continue
1779 *.la) lib="$deplib" ;;
1780 *.$libext)
1781 if test $pass = conv; then
1782 deplibs="$deplib $deplibs"
1783 continue
1785 case $linkmode in
1786 lib)
1787 if test "$deplibs_check_method" != pass_all; then
1788 echo
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."
1793 else
1794 echo
1795 echo "*** Warning: Linking the shared library $output against the"
1796 echo "*** static library $deplib is not portable!"
1797 deplibs="$deplib $deplibs"
1799 continue
1801 prog)
1802 if test $pass != link; then
1803 deplibs="$deplib $deplibs"
1804 else
1805 compile_deplibs="$deplib $compile_deplibs"
1806 finalize_deplibs="$deplib $finalize_deplibs"
1808 continue
1810 esac # linkmode
1811 ;; # *.$libext
1812 *.lo | *.$objext)
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"
1819 else
1820 newdlfiles="$newdlfiles $deplib"
1822 continue
1824 %DEPLIBS%)
1825 alldeplibs=yes
1826 continue
1828 esac # case $deplib
1829 if test $found = yes || test -f "$lib"; then :
1830 else
1831 $echo "$modename: cannot find the library \`$lib'" 1>&2
1832 exit 1
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 :
1837 else
1838 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1839 exit 1
1842 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1843 test "X$ladir" = "X$lib" && ladir="."
1845 dlname=
1846 dlopen=
1847 dlpreopen=
1848 libdir=
1849 library_names=
1850 old_library=
1851 # If the library was installed with an old release of libtool,
1852 # it will not redefine variable installed.
1853 installed=yes
1855 # Read the .la file
1856 case $lib in
1857 */* | *\\*) . $lib ;;
1858 *) . ./$lib ;;
1859 esac
1861 case $host in
1862 *-*-darwin*)
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'`
1866 esac
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
1882 exit 1
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"
1887 tmp_libs=
1888 for deplib in $dependency_libs; do
1889 deplibs="$deplib $deplibs"
1890 case "$tmp_libs " in
1891 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1892 esac
1893 tmp_libs="$tmp_libs $deplib"
1894 done
1895 elif test $linkmode != prog && test $linkmode != lib; then
1896 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1897 exit 1
1899 continue
1900 fi # $pass = conv
1902 # Get the name of the library we link against.
1903 linklib=
1904 for l in $old_library $library_names; do
1905 linklib="$l"
1906 done
1907 if test -z "$linklib"; then
1908 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1909 exit 1
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
1916 exit 1
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"
1922 else
1923 newdlfiles="$newdlfiles $lib"
1925 continue
1926 fi # $pass = dlopen
1928 # We need an absolute path.
1929 case $ladir in
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
1936 abs_ladir="$ladir"
1939 esac
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
1946 dir="$ladir"
1947 absdir="$abs_ladir"
1948 libdir="$abs_ladir"
1949 else
1950 dir="$libdir"
1951 absdir="$libdir"
1953 else
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
1965 exit 1
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"
1974 else
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"
1986 else
1987 deplibs="$lib $deplibs"
1989 continue
1992 if test $linkmode = prog && test $pass != link; then
1993 newlib_search_path="$newlib_search_path $ladir"
1994 deplibs="$lib $deplibs"
1996 linkalldeplibs=no
1997 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1998 test "$build_libtool_libs" = no; then
1999 linkalldeplibs=yes
2002 tmp_libs=
2003 for deplib in $dependency_libs; do
2004 case $deplib in
2005 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2006 esac
2007 # Need to link against all dependency_libs?
2008 if test $linkalldeplibs = yes; then
2009 deplibs="$deplib $deplibs"
2010 else
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" ;;
2017 esac
2018 tmp_libs="$tmp_libs $deplib"
2019 done # for deplib
2020 continue
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
2032 # search path.
2033 case " $sys_lib_dlsearch_path " in
2034 *" $absdir "*) ;;
2036 case "$compile_rpath " in
2037 *" $absdir "*) ;;
2038 *) compile_rpath="$compile_rpath $absdir"
2039 esac
2041 esac
2042 case " $sys_lib_dlsearch_path " in
2043 *" $libdir "*) ;;
2045 case "$finalize_rpath " in
2046 *" $libdir "*) ;;
2047 *) finalize_rpath="$finalize_rpath $libdir"
2048 esac
2050 esac
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
2056 *" $dir "*) ;;
2057 *" $absdir "*) ;;
2058 *) temp_rpath="$temp_rpath $dir" ;;
2059 esac
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
2069 continue
2072 if test "$installed" = no; then
2073 notinst_deplibs="$notinst_deplibs $lib"
2074 need_relink=yes
2077 if test -n "$old_archive_from_expsyms_cmds"; then
2078 # figure out the soname
2079 set dummy $library_names
2080 realname="$2"
2081 shift; shift
2082 libname=`eval \\$echo \"$libname_spec\"`
2083 # use dlname if we got it. it's perfectly good, no?
2084 if test -n "$dlname"; then
2085 soname="$dlname"
2086 elif test -n "$soname_spec"; then
2087 # bleh windows
2088 case $host in
2089 *cygwin*)
2090 major=`expr $current - $age`
2091 versuffix="-$major"
2093 esac
2094 eval soname=\"$soname_spec\"
2095 else
2096 soname="$realname"
2099 # Make a new name for the extract_expsyms_cmds to use
2100 soroot="$soname"
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 :
2106 else
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
2111 IFS="$save_ifs"
2112 eval cmd=\"$cmd\"
2113 $show "$cmd"
2114 $run eval "$cmd" || exit $?
2115 done
2116 IFS="$save_ifs"
2119 # Create $newlib
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
2125 IFS="$save_ifs"
2126 eval cmd=\"$cmd\"
2127 $show "$cmd"
2128 $run eval "$cmd" || exit $?
2129 done
2130 IFS="$save_ifs"
2132 # make sure the library variables are pointing to the new library
2133 dir=$output_objdir
2134 linklib=$newlib
2135 fi # test -n $old_archive_from_expsyms_cmds
2137 if test $linkmode = prog || test "$mode" != relink; then
2138 add_shlibpath=
2139 add_dir=
2140 add=
2141 lib_linked=yes
2142 case $hardcode_action in
2143 immediate | unsupported)
2144 if test "$hardcode_direct" = no; then
2145 add="$dir/$linklib"
2146 elif test "$hardcode_minus_L" = no; then
2147 case $host in
2148 *-*-sunos*) add_shlibpath="$dir" ;;
2149 esac
2150 add_dir="-L$dir"
2151 add="-l$name"
2152 elif test "$hardcode_shlibpath_var" = no; then
2153 add_shlibpath="$dir"
2154 add="-l$name"
2155 else
2156 lib_linked=no
2159 relink)
2160 if test "$hardcode_direct" = yes; then
2161 add="$dir/$linklib"
2162 elif test "$hardcode_minus_L" = yes; then
2163 add_dir="-L$dir"
2164 add="-l$name"
2165 elif test "$hardcode_shlibpath_var" = yes; then
2166 add_shlibpath="$dir"
2167 add="-l$name"
2168 else
2169 lib_linked=no
2172 *) lib_linked=no ;;
2173 esac
2175 if test "$lib_linked" != yes; then
2176 $echo "$modename: configuration error: unsupported hardcode properties"
2177 exit 1
2180 if test -n "$add_shlibpath"; then
2181 case :$compile_shlibpath: in
2182 *":$add_shlibpath:"*) ;;
2183 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2184 esac
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"
2189 else
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
2196 *":$libdir:"*) ;;
2197 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2198 esac
2203 if test $linkmode = prog || test "$mode" = relink; then
2204 add_shlibpath=
2205 add_dir=
2206 add=
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
2211 add_dir="-L$libdir"
2212 add="-l$name"
2213 elif test "$hardcode_shlibpath_var" = yes; then
2214 case :$finalize_shlibpath: in
2215 *":$libdir:"*) ;;
2216 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2217 esac
2218 add="-l$name"
2219 else
2220 # We cannot seem to hardcode it, guess we'll fake it.
2221 add_dir="-L$libdir"
2222 add="-l$name"
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"
2228 else
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
2239 continue
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
2245 # shared platforms.
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"
2250 else
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.
2262 echo
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
2271 echo
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
2279 build_old_libs=yes
2280 else
2281 build_libtool_libs=no
2284 else
2285 convenience="$convenience $dir/$old_library"
2286 old_convenience="$old_convenience $dir/$old_library"
2287 deplibs="$dir/$old_library $deplibs"
2288 link_static=yes
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
2297 temp_deplibs=
2298 for libdir in $dependency_libs; do
2299 case $libdir in
2300 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2301 case " $xrpath " in
2302 *" $temp_xrpath "*) ;;
2303 *) xrpath="$xrpath $temp_xrpath";;
2304 esac;;
2305 *) temp_deplibs="$temp_deplibs $libdir";;
2306 esac
2307 done
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
2315 tmp_libs=
2316 for deplib in $dependency_libs; do
2317 newdependency_libs="$deplib $newdependency_libs"
2318 case "$tmp_libs " in
2319 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2320 esac
2321 tmp_libs="$tmp_libs $deplib"
2322 done
2324 if test $link_all_deplibs != no; then
2325 # Add the search paths of all dependency libraries
2326 for deplib in $dependency_libs; do
2327 case $deplib in
2328 -L*) path="$deplib" ;;
2329 *.la)
2330 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2331 test "X$dir" = "X$deplib" && dir="."
2332 # We need an absolute path.
2333 case $dir in
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
2339 absdir="$dir"
2342 esac
2343 if grep "^installed=no" $deplib > /dev/null; then
2344 path="-L$absdir/$objdir"
2345 else
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
2349 exit 1
2351 if test "$absdir" != "$libdir"; then
2352 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2354 path="-L$absdir"
2357 *) continue ;;
2358 esac
2359 case " $deplibs " in
2360 *" $path "*) ;;
2361 *) deplibs="$path $deplibs" ;;
2362 esac
2363 done
2364 fi # link_all_deplibs != no
2365 fi # linkmode = lib
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"
2371 done
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.
2377 lib_search_path=
2378 for dir in $newlib_search_path; do
2379 case "$lib_search_path " in
2380 *" $dir "*) ;;
2381 *) lib_search_path="$lib_search_path $dir" ;;
2382 esac
2383 done
2384 newlib_search_path=
2387 if test "$linkmode,$pass" != "prog,link"; then
2388 vars="deplibs"
2389 else
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\"
2395 new_libs=
2396 for deplib in $tmp_libs; do
2397 case $deplib in
2398 -L*) new_libs="$deplib $new_libs" ;;
2400 case " $specialdeplibs " in
2401 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2403 case " $new_libs " in
2404 *" $deplib "*) ;;
2405 *) new_libs="$deplib $new_libs" ;;
2406 esac
2408 esac
2410 esac
2411 done
2412 tmp_libs=
2413 for deplib in $new_libs; do
2414 case $deplib in
2415 -L*)
2416 case " $tmp_libs " in
2417 *" $deplib "*) ;;
2418 *) tmp_libs="$tmp_libs $deplib" ;;
2419 esac
2421 *) tmp_libs="$tmp_libs $deplib" ;;
2422 esac
2423 done
2424 eval $var=\"$tmp_libs\"
2425 done # for var
2427 if test "$pass" = "conv" &&
2428 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2429 libs="$deplibs" # reset libs
2430 deplibs=
2432 done # for pass
2433 if test $linkmode = prog; then
2434 dlfiles="$newdlfiles"
2435 dlprefiles="$newdlprefiles"
2438 case $linkmode in
2439 oldlib)
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
2466 oldlibs="$output"
2467 objs="$objs$old_deplibs"
2470 lib)
2471 # Make sure we only generate libraries of the form `libNAME.la'.
2472 case $outputname in
2473 lib*)
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
2481 $echo "$help" 1>&2
2482 exit 1
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\"
2489 else
2490 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2493 esac
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
2498 exit 1
2499 else
2500 echo
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
2511 set dummy $rpath
2512 if test $# -gt 2; then
2513 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2515 install_libdir="$2"
2517 oldlibs=
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
2526 build_old_libs=yes
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
2536 else
2538 # Parse the version information argument.
2539 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2540 set dummy $vinfo 0 0 0
2541 IFS="$save_ifs"
2543 if test -n "$8"; then
2544 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2545 $echo "$help" 1>&2
2546 exit 1
2549 current="$2"
2550 revision="$3"
2551 age="$4"
2553 # Check that each of the things are valid numbers.
2554 case $current in
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
2559 exit 1
2561 esac
2563 case $revision in
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
2568 exit 1
2570 esac
2572 case $age in
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
2577 exit 1
2579 esac
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
2584 exit 1
2587 # Calculate the version variables.
2588 major=
2589 versuffix=
2590 verstring=
2591 case $version_type in
2592 none) ;;
2594 darwin)
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"
2604 freebsd-aout)
2605 major=".$current"
2606 versuffix=".$current.$revision";
2609 freebsd-elf)
2610 major=".$current"
2611 versuffix=".$current";
2614 irix)
2615 major=`expr $current - $age + 1`
2616 verstring="sgi$major.$revision"
2618 # Add in all the interfaces that we are compatible with.
2619 loop=$revision
2620 while test $loop != 0; do
2621 iface=`expr $revision - $loop`
2622 loop=`expr $loop - 1`
2623 verstring="sgi$major.$iface:$verstring"
2624 done
2626 # Before this point, $major must not contain `.'.
2627 major=.$major
2628 versuffix="$major.$revision"
2631 linux)
2632 major=.`expr $current - $age`
2633 versuffix="$major.$age.$revision"
2636 osf)
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.
2642 loop=$age
2643 while test $loop != 0; do
2644 iface=`expr $current - $loop`
2645 loop=`expr $loop - 1`
2646 verstring="$verstring:${iface}.0"
2647 done
2649 # Make executables depend on our current version.
2650 verstring="$verstring:${current}.0"
2653 sunos)
2654 major=".$current"
2655 versuffix=".$current.$revision"
2658 windows)
2659 # Use '-' rather than '.', since we only want one
2660 # extension on DOS 8.3 filesystems.
2661 major=`expr $current - $age`
2662 versuffix="-$major"
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
2668 exit 1
2670 esac
2672 # Clear the version info if we defaulted, and they specified a release.
2673 if test -z "$vinfo" && test -n "$release"; then
2674 major=
2675 case $version_type in
2676 darwin)
2677 # we can't check for "0.0" in archive_cmds due to quoting
2678 # problems, so we reset it completely
2679 verstring=
2682 verstring="0.0"
2684 esac
2685 if test "$need_version" = no; then
2686 versuffix=
2687 else
2688 versuffix=".0.0"
2692 # Remove version info from name if versioning should be avoided
2693 if test "$avoid_version" = yes && test "$need_version" = no; then
2694 major=
2695 versuffix=
2696 verstring=""
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
2704 build_old_libs=yes
2706 else
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.
2715 removelist=
2716 tempremovelist=`echo "$output_objdir/*"`
2717 for p in $tempremovelist; do
2718 case $p in
2719 *.$objext)
2721 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2722 removelist="$removelist $p"
2724 *) ;;
2725 esac
2726 done
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'`
2746 done
2748 if test -n "$xrpath"; then
2749 # If the user specified any rpath flags, then add them.
2750 temp_xrpath=
2751 for libdir in $xrpath; do
2752 temp_xrpath="$temp_xrpath -R$libdir"
2753 case "$finalize_rpath " in
2754 *" $libdir "*) ;;
2755 *) finalize_rpath="$finalize_rpath $libdir" ;;
2756 esac
2757 done
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"
2765 dlfiles=
2766 for lib in $old_dlfiles; do
2767 case " $dlprefiles $dlfiles " in
2768 *" $lib "*) ;;
2769 *) dlfiles="$dlfiles $lib" ;;
2770 esac
2771 done
2773 # Make sure dlprefiles contains only unique files
2774 old_dlprefiles="$dlprefiles"
2775 dlprefiles=
2776 for lib in $old_dlprefiles; do
2777 case "$dlprefiles " in
2778 *" $lib "*) ;;
2779 *) dlprefiles="$dlprefiles $lib" ;;
2780 esac
2781 done
2783 if test "$build_libtool_libs" = yes; then
2784 if test -n "$rpath"; then
2785 case $host in
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"
2793 *-*-netbsd*)
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"
2802 esac
2805 # Transform deplibs into only deplibs that can be linked in shared.
2806 name_save=$name
2807 libname_save=$libname
2808 release_save=$release
2809 versuffix_save=$versuffix
2810 major_save=$major
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?
2814 release=""
2815 versuffix=""
2816 major=""
2817 newdeplibs=
2818 droppeddeps=no
2819 case $deplibs_check_method in
2820 pass_all)
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.
2826 newdeplibs=$deplibs
2828 test_compile)
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.
2833 $rm conftest.c
2834 cat > conftest.c <<EOF
2835 int main() { return 0; }
2837 $rm conftest
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
2848 deplib_match=$2
2849 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2850 newdeplibs="$newdeplibs $i"
2851 else
2852 droppeddeps=yes
2853 echo
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."
2859 else
2860 newdeplibs="$newdeplibs $i"
2862 done
2863 else
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
2870 $rm conftest
2871 $LTCC -o conftest conftest.c $i
2872 # Did it work?
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
2878 deplib_match=$2
2879 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2880 newdeplibs="$newdeplibs $i"
2881 else
2882 droppeddeps=yes
2883 echo
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."
2889 else
2890 droppeddeps=yes
2891 echo
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."
2897 else
2898 newdeplibs="$newdeplibs $i"
2900 done
2903 file_magic*)
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
2917 continue
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,
2923 # but so what?
2924 potlib="$potent_lib"
2925 while test -h "$potlib" 2>/dev/null; do
2926 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2927 case $potliblink in
2928 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2929 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2930 esac
2931 done
2932 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2933 | sed 10q \
2934 | egrep "$file_magic_regex" > /dev/null; then
2935 newdeplibs="$newdeplibs $a_deplib"
2936 a_deplib=""
2937 break 2
2939 done
2940 done
2941 if test -n "$a_deplib" ; then
2942 droppeddeps=yes
2943 echo
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."
2949 else
2950 # Add a -L argument.
2951 newdeplibs="$newdeplibs $a_deplib"
2953 done # Gone through all deplibs.
2955 match_pattern*)
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 \
2967 | sed 10q \
2968 | egrep "$match_pattern_regex" > /dev/null; then
2969 newdeplibs="$newdeplibs $a_deplib"
2970 a_deplib=""
2971 break 2
2973 done
2974 done
2975 if test -n "$a_deplib" ; then
2976 droppeddeps=yes
2977 echo
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."
2983 else
2984 # Add a -L argument.
2985 newdeplibs="$newdeplibs $a_deplib"
2987 done # Gone through all deplibs.
2989 none | unknown | *)
2990 newdeplibs=""
2991 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2992 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2993 grep . >/dev/null; then
2994 echo
2995 if test "X$deplibs_check_method" = "Xnone"; then
2996 echo "*** Warning: inter-library dependencies are not supported in this platform."
2997 else
2998 echo "*** Warning: inter-library dependencies are not known to be supported."
3000 echo "*** All declared inter-library dependencies are being dropped."
3001 droppeddeps=yes
3004 esac
3005 versuffix=$versuffix_save
3006 major=$major_save
3007 release=$release_save
3008 libname=$libname_save
3009 name=$name_save
3011 case $host in
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 /'`
3016 esac
3018 if test "$droppeddeps" = yes; then
3019 if test "$module" = yes; then
3020 echo
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
3026 echo
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
3035 build_old_libs=yes
3036 else
3037 build_libtool_libs=no
3039 else
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
3045 echo
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
3053 build_old_libs=yes
3054 else
3055 build_libtool_libs=no
3060 # Time to change all our "foo.framework" stuff back to "-framework foo"
3061 case $host in
3062 *-*-darwin*)
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'`
3066 esac
3067 # Done checking deplibs!
3068 # Done checking deplibs!
3069 deplibs=$newdeplibs
3072 # All the library-specific variables (install_libdir is set above).
3073 library_names=
3074 old_library=
3075 dlname=
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
3081 hardcode_libdirs=
3082 dep_rpath=
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"
3090 else
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"
3098 esac
3100 else
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
3106 *" $libdir "*) ;;
3107 *) perm_rpath="$perm_rpath $libdir" ;;
3108 esac
3110 done
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.
3119 rpath=
3120 for dir in $perm_rpath; do
3121 rpath="$rpath$dir:"
3122 done
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
3138 realname="$2"
3139 shift; shift
3141 if test -n "$soname_spec"; then
3142 eval soname=\"$soname_spec\"
3143 else
3144 soname="$realname"
3146 test -z "$dlname" && dlname=$soname
3148 lib="$output_objdir/$realname"
3149 for link
3151 linknames="$linknames $link"
3152 done
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
3159 # xdir="."
3160 # else
3161 # xdir="$xdir"
3162 # fi
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 $?
3168 # fi
3169 # done
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
3183 IFS="$save_ifs"
3184 $show "$cmd"
3185 $run eval "$cmd" || exit $?
3186 done
3187 IFS="$save_ifs"
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\"
3205 else
3206 gentop="$output_objdir/${outputname}x"
3207 $show "${rm}r $gentop"
3208 $run ${rm}r "$gentop"
3209 $show "$mkdir $gentop"
3210 $run $mkdir "$gentop"
3211 status=$?
3212 if test $status -ne 0 && test ! -d "$gentop"; then
3213 exit $status
3215 generated="$generated $gentop"
3217 for xlib in $convenience; do
3218 # Extract the objects.
3219 case $xlib in
3220 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3221 *) xabs=`pwd`"/$xlib" ;;
3222 esac
3223 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3224 xdir="$gentop/$xlib"
3226 $show "${rm}r $xdir"
3227 $run ${rm}r "$xdir"
3228 $show "$mkdir $xdir"
3229 $run $mkdir "$xdir"
3230 status=$?
3231 if test $status -ne 0 && test ! -d "$xdir"; then
3232 exit $status
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`
3238 done
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
3256 else
3257 eval test_cmds=\"$archive_cmds\"
3258 cmds=$archive_cmds
3260 if len=`expr "X$test_cmds" : ".*"` &&
3261 test $len -le $max_cmd_len; then
3263 else
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
3274 # the spec.
3275 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3276 save_libobjs=$libobjs
3278 save_output=$output
3280 # Clear the reloadable object creation command queue and
3281 # initialize k to one.
3282 test_cmds=
3283 concat_cmds=
3284 objlist=
3285 delfiles=
3286 last_robj=
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"
3297 else
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\"
3303 else
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
3309 k=`expr $k + 1`
3310 output=$output_objdir/$save_output-${k}.$objext
3311 objlist=$obj
3312 len=1
3314 done
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
3326 i=`expr $i + 1`
3327 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3328 done
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
3335 IFS="$save_ifs"
3336 eval cmd=\"$cmd\"
3337 $show "$cmd"
3338 $run eval "$cmd" || exit $?
3339 done
3340 IFS="$save_ifs"
3342 libobjs=$output
3343 # Restore the value of output.
3344 output=$save_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
3355 else
3356 cmds=$archive_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
3365 IFS="$save_ifs"
3366 eval cmd=\"$cmd\"
3367 $show "$cmd"
3368 $run eval "$cmd" || exit $?
3369 done
3370 IFS="$save_ifs"
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 $?
3375 exit 0
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 $?
3384 done
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.
3389 dlname="$soname"
3394 obj)
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
3403 if test -n "$rpath"; then
3404 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3407 if test -n "$xrpath"; then
3408 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3411 if test -n "$vinfo"; then
3412 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3415 if test -n "$release"; then
3416 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3419 case $output in
3420 *.lo)
3421 if test -n "$objs$old_deplibs"; then
3422 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3423 exit 1
3425 libobj="$output"
3426 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3429 libobj=
3430 obj="$output"
3432 esac
3434 # Delete the old objects.
3435 $run $rm $obj $libobj
3437 # Objects from convenience libraries. This assumes
3438 # single-version convenience libraries. Whenever we create
3439 # different ones for PIC/non-PIC, this we'll have to duplicate
3440 # the extraction.
3441 reload_conv_objs=
3442 gentop=
3443 # reload_cmds runs $LD directly, so let us get rid of
3444 # -Wl from whole_archive_flag_spec
3447 if test -n "$convenience"; then
3448 if test -n "$whole_archive_flag_spec"; then
3449 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3450 else
3451 gentop="$output_objdir/${obj}x"
3452 $show "${rm}r $gentop"
3453 $run ${rm}r "$gentop"
3454 $show "$mkdir $gentop"
3455 $run $mkdir "$gentop"
3456 status=$?
3457 if test $status -ne 0 && test ! -d "$gentop"; then
3458 exit $status
3460 generated="$generated $gentop"
3462 for xlib in $convenience; do
3463 # Extract the objects.
3464 case $xlib in
3465 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3466 *) xabs=`pwd`"/$xlib" ;;
3467 esac
3468 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3469 xdir="$gentop/$xlib"
3471 $show "${rm}r $xdir"
3472 $run ${rm}r "$xdir"
3473 $show "$mkdir $xdir"
3474 $run $mkdir "$xdir"
3475 status=$?
3476 if test $status -ne 0 && test ! -d "$xdir"; then
3477 exit $status
3479 $show "(cd $xdir && $AR x $xabs)"
3480 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3482 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3483 done
3487 # Create the old-style object.
3488 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
3490 output="$obj"
3491 eval cmds=\"$reload_cmds\"
3492 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3493 for cmd in $cmds; do
3494 IFS="$save_ifs"
3495 $show "$cmd"
3496 $run eval "$cmd" || exit $?
3497 done
3498 IFS="$save_ifs"
3500 # Exit if we aren't doing a library object file.
3501 if test -z "$libobj"; then
3502 if test -n "$gentop"; then
3503 $show "${rm}r $gentop"
3504 $run ${rm}r $gentop
3507 exit 0
3510 if test "$build_libtool_libs" != yes; then
3511 if test -n "$gentop"; then
3512 $show "${rm}r $gentop"
3513 $run ${rm}r $gentop
3516 # Create an invalid libtool object if no PIC, so that we don't
3517 # accidentally link it into a program.
3518 # $show "echo timestamp > $libobj"
3519 # $run eval "echo timestamp > $libobj" || exit $?
3520 exit 0
3523 if test -n "$pic_flag" || test "$pic_mode" != default; then
3524 # Only do commands if we really have different PIC objects.
3525 reload_objs="$libobjs $reload_conv_objs"
3526 output="$libobj"
3527 eval cmds=\"$reload_cmds\"
3528 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3529 for cmd in $cmds; do
3530 IFS="$save_ifs"
3531 $show "$cmd"
3532 $run eval "$cmd" || exit $?
3533 done
3534 IFS="$save_ifs"
3535 # else
3536 # # Just create a symlink.
3537 # $show $rm $libobj
3538 # $run $rm $libobj
3539 # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3540 # if test "X$xdir" = "X$libobj"; then
3541 # xdir="."
3542 # else
3543 # xdir="$xdir"
3544 # fi
3545 # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3546 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3547 # $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3548 # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3551 if test -n "$gentop"; then
3552 $show "${rm}r $gentop"
3553 $run ${rm}r $gentop
3556 exit 0
3559 prog)
3560 case $host in
3561 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3562 esac
3563 if test -n "$vinfo"; then
3564 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3567 if test -n "$release"; then
3568 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3571 if test "$preload" = yes; then
3572 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3573 test "$dlopen_self_static" = unknown; then
3574 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3578 case $host in
3579 *-*-rhapsody* | *-*-darwin1.[012])
3580 # On Rhapsody replace the C library is the System framework
3581 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3582 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3584 esac
3586 case $host in
3587 *-*-darwin*)
3588 # Don't allow lazy linking, it breaks C++ global constructors
3589 if test "$tagname" = CXX ; then
3590 compile_command="$compile_command ${wl}-bind_at_load"
3591 finalize_command="$finalize_command ${wl}-bind_at_load"
3593 # Time to change all our "foo.framework" stuff back to "-framework foo"
3594 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3595 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3597 esac
3599 compile_command="$compile_command $compile_deplibs"
3600 finalize_command="$finalize_command $finalize_deplibs"
3602 if test -n "$rpath$xrpath"; then
3603 # If the user specified any rpath flags, then add them.
3604 for libdir in $rpath $xrpath; do
3605 # This is the magic to use -rpath.
3606 case "$finalize_rpath " in
3607 *" $libdir "*) ;;
3608 *) finalize_rpath="$finalize_rpath $libdir" ;;
3609 esac
3610 done
3613 # Now hardcode the library paths
3614 rpath=
3615 hardcode_libdirs=
3616 for libdir in $compile_rpath $finalize_rpath; do
3617 if test -n "$hardcode_libdir_flag_spec"; then
3618 if test -n "$hardcode_libdir_separator"; then
3619 if test -z "$hardcode_libdirs"; then
3620 hardcode_libdirs="$libdir"
3621 else
3622 # Just accumulate the unique libdirs.
3623 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3624 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3627 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3629 esac
3631 else
3632 eval flag=\"$hardcode_libdir_flag_spec\"
3633 rpath="$rpath $flag"
3635 elif test -n "$runpath_var"; then
3636 case "$perm_rpath " in
3637 *" $libdir "*) ;;
3638 *) perm_rpath="$perm_rpath $libdir" ;;
3639 esac
3641 case $host in
3642 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3643 case :$dllsearchpath: in
3644 *":$libdir:"*) ;;
3645 *) dllsearchpath="$dllsearchpath:$libdir";;
3646 esac
3648 esac
3649 done
3650 # Substitute the hardcoded libdirs into the rpath.
3651 if test -n "$hardcode_libdir_separator" &&
3652 test -n "$hardcode_libdirs"; then
3653 libdir="$hardcode_libdirs"
3654 eval rpath=\" $hardcode_libdir_flag_spec\"
3656 compile_rpath="$rpath"
3658 rpath=
3659 hardcode_libdirs=
3660 for libdir in $finalize_rpath; do
3661 if test -n "$hardcode_libdir_flag_spec"; then
3662 if test -n "$hardcode_libdir_separator"; then
3663 if test -z "$hardcode_libdirs"; then
3664 hardcode_libdirs="$libdir"
3665 else
3666 # Just accumulate the unique libdirs.
3667 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3668 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3671 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3673 esac
3675 else
3676 eval flag=\"$hardcode_libdir_flag_spec\"
3677 rpath="$rpath $flag"
3679 elif test -n "$runpath_var"; then
3680 case "$finalize_perm_rpath " in
3681 *" $libdir "*) ;;
3682 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3683 esac
3685 done
3686 # Substitute the hardcoded libdirs into the rpath.
3687 if test -n "$hardcode_libdir_separator" &&
3688 test -n "$hardcode_libdirs"; then
3689 libdir="$hardcode_libdirs"
3690 eval rpath=\" $hardcode_libdir_flag_spec\"
3692 finalize_rpath="$rpath"
3694 dlsyms=
3695 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3696 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3697 dlsyms="${outputname}S.c"
3698 else
3699 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3703 if test -n "$dlsyms"; then
3704 case $dlsyms in
3705 "") ;;
3706 *.c)
3707 # Discover the nlist of each of the dlfiles.
3708 nlist="$output_objdir/${outputname}.nm"
3710 $show "$rm $nlist ${nlist}S ${nlist}T"
3711 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3713 # Parse the name list into a source file.
3714 $show "creating $output_objdir/$dlsyms"
3716 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3717 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3718 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3720 #ifdef __cplusplus
3721 extern \"C\" {
3722 #endif
3724 /* Prevent the only kind of declaration conflicts we can make. */
3725 #define lt_preloaded_symbols some_other_symbol
3727 /* External symbol declarations for the compiler. */\
3730 if test "$dlself" = yes; then
3731 $show "generating symbol list for \`$output'"
3733 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3735 # Add our own program objects to the symbol list.
3736 progfiles="$objs$old_deplibs"
3737 for arg in $progfiles; do
3738 $show "extracting global C symbols from \`$arg'"
3739 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3740 done
3742 if test -n "$exclude_expsyms"; then
3743 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3744 $run eval '$mv "$nlist"T "$nlist"'
3747 if test -n "$export_symbols_regex"; then
3748 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3749 $run eval '$mv "$nlist"T "$nlist"'
3752 # Prepare the list of exported symbols
3753 if test -z "$export_symbols"; then
3754 export_symbols="$output_objdir/$output.exp"
3755 $run $rm $export_symbols
3756 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3757 else
3758 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3759 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3760 $run eval 'mv "$nlist"T "$nlist"'
3764 for arg in $dlprefiles; do
3765 $show "extracting global C symbols from \`$arg'"
3766 name=`echo "$arg" | sed -e 's%^.*/%%'`
3767 $run eval 'echo ": $name " >> "$nlist"'
3768 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3769 done
3771 if test -z "$run"; then
3772 # Make sure we have at least an empty file.
3773 test -f "$nlist" || : > "$nlist"
3775 if test -n "$exclude_expsyms"; then
3776 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3777 $mv "$nlist"T "$nlist"
3780 # Try sorting and uniquifying the output.
3781 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3783 else
3784 grep -v "^: " < "$nlist" > "$nlist"S
3787 if test -f "$nlist"S; then
3788 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3789 else
3790 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3793 $echo >> "$output_objdir/$dlsyms" "\
3795 #undef lt_preloaded_symbols
3797 #if defined (__STDC__) && __STDC__
3798 # define lt_ptr_t void *
3799 #else
3800 # define lt_ptr_t char *
3801 # define const
3802 #endif
3804 /* The mapping between symbol names and symbols. */
3805 const struct {
3806 const char *name;
3807 lt_ptr_t address;
3809 lt_preloaded_symbols[] =
3813 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3814 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3815 < "$nlist" >> "$output_objdir/$dlsyms"
3817 $echo >> "$output_objdir/$dlsyms" "\
3818 {0, (lt_ptr_t) 0}
3821 /* This works around a problem in FreeBSD linker */
3822 #ifdef FREEBSD_WORKAROUND
3823 static const void *lt_preloaded_setup() {
3824 return lt_preloaded_symbols;
3826 #endif
3828 #ifdef __cplusplus
3830 #endif\
3834 pic_flag_for_symtable=
3835 case $host in
3836 # compiling the symbol table file with pic_flag works around
3837 # a FreeBSD bug that causes programs to crash when -lm is
3838 # linked before any other PIC object. But we must not use
3839 # pic_flag when linking with -static. The problem exists in
3840 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3841 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3842 case "$compile_command " in
3843 *" -static "*) ;;
3844 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3845 esac;;
3846 *-*-hpux*)
3847 case "$compile_command " in
3848 *" -static "*) ;;
3849 *) pic_flag_for_symtable=" $pic_flag";;
3850 esac
3851 esac
3853 # Now compile the dynamic symbol file.
3854 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3855 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3857 # Clean up the generated files.
3858 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3859 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3861 # Transform the symbol file into the correct name.
3862 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3863 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3866 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3867 exit 1
3869 esac
3870 else
3871 # We keep going just in case the user didn't refer to
3872 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3873 # really was required.
3875 # Nullify the symbol file.
3876 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3877 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3880 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3881 # Replace the output file specification.
3882 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3883 link_command="$compile_command$compile_rpath"
3885 # We have no uninstalled library dependencies, so finalize right now.
3886 $show "$link_command"
3887 $run eval "$link_command"
3888 status=$?
3890 # Delete the generated files.
3891 if test -n "$dlsyms"; then
3892 $show "$rm $output_objdir/${outputname}S.${objext}"
3893 $run $rm "$output_objdir/${outputname}S.${objext}"
3896 exit $status
3899 if test -n "$shlibpath_var"; then
3900 # We should set the shlibpath_var
3901 rpath=
3902 for dir in $temp_rpath; do
3903 case $dir in
3904 [\\/]* | [A-Za-z]:[\\/]*)
3905 # Absolute path.
3906 rpath="$rpath$dir:"
3909 # Relative path: add a thisdir entry.
3910 rpath="$rpath\$thisdir/$dir:"
3912 esac
3913 done
3914 temp_rpath="$rpath"
3917 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3918 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3920 if test -n "$finalize_shlibpath"; then
3921 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3924 compile_var=
3925 finalize_var=
3926 if test -n "$runpath_var"; then
3927 if test -n "$perm_rpath"; then
3928 # We should set the runpath_var.
3929 rpath=
3930 for dir in $perm_rpath; do
3931 rpath="$rpath$dir:"
3932 done
3933 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3935 if test -n "$finalize_perm_rpath"; then
3936 # We should set the runpath_var.
3937 rpath=
3938 for dir in $finalize_perm_rpath; do
3939 rpath="$rpath$dir:"
3940 done
3941 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3945 if test "$no_install" = yes; then
3946 # We don't need to create a wrapper script.
3947 link_command="$compile_var$compile_command$compile_rpath"
3948 # Replace the output file specification.
3949 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3950 # Delete the old output file.
3951 $run $rm $output
3952 # Link the executable and exit
3953 $show "$link_command"
3954 $run eval "$link_command" || exit $?
3955 exit 0
3958 if test "$hardcode_action" = relink; then
3959 # Fast installation is not supported
3960 link_command="$compile_var$compile_command$compile_rpath"
3961 relink_command="$finalize_var$finalize_command$finalize_rpath"
3963 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3964 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3965 else
3966 if test "$fast_install" != no; then
3967 link_command="$finalize_var$compile_command$finalize_rpath"
3968 if test "$fast_install" = yes; then
3969 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3970 else
3971 # fast_install is set to needless
3972 relink_command=
3974 else
3975 link_command="$compile_var$compile_command$compile_rpath"
3976 relink_command="$finalize_var$finalize_command$finalize_rpath"
3980 # Replace the output file specification.
3981 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3983 # Delete the old output files.
3984 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3986 $show "$link_command"
3987 $run eval "$link_command" || exit $?
3989 # Now create the wrapper script.
3990 $show "creating $output"
3992 # Quote the relink command for shipping.
3993 if test -n "$relink_command"; then
3994 # Preserve any variables that may affect compiler behavior
3995 for var in $variables_saved_for_relink; do
3996 if eval test -z \"\${$var+set}\"; then
3997 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3998 elif eval var_value=\$$var; test -z "$var_value"; then
3999 relink_command="$var=; export $var; $relink_command"
4000 else
4001 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4002 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4004 done
4005 relink_command="cd `pwd`; $relink_command"
4006 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4009 # Quote $echo for shipping.
4010 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4011 case $0 in
4012 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4013 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4014 esac
4015 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4016 else
4017 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4020 # Only actually do things if our run command is non-null.
4021 if test -z "$run"; then
4022 # win32 will think the script is a binary if it has
4023 # a .exe suffix, so we strip it off here.
4024 case $output in
4025 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
4026 esac
4027 # test for cygwin because mv fails w/o .exe extensions
4028 case $host in
4029 *cygwin*) exeext=.exe ;;
4030 *) exeext= ;;
4031 esac
4032 $rm $output
4033 trap "$rm $output; exit 1" 1 2 15
4035 $echo > $output "\
4036 #! $SHELL
4038 # $output - temporary wrapper script for $objdir/$outputname
4039 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4041 # The $output program cannot be directly executed until all the libtool
4042 # libraries that it depends on are installed.
4044 # This wrapper script should never be moved out of the build directory.
4045 # If it is, it will not operate correctly.
4047 # Sed substitution that helps us do robust quoting. It backslashifies
4048 # metacharacters that are still active within double-quoted strings.
4049 Xsed='sed -e 1s/^X//'
4050 sed_quote_subst='$sed_quote_subst'
4052 # The HP-UX ksh and POSIX shell print the target directory to stdout
4053 # if CDPATH is set.
4054 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4056 relink_command=\"$relink_command\"
4058 # This environment variable determines our operation mode.
4059 if test \"\$libtool_install_magic\" = \"$magic\"; then
4060 # install mode needs the following variable:
4061 notinst_deplibs='$notinst_deplibs'
4062 else
4063 # When we are sourced in execute mode, \$file and \$echo are already set.
4064 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4065 echo=\"$qecho\"
4066 file=\"\$0\"
4067 # Make sure echo works.
4068 if test \"X\$1\" = X--no-reexec; then
4069 # Discard the --no-reexec flag, and continue.
4070 shift
4071 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4072 # Yippee, \$echo works!
4074 else
4075 # Restart under the correct shell, and then maybe \$echo will work.
4076 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4080 $echo >> $output "\
4082 # Find the directory that this script lives in.
4083 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4084 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4086 # Follow symbolic links until we get to the real thisdir.
4087 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
4088 while test -n \"\$file\"; do
4089 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4091 # If there was a directory component, then change thisdir.
4092 if test \"x\$destdir\" != \"x\$file\"; then
4093 case \"\$destdir\" in
4094 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4095 *) thisdir=\"\$thisdir/\$destdir\" ;;
4096 esac
4099 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4100 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
4101 done
4103 # Try to get the absolute directory name.
4104 absdir=\`cd \"\$thisdir\" && pwd\`
4105 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4108 if test "$fast_install" = yes; then
4109 echo >> $output "\
4110 program=lt-'$outputname'$exeext
4111 progdir=\"\$thisdir/$objdir\"
4113 if test ! -f \"\$progdir/\$program\" || \\
4114 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
4115 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4117 file=\"\$\$-\$program\"
4119 if test ! -d \"\$progdir\"; then
4120 $mkdir \"\$progdir\"
4121 else
4122 $rm \"\$progdir/\$file\"
4125 echo >> $output "\
4127 # relink executable if necessary
4128 if test -n \"\$relink_command\"; then
4129 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4130 else
4131 $echo \"\$relink_command_output\" >&2
4132 $rm \"\$progdir/\$file\"
4133 exit 1
4137 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4138 { $rm \"\$progdir/\$program\";
4139 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4140 $rm \"\$progdir/\$file\"
4142 else
4143 echo >> $output "\
4144 program='$outputname'
4145 progdir=\"\$thisdir/$objdir\"
4149 echo >> $output "\
4151 if test -f \"\$progdir/\$program\"; then"
4153 # Export our shlibpath_var if we have one.
4154 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4155 $echo >> $output "\
4156 # Add our own library path to $shlibpath_var
4157 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4159 # Some systems cannot cope with colon-terminated $shlibpath_var
4160 # The second colon is a workaround for a bug in BeOS R4 sed
4161 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4163 export $shlibpath_var
4167 # fixup the dll searchpath if we need to.
4168 if test -n "$dllsearchpath"; then
4169 $echo >> $output "\
4170 # Add the dll search path components to the executable PATH
4171 PATH=$dllsearchpath:\$PATH
4175 $echo >> $output "\
4176 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4177 # Run the actual program with our arguments.
4179 case $host in
4180 # win32 systems need to use the prog path for dll
4181 # lookup to work
4182 *-*-cygwin* | *-*-pw32*)
4183 $echo >> $output "\
4184 exec \$progdir/\$program \${1+\"\$@\"}
4188 # Backslashes separate directories on plain windows
4189 *-*-mingw | *-*-os2*)
4190 $echo >> $output "\
4191 exec \$progdir\\\\\$program \${1+\"\$@\"}
4196 $echo >> $output "\
4197 # Export the path to the program.
4198 PATH=\"\$progdir:\$PATH\"
4199 export PATH
4201 exec \$program \${1+\"\$@\"}
4204 esac
4205 $echo >> $output "\
4206 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4207 exit 1
4209 else
4210 # The program doesn't exist.
4211 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4212 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4213 echo \"See the $PACKAGE documentation for more information.\" 1>&2
4214 exit 1
4218 chmod +x $output
4220 exit 0
4222 esac
4224 # See if we need to build an old-fashioned archive.
4225 for oldlib in $oldlibs; do
4227 if test "$build_libtool_libs" = convenience; then
4228 oldobjs="$libobjs_save"
4229 addlibs="$convenience"
4230 build_libtool_libs=no
4231 else
4232 if test "$build_libtool_libs" = module; then
4233 oldobjs="$libobjs_save"
4234 build_libtool_libs=no
4235 else
4236 oldobjs="$objs$old_deplibs $non_pic_objects"
4238 addlibs="$old_convenience"
4241 if test -n "$addlibs"; then
4242 gentop="$output_objdir/${outputname}x"
4243 $show "${rm}r $gentop"
4244 $run ${rm}r "$gentop"
4245 $show "$mkdir $gentop"
4246 $run $mkdir "$gentop"
4247 status=$?
4248 if test $status -ne 0 && test ! -d "$gentop"; then
4249 exit $status
4251 generated="$generated $gentop"
4253 # Add in members from convenience archives.
4254 for xlib in $addlibs; do
4255 # Extract the objects.
4256 case $xlib in
4257 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4258 *) xabs=`pwd`"/$xlib" ;;
4259 esac
4260 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4261 xdir="$gentop/$xlib"
4263 $show "${rm}r $xdir"
4264 $run ${rm}r "$xdir"
4265 $show "$mkdir $xdir"
4266 $run $mkdir "$xdir"
4267 status=$?
4268 if test $status -ne 0 && test ! -d "$xdir"; then
4269 exit $status
4271 $show "(cd $xdir && $AR x $xabs)"
4272 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4274 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
4275 done
4278 # Do each command in the archive commands.
4279 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4280 eval cmds=\"$old_archive_from_new_cmds\"
4281 else
4282 # # Ensure that we have .o objects in place in case we decided
4283 # # not to build a shared library, and have fallen back to building
4284 # # static libs even though --disable-static was passed!
4285 # for oldobj in $oldobjs; do
4286 # if test ! -f $oldobj; then
4287 # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
4288 # if test "X$xdir" = "X$oldobj"; then
4289 # xdir="."
4290 # else
4291 # xdir="$xdir"
4292 # fi
4293 # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
4294 # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
4295 # $show "(cd $xdir && ${LN_S} $obj $baseobj)"
4296 # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4297 # fi
4298 # done
4300 eval cmds=\"$old_archive_cmds\"
4302 if len=`expr "X$cmds" : ".*"` &&
4303 test $len -le $max_cmd_len; then
4305 else
4306 # the command line is too long to link in one step, link in parts
4307 $echo "using piecewise archive linking..."
4308 save_RANLIB=$RANLIB
4309 RANLIB=:
4310 objlist=
4311 concat_cmds=
4312 save_oldobjs=$oldobjs
4313 # GNU ar 2.10+ was changed to match POSIX; thus no paths are
4314 # encoded into archives. This makes 'ar r' malfunction in
4315 # this piecewise linking case whenever conflicting object
4316 # names appear in distinct ar calls; check, warn and compensate.
4317 if (for obj in $save_oldobjs
4319 $echo "X$obj" | $Xsed -e 's%^.*/%%'
4320 done | sort | sort -uc >/dev/null 2>&1); then
4322 else
4323 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
4324 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
4325 AR_FLAGS=cq
4327 for obj in $save_oldobjs
4329 oldobjs="$objlist $obj"
4330 objlist="$objlist $obj"
4331 eval test_cmds=\"$old_archive_cmds\"
4332 if len=`expr "X$test_cmds" : ".*"` &&
4333 test $len -le $max_cmd_len; then
4335 else
4336 # the above command should be used before it gets too long
4337 oldobjs=$objlist
4338 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4339 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4340 objlist=
4342 done
4343 RANLIB=$save_RANLIB
4344 oldobjs=$objlist
4345 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4348 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4349 for cmd in $cmds; do
4350 IFS="$save_ifs"
4351 $show "$cmd"
4352 $run eval "$cmd" || exit $?
4353 done
4354 IFS="$save_ifs"
4355 done
4357 if test -n "$generated"; then
4358 $show "${rm}r$generated"
4359 $run ${rm}r$generated
4362 # Now create the libtool archive.
4363 case $output in
4364 *.la)
4365 old_library=
4366 test "$build_old_libs" = yes && old_library="$libname.$libext"
4367 $show "creating $output"
4369 # Preserve any variables that may affect compiler behavior
4370 for var in $variables_saved_for_relink; do
4371 if eval test -z \"\${$var+set}\"; then
4372 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4373 elif eval var_value=\$$var; test -z "$var_value"; then
4374 relink_command="$var=; export $var; $relink_command"
4375 else
4376 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4377 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4379 done
4380 # Quote the link command for shipping.
4381 tagopts=
4382 for tag in $taglist; do
4383 tagopts="$tagopts --tag $tag"
4384 done
4385 relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)"
4386 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4388 # Only create the output if not a dry run.
4389 if test -z "$run"; then
4390 for installed in no yes; do
4391 if test "$installed" = yes; then
4392 if test -z "$install_libdir"; then
4393 break
4395 output="$output_objdir/$outputname"i
4396 # Replace all uninstalled libtool libraries with the installed ones
4397 newdependency_libs=
4398 for deplib in $dependency_libs; do
4399 case $deplib in
4400 *.la)
4401 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4402 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4403 if test -z "$libdir"; then
4404 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4405 exit 1
4407 newdependency_libs="$newdependency_libs $libdir/$name"
4409 *) newdependency_libs="$newdependency_libs $deplib" ;;
4410 esac
4411 done
4412 dependency_libs="$newdependency_libs"
4413 newdlfiles=
4414 for lib in $dlfiles; do
4415 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4416 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4417 if test -z "$libdir"; then
4418 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4419 exit 1
4421 newdlfiles="$newdlfiles $libdir/$name"
4422 done
4423 dlfiles="$newdlfiles"
4424 newdlprefiles=
4425 for lib in $dlprefiles; do
4426 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4427 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4428 if test -z "$libdir"; then
4429 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4430 exit 1
4432 newdlprefiles="$newdlprefiles $libdir/$name"
4433 done
4434 dlprefiles="$newdlprefiles"
4436 $rm $output
4437 # place dlname in correct position for cygwin
4438 tdlname=$dlname
4439 case $host,$output,$installed,$module,$dlname in
4440 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4441 esac
4442 $echo > $output "\
4443 # $outputname - a libtool library file
4444 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4446 # Please DO NOT delete this file!
4447 # It is necessary for linking the library.
4449 # The name that we can dlopen(3).
4450 dlname='$tdlname'
4452 # Names of this library.
4453 library_names='$library_names'
4455 # The name of the static archive.
4456 old_library='$old_library'
4458 # Libraries that this one depends upon.
4459 dependency_libs='$dependency_libs'
4461 # Version information for $libname.
4462 current=$current
4463 age=$age
4464 revision=$revision
4466 # Is this an already installed library?
4467 installed=$installed
4469 # Files to dlopen/dlpreopen
4470 dlopen='$dlfiles'
4471 dlpreopen='$dlprefiles'
4473 # Directory that this library needs to be installed in:
4474 libdir='$install_libdir'"
4475 if test "$installed" = no && test $need_relink = yes; then
4476 $echo >> $output "\
4477 relink_command=\"$relink_command\""
4479 done
4482 # Do a symbolic link so that the libtool archive can be found in
4483 # LD_LIBRARY_PATH before the program is installed.
4484 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4485 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4487 esac
4488 exit 0
4491 # libtool install mode
4492 install)
4493 modename="$modename: install"
4495 # There may be an optional sh(1) argument at the beginning of
4496 # install_prog (especially on Windows NT).
4497 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4498 # Allow the use of GNU shtool's install command.
4499 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4500 # Aesthetically quote it.
4501 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4502 case $arg in
4503 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4504 arg="\"$arg\""
4506 esac
4507 install_prog="$arg "
4508 arg="$1"
4509 shift
4510 else
4511 install_prog=
4512 arg="$nonopt"
4515 # The real first argument should be the name of the installation program.
4516 # Aesthetically quote it.
4517 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4518 case $arg in
4519 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4520 arg="\"$arg\""
4522 esac
4523 install_prog="$install_prog$arg"
4525 # We need to accept at least all the BSD install flags.
4526 dest=
4527 files=
4528 opts=
4529 prev=
4530 install_type=
4531 isdir=no
4532 stripme=
4533 for arg
4535 if test -n "$dest"; then
4536 files="$files $dest"
4537 dest="$arg"
4538 continue
4541 case $arg in
4542 -d) isdir=yes ;;
4543 -f) prev="-f" ;;
4544 -g) prev="-g" ;;
4545 -m) prev="-m" ;;
4546 -o) prev="-o" ;;
4548 stripme=" -s"
4549 continue
4551 -*) ;;
4554 # If the previous option needed an argument, then skip it.
4555 if test -n "$prev"; then
4556 prev=
4557 else
4558 dest="$arg"
4559 continue
4562 esac
4564 # Aesthetically quote the argument.
4565 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4566 case $arg in
4567 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4568 arg="\"$arg\""
4570 esac
4571 install_prog="$install_prog $arg"
4572 done
4574 if test -z "$install_prog"; then
4575 $echo "$modename: you must specify an install program" 1>&2
4576 $echo "$help" 1>&2
4577 exit 1
4580 if test -n "$prev"; then
4581 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4582 $echo "$help" 1>&2
4583 exit 1
4586 if test -z "$files"; then
4587 if test -z "$dest"; then
4588 $echo "$modename: no file or destination specified" 1>&2
4589 else
4590 $echo "$modename: you must specify a destination" 1>&2
4592 $echo "$help" 1>&2
4593 exit 1
4596 # Strip any trailing slash from the destination.
4597 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4599 # Check to see that the destination is a directory.
4600 test -d "$dest" && isdir=yes
4601 if test "$isdir" = yes; then
4602 destdir="$dest"
4603 destname=
4604 else
4605 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4606 test "X$destdir" = "X$dest" && destdir=.
4607 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4609 # Not a directory, so check to see that there is only one file specified.
4610 set dummy $files
4611 if test $# -gt 2; then
4612 $echo "$modename: \`$dest' is not a directory" 1>&2
4613 $echo "$help" 1>&2
4614 exit 1
4617 case $destdir in
4618 [\\/]* | [A-Za-z]:[\\/]*) ;;
4620 for file in $files; do
4621 case $file in
4622 *.lo) ;;
4624 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4625 $echo "$help" 1>&2
4626 exit 1
4628 esac
4629 done
4631 esac
4633 # This variable tells wrapper scripts just to set variables rather
4634 # than running their programs.
4635 libtool_install_magic="$magic"
4637 staticlibs=
4638 future_libdirs=
4639 current_libdirs=
4640 for file in $files; do
4642 # Do each installation.
4643 case $file in
4644 *.$libext)
4645 # Do the static libraries later.
4646 staticlibs="$staticlibs $file"
4649 *.la)
4650 # Check to see that this really is a libtool archive.
4651 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4652 else
4653 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4654 $echo "$help" 1>&2
4655 exit 1
4658 library_names=
4659 old_library=
4660 relink_command=
4661 # If there is no directory component, then add one.
4662 case $file in
4663 */* | *\\*) . $file ;;
4664 *) . ./$file ;;
4665 esac
4667 # Add the libdir to current_libdirs if it is the destination.
4668 if test "X$destdir" = "X$libdir"; then
4669 case "$current_libdirs " in
4670 *" $libdir "*) ;;
4671 *) current_libdirs="$current_libdirs $libdir" ;;
4672 esac
4673 else
4674 # Note the libdir as a future libdir.
4675 case "$future_libdirs " in
4676 *" $libdir "*) ;;
4677 *) future_libdirs="$future_libdirs $libdir" ;;
4678 esac
4681 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4682 test "X$dir" = "X$file/" && dir=
4683 dir="$dir$objdir"
4685 if test -n "$relink_command"; then
4686 $echo "$modename: warning: relinking \`$file'" 1>&2
4687 $show "$relink_command"
4688 if $run eval "$relink_command"; then :
4689 else
4690 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4691 exit 1
4695 # See the names of the shared library.
4696 set dummy $library_names
4697 if test -n "$2"; then
4698 realname="$2"
4699 shift
4700 shift
4702 srcname="$realname"
4703 test -n "$relink_command" && srcname="$realname"T
4705 # Install the shared library and build the symlinks.
4706 $show "$install_prog $dir/$srcname $destdir/$realname"
4707 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4708 if test -n "$stripme" && test -n "$striplib"; then
4709 $show "$striplib $destdir/$realname"
4710 $run eval "$striplib $destdir/$realname" || exit $?
4713 if test $# -gt 0; then
4714 # Delete the old symlinks, and create new ones.
4715 for linkname
4717 if test "$linkname" != "$realname"; then
4718 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4719 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4721 done
4724 # Do each command in the postinstall commands.
4725 lib="$destdir/$realname"
4726 eval cmds=\"$postinstall_cmds\"
4727 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4728 for cmd in $cmds; do
4729 IFS="$save_ifs"
4730 $show "$cmd"
4731 $run eval "$cmd" || exit $?
4732 done
4733 IFS="$save_ifs"
4736 # Install the pseudo-library for information purposes.
4737 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4738 instname="$dir/$name"i
4739 $show "$install_prog $instname $destdir/$name"
4740 $run eval "$install_prog $instname $destdir/$name" || exit $?
4742 # Maybe install the static library, too.
4743 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4746 *.lo)
4747 # Install (i.e. copy) a libtool object.
4749 # Figure out destination file name, if it wasn't already specified.
4750 if test -n "$destname"; then
4751 destfile="$destdir/$destname"
4752 else
4753 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4754 destfile="$destdir/$destfile"
4757 # Deduce the name of the destination old-style object file.
4758 case $destfile in
4759 *.lo)
4760 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4762 *.$objext)
4763 staticdest="$destfile"
4764 destfile=
4767 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4768 $echo "$help" 1>&2
4769 exit 1
4771 esac
4773 # Install the libtool object if requested.
4774 if test -n "$destfile"; then
4775 $show "$install_prog $file $destfile"
4776 $run eval "$install_prog $file $destfile" || exit $?
4779 # Install the old object if enabled.
4780 if test "$build_old_libs" = yes; then
4781 # Deduce the name of the old-style object file.
4782 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4784 $show "$install_prog $staticobj $staticdest"
4785 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4787 exit 0
4791 # Figure out destination file name, if it wasn't already specified.
4792 if test -n "$destname"; then
4793 destfile="$destdir/$destname"
4794 else
4795 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4796 destfile="$destdir/$destfile"
4799 # Do a test to see if this is really a libtool program.
4800 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4801 notinst_deplibs=
4802 relink_command=
4804 # If there is no directory component, then add one.
4805 case $file in
4806 */* | *\\*) . $file ;;
4807 *) . ./$file ;;
4808 esac
4810 # Check the variables that should have been set.
4811 if test -z "$notinst_deplibs"; then
4812 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4813 exit 1
4816 finalize=yes
4817 for lib in $notinst_deplibs; do
4818 # Check to see that each library is installed.
4819 libdir=
4820 if test -f "$lib"; then
4821 # If there is no directory component, then add one.
4822 case $lib in
4823 */* | *\\*) . $lib ;;
4824 *) . ./$lib ;;
4825 esac
4827 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4828 if test -n "$libdir" && test ! -f "$libfile"; then
4829 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4830 finalize=no
4832 done
4834 relink_command=
4835 # If there is no directory component, then add one.
4836 case $file in
4837 */* | *\\*) . $file ;;
4838 *) . ./$file ;;
4839 esac
4841 outputname=
4842 if test "$fast_install" = no && test -n "$relink_command"; then
4843 if test "$finalize" = yes && test -z "$run"; then
4844 tmpdir="/tmp"
4845 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4846 tmpdir="$tmpdir/libtool-$$"
4847 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4848 else
4849 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4850 continue
4852 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4853 outputname="$tmpdir/$file"
4854 # Replace the output file specification.
4855 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4857 $show "$relink_command"
4858 if $run eval "$relink_command"; then :
4859 else
4860 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4861 ${rm}r "$tmpdir"
4862 continue
4864 file="$outputname"
4865 else
4866 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4868 else
4869 # Install the binary that we compiled earlier.
4870 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4875 # remove .exe since cygwin /usr/bin/install will append another
4876 # one anyways
4877 case $install_prog,$host in
4878 */usr/bin/install*,*cygwin*)
4879 case $file:$destfile in
4880 *.exe:*.exe)
4881 # this is ok
4883 *.exe:*)
4884 destfile=$destfile.exe
4886 *:*.exe)
4887 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4889 esac
4891 esac
4893 $show "$install_prog$stripme $file $destfile"
4894 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4895 test -n "$outputname" && ${rm}r "$tmpdir"
4897 esac
4898 done
4900 for file in $staticlibs; do
4901 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4903 # Set up the ranlib parameters.
4904 oldlib="$destdir/$name"
4906 $show "$install_prog $file $oldlib"
4907 $run eval "$install_prog \$file \$oldlib" || exit $?
4909 if test -n "$stripme" && test -n "$striplib"; then
4910 $show "$old_striplib $oldlib"
4911 $run eval "$old_striplib $oldlib" || exit $?
4914 # Do each command in the postinstall commands.
4915 eval cmds=\"$old_postinstall_cmds\"
4916 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4917 for cmd in $cmds; do
4918 IFS="$save_ifs"
4919 $show "$cmd"
4920 $run eval "$cmd" || exit $?
4921 done
4922 IFS="$save_ifs"
4923 done
4925 if test -n "$future_libdirs"; then
4926 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4929 if test -n "$current_libdirs"; then
4930 # Maybe just do a dry run.
4931 test -n "$run" && current_libdirs=" -n$current_libdirs"
4932 exec_cmd='$SHELL $0 --finish$current_libdirs'
4933 else
4934 exit 0
4938 # libtool finish mode
4939 finish)
4940 modename="$modename: finish"
4941 libdirs="$nonopt"
4942 admincmds=
4944 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4945 for dir
4947 libdirs="$libdirs $dir"
4948 done
4950 for libdir in $libdirs; do
4951 if test -n "$finish_cmds"; then
4952 # Do each command in the finish commands.
4953 eval cmds=\"$finish_cmds\"
4954 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4955 for cmd in $cmds; do
4956 IFS="$save_ifs"
4957 $show "$cmd"
4958 $run eval "$cmd" || admincmds="$admincmds
4959 $cmd"
4960 done
4961 IFS="$save_ifs"
4963 if test -n "$finish_eval"; then
4964 # Do the single finish_eval.
4965 eval cmds=\"$finish_eval\"
4966 $run eval "$cmds" || admincmds="$admincmds
4967 $cmds"
4969 done
4972 # Exit here if they wanted silent mode.
4973 test "$show" = ":" && exit 0
4975 echo "----------------------------------------------------------------------"
4976 echo "Libraries have been installed in:"
4977 for libdir in $libdirs; do
4978 echo " $libdir"
4979 done
4980 echo
4981 echo "If you ever happen to want to link against installed libraries"
4982 echo "in a given directory, LIBDIR, you must either use libtool, and"
4983 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4984 echo "flag during linking and do at least one of the following:"
4985 if test -n "$shlibpath_var"; then
4986 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4987 echo " during execution"
4989 if test -n "$runpath_var"; then
4990 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4991 echo " during linking"
4993 if test -n "$hardcode_libdir_flag_spec"; then
4994 libdir=LIBDIR
4995 eval flag=\"$hardcode_libdir_flag_spec\"
4997 echo " - use the \`$flag' linker flag"
4999 if test -n "$admincmds"; then
5000 echo " - have your system administrator run these commands:$admincmds"
5002 if test -f /etc/ld.so.conf; then
5003 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5005 echo
5006 echo "See any operating system documentation about shared libraries for"
5007 echo "more information, such as the ld(1) and ld.so(8) manual pages."
5008 echo "----------------------------------------------------------------------"
5009 exit 0
5012 # libtool execute mode
5013 execute)
5014 modename="$modename: execute"
5016 # The first argument is the command name.
5017 cmd="$nonopt"
5018 if test -z "$cmd"; then
5019 $echo "$modename: you must specify a COMMAND" 1>&2
5020 $echo "$help"
5021 exit 1
5024 # Handle -dlopen flags immediately.
5025 for file in $execute_dlfiles; do
5026 if test ! -f "$file"; then
5027 $echo "$modename: \`$file' is not a file" 1>&2
5028 $echo "$help" 1>&2
5029 exit 1
5032 dir=
5033 case $file in
5034 *.la)
5035 # Check to see that this really is a libtool archive.
5036 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5037 else
5038 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5039 $echo "$help" 1>&2
5040 exit 1
5043 # Read the libtool library.
5044 dlname=
5045 library_names=
5047 # If there is no directory component, then add one.
5048 case $file in
5049 */* | *\\*) . $file ;;
5050 *) . ./$file ;;
5051 esac
5053 # Skip this library if it cannot be dlopened.
5054 if test -z "$dlname"; then
5055 # Warn if it was a shared library.
5056 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5057 continue
5060 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5061 test "X$dir" = "X$file" && dir=.
5063 if test -f "$dir/$objdir/$dlname"; then
5064 dir="$dir/$objdir"
5065 else
5066 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5067 exit 1
5071 *.lo)
5072 # Just add the directory containing the .lo file.
5073 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5074 test "X$dir" = "X$file" && dir=.
5078 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5079 continue
5081 esac
5083 # Get the absolute pathname.
5084 absdir=`cd "$dir" && pwd`
5085 test -n "$absdir" && dir="$absdir"
5087 # Now add the directory to shlibpath_var.
5088 if eval "test -z \"\$$shlibpath_var\""; then
5089 eval "$shlibpath_var=\"\$dir\""
5090 else
5091 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5093 done
5095 # This variable tells wrapper scripts just to set shlibpath_var
5096 # rather than running their programs.
5097 libtool_execute_magic="$magic"
5099 # Check if any of the arguments is a wrapper script.
5100 args=
5101 for file
5103 case $file in
5104 -*) ;;
5106 # Do a test to see if this is really a libtool program.
5107 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5108 # If there is no directory component, then add one.
5109 case $file in
5110 */* | *\\*) . $file ;;
5111 *) . ./$file ;;
5112 esac
5114 # Transform arg to wrapped name.
5115 file="$progdir/$program"
5118 esac
5119 # Quote arguments (to preserve shell metacharacters).
5120 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5121 args="$args \"$file\""
5122 done
5124 if test -z "$run"; then
5125 if test -n "$shlibpath_var"; then
5126 # Export the shlibpath_var.
5127 eval "export $shlibpath_var"
5130 # Restore saved enviroment variables
5131 if test "${save_LC_ALL+set}" = set; then
5132 LC_ALL="$save_LC_ALL"; export LC_ALL
5134 if test "${save_LANG+set}" = set; then
5135 LANG="$save_LANG"; export LANG
5138 # Now prepare to actually exec the command.
5139 exec_cmd='"$cmd"$args'
5140 else
5141 # Display what would be done.
5142 if test -n "$shlibpath_var"; then
5143 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5144 $echo "export $shlibpath_var"
5146 $echo "$cmd$args"
5147 exit 0
5151 # libtool clean and uninstall mode
5152 clean | uninstall)
5153 modename="$modename: $mode"
5154 rm="$nonopt"
5155 files=
5156 rmforce=
5157 exit_status=0
5159 # This variable tells wrapper scripts just to set variables rather
5160 # than running their programs.
5161 libtool_install_magic="$magic"
5163 for arg
5165 case $arg in
5166 -f) rm="$rm $arg"; rmforce=yes ;;
5167 -*) rm="$rm $arg" ;;
5168 *) files="$files $arg" ;;
5169 esac
5170 done
5172 if test -z "$rm"; then
5173 $echo "$modename: you must specify an RM program" 1>&2
5174 $echo "$help" 1>&2
5175 exit 1
5178 rmdirs=
5180 for file in $files; do
5181 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5182 if test "X$dir" = "X$file"; then
5183 dir=.
5184 objdir="$objdir"
5185 else
5186 objdir="$dir/$objdir"
5188 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5189 test $mode = uninstall && objdir="$dir"
5191 # Remember objdir for removal later, being careful to avoid duplicates
5192 if test $mode = clean; then
5193 case " $rmdirs " in
5194 *" $objdir "*) ;;
5195 *) rmdirs="$rmdirs $objdir" ;;
5196 esac
5199 # Don't error if the file doesn't exist and rm -f was used.
5200 if (test -L "$file") >/dev/null 2>&1 \
5201 || (test -h "$file") >/dev/null 2>&1 \
5202 || test -f "$file"; then
5204 elif test -d "$file"; then
5205 exit_status=1
5206 continue
5207 elif test "$rmforce" = yes; then
5208 continue
5211 rmfiles="$file"
5213 case $name in
5214 *.la)
5215 # Possibly a libtool archive, so verify it.
5216 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5217 . $dir/$name
5219 # Delete the libtool libraries and symlinks.
5220 for n in $library_names; do
5221 rmfiles="$rmfiles $objdir/$n"
5222 done
5223 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5224 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5226 if test $mode = uninstall; then
5227 if test -n "$library_names"; then
5228 # Do each command in the postuninstall commands.
5229 eval cmds=\"$postuninstall_cmds\"
5230 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5231 for cmd in $cmds; do
5232 IFS="$save_ifs"
5233 $show "$cmd"
5234 $run eval "$cmd"
5235 if test $? != 0 && test "$rmforce" != yes; then
5236 exit_status=1
5238 done
5239 IFS="$save_ifs"
5242 if test -n "$old_library"; then
5243 # Do each command in the old_postuninstall commands.
5244 eval cmds=\"$old_postuninstall_cmds\"
5245 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5246 for cmd in $cmds; do
5247 IFS="$save_ifs"
5248 $show "$cmd"
5249 $run eval "$cmd"
5250 if test $? != 0 && test "$rmforce" != yes; then
5251 exit_status=1
5253 done
5254 IFS="$save_ifs"
5256 # FIXME: should reinstall the best remaining shared library.
5261 *.lo)
5262 # Possibly a libtool object, so verify it.
5263 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5265 # Read the .lo file
5266 . $dir/$name
5268 # Add PIC object to the list of files to remove.
5269 if test -n "$pic_object" \
5270 && test "$pic_object" != none; then
5271 rmfiles="$rmfiles $dir/$pic_object"
5274 # Add non-PIC object to the list of files to remove.
5275 if test -n "$non_pic_object" \
5276 && test "$non_pic_object" != none; then
5277 rmfiles="$rmfiles $dir/$non_pic_object"
5283 # Do a test to see if this is a libtool program.
5284 if test $mode = clean &&
5285 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5286 relink_command=
5287 . $dir/$file
5289 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5290 if test "$fast_install" = yes && test -n "$relink_command"; then
5291 rmfiles="$rmfiles $objdir/lt-$name"
5295 esac
5296 $show "$rm $rmfiles"
5297 $run $rm $rmfiles || exit_status=1
5298 done
5300 # Try to remove the ${objdir}s in the directories where we deleted files
5301 for dir in $rmdirs; do
5302 if test -d "$dir"; then
5303 $show "rmdir $dir"
5304 $run rmdir $dir >/dev/null 2>&1
5306 done
5308 exit $exit_status
5312 $echo "$modename: you must specify a MODE" 1>&2
5313 $echo "$generic_help" 1>&2
5314 exit 1
5316 esac
5318 if test -z "$exec_cmd"; then
5319 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5320 $echo "$generic_help" 1>&2
5321 exit 1
5323 fi # test -z "$show_help"
5325 if test -n "$exec_cmd"; then
5326 eval exec $exec_cmd
5327 exit 1
5330 # We need to display help for each of the modes.
5331 case $mode in
5332 "") $echo \
5333 "Usage: $modename [OPTION]... [MODE-ARG]...
5335 Provide generalized library-building support services.
5337 --config show all configuration variables
5338 --debug enable verbose shell tracing
5339 -n, --dry-run display commands without modifying any files
5340 --features display basic configuration information and exit
5341 --finish same as \`--mode=finish'
5342 --help display this help message and exit
5343 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
5344 --quiet same as \`--silent'
5345 --silent don't print informational messages
5346 --tag=TAG use configuration variables from tag TAG
5347 --version print version information
5349 MODE must be one of the following:
5351 clean remove files from the build directory
5352 compile compile a source file into a libtool object
5353 execute automatically set library path, then run a program
5354 finish complete the installation of libtool libraries
5355 install install libraries or executables
5356 link create a library or an executable
5357 uninstall remove libraries from an installed directory
5359 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5360 a more detailed description of MODE."
5361 exit 0
5364 clean)
5365 $echo \
5366 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5368 Remove files from the build directory.
5370 RM is the name of the program to use to delete files associated with each FILE
5371 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5372 to RM.
5374 If FILE is a libtool library, object or program, all the files associated
5375 with it are deleted. Otherwise, only FILE itself is deleted using RM."
5378 compile)
5379 $echo \
5380 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5382 Compile a source file into a libtool library object.
5384 This mode accepts the following additional options:
5386 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5387 -prefer-pic try to building PIC objects only
5388 -prefer-non-pic try to building non-PIC objects only
5389 -static always build a \`.o' file suitable for static linking
5391 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5392 from the given SOURCEFILE.
5394 The output file name is determined by removing the directory component from
5395 SOURCEFILE, then substituting the C source code suffix \`.c' with the
5396 library object suffix, \`.lo'."
5399 execute)
5400 $echo \
5401 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5403 Automatically set library path, then run a program.
5405 This mode accepts the following additional options:
5407 -dlopen FILE add the directory containing FILE to the library path
5409 This mode sets the library path environment variable according to \`-dlopen'
5410 flags.
5412 If any of the ARGS are libtool executable wrappers, then they are translated
5413 into their corresponding uninstalled binary, and any of their required library
5414 directories are added to the library path.
5416 Then, COMMAND is executed, with ARGS as arguments."
5419 finish)
5420 $echo \
5421 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5423 Complete the installation of libtool libraries.
5425 Each LIBDIR is a directory that contains libtool libraries.
5427 The commands that this mode executes may require superuser privileges. Use
5428 the \`--dry-run' option if you just want to see what would be executed."
5431 install)
5432 $echo \
5433 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5435 Install executables or libraries.
5437 INSTALL-COMMAND is the installation command. The first component should be
5438 either the \`install' or \`cp' program.
5440 The rest of the components are interpreted as arguments to that command (only
5441 BSD-compatible install options are recognized)."
5444 link)
5445 $echo \
5446 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5448 Link object files or libraries together to form another library, or to
5449 create an executable program.
5451 LINK-COMMAND is a command using the C compiler that you would use to create
5452 a program from several object files.
5454 The following components of LINK-COMMAND are treated specially:
5456 -all-static do not do any dynamic linking at all
5457 -avoid-version do not add a version suffix if possible
5458 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5459 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5460 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5461 -export-symbols SYMFILE
5462 try to export only the symbols listed in SYMFILE
5463 -export-symbols-regex REGEX
5464 try to export only the symbols matching REGEX
5465 -LLIBDIR search LIBDIR for required installed libraries
5466 -lNAME OUTPUT-FILE requires the installed library libNAME
5467 -module build a library that can dlopened
5468 -no-fast-install disable the fast-install mode
5469 -no-install link a not-installable executable
5470 -no-undefined declare that a library does not refer to external symbols
5471 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5472 -objectlist FILE Use a list of object files found in FILE to specify objects
5473 -release RELEASE specify package release information
5474 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5475 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5476 -static do not do any dynamic linking of libtool libraries
5477 -version-info CURRENT[:REVISION[:AGE]]
5478 specify library version info [each variable defaults to 0]
5480 All other options (arguments beginning with \`-') are ignored.
5482 Every other argument is treated as a filename. Files ending in \`.la' are
5483 treated as uninstalled libtool libraries, other files are standard or library
5484 object files.
5486 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5487 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5488 required, except when creating a convenience library.
5490 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5491 using \`ar' and \`ranlib', or on Windows using \`lib'.
5493 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5494 is created, otherwise an executable program is created."
5497 uninstall)
5498 $echo \
5499 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5501 Remove libraries from an installation directory.
5503 RM is the name of the program to use to delete files associated with each FILE
5504 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5505 to RM.
5507 If FILE is a libtool library, all the files associated with it are deleted.
5508 Otherwise, only FILE itself is deleted using RM."
5512 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5513 $echo "$help" 1>&2
5514 exit 1
5516 esac
5518 echo
5519 $echo "Try \`$modename --help' for more information about other modes."
5521 exit 0
5523 # The TAGs below are defined such that we never get into a situation
5524 # in which we disable both kinds of libraries. Given conflicting
5525 # choices, we go for a static library, that is the most portable,
5526 # since we can't tell whether shared libraries were disabled because
5527 # the user asked for that or because the platform doesn't support
5528 # them. This is particularly important on AIX, because we don't
5529 # support having both static and shared libraries enabled at the same
5530 # time on that platform, so we default to a shared-only configuration.
5531 # If a disable-shared tag is given, we'll fallback to a static-only
5532 # configuration. But we'll never go from static-only to shared-only.
5534 ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5535 build_libtool_libs=no
5536 build_old_libs=yes
5537 ### END LIBTOOL TAG CONFIG: disable-shared
5539 ### BEGIN LIBTOOL TAG CONFIG: disable-static
5540 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5541 ### END LIBTOOL TAG CONFIG: disable-static
5543 # Local Variables:
5544 # mode:shell-script
5545 # sh-indentation:2
5546 # End: