Bump version to gcc-4055.
[official-gcc.git] / ltmain.sh
blob5925eebba574bbc65745ad5d3c68c1ec7e2cbfd0
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 # APPLE LOCAL begin handle ~ in pathnames 2002-01-14 --sts
499 # Since CC may have args with shell metachars in them, add
500 # doublequotes to args so it looks the same as $base_compile.
501 qCC=
502 for argu in $CC; do
503 case $argu in
504 # Double-quote args containing other shell metacharacters.
505 # Many Bourne shells cannot handle close brackets correctly
506 # in scan sets, so we specify it separately.
507 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
508 argu="\"$argu\""
510 esac
511 # Add the previous argument to qCC.
512 if test -z "$qCC"; then
513 qCC="$argu"
514 else
515 qCC="$qCC $argu"
517 done
518 # APPLE LOCAL end handle ~ in pathnames 2002-01-14 --sts
519 case $base_compile in
520 # APPLE LOCAL handle ~ in pathnames 2002-01-14 --sts
521 "$qCC "*) ;;
522 # Blanks in the command may have been stripped by the calling shell,
523 # but not from the CC environment variable when ltconfig was run.
524 # APPLE LOCAL handle ~ in pathnames 2002-01-14 --sts
525 "`$echo $qCC` "*) ;;
527 for z in $available_tags; do
528 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
529 # Evaluate the configuration.
530 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
531 case $base_compile in
532 "$CC "*)
533 # The compiler in the base compile command matches
534 # the one in the tagged configuration.
535 # Assume this is the tagged configuration we want.
536 tagname=$z
537 break
539 "`$echo $CC` "*)
540 tagname=$z
541 break
543 esac
545 done
546 # If $tagname still isn't set, then no tagged configuration
547 # was found and let the user know that the "--tag" command
548 # line option must be used.
549 if test -z "$tagname"; then
550 echo "$modename: unable to infer tagged configuration"
551 echo "$modename: specify a tag with \`--tag'" 1>&2
552 exit 1
553 # else
554 # echo "$modename: using $tagname tagged configuration"
557 esac
560 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
561 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
562 if test "X$xdir" = "X$obj"; then
563 xdir=
564 else
565 xdir=$xdir/
567 lobj=${xdir}$objdir/$objname
569 if test -z "$base_compile"; then
570 $echo "$modename: you must specify a compilation command" 1>&2
571 $echo "$help" 1>&2
572 exit 1
575 # Delete any leftover library objects.
576 if test "$build_old_libs" = yes; then
577 removelist="$obj $lobj $libobj ${libobj}T"
578 else
579 removelist="$lobj $libobj ${libobj}T"
582 $run $rm $removelist
583 trap "$run $rm $removelist; exit 1" 1 2 15
585 # On Cygwin there's no "real" PIC flag so we must build both object types
586 case $host_os in
587 cygwin* | mingw* | pw32* | os2*)
588 pic_mode=default
590 esac
591 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
592 # non-PIC code in shared libraries is not supported
593 pic_mode=default
596 # Calculate the filename of the output object if compiler does
597 # not support -o with -c
598 if test "$compiler_c_o" = no; then
599 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
600 lockfile="$output_obj.lock"
601 removelist="$removelist $output_obj $lockfile"
602 trap "$run $rm $removelist; exit 1" 1 2 15
603 else
604 output_obj=
605 need_locks=no
606 lockfile=
609 # Lock this critical section if it is needed
610 # We use this script file to make the link, it avoids creating a new file
611 if test "$need_locks" = yes; then
612 until $run ln "$0" "$lockfile" 2>/dev/null; do
613 $show "Waiting for $lockfile to be removed"
614 sleep 2
615 done
616 elif test "$need_locks" = warn; then
617 if test -f "$lockfile"; then
618 echo "\
619 *** ERROR, $lockfile exists and contains:
620 `cat $lockfile 2>/dev/null`
622 This indicates that another process is trying to use the same
623 temporary object file, and libtool could not work around it because
624 your compiler does not support \`-c' and \`-o' together. If you
625 repeat this compilation, it may succeed, by chance, but you had better
626 avoid parallel builds (make -j) in this platform, or get a better
627 compiler."
629 $run $rm $removelist
630 exit 1
632 echo $srcfile > "$lockfile"
635 if test -n "$fix_srcfile_path"; then
636 eval srcfile=\"$fix_srcfile_path\"
639 $run $rm "$libobj" "${libobj}T"
641 # Create a libtool object file (analogous to a ".la" file),
642 # but don't create it if we're doing a dry run.
643 test -z "$run" && cat > ${libobj}T <<EOF
644 # $libobj - a libtool object file
645 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
647 # Please DO NOT delete this file!
648 # It is necessary for linking the library.
650 # Name of the PIC object.
653 # Only build a PIC object if we are building libtool libraries.
654 if test "$build_libtool_libs" = yes; then
655 # Without this assignment, base_compile gets emptied.
656 fbsd_hideous_sh_bug=$base_compile
658 if test "$pic_mode" != no; then
659 command="$base_compile $srcfile $pic_flag"
660 else
661 # Don't build PIC code
662 command="$base_compile $srcfile"
665 if test ! -d ${xdir}$objdir; then
666 $show "$mkdir ${xdir}$objdir"
667 $run $mkdir ${xdir}$objdir
668 status=$?
669 if test $status -ne 0 && test ! -d ${xdir}$objdir; then
670 exit $status
674 if test -z "$output_obj"; then
675 # Place PIC objects in $objdir
676 command="$command -o $lobj"
679 $run $rm "$lobj" "$output_obj"
681 $show "$command"
682 if $run eval "$command"; then :
683 else
684 test -n "$output_obj" && $run $rm $removelist
685 exit 1
688 if test "$need_locks" = warn &&
689 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
690 echo "\
691 *** ERROR, $lockfile contains:
692 `cat $lockfile 2>/dev/null`
694 but it should contain:
695 $srcfile
697 This indicates that another process is trying to use the same
698 temporary object file, and libtool could not work around it because
699 your compiler does not support \`-c' and \`-o' together. If you
700 repeat this compilation, it may succeed, by chance, but you had better
701 avoid parallel builds (make -j) in this platform, or get a better
702 compiler."
704 $run $rm $removelist
705 exit 1
708 # Just move the object if needed, then go on to compile the next one
709 if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
710 $show "$mv $output_obj $lobj"
711 if $run $mv $output_obj $lobj; then :
712 else
713 error=$?
714 $run $rm $removelist
715 exit $error
719 # Append the name of the PIC object to the libtool object file.
720 test -z "$run" && cat >> ${libobj}T <<EOF
721 pic_object='$objdir/$objname'
725 # Allow error messages only from the first compilation.
726 suppress_output=' >/dev/null 2>&1'
727 else
728 # No PIC object so indicate it doesn't exist in the libtool
729 # object file.
730 test -z "$run" && cat >> ${libobj}T <<EOF
731 pic_object=none
736 # Only build a position-dependent object if we build old libraries.
737 if test "$build_old_libs" = yes; then
738 if test "$pic_mode" != yes; then
739 # Don't build PIC code
740 command="$base_compile $srcfile"
741 else
742 command="$base_compile $srcfile $pic_flag"
744 if test "$compiler_c_o" = yes; then
745 command="$command -o $obj"
748 # Suppress compiler output if we already did a PIC compilation.
749 command="$command$suppress_output"
750 $run $rm "$obj" "$output_obj"
751 $show "$command"
752 if $run eval "$command"; then :
753 else
754 $run $rm $removelist
755 exit 1
758 if test "$need_locks" = warn &&
759 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
760 echo "\
761 *** ERROR, $lockfile contains:
762 `cat $lockfile 2>/dev/null`
764 but it should contain:
765 $srcfile
767 This indicates that another process is trying to use the same
768 temporary object file, and libtool could not work around it because
769 your compiler does not support \`-c' and \`-o' together. If you
770 repeat this compilation, it may succeed, by chance, but you had better
771 avoid parallel builds (make -j) in this platform, or get a better
772 compiler."
774 $run $rm $removelist
775 exit 1
778 # Just move the object if needed
779 if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
780 $show "$mv $output_obj $obj"
781 if $run $mv $output_obj $obj; then :
782 else
783 error=$?
784 $run $rm $removelist
785 exit $error
789 # Append the name of the non-PIC object the libtool object file.
790 # Only append if the libtool object file exists.
791 test -z "$run" && cat >> ${libobj}T <<EOF
792 # Name of the non-PIC object.
793 non_pic_object='$objname'
796 else
797 # Append the name of the non-PIC object the libtool object file.
798 # Only append if the libtool object file exists.
799 test -z "$run" && cat >> ${libobj}T <<EOF
800 # Name of the non-PIC object.
801 non_pic_object=none
806 $run $mv "${libobj}T" "${libobj}"
808 # Unlock the critical section if it was locked
809 if test "$need_locks" != no; then
810 $run $rm "$lockfile"
813 exit 0
816 # libtool link mode
817 link | relink)
818 modename="$modename: link"
819 case $host in
820 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
821 # It is impossible to link a dll without this setting, and
822 # we shouldn't force the makefile maintainer to figure out
823 # which system we are compiling for in order to pass an extra
824 # flag for every libtool invokation.
825 # allow_undefined=no
827 # FIXME: Unfortunately, there are problems with the above when trying
828 # to make a dll which has undefined symbols, in which case not
829 # even a static library is built. For now, we need to specify
830 # -no-undefined on the libtool link line when we can be certain
831 # that all symbols are satisfied, otherwise we get a static library.
832 allow_undefined=yes
835 allow_undefined=yes
837 esac
838 libtool_args="$nonopt"
839 base_compile="$nonopt"
840 compile_command="$nonopt"
841 finalize_command="$nonopt"
843 compile_rpath=
844 finalize_rpath=
845 compile_shlibpath=
846 finalize_shlibpath=
847 convenience=
848 old_convenience=
849 deplibs=
850 old_deplibs=
851 compiler_flags=
852 linker_flags=
853 dllsearchpath=
854 lib_search_path=`pwd`
856 avoid_version=no
857 dlfiles=
858 dlprefiles=
859 dlself=no
860 export_dynamic=no
861 export_symbols=
862 export_symbols_regex=
863 generated=
864 libobjs=
865 ltlibs=
866 module=no
867 no_install=no
868 objs=
869 non_pic_objects=
870 prefer_static_libs=no
871 preload=no
872 prev=
873 prevarg=
874 release=
875 rpath=
876 xrpath=
877 perm_rpath=
878 temp_rpath=
879 thread_safe=no
880 vinfo=
882 # We need to know -static, to get the right output filenames.
883 for arg
885 case $arg in
886 -all-static | -static)
887 if test "X$arg" = "X-all-static"; then
888 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
889 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
891 if test -n "$link_static_flag"; then
892 dlopen_self=$dlopen_self_static
894 else
895 if test -z "$pic_flag" && test -n "$link_static_flag"; then
896 dlopen_self=$dlopen_self_static
899 build_libtool_libs=no
900 build_old_libs=yes
901 prefer_static_libs=yes
902 break
904 esac
905 done
907 # See if our shared archives depend on static archives.
908 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
910 # Go through the arguments, transforming them on the way.
911 while test $# -gt 0; do
912 arg="$1"
913 base_compile="$base_compile $arg"
914 shift
915 case $arg in
916 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
917 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
919 *) qarg=$arg ;;
920 esac
921 libtool_args="$libtool_args $qarg"
923 # If the previous option needs an argument, assign it.
924 if test -n "$prev"; then
925 case $prev in
926 output)
927 compile_command="$compile_command @OUTPUT@"
928 finalize_command="$finalize_command @OUTPUT@"
930 esac
932 case $prev in
933 dlfiles|dlprefiles)
934 if test "$preload" = no; then
935 # Add the symbol object into the linking commands.
936 compile_command="$compile_command @SYMFILE@"
937 finalize_command="$finalize_command @SYMFILE@"
938 preload=yes
940 case $arg in
941 *.la | *.lo) ;; # We handle these cases below.
942 force)
943 if test "$dlself" = no; then
944 dlself=needless
945 export_dynamic=yes
947 prev=
948 continue
950 self)
951 if test "$prev" = dlprefiles; then
952 dlself=yes
953 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
954 dlself=yes
955 else
956 dlself=needless
957 export_dynamic=yes
959 prev=
960 continue
963 if test "$prev" = dlfiles; then
964 dlfiles="$dlfiles $arg"
965 else
966 dlprefiles="$dlprefiles $arg"
968 prev=
969 continue
971 esac
973 expsyms)
974 export_symbols="$arg"
975 if test ! -f "$arg"; then
976 $echo "$modename: symbol file \`$arg' does not exist"
977 exit 1
979 prev=
980 continue
982 expsyms_regex)
983 export_symbols_regex="$arg"
984 prev=
985 continue
987 release)
988 release="-$arg"
989 prev=
990 continue
992 objectlist)
993 if test -f "$arg"; then
994 save_arg=$arg
995 moreargs=
996 for fil in `cat $save_arg`
998 # moreargs="$moreargs $fil"
999 arg=$fil
1000 # A libtool-controlled object.
1002 # Check to see that this really is a libtool object.
1003 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1004 pic_object=
1005 non_pic_object=
1007 # Read the .lo file
1008 # If there is no directory component, then add one.
1009 case $arg in
1010 */* | *\\*) . $arg ;;
1011 *) . ./$arg ;;
1012 esac
1014 if test -z "$pic_object" || \
1015 test -z "$non_pic_object" ||
1016 test "$pic_object" = none && \
1017 test "$non_pic_object" = none; then
1018 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1019 exit 1
1022 # Extract subdirectory from the argument.
1023 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1024 if test "X$xdir" = "X$arg"; then
1025 xdir=
1026 else
1027 xdir="$xdir/"
1030 if test "$pic_object" != none; then
1031 # Prepend the subdirectory the object is found in.
1032 pic_object="$xdir$pic_object"
1034 if test "$prev" = dlfiles; then
1035 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1036 dlfiles="$dlfiles $pic_object"
1037 prev=
1038 continue
1039 else
1040 # If libtool objects are unsupported, then we need to preload.
1041 prev=dlprefiles
1045 # CHECK ME: I think I busted this. -Ossama
1046 if test "$prev" = dlprefiles; then
1047 # Preload the old-style object.
1048 dlprefiles="$dlprefiles $pic_object"
1049 prev=
1052 # A PIC object.
1053 libobjs="$libobjs $pic_object"
1054 arg="$pic_object"
1057 # Non-PIC object.
1058 if test "$non_pic_object" != none; then
1059 # Prepend the subdirectory the object is found in.
1060 non_pic_object="$xdir$non_pic_object"
1062 # A standard non-PIC object
1063 non_pic_objects="$non_pic_objects $non_pic_object"
1064 if test -z "$pic_object" || test "$pic_object" = none ; then
1065 arg="$non_pic_object"
1067 else
1068 # If the PIC object exists, use it instead.
1069 # $xdir was prepended to $pic_object above.
1070 non_pic_object="$pic_object"
1071 non_pic_objects="$non_pic_objects $non_pic_object"
1073 else
1074 # Only an error if not doing a dry-run.
1075 if test -z "$run"; then
1076 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1077 exit 1
1078 else
1079 # Dry-run case.
1081 # Extract subdirectory from the argument.
1082 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1083 if test "X$xdir" = "X$arg"; then
1084 xdir=
1085 else
1086 xdir="$xdir/"
1089 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1090 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1091 libobjs="$libobjs $pic_object"
1092 non_pic_objects="$non_pic_objects $non_pic_object"
1095 done
1096 else
1097 $echo "$modename: link input file \`$save_arg' does not exist"
1098 exit 1
1100 arg=$save_arg
1101 prev=
1102 continue
1104 rpath | xrpath)
1105 # We need an absolute path.
1106 case $arg in
1107 [\\/]* | [A-Za-z]:[\\/]*) ;;
1109 $echo "$modename: only absolute run-paths are allowed" 1>&2
1110 exit 1
1112 esac
1113 if test "$prev" = rpath; then
1114 case "$rpath " in
1115 *" $arg "*) ;;
1116 *) rpath="$rpath $arg" ;;
1117 esac
1118 else
1119 case "$xrpath " in
1120 *" $arg "*) ;;
1121 *) xrpath="$xrpath $arg" ;;
1122 esac
1124 prev=
1125 continue
1127 xcompiler)
1128 compiler_flags="$compiler_flags $qarg"
1129 prev=
1130 compile_command="$compile_command $qarg"
1131 finalize_command="$finalize_command $qarg"
1132 continue
1134 xlinker)
1135 linker_flags="$linker_flags $qarg"
1136 compiler_flags="$compiler_flags $wl$qarg"
1137 prev=
1138 compile_command="$compile_command $wl$qarg"
1139 finalize_command="$finalize_command $wl$qarg"
1140 continue
1142 framework)
1143 case $host in
1144 *-*-darwin*)
1145 case "$deplibs " in
1146 *" $qarg.framework "*) ;;
1147 *) deplibs="$deplibs $qarg.framework" # this is fixed later
1149 esac
1151 esac
1152 prev=
1153 continue
1156 eval "$prev=\"\$arg\""
1157 prev=
1158 continue
1160 esac
1161 fi # test -n $prev
1163 prevarg="$arg"
1165 case $arg in
1166 -all-static)
1167 if test -n "$link_static_flag"; then
1168 compile_command="$compile_command $link_static_flag"
1169 finalize_command="$finalize_command $link_static_flag"
1171 continue
1174 -allow-undefined)
1175 # FIXME: remove this flag sometime in the future.
1176 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1177 continue
1180 -avoid-version)
1181 avoid_version=yes
1182 continue
1185 -dlopen)
1186 prev=dlfiles
1187 continue
1190 -dlpreopen)
1191 prev=dlprefiles
1192 continue
1195 -export-dynamic)
1196 export_dynamic=yes
1197 continue
1200 -export-symbols | -export-symbols-regex)
1201 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1202 $echo "$modename: more than one -exported-symbols argument is not allowed"
1203 exit 1
1205 if test "X$arg" = "X-export-symbols"; then
1206 prev=expsyms
1207 else
1208 prev=expsyms_regex
1210 continue
1213 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1214 # so, if we see these flags be careful not to treat them like -L
1215 -L[A-Z][A-Z]*:*)
1216 case $with_gcc/$host in
1217 no/*-*-irix*)
1218 compile_command="$compile_command $arg"
1219 finalize_command="$finalize_command $arg"
1221 esac
1222 continue
1225 -L*)
1226 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1227 # We need an absolute path.
1228 case $dir in
1229 [\\/]* | [A-Za-z]:[\\/]*) ;;
1231 absdir=`cd "$dir" && pwd`
1232 if test -z "$absdir"; then
1233 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1234 exit 1
1236 dir="$absdir"
1238 esac
1239 case "$deplibs " in
1240 *" -L$dir "*) ;;
1242 deplibs="$deplibs -L$dir"
1243 lib_search_path="$lib_search_path $dir"
1245 esac
1246 case $host in
1247 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1248 case :$dllsearchpath: in
1249 *":$dir:"*) ;;
1250 *) dllsearchpath="$dllsearchpath:$dir";;
1251 esac
1253 esac
1254 continue
1257 -l*)
1258 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1259 case $host in
1260 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1261 # These systems don't actually have a C or math library (as such)
1262 continue
1264 *-*-mingw* | *-*-os2*)
1265 # These systems don't actually have a C library (as such)
1266 test "X$arg" = "X-lc" && continue
1268 esac
1270 deplibs="$deplibs $arg"
1271 continue
1274 -module)
1275 module=yes
1276 continue
1279 -no-fast-install)
1280 fast_install=no
1281 continue
1284 -no-install)
1285 case $host in
1286 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1287 # The PATH hackery in wrapper scripts is required on Windows
1288 # in order for the loader to find any dlls it needs.
1289 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1290 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1291 fast_install=no
1293 *) no_install=yes ;;
1294 esac
1295 continue
1298 -no-undefined)
1299 allow_undefined=no
1300 continue
1303 -objectlist)
1304 prev=objectlist
1305 continue
1308 -o) prev=output ;;
1310 -release)
1311 prev=release
1312 continue
1315 -rpath)
1316 prev=rpath
1317 continue
1321 prev=xrpath
1322 continue
1325 -R*)
1326 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1327 # We need an absolute path.
1328 case $dir in
1329 [\\/]* | [A-Za-z]:[\\/]*) ;;
1331 $echo "$modename: only absolute run-paths are allowed" 1>&2
1332 exit 1
1334 esac
1335 case "$xrpath " in
1336 *" $dir "*) ;;
1337 *) xrpath="$xrpath $dir" ;;
1338 esac
1339 continue
1342 -static)
1343 # The effects of -static are defined in a previous loop.
1344 # We used to do the same as -all-static on platforms that
1345 # didn't have a PIC flag, but the assumption that the effects
1346 # would be equivalent was wrong. It would break on at least
1347 # Digital Unix and AIX.
1348 continue
1351 -thread-safe)
1352 thread_safe=yes
1353 continue
1356 -version-info)
1357 prev=vinfo
1358 continue
1361 -Wc,*)
1362 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1363 arg=
1364 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1365 for flag in $args; do
1366 IFS="$save_ifs"
1367 case $flag in
1368 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1369 flag="\"$flag\""
1371 esac
1372 arg="$arg $wl$flag"
1373 compiler_flags="$compiler_flags $flag"
1374 done
1375 IFS="$save_ifs"
1376 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1379 -Wl,*)
1380 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1381 arg=
1382 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1383 for flag in $args; do
1384 IFS="$save_ifs"
1385 case $flag in
1386 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1387 flag="\"$flag\""
1389 esac
1390 arg="$arg $wl$flag"
1391 compiler_flags="$compiler_flags $wl$flag"
1392 linker_flags="$linker_flags $flag"
1393 done
1394 IFS="$save_ifs"
1395 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1398 -Xcompiler)
1399 prev=xcompiler
1400 continue
1403 -Xlinker)
1404 prev=xlinker
1405 continue
1407 -framework)
1408 prev=framework
1409 continue
1412 # Some other compiler flag.
1413 -* | +*)
1414 # Unknown arguments in both finalize_command and compile_command need
1415 # to be aesthetically quoted because they are evaled later.
1416 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1417 case $arg in
1418 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1419 arg="\"$arg\""
1421 esac
1424 *.$objext)
1425 # A standard object.
1426 objs="$objs $arg"
1429 *.lo)
1430 # A libtool-controlled object.
1432 # Check to see that this really is a libtool object.
1433 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1434 pic_object=
1435 non_pic_object=
1437 # Read the .lo file
1438 # If there is no directory component, then add one.
1439 case $arg in
1440 */* | *\\*) . $arg ;;
1441 *) . ./$arg ;;
1442 esac
1444 if test -z "$pic_object" || \
1445 test -z "$non_pic_object" ||
1446 test "$pic_object" = none && \
1447 test "$non_pic_object" = none; then
1448 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1449 exit 1
1452 # Extract subdirectory from the argument.
1453 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1454 if test "X$xdir" = "X$arg"; then
1455 xdir=
1456 else
1457 xdir="$xdir/"
1460 if test "$pic_object" != none; then
1461 # Prepend the subdirectory the object is found in.
1462 pic_object="$xdir$pic_object"
1464 if test "$prev" = dlfiles; then
1465 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1466 dlfiles="$dlfiles $pic_object"
1467 prev=
1468 continue
1469 else
1470 # If libtool objects are unsupported, then we need to preload.
1471 prev=dlprefiles
1475 # CHECK ME: I think I busted this. -Ossama
1476 if test "$prev" = dlprefiles; then
1477 # Preload the old-style object.
1478 dlprefiles="$dlprefiles $pic_object"
1479 prev=
1482 # A PIC object.
1483 libobjs="$libobjs $pic_object"
1484 arg="$pic_object"
1487 # Non-PIC object.
1488 if test "$non_pic_object" != none; then
1489 # Prepend the subdirectory the object is found in.
1490 non_pic_object="$xdir$non_pic_object"
1492 # A standard non-PIC object
1493 non_pic_objects="$non_pic_objects $non_pic_object"
1494 if test -z "$pic_object" || test "$pic_object" = none ; then
1495 arg="$non_pic_object"
1497 else
1498 # If the PIC object exists, use it instead.
1499 # $xdir was prepended to $pic_object above.
1500 non_pic_object="$pic_object"
1501 non_pic_objects="$non_pic_objects $non_pic_object"
1503 else
1504 # Only an error if not doing a dry-run.
1505 if test -z "$run"; then
1506 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1507 exit 1
1508 else
1509 # Dry-run case.
1511 # Extract subdirectory from the argument.
1512 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1513 if test "X$xdir" = "X$arg"; then
1514 xdir=
1515 else
1516 xdir="$xdir/"
1519 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1520 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1521 libobjs="$libobjs $pic_object"
1522 non_pic_objects="$non_pic_objects $non_pic_object"
1527 *.$libext)
1528 # An archive.
1529 deplibs="$deplibs $arg"
1530 old_deplibs="$old_deplibs $arg"
1531 continue
1534 *.la)
1535 # A libtool-controlled library.
1537 if test "$prev" = dlfiles; then
1538 # This library was specified with -dlopen.
1539 dlfiles="$dlfiles $arg"
1540 prev=
1541 elif test "$prev" = dlprefiles; then
1542 # The library was specified with -dlpreopen.
1543 dlprefiles="$dlprefiles $arg"
1544 prev=
1545 else
1546 deplibs="$deplibs $arg"
1548 continue
1551 # Some other compiler argument.
1553 # Unknown arguments in both finalize_command and compile_command need
1554 # to be aesthetically quoted because they are evaled later.
1555 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1556 case $arg in
1557 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1558 arg="\"$arg\""
1560 esac
1562 esac # arg
1564 # Now actually substitute the argument into the commands.
1565 if test -n "$arg"; then
1566 compile_command="$compile_command $arg"
1567 finalize_command="$finalize_command $arg"
1569 done # argument parsing loop
1571 if test -n "$prev"; then
1572 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1573 $echo "$help" 1>&2
1574 exit 1
1577 # Infer tagged configuration to use if any are available and
1578 # if one wasn't chosen via the "--tag" command line option.
1579 # Only attempt this if the compiler in the base link
1580 # command doesn't match the default compiler.
1581 if test -n "$available_tags" && test -z "$tagname"; then
1582 case $base_compile in
1583 "$CC "*) ;;
1584 # Blanks in the command may have been stripped by the calling shell,
1585 # but not from the CC environment variable when ltconfig was run.
1586 "`$echo $CC` "*) ;;
1588 for z in $available_tags; do
1589 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1590 # Evaluate the configuration.
1591 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1592 case $base_compile in
1593 "$CC "*)
1594 # The compiler in $compile_command matches
1595 # the one in the tagged configuration.
1596 # Assume this is the tagged configuration we want.
1597 tagname=$z
1598 break
1600 "`$echo $CC` "*)
1601 tagname=$z
1602 break
1604 esac
1606 done
1607 # If $tagname still isn't set, then no tagged configuration
1608 # was found and let the user know that the "--tag" command
1609 # line option must be used.
1610 if test -z "$tagname"; then
1611 echo "$modename: unable to infer tagged configuration"
1612 echo "$modename: specify a tag with \`--tag'" 1>&2
1613 exit 1
1614 # else
1615 # echo "$modename: using $tagname tagged configuration"
1618 esac
1621 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1622 eval arg=\"$export_dynamic_flag_spec\"
1623 compile_command="$compile_command $arg"
1624 finalize_command="$finalize_command $arg"
1627 # calculate the name of the file, without its directory
1628 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1629 libobjs_save="$libobjs"
1631 if test -n "$shlibpath_var"; then
1632 # get the directories listed in $shlibpath_var
1633 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1634 else
1635 shlib_search_path=
1637 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1638 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1640 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1641 if test "X$output_objdir" = "X$output"; then
1642 output_objdir="$objdir"
1643 else
1644 output_objdir="$output_objdir/$objdir"
1646 # Create the object directory.
1647 if test ! -d $output_objdir; then
1648 $show "$mkdir $output_objdir"
1649 $run $mkdir $output_objdir
1650 status=$?
1651 if test $status -ne 0 && test ! -d $output_objdir; then
1652 exit $status
1656 # Determine the type of output
1657 case $output in
1659 $echo "$modename: you must specify an output file" 1>&2
1660 $echo "$help" 1>&2
1661 exit 1
1663 *.$libext) linkmode=oldlib ;;
1664 *.lo | *.$objext) linkmode=obj ;;
1665 *.la) linkmode=lib ;;
1666 *) linkmode=prog ;; # Anything else should be a program.
1667 esac
1669 specialdeplibs=
1670 libs=
1671 # Find all interdependent deplibs by searching for libraries
1672 # that are linked more than once (e.g. -la -lb -la)
1673 for deplib in $deplibs; do
1674 case "$libs " in
1675 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1676 esac
1677 libs="$libs $deplib"
1678 done
1680 if test $linkmode = lib; then
1681 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1683 # Compute libraries that are listed more than once in $predeps
1684 # $postdeps and mark them as special (i.e., whose duplicates are
1685 # not to be eliminated).
1686 pre_post_deps=
1687 for pre_post_dep in $predeps $postdeps; do
1688 case "$pre_post_deps " in
1689 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1690 esac
1691 pre_post_deps="$pre_post_deps $pre_post_dep"
1692 done
1693 pre_post_deps=
1696 deplibs=
1697 newdependency_libs=
1698 newlib_search_path=
1699 need_relink=no # whether we're linking any uninstalled libtool libraries
1700 notinst_deplibs= # not-installed libtool libraries
1701 notinst_path= # paths that contain not-installed libtool libraries
1702 case $linkmode in
1703 lib)
1704 passes="conv link"
1705 for file in $dlfiles $dlprefiles; do
1706 case $file in
1707 *.la) ;;
1709 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1710 exit 1
1712 esac
1713 done
1715 prog)
1716 compile_deplibs=
1717 finalize_deplibs=
1718 alldeplibs=no
1719 newdlfiles=
1720 newdlprefiles=
1721 passes="conv scan dlopen dlpreopen link"
1723 *) passes="conv"
1725 esac
1726 for pass in $passes; do
1727 if test $linkmode = prog; then
1728 # Determine which files to process
1729 case $pass in
1730 dlopen)
1731 libs="$dlfiles"
1732 save_deplibs="$deplibs" # Collect dlpreopened libraries
1733 deplibs=
1735 dlpreopen) libs="$dlprefiles" ;;
1736 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1737 esac
1739 for deplib in $libs; do
1740 lib=
1741 found=no
1742 case $deplib in
1743 -l*)
1744 if test $linkmode = oldlib && test $linkmode = obj; then
1745 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1746 continue
1748 if test $pass = conv; then
1749 deplibs="$deplib $deplibs"
1750 continue
1752 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1753 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1754 # Search the libtool library
1755 lib="$searchdir/lib${name}.la"
1756 if test -f "$lib"; then
1757 found=yes
1758 break
1760 done
1761 if test "$found" != yes; then
1762 # deplib doesn't seem to be a libtool library
1763 if test "$linkmode,$pass" = "prog,link"; then
1764 compile_deplibs="$deplib $compile_deplibs"
1765 finalize_deplibs="$deplib $finalize_deplibs"
1766 else
1767 deplibs="$deplib $deplibs"
1768 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1770 continue
1772 ;; # -l
1773 -L*)
1774 case $linkmode in
1775 lib)
1776 deplibs="$deplib $deplibs"
1777 test $pass = conv && continue
1778 newdependency_libs="$deplib $newdependency_libs"
1779 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1781 prog)
1782 if test $pass = conv; then
1783 deplibs="$deplib $deplibs"
1784 continue
1786 if test $pass = scan; then
1787 deplibs="$deplib $deplibs"
1788 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1789 else
1790 compile_deplibs="$deplib $compile_deplibs"
1791 finalize_deplibs="$deplib $finalize_deplibs"
1795 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1797 esac # linkmode
1798 continue
1799 ;; # -L
1800 -R*)
1801 if test $pass = link; then
1802 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1803 # Make sure the xrpath contains only unique directories.
1804 case "$xrpath " in
1805 *" $dir "*) ;;
1806 *) xrpath="$xrpath $dir" ;;
1807 esac
1809 deplibs="$deplib $deplibs"
1810 continue
1812 *.la) lib="$deplib" ;;
1813 *.$libext)
1814 if test $pass = conv; then
1815 deplibs="$deplib $deplibs"
1816 continue
1818 case $linkmode in
1819 lib)
1820 if test "$deplibs_check_method" != pass_all; then
1821 echo
1822 echo "*** Warning: This library needs some functionality provided by $deplib."
1823 echo "*** I have the capability to make that library automatically link in when"
1824 echo "*** you link to this library. But I can only do this if you have a"
1825 echo "*** shared version of the library, which you do not appear to have."
1826 else
1827 echo
1828 echo "*** Warning: Linking the shared library $output against the"
1829 echo "*** static library $deplib is not portable!"
1830 deplibs="$deplib $deplibs"
1832 continue
1834 prog)
1835 if test $pass != link; then
1836 deplibs="$deplib $deplibs"
1837 else
1838 compile_deplibs="$deplib $compile_deplibs"
1839 finalize_deplibs="$deplib $finalize_deplibs"
1841 continue
1843 esac # linkmode
1844 ;; # *.$libext
1845 *.lo | *.$objext)
1846 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1847 # If there is no dlopen support or we're linking statically,
1848 # we need to preload.
1849 newdlprefiles="$newdlprefiles $deplib"
1850 compile_deplibs="$deplib $compile_deplibs"
1851 finalize_deplibs="$deplib $finalize_deplibs"
1852 else
1853 newdlfiles="$newdlfiles $deplib"
1855 continue
1857 %DEPLIBS%)
1858 alldeplibs=yes
1859 continue
1861 esac # case $deplib
1862 if test $found = yes || test -f "$lib"; then :
1863 else
1864 $echo "$modename: cannot find the library \`$lib'" 1>&2
1865 exit 1
1868 # Check to see that this really is a libtool archive.
1869 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1870 else
1871 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1872 exit 1
1875 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1876 test "X$ladir" = "X$lib" && ladir="."
1878 dlname=
1879 dlopen=
1880 dlpreopen=
1881 libdir=
1882 library_names=
1883 old_library=
1884 # If the library was installed with an old release of libtool,
1885 # it will not redefine variable installed.
1886 installed=yes
1888 # Read the .la file
1889 case $lib in
1890 */* | *\\*) . $lib ;;
1891 *) . ./$lib ;;
1892 esac
1894 case $host in
1895 *-*-darwin*)
1896 # Convert "-framework foo" to "foo.framework" in dependency_libs
1897 test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
1899 esac
1901 if test "$linkmode,$pass" = "lib,link" ||
1902 test "$linkmode,$pass" = "prog,scan" ||
1903 { test $linkmode = oldlib && test $linkmode = obj; }; then
1904 # Add dl[pre]opened files of deplib
1905 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1906 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1909 if test $pass = conv; then
1910 # Only check for convenience libraries
1911 deplibs="$lib $deplibs"
1912 if test -z "$libdir"; then
1913 if test -z "$old_library"; then
1914 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1915 exit 1
1917 # It is a libtool convenience library, so add in its objects.
1918 convenience="$convenience $ladir/$objdir/$old_library"
1919 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1920 tmp_libs=
1921 for deplib in $dependency_libs; do
1922 deplibs="$deplib $deplibs"
1923 case "$tmp_libs " in
1924 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1925 esac
1926 tmp_libs="$tmp_libs $deplib"
1927 done
1928 elif test $linkmode != prog && test $linkmode != lib; then
1929 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1930 exit 1
1932 continue
1933 fi # $pass = conv
1935 # Get the name of the library we link against.
1936 linklib=
1937 for l in $old_library $library_names; do
1938 linklib="$l"
1939 done
1940 if test -z "$linklib"; then
1941 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1942 exit 1
1945 # This library was specified with -dlopen.
1946 if test $pass = dlopen; then
1947 if test -z "$libdir"; then
1948 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1949 exit 1
1951 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1952 # If there is no dlname, no dlopen support or we're linking
1953 # statically, we need to preload.
1954 dlprefiles="$dlprefiles $lib"
1955 else
1956 newdlfiles="$newdlfiles $lib"
1958 continue
1959 fi # $pass = dlopen
1961 # We need an absolute path.
1962 case $ladir in
1963 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1965 abs_ladir=`cd "$ladir" && pwd`
1966 if test -z "$abs_ladir"; then
1967 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1968 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1969 abs_ladir="$ladir"
1972 esac
1973 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1975 # Find the relevant object directory and library name.
1976 if test "X$installed" = Xyes; then
1977 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1978 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1979 dir="$ladir"
1980 absdir="$abs_ladir"
1981 libdir="$abs_ladir"
1982 else
1983 dir="$libdir"
1984 absdir="$libdir"
1986 else
1987 dir="$ladir/$objdir"
1988 absdir="$abs_ladir/$objdir"
1989 # Remove this search path later
1990 notinst_path="$notinst_path $abs_ladir"
1991 fi # $installed = yes
1992 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1994 # This library was specified with -dlpreopen.
1995 if test $pass = dlpreopen; then
1996 if test -z "$libdir"; then
1997 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1998 exit 1
2000 # Prefer using a static library (so that no silly _DYNAMIC symbols
2001 # are required to link).
2002 if test -n "$old_library"; then
2003 newdlprefiles="$newdlprefiles $dir/$old_library"
2004 # Otherwise, use the dlname, so that lt_dlopen finds it.
2005 elif test -n "$dlname"; then
2006 newdlprefiles="$newdlprefiles $dir/$dlname"
2007 else
2008 newdlprefiles="$newdlprefiles $dir/$linklib"
2010 fi # $pass = dlpreopen
2012 if test -z "$libdir"; then
2013 # Link the convenience library
2014 if test $linkmode = lib; then
2015 deplibs="$dir/$old_library $deplibs"
2016 elif test "$linkmode,$pass" = "prog,link"; then
2017 compile_deplibs="$dir/$old_library $compile_deplibs"
2018 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2019 else
2020 deplibs="$lib $deplibs"
2022 continue
2025 if test $linkmode = prog && test $pass != link; then
2026 newlib_search_path="$newlib_search_path $ladir"
2027 deplibs="$lib $deplibs"
2029 linkalldeplibs=no
2030 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2031 test "$build_libtool_libs" = no; then
2032 linkalldeplibs=yes
2035 tmp_libs=
2036 for deplib in $dependency_libs; do
2037 case $deplib in
2038 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2039 esac
2040 # Need to link against all dependency_libs?
2041 if test $linkalldeplibs = yes; then
2042 deplibs="$deplib $deplibs"
2043 else
2044 # Need to hardcode shared library paths
2045 # or/and link against static libraries
2046 newdependency_libs="$deplib $newdependency_libs"
2048 case "$tmp_libs " in
2049 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2050 esac
2051 tmp_libs="$tmp_libs $deplib"
2052 done # for deplib
2053 continue
2054 fi # $linkmode = prog...
2056 link_static=no # Whether the deplib will be linked statically
2057 if test -n "$library_names" &&
2058 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2059 # Link against this shared library
2061 if test "$linkmode,$pass" = "prog,link" ||
2062 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
2063 # Hardcode the library path.
2064 # Skip directories that are in the system default run-time
2065 # search path.
2066 case " $sys_lib_dlsearch_path " in
2067 *" $absdir "*) ;;
2069 case "$compile_rpath " in
2070 *" $absdir "*) ;;
2071 *) compile_rpath="$compile_rpath $absdir"
2072 esac
2074 esac
2075 case " $sys_lib_dlsearch_path " in
2076 *" $libdir "*) ;;
2078 case "$finalize_rpath " in
2079 *" $libdir "*) ;;
2080 *) finalize_rpath="$finalize_rpath $libdir"
2081 esac
2083 esac
2084 if test $linkmode = prog; then
2085 # We need to hardcode the library path
2086 if test -n "$shlibpath_var"; then
2087 # Make sure the rpath contains only unique directories.
2088 case "$temp_rpath " in
2089 *" $dir "*) ;;
2090 *" $absdir "*) ;;
2091 *) temp_rpath="$temp_rpath $dir" ;;
2092 esac
2095 fi # $linkmode,$pass = prog,link...
2097 if test "$alldeplibs" = yes &&
2098 { test "$deplibs_check_method" = pass_all ||
2099 { test "$build_libtool_libs" = yes &&
2100 test -n "$library_names"; }; }; then
2101 # We only need to search for static libraries
2102 continue
2105 if test "$installed" = no; then
2106 notinst_deplibs="$notinst_deplibs $lib"
2107 need_relink=yes
2110 if test -n "$old_archive_from_expsyms_cmds"; then
2111 # figure out the soname
2112 set dummy $library_names
2113 realname="$2"
2114 shift; shift
2115 libname=`eval \\$echo \"$libname_spec\"`
2116 # use dlname if we got it. it's perfectly good, no?
2117 if test -n "$dlname"; then
2118 soname="$dlname"
2119 elif test -n "$soname_spec"; then
2120 # bleh windows
2121 case $host in
2122 *cygwin*)
2123 major=`expr $current - $age`
2124 versuffix="-$major"
2126 esac
2127 eval soname=\"$soname_spec\"
2128 else
2129 soname="$realname"
2132 # Make a new name for the extract_expsyms_cmds to use
2133 soroot="$soname"
2134 soname=`echo $soroot | sed -e 's/^.*\///'`
2135 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2137 # If the library has no export list, then create one now
2138 if test -f "$output_objdir/$soname-def"; then :
2139 else
2140 $show "extracting exported symbol list from \`$soname'"
2141 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2142 cmds=$extract_expsyms_cmds
2143 for cmd in $cmds; do
2144 IFS="$save_ifs"
2145 eval cmd=\"$cmd\"
2146 $show "$cmd"
2147 $run eval "$cmd" || exit $?
2148 done
2149 IFS="$save_ifs"
2152 # Create $newlib
2153 if test -f "$output_objdir/$newlib"; then :; else
2154 $show "generating import library for \`$soname'"
2155 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2156 cmds=$old_archive_from_expsyms_cmds
2157 for cmd in $cmds; do
2158 IFS="$save_ifs"
2159 eval cmd=\"$cmd\"
2160 $show "$cmd"
2161 $run eval "$cmd" || exit $?
2162 done
2163 IFS="$save_ifs"
2165 # make sure the library variables are pointing to the new library
2166 dir=$output_objdir
2167 linklib=$newlib
2168 fi # test -n $old_archive_from_expsyms_cmds
2170 if test $linkmode = prog || test "$mode" != relink; then
2171 add_shlibpath=
2172 add_dir=
2173 add=
2174 lib_linked=yes
2175 case $hardcode_action in
2176 immediate | unsupported)
2177 if test "$hardcode_direct" = no; then
2178 add="$dir/$linklib"
2179 elif test "$hardcode_minus_L" = no; then
2180 case $host in
2181 *-*-sunos*) add_shlibpath="$dir" ;;
2182 esac
2183 add_dir="-L$dir"
2184 add="-l$name"
2185 elif test "$hardcode_shlibpath_var" = no; then
2186 add_shlibpath="$dir"
2187 add="-l$name"
2188 else
2189 lib_linked=no
2192 relink)
2193 if test "$hardcode_direct" = yes; then
2194 add="$dir/$linklib"
2195 elif test "$hardcode_minus_L" = yes; then
2196 add_dir="-L$dir"
2197 add="-l$name"
2198 elif test "$hardcode_shlibpath_var" = yes; then
2199 add_shlibpath="$dir"
2200 add="-l$name"
2201 else
2202 lib_linked=no
2205 *) lib_linked=no ;;
2206 esac
2208 if test "$lib_linked" != yes; then
2209 $echo "$modename: configuration error: unsupported hardcode properties"
2210 exit 1
2213 if test -n "$add_shlibpath"; then
2214 case :$compile_shlibpath: in
2215 *":$add_shlibpath:"*) ;;
2216 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2217 esac
2219 if test $linkmode = prog; then
2220 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2221 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2222 else
2223 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2224 test -n "$add" && deplibs="$add $deplibs"
2225 if test "$hardcode_direct" != yes && \
2226 test "$hardcode_minus_L" != yes && \
2227 test "$hardcode_shlibpath_var" = yes; then
2228 case :$finalize_shlibpath: in
2229 *":$libdir:"*) ;;
2230 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2231 esac
2236 if test $linkmode = prog || test "$mode" = relink; then
2237 add_shlibpath=
2238 add_dir=
2239 add=
2240 # Finalize command for both is simple: just hardcode it.
2241 if test "$hardcode_direct" = yes; then
2242 add="$libdir/$linklib"
2243 elif test "$hardcode_minus_L" = yes; then
2244 add_dir="-L$libdir"
2245 add="-l$name"
2246 elif test "$hardcode_shlibpath_var" = yes; then
2247 case :$finalize_shlibpath: in
2248 *":$libdir:"*) ;;
2249 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2250 esac
2251 add="-l$name"
2252 else
2253 # We cannot seem to hardcode it, guess we'll fake it.
2254 add_dir="-L$libdir"
2255 add="-l$name"
2258 if test $linkmode = prog; then
2259 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2260 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2261 else
2262 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2263 test -n "$add" && deplibs="$add $deplibs"
2266 elif test $linkmode = prog; then
2267 if test "$alldeplibs" = yes &&
2268 { test "$deplibs_check_method" = pass_all ||
2269 { test "$build_libtool_libs" = yes &&
2270 test -n "$library_names"; }; }; then
2271 # We only need to search for static libraries
2272 continue
2275 # Try to link the static library
2276 # Here we assume that one of hardcode_direct or hardcode_minus_L
2277 # is not unsupported. This is valid on all known static and
2278 # shared platforms.
2279 if test "$hardcode_direct" != unsupported; then
2280 test -n "$old_library" && linklib="$old_library"
2281 compile_deplibs="$dir/$linklib $compile_deplibs"
2282 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2283 else
2284 compile_deplibs="-l$name -L$dir $compile_deplibs"
2285 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2287 elif test "$build_libtool_libs" = yes; then
2288 # Not a shared library
2289 if test "$deplibs_check_method" != pass_all; then
2290 # We're trying link a shared library against a static one
2291 # but the system doesn't support it.
2293 # Just print a warning and add the library to dependency_libs so
2294 # that the program can be linked against the static library.
2295 echo
2296 echo "*** Warning: This library needs some functionality provided by $lib."
2297 echo "*** I have the capability to make that library automatically link in when"
2298 echo "*** you link to this library. But I can only do this if you have a"
2299 echo "*** shared version of the library, which you do not appear to have."
2300 if test "$module" = yes; then
2301 echo "*** Therefore, libtool will create a static module, that should work "
2302 echo "*** as long as the dlopening application is linked with the -dlopen flag."
2303 if test -z "$global_symbol_pipe"; then
2304 echo
2305 echo "*** However, this would only work if libtool was able to extract symbol"
2306 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2307 echo "*** not find such a program. So, this module is probably useless."
2308 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2310 if test "$build_old_libs" = no; then
2311 build_libtool_libs=module
2312 build_old_libs=yes
2313 else
2314 build_libtool_libs=no
2317 else
2318 convenience="$convenience $dir/$old_library"
2319 old_convenience="$old_convenience $dir/$old_library"
2320 deplibs="$dir/$old_library $deplibs"
2321 link_static=yes
2323 fi # link shared/static library?
2325 if test $linkmode = lib; then
2326 if test -n "$dependency_libs" &&
2327 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2328 test $link_static = yes; }; then
2329 # Extract -R from dependency_libs
2330 temp_deplibs=
2331 for libdir in $dependency_libs; do
2332 case $libdir in
2333 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2334 case " $xrpath " in
2335 *" $temp_xrpath "*) ;;
2336 *) xrpath="$xrpath $temp_xrpath";;
2337 esac;;
2338 *) temp_deplibs="$temp_deplibs $libdir";;
2339 esac
2340 done
2341 dependency_libs="$temp_deplibs"
2344 newlib_search_path="$newlib_search_path $absdir"
2345 # Link against this library
2346 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2347 # ... and its dependency_libs
2348 tmp_libs=
2349 for deplib in $dependency_libs; do
2350 newdependency_libs="$deplib $newdependency_libs"
2351 case "$tmp_libs " in
2352 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2353 esac
2354 tmp_libs="$tmp_libs $deplib"
2355 done
2357 if test $link_all_deplibs != no; then
2358 # Add the search paths of all dependency libraries
2359 for deplib in $dependency_libs; do
2360 case $deplib in
2361 -L*) path="$deplib" ;;
2362 *.la)
2363 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2364 test "X$dir" = "X$deplib" && dir="."
2365 # We need an absolute path.
2366 case $dir in
2367 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2369 absdir=`cd "$dir" && pwd`
2370 if test -z "$absdir"; then
2371 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2372 absdir="$dir"
2375 esac
2376 if grep "^installed=no" $deplib > /dev/null; then
2377 path="-L$absdir/$objdir"
2378 else
2379 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2380 if test -z "$libdir"; then
2381 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2382 exit 1
2384 if test "$absdir" != "$libdir"; then
2385 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2387 path="-L$absdir"
2390 *) continue ;;
2391 esac
2392 case " $deplibs " in
2393 *" $path "*) ;;
2394 *) deplibs="$path $deplibs" ;;
2395 esac
2396 done
2397 fi # link_all_deplibs != no
2398 fi # linkmode = lib
2399 done # for deplib in $libs
2400 if test $pass = dlpreopen; then
2401 # Link the dlpreopened libraries before other libraries
2402 for deplib in $save_deplibs; do
2403 deplibs="$deplib $deplibs"
2404 done
2406 if test $pass != dlopen; then
2407 test $pass != scan && dependency_libs="$newdependency_libs"
2408 if test $pass != conv; then
2409 # Make sure lib_search_path contains only unique directories.
2410 lib_search_path=
2411 for dir in $newlib_search_path; do
2412 case "$lib_search_path " in
2413 *" $dir "*) ;;
2414 *) lib_search_path="$lib_search_path $dir" ;;
2415 esac
2416 done
2417 newlib_search_path=
2420 if test "$linkmode,$pass" != "prog,link"; then
2421 vars="deplibs"
2422 else
2423 vars="compile_deplibs finalize_deplibs"
2425 for var in $vars dependency_libs; do
2426 # Add libraries to $var in reverse order
2427 eval tmp_libs=\"\$$var\"
2428 new_libs=
2429 for deplib in $tmp_libs; do
2430 case $deplib in
2431 -L*) new_libs="$deplib $new_libs" ;;
2433 case " $specialdeplibs " in
2434 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2436 case " $new_libs " in
2437 *" $deplib "*) ;;
2438 *) new_libs="$deplib $new_libs" ;;
2439 esac
2441 esac
2443 esac
2444 done
2445 tmp_libs=
2446 for deplib in $new_libs; do
2447 case $deplib in
2448 -L*)
2449 case " $tmp_libs " in
2450 *" $deplib "*) ;;
2451 *) tmp_libs="$tmp_libs $deplib" ;;
2452 esac
2454 *) tmp_libs="$tmp_libs $deplib" ;;
2455 esac
2456 done
2457 eval $var=\"$tmp_libs\"
2458 done # for var
2460 if test "$pass" = "conv" &&
2461 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2462 libs="$deplibs" # reset libs
2463 deplibs=
2465 done # for pass
2466 if test $linkmode = prog; then
2467 dlfiles="$newdlfiles"
2468 dlprefiles="$newdlprefiles"
2471 case $linkmode in
2472 oldlib)
2473 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2474 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2477 if test -n "$rpath"; then
2478 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2481 if test -n "$xrpath"; then
2482 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2485 if test -n "$vinfo"; then
2486 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2489 if test -n "$release"; then
2490 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2493 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2494 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2497 # Now set the variables for building old libraries.
2498 build_libtool_libs=no
2499 oldlibs="$output"
2500 objs="$objs$old_deplibs"
2503 lib)
2504 # Make sure we only generate libraries of the form `libNAME.la'.
2505 case $outputname in
2506 lib*)
2507 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2508 eval shared_ext=\"$shrext\"
2509 eval libname=\"$libname_spec\"
2512 if test "$module" = no; then
2513 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2514 $echo "$help" 1>&2
2515 exit 1
2517 if test "$need_lib_prefix" != no; then
2518 # Add the "lib" prefix for modules if required
2519 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2520 eval shared_ext=\"$shrext\"
2521 eval libname=\"$libname_spec\"
2522 else
2523 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2526 esac
2528 if test -n "$objs"; then
2529 if test "$deplibs_check_method" != pass_all; then
2530 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2531 exit 1
2532 else
2533 echo
2534 echo "*** Warning: Linking the shared library $output against the non-libtool"
2535 echo "*** objects $objs is not portable!"
2536 libobjs="$libobjs $objs"
2540 if test "$dlself" != no; then
2541 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2544 set dummy $rpath
2545 if test $# -gt 2; then
2546 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2548 install_libdir="$2"
2550 oldlibs=
2551 if test -z "$rpath"; then
2552 if test "$build_libtool_libs" = yes; then
2553 # Building a libtool convenience library.
2554 # Some compilers have problems with a `.al' extension so
2555 # convenience libraries should have the same extension an
2556 # archive normally would.
2557 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2558 build_libtool_libs=convenience
2559 build_old_libs=yes
2562 if test -n "$vinfo"; then
2563 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2566 if test -n "$release"; then
2567 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2569 else
2571 # Parse the version information argument.
2572 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2573 set dummy $vinfo 0 0 0
2574 IFS="$save_ifs"
2576 if test -n "$8"; then
2577 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2578 $echo "$help" 1>&2
2579 exit 1
2582 current="$2"
2583 revision="$3"
2584 age="$4"
2586 # Check that each of the things are valid numbers.
2587 case $current in
2588 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2590 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2591 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2592 exit 1
2594 esac
2596 case $revision in
2597 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2599 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2600 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2601 exit 1
2603 esac
2605 case $age in
2606 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2608 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2609 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2610 exit 1
2612 esac
2614 if test $age -gt $current; then
2615 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2616 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2617 exit 1
2620 # Calculate the version variables.
2621 major=
2622 versuffix=
2623 verstring=
2624 case $version_type in
2625 none) ;;
2627 darwin)
2628 # Like Linux, but with the current version available in
2629 # verstring for coding it into the library header
2630 major=.`expr $current - $age`
2631 versuffix="$major.$age.$revision"
2632 # Darwin ld doesn't like 0 for these options...
2633 minor_current=`expr $current + 1`
2634 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2637 freebsd-aout)
2638 major=".$current"
2639 versuffix=".$current.$revision";
2642 freebsd-elf)
2643 major=".$current"
2644 versuffix=".$current";
2647 irix)
2648 major=`expr $current - $age + 1`
2649 verstring="sgi$major.$revision"
2651 # Add in all the interfaces that we are compatible with.
2652 loop=$revision
2653 while test $loop != 0; do
2654 iface=`expr $revision - $loop`
2655 loop=`expr $loop - 1`
2656 verstring="sgi$major.$iface:$verstring"
2657 done
2659 # Before this point, $major must not contain `.'.
2660 major=.$major
2661 versuffix="$major.$revision"
2664 linux)
2665 major=.`expr $current - $age`
2666 versuffix="$major.$age.$revision"
2669 osf)
2670 major=.`expr $current - $age`
2671 versuffix=".$current.$age.$revision"
2672 verstring="$current.$age.$revision"
2674 # Add in all the interfaces that we are compatible with.
2675 loop=$age
2676 while test $loop != 0; do
2677 iface=`expr $current - $loop`
2678 loop=`expr $loop - 1`
2679 verstring="$verstring:${iface}.0"
2680 done
2682 # Make executables depend on our current version.
2683 verstring="$verstring:${current}.0"
2686 sunos)
2687 major=".$current"
2688 versuffix=".$current.$revision"
2691 windows)
2692 # Use '-' rather than '.', since we only want one
2693 # extension on DOS 8.3 filesystems.
2694 major=`expr $current - $age`
2695 versuffix="-$major"
2699 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2700 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2701 exit 1
2703 esac
2705 # Clear the version info if we defaulted, and they specified a release.
2706 if test -z "$vinfo" && test -n "$release"; then
2707 major=
2708 case $version_type in
2709 darwin)
2710 # we can't check for "0.0" in archive_cmds due to quoting
2711 # problems, so we reset it completely
2712 verstring=
2715 verstring="0.0"
2717 esac
2718 if test "$need_version" = no; then
2719 versuffix=
2720 else
2721 versuffix=".0.0"
2725 # Remove version info from name if versioning should be avoided
2726 if test "$avoid_version" = yes && test "$need_version" = no; then
2727 major=
2728 versuffix=
2729 verstring=""
2732 # Check to see if the archive will have undefined symbols.
2733 if test "$allow_undefined" = yes; then
2734 if test "$allow_undefined_flag" = unsupported; then
2735 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2736 build_libtool_libs=no
2737 build_old_libs=yes
2739 else
2740 # Don't allow undefined symbols.
2741 allow_undefined_flag="$no_undefined_flag"
2745 if test "$mode" != relink; then
2746 # Remove our outputs, but don't remove object files since they
2747 # may have been created when compiling PIC objects.
2748 removelist=
2749 tempremovelist=`echo "$output_objdir/*"`
2750 for p in $tempremovelist; do
2751 case $p in
2752 *.$objext)
2754 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2755 removelist="$removelist $p"
2757 *) ;;
2758 esac
2759 done
2760 if test -n "$removelist"; then
2761 $show "${rm}r $removelist"
2762 $run ${rm}r $removelist
2766 # Now set the variables for building old libraries.
2767 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2768 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2770 # Transform .lo files to .o files.
2771 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2774 # Eliminate all temporary directories.
2775 for path in $notinst_path; do
2776 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2777 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2778 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2779 done
2781 if test -n "$xrpath"; then
2782 # If the user specified any rpath flags, then add them.
2783 temp_xrpath=
2784 for libdir in $xrpath; do
2785 temp_xrpath="$temp_xrpath -R$libdir"
2786 case "$finalize_rpath " in
2787 *" $libdir "*) ;;
2788 *) finalize_rpath="$finalize_rpath $libdir" ;;
2789 esac
2790 done
2791 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2792 dependency_libs="$temp_xrpath $dependency_libs"
2796 # Make sure dlfiles contains only unique files that won't be dlpreopened
2797 old_dlfiles="$dlfiles"
2798 dlfiles=
2799 for lib in $old_dlfiles; do
2800 case " $dlprefiles $dlfiles " in
2801 *" $lib "*) ;;
2802 *) dlfiles="$dlfiles $lib" ;;
2803 esac
2804 done
2806 # Make sure dlprefiles contains only unique files
2807 old_dlprefiles="$dlprefiles"
2808 dlprefiles=
2809 for lib in $old_dlprefiles; do
2810 case "$dlprefiles " in
2811 *" $lib "*) ;;
2812 *) dlprefiles="$dlprefiles $lib" ;;
2813 esac
2814 done
2816 if test "$build_libtool_libs" = yes; then
2817 if test -n "$rpath"; then
2818 case $host in
2819 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2820 # these systems don't actually have a c library (as such)!
2822 *-*-rhapsody* | *-*-darwin1.[012])
2823 # Rhapsody C library is in the System framework
2824 deplibs="$deplibs -framework System"
2826 *-*-netbsd*)
2827 # Don't link with libc until the a.out ld.so is fixed.
2830 # Add libc to deplibs on all other systems if necessary.
2831 if test $build_libtool_need_lc = "yes"; then
2832 deplibs="$deplibs -lc"
2835 esac
2838 # Transform deplibs into only deplibs that can be linked in shared.
2839 name_save=$name
2840 libname_save=$libname
2841 release_save=$release
2842 versuffix_save=$versuffix
2843 major_save=$major
2844 # I'm not sure if I'm treating the release correctly. I think
2845 # release should show up in the -l (ie -lgmp5) so we don't want to
2846 # add it in twice. Is that correct?
2847 release=""
2848 versuffix=""
2849 major=""
2850 newdeplibs=
2851 droppeddeps=no
2852 case $deplibs_check_method in
2853 pass_all)
2854 # Don't check for shared/static. Everything works.
2855 # This might be a little naive. We might want to check
2856 # whether the library exists or not. But this is on
2857 # osf3 & osf4 and I'm not really sure... Just
2858 # implementing what was already the behaviour.
2859 newdeplibs=$deplibs
2861 test_compile)
2862 # This code stresses the "libraries are programs" paradigm to its
2863 # limits. Maybe even breaks it. We compile a program, linking it
2864 # against the deplibs as a proxy for the library. Then we can check
2865 # whether they linked in statically or dynamically with ldd.
2866 $rm conftest.c
2867 cat > conftest.c <<EOF
2868 int main() { return 0; }
2870 $rm conftest
2871 $LTCC -o conftest conftest.c $deplibs
2872 if test $? -eq 0 ; then
2873 ldd_output=`ldd conftest`
2874 for i in $deplibs; do
2875 name="`expr $i : '-l\(.*\)'`"
2876 # If $name is empty we are operating on a -L argument.
2877 if test -n "$name" && test "$name" != "0"; then
2878 libname=`eval \\$echo \"$libname_spec\"`
2879 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2880 set dummy $deplib_matches
2881 deplib_match=$2
2882 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2883 newdeplibs="$newdeplibs $i"
2884 else
2885 droppeddeps=yes
2886 echo
2887 echo "*** Warning: This library needs some functionality provided by $i."
2888 echo "*** I have the capability to make that library automatically link in when"
2889 echo "*** you link to this library. But I can only do this if you have a"
2890 echo "*** shared version of the library, which you do not appear to have."
2892 else
2893 newdeplibs="$newdeplibs $i"
2895 done
2896 else
2897 # Error occured in the first compile. Let's try to salvage the situation:
2898 # Compile a seperate program for each library.
2899 for i in $deplibs; do
2900 name="`expr $i : '-l\(.*\)'`"
2901 # If $name is empty we are operating on a -L argument.
2902 if test -n "$name" && test "$name" != "0"; then
2903 $rm conftest
2904 $LTCC -o conftest conftest.c $i
2905 # Did it work?
2906 if test $? -eq 0 ; then
2907 ldd_output=`ldd conftest`
2908 libname=`eval \\$echo \"$libname_spec\"`
2909 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2910 set dummy $deplib_matches
2911 deplib_match=$2
2912 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2913 newdeplibs="$newdeplibs $i"
2914 else
2915 droppeddeps=yes
2916 echo
2917 echo "*** Warning: This library needs some functionality provided by $i."
2918 echo "*** I have the capability to make that library automatically link in when"
2919 echo "*** you link to this library. But I can only do this if you have a"
2920 echo "*** shared version of the library, which you do not appear to have."
2922 else
2923 droppeddeps=yes
2924 echo
2925 echo "*** Warning! Library $i is needed by this library but I was not able to"
2926 echo "*** make it link in! You will probably need to install it or some"
2927 echo "*** library that it depends on before this library will be fully"
2928 echo "*** functional. Installing it before continuing would be even better."
2930 else
2931 newdeplibs="$newdeplibs $i"
2933 done
2936 file_magic*)
2937 set dummy $deplibs_check_method
2938 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2939 for a_deplib in $deplibs; do
2940 name="`expr $a_deplib : '-l\(.*\)'`"
2941 # If $name is empty we are operating on a -L argument.
2942 if test -n "$name" && test "$name" != "0"; then
2943 libname=`eval \\$echo \"$libname_spec\"`
2944 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2945 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2946 for potent_lib in $potential_libs; do
2947 # Follow soft links.
2948 if ls -lLd "$potent_lib" 2>/dev/null \
2949 | grep " -> " >/dev/null; then
2950 continue
2952 # The statement above tries to avoid entering an
2953 # endless loop below, in case of cyclic links.
2954 # We might still enter an endless loop, since a link
2955 # loop can be closed while we follow links,
2956 # but so what?
2957 potlib="$potent_lib"
2958 while test -h "$potlib" 2>/dev/null; do
2959 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2960 case $potliblink in
2961 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2962 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2963 esac
2964 done
2965 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2966 | sed 10q \
2967 | egrep "$file_magic_regex" > /dev/null; then
2968 newdeplibs="$newdeplibs $a_deplib"
2969 a_deplib=""
2970 break 2
2972 done
2973 done
2974 if test -n "$a_deplib" ; then
2975 droppeddeps=yes
2976 echo
2977 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2978 echo "*** I have the capability to make that library automatically link in when"
2979 echo "*** you link to this library. But I can only do this if you have a"
2980 echo "*** shared version of the library, which you do not appear to have."
2982 else
2983 # Add a -L argument.
2984 newdeplibs="$newdeplibs $a_deplib"
2986 done # Gone through all deplibs.
2988 match_pattern*)
2989 set dummy $deplibs_check_method
2990 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2991 for a_deplib in $deplibs; do
2992 name="`expr $a_deplib : '-l\(.*\)'`"
2993 # If $name is empty we are operating on a -L argument.
2994 if test -n "$name" && test "$name" != "0"; then
2995 libname=`eval \\$echo \"$libname_spec\"`
2996 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2997 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2998 for potent_lib in $potential_libs; do
2999 if eval echo \"$potent_lib\" 2>/dev/null \
3000 | sed 10q \
3001 | egrep "$match_pattern_regex" > /dev/null; then
3002 newdeplibs="$newdeplibs $a_deplib"
3003 a_deplib=""
3004 break 2
3006 done
3007 done
3008 if test -n "$a_deplib" ; then
3009 droppeddeps=yes
3010 echo
3011 echo "*** Warning: This library needs some functionality provided by $a_deplib."
3012 echo "*** I have the capability to make that library automatically link in when"
3013 echo "*** you link to this library. But I can only do this if you have a"
3014 echo "*** shared version of the library, which you do not appear to have."
3016 else
3017 # Add a -L argument.
3018 newdeplibs="$newdeplibs $a_deplib"
3020 done # Gone through all deplibs.
3022 none | unknown | *)
3023 newdeplibs=""
3024 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3025 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
3026 grep . >/dev/null; then
3027 echo
3028 if test "X$deplibs_check_method" = "Xnone"; then
3029 echo "*** Warning: inter-library dependencies are not supported in this platform."
3030 else
3031 echo "*** Warning: inter-library dependencies are not known to be supported."
3033 echo "*** All declared inter-library dependencies are being dropped."
3034 droppeddeps=yes
3037 esac
3038 versuffix=$versuffix_save
3039 major=$major_save
3040 release=$release_save
3041 libname=$libname_save
3042 name=$name_save
3044 case $host in
3045 *-*-rhapsody* | *-*-darwin1.[012])
3046 # On Rhapsody replace the C library is the System framework
3047 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3049 esac
3051 if test "$droppeddeps" = yes; then
3052 if test "$module" = yes; then
3053 echo
3054 echo "*** Warning: libtool could not satisfy all declared inter-library"
3055 echo "*** dependencies of module $libname. Therefore, libtool will create"
3056 echo "*** a static module, that should work as long as the dlopening"
3057 echo "*** application is linked with the -dlopen flag."
3058 if test -z "$global_symbol_pipe"; then
3059 echo
3060 echo "*** However, this would only work if libtool was able to extract symbol"
3061 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3062 echo "*** not find such a program. So, this module is probably useless."
3063 echo "*** \`nm' from GNU binutils and a full rebuild may help."
3065 if test "$build_old_libs" = no; then
3066 oldlibs="$output_objdir/$libname.$libext"
3067 build_libtool_libs=module
3068 build_old_libs=yes
3069 else
3070 build_libtool_libs=no
3072 else
3073 echo "*** The inter-library dependencies that have been dropped here will be"
3074 echo "*** automatically added whenever a program is linked with this library"
3075 echo "*** or is declared to -dlopen it."
3077 if test $allow_undefined = no; then
3078 echo
3079 echo "*** Since this library must not contain undefined symbols,"
3080 echo "*** because either the platform does not support them or"
3081 echo "*** it was explicitly requested with -no-undefined,"
3082 echo "*** libtool will only create a static version of it."
3083 if test "$build_old_libs" = no; then
3084 oldlibs="$output_objdir/$libname.$libext"
3085 build_libtool_libs=module
3086 build_old_libs=yes
3087 else
3088 build_libtool_libs=no
3093 # Time to change all our "foo.framework" stuff back to "-framework foo"
3094 case $host in
3095 *-*-darwin*)
3096 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3097 dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3099 esac
3100 # Done checking deplibs!
3101 # Done checking deplibs!
3102 deplibs=$newdeplibs
3105 # All the library-specific variables (install_libdir is set above).
3106 library_names=
3107 old_library=
3108 dlname=
3110 # Test again, we may have decided not to build it any more
3111 if test "$build_libtool_libs" = yes; then
3112 if test $hardcode_into_libs = yes; then
3113 # Hardcode the library paths
3114 hardcode_libdirs=
3115 dep_rpath=
3116 rpath="$finalize_rpath"
3117 test "$mode" != relink && rpath="$compile_rpath$rpath"
3118 for libdir in $rpath; do
3119 if test -n "$hardcode_libdir_flag_spec"; then
3120 if test -n "$hardcode_libdir_separator"; then
3121 if test -z "$hardcode_libdirs"; then
3122 hardcode_libdirs="$libdir"
3123 else
3124 # Just accumulate the unique libdirs.
3125 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3126 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3129 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3131 esac
3133 else
3134 eval flag=\"$hardcode_libdir_flag_spec\"
3135 dep_rpath="$dep_rpath $flag"
3137 elif test -n "$runpath_var"; then
3138 case "$perm_rpath " in
3139 *" $libdir "*) ;;
3140 *) perm_rpath="$perm_rpath $libdir" ;;
3141 esac
3143 done
3144 # Substitute the hardcoded libdirs into the rpath.
3145 if test -n "$hardcode_libdir_separator" &&
3146 test -n "$hardcode_libdirs"; then
3147 libdir="$hardcode_libdirs"
3148 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3150 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3151 # We should set the runpath_var.
3152 rpath=
3153 for dir in $perm_rpath; do
3154 rpath="$rpath$dir:"
3155 done
3156 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3158 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3161 shlibpath="$finalize_shlibpath"
3162 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3163 if test -n "$shlibpath"; then
3164 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3167 # Get the real and link names of the library.
3168 eval library_names=\"$library_names_spec\"
3169 eval shared_ext=\"$shrext\"
3170 set dummy $library_names
3171 realname="$2"
3172 shift; shift
3174 if test -n "$soname_spec"; then
3175 eval soname=\"$soname_spec\"
3176 else
3177 soname="$realname"
3179 test -z "$dlname" && dlname=$soname
3181 lib="$output_objdir/$realname"
3182 for link
3184 linknames="$linknames $link"
3185 done
3187 # # Ensure that we have .o objects for linkers which dislike .lo
3188 # # (e.g. aix) in case we are running --disable-static
3189 # for obj in $libobjs; do
3190 # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3191 # if test "X$xdir" = "X$obj"; then
3192 # xdir="."
3193 # else
3194 # xdir="$xdir"
3195 # fi
3196 # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3197 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3198 # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
3199 # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3200 # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3201 # fi
3202 # done
3204 # Use standard objects if they are pic
3205 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3207 # Prepare the list of exported symbols
3208 if test -z "$export_symbols"; then
3209 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3210 $show "generating symbol list for \`$libname.la'"
3211 export_symbols="$output_objdir/$libname.exp"
3212 $run $rm $export_symbols
3213 eval cmds=\"$export_symbols_cmds\"
3214 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3215 for cmd in $cmds; do
3216 IFS="$save_ifs"
3217 $show "$cmd"
3218 $run eval "$cmd" || exit $?
3219 done
3220 IFS="$save_ifs"
3221 if test -n "$export_symbols_regex"; then
3222 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3223 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3224 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3225 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3230 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3231 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3234 if test -n "$convenience"; then
3235 if test -n "$whole_archive_flag_spec"; then
3236 save_libobjs=$libobjs
3237 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3238 else
3239 gentop="$output_objdir/${outputname}x"
3240 $show "${rm}r $gentop"
3241 $run ${rm}r "$gentop"
3242 $show "$mkdir $gentop"
3243 $run $mkdir "$gentop"
3244 status=$?
3245 if test $status -ne 0 && test ! -d "$gentop"; then
3246 exit $status
3248 generated="$generated $gentop"
3250 for xlib in $convenience; do
3251 # Extract the objects.
3252 case $xlib in
3253 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3254 *) xabs=`pwd`"/$xlib" ;;
3255 esac
3256 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3257 xdir="$gentop/$xlib"
3259 $show "${rm}r $xdir"
3260 $run ${rm}r "$xdir"
3261 $show "$mkdir $xdir"
3262 $run $mkdir "$xdir"
3263 status=$?
3264 if test $status -ne 0 && test ! -d "$xdir"; then
3265 exit $status
3267 $show "(cd $xdir && $AR x $xabs)"
3268 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3270 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3271 done
3275 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3276 eval flag=\"$thread_safe_flag_spec\"
3277 linker_flags="$linker_flags $flag"
3280 # Make a backup of the uninstalled library when relinking
3281 if test "$mode" = relink; then
3282 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3285 # Do each of the archive commands.
3286 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3287 eval test_cmds=\"$archive_expsym_cmds\"
3288 cmds=$archive_expsym_cmds
3289 else
3290 eval test_cmds=\"$archive_cmds\"
3291 cmds=$archive_cmds
3293 if len=`expr "X$test_cmds" : ".*"` &&
3294 test $len -le $max_cmd_len; then
3296 else
3297 # The command line is too long to link in one step, link piecewise.
3298 $echo "creating reloadable object files..."
3300 # Save the value of $output and $libobjs because we want to
3301 # use them later. If we have whole_archive_flag_spec, we
3302 # want to use save_libobjs as it was before
3303 # whole_archive_flag_spec was expanded, because we can't
3304 # assume the linker understands whole_archive_flag_spec.
3305 # This may have to be revisited, in case too many
3306 # convenience libraries get linked in and end up exceeding
3307 # the spec.
3308 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3309 save_libobjs=$libobjs
3311 save_output=$output
3313 # Clear the reloadable object creation command queue and
3314 # initialize k to one.
3315 test_cmds=
3316 concat_cmds=
3317 objlist=
3318 delfiles=
3319 last_robj=
3321 output=$output_objdir/$save_output-${k}.$objext
3322 # Loop over the list of objects to be linked.
3323 for obj in $save_libobjs
3325 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3326 if test "X$objlist" = X ||
3327 { len=`expr "X$test_cmds" : ".*"` &&
3328 test $len -le $max_cmd_len; }; then
3329 objlist="$objlist $obj"
3330 else
3331 # The command $test_cmds is almost too long, add a
3332 # command to the queue.
3333 if test $k -eq 1 ; then
3334 # The first file doesn't have a previous command to add.
3335 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3336 else
3337 # All subsequent reloadable object files will link in
3338 # the last one created.
3339 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3341 last_robj=$output_objdir/$save_output-${k}.$objext
3342 k=`expr $k + 1`
3343 output=$output_objdir/$save_output-${k}.$objext
3344 objlist=$obj
3345 len=1
3347 done
3348 # Handle the remaining objects by creating one last
3349 # reloadable object file. All subsequent reloadable object
3350 # files will link in the last one created.
3351 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3352 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3354 # Set up a command to remove the reloadale object files
3355 # after they are used.
3357 while test $i -lt $k
3359 i=`expr $i + 1`
3360 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3361 done
3363 $echo "creating a temporary reloadable object file: $output"
3365 # Loop through the commands generated above and execute them.
3366 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3367 for cmd in $concat_cmds; do
3368 IFS="$save_ifs"
3369 eval cmd=\"$cmd\"
3370 $show "$cmd"
3371 $run eval "$cmd" || exit $?
3372 done
3373 IFS="$save_ifs"
3375 libobjs=$output
3376 # Restore the value of output.
3377 output=$save_output
3379 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3380 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3382 # Expand the library linking commands again to reset the
3383 # value of $libobjs for piecewise linking.
3385 # Do each of the archive commands.
3386 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3387 cmds=$archive_expsym_cmds
3388 else
3389 cmds=$archive_cmds
3392 # Append the command to remove the reloadable object files
3393 # to the just-reset $cmds.
3394 eval cmds=\"\$cmds~$rm $delfiles\"
3396 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3397 for cmd in $cmds; do
3398 IFS="$save_ifs"
3399 eval cmd=\"$cmd\"
3400 $show "$cmd"
3401 $run eval "$cmd" || exit $?
3402 done
3403 IFS="$save_ifs"
3405 # Restore the uninstalled library and exit
3406 if test "$mode" = relink; then
3407 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3408 exit 0
3411 # Create links to the real library.
3412 for linkname in $linknames; do
3413 if test "$realname" != "$linkname"; then
3414 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3415 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3417 done
3419 # If -module or -export-dynamic was specified, set the dlname.
3420 if test "$module" = yes || test "$export_dynamic" = yes; then
3421 # On all known operating systems, these are identical.
3422 dlname="$soname"
3427 obj)
3428 if test -n "$deplibs"; then
3429 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3432 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3433 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3436 if test -n "$rpath"; then
3437 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3440 if test -n "$xrpath"; then
3441 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3444 if test -n "$vinfo"; then
3445 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3448 if test -n "$release"; then
3449 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3452 case $output in
3453 *.lo)
3454 if test -n "$objs$old_deplibs"; then
3455 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3456 exit 1
3458 libobj="$output"
3459 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3462 libobj=
3463 obj="$output"
3465 esac
3467 # Delete the old objects.
3468 $run $rm $obj $libobj
3470 # Objects from convenience libraries. This assumes
3471 # single-version convenience libraries. Whenever we create
3472 # different ones for PIC/non-PIC, this we'll have to duplicate
3473 # the extraction.
3474 reload_conv_objs=
3475 gentop=
3476 # reload_cmds runs $LD directly, so let us get rid of
3477 # -Wl from whole_archive_flag_spec
3480 if test -n "$convenience"; then
3481 if test -n "$whole_archive_flag_spec"; then
3482 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3483 else
3484 gentop="$output_objdir/${obj}x"
3485 $show "${rm}r $gentop"
3486 $run ${rm}r "$gentop"
3487 $show "$mkdir $gentop"
3488 $run $mkdir "$gentop"
3489 status=$?
3490 if test $status -ne 0 && test ! -d "$gentop"; then
3491 exit $status
3493 generated="$generated $gentop"
3495 for xlib in $convenience; do
3496 # Extract the objects.
3497 case $xlib in
3498 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3499 *) xabs=`pwd`"/$xlib" ;;
3500 esac
3501 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3502 xdir="$gentop/$xlib"
3504 $show "${rm}r $xdir"
3505 $run ${rm}r "$xdir"
3506 $show "$mkdir $xdir"
3507 $run $mkdir "$xdir"
3508 status=$?
3509 if test $status -ne 0 && test ! -d "$xdir"; then
3510 exit $status
3512 $show "(cd $xdir && $AR x $xabs)"
3513 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3515 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3516 done
3520 # Create the old-style object.
3521 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
3523 output="$obj"
3524 eval cmds=\"$reload_cmds\"
3525 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3526 for cmd in $cmds; do
3527 IFS="$save_ifs"
3528 $show "$cmd"
3529 $run eval "$cmd" || exit $?
3530 done
3531 IFS="$save_ifs"
3533 # Exit if we aren't doing a library object file.
3534 if test -z "$libobj"; then
3535 if test -n "$gentop"; then
3536 $show "${rm}r $gentop"
3537 $run ${rm}r $gentop
3540 exit 0
3543 if test "$build_libtool_libs" != yes; then
3544 if test -n "$gentop"; then
3545 $show "${rm}r $gentop"
3546 $run ${rm}r $gentop
3549 # Create an invalid libtool object if no PIC, so that we don't
3550 # accidentally link it into a program.
3551 # $show "echo timestamp > $libobj"
3552 # $run eval "echo timestamp > $libobj" || exit $?
3553 exit 0
3556 if test -n "$pic_flag" || test "$pic_mode" != default; then
3557 # Only do commands if we really have different PIC objects.
3558 reload_objs="$libobjs $reload_conv_objs"
3559 output="$libobj"
3560 eval cmds=\"$reload_cmds\"
3561 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3562 for cmd in $cmds; do
3563 IFS="$save_ifs"
3564 $show "$cmd"
3565 $run eval "$cmd" || exit $?
3566 done
3567 IFS="$save_ifs"
3568 # else
3569 # # Just create a symlink.
3570 # $show $rm $libobj
3571 # $run $rm $libobj
3572 # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3573 # if test "X$xdir" = "X$libobj"; then
3574 # xdir="."
3575 # else
3576 # xdir="$xdir"
3577 # fi
3578 # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3579 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3580 # $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3581 # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3584 if test -n "$gentop"; then
3585 $show "${rm}r $gentop"
3586 $run ${rm}r $gentop
3589 exit 0
3592 prog)
3593 case $host in
3594 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3595 esac
3596 if test -n "$vinfo"; then
3597 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3600 if test -n "$release"; then
3601 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3604 if test "$preload" = yes; then
3605 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3606 test "$dlopen_self_static" = unknown; then
3607 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3611 case $host in
3612 *-*-rhapsody* | *-*-darwin1.[012])
3613 # On Rhapsody replace the C library is the System framework
3614 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3615 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3617 esac
3619 case $host in
3620 *-*-darwin*)
3621 # Don't allow lazy linking, it breaks C++ global constructors
3622 if test "$tagname" = CXX ; then
3623 compile_command="$compile_command ${wl}-bind_at_load"
3624 finalize_command="$finalize_command ${wl}-bind_at_load"
3626 # Time to change all our "foo.framework" stuff back to "-framework foo"
3627 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3628 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3630 esac
3632 compile_command="$compile_command $compile_deplibs"
3633 finalize_command="$finalize_command $finalize_deplibs"
3635 if test -n "$rpath$xrpath"; then
3636 # If the user specified any rpath flags, then add them.
3637 for libdir in $rpath $xrpath; do
3638 # This is the magic to use -rpath.
3639 case "$finalize_rpath " in
3640 *" $libdir "*) ;;
3641 *) finalize_rpath="$finalize_rpath $libdir" ;;
3642 esac
3643 done
3646 # Now hardcode the library paths
3647 rpath=
3648 hardcode_libdirs=
3649 for libdir in $compile_rpath $finalize_rpath; do
3650 if test -n "$hardcode_libdir_flag_spec"; then
3651 if test -n "$hardcode_libdir_separator"; then
3652 if test -z "$hardcode_libdirs"; then
3653 hardcode_libdirs="$libdir"
3654 else
3655 # Just accumulate the unique libdirs.
3656 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3657 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3660 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3662 esac
3664 else
3665 eval flag=\"$hardcode_libdir_flag_spec\"
3666 rpath="$rpath $flag"
3668 elif test -n "$runpath_var"; then
3669 case "$perm_rpath " in
3670 *" $libdir "*) ;;
3671 *) perm_rpath="$perm_rpath $libdir" ;;
3672 esac
3674 case $host in
3675 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3676 case :$dllsearchpath: in
3677 *":$libdir:"*) ;;
3678 *) dllsearchpath="$dllsearchpath:$libdir";;
3679 esac
3681 esac
3682 done
3683 # Substitute the hardcoded libdirs into the rpath.
3684 if test -n "$hardcode_libdir_separator" &&
3685 test -n "$hardcode_libdirs"; then
3686 libdir="$hardcode_libdirs"
3687 eval rpath=\" $hardcode_libdir_flag_spec\"
3689 compile_rpath="$rpath"
3691 rpath=
3692 hardcode_libdirs=
3693 for libdir in $finalize_rpath; do
3694 if test -n "$hardcode_libdir_flag_spec"; then
3695 if test -n "$hardcode_libdir_separator"; then
3696 if test -z "$hardcode_libdirs"; then
3697 hardcode_libdirs="$libdir"
3698 else
3699 # Just accumulate the unique libdirs.
3700 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3701 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3704 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3706 esac
3708 else
3709 eval flag=\"$hardcode_libdir_flag_spec\"
3710 rpath="$rpath $flag"
3712 elif test -n "$runpath_var"; then
3713 case "$finalize_perm_rpath " in
3714 *" $libdir "*) ;;
3715 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3716 esac
3718 done
3719 # Substitute the hardcoded libdirs into the rpath.
3720 if test -n "$hardcode_libdir_separator" &&
3721 test -n "$hardcode_libdirs"; then
3722 libdir="$hardcode_libdirs"
3723 eval rpath=\" $hardcode_libdir_flag_spec\"
3725 finalize_rpath="$rpath"
3727 dlsyms=
3728 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3729 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3730 dlsyms="${outputname}S.c"
3731 else
3732 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3736 if test -n "$dlsyms"; then
3737 case $dlsyms in
3738 "") ;;
3739 *.c)
3740 # Discover the nlist of each of the dlfiles.
3741 nlist="$output_objdir/${outputname}.nm"
3743 $show "$rm $nlist ${nlist}S ${nlist}T"
3744 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3746 # Parse the name list into a source file.
3747 $show "creating $output_objdir/$dlsyms"
3749 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3750 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3751 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3753 #ifdef __cplusplus
3754 extern \"C\" {
3755 #endif
3757 /* Prevent the only kind of declaration conflicts we can make. */
3758 #define lt_preloaded_symbols some_other_symbol
3760 /* External symbol declarations for the compiler. */\
3763 if test "$dlself" = yes; then
3764 $show "generating symbol list for \`$output'"
3766 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3768 # Add our own program objects to the symbol list.
3769 progfiles="$objs$old_deplibs"
3770 for arg in $progfiles; do
3771 $show "extracting global C symbols from \`$arg'"
3772 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3773 done
3775 if test -n "$exclude_expsyms"; then
3776 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3777 $run eval '$mv "$nlist"T "$nlist"'
3780 if test -n "$export_symbols_regex"; then
3781 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3782 $run eval '$mv "$nlist"T "$nlist"'
3785 # Prepare the list of exported symbols
3786 if test -z "$export_symbols"; then
3787 export_symbols="$output_objdir/$output.exp"
3788 $run $rm $export_symbols
3789 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3790 else
3791 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3792 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3793 $run eval 'mv "$nlist"T "$nlist"'
3797 for arg in $dlprefiles; do
3798 $show "extracting global C symbols from \`$arg'"
3799 name=`echo "$arg" | sed -e 's%^.*/%%'`
3800 $run eval 'echo ": $name " >> "$nlist"'
3801 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3802 done
3804 if test -z "$run"; then
3805 # Make sure we have at least an empty file.
3806 test -f "$nlist" || : > "$nlist"
3808 if test -n "$exclude_expsyms"; then
3809 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3810 $mv "$nlist"T "$nlist"
3813 # Try sorting and uniquifying the output.
3814 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3816 else
3817 grep -v "^: " < "$nlist" > "$nlist"S
3820 if test -f "$nlist"S; then
3821 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3822 else
3823 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3826 $echo >> "$output_objdir/$dlsyms" "\
3828 #undef lt_preloaded_symbols
3830 #if defined (__STDC__) && __STDC__
3831 # define lt_ptr_t void *
3832 #else
3833 # define lt_ptr_t char *
3834 # define const
3835 #endif
3837 /* The mapping between symbol names and symbols. */
3838 const struct {
3839 const char *name;
3840 lt_ptr_t address;
3842 lt_preloaded_symbols[] =
3846 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3847 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3848 < "$nlist" >> "$output_objdir/$dlsyms"
3850 $echo >> "$output_objdir/$dlsyms" "\
3851 {0, (lt_ptr_t) 0}
3854 /* This works around a problem in FreeBSD linker */
3855 #ifdef FREEBSD_WORKAROUND
3856 static const void *lt_preloaded_setup() {
3857 return lt_preloaded_symbols;
3859 #endif
3861 #ifdef __cplusplus
3863 #endif\
3867 pic_flag_for_symtable=
3868 case $host in
3869 # compiling the symbol table file with pic_flag works around
3870 # a FreeBSD bug that causes programs to crash when -lm is
3871 # linked before any other PIC object. But we must not use
3872 # pic_flag when linking with -static. The problem exists in
3873 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3874 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3875 case "$compile_command " in
3876 *" -static "*) ;;
3877 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3878 esac;;
3879 *-*-hpux*)
3880 case "$compile_command " in
3881 *" -static "*) ;;
3882 *) pic_flag_for_symtable=" $pic_flag";;
3883 esac
3884 esac
3886 # Now compile the dynamic symbol file.
3887 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3888 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3890 # Clean up the generated files.
3891 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3892 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3894 # Transform the symbol file into the correct name.
3895 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3896 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3899 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3900 exit 1
3902 esac
3903 else
3904 # We keep going just in case the user didn't refer to
3905 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3906 # really was required.
3908 # Nullify the symbol file.
3909 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3910 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3913 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3914 # Replace the output file specification.
3915 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3916 link_command="$compile_command$compile_rpath"
3918 # We have no uninstalled library dependencies, so finalize right now.
3919 $show "$link_command"
3920 $run eval "$link_command"
3921 status=$?
3923 # Delete the generated files.
3924 if test -n "$dlsyms"; then
3925 $show "$rm $output_objdir/${outputname}S.${objext}"
3926 $run $rm "$output_objdir/${outputname}S.${objext}"
3929 exit $status
3932 if test -n "$shlibpath_var"; then
3933 # We should set the shlibpath_var
3934 rpath=
3935 for dir in $temp_rpath; do
3936 case $dir in
3937 [\\/]* | [A-Za-z]:[\\/]*)
3938 # Absolute path.
3939 rpath="$rpath$dir:"
3942 # Relative path: add a thisdir entry.
3943 rpath="$rpath\$thisdir/$dir:"
3945 esac
3946 done
3947 temp_rpath="$rpath"
3950 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3951 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3953 if test -n "$finalize_shlibpath"; then
3954 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3957 compile_var=
3958 finalize_var=
3959 if test -n "$runpath_var"; then
3960 if test -n "$perm_rpath"; then
3961 # We should set the runpath_var.
3962 rpath=
3963 for dir in $perm_rpath; do
3964 rpath="$rpath$dir:"
3965 done
3966 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3968 if test -n "$finalize_perm_rpath"; then
3969 # We should set the runpath_var.
3970 rpath=
3971 for dir in $finalize_perm_rpath; do
3972 rpath="$rpath$dir:"
3973 done
3974 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3978 if test "$no_install" = yes; then
3979 # We don't need to create a wrapper script.
3980 link_command="$compile_var$compile_command$compile_rpath"
3981 # Replace the output file specification.
3982 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3983 # Delete the old output file.
3984 $run $rm $output
3985 # Link the executable and exit
3986 $show "$link_command"
3987 $run eval "$link_command" || exit $?
3988 exit 0
3991 if test "$hardcode_action" = relink; then
3992 # Fast installation is not supported
3993 link_command="$compile_var$compile_command$compile_rpath"
3994 relink_command="$finalize_var$finalize_command$finalize_rpath"
3996 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3997 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3998 else
3999 if test "$fast_install" != no; then
4000 link_command="$finalize_var$compile_command$finalize_rpath"
4001 if test "$fast_install" = yes; then
4002 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4003 else
4004 # fast_install is set to needless
4005 relink_command=
4007 else
4008 link_command="$compile_var$compile_command$compile_rpath"
4009 relink_command="$finalize_var$finalize_command$finalize_rpath"
4013 # Replace the output file specification.
4014 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4016 # Delete the old output files.
4017 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4019 $show "$link_command"
4020 $run eval "$link_command" || exit $?
4022 # Now create the wrapper script.
4023 $show "creating $output"
4025 # Quote the relink command for shipping.
4026 if test -n "$relink_command"; then
4027 # Preserve any variables that may affect compiler behavior
4028 for var in $variables_saved_for_relink; do
4029 if eval test -z \"\${$var+set}\"; then
4030 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4031 elif eval var_value=\$$var; test -z "$var_value"; then
4032 relink_command="$var=; export $var; $relink_command"
4033 else
4034 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4035 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4037 done
4038 relink_command="cd `pwd`; $relink_command"
4039 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4042 # Quote $echo for shipping.
4043 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4044 case $0 in
4045 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4046 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4047 esac
4048 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4049 else
4050 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4053 # Only actually do things if our run command is non-null.
4054 if test -z "$run"; then
4055 # win32 will think the script is a binary if it has
4056 # a .exe suffix, so we strip it off here.
4057 case $output in
4058 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
4059 esac
4060 # test for cygwin because mv fails w/o .exe extensions
4061 case $host in
4062 *cygwin*) exeext=.exe ;;
4063 *) exeext= ;;
4064 esac
4065 $rm $output
4066 trap "$rm $output; exit 1" 1 2 15
4068 $echo > $output "\
4069 #! $SHELL
4071 # $output - temporary wrapper script for $objdir/$outputname
4072 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4074 # The $output program cannot be directly executed until all the libtool
4075 # libraries that it depends on are installed.
4077 # This wrapper script should never be moved out of the build directory.
4078 # If it is, it will not operate correctly.
4080 # Sed substitution that helps us do robust quoting. It backslashifies
4081 # metacharacters that are still active within double-quoted strings.
4082 Xsed='sed -e 1s/^X//'
4083 sed_quote_subst='$sed_quote_subst'
4085 # The HP-UX ksh and POSIX shell print the target directory to stdout
4086 # if CDPATH is set.
4087 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4089 relink_command=\"$relink_command\"
4091 # This environment variable determines our operation mode.
4092 if test \"\$libtool_install_magic\" = \"$magic\"; then
4093 # install mode needs the following variable:
4094 notinst_deplibs='$notinst_deplibs'
4095 else
4096 # When we are sourced in execute mode, \$file and \$echo are already set.
4097 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4098 echo=\"$qecho\"
4099 file=\"\$0\"
4100 # Make sure echo works.
4101 if test \"X\$1\" = X--no-reexec; then
4102 # Discard the --no-reexec flag, and continue.
4103 shift
4104 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4105 # Yippee, \$echo works!
4107 else
4108 # Restart under the correct shell, and then maybe \$echo will work.
4109 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4113 $echo >> $output "\
4115 # Find the directory that this script lives in.
4116 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4117 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4119 # Follow symbolic links until we get to the real thisdir.
4120 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
4121 while test -n \"\$file\"; do
4122 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4124 # If there was a directory component, then change thisdir.
4125 if test \"x\$destdir\" != \"x\$file\"; then
4126 case \"\$destdir\" in
4127 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4128 *) thisdir=\"\$thisdir/\$destdir\" ;;
4129 esac
4132 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4133 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
4134 done
4136 # Try to get the absolute directory name.
4137 absdir=\`cd \"\$thisdir\" && pwd\`
4138 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4141 if test "$fast_install" = yes; then
4142 echo >> $output "\
4143 program=lt-'$outputname'$exeext
4144 progdir=\"\$thisdir/$objdir\"
4146 if test ! -f \"\$progdir/\$program\" || \\
4147 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
4148 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4150 file=\"\$\$-\$program\"
4152 if test ! -d \"\$progdir\"; then
4153 $mkdir \"\$progdir\"
4154 else
4155 $rm \"\$progdir/\$file\"
4158 echo >> $output "\
4160 # relink executable if necessary
4161 if test -n \"\$relink_command\"; then
4162 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4163 else
4164 $echo \"\$relink_command_output\" >&2
4165 $rm \"\$progdir/\$file\"
4166 exit 1
4170 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4171 { $rm \"\$progdir/\$program\";
4172 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4173 $rm \"\$progdir/\$file\"
4175 else
4176 echo >> $output "\
4177 program='$outputname'
4178 progdir=\"\$thisdir/$objdir\"
4182 echo >> $output "\
4184 if test -f \"\$progdir/\$program\"; then"
4186 # Export our shlibpath_var if we have one.
4187 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4188 $echo >> $output "\
4189 # Add our own library path to $shlibpath_var
4190 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4192 # Some systems cannot cope with colon-terminated $shlibpath_var
4193 # The second colon is a workaround for a bug in BeOS R4 sed
4194 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4196 export $shlibpath_var
4200 # fixup the dll searchpath if we need to.
4201 if test -n "$dllsearchpath"; then
4202 $echo >> $output "\
4203 # Add the dll search path components to the executable PATH
4204 PATH=$dllsearchpath:\$PATH
4208 $echo >> $output "\
4209 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4210 # Run the actual program with our arguments.
4212 case $host in
4213 # win32 systems need to use the prog path for dll
4214 # lookup to work
4215 *-*-cygwin* | *-*-pw32*)
4216 $echo >> $output "\
4217 exec \$progdir/\$program \${1+\"\$@\"}
4221 # Backslashes separate directories on plain windows
4222 *-*-mingw | *-*-os2*)
4223 $echo >> $output "\
4224 exec \$progdir\\\\\$program \${1+\"\$@\"}
4229 $echo >> $output "\
4230 # Export the path to the program.
4231 PATH=\"\$progdir:\$PATH\"
4232 export PATH
4234 exec \$program \${1+\"\$@\"}
4237 esac
4238 $echo >> $output "\
4239 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4240 exit 1
4242 else
4243 # The program doesn't exist.
4244 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4245 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4246 echo \"See the $PACKAGE documentation for more information.\" 1>&2
4247 exit 1
4251 chmod +x $output
4253 exit 0
4255 esac
4257 # See if we need to build an old-fashioned archive.
4258 for oldlib in $oldlibs; do
4260 if test "$build_libtool_libs" = convenience; then
4261 oldobjs="$libobjs_save"
4262 addlibs="$convenience"
4263 build_libtool_libs=no
4264 else
4265 if test "$build_libtool_libs" = module; then
4266 oldobjs="$libobjs_save"
4267 build_libtool_libs=no
4268 else
4269 oldobjs="$objs$old_deplibs $non_pic_objects"
4271 addlibs="$old_convenience"
4274 if test -n "$addlibs"; then
4275 gentop="$output_objdir/${outputname}x"
4276 $show "${rm}r $gentop"
4277 $run ${rm}r "$gentop"
4278 $show "$mkdir $gentop"
4279 $run $mkdir "$gentop"
4280 status=$?
4281 if test $status -ne 0 && test ! -d "$gentop"; then
4282 exit $status
4284 generated="$generated $gentop"
4286 # Add in members from convenience archives.
4287 for xlib in $addlibs; do
4288 # Extract the objects.
4289 case $xlib in
4290 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4291 *) xabs=`pwd`"/$xlib" ;;
4292 esac
4293 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4294 xdir="$gentop/$xlib"
4296 $show "${rm}r $xdir"
4297 $run ${rm}r "$xdir"
4298 $show "$mkdir $xdir"
4299 $run $mkdir "$xdir"
4300 status=$?
4301 if test $status -ne 0 && test ! -d "$xdir"; then
4302 exit $status
4304 $show "(cd $xdir && $AR x $xabs)"
4305 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4307 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
4308 done
4311 # Do each command in the archive commands.
4312 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4313 eval cmds=\"$old_archive_from_new_cmds\"
4314 else
4315 # # Ensure that we have .o objects in place in case we decided
4316 # # not to build a shared library, and have fallen back to building
4317 # # static libs even though --disable-static was passed!
4318 # for oldobj in $oldobjs; do
4319 # if test ! -f $oldobj; then
4320 # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
4321 # if test "X$xdir" = "X$oldobj"; then
4322 # xdir="."
4323 # else
4324 # xdir="$xdir"
4325 # fi
4326 # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
4327 # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
4328 # $show "(cd $xdir && ${LN_S} $obj $baseobj)"
4329 # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4330 # fi
4331 # done
4333 eval cmds=\"$old_archive_cmds\"
4335 if len=`expr "X$cmds" : ".*"` &&
4336 test $len -le $max_cmd_len; then
4338 else
4339 # the command line is too long to link in one step, link in parts
4340 $echo "using piecewise archive linking..."
4341 save_RANLIB=$RANLIB
4342 RANLIB=:
4343 objlist=
4344 concat_cmds=
4345 save_oldobjs=$oldobjs
4346 # GNU ar 2.10+ was changed to match POSIX; thus no paths are
4347 # encoded into archives. This makes 'ar r' malfunction in
4348 # this piecewise linking case whenever conflicting object
4349 # names appear in distinct ar calls; check, warn and compensate.
4350 if (for obj in $save_oldobjs
4352 $echo "X$obj" | $Xsed -e 's%^.*/%%'
4353 done | sort | sort -uc >/dev/null 2>&1); then
4355 else
4356 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
4357 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
4358 AR_FLAGS=cq
4360 for obj in $save_oldobjs
4362 oldobjs="$objlist $obj"
4363 objlist="$objlist $obj"
4364 eval test_cmds=\"$old_archive_cmds\"
4365 if len=`expr "X$test_cmds" : ".*"` &&
4366 test $len -le $max_cmd_len; then
4368 else
4369 # the above command should be used before it gets too long
4370 oldobjs=$objlist
4371 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4372 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4373 objlist=
4375 done
4376 RANLIB=$save_RANLIB
4377 oldobjs=$objlist
4378 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4381 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4382 for cmd in $cmds; do
4383 IFS="$save_ifs"
4384 $show "$cmd"
4385 $run eval "$cmd" || exit $?
4386 done
4387 IFS="$save_ifs"
4388 done
4390 if test -n "$generated"; then
4391 $show "${rm}r$generated"
4392 $run ${rm}r$generated
4395 # Now create the libtool archive.
4396 case $output in
4397 *.la)
4398 old_library=
4399 test "$build_old_libs" = yes && old_library="$libname.$libext"
4400 $show "creating $output"
4402 # Preserve any variables that may affect compiler behavior
4403 for var in $variables_saved_for_relink; do
4404 if eval test -z \"\${$var+set}\"; then
4405 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4406 elif eval var_value=\$$var; test -z "$var_value"; then
4407 relink_command="$var=; export $var; $relink_command"
4408 else
4409 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4410 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4412 done
4413 # Quote the link command for shipping.
4414 tagopts=
4415 for tag in $taglist; do
4416 tagopts="$tagopts --tag $tag"
4417 done
4418 relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)"
4419 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4421 # Only create the output if not a dry run.
4422 if test -z "$run"; then
4423 for installed in no yes; do
4424 if test "$installed" = yes; then
4425 if test -z "$install_libdir"; then
4426 break
4428 output="$output_objdir/$outputname"i
4429 # Replace all uninstalled libtool libraries with the installed ones
4430 newdependency_libs=
4431 for deplib in $dependency_libs; do
4432 case $deplib in
4433 *.la)
4434 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4435 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4436 if test -z "$libdir"; then
4437 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4438 exit 1
4440 newdependency_libs="$newdependency_libs $libdir/$name"
4442 *) newdependency_libs="$newdependency_libs $deplib" ;;
4443 esac
4444 done
4445 dependency_libs="$newdependency_libs"
4446 newdlfiles=
4447 for lib in $dlfiles; do
4448 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4449 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4450 if test -z "$libdir"; then
4451 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4452 exit 1
4454 newdlfiles="$newdlfiles $libdir/$name"
4455 done
4456 dlfiles="$newdlfiles"
4457 newdlprefiles=
4458 for lib in $dlprefiles; do
4459 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4460 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4461 if test -z "$libdir"; then
4462 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4463 exit 1
4465 newdlprefiles="$newdlprefiles $libdir/$name"
4466 done
4467 dlprefiles="$newdlprefiles"
4469 $rm $output
4470 # place dlname in correct position for cygwin
4471 tdlname=$dlname
4472 case $host,$output,$installed,$module,$dlname in
4473 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4474 esac
4475 $echo > $output "\
4476 # $outputname - a libtool library file
4477 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4479 # Please DO NOT delete this file!
4480 # It is necessary for linking the library.
4482 # The name that we can dlopen(3).
4483 dlname='$tdlname'
4485 # Names of this library.
4486 library_names='$library_names'
4488 # The name of the static archive.
4489 old_library='$old_library'
4491 # Libraries that this one depends upon.
4492 dependency_libs='$dependency_libs'
4494 # Version information for $libname.
4495 current=$current
4496 age=$age
4497 revision=$revision
4499 # Is this an already installed library?
4500 installed=$installed
4502 # Files to dlopen/dlpreopen
4503 dlopen='$dlfiles'
4504 dlpreopen='$dlprefiles'
4506 # Directory that this library needs to be installed in:
4507 libdir='$install_libdir'"
4508 if test "$installed" = no && test $need_relink = yes; then
4509 $echo >> $output "\
4510 relink_command=\"$relink_command\""
4512 done
4515 # Do a symbolic link so that the libtool archive can be found in
4516 # LD_LIBRARY_PATH before the program is installed.
4517 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4518 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4520 esac
4521 exit 0
4524 # libtool install mode
4525 install)
4526 modename="$modename: install"
4528 # There may be an optional sh(1) argument at the beginning of
4529 # install_prog (especially on Windows NT).
4530 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4531 # Allow the use of GNU shtool's install command.
4532 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4533 # Aesthetically quote it.
4534 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4535 case $arg in
4536 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4537 arg="\"$arg\""
4539 esac
4540 install_prog="$arg "
4541 arg="$1"
4542 shift
4543 else
4544 install_prog=
4545 arg="$nonopt"
4548 # The real first argument should be the name of the installation program.
4549 # Aesthetically quote it.
4550 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4551 case $arg in
4552 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4553 arg="\"$arg\""
4555 esac
4556 install_prog="$install_prog$arg"
4558 # We need to accept at least all the BSD install flags.
4559 dest=
4560 files=
4561 opts=
4562 prev=
4563 install_type=
4564 isdir=no
4565 stripme=
4566 for arg
4568 if test -n "$dest"; then
4569 files="$files $dest"
4570 dest="$arg"
4571 continue
4574 case $arg in
4575 -d) isdir=yes ;;
4576 -f) prev="-f" ;;
4577 -g) prev="-g" ;;
4578 -m) prev="-m" ;;
4579 -o) prev="-o" ;;
4581 stripme=" -s"
4582 continue
4584 -*) ;;
4587 # If the previous option needed an argument, then skip it.
4588 if test -n "$prev"; then
4589 prev=
4590 else
4591 dest="$arg"
4592 continue
4595 esac
4597 # Aesthetically quote the argument.
4598 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4599 case $arg in
4600 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4601 arg="\"$arg\""
4603 esac
4604 install_prog="$install_prog $arg"
4605 done
4607 if test -z "$install_prog"; then
4608 $echo "$modename: you must specify an install program" 1>&2
4609 $echo "$help" 1>&2
4610 exit 1
4613 if test -n "$prev"; then
4614 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4615 $echo "$help" 1>&2
4616 exit 1
4619 if test -z "$files"; then
4620 if test -z "$dest"; then
4621 $echo "$modename: no file or destination specified" 1>&2
4622 else
4623 $echo "$modename: you must specify a destination" 1>&2
4625 $echo "$help" 1>&2
4626 exit 1
4629 # Strip any trailing slash from the destination.
4630 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4632 # Check to see that the destination is a directory.
4633 test -d "$dest" && isdir=yes
4634 if test "$isdir" = yes; then
4635 destdir="$dest"
4636 destname=
4637 else
4638 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4639 test "X$destdir" = "X$dest" && destdir=.
4640 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4642 # Not a directory, so check to see that there is only one file specified.
4643 set dummy $files
4644 if test $# -gt 2; then
4645 $echo "$modename: \`$dest' is not a directory" 1>&2
4646 $echo "$help" 1>&2
4647 exit 1
4650 case $destdir in
4651 [\\/]* | [A-Za-z]:[\\/]*) ;;
4653 for file in $files; do
4654 case $file in
4655 *.lo) ;;
4657 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4658 $echo "$help" 1>&2
4659 exit 1
4661 esac
4662 done
4664 esac
4666 # This variable tells wrapper scripts just to set variables rather
4667 # than running their programs.
4668 libtool_install_magic="$magic"
4670 staticlibs=
4671 future_libdirs=
4672 current_libdirs=
4673 for file in $files; do
4675 # Do each installation.
4676 case $file in
4677 *.$libext)
4678 # Do the static libraries later.
4679 staticlibs="$staticlibs $file"
4682 *.la)
4683 # Check to see that this really is a libtool archive.
4684 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4685 else
4686 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4687 $echo "$help" 1>&2
4688 exit 1
4691 library_names=
4692 old_library=
4693 relink_command=
4694 # If there is no directory component, then add one.
4695 case $file in
4696 */* | *\\*) . $file ;;
4697 *) . ./$file ;;
4698 esac
4700 # Add the libdir to current_libdirs if it is the destination.
4701 if test "X$destdir" = "X$libdir"; then
4702 case "$current_libdirs " in
4703 *" $libdir "*) ;;
4704 *) current_libdirs="$current_libdirs $libdir" ;;
4705 esac
4706 else
4707 # Note the libdir as a future libdir.
4708 case "$future_libdirs " in
4709 *" $libdir "*) ;;
4710 *) future_libdirs="$future_libdirs $libdir" ;;
4711 esac
4714 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4715 test "X$dir" = "X$file/" && dir=
4716 dir="$dir$objdir"
4718 if test -n "$relink_command"; then
4719 $echo "$modename: warning: relinking \`$file'" 1>&2
4720 $show "$relink_command"
4721 if $run eval "$relink_command"; then :
4722 else
4723 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4724 exit 1
4728 # See the names of the shared library.
4729 set dummy $library_names
4730 if test -n "$2"; then
4731 realname="$2"
4732 shift
4733 shift
4735 srcname="$realname"
4736 test -n "$relink_command" && srcname="$realname"T
4738 # Install the shared library and build the symlinks.
4739 $show "$install_prog $dir/$srcname $destdir/$realname"
4740 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4741 if test -n "$stripme" && test -n "$striplib"; then
4742 $show "$striplib $destdir/$realname"
4743 $run eval "$striplib $destdir/$realname" || exit $?
4746 if test $# -gt 0; then
4747 # Delete the old symlinks, and create new ones.
4748 for linkname
4750 if test "$linkname" != "$realname"; then
4751 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4752 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4754 done
4757 # Do each command in the postinstall commands.
4758 lib="$destdir/$realname"
4759 eval cmds=\"$postinstall_cmds\"
4760 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4761 for cmd in $cmds; do
4762 IFS="$save_ifs"
4763 $show "$cmd"
4764 $run eval "$cmd" || exit $?
4765 done
4766 IFS="$save_ifs"
4769 # Install the pseudo-library for information purposes.
4770 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4771 instname="$dir/$name"i
4772 $show "$install_prog $instname $destdir/$name"
4773 $run eval "$install_prog $instname $destdir/$name" || exit $?
4775 # Maybe install the static library, too.
4776 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4779 *.lo)
4780 # Install (i.e. copy) a libtool object.
4782 # Figure out destination file name, if it wasn't already specified.
4783 if test -n "$destname"; then
4784 destfile="$destdir/$destname"
4785 else
4786 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4787 destfile="$destdir/$destfile"
4790 # Deduce the name of the destination old-style object file.
4791 case $destfile in
4792 *.lo)
4793 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4795 *.$objext)
4796 staticdest="$destfile"
4797 destfile=
4800 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4801 $echo "$help" 1>&2
4802 exit 1
4804 esac
4806 # Install the libtool object if requested.
4807 if test -n "$destfile"; then
4808 $show "$install_prog $file $destfile"
4809 $run eval "$install_prog $file $destfile" || exit $?
4812 # Install the old object if enabled.
4813 if test "$build_old_libs" = yes; then
4814 # Deduce the name of the old-style object file.
4815 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4817 $show "$install_prog $staticobj $staticdest"
4818 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4820 exit 0
4824 # Figure out destination file name, if it wasn't already specified.
4825 if test -n "$destname"; then
4826 destfile="$destdir/$destname"
4827 else
4828 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4829 destfile="$destdir/$destfile"
4832 # Do a test to see if this is really a libtool program.
4833 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4834 notinst_deplibs=
4835 relink_command=
4837 # If there is no directory component, then add one.
4838 case $file in
4839 */* | *\\*) . $file ;;
4840 *) . ./$file ;;
4841 esac
4843 # Check the variables that should have been set.
4844 if test -z "$notinst_deplibs"; then
4845 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4846 exit 1
4849 finalize=yes
4850 for lib in $notinst_deplibs; do
4851 # Check to see that each library is installed.
4852 libdir=
4853 if test -f "$lib"; then
4854 # If there is no directory component, then add one.
4855 case $lib in
4856 */* | *\\*) . $lib ;;
4857 *) . ./$lib ;;
4858 esac
4860 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4861 if test -n "$libdir" && test ! -f "$libfile"; then
4862 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4863 finalize=no
4865 done
4867 relink_command=
4868 # If there is no directory component, then add one.
4869 case $file in
4870 */* | *\\*) . $file ;;
4871 *) . ./$file ;;
4872 esac
4874 outputname=
4875 if test "$fast_install" = no && test -n "$relink_command"; then
4876 if test "$finalize" = yes && test -z "$run"; then
4877 tmpdir="/tmp"
4878 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4879 tmpdir="$tmpdir/libtool-$$"
4880 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4881 else
4882 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4883 continue
4885 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4886 outputname="$tmpdir/$file"
4887 # Replace the output file specification.
4888 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4890 $show "$relink_command"
4891 if $run eval "$relink_command"; then :
4892 else
4893 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4894 ${rm}r "$tmpdir"
4895 continue
4897 file="$outputname"
4898 else
4899 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4901 else
4902 # Install the binary that we compiled earlier.
4903 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4908 # remove .exe since cygwin /usr/bin/install will append another
4909 # one anyways
4910 case $install_prog,$host in
4911 */usr/bin/install*,*cygwin*)
4912 case $file:$destfile in
4913 *.exe:*.exe)
4914 # this is ok
4916 *.exe:*)
4917 destfile=$destfile.exe
4919 *:*.exe)
4920 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4922 esac
4924 esac
4926 $show "$install_prog$stripme $file $destfile"
4927 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4928 test -n "$outputname" && ${rm}r "$tmpdir"
4930 esac
4931 done
4933 for file in $staticlibs; do
4934 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4936 # Set up the ranlib parameters.
4937 oldlib="$destdir/$name"
4939 $show "$install_prog $file $oldlib"
4940 $run eval "$install_prog \$file \$oldlib" || exit $?
4942 if test -n "$stripme" && test -n "$striplib"; then
4943 $show "$old_striplib $oldlib"
4944 $run eval "$old_striplib $oldlib" || exit $?
4947 # Do each command in the postinstall commands.
4948 eval cmds=\"$old_postinstall_cmds\"
4949 # APPLE LOCAL handle ~ in pathnames 2002-01-14 --sts
4950 IFS="${IFS= }"; save_ifs="$IFS"; IFS='@'
4951 for cmd in $cmds; do
4952 IFS="$save_ifs"
4953 $show "$cmd"
4954 $run eval "$cmd" || exit $?
4955 done
4956 IFS="$save_ifs"
4957 done
4959 if test -n "$future_libdirs"; then
4960 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4963 if test -n "$current_libdirs"; then
4964 # Maybe just do a dry run.
4965 test -n "$run" && current_libdirs=" -n$current_libdirs"
4966 exec_cmd='$SHELL $0 --finish$current_libdirs'
4967 else
4968 exit 0
4972 # libtool finish mode
4973 finish)
4974 modename="$modename: finish"
4975 libdirs="$nonopt"
4976 admincmds=
4978 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4979 for dir
4981 libdirs="$libdirs $dir"
4982 done
4984 for libdir in $libdirs; do
4985 if test -n "$finish_cmds"; then
4986 # Do each command in the finish commands.
4987 eval cmds=\"$finish_cmds\"
4988 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4989 for cmd in $cmds; do
4990 IFS="$save_ifs"
4991 $show "$cmd"
4992 $run eval "$cmd" || admincmds="$admincmds
4993 $cmd"
4994 done
4995 IFS="$save_ifs"
4997 if test -n "$finish_eval"; then
4998 # Do the single finish_eval.
4999 eval cmds=\"$finish_eval\"
5000 $run eval "$cmds" || admincmds="$admincmds
5001 $cmds"
5003 done
5006 # Exit here if they wanted silent mode.
5007 test "$show" = ":" && exit 0
5009 echo "----------------------------------------------------------------------"
5010 echo "Libraries have been installed in:"
5011 for libdir in $libdirs; do
5012 echo " $libdir"
5013 done
5014 echo
5015 echo "If you ever happen to want to link against installed libraries"
5016 echo "in a given directory, LIBDIR, you must either use libtool, and"
5017 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5018 echo "flag during linking and do at least one of the following:"
5019 if test -n "$shlibpath_var"; then
5020 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5021 echo " during execution"
5023 if test -n "$runpath_var"; then
5024 echo " - add LIBDIR to the \`$runpath_var' environment variable"
5025 echo " during linking"
5027 if test -n "$hardcode_libdir_flag_spec"; then
5028 libdir=LIBDIR
5029 eval flag=\"$hardcode_libdir_flag_spec\"
5031 echo " - use the \`$flag' linker flag"
5033 if test -n "$admincmds"; then
5034 echo " - have your system administrator run these commands:$admincmds"
5036 if test -f /etc/ld.so.conf; then
5037 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5039 echo
5040 echo "See any operating system documentation about shared libraries for"
5041 echo "more information, such as the ld(1) and ld.so(8) manual pages."
5042 echo "----------------------------------------------------------------------"
5043 exit 0
5046 # libtool execute mode
5047 execute)
5048 modename="$modename: execute"
5050 # The first argument is the command name.
5051 cmd="$nonopt"
5052 if test -z "$cmd"; then
5053 $echo "$modename: you must specify a COMMAND" 1>&2
5054 $echo "$help"
5055 exit 1
5058 # Handle -dlopen flags immediately.
5059 for file in $execute_dlfiles; do
5060 if test ! -f "$file"; then
5061 $echo "$modename: \`$file' is not a file" 1>&2
5062 $echo "$help" 1>&2
5063 exit 1
5066 dir=
5067 case $file in
5068 *.la)
5069 # Check to see that this really is a libtool archive.
5070 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5071 else
5072 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5073 $echo "$help" 1>&2
5074 exit 1
5077 # Read the libtool library.
5078 dlname=
5079 library_names=
5081 # If there is no directory component, then add one.
5082 case $file in
5083 */* | *\\*) . $file ;;
5084 *) . ./$file ;;
5085 esac
5087 # Skip this library if it cannot be dlopened.
5088 if test -z "$dlname"; then
5089 # Warn if it was a shared library.
5090 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5091 continue
5094 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5095 test "X$dir" = "X$file" && dir=.
5097 if test -f "$dir/$objdir/$dlname"; then
5098 dir="$dir/$objdir"
5099 else
5100 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5101 exit 1
5105 *.lo)
5106 # Just add the directory containing the .lo file.
5107 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5108 test "X$dir" = "X$file" && dir=.
5112 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5113 continue
5115 esac
5117 # Get the absolute pathname.
5118 absdir=`cd "$dir" && pwd`
5119 test -n "$absdir" && dir="$absdir"
5121 # Now add the directory to shlibpath_var.
5122 if eval "test -z \"\$$shlibpath_var\""; then
5123 eval "$shlibpath_var=\"\$dir\""
5124 else
5125 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5127 done
5129 # This variable tells wrapper scripts just to set shlibpath_var
5130 # rather than running their programs.
5131 libtool_execute_magic="$magic"
5133 # Check if any of the arguments is a wrapper script.
5134 args=
5135 for file
5137 case $file in
5138 -*) ;;
5140 # Do a test to see if this is really a libtool program.
5141 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5142 # If there is no directory component, then add one.
5143 case $file in
5144 */* | *\\*) . $file ;;
5145 *) . ./$file ;;
5146 esac
5148 # Transform arg to wrapped name.
5149 file="$progdir/$program"
5152 esac
5153 # Quote arguments (to preserve shell metacharacters).
5154 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5155 args="$args \"$file\""
5156 done
5158 if test -z "$run"; then
5159 if test -n "$shlibpath_var"; then
5160 # Export the shlibpath_var.
5161 eval "export $shlibpath_var"
5164 # Restore saved enviroment variables
5165 if test "${save_LC_ALL+set}" = set; then
5166 LC_ALL="$save_LC_ALL"; export LC_ALL
5168 if test "${save_LANG+set}" = set; then
5169 LANG="$save_LANG"; export LANG
5172 # Now prepare to actually exec the command.
5173 exec_cmd='"$cmd"$args'
5174 else
5175 # Display what would be done.
5176 if test -n "$shlibpath_var"; then
5177 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5178 $echo "export $shlibpath_var"
5180 $echo "$cmd$args"
5181 exit 0
5185 # libtool clean and uninstall mode
5186 clean | uninstall)
5187 modename="$modename: $mode"
5188 rm="$nonopt"
5189 files=
5190 rmforce=
5191 exit_status=0
5193 # This variable tells wrapper scripts just to set variables rather
5194 # than running their programs.
5195 libtool_install_magic="$magic"
5197 for arg
5199 case $arg in
5200 -f) rm="$rm $arg"; rmforce=yes ;;
5201 -*) rm="$rm $arg" ;;
5202 *) files="$files $arg" ;;
5203 esac
5204 done
5206 if test -z "$rm"; then
5207 $echo "$modename: you must specify an RM program" 1>&2
5208 $echo "$help" 1>&2
5209 exit 1
5212 rmdirs=
5214 for file in $files; do
5215 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5216 if test "X$dir" = "X$file"; then
5217 dir=.
5218 objdir="$objdir"
5219 else
5220 objdir="$dir/$objdir"
5222 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5223 test $mode = uninstall && objdir="$dir"
5225 # Remember objdir for removal later, being careful to avoid duplicates
5226 if test $mode = clean; then
5227 case " $rmdirs " in
5228 *" $objdir "*) ;;
5229 *) rmdirs="$rmdirs $objdir" ;;
5230 esac
5233 # Don't error if the file doesn't exist and rm -f was used.
5234 if (test -L "$file") >/dev/null 2>&1 \
5235 || (test -h "$file") >/dev/null 2>&1 \
5236 || test -f "$file"; then
5238 elif test -d "$file"; then
5239 exit_status=1
5240 continue
5241 elif test "$rmforce" = yes; then
5242 continue
5245 rmfiles="$file"
5247 case $name in
5248 *.la)
5249 # Possibly a libtool archive, so verify it.
5250 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5251 . $dir/$name
5253 # Delete the libtool libraries and symlinks.
5254 for n in $library_names; do
5255 rmfiles="$rmfiles $objdir/$n"
5256 done
5257 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5258 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5260 if test $mode = uninstall; then
5261 if test -n "$library_names"; then
5262 # Do each command in the postuninstall commands.
5263 eval cmds=\"$postuninstall_cmds\"
5264 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5265 for cmd in $cmds; do
5266 IFS="$save_ifs"
5267 $show "$cmd"
5268 $run eval "$cmd"
5269 if test $? != 0 && test "$rmforce" != yes; then
5270 exit_status=1
5272 done
5273 IFS="$save_ifs"
5276 if test -n "$old_library"; then
5277 # Do each command in the old_postuninstall commands.
5278 eval cmds=\"$old_postuninstall_cmds\"
5279 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5280 for cmd in $cmds; do
5281 IFS="$save_ifs"
5282 $show "$cmd"
5283 $run eval "$cmd"
5284 if test $? != 0 && test "$rmforce" != yes; then
5285 exit_status=1
5287 done
5288 IFS="$save_ifs"
5290 # FIXME: should reinstall the best remaining shared library.
5295 *.lo)
5296 # Possibly a libtool object, so verify it.
5297 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5299 # Read the .lo file
5300 . $dir/$name
5302 # Add PIC object to the list of files to remove.
5303 if test -n "$pic_object" \
5304 && test "$pic_object" != none; then
5305 rmfiles="$rmfiles $dir/$pic_object"
5308 # Add non-PIC object to the list of files to remove.
5309 if test -n "$non_pic_object" \
5310 && test "$non_pic_object" != none; then
5311 rmfiles="$rmfiles $dir/$non_pic_object"
5317 # Do a test to see if this is a libtool program.
5318 if test $mode = clean &&
5319 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5320 relink_command=
5321 . $dir/$file
5323 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5324 if test "$fast_install" = yes && test -n "$relink_command"; then
5325 rmfiles="$rmfiles $objdir/lt-$name"
5329 esac
5330 $show "$rm $rmfiles"
5331 $run $rm $rmfiles || exit_status=1
5332 done
5334 # Try to remove the ${objdir}s in the directories where we deleted files
5335 for dir in $rmdirs; do
5336 if test -d "$dir"; then
5337 $show "rmdir $dir"
5338 $run rmdir $dir >/dev/null 2>&1
5340 done
5342 exit $exit_status
5346 $echo "$modename: you must specify a MODE" 1>&2
5347 $echo "$generic_help" 1>&2
5348 exit 1
5350 esac
5352 if test -z "$exec_cmd"; then
5353 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5354 $echo "$generic_help" 1>&2
5355 exit 1
5357 fi # test -z "$show_help"
5359 if test -n "$exec_cmd"; then
5360 eval exec $exec_cmd
5361 exit 1
5364 # We need to display help for each of the modes.
5365 case $mode in
5366 "") $echo \
5367 "Usage: $modename [OPTION]... [MODE-ARG]...
5369 Provide generalized library-building support services.
5371 --config show all configuration variables
5372 --debug enable verbose shell tracing
5373 -n, --dry-run display commands without modifying any files
5374 --features display basic configuration information and exit
5375 --finish same as \`--mode=finish'
5376 --help display this help message and exit
5377 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
5378 --quiet same as \`--silent'
5379 --silent don't print informational messages
5380 --tag=TAG use configuration variables from tag TAG
5381 --version print version information
5383 MODE must be one of the following:
5385 clean remove files from the build directory
5386 compile compile a source file into a libtool object
5387 execute automatically set library path, then run a program
5388 finish complete the installation of libtool libraries
5389 install install libraries or executables
5390 link create a library or an executable
5391 uninstall remove libraries from an installed directory
5393 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5394 a more detailed description of MODE."
5395 exit 0
5398 clean)
5399 $echo \
5400 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5402 Remove files from the build directory.
5404 RM is the name of the program to use to delete files associated with each FILE
5405 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5406 to RM.
5408 If FILE is a libtool library, object or program, all the files associated
5409 with it are deleted. Otherwise, only FILE itself is deleted using RM."
5412 compile)
5413 $echo \
5414 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5416 Compile a source file into a libtool library object.
5418 This mode accepts the following additional options:
5420 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5421 -prefer-pic try to building PIC objects only
5422 -prefer-non-pic try to building non-PIC objects only
5423 -static always build a \`.o' file suitable for static linking
5425 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5426 from the given SOURCEFILE.
5428 The output file name is determined by removing the directory component from
5429 SOURCEFILE, then substituting the C source code suffix \`.c' with the
5430 library object suffix, \`.lo'."
5433 execute)
5434 $echo \
5435 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5437 Automatically set library path, then run a program.
5439 This mode accepts the following additional options:
5441 -dlopen FILE add the directory containing FILE to the library path
5443 This mode sets the library path environment variable according to \`-dlopen'
5444 flags.
5446 If any of the ARGS are libtool executable wrappers, then they are translated
5447 into their corresponding uninstalled binary, and any of their required library
5448 directories are added to the library path.
5450 Then, COMMAND is executed, with ARGS as arguments."
5453 finish)
5454 $echo \
5455 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5457 Complete the installation of libtool libraries.
5459 Each LIBDIR is a directory that contains libtool libraries.
5461 The commands that this mode executes may require superuser privileges. Use
5462 the \`--dry-run' option if you just want to see what would be executed."
5465 install)
5466 $echo \
5467 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5469 Install executables or libraries.
5471 INSTALL-COMMAND is the installation command. The first component should be
5472 either the \`install' or \`cp' program.
5474 The rest of the components are interpreted as arguments to that command (only
5475 BSD-compatible install options are recognized)."
5478 link)
5479 $echo \
5480 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5482 Link object files or libraries together to form another library, or to
5483 create an executable program.
5485 LINK-COMMAND is a command using the C compiler that you would use to create
5486 a program from several object files.
5488 The following components of LINK-COMMAND are treated specially:
5490 -all-static do not do any dynamic linking at all
5491 -avoid-version do not add a version suffix if possible
5492 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5493 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5494 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5495 -export-symbols SYMFILE
5496 try to export only the symbols listed in SYMFILE
5497 -export-symbols-regex REGEX
5498 try to export only the symbols matching REGEX
5499 -LLIBDIR search LIBDIR for required installed libraries
5500 -lNAME OUTPUT-FILE requires the installed library libNAME
5501 -module build a library that can dlopened
5502 -no-fast-install disable the fast-install mode
5503 -no-install link a not-installable executable
5504 -no-undefined declare that a library does not refer to external symbols
5505 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5506 -objectlist FILE Use a list of object files found in FILE to specify objects
5507 -release RELEASE specify package release information
5508 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5509 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5510 -static do not do any dynamic linking of libtool libraries
5511 -version-info CURRENT[:REVISION[:AGE]]
5512 specify library version info [each variable defaults to 0]
5514 All other options (arguments beginning with \`-') are ignored.
5516 Every other argument is treated as a filename. Files ending in \`.la' are
5517 treated as uninstalled libtool libraries, other files are standard or library
5518 object files.
5520 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5521 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5522 required, except when creating a convenience library.
5524 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5525 using \`ar' and \`ranlib', or on Windows using \`lib'.
5527 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5528 is created, otherwise an executable program is created."
5531 uninstall)
5532 $echo \
5533 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5535 Remove libraries from an installation directory.
5537 RM is the name of the program to use to delete files associated with each FILE
5538 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5539 to RM.
5541 If FILE is a libtool library, all the files associated with it are deleted.
5542 Otherwise, only FILE itself is deleted using RM."
5546 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5547 $echo "$help" 1>&2
5548 exit 1
5550 esac
5552 echo
5553 $echo "Try \`$modename --help' for more information about other modes."
5555 exit 0
5557 # The TAGs below are defined such that we never get into a situation
5558 # in which we disable both kinds of libraries. Given conflicting
5559 # choices, we go for a static library, that is the most portable,
5560 # since we can't tell whether shared libraries were disabled because
5561 # the user asked for that or because the platform doesn't support
5562 # them. This is particularly important on AIX, because we don't
5563 # support having both static and shared libraries enabled at the same
5564 # time on that platform, so we default to a shared-only configuration.
5565 # If a disable-shared tag is given, we'll fallback to a static-only
5566 # configuration. But we'll never go from static-only to shared-only.
5568 ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5569 build_libtool_libs=no
5570 build_old_libs=yes
5571 ### END LIBTOOL TAG CONFIG: disable-shared
5573 ### BEGIN LIBTOOL TAG CONFIG: disable-static
5574 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5575 ### END LIBTOOL TAG CONFIG: disable-static
5577 # Local Variables:
5578 # mode:shell-script
5579 # sh-indentation:2
5580 # End: