Declare block/closure byref variable at function scope.
[llvm-gcc-4.2.git] / ltmain.sh
blob2820b26434268d7edca7a064ea128859dbbafe93
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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`
855 inst_prefix_dir=
857 avoid_version=no
858 dlfiles=
859 dlprefiles=
860 dlself=no
861 export_dynamic=no
862 export_symbols=
863 export_symbols_regex=
864 generated=
865 libobjs=
866 ltlibs=
867 module=no
868 no_install=no
869 objs=
870 non_pic_objects=
871 prefer_static_libs=no
872 preload=no
873 prev=
874 prevarg=
875 release=
876 rpath=
877 xrpath=
878 perm_rpath=
879 temp_rpath=
880 thread_safe=no
881 vinfo=
883 # We need to know -static, to get the right output filenames.
884 for arg
886 case $arg in
887 -all-static | -static)
888 if test "X$arg" = "X-all-static"; then
889 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
890 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
892 if test -n "$link_static_flag"; then
893 dlopen_self=$dlopen_self_static
895 else
896 if test -z "$pic_flag" && test -n "$link_static_flag"; then
897 dlopen_self=$dlopen_self_static
900 build_libtool_libs=no
901 build_old_libs=yes
902 prefer_static_libs=yes
903 break
905 esac
906 done
908 # See if our shared archives depend on static archives.
909 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
911 # Go through the arguments, transforming them on the way.
912 while test $# -gt 0; do
913 arg="$1"
914 base_compile="$base_compile $arg"
915 shift
916 case $arg in
917 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
918 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
920 *) qarg=$arg ;;
921 esac
922 libtool_args="$libtool_args $qarg"
924 # If the previous option needs an argument, assign it.
925 if test -n "$prev"; then
926 case $prev in
927 output)
928 compile_command="$compile_command @OUTPUT@"
929 finalize_command="$finalize_command @OUTPUT@"
931 esac
933 case $prev in
934 dlfiles|dlprefiles)
935 if test "$preload" = no; then
936 # Add the symbol object into the linking commands.
937 compile_command="$compile_command @SYMFILE@"
938 finalize_command="$finalize_command @SYMFILE@"
939 preload=yes
941 case $arg in
942 *.la | *.lo) ;; # We handle these cases below.
943 force)
944 if test "$dlself" = no; then
945 dlself=needless
946 export_dynamic=yes
948 prev=
949 continue
951 self)
952 if test "$prev" = dlprefiles; then
953 dlself=yes
954 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
955 dlself=yes
956 else
957 dlself=needless
958 export_dynamic=yes
960 prev=
961 continue
964 if test "$prev" = dlfiles; then
965 dlfiles="$dlfiles $arg"
966 else
967 dlprefiles="$dlprefiles $arg"
969 prev=
970 continue
972 esac
974 expsyms)
975 export_symbols="$arg"
976 if test ! -f "$arg"; then
977 $echo "$modename: symbol file \`$arg' does not exist"
978 exit 1
980 prev=
981 continue
983 expsyms_regex)
984 export_symbols_regex="$arg"
985 prev=
986 continue
988 inst_prefix)
989 inst_prefix_dir="$arg"
990 prev=
991 continue
993 release)
994 release="-$arg"
995 prev=
996 continue
998 objectlist)
999 if test -f "$arg"; then
1000 save_arg=$arg
1001 moreargs=
1002 for fil in `cat $save_arg`
1004 # moreargs="$moreargs $fil"
1005 arg=$fil
1006 # A libtool-controlled object.
1008 # Check to see that this really is a libtool object.
1009 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1010 pic_object=
1011 non_pic_object=
1013 # Read the .lo file
1014 # If there is no directory component, then add one.
1015 case $arg in
1016 */* | *\\*) . $arg ;;
1017 *) . ./$arg ;;
1018 esac
1020 if test -z "$pic_object" || \
1021 test -z "$non_pic_object" ||
1022 test "$pic_object" = none && \
1023 test "$non_pic_object" = none; then
1024 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1025 exit 1
1028 # Extract subdirectory from the argument.
1029 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1030 if test "X$xdir" = "X$arg"; then
1031 xdir=
1032 else
1033 xdir="$xdir/"
1036 if test "$pic_object" != none; then
1037 # Prepend the subdirectory the object is found in.
1038 pic_object="$xdir$pic_object"
1040 if test "$prev" = dlfiles; then
1041 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1042 dlfiles="$dlfiles $pic_object"
1043 prev=
1044 continue
1045 else
1046 # If libtool objects are unsupported, then we need to preload.
1047 prev=dlprefiles
1051 # CHECK ME: I think I busted this. -Ossama
1052 if test "$prev" = dlprefiles; then
1053 # Preload the old-style object.
1054 dlprefiles="$dlprefiles $pic_object"
1055 prev=
1058 # A PIC object.
1059 libobjs="$libobjs $pic_object"
1060 arg="$pic_object"
1063 # Non-PIC object.
1064 if test "$non_pic_object" != none; then
1065 # Prepend the subdirectory the object is found in.
1066 non_pic_object="$xdir$non_pic_object"
1068 # A standard non-PIC object
1069 non_pic_objects="$non_pic_objects $non_pic_object"
1070 if test -z "$pic_object" || test "$pic_object" = none ; then
1071 arg="$non_pic_object"
1073 else
1074 # If the PIC object exists, use it instead.
1075 # $xdir was prepended to $pic_object above.
1076 non_pic_object="$pic_object"
1077 non_pic_objects="$non_pic_objects $non_pic_object"
1079 else
1080 # Only an error if not doing a dry-run.
1081 if test -z "$run"; then
1082 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1083 exit 1
1084 else
1085 # Dry-run case.
1087 # Extract subdirectory from the argument.
1088 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1089 if test "X$xdir" = "X$arg"; then
1090 xdir=
1091 else
1092 xdir="$xdir/"
1095 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1096 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1097 libobjs="$libobjs $pic_object"
1098 non_pic_objects="$non_pic_objects $non_pic_object"
1101 done
1102 else
1103 $echo "$modename: link input file \`$save_arg' does not exist"
1104 exit 1
1106 arg=$save_arg
1107 prev=
1108 continue
1110 rpath | xrpath)
1111 # We need an absolute path.
1112 case $arg in
1113 [\\/]* | [A-Za-z]:[\\/]*) ;;
1115 $echo "$modename: only absolute run-paths are allowed" 1>&2
1116 exit 1
1118 esac
1119 if test "$prev" = rpath; then
1120 case "$rpath " in
1121 *" $arg "*) ;;
1122 *) rpath="$rpath $arg" ;;
1123 esac
1124 else
1125 case "$xrpath " in
1126 *" $arg "*) ;;
1127 *) xrpath="$xrpath $arg" ;;
1128 esac
1130 prev=
1131 continue
1133 xcompiler)
1134 compiler_flags="$compiler_flags $qarg"
1135 prev=
1136 compile_command="$compile_command $qarg"
1137 finalize_command="$finalize_command $qarg"
1138 continue
1140 xlinker)
1141 linker_flags="$linker_flags $qarg"
1142 compiler_flags="$compiler_flags $wl$qarg"
1143 prev=
1144 compile_command="$compile_command $wl$qarg"
1145 finalize_command="$finalize_command $wl$qarg"
1146 continue
1148 framework)
1149 case $host in
1150 *-*-darwin*)
1151 case "$deplibs " in
1152 *" $qarg.framework "*) ;;
1153 *) deplibs="$deplibs $qarg.framework" # this is fixed later
1155 esac
1157 esac
1158 prev=
1159 continue
1162 eval "$prev=\"\$arg\""
1163 prev=
1164 continue
1166 esac
1167 fi # test -n $prev
1169 prevarg="$arg"
1171 case $arg in
1172 -all-static)
1173 if test -n "$link_static_flag"; then
1174 compile_command="$compile_command $link_static_flag"
1175 finalize_command="$finalize_command $link_static_flag"
1177 continue
1180 -allow-undefined)
1181 # FIXME: remove this flag sometime in the future.
1182 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1183 continue
1186 -avoid-version)
1187 avoid_version=yes
1188 continue
1191 -dlopen)
1192 prev=dlfiles
1193 continue
1196 -dlpreopen)
1197 prev=dlprefiles
1198 continue
1201 -export-dynamic)
1202 export_dynamic=yes
1203 continue
1206 -export-symbols | -export-symbols-regex)
1207 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1208 $echo "$modename: more than one -exported-symbols argument is not allowed"
1209 exit 1
1211 if test "X$arg" = "X-export-symbols"; then
1212 prev=expsyms
1213 else
1214 prev=expsyms_regex
1216 continue
1219 -inst-prefix-dir)
1220 prev=inst_prefix
1221 continue
1224 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1225 # so, if we see these flags be careful not to treat them like -L
1226 -L[A-Z][A-Z]*:*)
1227 case $with_gcc/$host in
1228 no/*-*-irix*)
1229 compile_command="$compile_command $arg"
1230 finalize_command="$finalize_command $arg"
1232 esac
1233 continue
1236 -L*)
1237 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1238 # We need an absolute path.
1239 case $dir in
1240 [\\/]* | [A-Za-z]:[\\/]*) ;;
1242 absdir=`cd "$dir" && pwd`
1243 if test -z "$absdir"; then
1244 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1245 exit 1
1247 dir="$absdir"
1249 esac
1250 case "$deplibs " in
1251 *" -L$dir "*) ;;
1253 deplibs="$deplibs -L$dir"
1254 lib_search_path="$lib_search_path $dir"
1256 esac
1257 case $host in
1258 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1259 case :$dllsearchpath: in
1260 *":$dir:"*) ;;
1261 *) dllsearchpath="$dllsearchpath:$dir";;
1262 esac
1264 esac
1265 continue
1268 -l*)
1269 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1270 case $host in
1271 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1272 # These systems don't actually have a C or math library (as such)
1273 continue
1275 *-*-mingw* | *-*-os2*)
1276 # These systems don't actually have a C library (as such)
1277 test "X$arg" = "X-lc" && continue
1279 esac
1281 deplibs="$deplibs $arg"
1282 continue
1285 -module)
1286 module=yes
1287 continue
1290 -no-fast-install)
1291 fast_install=no
1292 continue
1295 -no-install)
1296 case $host in
1297 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1298 # The PATH hackery in wrapper scripts is required on Windows
1299 # in order for the loader to find any dlls it needs.
1300 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1301 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1302 fast_install=no
1304 *) no_install=yes ;;
1305 esac
1306 continue
1309 -no-undefined)
1310 allow_undefined=no
1311 continue
1314 -objectlist)
1315 prev=objectlist
1316 continue
1319 -o) prev=output ;;
1321 -release)
1322 prev=release
1323 continue
1326 -rpath)
1327 prev=rpath
1328 continue
1332 prev=xrpath
1333 continue
1336 -R*)
1337 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1338 # We need an absolute path.
1339 case $dir in
1340 [\\/]* | [A-Za-z]:[\\/]*) ;;
1342 $echo "$modename: only absolute run-paths are allowed" 1>&2
1343 exit 1
1345 esac
1346 case "$xrpath " in
1347 *" $dir "*) ;;
1348 *) xrpath="$xrpath $dir" ;;
1349 esac
1350 continue
1353 -static)
1354 # The effects of -static are defined in a previous loop.
1355 # We used to do the same as -all-static on platforms that
1356 # didn't have a PIC flag, but the assumption that the effects
1357 # would be equivalent was wrong. It would break on at least
1358 # Digital Unix and AIX.
1359 continue
1362 -thread-safe)
1363 thread_safe=yes
1364 continue
1367 -version-info)
1368 prev=vinfo
1369 continue
1372 -Wc,*)
1373 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1374 arg=
1375 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1376 for flag in $args; do
1377 IFS="$save_ifs"
1378 case $flag in
1379 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1380 flag="\"$flag\""
1382 esac
1383 arg="$arg $wl$flag"
1384 compiler_flags="$compiler_flags $flag"
1385 done
1386 IFS="$save_ifs"
1387 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1390 -Wl,*)
1391 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1392 arg=
1393 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1394 for flag in $args; do
1395 IFS="$save_ifs"
1396 case $flag in
1397 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1398 flag="\"$flag\""
1400 esac
1401 arg="$arg $wl$flag"
1402 compiler_flags="$compiler_flags $wl$flag"
1403 linker_flags="$linker_flags $flag"
1404 done
1405 IFS="$save_ifs"
1406 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1409 -Xcompiler)
1410 prev=xcompiler
1411 continue
1414 -Xlinker)
1415 prev=xlinker
1416 continue
1418 -framework)
1419 prev=framework
1420 continue
1423 # Some other compiler flag.
1424 -* | +*)
1425 # Unknown arguments in both finalize_command and compile_command need
1426 # to be aesthetically quoted because they are evaled later.
1427 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1428 case $arg in
1429 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1430 arg="\"$arg\""
1432 esac
1435 *.$objext)
1436 # A standard object.
1437 objs="$objs $arg"
1440 *.lo)
1441 # A libtool-controlled object.
1443 # Check to see that this really is a libtool object.
1444 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1445 pic_object=
1446 non_pic_object=
1448 # Read the .lo file
1449 # If there is no directory component, then add one.
1450 case $arg in
1451 */* | *\\*) . $arg ;;
1452 *) . ./$arg ;;
1453 esac
1455 if test -z "$pic_object" || \
1456 test -z "$non_pic_object" ||
1457 test "$pic_object" = none && \
1458 test "$non_pic_object" = none; then
1459 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1460 exit 1
1463 # Extract subdirectory from the argument.
1464 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1465 if test "X$xdir" = "X$arg"; then
1466 xdir=
1467 else
1468 xdir="$xdir/"
1471 if test "$pic_object" != none; then
1472 # Prepend the subdirectory the object is found in.
1473 pic_object="$xdir$pic_object"
1475 if test "$prev" = dlfiles; then
1476 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1477 dlfiles="$dlfiles $pic_object"
1478 prev=
1479 continue
1480 else
1481 # If libtool objects are unsupported, then we need to preload.
1482 prev=dlprefiles
1486 # CHECK ME: I think I busted this. -Ossama
1487 if test "$prev" = dlprefiles; then
1488 # Preload the old-style object.
1489 dlprefiles="$dlprefiles $pic_object"
1490 prev=
1493 # A PIC object.
1494 libobjs="$libobjs $pic_object"
1495 arg="$pic_object"
1498 # Non-PIC object.
1499 if test "$non_pic_object" != none; then
1500 # Prepend the subdirectory the object is found in.
1501 non_pic_object="$xdir$non_pic_object"
1503 # A standard non-PIC object
1504 non_pic_objects="$non_pic_objects $non_pic_object"
1505 if test -z "$pic_object" || test "$pic_object" = none ; then
1506 arg="$non_pic_object"
1508 else
1509 # If the PIC object exists, use it instead.
1510 # $xdir was prepended to $pic_object above.
1511 non_pic_object="$pic_object"
1512 non_pic_objects="$non_pic_objects $non_pic_object"
1514 else
1515 # Only an error if not doing a dry-run.
1516 if test -z "$run"; then
1517 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1518 exit 1
1519 else
1520 # Dry-run case.
1522 # Extract subdirectory from the argument.
1523 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1524 if test "X$xdir" = "X$arg"; then
1525 xdir=
1526 else
1527 xdir="$xdir/"
1530 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1531 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1532 libobjs="$libobjs $pic_object"
1533 non_pic_objects="$non_pic_objects $non_pic_object"
1538 *.$libext)
1539 # An archive.
1540 deplibs="$deplibs $arg"
1541 old_deplibs="$old_deplibs $arg"
1542 continue
1545 *.la)
1546 # A libtool-controlled library.
1548 if test "$prev" = dlfiles; then
1549 # This library was specified with -dlopen.
1550 dlfiles="$dlfiles $arg"
1551 prev=
1552 elif test "$prev" = dlprefiles; then
1553 # The library was specified with -dlpreopen.
1554 dlprefiles="$dlprefiles $arg"
1555 prev=
1556 else
1557 deplibs="$deplibs $arg"
1559 continue
1562 # Some other compiler argument.
1564 # Unknown arguments in both finalize_command and compile_command need
1565 # to be aesthetically quoted because they are evaled later.
1566 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1567 case $arg in
1568 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1569 arg="\"$arg\""
1571 esac
1573 esac # arg
1575 # Now actually substitute the argument into the commands.
1576 if test -n "$arg"; then
1577 compile_command="$compile_command $arg"
1578 finalize_command="$finalize_command $arg"
1580 done # argument parsing loop
1582 if test -n "$prev"; then
1583 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1584 $echo "$help" 1>&2
1585 exit 1
1588 # Infer tagged configuration to use if any are available and
1589 # if one wasn't chosen via the "--tag" command line option.
1590 # Only attempt this if the compiler in the base link
1591 # command doesn't match the default compiler.
1592 if test -n "$available_tags" && test -z "$tagname"; then
1593 case $base_compile in
1594 "$CC "*) ;;
1595 # Blanks in the command may have been stripped by the calling shell,
1596 # but not from the CC environment variable when ltconfig was run.
1597 "`$echo $CC` "*) ;;
1599 for z in $available_tags; do
1600 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1601 # Evaluate the configuration.
1602 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1603 case $base_compile in
1604 "$CC "*)
1605 # The compiler in $compile_command matches
1606 # the one in the tagged configuration.
1607 # Assume this is the tagged configuration we want.
1608 tagname=$z
1609 break
1611 "`$echo $CC` "*)
1612 tagname=$z
1613 break
1615 esac
1617 done
1618 # If $tagname still isn't set, then no tagged configuration
1619 # was found and let the user know that the "--tag" command
1620 # line option must be used.
1621 if test -z "$tagname"; then
1622 echo "$modename: unable to infer tagged configuration"
1623 echo "$modename: specify a tag with \`--tag'" 1>&2
1624 exit 1
1625 # else
1626 # echo "$modename: using $tagname tagged configuration"
1629 esac
1632 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1633 eval arg=\"$export_dynamic_flag_spec\"
1634 compile_command="$compile_command $arg"
1635 finalize_command="$finalize_command $arg"
1638 # calculate the name of the file, without its directory
1639 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1640 libobjs_save="$libobjs"
1642 if test -n "$shlibpath_var"; then
1643 # get the directories listed in $shlibpath_var
1644 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1645 else
1646 shlib_search_path=
1648 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1649 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1651 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1652 if test "X$output_objdir" = "X$output"; then
1653 output_objdir="$objdir"
1654 else
1655 output_objdir="$output_objdir/$objdir"
1657 # Create the object directory.
1658 if test ! -d $output_objdir; then
1659 $show "$mkdir $output_objdir"
1660 $run $mkdir $output_objdir
1661 status=$?
1662 if test $status -ne 0 && test ! -d $output_objdir; then
1663 exit $status
1667 # Determine the type of output
1668 case $output in
1670 $echo "$modename: you must specify an output file" 1>&2
1671 $echo "$help" 1>&2
1672 exit 1
1674 *.$libext) linkmode=oldlib ;;
1675 *.lo | *.$objext) linkmode=obj ;;
1676 *.la) linkmode=lib ;;
1677 *) linkmode=prog ;; # Anything else should be a program.
1678 esac
1680 specialdeplibs=
1681 libs=
1682 # Find all interdependent deplibs by searching for libraries
1683 # that are linked more than once (e.g. -la -lb -la)
1684 for deplib in $deplibs; do
1685 case "$libs " in
1686 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1687 esac
1688 libs="$libs $deplib"
1689 done
1691 if test $linkmode = lib; then
1692 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1694 # Compute libraries that are listed more than once in $predeps
1695 # $postdeps and mark them as special (i.e., whose duplicates are
1696 # not to be eliminated).
1697 pre_post_deps=
1698 for pre_post_dep in $predeps $postdeps; do
1699 case "$pre_post_deps " in
1700 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1701 esac
1702 pre_post_deps="$pre_post_deps $pre_post_dep"
1703 done
1704 pre_post_deps=
1707 deplibs=
1708 newdependency_libs=
1709 newlib_search_path=
1710 need_relink=no # whether we're linking any uninstalled libtool libraries
1711 notinst_deplibs= # not-installed libtool libraries
1712 notinst_path= # paths that contain not-installed libtool libraries
1713 case $linkmode in
1714 lib)
1715 passes="conv link"
1716 for file in $dlfiles $dlprefiles; do
1717 case $file in
1718 *.la) ;;
1720 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1721 exit 1
1723 esac
1724 done
1726 prog)
1727 compile_deplibs=
1728 finalize_deplibs=
1729 alldeplibs=no
1730 newdlfiles=
1731 newdlprefiles=
1732 passes="conv scan dlopen dlpreopen link"
1734 *) passes="conv"
1736 esac
1737 for pass in $passes; do
1738 if test $linkmode = prog; then
1739 # Determine which files to process
1740 case $pass in
1741 dlopen)
1742 libs="$dlfiles"
1743 save_deplibs="$deplibs" # Collect dlpreopened libraries
1744 deplibs=
1746 dlpreopen) libs="$dlprefiles" ;;
1747 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1748 esac
1750 for deplib in $libs; do
1751 lib=
1752 found=no
1753 case $deplib in
1754 -l*)
1755 if test $linkmode = oldlib && test $linkmode = obj; then
1756 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1757 continue
1759 if test $pass = conv; then
1760 deplibs="$deplib $deplibs"
1761 continue
1763 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1764 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1765 # Search the libtool library
1766 lib="$searchdir/lib${name}.la"
1767 if test -f "$lib"; then
1768 found=yes
1769 break
1771 done
1772 if test "$found" != yes; then
1773 # deplib doesn't seem to be a libtool library
1774 if test "$linkmode,$pass" = "prog,link"; then
1775 compile_deplibs="$deplib $compile_deplibs"
1776 finalize_deplibs="$deplib $finalize_deplibs"
1777 else
1778 deplibs="$deplib $deplibs"
1779 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1781 continue
1783 ;; # -l
1784 -L*)
1785 case $linkmode in
1786 lib)
1787 deplibs="$deplib $deplibs"
1788 test $pass = conv && continue
1789 newdependency_libs="$deplib $newdependency_libs"
1790 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1792 prog)
1793 if test $pass = conv; then
1794 deplibs="$deplib $deplibs"
1795 continue
1797 if test $pass = scan; then
1798 deplibs="$deplib $deplibs"
1799 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1800 else
1801 compile_deplibs="$deplib $compile_deplibs"
1802 finalize_deplibs="$deplib $finalize_deplibs"
1806 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1808 esac # linkmode
1809 continue
1810 ;; # -L
1811 -R*)
1812 if test $pass = link; then
1813 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1814 # Make sure the xrpath contains only unique directories.
1815 case "$xrpath " in
1816 *" $dir "*) ;;
1817 *) xrpath="$xrpath $dir" ;;
1818 esac
1820 deplibs="$deplib $deplibs"
1821 continue
1823 *.la) lib="$deplib" ;;
1824 *.$libext)
1825 if test $pass = conv; then
1826 deplibs="$deplib $deplibs"
1827 continue
1829 case $linkmode in
1830 lib)
1831 if test "$deplibs_check_method" != pass_all; then
1832 echo
1833 echo "*** Warning: This library needs some functionality provided by $deplib."
1834 echo "*** I have the capability to make that library automatically link in when"
1835 echo "*** you link to this library. But I can only do this if you have a"
1836 echo "*** shared version of the library, which you do not appear to have."
1837 else
1838 echo
1839 echo "*** Warning: Linking the shared library $output against the"
1840 echo "*** static library $deplib is not portable!"
1841 deplibs="$deplib $deplibs"
1843 continue
1845 prog)
1846 if test $pass != link; then
1847 deplibs="$deplib $deplibs"
1848 else
1849 compile_deplibs="$deplib $compile_deplibs"
1850 finalize_deplibs="$deplib $finalize_deplibs"
1852 continue
1854 esac # linkmode
1855 ;; # *.$libext
1856 *.lo | *.$objext)
1857 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1858 # If there is no dlopen support or we're linking statically,
1859 # we need to preload.
1860 newdlprefiles="$newdlprefiles $deplib"
1861 compile_deplibs="$deplib $compile_deplibs"
1862 finalize_deplibs="$deplib $finalize_deplibs"
1863 else
1864 newdlfiles="$newdlfiles $deplib"
1866 continue
1868 %DEPLIBS%)
1869 alldeplibs=yes
1870 continue
1872 esac # case $deplib
1873 if test $found = yes || test -f "$lib"; then :
1874 else
1875 $echo "$modename: cannot find the library \`$lib'" 1>&2
1876 exit 1
1879 # Check to see that this really is a libtool archive.
1880 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1881 else
1882 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1883 exit 1
1886 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1887 test "X$ladir" = "X$lib" && ladir="."
1889 dlname=
1890 dlopen=
1891 dlpreopen=
1892 libdir=
1893 library_names=
1894 old_library=
1895 # If the library was installed with an old release of libtool,
1896 # it will not redefine variable installed.
1897 installed=yes
1899 # Read the .la file
1900 case $lib in
1901 */* | *\\*) . $lib ;;
1902 *) . ./$lib ;;
1903 esac
1905 case $host in
1906 *-*-darwin*)
1907 # Convert "-framework foo" to "foo.framework" in dependency_libs
1908 test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
1910 esac
1912 if test "$linkmode,$pass" = "lib,link" ||
1913 test "$linkmode,$pass" = "prog,scan" ||
1914 { test $linkmode = oldlib && test $linkmode = obj; }; then
1915 # Add dl[pre]opened files of deplib
1916 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1917 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1920 if test $pass = conv; then
1921 # Only check for convenience libraries
1922 deplibs="$lib $deplibs"
1923 if test -z "$libdir"; then
1924 if test -z "$old_library"; then
1925 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1926 exit 1
1928 # It is a libtool convenience library, so add in its objects.
1929 convenience="$convenience $ladir/$objdir/$old_library"
1930 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1931 tmp_libs=
1932 for deplib in $dependency_libs; do
1933 deplibs="$deplib $deplibs"
1934 case "$tmp_libs " in
1935 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1936 esac
1937 tmp_libs="$tmp_libs $deplib"
1938 done
1939 elif test $linkmode != prog && test $linkmode != lib; then
1940 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1941 exit 1
1943 continue
1944 fi # $pass = conv
1946 # Get the name of the library we link against.
1947 linklib=
1948 for l in $old_library $library_names; do
1949 linklib="$l"
1950 done
1951 if test -z "$linklib"; then
1952 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1953 exit 1
1956 # This library was specified with -dlopen.
1957 if test $pass = dlopen; then
1958 if test -z "$libdir"; then
1959 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1960 exit 1
1962 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1963 # If there is no dlname, no dlopen support or we're linking
1964 # statically, we need to preload.
1965 dlprefiles="$dlprefiles $lib"
1966 else
1967 newdlfiles="$newdlfiles $lib"
1969 continue
1970 fi # $pass = dlopen
1972 # We need an absolute path.
1973 case $ladir in
1974 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1976 abs_ladir=`cd "$ladir" && pwd`
1977 if test -z "$abs_ladir"; then
1978 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1979 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1980 abs_ladir="$ladir"
1983 esac
1984 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1986 # Find the relevant object directory and library name.
1987 if test "X$installed" = Xyes; then
1988 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1989 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1990 dir="$ladir"
1991 absdir="$abs_ladir"
1992 libdir="$abs_ladir"
1993 else
1994 dir="$libdir"
1995 absdir="$libdir"
1997 else
1998 dir="$ladir/$objdir"
1999 absdir="$abs_ladir/$objdir"
2000 # Remove this search path later
2001 notinst_path="$notinst_path $abs_ladir"
2002 fi # $installed = yes
2003 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2005 # This library was specified with -dlpreopen.
2006 if test $pass = dlpreopen; then
2007 if test -z "$libdir"; then
2008 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2009 exit 1
2011 # Prefer using a static library (so that no silly _DYNAMIC symbols
2012 # are required to link).
2013 if test -n "$old_library"; then
2014 newdlprefiles="$newdlprefiles $dir/$old_library"
2015 # Otherwise, use the dlname, so that lt_dlopen finds it.
2016 elif test -n "$dlname"; then
2017 newdlprefiles="$newdlprefiles $dir/$dlname"
2018 else
2019 newdlprefiles="$newdlprefiles $dir/$linklib"
2021 fi # $pass = dlpreopen
2023 if test -z "$libdir"; then
2024 # Link the convenience library
2025 if test $linkmode = lib; then
2026 deplibs="$dir/$old_library $deplibs"
2027 elif test "$linkmode,$pass" = "prog,link"; then
2028 compile_deplibs="$dir/$old_library $compile_deplibs"
2029 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2030 else
2031 deplibs="$lib $deplibs"
2033 continue
2036 if test $linkmode = prog && test $pass != link; then
2037 newlib_search_path="$newlib_search_path $ladir"
2038 deplibs="$lib $deplibs"
2040 linkalldeplibs=no
2041 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2042 test "$build_libtool_libs" = no; then
2043 linkalldeplibs=yes
2046 tmp_libs=
2047 for deplib in $dependency_libs; do
2048 case $deplib in
2049 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2050 esac
2051 # Need to link against all dependency_libs?
2052 if test $linkalldeplibs = yes; then
2053 deplibs="$deplib $deplibs"
2054 else
2055 # Need to hardcode shared library paths
2056 # or/and link against static libraries
2057 newdependency_libs="$deplib $newdependency_libs"
2059 case "$tmp_libs " in
2060 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2061 esac
2062 tmp_libs="$tmp_libs $deplib"
2063 done # for deplib
2064 continue
2065 fi # $linkmode = prog...
2067 link_static=no # Whether the deplib will be linked statically
2068 if test -n "$library_names" &&
2069 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2070 # Link against this shared library
2072 if test "$linkmode,$pass" = "prog,link" ||
2073 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
2074 # Hardcode the library path.
2075 # Skip directories that are in the system default run-time
2076 # search path.
2077 case " $sys_lib_dlsearch_path " in
2078 *" $absdir "*) ;;
2080 case "$compile_rpath " in
2081 *" $absdir "*) ;;
2082 *) compile_rpath="$compile_rpath $absdir"
2083 esac
2085 esac
2086 case " $sys_lib_dlsearch_path " in
2087 *" $libdir "*) ;;
2089 case "$finalize_rpath " in
2090 *" $libdir "*) ;;
2091 *) finalize_rpath="$finalize_rpath $libdir"
2092 esac
2094 esac
2095 if test $linkmode = prog; then
2096 # We need to hardcode the library path
2097 if test -n "$shlibpath_var"; then
2098 # Make sure the rpath contains only unique directories.
2099 case "$temp_rpath " in
2100 *" $dir "*) ;;
2101 *" $absdir "*) ;;
2102 *) temp_rpath="$temp_rpath $dir" ;;
2103 esac
2106 fi # $linkmode,$pass = prog,link...
2108 if test "$alldeplibs" = yes &&
2109 { test "$deplibs_check_method" = pass_all ||
2110 { test "$build_libtool_libs" = yes &&
2111 test -n "$library_names"; }; }; then
2112 # We only need to search for static libraries
2113 continue
2116 if test "$installed" = no; then
2117 notinst_deplibs="$notinst_deplibs $lib"
2118 need_relink=yes
2121 if test -n "$old_archive_from_expsyms_cmds"; then
2122 # figure out the soname
2123 set dummy $library_names
2124 realname="$2"
2125 shift; shift
2126 libname=`eval \\$echo \"$libname_spec\"`
2127 # use dlname if we got it. it's perfectly good, no?
2128 if test -n "$dlname"; then
2129 soname="$dlname"
2130 elif test -n "$soname_spec"; then
2131 # bleh windows
2132 case $host in
2133 *cygwin*)
2134 major=`expr $current - $age`
2135 versuffix="-$major"
2137 esac
2138 eval soname=\"$soname_spec\"
2139 else
2140 soname="$realname"
2143 # Make a new name for the extract_expsyms_cmds to use
2144 soroot="$soname"
2145 soname=`echo $soroot | sed -e 's/^.*\///'`
2146 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2148 # If the library has no export list, then create one now
2149 if test -f "$output_objdir/$soname-def"; then :
2150 else
2151 $show "extracting exported symbol list from \`$soname'"
2152 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2153 cmds=$extract_expsyms_cmds
2154 for cmd in $cmds; do
2155 IFS="$save_ifs"
2156 eval cmd=\"$cmd\"
2157 $show "$cmd"
2158 $run eval "$cmd" || exit $?
2159 done
2160 IFS="$save_ifs"
2163 # Create $newlib
2164 if test -f "$output_objdir/$newlib"; then :; else
2165 $show "generating import library for \`$soname'"
2166 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2167 cmds=$old_archive_from_expsyms_cmds
2168 for cmd in $cmds; do
2169 IFS="$save_ifs"
2170 eval cmd=\"$cmd\"
2171 $show "$cmd"
2172 $run eval "$cmd" || exit $?
2173 done
2174 IFS="$save_ifs"
2176 # make sure the library variables are pointing to the new library
2177 dir=$output_objdir
2178 linklib=$newlib
2179 fi # test -n $old_archive_from_expsyms_cmds
2181 if test $linkmode = prog || test "$mode" != relink; then
2182 add_shlibpath=
2183 add_dir=
2184 add=
2185 lib_linked=yes
2186 case $hardcode_action in
2187 immediate | unsupported)
2188 if test "$hardcode_direct" = no; then
2189 add="$dir/$linklib"
2190 elif test "$hardcode_minus_L" = no; then
2191 case $host in
2192 *-*-sunos*) add_shlibpath="$dir" ;;
2193 esac
2194 add_dir="-L$dir"
2195 add="-l$name"
2196 elif test "$hardcode_shlibpath_var" = no; then
2197 add_shlibpath="$dir"
2198 add="-l$name"
2199 else
2200 lib_linked=no
2203 relink)
2204 if test "$hardcode_direct" = yes; then
2205 add="$dir/$linklib"
2206 elif test "$hardcode_minus_L" = yes; then
2207 add_dir="-L$dir"
2208 # Try looking first in the location we're being installed to.
2209 if test -n "$inst_prefix_dir"; then
2210 case "$libdir" in
2211 [\\/]*)
2212 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2214 esac
2216 add="-l$name"
2217 elif test "$hardcode_shlibpath_var" = yes; then
2218 add_shlibpath="$dir"
2219 add="-l$name"
2220 else
2221 lib_linked=no
2224 *) lib_linked=no ;;
2225 esac
2227 if test "$lib_linked" != yes; then
2228 $echo "$modename: configuration error: unsupported hardcode properties"
2229 exit 1
2232 if test -n "$add_shlibpath"; then
2233 case :$compile_shlibpath: in
2234 *":$add_shlibpath:"*) ;;
2235 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2236 esac
2238 if test $linkmode = prog; then
2239 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2240 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2241 else
2242 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2243 test -n "$add" && deplibs="$add $deplibs"
2244 if test "$hardcode_direct" != yes && \
2245 test "$hardcode_minus_L" != yes && \
2246 test "$hardcode_shlibpath_var" = yes; then
2247 case :$finalize_shlibpath: in
2248 *":$libdir:"*) ;;
2249 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2250 esac
2255 if test $linkmode = prog || test "$mode" = relink; then
2256 add_shlibpath=
2257 add_dir=
2258 add=
2259 # Finalize command for both is simple: just hardcode it.
2260 if test "$hardcode_direct" = yes; then
2261 add="$libdir/$linklib"
2262 elif test "$hardcode_minus_L" = yes; then
2263 add_dir="-L$libdir"
2264 add="-l$name"
2265 elif test "$hardcode_shlibpath_var" = yes; then
2266 case :$finalize_shlibpath: in
2267 *":$libdir:"*) ;;
2268 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2269 esac
2270 add="-l$name"
2271 else
2272 # We cannot seem to hardcode it, guess we'll fake it.
2273 add_dir="-L$libdir"
2274 # Try looking first in the location we're being installed to.
2275 if test -n "$inst_prefix_dir"; then
2276 case "$libdir" in
2277 [\\/]*)
2278 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2280 esac
2282 add="-l$name"
2285 if test $linkmode = prog; then
2286 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2287 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2288 else
2289 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2290 test -n "$add" && deplibs="$add $deplibs"
2293 elif test $linkmode = prog; then
2294 if test "$alldeplibs" = yes &&
2295 { test "$deplibs_check_method" = pass_all ||
2296 { test "$build_libtool_libs" = yes &&
2297 test -n "$library_names"; }; }; then
2298 # We only need to search for static libraries
2299 continue
2302 # Try to link the static library
2303 # Here we assume that one of hardcode_direct or hardcode_minus_L
2304 # is not unsupported. This is valid on all known static and
2305 # shared platforms.
2306 if test "$hardcode_direct" != unsupported; then
2307 test -n "$old_library" && linklib="$old_library"
2308 compile_deplibs="$dir/$linklib $compile_deplibs"
2309 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2310 else
2311 compile_deplibs="-l$name -L$dir $compile_deplibs"
2312 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2314 elif test "$build_libtool_libs" = yes; then
2315 # Not a shared library
2316 if test "$deplibs_check_method" != pass_all; then
2317 # We're trying link a shared library against a static one
2318 # but the system doesn't support it.
2320 # Just print a warning and add the library to dependency_libs so
2321 # that the program can be linked against the static library.
2322 echo
2323 echo "*** Warning: This library needs some functionality provided by $lib."
2324 echo "*** I have the capability to make that library automatically link in when"
2325 echo "*** you link to this library. But I can only do this if you have a"
2326 echo "*** shared version of the library, which you do not appear to have."
2327 if test "$module" = yes; then
2328 echo "*** Therefore, libtool will create a static module, that should work "
2329 echo "*** as long as the dlopening application is linked with the -dlopen flag."
2330 if test -z "$global_symbol_pipe"; then
2331 echo
2332 echo "*** However, this would only work if libtool was able to extract symbol"
2333 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2334 echo "*** not find such a program. So, this module is probably useless."
2335 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2337 if test "$build_old_libs" = no; then
2338 build_libtool_libs=module
2339 build_old_libs=yes
2340 else
2341 build_libtool_libs=no
2344 else
2345 convenience="$convenience $dir/$old_library"
2346 old_convenience="$old_convenience $dir/$old_library"
2347 deplibs="$dir/$old_library $deplibs"
2348 link_static=yes
2350 fi # link shared/static library?
2352 if test $linkmode = lib; then
2353 if test -n "$dependency_libs" &&
2354 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2355 test $link_static = yes; }; then
2356 # Extract -R from dependency_libs
2357 temp_deplibs=
2358 for libdir in $dependency_libs; do
2359 case $libdir in
2360 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2361 case " $xrpath " in
2362 *" $temp_xrpath "*) ;;
2363 *) xrpath="$xrpath $temp_xrpath";;
2364 esac;;
2365 *) temp_deplibs="$temp_deplibs $libdir";;
2366 esac
2367 done
2368 dependency_libs="$temp_deplibs"
2371 newlib_search_path="$newlib_search_path $absdir"
2372 # Link against this library
2373 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2374 # ... and its dependency_libs
2375 tmp_libs=
2376 for deplib in $dependency_libs; do
2377 newdependency_libs="$deplib $newdependency_libs"
2378 case "$tmp_libs " in
2379 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2380 esac
2381 tmp_libs="$tmp_libs $deplib"
2382 done
2384 if test $link_all_deplibs != no; then
2385 # Add the search paths of all dependency libraries
2386 for deplib in $dependency_libs; do
2387 case $deplib in
2388 -L*) path="$deplib" ;;
2389 *.la)
2390 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2391 test "X$dir" = "X$deplib" && dir="."
2392 # We need an absolute path.
2393 case $dir in
2394 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2396 absdir=`cd "$dir" && pwd`
2397 if test -z "$absdir"; then
2398 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2399 absdir="$dir"
2402 esac
2403 if grep "^installed=no" $deplib > /dev/null; then
2404 path="-L$absdir/$objdir"
2405 else
2406 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2407 if test -z "$libdir"; then
2408 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2409 exit 1
2411 if test "$absdir" != "$libdir"; then
2412 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2414 path="-L$absdir"
2417 *) continue ;;
2418 esac
2419 case " $deplibs " in
2420 *" $path "*) ;;
2421 *) deplibs="$path $deplibs" ;;
2422 esac
2423 done
2424 fi # link_all_deplibs != no
2425 fi # linkmode = lib
2426 done # for deplib in $libs
2427 if test $pass = dlpreopen; then
2428 # Link the dlpreopened libraries before other libraries
2429 for deplib in $save_deplibs; do
2430 deplibs="$deplib $deplibs"
2431 done
2433 if test $pass != dlopen; then
2434 test $pass != scan && dependency_libs="$newdependency_libs"
2435 if test $pass != conv; then
2436 # Make sure lib_search_path contains only unique directories.
2437 lib_search_path=
2438 for dir in $newlib_search_path; do
2439 case "$lib_search_path " in
2440 *" $dir "*) ;;
2441 *) lib_search_path="$lib_search_path $dir" ;;
2442 esac
2443 done
2444 newlib_search_path=
2447 if test "$linkmode,$pass" != "prog,link"; then
2448 vars="deplibs"
2449 else
2450 vars="compile_deplibs finalize_deplibs"
2452 for var in $vars dependency_libs; do
2453 # Add libraries to $var in reverse order
2454 eval tmp_libs=\"\$$var\"
2455 new_libs=
2456 for deplib in $tmp_libs; do
2457 case $deplib in
2458 -L*) new_libs="$deplib $new_libs" ;;
2460 case " $specialdeplibs " in
2461 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2463 case " $new_libs " in
2464 *" $deplib "*) ;;
2465 *) new_libs="$deplib $new_libs" ;;
2466 esac
2468 esac
2470 esac
2471 done
2472 tmp_libs=
2473 for deplib in $new_libs; do
2474 case $deplib in
2475 -L*)
2476 case " $tmp_libs " in
2477 *" $deplib "*) ;;
2478 *) tmp_libs="$tmp_libs $deplib" ;;
2479 esac
2481 *) tmp_libs="$tmp_libs $deplib" ;;
2482 esac
2483 done
2484 eval $var=\"$tmp_libs\"
2485 done # for var
2487 if test "$pass" = "conv" &&
2488 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2489 libs="$deplibs" # reset libs
2490 deplibs=
2492 done # for pass
2493 if test $linkmode = prog; then
2494 dlfiles="$newdlfiles"
2495 dlprefiles="$newdlprefiles"
2498 case $linkmode in
2499 oldlib)
2500 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2501 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2504 if test -n "$rpath"; then
2505 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2508 if test -n "$xrpath"; then
2509 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2512 if test -n "$vinfo"; then
2513 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2516 if test -n "$release"; then
2517 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2520 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2521 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2524 # Now set the variables for building old libraries.
2525 build_libtool_libs=no
2526 oldlibs="$output"
2527 objs="$objs$old_deplibs"
2530 lib)
2531 # Make sure we only generate libraries of the form `libNAME.la'.
2532 case $outputname in
2533 lib*)
2534 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2535 eval shared_ext=\"$shrext\"
2536 eval libname=\"$libname_spec\"
2539 if test "$module" = no; then
2540 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2541 $echo "$help" 1>&2
2542 exit 1
2544 if test "$need_lib_prefix" != no; then
2545 # Add the "lib" prefix for modules if required
2546 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2547 eval shared_ext=\"$shrext\"
2548 eval libname=\"$libname_spec\"
2549 else
2550 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2553 esac
2555 if test -n "$objs"; then
2556 if test "$deplibs_check_method" != pass_all; then
2557 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2558 exit 1
2559 else
2560 echo
2561 echo "*** Warning: Linking the shared library $output against the non-libtool"
2562 echo "*** objects $objs is not portable!"
2563 libobjs="$libobjs $objs"
2567 if test "$dlself" != no; then
2568 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2571 set dummy $rpath
2572 if test $# -gt 2; then
2573 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2575 install_libdir="$2"
2577 oldlibs=
2578 if test -z "$rpath"; then
2579 if test "$build_libtool_libs" = yes; then
2580 # Building a libtool convenience library.
2581 # Some compilers have problems with a `.al' extension so
2582 # convenience libraries should have the same extension an
2583 # archive normally would.
2584 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2585 build_libtool_libs=convenience
2586 build_old_libs=yes
2589 if test -n "$vinfo"; then
2590 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2593 if test -n "$release"; then
2594 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2596 else
2598 # Parse the version information argument.
2599 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2600 set dummy $vinfo 0 0 0
2601 IFS="$save_ifs"
2603 if test -n "$8"; then
2604 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2605 $echo "$help" 1>&2
2606 exit 1
2609 current="$2"
2610 revision="$3"
2611 age="$4"
2613 # Check that each of the things are valid numbers.
2614 case $current in
2615 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2617 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2618 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2619 exit 1
2621 esac
2623 case $revision in
2624 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2626 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2627 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2628 exit 1
2630 esac
2632 case $age in
2633 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2635 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2636 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2637 exit 1
2639 esac
2641 if test $age -gt $current; then
2642 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2643 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2644 exit 1
2647 # Calculate the version variables.
2648 major=
2649 versuffix=
2650 verstring=
2651 case $version_type in
2652 none) ;;
2654 darwin)
2655 # Like Linux, but with the current version available in
2656 # verstring for coding it into the library header
2657 major=.`expr $current - $age`
2658 versuffix="$major.$age.$revision"
2659 # Darwin ld doesn't like 0 for these options...
2660 minor_current=`expr $current + 1`
2661 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2664 freebsd-aout)
2665 major=".$current"
2666 versuffix=".$current.$revision";
2669 freebsd-elf)
2670 major=".$current"
2671 versuffix=".$current";
2674 irix)
2675 major=`expr $current - $age + 1`
2676 verstring="sgi$major.$revision"
2678 # Add in all the interfaces that we are compatible with.
2679 loop=$revision
2680 while test $loop != 0; do
2681 iface=`expr $revision - $loop`
2682 loop=`expr $loop - 1`
2683 verstring="sgi$major.$iface:$verstring"
2684 done
2686 # Before this point, $major must not contain `.'.
2687 major=.$major
2688 versuffix="$major.$revision"
2691 linux)
2692 major=.`expr $current - $age`
2693 versuffix="$major.$age.$revision"
2696 osf)
2697 major=.`expr $current - $age`
2698 versuffix=".$current.$age.$revision"
2699 verstring="$current.$age.$revision"
2701 # Add in all the interfaces that we are compatible with.
2702 loop=$age
2703 while test $loop != 0; do
2704 iface=`expr $current - $loop`
2705 loop=`expr $loop - 1`
2706 verstring="$verstring:${iface}.0"
2707 done
2709 # Make executables depend on our current version.
2710 verstring="$verstring:${current}.0"
2713 sunos)
2714 major=".$current"
2715 versuffix=".$current.$revision"
2718 windows)
2719 # Use '-' rather than '.', since we only want one
2720 # extension on DOS 8.3 filesystems.
2721 major=`expr $current - $age`
2722 versuffix="-$major"
2726 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2727 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2728 exit 1
2730 esac
2732 # Clear the version info if we defaulted, and they specified a release.
2733 if test -z "$vinfo" && test -n "$release"; then
2734 major=
2735 case $version_type in
2736 darwin)
2737 # we can't check for "0.0" in archive_cmds due to quoting
2738 # problems, so we reset it completely
2739 verstring=
2742 verstring="0.0"
2744 esac
2745 if test "$need_version" = no; then
2746 versuffix=
2747 else
2748 versuffix=".0.0"
2752 # Remove version info from name if versioning should be avoided
2753 if test "$avoid_version" = yes && test "$need_version" = no; then
2754 major=
2755 versuffix=
2756 verstring=""
2759 # Check to see if the archive will have undefined symbols.
2760 if test "$allow_undefined" = yes; then
2761 if test "$allow_undefined_flag" = unsupported; then
2762 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2763 build_libtool_libs=no
2764 build_old_libs=yes
2766 else
2767 # Don't allow undefined symbols.
2768 allow_undefined_flag="$no_undefined_flag"
2772 if test "$mode" != relink; then
2773 # Remove our outputs, but don't remove object files since they
2774 # may have been created when compiling PIC objects.
2775 removelist=
2776 tempremovelist=`echo "$output_objdir/*"`
2777 for p in $tempremovelist; do
2778 case $p in
2779 *.$objext)
2781 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2782 removelist="$removelist $p"
2784 *) ;;
2785 esac
2786 done
2787 if test -n "$removelist"; then
2788 $show "${rm}r $removelist"
2789 $run ${rm}r $removelist
2793 # Now set the variables for building old libraries.
2794 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2795 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2797 # Transform .lo files to .o files.
2798 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2801 # Eliminate all temporary directories.
2802 for path in $notinst_path; do
2803 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2804 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2805 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2806 done
2808 if test -n "$xrpath"; then
2809 # If the user specified any rpath flags, then add them.
2810 temp_xrpath=
2811 for libdir in $xrpath; do
2812 temp_xrpath="$temp_xrpath -R$libdir"
2813 case "$finalize_rpath " in
2814 *" $libdir "*) ;;
2815 *) finalize_rpath="$finalize_rpath $libdir" ;;
2816 esac
2817 done
2818 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2819 dependency_libs="$temp_xrpath $dependency_libs"
2823 # Make sure dlfiles contains only unique files that won't be dlpreopened
2824 old_dlfiles="$dlfiles"
2825 dlfiles=
2826 for lib in $old_dlfiles; do
2827 case " $dlprefiles $dlfiles " in
2828 *" $lib "*) ;;
2829 *) dlfiles="$dlfiles $lib" ;;
2830 esac
2831 done
2833 # Make sure dlprefiles contains only unique files
2834 old_dlprefiles="$dlprefiles"
2835 dlprefiles=
2836 for lib in $old_dlprefiles; do
2837 case "$dlprefiles " in
2838 *" $lib "*) ;;
2839 *) dlprefiles="$dlprefiles $lib" ;;
2840 esac
2841 done
2843 if test "$build_libtool_libs" = yes; then
2844 if test -n "$rpath"; then
2845 case $host in
2846 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2847 # these systems don't actually have a c library (as such)!
2849 *-*-rhapsody* | *-*-darwin1.[012])
2850 # Rhapsody C library is in the System framework
2851 deplibs="$deplibs -framework System"
2853 *-*-netbsd*)
2854 # Don't link with libc until the a.out ld.so is fixed.
2857 # Add libc to deplibs on all other systems if necessary.
2858 if test $build_libtool_need_lc = "yes"; then
2859 deplibs="$deplibs -lc"
2862 esac
2865 # Transform deplibs into only deplibs that can be linked in shared.
2866 name_save=$name
2867 libname_save=$libname
2868 release_save=$release
2869 versuffix_save=$versuffix
2870 major_save=$major
2871 # I'm not sure if I'm treating the release correctly. I think
2872 # release should show up in the -l (ie -lgmp5) so we don't want to
2873 # add it in twice. Is that correct?
2874 release=""
2875 versuffix=""
2876 major=""
2877 newdeplibs=
2878 droppeddeps=no
2879 case $deplibs_check_method in
2880 pass_all)
2881 # Don't check for shared/static. Everything works.
2882 # This might be a little naive. We might want to check
2883 # whether the library exists or not. But this is on
2884 # osf3 & osf4 and I'm not really sure... Just
2885 # implementing what was already the behaviour.
2886 newdeplibs=$deplibs
2888 test_compile)
2889 # This code stresses the "libraries are programs" paradigm to its
2890 # limits. Maybe even breaks it. We compile a program, linking it
2891 # against the deplibs as a proxy for the library. Then we can check
2892 # whether they linked in statically or dynamically with ldd.
2893 $rm conftest.c
2894 cat > conftest.c <<EOF
2895 int main() { return 0; }
2897 $rm conftest
2898 $LTCC -o conftest conftest.c $deplibs
2899 if test $? -eq 0 ; then
2900 ldd_output=`ldd conftest`
2901 for i in $deplibs; do
2902 name="`expr $i : '-l\(.*\)'`"
2903 # If $name is empty we are operating on a -L argument.
2904 if test -n "$name" && test "$name" != "0"; then
2905 libname=`eval \\$echo \"$libname_spec\"`
2906 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2907 set dummy $deplib_matches
2908 deplib_match=$2
2909 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2910 newdeplibs="$newdeplibs $i"
2911 else
2912 droppeddeps=yes
2913 echo
2914 echo "*** Warning: This library needs some functionality provided by $i."
2915 echo "*** I have the capability to make that library automatically link in when"
2916 echo "*** you link to this library. But I can only do this if you have a"
2917 echo "*** shared version of the library, which you do not appear to have."
2919 else
2920 newdeplibs="$newdeplibs $i"
2922 done
2923 else
2924 # Error occured in the first compile. Let's try to salvage the situation:
2925 # Compile a seperate program for each library.
2926 for i in $deplibs; do
2927 name="`expr $i : '-l\(.*\)'`"
2928 # If $name is empty we are operating on a -L argument.
2929 if test -n "$name" && test "$name" != "0"; then
2930 $rm conftest
2931 $LTCC -o conftest conftest.c $i
2932 # Did it work?
2933 if test $? -eq 0 ; then
2934 ldd_output=`ldd conftest`
2935 libname=`eval \\$echo \"$libname_spec\"`
2936 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2937 set dummy $deplib_matches
2938 deplib_match=$2
2939 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2940 newdeplibs="$newdeplibs $i"
2941 else
2942 droppeddeps=yes
2943 echo
2944 echo "*** Warning: This library needs some functionality provided by $i."
2945 echo "*** I have the capability to make that library automatically link in when"
2946 echo "*** you link to this library. But I can only do this if you have a"
2947 echo "*** shared version of the library, which you do not appear to have."
2949 else
2950 droppeddeps=yes
2951 echo
2952 echo "*** Warning! Library $i is needed by this library but I was not able to"
2953 echo "*** make it link in! You will probably need to install it or some"
2954 echo "*** library that it depends on before this library will be fully"
2955 echo "*** functional. Installing it before continuing would be even better."
2957 else
2958 newdeplibs="$newdeplibs $i"
2960 done
2963 file_magic*)
2964 set dummy $deplibs_check_method
2965 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2966 for a_deplib in $deplibs; do
2967 name="`expr $a_deplib : '-l\(.*\)'`"
2968 # If $name is empty we are operating on a -L argument.
2969 if test -n "$name" && test "$name" != "0"; then
2970 libname=`eval \\$echo \"$libname_spec\"`
2971 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2972 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2973 for potent_lib in $potential_libs; do
2974 # Follow soft links.
2975 if ls -lLd "$potent_lib" 2>/dev/null \
2976 | grep " -> " >/dev/null; then
2977 continue
2979 # The statement above tries to avoid entering an
2980 # endless loop below, in case of cyclic links.
2981 # We might still enter an endless loop, since a link
2982 # loop can be closed while we follow links,
2983 # but so what?
2984 potlib="$potent_lib"
2985 while test -h "$potlib" 2>/dev/null; do
2986 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2987 case $potliblink in
2988 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2989 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2990 esac
2991 done
2992 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2993 | sed 10q \
2994 | egrep "$file_magic_regex" > /dev/null; then
2995 newdeplibs="$newdeplibs $a_deplib"
2996 a_deplib=""
2997 break 2
2999 done
3000 done
3001 if test -n "$a_deplib" ; then
3002 droppeddeps=yes
3003 echo
3004 echo "*** Warning: This library needs some functionality provided by $a_deplib."
3005 echo "*** I have the capability to make that library automatically link in when"
3006 echo "*** you link to this library. But I can only do this if you have a"
3007 echo "*** shared version of the library, which you do not appear to have."
3009 else
3010 # Add a -L argument.
3011 newdeplibs="$newdeplibs $a_deplib"
3013 done # Gone through all deplibs.
3015 match_pattern*)
3016 set dummy $deplibs_check_method
3017 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3018 for a_deplib in $deplibs; do
3019 name="`expr $a_deplib : '-l\(.*\)'`"
3020 # If $name is empty we are operating on a -L argument.
3021 if test -n "$name" && test "$name" != "0"; then
3022 libname=`eval \\$echo \"$libname_spec\"`
3023 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3024 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3025 for potent_lib in $potential_libs; do
3026 if eval echo \"$potent_lib\" 2>/dev/null \
3027 | sed 10q \
3028 | egrep "$match_pattern_regex" > /dev/null; then
3029 newdeplibs="$newdeplibs $a_deplib"
3030 a_deplib=""
3031 break 2
3033 done
3034 done
3035 if test -n "$a_deplib" ; then
3036 droppeddeps=yes
3037 echo
3038 echo "*** Warning: This library needs some functionality provided by $a_deplib."
3039 echo "*** I have the capability to make that library automatically link in when"
3040 echo "*** you link to this library. But I can only do this if you have a"
3041 echo "*** shared version of the library, which you do not appear to have."
3043 else
3044 # Add a -L argument.
3045 newdeplibs="$newdeplibs $a_deplib"
3047 done # Gone through all deplibs.
3049 none | unknown | *)
3050 newdeplibs=""
3051 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3052 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
3053 grep . >/dev/null; then
3054 echo
3055 if test "X$deplibs_check_method" = "Xnone"; then
3056 echo "*** Warning: inter-library dependencies are not supported in this platform."
3057 else
3058 echo "*** Warning: inter-library dependencies are not known to be supported."
3060 echo "*** All declared inter-library dependencies are being dropped."
3061 droppeddeps=yes
3064 esac
3065 versuffix=$versuffix_save
3066 major=$major_save
3067 release=$release_save
3068 libname=$libname_save
3069 name=$name_save
3071 case $host in
3072 *-*-rhapsody* | *-*-darwin1.[012])
3073 # On Rhapsody replace the C library is the System framework
3074 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3076 esac
3078 if test "$droppeddeps" = yes; then
3079 if test "$module" = yes; then
3080 echo
3081 echo "*** Warning: libtool could not satisfy all declared inter-library"
3082 echo "*** dependencies of module $libname. Therefore, libtool will create"
3083 echo "*** a static module, that should work as long as the dlopening"
3084 echo "*** application is linked with the -dlopen flag."
3085 if test -z "$global_symbol_pipe"; then
3086 echo
3087 echo "*** However, this would only work if libtool was able to extract symbol"
3088 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3089 echo "*** not find such a program. So, this module is probably useless."
3090 echo "*** \`nm' from GNU binutils and a full rebuild may help."
3092 if test "$build_old_libs" = no; then
3093 oldlibs="$output_objdir/$libname.$libext"
3094 build_libtool_libs=module
3095 build_old_libs=yes
3096 else
3097 build_libtool_libs=no
3099 else
3100 echo "*** The inter-library dependencies that have been dropped here will be"
3101 echo "*** automatically added whenever a program is linked with this library"
3102 echo "*** or is declared to -dlopen it."
3104 if test $allow_undefined = no; then
3105 echo
3106 echo "*** Since this library must not contain undefined symbols,"
3107 echo "*** because either the platform does not support them or"
3108 echo "*** it was explicitly requested with -no-undefined,"
3109 echo "*** libtool will only create a static version of it."
3110 if test "$build_old_libs" = no; then
3111 oldlibs="$output_objdir/$libname.$libext"
3112 build_libtool_libs=module
3113 build_old_libs=yes
3114 else
3115 build_libtool_libs=no
3120 # Time to change all our "foo.framework" stuff back to "-framework foo"
3121 case $host in
3122 *-*-darwin*)
3123 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3124 dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3126 esac
3127 # Done checking deplibs!
3128 # Done checking deplibs!
3129 deplibs=$newdeplibs
3132 # All the library-specific variables (install_libdir is set above).
3133 library_names=
3134 old_library=
3135 dlname=
3137 # Test again, we may have decided not to build it any more
3138 if test "$build_libtool_libs" = yes; then
3139 if test $hardcode_into_libs = yes; then
3140 # Hardcode the library paths
3141 hardcode_libdirs=
3142 dep_rpath=
3143 rpath="$finalize_rpath"
3144 test "$mode" != relink && rpath="$compile_rpath$rpath"
3145 for libdir in $rpath; do
3146 if test -n "$hardcode_libdir_flag_spec"; then
3147 if test -n "$hardcode_libdir_separator"; then
3148 if test -z "$hardcode_libdirs"; then
3149 hardcode_libdirs="$libdir"
3150 else
3151 # Just accumulate the unique libdirs.
3152 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3153 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3156 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3158 esac
3160 else
3161 eval flag=\"$hardcode_libdir_flag_spec\"
3162 dep_rpath="$dep_rpath $flag"
3164 elif test -n "$runpath_var"; then
3165 case "$perm_rpath " in
3166 *" $libdir "*) ;;
3167 *) perm_rpath="$perm_rpath $libdir" ;;
3168 esac
3170 done
3171 # Substitute the hardcoded libdirs into the rpath.
3172 if test -n "$hardcode_libdir_separator" &&
3173 test -n "$hardcode_libdirs"; then
3174 libdir="$hardcode_libdirs"
3175 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3177 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3178 # We should set the runpath_var.
3179 rpath=
3180 for dir in $perm_rpath; do
3181 rpath="$rpath$dir:"
3182 done
3183 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3185 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3188 shlibpath="$finalize_shlibpath"
3189 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3190 if test -n "$shlibpath"; then
3191 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3194 # Get the real and link names of the library.
3195 eval library_names=\"$library_names_spec\"
3196 eval shared_ext=\"$shrext\"
3197 set dummy $library_names
3198 realname="$2"
3199 shift; shift
3201 if test -n "$soname_spec"; then
3202 eval soname=\"$soname_spec\"
3203 else
3204 soname="$realname"
3206 test -z "$dlname" && dlname=$soname
3208 lib="$output_objdir/$realname"
3209 for link
3211 linknames="$linknames $link"
3212 done
3214 # # Ensure that we have .o objects for linkers which dislike .lo
3215 # # (e.g. aix) in case we are running --disable-static
3216 # for obj in $libobjs; do
3217 # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3218 # if test "X$xdir" = "X$obj"; then
3219 # xdir="."
3220 # else
3221 # xdir="$xdir"
3222 # fi
3223 # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3224 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3225 # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
3226 # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3227 # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3228 # fi
3229 # done
3231 # Use standard objects if they are pic
3232 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3234 # Prepare the list of exported symbols
3235 if test -z "$export_symbols"; then
3236 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3237 $show "generating symbol list for \`$libname.la'"
3238 export_symbols="$output_objdir/$libname.exp"
3239 $run $rm $export_symbols
3240 eval cmds=\"$export_symbols_cmds\"
3241 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3242 for cmd in $cmds; do
3243 IFS="$save_ifs"
3244 $show "$cmd"
3245 $run eval "$cmd" || exit $?
3246 done
3247 IFS="$save_ifs"
3248 if test -n "$export_symbols_regex"; then
3249 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3250 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3251 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3252 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3257 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3258 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3261 if test -n "$convenience"; then
3262 if test -n "$whole_archive_flag_spec"; then
3263 save_libobjs=$libobjs
3264 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3265 else
3266 gentop="$output_objdir/${outputname}x"
3267 $show "${rm}r $gentop"
3268 $run ${rm}r "$gentop"
3269 $show "$mkdir $gentop"
3270 $run $mkdir "$gentop"
3271 status=$?
3272 if test $status -ne 0 && test ! -d "$gentop"; then
3273 exit $status
3275 generated="$generated $gentop"
3277 for xlib in $convenience; do
3278 # Extract the objects.
3279 case $xlib in
3280 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3281 *) xabs=`pwd`"/$xlib" ;;
3282 esac
3283 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3284 xdir="$gentop/$xlib"
3286 $show "${rm}r $xdir"
3287 $run ${rm}r "$xdir"
3288 $show "$mkdir $xdir"
3289 $run $mkdir "$xdir"
3290 status=$?
3291 if test $status -ne 0 && test ! -d "$xdir"; then
3292 exit $status
3294 $show "(cd $xdir && $AR x $xabs)"
3295 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3297 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3298 done
3302 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3303 eval flag=\"$thread_safe_flag_spec\"
3304 linker_flags="$linker_flags $flag"
3307 # Make a backup of the uninstalled library when relinking
3308 if test "$mode" = relink; then
3309 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3312 # Do each of the archive commands.
3313 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3314 eval test_cmds=\"$archive_expsym_cmds\"
3315 cmds=$archive_expsym_cmds
3316 else
3317 eval test_cmds=\"$archive_cmds\"
3318 cmds=$archive_cmds
3320 if len=`expr "X$test_cmds" : ".*"` &&
3321 test $len -le $max_cmd_len; then
3323 else
3324 # The command line is too long to link in one step, link piecewise.
3326 # Save the value of $output and $libobjs because we want to
3327 # use them later. If we have whole_archive_flag_spec, we
3328 # want to use save_libobjs as it was before
3329 # whole_archive_flag_spec was expanded, because we can't
3330 # assume the linker understands whole_archive_flag_spec.
3331 # This may have to be revisited, in case too many
3332 # convenience libraries get linked in and end up exceeding
3333 # the spec.
3334 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3335 save_libobjs=$libobjs
3337 save_output=$output
3338 output_la=`$echo "X$output" | $Xsed -e "s,^.*/,,"`
3340 # Clear the reloadable object creation command queue and
3341 # initialize k to one.
3342 test_cmds=
3343 concat_cmds=
3344 objlist=
3345 delfiles=
3346 last_robj=
3349 if test "$with_gnu_ld" = yes; then
3350 output=${output_objdir}/${output_la}.lnkscript
3351 $echo "creating GNU ld script: $output"
3352 $echo 'INPUT (' > $output
3353 for obj in $save_libobjs
3355 $echo \""$obj"\" >> $output
3356 done
3357 $echo ')' >> $output
3358 delfiles="$delfiles $output"
3359 elif test "X$file_list_spec" != X; then
3360 output=${output_objdir}/${output_la}.lnk
3361 $echo "creating linker input file list: $output"
3362 : > $output
3363 for obj in $save_libobjs
3365 $echo "$obj" >> $output
3366 done
3367 delfiles="$delfiles $output"
3368 output=\"$file_list_spec$output\"
3369 else
3370 $echo "creating reloadable object files..."
3371 output=$output_objdir/$save_output-${k}.$objext
3372 # Loop over the list of objects to be linked.
3373 for obj in $save_libobjs
3375 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3376 if test "X$objlist" = X ||
3377 { len=`expr "X$test_cmds" : ".*"` &&
3378 test $len -le $max_cmd_len; }; then
3379 objlist="$objlist $obj"
3380 else
3381 # The command $test_cmds is almost too long, add a
3382 # command to the queue.
3383 if test $k -eq 1 ; then
3384 # The first file doesn't have a previous command to add.
3385 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3386 else
3387 # All subsequent reloadable object files will link in
3388 # the last one created.
3389 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3391 last_robj=$output_objdir/$save_output-${k}.$objext
3392 k=`expr $k + 1`
3393 output=$output_objdir/$save_output-${k}.$objext
3394 objlist=$obj
3395 len=1
3397 done
3398 # Handle the remaining objects by creating one last
3399 # reloadable object file. All subsequent reloadable object
3400 # files will link in the last one created.
3401 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3402 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3404 # Set up a command to remove the reloadale object files
3405 # after they are used.
3407 while test $i -lt $k
3409 i=`expr $i + 1`
3410 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3411 done
3413 $echo "creating a temporary reloadable object file: $output"
3415 # Loop through the commands generated above and execute them.
3416 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3417 for cmd in $concat_cmds; do
3418 IFS="$save_ifs"
3419 eval cmd=\"$cmd\"
3420 $show "$cmd"
3421 $run eval "$cmd" || exit $?
3422 done
3423 IFS="$save_ifs"
3426 libobjs=$output
3427 # Restore the value of output.
3428 output=$save_output
3430 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3431 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3433 # Expand the library linking commands again to reset the
3434 # value of $libobjs for piecewise linking.
3436 # Do each of the archive commands.
3437 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3438 cmds=$archive_expsym_cmds
3439 else
3440 cmds=$archive_cmds
3443 # Append the command to remove the reloadable object files
3444 # to the just-reset $cmds.
3445 eval cmds=\"\$cmds~$rm $delfiles\"
3447 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3448 for cmd in $cmds; do
3449 IFS="$save_ifs"
3450 eval cmd=\"$cmd\"
3451 $show "$cmd"
3452 $run eval "$cmd" || exit $?
3453 done
3454 IFS="$save_ifs"
3456 # Restore the uninstalled library and exit
3457 if test "$mode" = relink; then
3458 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3459 exit 0
3462 # Create links to the real library.
3463 for linkname in $linknames; do
3464 if test "$realname" != "$linkname"; then
3465 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3466 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3468 done
3470 # If -module or -export-dynamic was specified, set the dlname.
3471 if test "$module" = yes || test "$export_dynamic" = yes; then
3472 # On all known operating systems, these are identical.
3473 dlname="$soname"
3478 obj)
3479 if test -n "$deplibs"; then
3480 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3483 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3484 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3487 if test -n "$rpath"; then
3488 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3491 if test -n "$xrpath"; then
3492 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3495 if test -n "$vinfo"; then
3496 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3499 if test -n "$release"; then
3500 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3503 case $output in
3504 *.lo)
3505 if test -n "$objs$old_deplibs"; then
3506 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3507 exit 1
3509 libobj="$output"
3510 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3513 libobj=
3514 obj="$output"
3516 esac
3518 # Delete the old objects.
3519 $run $rm $obj $libobj
3521 # Objects from convenience libraries. This assumes
3522 # single-version convenience libraries. Whenever we create
3523 # different ones for PIC/non-PIC, this we'll have to duplicate
3524 # the extraction.
3525 reload_conv_objs=
3526 gentop=
3527 # reload_cmds runs $LD directly, so let us get rid of
3528 # -Wl from whole_archive_flag_spec
3531 if test -n "$convenience"; then
3532 if test -n "$whole_archive_flag_spec"; then
3533 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3534 else
3535 gentop="$output_objdir/${obj}x"
3536 $show "${rm}r $gentop"
3537 $run ${rm}r "$gentop"
3538 $show "$mkdir $gentop"
3539 $run $mkdir "$gentop"
3540 status=$?
3541 if test $status -ne 0 && test ! -d "$gentop"; then
3542 exit $status
3544 generated="$generated $gentop"
3546 for xlib in $convenience; do
3547 # Extract the objects.
3548 case $xlib in
3549 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3550 *) xabs=`pwd`"/$xlib" ;;
3551 esac
3552 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3553 xdir="$gentop/$xlib"
3555 $show "${rm}r $xdir"
3556 $run ${rm}r "$xdir"
3557 $show "$mkdir $xdir"
3558 $run $mkdir "$xdir"
3559 status=$?
3560 if test $status -ne 0 && test ! -d "$xdir"; then
3561 exit $status
3563 $show "(cd $xdir && $AR x $xabs)"
3564 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3566 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3567 done
3571 # Create the old-style object.
3572 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
3574 output="$obj"
3575 eval cmds=\"$reload_cmds\"
3576 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3577 for cmd in $cmds; do
3578 IFS="$save_ifs"
3579 $show "$cmd"
3580 $run eval "$cmd" || exit $?
3581 done
3582 IFS="$save_ifs"
3584 # Exit if we aren't doing a library object file.
3585 if test -z "$libobj"; then
3586 if test -n "$gentop"; then
3587 $show "${rm}r $gentop"
3588 $run ${rm}r $gentop
3591 exit 0
3594 if test "$build_libtool_libs" != yes; then
3595 if test -n "$gentop"; then
3596 $show "${rm}r $gentop"
3597 $run ${rm}r $gentop
3600 # Create an invalid libtool object if no PIC, so that we don't
3601 # accidentally link it into a program.
3602 # $show "echo timestamp > $libobj"
3603 # $run eval "echo timestamp > $libobj" || exit $?
3604 exit 0
3607 if test -n "$pic_flag" || test "$pic_mode" != default; then
3608 # Only do commands if we really have different PIC objects.
3609 reload_objs="$libobjs $reload_conv_objs"
3610 output="$libobj"
3611 eval cmds=\"$reload_cmds\"
3612 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3613 for cmd in $cmds; do
3614 IFS="$save_ifs"
3615 $show "$cmd"
3616 $run eval "$cmd" || exit $?
3617 done
3618 IFS="$save_ifs"
3619 # else
3620 # # Just create a symlink.
3621 # $show $rm $libobj
3622 # $run $rm $libobj
3623 # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3624 # if test "X$xdir" = "X$libobj"; then
3625 # xdir="."
3626 # else
3627 # xdir="$xdir"
3628 # fi
3629 # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3630 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3631 # $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3632 # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3635 if test -n "$gentop"; then
3636 $show "${rm}r $gentop"
3637 $run ${rm}r $gentop
3640 exit 0
3643 prog)
3644 case $host in
3645 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3646 esac
3647 if test -n "$vinfo"; then
3648 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3651 if test -n "$release"; then
3652 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3655 if test "$preload" = yes; then
3656 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3657 test "$dlopen_self_static" = unknown; then
3658 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3662 case $host in
3663 *-*-rhapsody* | *-*-darwin1.[012])
3664 # On Rhapsody replace the C library is the System framework
3665 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3666 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3668 esac
3670 case $host in
3671 *-*-darwin*)
3672 # Don't allow lazy linking, it breaks C++ global constructors
3673 if test "$tagname" = CXX ; then
3674 compile_command="$compile_command ${wl}-bind_at_load"
3675 finalize_command="$finalize_command ${wl}-bind_at_load"
3677 # Time to change all our "foo.framework" stuff back to "-framework foo"
3678 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3679 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
3681 esac
3683 compile_command="$compile_command $compile_deplibs"
3684 finalize_command="$finalize_command $finalize_deplibs"
3686 if test -n "$rpath$xrpath"; then
3687 # If the user specified any rpath flags, then add them.
3688 for libdir in $rpath $xrpath; do
3689 # This is the magic to use -rpath.
3690 case "$finalize_rpath " in
3691 *" $libdir "*) ;;
3692 *) finalize_rpath="$finalize_rpath $libdir" ;;
3693 esac
3694 done
3697 # Now hardcode the library paths
3698 rpath=
3699 hardcode_libdirs=
3700 for libdir in $compile_rpath; do
3701 if test -n "$hardcode_libdir_flag_spec"; then
3702 if test -n "$hardcode_libdir_separator"; then
3703 if test -z "$hardcode_libdirs"; then
3704 hardcode_libdirs="$libdir"
3705 else
3706 # Just accumulate the unique libdirs.
3707 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3708 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3711 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3713 esac
3715 else
3716 eval flag=\"$hardcode_libdir_flag_spec\"
3717 rpath="$rpath $flag"
3719 elif test -n "$runpath_var"; then
3720 case "$perm_rpath " in
3721 *" $libdir "*) ;;
3722 *) perm_rpath="$perm_rpath $libdir" ;;
3723 esac
3725 case $host in
3726 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3727 case :$dllsearchpath: in
3728 *":$libdir:"*) ;;
3729 *) dllsearchpath="$dllsearchpath:$libdir";;
3730 esac
3732 esac
3733 done
3734 # Substitute the hardcoded libdirs into the rpath.
3735 if test -n "$hardcode_libdir_separator" &&
3736 test -n "$hardcode_libdirs"; then
3737 libdir="$hardcode_libdirs"
3738 eval rpath=\" $hardcode_libdir_flag_spec\"
3740 compile_rpath="$rpath"
3742 rpath=
3743 hardcode_libdirs=
3744 for libdir in $finalize_rpath; do
3745 if test -n "$hardcode_libdir_flag_spec"; then
3746 if test -n "$hardcode_libdir_separator"; then
3747 if test -z "$hardcode_libdirs"; then
3748 hardcode_libdirs="$libdir"
3749 else
3750 # Just accumulate the unique libdirs.
3751 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3752 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3755 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3757 esac
3759 else
3760 eval flag=\"$hardcode_libdir_flag_spec\"
3761 rpath="$rpath $flag"
3763 elif test -n "$runpath_var"; then
3764 case "$finalize_perm_rpath " in
3765 *" $libdir "*) ;;
3766 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3767 esac
3769 done
3770 # Substitute the hardcoded libdirs into the rpath.
3771 if test -n "$hardcode_libdir_separator" &&
3772 test -n "$hardcode_libdirs"; then
3773 libdir="$hardcode_libdirs"
3774 eval rpath=\" $hardcode_libdir_flag_spec\"
3776 finalize_rpath="$rpath"
3778 dlsyms=
3779 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3780 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3781 dlsyms="${outputname}S.c"
3782 else
3783 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3787 if test -n "$dlsyms"; then
3788 case $dlsyms in
3789 "") ;;
3790 *.c)
3791 # Discover the nlist of each of the dlfiles.
3792 nlist="$output_objdir/${outputname}.nm"
3794 $show "$rm $nlist ${nlist}S ${nlist}T"
3795 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3797 # Parse the name list into a source file.
3798 $show "creating $output_objdir/$dlsyms"
3800 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3801 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3802 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3804 #ifdef __cplusplus
3805 extern \"C\" {
3806 #endif
3808 /* Prevent the only kind of declaration conflicts we can make. */
3809 #define lt_preloaded_symbols some_other_symbol
3811 /* External symbol declarations for the compiler. */\
3814 if test "$dlself" = yes; then
3815 $show "generating symbol list for \`$output'"
3817 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3819 # Add our own program objects to the symbol list.
3820 progfiles="$objs$old_deplibs"
3821 for arg in $progfiles; do
3822 $show "extracting global C symbols from \`$arg'"
3823 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3824 done
3826 if test -n "$exclude_expsyms"; then
3827 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3828 $run eval '$mv "$nlist"T "$nlist"'
3831 if test -n "$export_symbols_regex"; then
3832 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3833 $run eval '$mv "$nlist"T "$nlist"'
3836 # Prepare the list of exported symbols
3837 if test -z "$export_symbols"; then
3838 export_symbols="$output_objdir/$output.exp"
3839 $run $rm $export_symbols
3840 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3841 else
3842 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3843 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3844 $run eval 'mv "$nlist"T "$nlist"'
3848 for arg in $dlprefiles; do
3849 $show "extracting global C symbols from \`$arg'"
3850 name=`echo "$arg" | sed -e 's%^.*/%%'`
3851 $run eval 'echo ": $name " >> "$nlist"'
3852 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3853 done
3855 if test -z "$run"; then
3856 # Make sure we have at least an empty file.
3857 test -f "$nlist" || : > "$nlist"
3859 if test -n "$exclude_expsyms"; then
3860 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3861 $mv "$nlist"T "$nlist"
3864 # Try sorting and uniquifying the output.
3865 if grep -v "^: " < "$nlist" |
3866 if sort -k 3 </dev/null >/dev/null 2>&1; then
3867 sort -k 3
3868 else
3869 sort +2
3870 fi |
3871 uniq > "$nlist"S; then
3873 else
3874 grep -v "^: " < "$nlist" > "$nlist"S
3877 if test -f "$nlist"S; then
3878 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3879 else
3880 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3883 $echo >> "$output_objdir/$dlsyms" "\
3885 #undef lt_preloaded_symbols
3887 #if defined (__STDC__) && __STDC__
3888 # define lt_ptr_t void *
3889 #else
3890 # define lt_ptr_t char *
3891 # define const
3892 #endif
3894 /* The mapping between symbol names and symbols. */
3895 const struct {
3896 const char *name;
3897 lt_ptr_t address;
3899 lt_preloaded_symbols[] =
3903 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3904 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3905 < "$nlist" >> "$output_objdir/$dlsyms"
3907 $echo >> "$output_objdir/$dlsyms" "\
3908 {0, (lt_ptr_t) 0}
3911 /* This works around a problem in FreeBSD linker */
3912 #ifdef FREEBSD_WORKAROUND
3913 static const void *lt_preloaded_setup() {
3914 return lt_preloaded_symbols;
3916 #endif
3918 #ifdef __cplusplus
3920 #endif\
3924 pic_flag_for_symtable=
3925 case $host in
3926 # compiling the symbol table file with pic_flag works around
3927 # a FreeBSD bug that causes programs to crash when -lm is
3928 # linked before any other PIC object. But we must not use
3929 # pic_flag when linking with -static. The problem exists in
3930 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3931 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3932 case "$compile_command " in
3933 *" -static "*) ;;
3934 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3935 esac;;
3936 *-*-hpux*)
3937 case "$compile_command " in
3938 *" -static "*) ;;
3939 *) pic_flag_for_symtable=" $pic_flag";;
3940 esac
3941 esac
3943 # Now compile the dynamic symbol file.
3944 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3945 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3947 # Clean up the generated files.
3948 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3949 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3951 # Transform the symbol file into the correct name.
3952 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3953 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3956 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3957 exit 1
3959 esac
3960 else
3961 # We keep going just in case the user didn't refer to
3962 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3963 # really was required.
3965 # Nullify the symbol file.
3966 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3967 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3970 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3971 # Replace the output file specification.
3972 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3973 link_command="$compile_command$compile_rpath"
3975 # We have no uninstalled library dependencies, so finalize right now.
3976 $show "$link_command"
3977 $run eval "$link_command"
3978 status=$?
3980 # Delete the generated files.
3981 if test -n "$dlsyms"; then
3982 $show "$rm $output_objdir/${outputname}S.${objext}"
3983 $run $rm "$output_objdir/${outputname}S.${objext}"
3986 exit $status
3989 if test -n "$shlibpath_var"; then
3990 # We should set the shlibpath_var
3991 rpath=
3992 for dir in $temp_rpath; do
3993 case $dir in
3994 [\\/]* | [A-Za-z]:[\\/]*)
3995 # Absolute path.
3996 rpath="$rpath$dir:"
3999 # Relative path: add a thisdir entry.
4000 rpath="$rpath\$thisdir/$dir:"
4002 esac
4003 done
4004 temp_rpath="$rpath"
4007 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4008 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4010 if test -n "$finalize_shlibpath"; then
4011 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4014 compile_var=
4015 finalize_var=
4016 if test -n "$runpath_var"; then
4017 if test -n "$perm_rpath"; then
4018 # We should set the runpath_var.
4019 rpath=
4020 for dir in $perm_rpath; do
4021 rpath="$rpath$dir:"
4022 done
4023 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4025 if test -n "$finalize_perm_rpath"; then
4026 # We should set the runpath_var.
4027 rpath=
4028 for dir in $finalize_perm_rpath; do
4029 rpath="$rpath$dir:"
4030 done
4031 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4035 if test "$no_install" = yes; then
4036 # We don't need to create a wrapper script.
4037 link_command="$compile_var$compile_command$compile_rpath"
4038 # Replace the output file specification.
4039 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4040 # Delete the old output file.
4041 $run $rm $output
4042 # Link the executable and exit
4043 $show "$link_command"
4044 $run eval "$link_command" || exit $?
4045 exit 0
4048 if test "$hardcode_action" = relink; then
4049 # Fast installation is not supported
4050 link_command="$compile_var$compile_command$compile_rpath"
4051 relink_command="$finalize_var$finalize_command$finalize_rpath"
4053 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4054 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4055 else
4056 if test "$fast_install" != no; then
4057 link_command="$finalize_var$compile_command$finalize_rpath"
4058 if test "$fast_install" = yes; then
4059 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4060 else
4061 # fast_install is set to needless
4062 relink_command=
4064 else
4065 link_command="$compile_var$compile_command$compile_rpath"
4066 relink_command="$finalize_var$finalize_command$finalize_rpath"
4070 # Replace the output file specification.
4071 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4073 # Delete the old output files.
4074 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4076 $show "$link_command"
4077 $run eval "$link_command" || exit $?
4079 # Now create the wrapper script.
4080 $show "creating $output"
4082 # Quote the relink command for shipping.
4083 if test -n "$relink_command"; then
4084 # Preserve any variables that may affect compiler behavior
4085 for var in $variables_saved_for_relink; do
4086 if eval test -z \"\${$var+set}\"; then
4087 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4088 elif eval var_value=\$$var; test -z "$var_value"; then
4089 relink_command="$var=; export $var; $relink_command"
4090 else
4091 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4092 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4094 done
4095 relink_command="cd `pwd`; $relink_command"
4096 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4099 # Quote $echo for shipping.
4100 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4101 case $0 in
4102 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4103 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4104 esac
4105 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4106 else
4107 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4110 # Only actually do things if our run command is non-null.
4111 if test -z "$run"; then
4112 # win32 will think the script is a binary if it has
4113 # a .exe suffix, so we strip it off here.
4114 case $output in
4115 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
4116 esac
4117 # test for cygwin because mv fails w/o .exe extensions
4118 case $host in
4119 *cygwin*) exeext=.exe ;;
4120 *) exeext= ;;
4121 esac
4122 $rm $output
4123 trap "$rm $output; exit 1" 1 2 15
4125 $echo > $output "\
4126 #! $SHELL
4128 # $output - temporary wrapper script for $objdir/$outputname
4129 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4131 # The $output program cannot be directly executed until all the libtool
4132 # libraries that it depends on are installed.
4134 # This wrapper script should never be moved out of the build directory.
4135 # If it is, it will not operate correctly.
4137 # Sed substitution that helps us do robust quoting. It backslashifies
4138 # metacharacters that are still active within double-quoted strings.
4139 Xsed='sed -e 1s/^X//'
4140 sed_quote_subst='$sed_quote_subst'
4142 # The HP-UX ksh and POSIX shell print the target directory to stdout
4143 # if CDPATH is set.
4144 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4146 relink_command=\"$relink_command\"
4148 # This environment variable determines our operation mode.
4149 if test \"\$libtool_install_magic\" = \"$magic\"; then
4150 # install mode needs the following variable:
4151 notinst_deplibs='$notinst_deplibs'
4152 else
4153 # When we are sourced in execute mode, \$file and \$echo are already set.
4154 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4155 echo=\"$qecho\"
4156 file=\"\$0\"
4157 # Make sure echo works.
4158 if test \"X\$1\" = X--no-reexec; then
4159 # Discard the --no-reexec flag, and continue.
4160 shift
4161 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4162 # Yippee, \$echo works!
4164 else
4165 # Restart under the correct shell, and then maybe \$echo will work.
4166 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4170 $echo >> $output "\
4172 # Find the directory that this script lives in.
4173 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4174 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4176 # Follow symbolic links until we get to the real thisdir.
4177 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
4178 while test -n \"\$file\"; do
4179 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4181 # If there was a directory component, then change thisdir.
4182 if test \"x\$destdir\" != \"x\$file\"; then
4183 case \"\$destdir\" in
4184 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4185 *) thisdir=\"\$thisdir/\$destdir\" ;;
4186 esac
4189 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4190 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
4191 done
4193 # Try to get the absolute directory name.
4194 absdir=\`cd \"\$thisdir\" && pwd\`
4195 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4198 if test "$fast_install" = yes; then
4199 echo >> $output "\
4200 program=lt-'$outputname'$exeext
4201 progdir=\"\$thisdir/$objdir\"
4203 if test ! -f \"\$progdir/\$program\" || \\
4204 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
4205 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4207 file=\"\$\$-\$program\"
4209 if test ! -d \"\$progdir\"; then
4210 $mkdir \"\$progdir\"
4211 else
4212 $rm \"\$progdir/\$file\"
4215 echo >> $output "\
4217 # relink executable if necessary
4218 if test -n \"\$relink_command\"; then
4219 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4220 else
4221 $echo \"\$relink_command_output\" >&2
4222 $rm \"\$progdir/\$file\"
4223 exit 1
4227 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4228 { $rm \"\$progdir/\$program\";
4229 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4230 $rm \"\$progdir/\$file\"
4232 else
4233 echo >> $output "\
4234 program='$outputname'
4235 progdir=\"\$thisdir/$objdir\"
4239 echo >> $output "\
4241 if test -f \"\$progdir/\$program\"; then"
4243 # Export our shlibpath_var if we have one.
4244 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4245 $echo >> $output "\
4246 # Add our own library path to $shlibpath_var
4247 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4249 # Some systems cannot cope with colon-terminated $shlibpath_var
4250 # The second colon is a workaround for a bug in BeOS R4 sed
4251 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4253 export $shlibpath_var
4257 # fixup the dll searchpath if we need to.
4258 if test -n "$dllsearchpath"; then
4259 $echo >> $output "\
4260 # Add the dll search path components to the executable PATH
4261 PATH=$dllsearchpath:\$PATH
4265 $echo >> $output "\
4266 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4267 # Run the actual program with our arguments.
4269 case $host in
4270 # win32 systems need to use the prog path for dll
4271 # lookup to work
4272 *-*-cygwin* | *-*-pw32*)
4273 $echo >> $output "\
4274 exec \$progdir/\$program \${1+\"\$@\"}
4278 # Backslashes separate directories on plain windows
4279 *-*-mingw | *-*-os2*)
4280 $echo >> $output "\
4281 exec \$progdir\\\\\$program \${1+\"\$@\"}
4286 $echo >> $output "\
4287 # Export the path to the program.
4288 PATH=\"\$progdir:\$PATH\"
4289 export PATH
4291 exec \$program \${1+\"\$@\"}
4294 esac
4295 $echo >> $output "\
4296 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4297 exit 1
4299 else
4300 # The program doesn't exist.
4301 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4302 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4303 echo \"See the $PACKAGE documentation for more information.\" 1>&2
4304 exit 1
4308 chmod +x $output
4310 exit 0
4312 esac
4314 # See if we need to build an old-fashioned archive.
4315 for oldlib in $oldlibs; do
4317 if test "$build_libtool_libs" = convenience; then
4318 oldobjs="$libobjs_save"
4319 addlibs="$convenience"
4320 build_libtool_libs=no
4321 else
4322 if test "$build_libtool_libs" = module; then
4323 oldobjs="$libobjs_save"
4324 build_libtool_libs=no
4325 else
4326 oldobjs="$objs$old_deplibs $non_pic_objects"
4328 addlibs="$old_convenience"
4331 if test -n "$addlibs"; then
4332 gentop="$output_objdir/${outputname}x"
4333 $show "${rm}r $gentop"
4334 $run ${rm}r "$gentop"
4335 $show "$mkdir $gentop"
4336 $run $mkdir "$gentop"
4337 status=$?
4338 if test $status -ne 0 && test ! -d "$gentop"; then
4339 exit $status
4341 generated="$generated $gentop"
4343 # Add in members from convenience archives.
4344 for xlib in $addlibs; do
4345 # Extract the objects.
4346 case $xlib in
4347 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4348 *) xabs=`pwd`"/$xlib" ;;
4349 esac
4350 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4351 xdir="$gentop/$xlib"
4353 $show "${rm}r $xdir"
4354 $run ${rm}r "$xdir"
4355 $show "$mkdir $xdir"
4356 $run $mkdir "$xdir"
4357 status=$?
4358 if test $status -ne 0 && test ! -d "$xdir"; then
4359 exit $status
4361 $show "(cd $xdir && $AR x $xabs)"
4362 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4364 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
4365 done
4368 # Do each command in the archive commands.
4369 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4370 eval cmds=\"$old_archive_from_new_cmds\"
4371 else
4372 # # Ensure that we have .o objects in place in case we decided
4373 # # not to build a shared library, and have fallen back to building
4374 # # static libs even though --disable-static was passed!
4375 # for oldobj in $oldobjs; do
4376 # if test ! -f $oldobj; then
4377 # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
4378 # if test "X$xdir" = "X$oldobj"; then
4379 # xdir="."
4380 # else
4381 # xdir="$xdir"
4382 # fi
4383 # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
4384 # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
4385 # $show "(cd $xdir && ${LN_S} $obj $baseobj)"
4386 # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4387 # fi
4388 # done
4390 # POSIX demands no paths to be encoded in archives. We have
4391 # to avoid creating archives with duplicate basenames if we
4392 # might have to extract them afterwards, e.g., when creating a
4393 # static archive out of a convenience library, or when linking
4394 # the entirety of a libtool archive into another (currently
4395 # not supported by libtool).
4396 if (for obj in $oldobjs
4398 $echo "X$obj" | $Xsed -e 's%^.*/%%'
4399 done | sort | sort -uc >/dev/null 2>&1); then
4401 else
4402 $echo "copying selected object files to avoid basename conflicts..."
4404 if test -z "$gentop"; then
4405 gentop="$output_objdir/${outputname}x"
4407 $show "${rm}r $gentop"
4408 $run ${rm}r "$gentop"
4409 $show "$mkdir $gentop"
4410 $run $mkdir "$gentop"
4411 status=$?
4412 if test $status -ne 0 && test ! -d "$gentop"; then
4413 exit $status
4415 generated="$generated $gentop"
4418 save_oldobjs=$oldobjs
4419 oldobjs=
4420 counter=1
4421 for obj in $save_oldobjs
4423 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
4424 case " $oldobjs " in
4425 " ") oldobjs=$obj ;;
4426 *[\ /]"$objbase "*)
4427 while :; do
4428 # Make sure we don't pick an alternate name that also
4429 # overlaps.
4430 newobj=lt$counter-$objbase
4431 counter=`expr $counter + 1`
4432 case " $oldobjs " in
4433 *[\ /]"$newobj "*) ;;
4434 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
4435 esac
4436 done
4437 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
4438 $run ln "$obj" "$gentop/$newobj" ||
4439 $run cp "$obj" "$gentop/$newobj"
4440 oldobjs="$oldobjs $gentop/$newobj"
4442 *) oldobjs="$oldobjs $obj" ;;
4443 esac
4444 done
4447 eval cmds=\"$old_archive_cmds\"
4449 if len=`expr "X$cmds" : ".*"` &&
4450 test $len -le $max_cmd_len; then
4452 else
4453 # the command line is too long to link in one step, link in parts
4454 $echo "using piecewise archive linking..."
4455 save_RANLIB=$RANLIB
4456 RANLIB=:
4457 objlist=
4458 concat_cmds=
4459 save_oldobjs=$oldobjs
4461 for obj in $save_oldobjs
4463 oldobjs="$objlist $obj"
4464 objlist="$objlist $obj"
4465 eval test_cmds=\"$old_archive_cmds\"
4466 if len=`expr "X$test_cmds" : ".*"` &&
4467 test $len -le $max_cmd_len; then
4469 else
4470 # the above command should be used before it gets too long
4471 oldobjs=$objlist
4472 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4473 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4474 objlist=
4476 done
4477 RANLIB=$save_RANLIB
4478 oldobjs=$objlist
4479 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4482 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4483 for cmd in $cmds; do
4484 IFS="$save_ifs"
4485 $show "$cmd"
4486 $run eval "$cmd" || exit $?
4487 done
4488 IFS="$save_ifs"
4489 done
4491 if test -n "$generated"; then
4492 $show "${rm}r$generated"
4493 $run ${rm}r$generated
4496 # Now create the libtool archive.
4497 case $output in
4498 *.la)
4499 old_library=
4500 test "$build_old_libs" = yes && old_library="$libname.$libext"
4501 $show "creating $output"
4503 # Preserve any variables that may affect compiler behavior
4504 for var in $variables_saved_for_relink; do
4505 if eval test -z \"\${$var+set}\"; then
4506 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4507 elif eval var_value=\$$var; test -z "$var_value"; then
4508 relink_command="$var=; export $var; $relink_command"
4509 else
4510 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4511 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4513 done
4514 # Quote the link command for shipping.
4515 tagopts=
4516 for tag in $taglist; do
4517 tagopts="$tagopts --tag $tag"
4518 done
4519 relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)"
4520 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4522 # Only create the output if not a dry run.
4523 if test -z "$run"; then
4524 for installed in no yes; do
4525 if test "$installed" = yes; then
4526 if test -z "$install_libdir"; then
4527 break
4529 output="$output_objdir/$outputname"i
4530 # Replace all uninstalled libtool libraries with the installed ones
4531 newdependency_libs=
4532 for deplib in $dependency_libs; do
4533 case $deplib in
4534 *.la)
4535 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4536 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4537 if test -z "$libdir"; then
4538 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4539 exit 1
4541 newdependency_libs="$newdependency_libs $libdir/$name"
4543 *) newdependency_libs="$newdependency_libs $deplib" ;;
4544 esac
4545 done
4546 dependency_libs="$newdependency_libs"
4547 newdlfiles=
4548 for lib in $dlfiles; do
4549 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4550 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4551 if test -z "$libdir"; then
4552 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4553 exit 1
4555 newdlfiles="$newdlfiles $libdir/$name"
4556 done
4557 dlfiles="$newdlfiles"
4558 newdlprefiles=
4559 for lib in $dlprefiles; do
4560 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4561 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4562 if test -z "$libdir"; then
4563 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4564 exit 1
4566 newdlprefiles="$newdlprefiles $libdir/$name"
4567 done
4568 dlprefiles="$newdlprefiles"
4570 $rm $output
4571 # place dlname in correct position for cygwin
4572 tdlname=$dlname
4573 case $host,$output,$installed,$module,$dlname in
4574 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4575 esac
4576 $echo > $output "\
4577 # $outputname - a libtool library file
4578 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4580 # Please DO NOT delete this file!
4581 # It is necessary for linking the library.
4583 # The name that we can dlopen(3).
4584 dlname='$tdlname'
4586 # Names of this library.
4587 library_names='$library_names'
4589 # The name of the static archive.
4590 old_library='$old_library'
4592 # Libraries that this one depends upon.
4593 dependency_libs='$dependency_libs'
4595 # Version information for $libname.
4596 current=$current
4597 age=$age
4598 revision=$revision
4600 # Is this an already installed library?
4601 installed=$installed
4603 # Files to dlopen/dlpreopen
4604 dlopen='$dlfiles'
4605 dlpreopen='$dlprefiles'
4607 # Directory that this library needs to be installed in:
4608 libdir='$install_libdir'"
4609 if test "$installed" = no && test $need_relink = yes; then
4610 $echo >> $output "\
4611 relink_command=\"$relink_command\""
4613 done
4616 # Do a symbolic link so that the libtool archive can be found in
4617 # LD_LIBRARY_PATH before the program is installed.
4618 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4619 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4621 esac
4622 exit 0
4625 # libtool install mode
4626 install)
4627 modename="$modename: install"
4629 # There may be an optional sh(1) argument at the beginning of
4630 # install_prog (especially on Windows NT).
4631 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4632 # Allow the use of GNU shtool's install command.
4633 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4634 # Aesthetically quote it.
4635 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4636 case $arg in
4637 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4638 arg="\"$arg\""
4640 esac
4641 install_prog="$arg "
4642 arg="$1"
4643 shift
4644 else
4645 install_prog=
4646 arg="$nonopt"
4649 # The real first argument should be the name of the installation program.
4650 # Aesthetically quote it.
4651 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4652 case $arg in
4653 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4654 arg="\"$arg\""
4656 esac
4657 install_prog="$install_prog$arg"
4659 # We need to accept at least all the BSD install flags.
4660 dest=
4661 files=
4662 opts=
4663 prev=
4664 install_type=
4665 isdir=no
4666 stripme=
4667 for arg
4669 if test -n "$dest"; then
4670 files="$files $dest"
4671 dest="$arg"
4672 continue
4675 case $arg in
4676 -d) isdir=yes ;;
4677 -f) prev="-f" ;;
4678 -g) prev="-g" ;;
4679 -m) prev="-m" ;;
4680 -o) prev="-o" ;;
4682 stripme=" -s"
4683 continue
4685 -*) ;;
4688 # If the previous option needed an argument, then skip it.
4689 if test -n "$prev"; then
4690 prev=
4691 else
4692 dest="$arg"
4693 continue
4696 esac
4698 # Aesthetically quote the argument.
4699 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4700 case $arg in
4701 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4702 arg="\"$arg\""
4704 esac
4705 install_prog="$install_prog $arg"
4706 done
4708 if test -z "$install_prog"; then
4709 $echo "$modename: you must specify an install program" 1>&2
4710 $echo "$help" 1>&2
4711 exit 1
4714 if test -n "$prev"; then
4715 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4716 $echo "$help" 1>&2
4717 exit 1
4720 if test -z "$files"; then
4721 if test -z "$dest"; then
4722 $echo "$modename: no file or destination specified" 1>&2
4723 else
4724 $echo "$modename: you must specify a destination" 1>&2
4726 $echo "$help" 1>&2
4727 exit 1
4730 # Strip any trailing slash from the destination.
4731 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4733 # Check to see that the destination is a directory.
4734 test -d "$dest" && isdir=yes
4735 if test "$isdir" = yes; then
4736 destdir="$dest"
4737 destname=
4738 else
4739 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4740 test "X$destdir" = "X$dest" && destdir=.
4741 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4743 # Not a directory, so check to see that there is only one file specified.
4744 set dummy $files
4745 if test $# -gt 2; then
4746 $echo "$modename: \`$dest' is not a directory" 1>&2
4747 $echo "$help" 1>&2
4748 exit 1
4751 case $destdir in
4752 [\\/]* | [A-Za-z]:[\\/]*) ;;
4754 for file in $files; do
4755 case $file in
4756 *.lo) ;;
4758 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4759 $echo "$help" 1>&2
4760 exit 1
4762 esac
4763 done
4765 esac
4767 # This variable tells wrapper scripts just to set variables rather
4768 # than running their programs.
4769 libtool_install_magic="$magic"
4771 staticlibs=
4772 future_libdirs=
4773 current_libdirs=
4774 for file in $files; do
4776 # Do each installation.
4777 case $file in
4778 *.$libext)
4779 # Do the static libraries later.
4780 staticlibs="$staticlibs $file"
4783 *.la)
4784 # Check to see that this really is a libtool archive.
4785 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4786 else
4787 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4788 $echo "$help" 1>&2
4789 exit 1
4792 library_names=
4793 old_library=
4794 relink_command=
4795 # If there is no directory component, then add one.
4796 case $file in
4797 */* | *\\*) . $file ;;
4798 *) . ./$file ;;
4799 esac
4801 # Add the libdir to current_libdirs if it is the destination.
4802 if test "X$destdir" = "X$libdir"; then
4803 case "$current_libdirs " in
4804 *" $libdir "*) ;;
4805 *) current_libdirs="$current_libdirs $libdir" ;;
4806 esac
4807 else
4808 # Note the libdir as a future libdir.
4809 case "$future_libdirs " in
4810 *" $libdir "*) ;;
4811 *) future_libdirs="$future_libdirs $libdir" ;;
4812 esac
4815 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4816 test "X$dir" = "X$file/" && dir=
4817 dir="$dir$objdir"
4819 if test -n "$relink_command"; then
4820 # Determine the prefix the user has applied to our future dir.
4821 inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
4823 # Don't allow the user to place us outside of our expected
4824 # location b/c this prevents finding dependent libraries that
4825 # are installed to the same prefix.
4826 # At present, this check doesn't affect windows .dll's that
4827 # are installed into $libdir/../bin (currently, that works fine)
4828 # but it's something to keep an eye on.
4829 if test "$inst_prefix_dir" = "$destdir"; then
4830 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4831 exit 1
4834 if test -n "$inst_prefix_dir"; then
4835 # Stick the inst_prefix_dir data into the link command.
4836 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4837 else
4838 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
4841 $echo "$modename: warning: relinking \`$file'" 1>&2
4842 $show "$relink_command"
4843 if $run eval "$relink_command"; then :
4844 else
4845 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4846 exit 1
4850 # See the names of the shared library.
4851 set dummy $library_names
4852 if test -n "$2"; then
4853 realname="$2"
4854 shift
4855 shift
4857 srcname="$realname"
4858 test -n "$relink_command" && srcname="$realname"T
4860 # Install the shared library and build the symlinks.
4861 $show "$install_prog $dir/$srcname $destdir/$realname"
4862 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4863 if test -n "$stripme" && test -n "$striplib"; then
4864 $show "$striplib $destdir/$realname"
4865 $run eval "$striplib $destdir/$realname" || exit $?
4868 if test $# -gt 0; then
4869 # Delete the old symlinks, and create new ones.
4870 for linkname
4872 if test "$linkname" != "$realname"; then
4873 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4874 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4876 done
4879 # Do each command in the postinstall commands.
4880 lib="$destdir/$realname"
4881 eval cmds=\"$postinstall_cmds\"
4882 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4883 for cmd in $cmds; do
4884 IFS="$save_ifs"
4885 $show "$cmd"
4886 $run eval "$cmd" || exit $?
4887 done
4888 IFS="$save_ifs"
4891 # Install the pseudo-library for information purposes.
4892 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4893 instname="$dir/$name"i
4894 $show "$install_prog $instname $destdir/$name"
4895 $run eval "$install_prog $instname $destdir/$name" || exit $?
4897 # Maybe install the static library, too.
4898 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4901 *.lo)
4902 # Install (i.e. copy) a libtool object.
4904 # Figure out destination file name, if it wasn't already specified.
4905 if test -n "$destname"; then
4906 destfile="$destdir/$destname"
4907 else
4908 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4909 destfile="$destdir/$destfile"
4912 # Deduce the name of the destination old-style object file.
4913 case $destfile in
4914 *.lo)
4915 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4917 *.$objext)
4918 staticdest="$destfile"
4919 destfile=
4922 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4923 $echo "$help" 1>&2
4924 exit 1
4926 esac
4928 # Install the libtool object if requested.
4929 if test -n "$destfile"; then
4930 $show "$install_prog $file $destfile"
4931 $run eval "$install_prog $file $destfile" || exit $?
4934 # Install the old object if enabled.
4935 if test "$build_old_libs" = yes; then
4936 # Deduce the name of the old-style object file.
4937 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4939 $show "$install_prog $staticobj $staticdest"
4940 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4942 exit 0
4946 # Figure out destination file name, if it wasn't already specified.
4947 if test -n "$destname"; then
4948 destfile="$destdir/$destname"
4949 else
4950 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4951 destfile="$destdir/$destfile"
4954 # Do a test to see if this is really a libtool program.
4955 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4956 notinst_deplibs=
4957 relink_command=
4959 # If there is no directory component, then add one.
4960 case $file in
4961 */* | *\\*) . $file ;;
4962 *) . ./$file ;;
4963 esac
4965 # Check the variables that should have been set.
4966 if test -z "$notinst_deplibs"; then
4967 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4968 exit 1
4971 finalize=yes
4972 for lib in $notinst_deplibs; do
4973 # Check to see that each library is installed.
4974 libdir=
4975 if test -f "$lib"; then
4976 # If there is no directory component, then add one.
4977 case $lib in
4978 */* | *\\*) . $lib ;;
4979 *) . ./$lib ;;
4980 esac
4982 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4983 if test -n "$libdir" && test ! -f "$libfile"; then
4984 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4985 finalize=no
4987 done
4989 relink_command=
4990 # If there is no directory component, then add one.
4991 case $file in
4992 */* | *\\*) . $file ;;
4993 *) . ./$file ;;
4994 esac
4996 outputname=
4997 if test "$fast_install" = no && test -n "$relink_command"; then
4998 if test "$finalize" = yes && test -z "$run"; then
4999 tmpdir="/tmp"
5000 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5001 tmpdir="$tmpdir/libtool-$$"
5002 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
5003 else
5004 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5005 continue
5007 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5008 outputname="$tmpdir/$file"
5009 # Replace the output file specification.
5010 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5012 $show "$relink_command"
5013 if $run eval "$relink_command"; then :
5014 else
5015 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5016 ${rm}r "$tmpdir"
5017 continue
5019 file="$outputname"
5020 else
5021 $echo "$modename: warning: cannot relink \`$file'" 1>&2
5023 else
5024 # Install the binary that we compiled earlier.
5025 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5030 # remove .exe since cygwin /usr/bin/install will append another
5031 # one anyways
5032 case $install_prog,$host in
5033 */usr/bin/install*,*cygwin*)
5034 case $file:$destfile in
5035 *.exe:*.exe)
5036 # this is ok
5038 *.exe:*)
5039 destfile=$destfile.exe
5041 *:*.exe)
5042 destfile=`echo $destfile | sed -e 's,.exe$,,'`
5044 esac
5046 esac
5048 $show "$install_prog$stripme $file $destfile"
5049 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5050 test -n "$outputname" && ${rm}r "$tmpdir"
5052 esac
5053 done
5055 for file in $staticlibs; do
5056 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5058 # Set up the ranlib parameters.
5059 oldlib="$destdir/$name"
5061 $show "$install_prog $file $oldlib"
5062 $run eval "$install_prog \$file \$oldlib" || exit $?
5064 if test -n "$stripme" && test -n "$striplib"; then
5065 $show "$old_striplib $oldlib"
5066 $run eval "$old_striplib $oldlib" || exit $?
5069 # Do each command in the postinstall commands.
5070 eval cmds=\"$old_postinstall_cmds\"
5071 # APPLE LOCAL handle ~ in pathnames 2002-01-14 --sts
5072 IFS="${IFS= }"; save_ifs="$IFS"; IFS='@'
5073 for cmd in $cmds; do
5074 IFS="$save_ifs"
5075 $show "$cmd"
5076 $run eval "$cmd" || exit $?
5077 done
5078 IFS="$save_ifs"
5079 done
5081 if test -n "$future_libdirs"; then
5082 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5085 if test -n "$current_libdirs"; then
5086 # Maybe just do a dry run.
5087 test -n "$run" && current_libdirs=" -n$current_libdirs"
5088 exec_cmd='$SHELL $0 --finish$current_libdirs'
5089 else
5090 exit 0
5094 # libtool finish mode
5095 finish)
5096 modename="$modename: finish"
5097 libdirs="$nonopt"
5098 admincmds=
5100 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5101 for dir
5103 libdirs="$libdirs $dir"
5104 done
5106 for libdir in $libdirs; do
5107 if test -n "$finish_cmds"; then
5108 # Do each command in the finish commands.
5109 eval cmds=\"$finish_cmds\"
5110 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5111 for cmd in $cmds; do
5112 IFS="$save_ifs"
5113 $show "$cmd"
5114 $run eval "$cmd" || admincmds="$admincmds
5115 $cmd"
5116 done
5117 IFS="$save_ifs"
5119 if test -n "$finish_eval"; then
5120 # Do the single finish_eval.
5121 eval cmds=\"$finish_eval\"
5122 $run eval "$cmds" || admincmds="$admincmds
5123 $cmds"
5125 done
5128 # Exit here if they wanted silent mode.
5129 test "$show" = ":" && exit 0
5131 echo "----------------------------------------------------------------------"
5132 echo "Libraries have been installed in:"
5133 for libdir in $libdirs; do
5134 echo " $libdir"
5135 done
5136 echo
5137 echo "If you ever happen to want to link against installed libraries"
5138 echo "in a given directory, LIBDIR, you must either use libtool, and"
5139 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5140 echo "flag during linking and do at least one of the following:"
5141 if test -n "$shlibpath_var"; then
5142 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5143 echo " during execution"
5145 if test -n "$runpath_var"; then
5146 echo " - add LIBDIR to the \`$runpath_var' environment variable"
5147 echo " during linking"
5149 if test -n "$hardcode_libdir_flag_spec"; then
5150 libdir=LIBDIR
5151 eval flag=\"$hardcode_libdir_flag_spec\"
5153 echo " - use the \`$flag' linker flag"
5155 if test -n "$admincmds"; then
5156 echo " - have your system administrator run these commands:$admincmds"
5158 if test -f /etc/ld.so.conf; then
5159 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5161 echo
5162 echo "See any operating system documentation about shared libraries for"
5163 echo "more information, such as the ld(1) and ld.so(8) manual pages."
5164 echo "----------------------------------------------------------------------"
5165 exit 0
5168 # libtool execute mode
5169 execute)
5170 modename="$modename: execute"
5172 # The first argument is the command name.
5173 cmd="$nonopt"
5174 if test -z "$cmd"; then
5175 $echo "$modename: you must specify a COMMAND" 1>&2
5176 $echo "$help"
5177 exit 1
5180 # Handle -dlopen flags immediately.
5181 for file in $execute_dlfiles; do
5182 if test ! -f "$file"; then
5183 $echo "$modename: \`$file' is not a file" 1>&2
5184 $echo "$help" 1>&2
5185 exit 1
5188 dir=
5189 case $file in
5190 *.la)
5191 # Check to see that this really is a libtool archive.
5192 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5193 else
5194 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5195 $echo "$help" 1>&2
5196 exit 1
5199 # Read the libtool library.
5200 dlname=
5201 library_names=
5203 # If there is no directory component, then add one.
5204 case $file in
5205 */* | *\\*) . $file ;;
5206 *) . ./$file ;;
5207 esac
5209 # Skip this library if it cannot be dlopened.
5210 if test -z "$dlname"; then
5211 # Warn if it was a shared library.
5212 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5213 continue
5216 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5217 test "X$dir" = "X$file" && dir=.
5219 if test -f "$dir/$objdir/$dlname"; then
5220 dir="$dir/$objdir"
5221 else
5222 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5223 exit 1
5227 *.lo)
5228 # Just add the directory containing the .lo file.
5229 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5230 test "X$dir" = "X$file" && dir=.
5234 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5235 continue
5237 esac
5239 # Get the absolute pathname.
5240 absdir=`cd "$dir" && pwd`
5241 test -n "$absdir" && dir="$absdir"
5243 # Now add the directory to shlibpath_var.
5244 if eval "test -z \"\$$shlibpath_var\""; then
5245 eval "$shlibpath_var=\"\$dir\""
5246 else
5247 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5249 done
5251 # This variable tells wrapper scripts just to set shlibpath_var
5252 # rather than running their programs.
5253 libtool_execute_magic="$magic"
5255 # Check if any of the arguments is a wrapper script.
5256 args=
5257 for file
5259 case $file in
5260 -*) ;;
5262 # Do a test to see if this is really a libtool program.
5263 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5264 # If there is no directory component, then add one.
5265 case $file in
5266 */* | *\\*) . $file ;;
5267 *) . ./$file ;;
5268 esac
5270 # Transform arg to wrapped name.
5271 file="$progdir/$program"
5274 esac
5275 # Quote arguments (to preserve shell metacharacters).
5276 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5277 args="$args \"$file\""
5278 done
5280 if test -z "$run"; then
5281 if test -n "$shlibpath_var"; then
5282 # Export the shlibpath_var.
5283 eval "export $shlibpath_var"
5286 # Restore saved enviroment variables
5287 if test "${save_LC_ALL+set}" = set; then
5288 LC_ALL="$save_LC_ALL"; export LC_ALL
5290 if test "${save_LANG+set}" = set; then
5291 LANG="$save_LANG"; export LANG
5294 # Now prepare to actually exec the command.
5295 exec_cmd='"$cmd"$args'
5296 else
5297 # Display what would be done.
5298 if test -n "$shlibpath_var"; then
5299 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5300 $echo "export $shlibpath_var"
5302 $echo "$cmd$args"
5303 exit 0
5307 # libtool clean and uninstall mode
5308 clean | uninstall)
5309 modename="$modename: $mode"
5310 rm="$nonopt"
5311 files=
5312 rmforce=
5313 exit_status=0
5315 # This variable tells wrapper scripts just to set variables rather
5316 # than running their programs.
5317 libtool_install_magic="$magic"
5319 for arg
5321 case $arg in
5322 -f) rm="$rm $arg"; rmforce=yes ;;
5323 -*) rm="$rm $arg" ;;
5324 *) files="$files $arg" ;;
5325 esac
5326 done
5328 if test -z "$rm"; then
5329 $echo "$modename: you must specify an RM program" 1>&2
5330 $echo "$help" 1>&2
5331 exit 1
5334 rmdirs=
5336 for file in $files; do
5337 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5338 if test "X$dir" = "X$file"; then
5339 dir=.
5340 objdir="$objdir"
5341 else
5342 objdir="$dir/$objdir"
5344 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5345 test $mode = uninstall && objdir="$dir"
5347 # Remember objdir for removal later, being careful to avoid duplicates
5348 if test $mode = clean; then
5349 case " $rmdirs " in
5350 *" $objdir "*) ;;
5351 *) rmdirs="$rmdirs $objdir" ;;
5352 esac
5355 # Don't error if the file doesn't exist and rm -f was used.
5356 if (test -L "$file") >/dev/null 2>&1 \
5357 || (test -h "$file") >/dev/null 2>&1 \
5358 || test -f "$file"; then
5360 elif test -d "$file"; then
5361 exit_status=1
5362 continue
5363 elif test "$rmforce" = yes; then
5364 continue
5367 rmfiles="$file"
5369 case $name in
5370 *.la)
5371 # Possibly a libtool archive, so verify it.
5372 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5373 . $dir/$name
5375 # Delete the libtool libraries and symlinks.
5376 for n in $library_names; do
5377 rmfiles="$rmfiles $objdir/$n"
5378 done
5379 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5380 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5382 if test $mode = uninstall; then
5383 if test -n "$library_names"; then
5384 # Do each command in the postuninstall commands.
5385 eval cmds=\"$postuninstall_cmds\"
5386 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5387 for cmd in $cmds; do
5388 IFS="$save_ifs"
5389 $show "$cmd"
5390 $run eval "$cmd"
5391 if test $? != 0 && test "$rmforce" != yes; then
5392 exit_status=1
5394 done
5395 IFS="$save_ifs"
5398 if test -n "$old_library"; then
5399 # Do each command in the old_postuninstall commands.
5400 eval cmds=\"$old_postuninstall_cmds\"
5401 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5402 for cmd in $cmds; do
5403 IFS="$save_ifs"
5404 $show "$cmd"
5405 $run eval "$cmd"
5406 if test $? != 0 && test "$rmforce" != yes; then
5407 exit_status=1
5409 done
5410 IFS="$save_ifs"
5412 # FIXME: should reinstall the best remaining shared library.
5417 *.lo)
5418 # Possibly a libtool object, so verify it.
5419 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5421 # Read the .lo file
5422 . $dir/$name
5424 # Add PIC object to the list of files to remove.
5425 if test -n "$pic_object" \
5426 && test "$pic_object" != none; then
5427 rmfiles="$rmfiles $dir/$pic_object"
5430 # Add non-PIC object to the list of files to remove.
5431 if test -n "$non_pic_object" \
5432 && test "$non_pic_object" != none; then
5433 rmfiles="$rmfiles $dir/$non_pic_object"
5439 # Do a test to see if this is a libtool program.
5440 if test $mode = clean &&
5441 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5442 relink_command=
5443 . $dir/$file
5445 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5446 if test "$fast_install" = yes && test -n "$relink_command"; then
5447 rmfiles="$rmfiles $objdir/lt-$name"
5451 esac
5452 $show "$rm $rmfiles"
5453 $run $rm $rmfiles || exit_status=1
5454 done
5456 # Try to remove the ${objdir}s in the directories where we deleted files
5457 for dir in $rmdirs; do
5458 if test -d "$dir"; then
5459 $show "rmdir $dir"
5460 $run rmdir $dir >/dev/null 2>&1
5462 done
5464 exit $exit_status
5468 $echo "$modename: you must specify a MODE" 1>&2
5469 $echo "$generic_help" 1>&2
5470 exit 1
5472 esac
5474 if test -z "$exec_cmd"; then
5475 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5476 $echo "$generic_help" 1>&2
5477 exit 1
5479 fi # test -z "$show_help"
5481 if test -n "$exec_cmd"; then
5482 eval exec $exec_cmd
5483 exit 1
5486 # We need to display help for each of the modes.
5487 case $mode in
5488 "") $echo \
5489 "Usage: $modename [OPTION]... [MODE-ARG]...
5491 Provide generalized library-building support services.
5493 --config show all configuration variables
5494 --debug enable verbose shell tracing
5495 -n, --dry-run display commands without modifying any files
5496 --features display basic configuration information and exit
5497 --finish same as \`--mode=finish'
5498 --help display this help message and exit
5499 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
5500 --quiet same as \`--silent'
5501 --silent don't print informational messages
5502 --tag=TAG use configuration variables from tag TAG
5503 --version print version information
5505 MODE must be one of the following:
5507 clean remove files from the build directory
5508 compile compile a source file into a libtool object
5509 execute automatically set library path, then run a program
5510 finish complete the installation of libtool libraries
5511 install install libraries or executables
5512 link create a library or an executable
5513 uninstall remove libraries from an installed directory
5515 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5516 a more detailed description of MODE."
5517 exit 0
5520 clean)
5521 $echo \
5522 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5524 Remove files from the build directory.
5526 RM is the name of the program to use to delete files associated with each FILE
5527 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5528 to RM.
5530 If FILE is a libtool library, object or program, all the files associated
5531 with it are deleted. Otherwise, only FILE itself is deleted using RM."
5534 compile)
5535 $echo \
5536 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5538 Compile a source file into a libtool library object.
5540 This mode accepts the following additional options:
5542 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5543 -prefer-pic try to building PIC objects only
5544 -prefer-non-pic try to building non-PIC objects only
5545 -static always build a \`.o' file suitable for static linking
5547 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5548 from the given SOURCEFILE.
5550 The output file name is determined by removing the directory component from
5551 SOURCEFILE, then substituting the C source code suffix \`.c' with the
5552 library object suffix, \`.lo'."
5555 execute)
5556 $echo \
5557 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5559 Automatically set library path, then run a program.
5561 This mode accepts the following additional options:
5563 -dlopen FILE add the directory containing FILE to the library path
5565 This mode sets the library path environment variable according to \`-dlopen'
5566 flags.
5568 If any of the ARGS are libtool executable wrappers, then they are translated
5569 into their corresponding uninstalled binary, and any of their required library
5570 directories are added to the library path.
5572 Then, COMMAND is executed, with ARGS as arguments."
5575 finish)
5576 $echo \
5577 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5579 Complete the installation of libtool libraries.
5581 Each LIBDIR is a directory that contains libtool libraries.
5583 The commands that this mode executes may require superuser privileges. Use
5584 the \`--dry-run' option if you just want to see what would be executed."
5587 install)
5588 $echo \
5589 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5591 Install executables or libraries.
5593 INSTALL-COMMAND is the installation command. The first component should be
5594 either the \`install' or \`cp' program.
5596 The rest of the components are interpreted as arguments to that command (only
5597 BSD-compatible install options are recognized)."
5600 link)
5601 $echo \
5602 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5604 Link object files or libraries together to form another library, or to
5605 create an executable program.
5607 LINK-COMMAND is a command using the C compiler that you would use to create
5608 a program from several object files.
5610 The following components of LINK-COMMAND are treated specially:
5612 -all-static do not do any dynamic linking at all
5613 -avoid-version do not add a version suffix if possible
5614 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5615 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5616 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5617 -export-symbols SYMFILE
5618 try to export only the symbols listed in SYMFILE
5619 -export-symbols-regex REGEX
5620 try to export only the symbols matching REGEX
5621 -LLIBDIR search LIBDIR for required installed libraries
5622 -lNAME OUTPUT-FILE requires the installed library libNAME
5623 -module build a library that can dlopened
5624 -no-fast-install disable the fast-install mode
5625 -no-install link a not-installable executable
5626 -no-undefined declare that a library does not refer to external symbols
5627 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5628 -objectlist FILE Use a list of object files found in FILE to specify objects
5629 -release RELEASE specify package release information
5630 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5631 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5632 -static do not do any dynamic linking of libtool libraries
5633 -version-info CURRENT[:REVISION[:AGE]]
5634 specify library version info [each variable defaults to 0]
5636 All other options (arguments beginning with \`-') are ignored.
5638 Every other argument is treated as a filename. Files ending in \`.la' are
5639 treated as uninstalled libtool libraries, other files are standard or library
5640 object files.
5642 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5643 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5644 required, except when creating a convenience library.
5646 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5647 using \`ar' and \`ranlib', or on Windows using \`lib'.
5649 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5650 is created, otherwise an executable program is created."
5653 uninstall)
5654 $echo \
5655 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5657 Remove libraries from an installation directory.
5659 RM is the name of the program to use to delete files associated with each FILE
5660 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5661 to RM.
5663 If FILE is a libtool library, all the files associated with it are deleted.
5664 Otherwise, only FILE itself is deleted using RM."
5668 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5669 $echo "$help" 1>&2
5670 exit 1
5672 esac
5674 echo
5675 $echo "Try \`$modename --help' for more information about other modes."
5677 exit 0
5679 # The TAGs below are defined such that we never get into a situation
5680 # in which we disable both kinds of libraries. Given conflicting
5681 # choices, we go for a static library, that is the most portable,
5682 # since we can't tell whether shared libraries were disabled because
5683 # the user asked for that or because the platform doesn't support
5684 # them. This is particularly important on AIX, because we don't
5685 # support having both static and shared libraries enabled at the same
5686 # time on that platform, so we default to a shared-only configuration.
5687 # If a disable-shared tag is given, we'll fallback to a static-only
5688 # configuration. But we'll never go from static-only to shared-only.
5690 ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5691 build_libtool_libs=no
5692 build_old_libs=yes
5693 ### END LIBTOOL TAG CONFIG: disable-shared
5695 ### BEGIN LIBTOOL TAG CONFIG: disable-static
5696 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5697 ### END LIBTOOL TAG CONFIG: disable-static
5699 # Local Variables:
5700 # mode:shell-script
5701 # sh-indentation:2
5702 # End: