Update generated configure scripts.
[binutils.git] / ltmain.sh
blob2bccd110f030157d3e3aa72b81d7a55eddb04478
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-2000, 2001 Free Software Foundation, Inc.
5 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
26 # Check that we have a working $echo.
27 if test "X$1" = X--no-reexec; then
28 # Discard the --no-reexec flag, and continue.
29 shift
30 elif test "X$1" = X--fallback-echo; then
31 # Avoid inline document here, it may be left over
33 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
34 # Yippee, $echo works!
36 else
37 # Restart under the correct shell, and then maybe $echo will work.
38 exec $SHELL "$0" --no-reexec ${1+"$@"}
41 if test "X$1" = X--fallback-echo; then
42 # used as fallback echo
43 shift
44 cat <<EOF
46 EOF
47 exit 0
50 # The name of this program.
51 progname=`$echo "$0" | sed 's%^.*/%%'`
52 modename="$progname"
54 # Constants.
55 PROGRAM=ltmain.sh
56 PACKAGE=libtool
57 VERSION=1.4a
58 TIMESTAMP=" (1.641.2.122 2000/09/30 05:27:52)"
60 default_mode=
61 help="Try \`$progname --help' for more information."
62 magic="%%%MAGIC variable%%%"
63 mkdir="mkdir"
64 mv="mv -f"
65 rm="rm -f"
67 # Sed substitution that helps us do robust quoting. It backslashifies
68 # metacharacters that are still active within double-quoted strings.
69 Xsed='sed -e 1s/^X//'
70 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
71 SP2NL='tr \040 \012'
72 NL2SP='tr \015\012 \040\040'
74 # NLS nuisances.
75 # Only set LANG and LC_ALL to C if already set.
76 # These must not be set unconditionally because not all systems understand
77 # e.g. LANG=C (notably SCO).
78 # We save the old values to restore during execute mode.
79 if test "${LC_ALL+set}" = set; then
80 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
82 if test "${LANG+set}" = set; then
83 save_LANG="$LANG"; LANG=C; export LANG
86 if test "$LTCONFIG_VERSION" != "$VERSION"; then
87 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
88 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
89 exit 1
92 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
93 echo "$modename: not configured to build any kind of library" 1>&2
94 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
95 exit 1
98 # Global variables.
99 mode=$default_mode
100 nonopt=
101 prev=
102 prevopt=
103 run=
104 show="$echo"
105 show_help=
106 execute_dlfiles=
107 lo2o="s/\\.lo\$/.${objext}/"
108 o2lo="s/\\.${objext}\$/.lo/"
110 # Parse our command line options once, thoroughly.
111 while test $# -gt 0
113 arg="$1"
114 shift
116 case "$arg" in
117 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
118 *) optarg= ;;
119 esac
121 # If the previous option needs an argument, assign it.
122 if test -n "$prev"; then
123 case "$prev" in
124 execute_dlfiles)
125 eval "$prev=\"\$$prev \$arg\""
127 tag)
128 tagname="$arg"
130 # Check whether tagname contains only valid characters
131 case "$tagname" in
132 *[!-_A-Za-z0-9,/]*)
133 echo "$progname: invalid tag name: $tagname" 1>&2
134 exit 1
136 esac
138 if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
139 taglist="$taglist $tagname"
140 # Evaluate the configuration.
141 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
142 else
143 echo "$progname: ignoring unknown tag $tagname" 1>&2
147 eval "$prev=\$arg"
149 esac
151 prev=
152 prevopt=
153 continue
156 # Have we seen a non-optional argument yet?
157 case "$arg" in
158 --help)
159 show_help=yes
162 --version)
163 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
164 exit 0
167 --config)
168 sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0"
169 # Now print the configurations for the tags.
170 for tagname in $taglist; do
171 sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
172 done
173 exit 0
176 --debug)
177 echo "$progname: enabling shell trace mode"
178 set -x
181 --dry-run | -n)
182 run=:
185 --features)
186 echo "host: $host"
187 if test "$build_libtool_libs" = yes; then
188 echo "enable shared libraries"
189 else
190 echo "disable shared libraries"
192 if test "$build_old_libs" = yes; then
193 echo "enable static libraries"
194 else
195 echo "disable static libraries"
197 exit 0
200 --finish) mode="finish" ;;
202 --mode) prevopt="--mode" prev=mode ;;
203 --mode=*) mode="$optarg" ;;
205 --quiet | --silent)
206 show=:
209 --tag) prevopt="--tag" prev=tag ;;
210 --tag=*)
211 set tag "$optarg" ${1+"$@"}
212 shift
213 prev=tag
216 -dlopen)
217 prevopt="-dlopen"
218 prev=execute_dlfiles
222 $echo "$modename: unrecognized option \`$arg'" 1>&2
223 $echo "$help" 1>&2
224 exit 1
228 nonopt="$arg"
229 break
231 esac
232 done
234 if test -n "$prevopt"; then
235 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
236 $echo "$help" 1>&2
237 exit 1
240 if test -z "$show_help"; then
242 # Infer the operation mode.
243 if test -z "$mode"; then
244 case "$nonopt" in
245 *cc | *++ | gcc* | *-gcc*)
246 mode=link
247 for arg
249 case "$arg" in
251 mode=compile
252 break
254 esac
255 done
257 *db | *dbx | *strace | *truss)
258 mode=execute
260 *install*|cp|mv)
261 mode=install
263 *rm)
264 mode=uninstall
267 # If we have no mode, but dlfiles were specified, then do execute mode.
268 test -n "$execute_dlfiles" && mode=execute
270 # Just use the default operation mode.
271 if test -z "$mode"; then
272 if test -n "$nonopt"; then
273 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
274 else
275 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
279 esac
282 # Only execute mode is allowed to have -dlopen flags.
283 if test -n "$execute_dlfiles" && test "$mode" != execute; then
284 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
285 $echo "$help" 1>&2
286 exit 1
289 # Change the help message to a mode-specific one.
290 generic_help="$help"
291 help="Try \`$modename --help --mode=$mode' for more information."
293 # These modes are in order of execution frequency so that they run quickly.
294 case "$mode" in
295 # libtool compile mode
296 compile)
297 modename="$modename: compile"
298 # Get the compilation command and the source file.
299 base_compile=
300 prev=
301 lastarg=
302 srcfile="$nonopt"
303 suppress_output=
305 user_target=no
306 for arg
308 case "$prev" in
309 "") ;;
310 xcompiler)
311 # Aesthetically quote the previous argument.
312 prev=
313 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
315 case "$arg" in
316 # Double-quote args containing other shell metacharacters.
317 # Many Bourne shells cannot handle close brackets correctly
318 # in scan sets, so we specify it separately.
319 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
320 arg="\"$arg\""
322 esac
324 # Add the previous argument to base_compile.
325 if test -z "$base_compile"; then
326 base_compile="$lastarg"
327 else
328 base_compile="$base_compile $lastarg"
330 continue
332 esac
334 # Accept any command-line options.
335 case "$arg" in
337 if test "$user_target" != "no"; then
338 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
339 exit 1
341 user_target=next
344 -static)
345 build_old_libs=yes
346 continue
349 -prefer-pic)
350 pic_mode=yes
351 continue
354 -prefer-non-pic)
355 pic_mode=no
356 continue
359 -Xcompiler)
360 prev=xcompiler
361 continue
364 -Wc,*)
365 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
366 lastarg=
367 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
368 for arg in $args; do
369 IFS="$save_ifs"
371 # Double-quote args containing other shell metacharacters.
372 # Many Bourne shells cannot handle close brackets correctly
373 # in scan sets, so we specify it separately.
374 case "$arg" in
375 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
376 arg="\"$arg\""
378 esac
379 lastarg="$lastarg $arg"
380 done
381 IFS="$save_ifs"
382 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
384 # Add the arguments to base_compile.
385 if test -z "$base_compile"; then
386 base_compile="$lastarg"
387 else
388 base_compile="$base_compile $lastarg"
390 continue
392 esac
394 case "$user_target" in
395 next)
396 # The next one is the -o target name
397 user_target=yes
398 continue
400 yes)
401 # We got the output file
402 user_target=set
403 libobj="$arg"
404 continue
406 esac
408 # Accept the current argument as the source file.
409 lastarg="$srcfile"
410 srcfile="$arg"
412 # Aesthetically quote the previous argument.
414 # Backslashify any backslashes, double quotes, and dollar signs.
415 # These are the only characters that are still specially
416 # interpreted inside of double-quoted scrings.
417 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
419 # Double-quote args containing other shell metacharacters.
420 # Many Bourne shells cannot handle close brackets correctly
421 # in scan sets, so we specify it separately.
422 case "$lastarg" in
423 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
424 lastarg="\"$lastarg\""
426 esac
428 # Add the previous argument to base_compile.
429 if test -z "$base_compile"; then
430 base_compile="$lastarg"
431 else
432 base_compile="$base_compile $lastarg"
434 done
436 case "$user_target" in
437 set)
440 # Get the name of the library object.
441 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
444 $echo "$modename: you must specify a target with \`-o'" 1>&2
445 exit 1
447 esac
449 # Recognize several different file suffixes.
450 # If the user specifies -o file.o, it is replaced with file.lo
451 xform='[cCFSfmso]'
452 case "$libobj" in
453 *.ada) xform=ada ;;
454 *.adb) xform=adb ;;
455 *.ads) xform=ads ;;
456 *.asm) xform=asm ;;
457 *.c++) xform=c++ ;;
458 *.cc) xform=cc ;;
459 *.class) xform=class ;;
460 *.cpp) xform=cpp ;;
461 *.cxx) xform=cxx ;;
462 *.f90) xform=f90 ;;
463 *.for) xform=for ;;
464 *.java) xform=java ;;
465 esac
467 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
469 case "$libobj" in
470 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
472 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
473 exit 1
475 esac
477 # Infer tagged configuration to use if any are available and
478 # if one wasn't chosen via the "--tag" command line option.
479 # Only attempt this if the compiler in the base compile
480 # command doesn't match the default compiler.
481 if test -n "$available_tags" && test -z "$tagname"; then
482 case $base_compile in
483 "$CC "*) ;;
484 # Blanks in the command may have been stripped by the calling shell,
485 # but not from the CC environment variable when ltconfig was run.
486 "`$echo $CC` "*) ;;
488 for z in $available_tags; do
489 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
490 # Evaluate the configuration.
491 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
492 case $base_compile in
493 "$CC "*)
494 # The compiler in the base compile command matches
495 # the one in the tagged configuration.
496 # Assume this is the tagged configuration we want.
497 tagname=$z
498 break
500 "`$echo $CC` "*)
501 tagname=$z
502 break
504 esac
506 done
507 # If $tagname still isn't set, then no tagged configuration
508 # was found and let the user know that the "--tag" command
509 # line option must be used.
510 if test -z "$tagname"; then
511 echo "$modename: unable to infer tagged configuration"
512 echo "$modename: specify a tag with \`--tag'" 1>&2
513 exit 1
514 # else
515 # echo "$modename: using $tagname tagged configuration"
518 esac
521 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
522 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
523 if test "X$xdir" = "X$obj"; then
524 xdir=
525 else
526 xdir=$xdir/
528 lobj=${xdir}$objdir/$objname
530 if test -z "$base_compile"; then
531 $echo "$modename: you must specify a compilation command" 1>&2
532 $echo "$help" 1>&2
533 exit 1
536 # Delete any leftover library objects.
537 if test "$build_old_libs" = yes; then
538 removelist="$obj $lobj $libobj ${libobj}T"
539 else
540 removelist="$lobj $libobj ${libobj}T"
543 $run $rm $removelist
544 trap "$run $rm $removelist; exit 1" 1 2 15
546 # On Cygwin there's no "real" PIC flag so we must build both object types
547 case "$host_os" in
548 cygwin* | mingw* | pw32* | os2*)
549 pic_mode=default
551 esac
552 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
553 # non-PIC code in shared libraries is not supported
554 pic_mode=default
557 # Calculate the filename of the output object if compiler does
558 # not support -o with -c
559 if test "$compiler_c_o" = no; then
560 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
561 lockfile="$output_obj.lock"
562 removelist="$removelist $output_obj $lockfile"
563 trap "$run $rm $removelist; exit 1" 1 2 15
564 else
565 output_obj=
566 need_locks=no
567 lockfile=
570 # Lock this critical section if it is needed
571 # We use this script file to make the link, it avoids creating a new file
572 if test "$need_locks" = yes; then
573 until $run ln "$0" "$lockfile" 2>/dev/null; do
574 $show "Waiting for $lockfile to be removed"
575 sleep 2
576 done
577 elif test "$need_locks" = warn; then
578 if test -f "$lockfile"; then
579 echo "\
580 *** ERROR, $lockfile exists and contains:
581 `cat $lockfile 2>/dev/null`
583 This indicates that another process is trying to use the same
584 temporary object file, and libtool could not work around it because
585 your compiler does not support \`-c' and \`-o' together. If you
586 repeat this compilation, it may succeed, by chance, but you had better
587 avoid parallel builds (make -j) in this platform, or get a better
588 compiler."
590 $run $rm $removelist
591 exit 1
593 echo $srcfile > "$lockfile"
596 if test -n "$fix_srcfile_path"; then
597 eval srcfile=\"$fix_srcfile_path\"
600 $run $rm "$libobj" "${libobj}T"
602 # Create a libtool object file (analogous to a ".la" file),
603 # but don't create it if we're doing a dry run.
604 test -z "$run" && cat > ${libobj}T <<EOF
605 # $libobj - a libtool object file
606 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
608 # Please DO NOT delete this file!
609 # It is necessary for linking the library.
611 # Name of the PIC object.
614 # Only build a PIC object if we are building libtool libraries.
615 if test "$build_libtool_libs" = yes; then
616 # Without this assignment, base_compile gets emptied.
617 fbsd_hideous_sh_bug=$base_compile
619 if test "$pic_mode" != no; then
620 command="$base_compile $srcfile $pic_flag"
621 else
622 # Don't build PIC code
623 command="$base_compile $srcfile"
626 if test ! -d ${xdir}$objdir; then
627 $show "$mkdir ${xdir}$objdir"
628 $run $mkdir ${xdir}$objdir
629 status=$?
630 if test $status -ne 0 && test ! -d ${xdir}$objdir; then
631 exit $status
635 if test -z "$output_obj"; then
636 # Place PIC objects in $objdir
637 command="$command -o $lobj"
640 $run $rm "$lobj" "$output_obj"
642 $show "$command"
643 if $run eval "$command"; then :
644 else
645 test -n "$output_obj" && $run $rm $removelist
646 exit 1
649 if test "$need_locks" = warn &&
650 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
651 echo "\
652 *** ERROR, $lockfile contains:
653 `cat $lockfile 2>/dev/null`
655 but it should contain:
656 $srcfile
658 This indicates that another process is trying to use the same
659 temporary object file, and libtool could not work around it because
660 your compiler does not support \`-c' and \`-o' together. If you
661 repeat this compilation, it may succeed, by chance, but you had better
662 avoid parallel builds (make -j) in this platform, or get a better
663 compiler."
665 $run $rm $removelist
666 exit 1
669 # Just move the object if needed, then go on to compile the next one
670 if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
671 $show "$mv $output_obj $lobj"
672 if $run $mv $output_obj $lobj; then :
673 else
674 error=$?
675 $run $rm $removelist
676 exit $error
680 # Append the name of the PIC object to the libtool object file.
681 test -z "$run" && cat >> ${libobj}T <<EOF
682 pic_object='$objdir/$objname'
686 # Allow error messages only from the first compilation.
687 suppress_output=' >/dev/null 2>&1'
688 else
689 # No PIC object so indicate it doesn't exist in the libtool
690 # object file.
691 test -z "$run" && cat >> ${libobj}T <<EOF
692 pic_object=none
697 # Only build a position-dependent object if we build old libraries.
698 if test "$build_old_libs" = yes; then
699 if test "$pic_mode" != yes; then
700 # Don't build PIC code
701 command="$base_compile $srcfile"
702 else
703 command="$base_compile $srcfile $pic_flag"
705 if test "$compiler_c_o" = yes; then
706 command="$command -o $obj"
709 # Suppress compiler output if we already did a PIC compilation.
710 command="$command$suppress_output"
711 $run $rm "$obj" "$output_obj"
712 $show "$command"
713 if $run eval "$command"; then :
714 else
715 $run $rm $removelist
716 exit 1
719 if test "$need_locks" = warn &&
720 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
721 echo "\
722 *** ERROR, $lockfile contains:
723 `cat $lockfile 2>/dev/null`
725 but it should contain:
726 $srcfile
728 This indicates that another process is trying to use the same
729 temporary object file, and libtool could not work around it because
730 your compiler does not support \`-c' and \`-o' together. If you
731 repeat this compilation, it may succeed, by chance, but you had better
732 avoid parallel builds (make -j) in this platform, or get a better
733 compiler."
735 $run $rm $removelist
736 exit 1
739 # Just move the object if needed
740 if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
741 $show "$mv $output_obj $obj"
742 if $run $mv $output_obj $obj; then :
743 else
744 error=$?
745 $run $rm $removelist
746 exit $error
750 # Append the name of the non-PIC object the libtool object file.
751 # Only append if the libtool object file exists.
752 test -z "$run" && cat >> ${libobj}T <<EOF
753 # Name of the non-PIC object.
754 non_pic_object='$objname'
757 else
758 # Append the name of the non-PIC object the libtool object file.
759 # Only append if the libtool object file exists.
760 test -z "$run" && cat >> ${libobj}T <<EOF
761 # Name of the non-PIC object.
762 non_pic_object=none
767 $run $mv "${libobj}T" "${libobj}"
769 # Unlock the critical section if it was locked
770 if test "$need_locks" != no; then
771 $run $rm "$lockfile"
774 exit 0
777 # libtool link mode
778 link | relink)
779 modename="$modename: link"
780 case "$host" in
781 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
782 # It is impossible to link a dll without this setting, and
783 # we shouldn't force the makefile maintainer to figure out
784 # which system we are compiling for in order to pass an extra
785 # flag for every libtool invokation.
786 # allow_undefined=no
788 # FIXME: Unfortunately, there are problems with the above when trying
789 # to make a dll which has undefined symbols, in which case not
790 # even a static library is built. For now, we need to specify
791 # -no-undefined on the libtool link line when we can be certain
792 # that all symbols are satisfied, otherwise we get a static library.
793 allow_undefined=yes
796 allow_undefined=yes
798 esac
799 libtool_args="$nonopt"
800 base_compile="$nonopt"
801 compile_command="$nonopt"
802 finalize_command="$nonopt"
804 compile_rpath=
805 finalize_rpath=
806 compile_shlibpath=
807 finalize_shlibpath=
808 convenience=
809 old_convenience=
810 deplibs=
811 old_deplibs=
812 compiler_flags=
813 linker_flags=
814 dllsearchpath=
815 lib_search_path=`pwd`
817 avoid_version=no
818 dlfiles=
819 dlprefiles=
820 dlself=no
821 export_dynamic=no
822 export_symbols=
823 export_symbols_regex=
824 generated=
825 libobjs=
826 ltlibs=
827 module=no
828 no_install=no
829 objs=
830 non_pic_objects=
831 prefer_static_libs=no
832 preload=no
833 prev=
834 prevarg=
835 release=
836 rpath=
837 xrpath=
838 perm_rpath=
839 temp_rpath=
840 thread_safe=no
841 vinfo=
843 # We need to know -static, to get the right output filenames.
844 for arg
846 case "$arg" in
847 -all-static | -static)
848 if test "X$arg" = "X-all-static"; then
849 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
850 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
852 if test -n "$link_static_flag"; then
853 dlopen_self=$dlopen_self_static
855 else
856 if test -z "$pic_flag" && test -n "$link_static_flag"; then
857 dlopen_self=$dlopen_self_static
860 build_libtool_libs=no
861 build_old_libs=yes
862 prefer_static_libs=yes
863 break
865 esac
866 done
868 # See if our shared archives depend on static archives.
869 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
871 # Go through the arguments, transforming them on the way.
872 while test $# -gt 0; do
873 arg="$1"
874 base_compile="$base_compile $arg"
875 shift
876 case "$arg" in
877 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
878 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
880 *) qarg=$arg ;;
881 esac
882 libtool_args="$libtool_args $qarg"
884 # If the previous option needs an argument, assign it.
885 if test -n "$prev"; then
886 case "$prev" in
887 output)
888 compile_command="$compile_command @OUTPUT@"
889 finalize_command="$finalize_command @OUTPUT@"
891 esac
893 case "$prev" in
894 dlfiles|dlprefiles)
895 if test "$preload" = no; then
896 # Add the symbol object into the linking commands.
897 compile_command="$compile_command @SYMFILE@"
898 finalize_command="$finalize_command @SYMFILE@"
899 preload=yes
901 case "$arg" in
902 *.la | *.lo) ;; # We handle these cases below.
903 force)
904 if test "$dlself" = no; then
905 dlself=needless
906 export_dynamic=yes
908 prev=
909 continue
911 self)
912 if test "$prev" = dlprefiles; then
913 dlself=yes
914 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
915 dlself=yes
916 else
917 dlself=needless
918 export_dynamic=yes
920 prev=
921 continue
924 if test "$prev" = dlfiles; then
925 dlfiles="$dlfiles $arg"
926 else
927 dlprefiles="$dlprefiles $arg"
929 prev=
930 continue
932 esac
934 expsyms)
935 export_symbols="$arg"
936 if test ! -f "$arg"; then
937 $echo "$modename: symbol file \`$arg' does not exist"
938 exit 1
940 prev=
941 continue
943 expsyms_regex)
944 export_symbols_regex="$arg"
945 prev=
946 continue
948 release)
949 release="-$arg"
950 prev=
951 continue
953 rpath | xrpath)
954 # We need an absolute path.
955 case "$arg" in
956 [\\/]* | [A-Za-z]:[\\/]*) ;;
958 $echo "$modename: only absolute run-paths are allowed" 1>&2
959 exit 1
961 esac
962 if test "$prev" = rpath; then
963 case "$rpath " in
964 *" $arg "*) ;;
965 *) rpath="$rpath $arg" ;;
966 esac
967 else
968 case "$xrpath " in
969 *" $arg "*) ;;
970 *) xrpath="$xrpath $arg" ;;
971 esac
973 prev=
974 continue
976 xcompiler)
977 compiler_flags="$compiler_flags $qarg"
978 prev=
979 compile_command="$compile_command $qarg"
980 finalize_command="$finalize_command $qarg"
981 continue
983 xlinker)
984 linker_flags="$linker_flags $qarg"
985 compiler_flags="$compiler_flags $wl$qarg"
986 prev=
987 compile_command="$compile_command $wl$qarg"
988 finalize_command="$finalize_command $wl$qarg"
989 continue
992 eval "$prev=\"\$arg\""
993 prev=
994 continue
996 esac
999 prevarg="$arg"
1001 case "$arg" in
1002 -all-static)
1003 if test -n "$link_static_flag"; then
1004 compile_command="$compile_command $link_static_flag"
1005 finalize_command="$finalize_command $link_static_flag"
1007 continue
1010 -allow-undefined)
1011 # FIXME: remove this flag sometime in the future.
1012 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1013 continue
1016 -avoid-version)
1017 avoid_version=yes
1018 continue
1021 -dlopen)
1022 prev=dlfiles
1023 continue
1026 -dlpreopen)
1027 prev=dlprefiles
1028 continue
1031 -export-dynamic)
1032 export_dynamic=yes
1033 continue
1036 -export-symbols | -export-symbols-regex)
1037 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1038 $echo "$modename: not more than one -exported-symbols argument allowed"
1039 exit 1
1041 if test "X$arg" = "X-export-symbols"; then
1042 prev=expsyms
1043 else
1044 prev=expsyms_regex
1046 continue
1049 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1050 # so, if we see these flags be careful not to treat them like -L
1051 -L[A-Z][A-Z]*:*)
1052 case $with_gcc/$host in
1053 no/*-*-irix*)
1054 compile_command="$compile_command $arg"
1055 finalize_command="$finalize_command $arg"
1057 esac
1058 continue
1061 -L*)
1062 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1063 # We need an absolute path.
1064 case "$dir" in
1065 [\\/]* | [A-Za-z]:[\\/]*) ;;
1067 absdir=`cd "$dir" && pwd`
1068 if test -z "$absdir"; then
1069 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1070 exit 1
1072 dir="$absdir"
1074 esac
1075 case "$deplibs " in
1076 *" -L$dir "*) ;;
1078 deplibs="$deplibs -L$dir"
1079 lib_search_path="$lib_search_path $dir"
1081 esac
1082 case "$host" in
1083 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1084 case ":$dllsearchpath:" in
1085 *":$dir:"*) ;;
1086 *) dllsearchpath="$dllsearchpath:$dir";;
1087 esac
1089 esac
1090 continue
1093 -l*)
1094 if test "$arg" = "-lc"; then
1095 case "$host" in
1096 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
1097 # These systems don't actually have c library (as such)
1098 continue
1100 esac
1101 elif test "$arg" = "-lm"; then
1102 case "$host" in
1103 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1104 # These systems don't actually have math library (as such)
1105 continue
1107 esac
1109 deplibs="$deplibs $arg"
1110 continue
1113 -module)
1114 module=yes
1115 continue
1118 -no-fast-install)
1119 fast_install=no
1120 continue
1123 -no-install)
1124 case "$host" in
1125 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1126 # The PATH hackery in wrapper scripts is required on Windows
1127 # in order for the loader to find any dlls it needs.
1128 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1129 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1130 fast_install=no
1132 *-*-rhapsody*)
1133 # rhapsody is a little odd...
1134 deplibs="$deplibs -framework System"
1137 no_install=yes
1139 esac
1140 continue
1143 -no-undefined)
1144 allow_undefined=no
1145 continue
1148 -o) prev=output ;;
1150 -release)
1151 prev=release
1152 continue
1155 -rpath)
1156 prev=rpath
1157 continue
1161 prev=xrpath
1162 continue
1165 -R*)
1166 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1167 # We need an absolute path.
1168 case "$dir" in
1169 [\\/]* | [A-Za-z]:[\\/]*) ;;
1171 $echo "$modename: only absolute run-paths are allowed" 1>&2
1172 exit 1
1174 esac
1175 case "$xrpath " in
1176 *" $dir "*) ;;
1177 *) xrpath="$xrpath $dir" ;;
1178 esac
1179 continue
1182 -static)
1183 # The effects of -static are defined in a previous loop.
1184 # We used to do the same as -all-static on platforms that
1185 # didn't have a PIC flag, but the assumption that the effects
1186 # would be equivalent was wrong. It would break on at least
1187 # Digital Unix and AIX.
1188 continue
1191 -thread-safe)
1192 thread_safe=yes
1193 continue
1196 -version-info)
1197 prev=vinfo
1198 continue
1201 -Wc,*)
1202 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1203 arg=
1204 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1205 for flag in $args; do
1206 IFS="$save_ifs"
1207 case "$flag" in
1208 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1209 flag="\"$flag\""
1211 esac
1212 arg="$arg $wl$flag"
1213 compiler_flags="$compiler_flags $flag"
1214 done
1215 IFS="$save_ifs"
1216 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1219 -Wl,*)
1220 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1221 arg=
1222 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1223 for flag in $args; do
1224 IFS="$save_ifs"
1225 case "$flag" in
1226 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1227 flag="\"$flag\""
1229 esac
1230 arg="$arg $wl$flag"
1231 compiler_flags="$compiler_flags $wl$flag"
1232 linker_flags="$linker_flags $flag"
1233 done
1234 IFS="$save_ifs"
1235 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1238 -Xcompiler)
1239 prev=xcompiler
1240 continue
1243 -Xlinker)
1244 prev=xlinker
1245 continue
1248 # Some other compiler flag.
1249 -* | +*)
1250 # Unknown arguments in both finalize_command and compile_command need
1251 # to be aesthetically quoted because they are evaled later.
1252 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1253 case "$arg" in
1254 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1255 arg="\"$arg\""
1257 esac
1260 *.$objext)
1261 # A standard object.
1262 objs="$objs $arg"
1265 *.lo)
1266 # A libtool-controlled object.
1268 # Check to see that this really is a libtool object.
1269 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1270 pic_object=
1271 non_pic_object=
1273 # Read the .lo file
1274 # If there is no directory component, then add one.
1275 case "$arg" in
1276 */* | *\\*) . $arg ;;
1277 *) . ./$arg ;;
1278 esac
1280 if test -z "$pic_object" || \
1281 test -z "$non_pic_object" ||
1282 test "$pic_object" = none && \
1283 test "$non_pic_object" = none; then
1284 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1285 exit 1
1288 # Extract subdirectory from the argument.
1289 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1290 if test "X$xdir" = "X$arg"; then
1291 xdir=
1292 else
1293 xdir="$xdir/"
1296 if test "$pic_object" != none; then
1297 # Prepend the subdirectory the object is found in.
1298 pic_object="$xdir$pic_object"
1300 if test "$prev" = dlfiles; then
1301 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1302 dlfiles="$dlfiles $pic_object"
1303 prev=
1304 continue
1305 else
1306 # If libtool objects are unsupported, then we need to preload.
1307 prev=dlprefiles
1311 # CHECK ME: I think I busted this. -Ossama
1312 if test "$prev" = dlprefiles; then
1313 # Preload the old-style object.
1314 dlprefiles="$dlprefiles $pic_object"
1315 prev=
1318 # A PIC object.
1319 libobjs="$libobjs $pic_object"
1320 arg="$pic_object"
1323 # Non-PIC object.
1324 if test "$non_pic_object" != none; then
1325 # Prepend the subdirectory the object is found in.
1326 non_pic_object="$xdir$non_pic_object"
1328 # A standard non-PIC object
1329 non_pic_objects="$non_pic_objects $non_pic_object"
1330 if test -z "$pic_object" || test "$pic_object" = none ; then
1331 arg="$non_pic_object"
1334 else
1335 # Only an error if not doing a dry-run.
1336 if test -z "$run"; then
1337 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1338 exit 1
1339 else
1340 # Dry-run case.
1342 # Extract subdirectory from the argument.
1343 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1344 if test "X$xdir" = "X$arg"; then
1345 xdir=
1346 else
1347 xdir="$xdir/"
1350 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1351 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1352 libobjs="$libobjs $pic_object"
1353 non_pic_objects="$non_pic_objects $non_pic_object"
1358 *.$libext)
1359 # An archive.
1360 deplibs="$deplibs $arg"
1361 old_deplibs="$old_deplibs $arg"
1362 continue
1365 *.la)
1366 # A libtool-controlled library.
1368 if test "$prev" = dlfiles; then
1369 # This library was specified with -dlopen.
1370 dlfiles="$dlfiles $arg"
1371 prev=
1372 elif test "$prev" = dlprefiles; then
1373 # The library was specified with -dlpreopen.
1374 dlprefiles="$dlprefiles $arg"
1375 prev=
1376 else
1377 deplibs="$deplibs $arg"
1379 continue
1382 # Some other compiler argument.
1384 # Unknown arguments in both finalize_command and compile_command need
1385 # to be aesthetically quoted because they are evaled later.
1386 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1387 case "$arg" in
1388 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1389 arg="\"$arg\""
1391 esac
1393 esac
1395 # Now actually substitute the argument into the commands.
1396 if test -n "$arg"; then
1397 compile_command="$compile_command $arg"
1398 finalize_command="$finalize_command $arg"
1400 done
1402 if test -n "$prev"; then
1403 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1404 $echo "$help" 1>&2
1405 exit 1
1408 # Infer tagged configuration to use if any are available and
1409 # if one wasn't chosen via the "--tag" command line option.
1410 # Only attempt this if the compiler in the base link
1411 # command doesn't match the default compiler.
1412 if test -n "$available_tags" && test -z "$tagname"; then
1413 case $base_compile in
1414 "$CC "*) ;;
1415 # Blanks in the command may have been stripped by the calling shell,
1416 # but not from the CC environment variable when ltconfig was run.
1417 "`$echo $CC` "*) ;;
1419 for z in $available_tags; do
1420 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1421 # Evaluate the configuration.
1422 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1423 case $base_compile in
1424 "$CC "*)
1425 # The compiler in $compile_command matches
1426 # the one in the tagged configuration.
1427 # Assume this is the tagged configuration we want.
1428 tagname=$z
1429 break
1431 "`$echo $CC` "*)
1432 tagname=$z
1433 break
1435 esac
1437 done
1438 # If $tagname still isn't set, then no tagged configuration
1439 # was found and let the user know that the "--tag" command
1440 # line option must be used.
1441 if test -z "$tagname"; then
1442 echo "$modename: unable to infer tagged configuration"
1443 echo "$modename: specify a tag with \`--tag'" 1>&2
1444 exit 1
1445 # else
1446 # echo "$modename: using $tagname tagged configuration"
1449 esac
1452 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1453 eval arg=\"$export_dynamic_flag_spec\"
1454 compile_command="$compile_command $arg"
1455 finalize_command="$finalize_command $arg"
1458 oldlibs=
1459 # calculate the name of the file, without its directory
1460 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1461 libobjs_save="$libobjs"
1463 if test -n "$shlibpath_var"; then
1464 # get the directories listed in $shlibpath_var
1465 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1466 else
1467 shlib_search_path=
1469 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1470 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1472 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1473 if test "X$output_objdir" = "X$output"; then
1474 output_objdir="$objdir"
1475 else
1476 output_objdir="$output_objdir/$objdir"
1478 # Create the object directory.
1479 if test ! -d $output_objdir; then
1480 $show "$mkdir $output_objdir"
1481 $run $mkdir $output_objdir
1482 status=$?
1483 if test $status -ne 0 && test ! -d $output_objdir; then
1484 exit $status
1488 # Determine the type of output
1489 case "$output" in
1491 $echo "$modename: you must specify an output file" 1>&2
1492 $echo "$help" 1>&2
1493 exit 1
1495 *.$libext) linkmode=oldlib ;;
1496 *.lo | *.$objext) linkmode=obj ;;
1497 *.la) linkmode=lib ;;
1498 *) linkmode=prog ;; # Anything else should be a program.
1499 esac
1501 specialdeplibs=
1502 libs=
1503 # Find all interdependent deplibs by searching for libraries
1504 # that are linked more than once (e.g. -la -lb -la)
1505 for deplib in $deplibs; do
1506 case "$libs " in
1507 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1508 esac
1509 libs="$libs $deplib"
1510 done
1512 if test $linkmode = lib; then
1513 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1516 deplibs=
1517 newdependency_libs=
1518 newlib_search_path=
1519 need_relink=no # whether we're linking any uninstalled libtool libraries
1520 uninst_deplibs= # uninstalled libtool libraries
1521 uninst_path= # paths that contain uninstalled libtool libraries
1522 case $linkmode in
1523 lib)
1524 passes="conv link"
1525 for file in $dlfiles $dlprefiles; do
1526 case "$file" in
1527 *.la) ;;
1529 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1530 exit 1
1532 esac
1533 done
1535 prog)
1536 compile_deplibs=
1537 finalize_deplibs=
1538 alldeplibs=no
1539 newdlfiles=
1540 newdlprefiles=
1541 passes="conv scan dlopen dlpreopen link"
1543 *) passes="conv"
1545 esac
1546 for pass in $passes; do
1547 if test "$linkmode,$pass" = "lib,link" ||
1548 test "$linkmode,$pass" = "prog,scan"; then
1549 libs="$deplibs"
1550 deplibs=
1552 if test $linkmode = prog; then
1553 case $pass in
1554 dlopen) libs="$dlfiles" ;;
1555 dlpreopen) libs="$dlprefiles" ;;
1556 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1557 esac
1559 if test $pass = dlopen; then
1560 # Collect dlpreopened libraries
1561 save_deplibs="$deplibs"
1562 deplibs=
1564 for deplib in $libs; do
1565 lib=
1566 found=no
1567 case "$deplib" in
1568 -l*)
1569 if test $linkmode != lib && test $linkmode != prog; then
1570 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1571 continue
1573 if test $pass = conv; then
1574 deplibs="$deplib $deplibs"
1575 continue
1577 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1578 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1579 # Search the libtool library
1580 lib="$searchdir/lib${name}.la"
1581 if test -f "$lib"; then
1582 found=yes
1583 break
1585 done
1586 if test "$found" != yes; then
1587 if test "$linkmode,$pass" = "prog,link"; then
1588 compile_deplibs="$deplib $compile_deplibs"
1589 finalize_deplibs="$deplib $finalize_deplibs"
1590 else
1591 deplibs="$deplib $deplibs"
1592 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1594 continue
1597 -L*)
1598 case $linkmode in
1599 lib)
1600 deplibs="$deplib $deplibs"
1601 test $pass = conv && continue
1602 newdependency_libs="$deplib $newdependency_libs"
1603 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1605 prog)
1606 if test $pass = conv; then
1607 deplibs="$deplib $deplibs"
1608 continue
1610 if test $pass = scan; then
1611 deplibs="$deplib $deplibs"
1612 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1613 else
1614 compile_deplibs="$deplib $compile_deplibs"
1615 finalize_deplibs="$deplib $finalize_deplibs"
1619 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1621 esac
1622 continue
1624 -R*)
1625 if test $pass = link; then
1626 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1627 # Make sure the xrpath contains only unique directories.
1628 case "$xrpath " in
1629 *" $dir "*) ;;
1630 *) xrpath="$xrpath $dir" ;;
1631 esac
1633 deplibs="$deplib $deplibs"
1634 continue
1636 *.la) lib="$deplib" ;;
1637 *.$libext)
1638 if test $pass = conv; then
1639 deplibs="$deplib $deplibs"
1640 continue
1642 case $linkmode in
1643 lib)
1644 if test "$deplibs_check_method" != pass_all; then
1645 echo
1646 echo "*** Warning: This library needs some functionality provided by $deplib."
1647 echo "*** I have the capability to make that library automatically link in when"
1648 echo "*** you link to this library. But I can only do this if you have a"
1649 echo "*** shared version of the library, which you do not appear to have."
1650 else
1651 echo
1652 echo "*** Warning: Linking the shared library $output against the"
1653 echo "*** static library $deplib is not portable!"
1654 deplibs="$deplib $deplibs"
1656 continue
1658 prog)
1659 if test $pass != link; then
1660 deplibs="$deplib $deplibs"
1661 else
1662 compile_deplibs="$deplib $compile_deplibs"
1663 finalize_deplibs="$deplib $finalize_deplibs"
1665 continue
1667 esac
1669 *.lo | *.$objext)
1670 if test $pass = conv; then
1671 deplibs="$deplib $deplibs"
1672 elif test $linkmode = prog; then
1673 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1674 # If there is no dlopen support or we're linking statically,
1675 # we need to preload.
1676 newdlprefiles="$newdlprefiles $deplib"
1677 compile_deplibs="$deplib $compile_deplibs"
1678 finalize_deplibs="$deplib $finalize_deplibs"
1679 else
1680 newdlfiles="$newdlfiles $deplib"
1683 continue
1685 %DEPLIBS%)
1686 alldeplibs=yes
1687 continue
1689 esac
1690 if test $found = yes || test -f "$lib"; then :
1691 else
1692 $echo "$modename: cannot find the library \`$lib'" 1>&2
1693 exit 1
1696 # Check to see that this really is a libtool archive.
1697 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1698 else
1699 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1700 exit 1
1703 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1704 test "X$ladir" = "X$lib" && ladir="."
1706 dlname=
1707 dlopen=
1708 dlpreopen=
1709 libdir=
1710 library_names=
1711 old_library=
1712 # If the library was installed with an old release of libtool,
1713 # it will not redefine variable installed.
1714 installed=yes
1716 # Read the .la file
1717 case "$lib" in
1718 */* | *\\*) . $lib ;;
1719 *) . ./$lib ;;
1720 esac
1722 if test "$linkmode,$pass" = "lib,link" ||
1723 test "$linkmode,$pass" = "prog,scan" ||
1724 { test $linkmode != prog && test $linkmode != lib; }; then
1725 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1726 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1729 if test $pass = conv; then
1730 # only check for convenience libraries
1731 deplibs="$lib $deplibs"
1732 if test -z "$libdir"; then
1733 if test -z "$old_library"; then
1734 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1735 exit 1
1737 # It is a libtool convenience library, so add in its objects.
1738 convenience="$convenience $ladir/$objdir/$old_library"
1739 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1740 tmp_libs=
1741 for deplib in $dependency_libs; do
1742 deplibs="$deplib $deplibs"
1743 case "$tmp_libs " in
1744 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1745 esac
1746 tmp_libs="$tmp_libs $deplib"
1747 done
1748 elif test $linkmode != prog && test $linkmode != lib; then
1749 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1750 exit 1
1752 continue
1755 # Get the name of the library we link against.
1756 linklib=
1757 for l in $old_library $library_names; do
1758 linklib="$l"
1759 done
1760 if test -z "$linklib"; then
1761 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1762 exit 1
1765 # This library was specified with -dlopen.
1766 if test $pass = dlopen; then
1767 if test -z "$libdir"; then
1768 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1769 exit 1
1771 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1772 # If there is no dlname, no dlopen support or we're linking statically,
1773 # we need to preload.
1774 dlprefiles="$dlprefiles $lib"
1775 else
1776 newdlfiles="$newdlfiles $lib"
1778 continue
1781 # We need an absolute path.
1782 case "$ladir" in
1783 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1785 abs_ladir=`cd "$ladir" && pwd`
1786 if test -z "$abs_ladir"; then
1787 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1788 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1789 abs_ladir="$ladir"
1792 esac
1793 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1795 # Find the relevant object directory and library name.
1796 if test "X$installed" = Xyes; then
1797 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1798 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1799 dir="$ladir"
1800 absdir="$abs_ladir"
1801 libdir="$abs_ladir"
1802 else
1803 dir="$libdir"
1804 absdir="$libdir"
1806 else
1807 dir="$ladir/$objdir"
1808 absdir="$abs_ladir/$objdir"
1809 # Remove this search path later
1810 uninst_path="$uninst_path $abs_ladir"
1812 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1814 # This library was specified with -dlpreopen.
1815 if test $pass = dlpreopen; then
1816 if test -z "$libdir"; then
1817 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1818 exit 1
1820 # Prefer using a static library (so that no silly _DYNAMIC symbols
1821 # are required to link).
1822 if test -n "$old_library"; then
1823 newdlprefiles="$newdlprefiles $dir/$old_library"
1824 # Otherwise, use the dlname, so that lt_dlopen finds it.
1825 elif test -n "$dlname"; then
1826 newdlprefiles="$newdlprefiles $dir/$dlname"
1827 else
1828 newdlprefiles="$newdlprefiles $dir/$linklib"
1832 if test -z "$libdir"; then
1833 # link the convenience library
1834 if test $linkmode = lib; then
1835 deplibs="$dir/$old_library $deplibs"
1836 elif test "$linkmode,$pass" = "prog,link"; then
1837 compile_deplibs="$dir/$old_library $compile_deplibs"
1838 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1839 else
1840 deplibs="$lib $deplibs" # used for prog,scan pass
1842 continue
1845 if test $linkmode = prog && test $pass != link; then
1846 newlib_search_path="$newlib_search_path $ladir"
1847 deplibs="$lib $deplibs"
1849 linkalldeplibs=no
1850 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1851 test "$build_libtool_libs" = no; then
1852 linkalldeplibs=yes
1855 tmp_libs=
1856 for deplib in $dependency_libs; do
1857 case "$deplib" in
1858 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1859 esac
1860 # Need to link against all dependency_libs?
1861 if test $linkalldeplibs = yes; then
1862 deplibs="$deplib $deplibs"
1863 else
1864 # Need to hardcode shared library paths
1865 # or/and link against static libraries
1866 newdependency_libs="$deplib $newdependency_libs"
1868 case "$tmp_libs " in
1869 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1870 esac
1871 tmp_libs="$tmp_libs $deplib"
1872 done
1873 continue
1876 if test "$linkmode,$pass" = "prog,link"; then
1877 if test -n "$library_names" &&
1878 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1879 # We need to hardcode the library path
1880 if test -n "$shlibpath_var"; then
1881 # Make sure the rpath contains only unique directories.
1882 case "$temp_rpath " in
1883 *" $dir "*) ;;
1884 *" $absdir "*) ;;
1885 *) temp_rpath="$temp_rpath $dir" ;;
1886 esac
1889 # Hardcode the library path.
1890 # Skip directories that are in the system default run-time
1891 # search path.
1892 case " $sys_lib_dlsearch_path " in
1893 *" $absdir "*) ;;
1895 case "$compile_rpath " in
1896 *" $absdir "*) ;;
1897 *) compile_rpath="$compile_rpath $absdir"
1898 esac
1900 esac
1902 case " $sys_lib_dlsearch_path " in
1903 *" $libdir "*) ;;
1905 case "$finalize_rpath " in
1906 *" $libdir "*) ;;
1907 *) finalize_rpath="$finalize_rpath $libdir"
1908 esac
1910 esac
1913 if test "$alldeplibs" = yes &&
1914 { test "$deplibs_check_method" = pass_all ||
1915 { test "$build_libtool_libs" = yes &&
1916 test -n "$library_names"; }; }; then
1917 # We only need to search for static libraries
1918 continue
1922 link_static=no # Whether the deplib will be linked statically
1923 if test -n "$library_names" &&
1924 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1925 if test "$installed" = no; then
1926 uninst_deplibs="$uninst_deplibs $lib"
1927 need_relink=yes
1929 # This is a shared library
1930 if test $linkmode = lib &&
1931 test $hardcode_into_libs = yes; then
1932 # Hardcode the library path.
1933 # Skip directories that are in the system default run-time
1934 # search path.
1935 case " $sys_lib_dlsearch_path " in
1936 *" $absdir "*) ;;
1938 case "$compile_rpath " in
1939 *" $absdir "*) ;;
1940 *) compile_rpath="$compile_rpath $absdir"
1941 esac
1943 esac
1944 case " $sys_lib_dlsearch_path " in
1945 *" $libdir "*) ;;
1947 case "$finalize_rpath " in
1948 *" $libdir "*) ;;
1949 *) finalize_rpath="$finalize_rpath $libdir"
1950 esac
1952 esac
1955 if test -n "$old_archive_from_expsyms_cmds"; then
1956 # figure out the soname
1957 set dummy $library_names
1958 realname="$2"
1959 shift; shift
1960 libname=`eval \\$echo \"$libname_spec\"`
1961 if test -n "$soname_spec"; then
1962 eval soname=\"$soname_spec\"
1963 else
1964 soname="$realname"
1967 # Make a new name for the extract_expsyms_cmds to use
1968 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1970 # If the library has no export list, then create one now
1971 if test -f "$output_objdir/$soname-def"; then :
1972 else
1973 $show "extracting exported symbol list from \`$soname'"
1974 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1975 eval cmds=\"$extract_expsyms_cmds\"
1976 for cmd in $cmds; do
1977 IFS="$save_ifs"
1978 $show "$cmd"
1979 $run eval "$cmd" || exit $?
1980 done
1981 IFS="$save_ifs"
1984 # Create $newlib
1985 if test -f "$output_objdir/$newlib"; then :; else
1986 $show "generating import library for \`$soname'"
1987 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1988 eval cmds=\"$old_archive_from_expsyms_cmds\"
1989 for cmd in $cmds; do
1990 IFS="$save_ifs"
1991 $show "$cmd"
1992 $run eval "$cmd" || exit $?
1993 done
1994 IFS="$save_ifs"
1996 # make sure the library variables are pointing to the new library
1997 dir=$output_objdir
1998 linklib=$newlib
2001 if test $linkmode = prog || test "$mode" != relink; then
2002 add_shlibpath=
2003 add_dir=
2004 add=
2005 lib_linked=yes
2006 case "$hardcode_action" in
2007 immediate | unsupported)
2008 if test "$hardcode_direct" = no; then
2009 add="$dir/$linklib"
2010 elif test "$hardcode_minus_L" = no; then
2011 case "$host" in
2012 *-*-sunos*) add_shlibpath="$dir" ;;
2013 esac
2014 add_dir="-L$dir"
2015 add="-l$name"
2016 elif test "$hardcode_shlibpath_var" = no; then
2017 add_shlibpath="$dir"
2018 add="-l$name"
2019 else
2020 lib_linked=no
2023 relink)
2024 if test "$hardcode_direct" = yes; then
2025 add="$dir/$linklib"
2026 elif test "$hardcode_minus_L" = yes; then
2027 add_dir="-L$dir"
2028 add="-l$name"
2029 elif test "$hardcode_shlibpath_var" = yes; then
2030 add_shlibpath="$dir"
2031 add="-l$name"
2032 else
2033 lib_linked=no
2036 *) lib_linked=no ;;
2037 esac
2039 if test "$lib_linked" != yes; then
2040 $echo "$modename: configuration error: unsupported hardcode properties"
2041 exit 1
2044 if test -n "$add_shlibpath"; then
2045 case ":$compile_shlibpath:" in
2046 *":$add_shlibpath:"*) ;;
2047 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2048 esac
2050 if test $linkmode = prog; then
2051 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2052 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2053 else
2054 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2055 test -n "$add" && deplibs="$add $deplibs"
2056 if test "$hardcode_direct" != yes && \
2057 test "$hardcode_minus_L" != yes && \
2058 test "$hardcode_shlibpath_var" = yes; then
2059 case ":$finalize_shlibpath:" in
2060 *":$libdir:"*) ;;
2061 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2062 esac
2067 if test $linkmode = prog || test "$mode" = relink; then
2068 add_shlibpath=
2069 add_dir=
2070 add=
2071 # Finalize command for both is simple: just hardcode it.
2072 if test "$hardcode_direct" = yes; then
2073 add="$libdir/$linklib"
2074 elif test "$hardcode_minus_L" = yes; then
2075 add_dir="-L$libdir"
2076 add="-l$name"
2077 elif test "$hardcode_shlibpath_var" = yes; then
2078 case ":$finalize_shlibpath:" in
2079 *":$libdir:"*) ;;
2080 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2081 esac
2082 add="-l$name"
2083 else
2084 # We cannot seem to hardcode it, guess we'll fake it.
2085 add_dir="-L$libdir"
2086 add="-l$name"
2089 if test $linkmode = prog; then
2090 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2091 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2092 else
2093 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2094 test -n "$add" && deplibs="$add $deplibs"
2097 elif test $linkmode = prog; then
2098 # Here we assume that one of hardcode_direct or hardcode_minus_L
2099 # is not unsupported. This is valid on all known static and
2100 # shared platforms.
2101 if test "$hardcode_direct" != unsupported; then
2102 test -n "$old_library" && linklib="$old_library"
2103 compile_deplibs="$dir/$linklib $compile_deplibs"
2104 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2105 else
2106 compile_deplibs="-l$name -L$dir $compile_deplibs"
2107 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2109 elif test "$build_libtool_libs" = yes; then
2110 # Not a shared library
2111 if test "$deplibs_check_method" != pass_all; then
2112 # We're trying link a shared library against a static one
2113 # but the system doesn't support it.
2114 # Just print a warning and add the library to dependency_libs so
2115 # that the program can be linked against the static library.
2116 echo
2117 echo "*** Warning: This library needs some functionality provided by $lib."
2118 echo "*** I have the capability to make that library automatically link in when"
2119 echo "*** you link to this library. But I can only do this if you have a"
2120 echo "*** shared version of the library, which you do not appear to have."
2121 else
2122 convenience="$convenience $dir/$old_library"
2123 old_convenience="$old_convenience $dir/$old_library"
2124 deplibs="$dir/$old_library $deplibs"
2125 link_static=yes
2129 if test $linkmode = lib; then
2130 if test -n "$dependency_libs" &&
2131 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2132 test $link_static = yes; }; then
2133 # Extract -R from dependency_libs
2134 temp_deplibs=
2135 for libdir in $dependency_libs; do
2136 case "$libdir" in
2137 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2138 case " $xrpath " in
2139 *" $temp_xrpath "*) ;;
2140 *) xrpath="$xrpath $temp_xrpath";;
2141 esac;;
2142 *) temp_deplibs="$temp_deplibs $libdir";;
2143 esac
2144 done
2145 dependency_libs="$temp_deplibs"
2148 newlib_search_path="$newlib_search_path $absdir"
2149 # Link against this library
2150 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2151 # ... and its dependency_libs
2152 tmp_libs=
2153 for deplib in $dependency_libs; do
2154 newdependency_libs="$deplib $newdependency_libs"
2155 case "$tmp_libs " in
2156 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2157 esac
2158 tmp_libs="$tmp_libs $deplib"
2159 done
2161 if test $link_all_deplibs != no; then
2162 # Add the search paths of all dependency libraries
2163 for deplib in $dependency_libs; do
2164 case "$deplib" in
2165 -L*) path="$deplib" ;;
2166 *.la)
2167 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2168 test "X$dir" = "X$deplib" && dir="."
2169 # We need an absolute path.
2170 case "$dir" in
2171 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2173 absdir=`cd "$dir" && pwd`
2174 if test -z "$absdir"; then
2175 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2176 absdir="$dir"
2179 esac
2180 if grep "^installed=no" $deplib > /dev/null; then
2181 path="-L$absdir/$objdir"
2182 else
2183 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2184 if test -z "$libdir"; then
2185 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2186 exit 1
2188 if test "$absdir" != "$libdir"; then
2189 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2191 path="-L$absdir"
2194 *) continue ;;
2195 esac
2196 case " $deplibs " in
2197 *" $path "*) ;;
2198 *) deplibs="$path $deplibs" ;;
2199 esac
2200 done
2203 done
2204 dependency_libs="$newdependency_libs"
2205 if test $pass = dlpreopen; then
2206 # Link the dlpreopened libraries before other libraries
2207 for deplib in $save_deplibs; do
2208 deplibs="$deplib $deplibs"
2209 done
2211 if test $pass != dlopen; then
2212 if test $pass != conv; then
2213 # Make sure lib_search_path contains only unique directories.
2214 lib_search_path=
2215 for dir in $newlib_search_path; do
2216 case "$lib_search_path " in
2217 *" $dir "*) ;;
2218 *) lib_search_path="$lib_search_path $dir" ;;
2219 esac
2220 done
2221 newlib_search_path=
2224 if test "$linkmode,$pass" != "prog,link"; then
2225 vars="deplibs"
2226 else
2227 vars="compile_deplibs finalize_deplibs"
2229 for var in $vars dependency_libs; do
2230 # Make sure that $var contains only unique libraries
2231 # and add them in reverse order
2232 eval tmp_libs=\"\$$var\"
2233 new_libs=
2234 for deplib in $tmp_libs; do
2235 case "$deplib" in
2236 -L*) new_libs="$deplib $new_libs" ;;
2238 case " $specialdeplibs " in
2239 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2241 case " $new_libs " in
2242 *" $deplib "*) ;;
2243 *) new_libs="$deplib $new_libs" ;;
2244 esac
2246 esac
2248 esac
2249 done
2250 tmp_libs=
2251 for deplib in $new_libs; do
2252 case "$deplib" in
2253 -L*)
2254 case " $tmp_libs " in
2255 *" $deplib "*) ;;
2256 *) tmp_libs="$tmp_libs $deplib" ;;
2257 esac
2259 *) tmp_libs="$tmp_libs $deplib" ;;
2260 esac
2261 done
2262 eval $var=\"$tmp_libs\"
2263 done
2265 done
2266 if test $linkmode = prog; then
2267 dlfiles="$newdlfiles"
2268 dlprefiles="$newdlprefiles"
2271 case $linkmode in
2272 oldlib)
2273 if test -n "$deplibs"; then
2274 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2277 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2278 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2281 if test -n "$rpath"; then
2282 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2285 if test -n "$xrpath"; then
2286 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2289 if test -n "$vinfo"; then
2290 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2293 if test -n "$release"; then
2294 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2297 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2298 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2301 # Now set the variables for building old libraries.
2302 build_libtool_libs=no
2303 oldlibs="$output"
2304 objs="$objs$old_deplibs"
2307 lib)
2308 # Make sure we only generate libraries of the form `libNAME.la'.
2309 case "$outputname" in
2310 lib*)
2311 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2312 eval libname=\"$libname_spec\"
2315 if test "$module" = no; then
2316 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2317 $echo "$help" 1>&2
2318 exit 1
2320 if test "$need_lib_prefix" != no; then
2321 # Add the "lib" prefix for modules if required
2322 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2323 eval libname=\"$libname_spec\"
2324 else
2325 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2328 esac
2330 if test -n "$objs"; then
2331 if test "$deplibs_check_method" != pass_all; then
2332 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2333 exit 1
2334 else
2335 echo
2336 echo "*** Warning: Linking the shared library $output against the non-libtool"
2337 echo "*** objects $objs is not portable!"
2338 libobjs="$libobjs $objs"
2342 if test "$dlself" != no; then
2343 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2346 set dummy $rpath
2347 if test $# -gt 2; then
2348 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2350 install_libdir="$2"
2352 oldlibs=
2353 if test -z "$rpath"; then
2354 if test "$build_libtool_libs" = yes; then
2355 # Building a libtool convenience library.
2356 # Some compilers have problems with a `.al' extension so
2357 # convenience libraries should have the same extension an
2358 # archive normally would.
2359 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2360 build_libtool_libs=convenience
2361 build_old_libs=yes
2364 if test -n "$vinfo"; then
2365 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2368 if test -n "$release"; then
2369 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2371 else
2373 # Parse the version information argument.
2374 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2375 set dummy $vinfo 0 0 0
2376 IFS="$save_ifs"
2378 if test -n "$8"; then
2379 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2380 $echo "$help" 1>&2
2381 exit 1
2384 current="$2"
2385 revision="$3"
2386 age="$4"
2388 # Check that each of the things are valid numbers.
2389 case "$current" in
2390 0 | [1-9] | [1-9][0-9]*) ;;
2392 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2393 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2394 exit 1
2396 esac
2398 case "$revision" in
2399 0 | [1-9] | [1-9][0-9]*) ;;
2401 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2402 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2403 exit 1
2405 esac
2407 case "$age" in
2408 0 | [1-9] | [1-9][0-9]*) ;;
2410 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2411 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2412 exit 1
2414 esac
2416 if test $age -gt $current; then
2417 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2418 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2419 exit 1
2422 # Calculate the version variables.
2423 major=
2424 versuffix=
2425 verstring=
2426 case "$version_type" in
2427 none) ;;
2429 irix)
2430 major=`expr $current - $age + 1`
2431 verstring="sgi$major.$revision"
2433 # Add in all the interfaces that we are compatible with.
2434 loop=$revision
2435 while test $loop != 0; do
2436 iface=`expr $revision - $loop`
2437 loop=`expr $loop - 1`
2438 verstring="sgi$major.$iface:$verstring"
2439 done
2441 # Before this point, $major must not contain `.'.
2442 major=.$major
2443 versuffix="$major.$revision"
2446 linux)
2447 major=.`expr $current - $age`
2448 versuffix="$major.$age.$revision"
2451 osf)
2452 major=`expr $current - $age`
2453 versuffix=".$current.$age.$revision"
2454 verstring="$current.$age.$revision"
2456 # Add in all the interfaces that we are compatible with.
2457 loop=$age
2458 while test $loop != 0; do
2459 iface=`expr $current - $loop`
2460 loop=`expr $loop - 1`
2461 verstring="$verstring:${iface}.0"
2462 done
2464 # Make executables depend on our current version.
2465 verstring="$verstring:${current}.0"
2468 sunos)
2469 major=".$current"
2470 versuffix=".$current.$revision"
2473 freebsd-aout)
2474 major=".$current"
2475 versuffix=".$current.$revision";
2478 freebsd-elf)
2479 major=".$current"
2480 versuffix=".$current";
2483 windows)
2484 # Use '-' rather than '.', since we only want one
2485 # extension on DOS 8.3 filesystems.
2486 major=`expr $current - $age`
2487 versuffix="-$major"
2491 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2492 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2493 exit 1
2495 esac
2497 # Clear the version info if we defaulted, and they specified a release.
2498 if test -z "$vinfo" && test -n "$release"; then
2499 major=
2500 verstring="0.0"
2501 if test "$need_version" = no; then
2502 versuffix=
2503 else
2504 versuffix=".0.0"
2508 # Remove version info from name if versioning should be avoided
2509 if test "$avoid_version" = yes && test "$need_version" = no; then
2510 major=
2511 versuffix=
2512 verstring=""
2515 # Check to see if the archive will have undefined symbols.
2516 if test "$allow_undefined" = yes; then
2517 if test "$allow_undefined_flag" = unsupported; then
2518 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2519 build_libtool_libs=no
2520 build_old_libs=yes
2522 else
2523 # Don't allow undefined symbols.
2524 allow_undefined_flag="$no_undefined_flag"
2528 if test "$mode" != relink; then
2529 # Remove our outputs, but don't remove object files since they
2530 # may have been created when compiling PIC objects.
2531 removelist=
2532 tempremovelist=`echo "$output_objdir/*"`
2533 for p in $tempremovelist; do
2534 case "$p" in
2535 *.$objext)
2537 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2538 removelist="$removelist $p"
2540 *) ;;
2541 esac
2542 done
2543 if test -n "$removelist"; then
2544 $show "${rm}r $removelist"
2545 $run ${rm}r $removelist
2549 # Now set the variables for building old libraries.
2550 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2551 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2553 # Transform .lo files to .o files.
2554 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2557 # Eliminate all temporary directories.
2558 for path in $uninst_path; do
2559 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2560 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2561 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2562 done
2564 if test -n "$xrpath"; then
2565 # If the user specified any rpath flags, then add them.
2566 temp_xrpath=
2567 for libdir in $xrpath; do
2568 temp_xrpath="$temp_xrpath -R$libdir"
2569 case "$finalize_rpath " in
2570 *" $libdir "*) ;;
2571 *) finalize_rpath="$finalize_rpath $libdir" ;;
2572 esac
2573 done
2574 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2575 dependency_libs="$temp_xrpath $dependency_libs"
2579 # Make sure dlfiles contains only unique files that won't be dlpreopened
2580 old_dlfiles="$dlfiles"
2581 dlfiles=
2582 for lib in $old_dlfiles; do
2583 case " $dlprefiles $dlfiles " in
2584 *" $lib "*) ;;
2585 *) dlfiles="$dlfiles $lib" ;;
2586 esac
2587 done
2589 # Make sure dlprefiles contains only unique files
2590 old_dlprefiles="$dlprefiles"
2591 dlprefiles=
2592 for lib in $old_dlprefiles; do
2593 case "$dlprefiles " in
2594 *" $lib "*) ;;
2595 *) dlprefiles="$dlprefiles $lib" ;;
2596 esac
2597 done
2599 if test "$build_libtool_libs" = yes; then
2600 if test -n "$rpath"; then
2601 case "$host" in
2602 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2603 # these systems don't actually have a c library (as such)!
2606 # Add libc to deplibs on all other systems if necessary.
2607 if test $build_libtool_need_lc = "yes"; then
2608 deplibs="$deplibs -lc"
2611 esac
2614 # Transform deplibs into only deplibs that can be linked in shared.
2615 name_save=$name
2616 libname_save=$libname
2617 release_save=$release
2618 versuffix_save=$versuffix
2619 major_save=$major
2620 # I'm not sure if I'm treating the release correctly. I think
2621 # release should show up in the -l (ie -lgmp5) so we don't want to
2622 # add it in twice. Is that correct?
2623 release=""
2624 versuffix=""
2625 major=""
2626 newdeplibs=
2627 droppeddeps=no
2628 case "$deplibs_check_method" in
2629 pass_all)
2630 # Don't check for shared/static. Everything works.
2631 # This might be a little naive. We might want to check
2632 # whether the library exists or not. But this is on
2633 # osf3 & osf4 and I'm not really sure... Just
2634 # implementing what was already the behaviour.
2635 newdeplibs=$deplibs
2637 test_compile)
2638 # This code stresses the "libraries are programs" paradigm to its
2639 # limits. Maybe even breaks it. We compile a program, linking it
2640 # against the deplibs as a proxy for the library. Then we can check
2641 # whether they linked in statically or dynamically with ldd.
2642 $rm conftest.c
2643 cat > conftest.c <<EOF
2644 int main() { return 0; }
2646 $rm conftest
2647 $LTCC -o conftest conftest.c $deplibs
2648 if test $? -eq 0 ; then
2649 ldd_output=`ldd conftest`
2650 for i in $deplibs; do
2651 name="`expr $i : '-l\(.*\)'`"
2652 # If $name is empty we are operating on a -L argument.
2653 if test "$name" != "" ; then
2654 libname=`eval \\$echo \"$libname_spec\"`
2655 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2656 set dummy $deplib_matches
2657 deplib_match=$2
2658 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2659 newdeplibs="$newdeplibs $i"
2660 else
2661 droppeddeps=yes
2662 echo
2663 echo "*** Warning: This library needs some functionality provided by $i."
2664 echo "*** I have the capability to make that library automatically link in when"
2665 echo "*** you link to this library. But I can only do this if you have a"
2666 echo "*** shared version of the library, which you do not appear to have."
2668 else
2669 newdeplibs="$newdeplibs $i"
2671 done
2672 else
2673 # Error occured in the first compile. Let's try to salvage the situation:
2674 # Compile a seperate program for each library.
2675 for i in $deplibs; do
2676 name="`expr $i : '-l\(.*\)'`"
2677 # If $name is empty we are operating on a -L argument.
2678 if test "$name" != "" ; then
2679 $rm conftest
2680 $LTCC -o conftest conftest.c $i
2681 # Did it work?
2682 if test $? -eq 0 ; then
2683 ldd_output=`ldd conftest`
2684 libname=`eval \\$echo \"$libname_spec\"`
2685 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2686 set dummy $deplib_matches
2687 deplib_match=$2
2688 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2689 newdeplibs="$newdeplibs $i"
2690 else
2691 droppeddeps=yes
2692 echo
2693 echo "*** Warning: This library needs some functionality provided by $i."
2694 echo "*** I have the capability to make that library automatically link in when"
2695 echo "*** you link to this library. But I can only do this if you have a"
2696 echo "*** shared version of the library, which you do not appear to have."
2698 else
2699 droppeddeps=yes
2700 echo
2701 echo "*** Warning! Library $i is needed by this library but I was not able to"
2702 echo "*** make it link in! You will probably need to install it or some"
2703 echo "*** library that it depends on before this library will be fully"
2704 echo "*** functional. Installing it before continuing would be even better."
2706 else
2707 newdeplibs="$newdeplibs $i"
2709 done
2712 file_magic*)
2713 set dummy $deplibs_check_method
2714 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2715 for a_deplib in $deplibs; do
2716 name="`expr $a_deplib : '-l\(.*\)'`"
2717 # If $name is empty we are operating on a -L argument.
2718 if test "$name" != "" ; then
2719 libname=`eval \\$echo \"$libname_spec\"`
2720 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2721 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2722 for potent_lib in $potential_libs; do
2723 # Follow soft links.
2724 if ls -lLd "$potent_lib" 2>/dev/null \
2725 | grep " -> " >/dev/null; then
2726 continue
2728 # The statement above tries to avoid entering an
2729 # endless loop below, in case of cyclic links.
2730 # We might still enter an endless loop, since a link
2731 # loop can be closed while we follow links,
2732 # but so what?
2733 potlib="$potent_lib"
2734 while test -h "$potlib" 2>/dev/null; do
2735 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2736 case "$potliblink" in
2737 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2738 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2739 esac
2740 done
2741 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2742 | sed 10q \
2743 | egrep "$file_magic_regex" > /dev/null; then
2744 newdeplibs="$newdeplibs $a_deplib"
2745 a_deplib=""
2746 break 2
2748 done
2749 done
2750 if test -n "$a_deplib" ; then
2751 droppeddeps=yes
2752 echo
2753 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2754 echo "*** I have the capability to make that library automatically link in when"
2755 echo "*** you link to this library. But I can only do this if you have a"
2756 echo "*** shared version of the library, which you do not appear to have."
2758 else
2759 # Add a -L argument.
2760 newdeplibs="$newdeplibs $a_deplib"
2762 done # Gone through all deplibs.
2764 none | unknown | *)
2765 newdeplibs=""
2766 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2767 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2768 grep . >/dev/null; then
2769 echo
2770 if test "X$deplibs_check_method" = "Xnone"; then
2771 echo "*** Warning: inter-library dependencies are not supported in this platform."
2772 else
2773 echo "*** Warning: inter-library dependencies are not known to be supported."
2775 echo "*** All declared inter-library dependencies are being dropped."
2776 droppeddeps=yes
2779 esac
2780 versuffix=$versuffix_save
2781 major=$major_save
2782 release=$release_save
2783 libname=$libname_save
2784 name=$name_save
2786 if test "$droppeddeps" = yes; then
2787 if test "$module" = yes; then
2788 echo
2789 echo "*** Warning: libtool could not satisfy all declared inter-library"
2790 echo "*** dependencies of module $libname. Therefore, libtool will create"
2791 echo "*** a static module, that should work as long as the dlopening"
2792 echo "*** application is linked with the -dlopen flag."
2793 if test -z "$global_symbol_pipe"; then
2794 echo
2795 echo "*** However, this would only work if libtool was able to extract symbol"
2796 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2797 echo "*** not find such a program. So, this module is probably useless."
2798 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2800 if test "$build_old_libs" = no; then
2801 oldlibs="$output_objdir/$libname.$libext"
2802 build_libtool_libs=module
2803 build_old_libs=yes
2804 else
2805 build_libtool_libs=no
2807 else
2808 echo "*** The inter-library dependencies that have been dropped here will be"
2809 echo "*** automatically added whenever a program is linked with this library"
2810 echo "*** or is declared to -dlopen it."
2813 # Done checking deplibs!
2814 deplibs=$newdeplibs
2817 # All the library-specific variables (install_libdir is set above).
2818 library_names=
2819 old_library=
2820 dlname=
2822 # Test again, we may have decided not to build it any more
2823 if test "$build_libtool_libs" = yes; then
2824 if test $hardcode_into_libs = yes; then
2825 # Hardcode the library paths
2826 hardcode_libdirs=
2827 dep_rpath=
2828 rpath="$finalize_rpath"
2829 test "$mode" != relink && rpath="$compile_rpath$rpath"
2830 for libdir in $rpath; do
2831 if test -n "$hardcode_libdir_flag_spec"; then
2832 if test -n "$hardcode_libdir_separator"; then
2833 if test -z "$hardcode_libdirs"; then
2834 hardcode_libdirs="$libdir"
2835 else
2836 # Just accumulate the unique libdirs.
2837 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2838 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2841 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2843 esac
2845 else
2846 eval flag=\"$hardcode_libdir_flag_spec\"
2847 dep_rpath="$dep_rpath $flag"
2849 elif test -n "$runpath_var"; then
2850 case "$perm_rpath " in
2851 *" $libdir "*) ;;
2852 *) perm_rpath="$perm_rpath $libdir" ;;
2853 esac
2855 done
2856 # Substitute the hardcoded libdirs into the rpath.
2857 if test -n "$hardcode_libdir_separator" &&
2858 test -n "$hardcode_libdirs"; then
2859 libdir="$hardcode_libdirs"
2860 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2862 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2863 # We should set the runpath_var.
2864 rpath=
2865 for dir in $perm_rpath; do
2866 rpath="$rpath$dir:"
2867 done
2868 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2870 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2873 shlibpath="$finalize_shlibpath"
2874 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2875 if test -n "$shlibpath"; then
2876 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2879 # Get the real and link names of the library.
2880 eval library_names=\"$library_names_spec\"
2881 set dummy $library_names
2882 realname="$2"
2883 shift; shift
2885 if test -n "$soname_spec"; then
2886 eval soname=\"$soname_spec\"
2887 else
2888 soname="$realname"
2891 lib="$output_objdir/$realname"
2892 for link
2894 linknames="$linknames $link"
2895 done
2897 # # Ensure that we have .o objects for linkers which dislike .lo
2898 # # (e.g. aix) in case we are running --disable-static
2899 # for obj in $libobjs; do
2900 # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2901 # if test "X$xdir" = "X$obj"; then
2902 # xdir="."
2903 # else
2904 # xdir="$xdir"
2905 # fi
2906 # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2907 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2908 # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
2909 # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2910 # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2911 # fi
2912 # done
2914 # Use standard objects if they are pic
2915 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2917 # Prepare the list of exported symbols
2918 if test -z "$export_symbols"; then
2919 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2920 $show "generating symbol list for \`$libname.la'"
2921 export_symbols="$output_objdir/$libname.exp"
2922 $run $rm $export_symbols
2923 eval cmds=\"$export_symbols_cmds\"
2924 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2925 for cmd in $cmds; do
2926 IFS="$save_ifs"
2927 $show "$cmd"
2928 $run eval "$cmd" || exit $?
2929 done
2930 IFS="$save_ifs"
2931 if test -n "$export_symbols_regex"; then
2932 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2933 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2934 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2935 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2940 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2941 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2944 if test -n "$convenience"; then
2945 if test -n "$whole_archive_flag_spec"; then
2946 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2947 else
2948 gentop="$output_objdir/${outputname}x"
2949 $show "${rm}r $gentop"
2950 $run ${rm}r "$gentop"
2951 $show "$mkdir $gentop"
2952 $run $mkdir "$gentop"
2953 status=$?
2954 if test $status -ne 0 && test ! -d "$gentop"; then
2955 exit $status
2957 generated="$generated $gentop"
2959 for xlib in $convenience; do
2960 # Extract the objects.
2961 case "$xlib" in
2962 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2963 *) xabs=`pwd`"/$xlib" ;;
2964 esac
2965 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2966 xdir="$gentop/$xlib"
2968 $show "${rm}r $xdir"
2969 $run ${rm}r "$xdir"
2970 $show "$mkdir $xdir"
2971 $run $mkdir "$xdir"
2972 status=$?
2973 if test $status -ne 0 && test ! -d "$xdir"; then
2974 exit $status
2976 $show "(cd $xdir && $AR x $xabs)"
2977 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2979 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2980 done
2984 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2985 eval flag=\"$thread_safe_flag_spec\"
2986 linker_flags="$linker_flags $flag"
2989 # Make a backup of the uninstalled library when relinking
2990 if test "$mode" = relink; then
2991 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2994 # Do each of the archive commands.
2995 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2996 eval cmds=\"$archive_expsym_cmds\"
2997 else
2998 eval cmds=\"$archive_cmds\"
3000 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3001 for cmd in $cmds; do
3002 IFS="$save_ifs"
3003 $show "$cmd"
3004 $run eval "$cmd" || exit $?
3005 done
3006 IFS="$save_ifs"
3008 # Restore the uninstalled library and exit
3009 if test "$mode" = relink; then
3010 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3011 exit 0
3014 # Create links to the real library.
3015 for linkname in $linknames; do
3016 if test "$realname" != "$linkname"; then
3017 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3018 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3020 done
3022 # If -module or -export-dynamic was specified, set the dlname.
3023 if test "$module" = yes || test "$export_dynamic" = yes; then
3024 # On all known operating systems, these are identical.
3025 dlname="$soname"
3030 obj)
3031 if test -n "$deplibs"; then
3032 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3035 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3036 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3039 if test -n "$rpath"; then
3040 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3043 if test -n "$xrpath"; then
3044 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3047 if test -n "$vinfo"; then
3048 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3051 if test -n "$release"; then
3052 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3055 case "$output" in
3056 *.lo)
3057 if test -n "$objs$old_deplibs"; then
3058 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3059 exit 1
3061 libobj="$output"
3062 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3065 libobj=
3066 obj="$output"
3068 esac
3070 # Delete the old objects.
3071 $run $rm $obj $libobj
3073 # Objects from convenience libraries. This assumes
3074 # single-version convenience libraries. Whenever we create
3075 # different ones for PIC/non-PIC, this we'll have to duplicate
3076 # the extraction.
3077 reload_conv_objs=
3078 gentop=
3079 # reload_cmds runs $LD directly, so let us get rid of
3080 # -Wl from whole_archive_flag_spec
3083 if test -n "$convenience"; then
3084 if test -n "$whole_archive_flag_spec"; then
3085 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3086 else
3087 gentop="$output_objdir/${obj}x"
3088 $show "${rm}r $gentop"
3089 $run ${rm}r "$gentop"
3090 $show "$mkdir $gentop"
3091 $run $mkdir "$gentop"
3092 status=$?
3093 if test $status -ne 0 && test ! -d "$gentop"; then
3094 exit $status
3096 generated="$generated $gentop"
3098 for xlib in $convenience; do
3099 # Extract the objects.
3100 case "$xlib" in
3101 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3102 *) xabs=`pwd`"/$xlib" ;;
3103 esac
3104 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3105 xdir="$gentop/$xlib"
3107 $show "${rm}r $xdir"
3108 $run ${rm}r "$xdir"
3109 $show "$mkdir $xdir"
3110 $run $mkdir "$xdir"
3111 status=$?
3112 if test $status -ne 0 && test ! -d "$xdir"; then
3113 exit $status
3115 $show "(cd $xdir && $AR x $xabs)"
3116 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3118 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3119 done
3123 # Create the old-style object.
3124 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
3126 output="$obj"
3127 eval cmds=\"$reload_cmds\"
3128 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3129 for cmd in $cmds; do
3130 IFS="$save_ifs"
3131 $show "$cmd"
3132 $run eval "$cmd" || exit $?
3133 done
3134 IFS="$save_ifs"
3136 # Exit if we aren't doing a library object file.
3137 if test -z "$libobj"; then
3138 if test -n "$gentop"; then
3139 $show "${rm}r $gentop"
3140 $run ${rm}r $gentop
3143 exit 0
3146 if test "$build_libtool_libs" != yes; then
3147 if test -n "$gentop"; then
3148 $show "${rm}r $gentop"
3149 $run ${rm}r $gentop
3152 # Create an invalid libtool object if no PIC, so that we don't
3153 # accidentally link it into a program.
3154 # $show "echo timestamp > $libobj"
3155 # $run eval "echo timestamp > $libobj" || exit $?
3156 exit 0
3159 if test -n "$pic_flag" || test "$pic_mode" != default; then
3160 # Only do commands if we really have different PIC objects.
3161 reload_objs="$libobjs $reload_conv_objs"
3162 output="$libobj"
3163 eval cmds=\"$reload_cmds\"
3164 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3165 for cmd in $cmds; do
3166 IFS="$save_ifs"
3167 $show "$cmd"
3168 $run eval "$cmd" || exit $?
3169 done
3170 IFS="$save_ifs"
3171 # else
3172 # # Just create a symlink.
3173 # $show $rm $libobj
3174 # $run $rm $libobj
3175 # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3176 # if test "X$xdir" = "X$libobj"; then
3177 # xdir="."
3178 # else
3179 # xdir="$xdir"
3180 # fi
3181 # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3182 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3183 # $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3184 # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3187 if test -n "$gentop"; then
3188 $show "${rm}r $gentop"
3189 $run ${rm}r $gentop
3192 exit 0
3195 prog)
3196 if test -n "$vinfo"; then
3197 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3200 if test -n "$release"; then
3201 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3204 if test "$preload" = yes; then
3205 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3206 test "$dlopen_self_static" = unknown; then
3207 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3211 compile_command="$compile_command $compile_deplibs"
3212 finalize_command="$finalize_command $finalize_deplibs"
3214 if test -n "$rpath$xrpath"; then
3215 # If the user specified any rpath flags, then add them.
3216 for libdir in $rpath $xrpath; do
3217 # This is the magic to use -rpath.
3218 case "$finalize_rpath " in
3219 *" $libdir "*) ;;
3220 *) finalize_rpath="$finalize_rpath $libdir" ;;
3221 esac
3222 done
3225 # Now hardcode the library paths
3226 rpath=
3227 hardcode_libdirs=
3228 for libdir in $compile_rpath $finalize_rpath; do
3229 if test -n "$hardcode_libdir_flag_spec"; then
3230 if test -n "$hardcode_libdir_separator"; then
3231 if test -z "$hardcode_libdirs"; then
3232 hardcode_libdirs="$libdir"
3233 else
3234 # Just accumulate the unique libdirs.
3235 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
3236 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3239 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3241 esac
3243 else
3244 eval flag=\"$hardcode_libdir_flag_spec\"
3245 rpath="$rpath $flag"
3247 elif test -n "$runpath_var"; then
3248 case "$perm_rpath " in
3249 *" $libdir "*) ;;
3250 *) perm_rpath="$perm_rpath $libdir" ;;
3251 esac
3253 case "$host" in
3254 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3255 case ":$dllsearchpath:" in
3256 *":$libdir:"*) ;;
3257 *) dllsearchpath="$dllsearchpath:$libdir";;
3258 esac
3260 esac
3261 done
3262 # Substitute the hardcoded libdirs into the rpath.
3263 if test -n "$hardcode_libdir_separator" &&
3264 test -n "$hardcode_libdirs"; then
3265 libdir="$hardcode_libdirs"
3266 eval rpath=\" $hardcode_libdir_flag_spec\"
3268 compile_rpath="$rpath"
3270 rpath=
3271 hardcode_libdirs=
3272 for libdir in $finalize_rpath; do
3273 if test -n "$hardcode_libdir_flag_spec"; then
3274 if test -n "$hardcode_libdir_separator"; then
3275 if test -z "$hardcode_libdirs"; then
3276 hardcode_libdirs="$libdir"
3277 else
3278 # Just accumulate the unique libdirs.
3279 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
3280 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3283 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3285 esac
3287 else
3288 eval flag=\"$hardcode_libdir_flag_spec\"
3289 rpath="$rpath $flag"
3291 elif test -n "$runpath_var"; then
3292 case "$finalize_perm_rpath " in
3293 *" $libdir "*) ;;
3294 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3295 esac
3297 done
3298 # Substitute the hardcoded libdirs into the rpath.
3299 if test -n "$hardcode_libdir_separator" &&
3300 test -n "$hardcode_libdirs"; then
3301 libdir="$hardcode_libdirs"
3302 eval rpath=\" $hardcode_libdir_flag_spec\"
3304 finalize_rpath="$rpath"
3306 dlsyms=
3307 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3308 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3309 dlsyms="${outputname}S.c"
3310 else
3311 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3315 if test -n "$dlsyms"; then
3316 case "$dlsyms" in
3317 "") ;;
3318 *.c)
3319 # Discover the nlist of each of the dlfiles.
3320 nlist="$output_objdir/${outputname}.nm"
3322 $show "$rm $nlist ${nlist}S ${nlist}T"
3323 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3325 # Parse the name list into a source file.
3326 $show "creating $output_objdir/$dlsyms"
3328 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3329 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3330 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3332 #ifdef __cplusplus
3333 extern \"C\" {
3334 #endif
3336 /* Prevent the only kind of declaration conflicts we can make. */
3337 #define lt_preloaded_symbols some_other_symbol
3339 /* External symbol declarations for the compiler. */\
3342 if test "$dlself" = yes; then
3343 $show "generating symbol list for \`$output'"
3345 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3347 # Add our own program objects to the symbol list.
3348 progfiles="$objs$old_deplibs"
3349 for arg in $progfiles; do
3350 $show "extracting global C symbols from \`$arg'"
3351 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3352 done
3354 if test -n "$exclude_expsyms"; then
3355 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3356 $run eval '$mv "$nlist"T "$nlist"'
3359 if test -n "$export_symbols_regex"; then
3360 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3361 $run eval '$mv "$nlist"T "$nlist"'
3364 # Prepare the list of exported symbols
3365 if test -z "$export_symbols"; then
3366 export_symbols="$output_objdir/$output.exp"
3367 $run $rm $export_symbols
3368 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3369 else
3370 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3371 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3372 $run eval 'mv "$nlist"T "$nlist"'
3376 for arg in $dlprefiles; do
3377 $show "extracting global C symbols from \`$arg'"
3378 name=`echo "$arg" | sed -e 's%^.*/%%'`
3379 $run eval 'echo ": $name " >> "$nlist"'
3380 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3381 done
3383 if test -z "$run"; then
3384 # Make sure we have at least an empty file.
3385 test -f "$nlist" || : > "$nlist"
3387 if test -n "$exclude_expsyms"; then
3388 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3389 $mv "$nlist"T "$nlist"
3392 # Try sorting and uniquifying the output.
3393 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3395 else
3396 grep -v "^: " < "$nlist" > "$nlist"S
3399 if test -f "$nlist"S; then
3400 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3401 else
3402 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3405 $echo >> "$output_objdir/$dlsyms" "\
3407 #undef lt_preloaded_symbols
3409 #if defined (__STDC__) && __STDC__
3410 # define lt_ptr_t void *
3411 #else
3412 # define lt_ptr_t char *
3413 # define const
3414 #endif
3416 /* The mapping between symbol names and symbols. */
3417 const struct {
3418 const char *name;
3419 lt_ptr_t address;
3421 lt_preloaded_symbols[] =
3425 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3426 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3427 < "$nlist" >> "$output_objdir/$dlsyms"
3429 $echo >> "$output_objdir/$dlsyms" "\
3430 {0, (lt_ptr_t) 0}
3433 /* This works around a problem in FreeBSD linker */
3434 #ifdef FREEBSD_WORKAROUND
3435 static const void *lt_preloaded_setup() {
3436 return lt_preloaded_symbols;
3438 #endif
3440 #ifdef __cplusplus
3442 #endif\
3446 pic_flag_for_symtable=
3447 case "$host" in
3448 # compiling the symbol table file with pic_flag works around
3449 # a FreeBSD bug that causes programs to crash when -lm is
3450 # linked before any other PIC object. But we must not use
3451 # pic_flag when linking with -static. The problem exists in
3452 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3453 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3454 case "$compile_command " in
3455 *" -static "*) ;;
3456 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3457 esac;;
3458 *-*-hpux*)
3459 case "$compile_command " in
3460 *" -static "*) ;;
3461 *) pic_flag_for_symtable=" $pic_flag";;
3462 esac
3463 esac
3465 # Now compile the dynamic symbol file.
3466 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3467 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3469 # Clean up the generated files.
3470 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3471 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3473 # Transform the symbol file into the correct name.
3474 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3475 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3478 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3479 exit 1
3481 esac
3482 else
3483 # We keep going just in case the user didn't refer to
3484 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3485 # really was required.
3487 # Nullify the symbol file.
3488 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3489 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3492 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3493 # Replace the output file specification.
3494 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3495 link_command="$compile_command$compile_rpath"
3497 # We have no uninstalled library dependencies, so finalize right now.
3498 $show "$link_command"
3499 $run eval "$link_command"
3500 status=$?
3502 # Delete the generated files.
3503 if test -n "$dlsyms"; then
3504 $show "$rm $output_objdir/${outputname}S.${objext}"
3505 $run $rm "$output_objdir/${outputname}S.${objext}"
3508 exit $status
3511 if test -n "$shlibpath_var"; then
3512 # We should set the shlibpath_var
3513 rpath=
3514 for dir in $temp_rpath; do
3515 case "$dir" in
3516 [\\/]* | [A-Za-z]:[\\/]*)
3517 # Absolute path.
3518 rpath="$rpath$dir:"
3521 # Relative path: add a thisdir entry.
3522 rpath="$rpath\$thisdir/$dir:"
3524 esac
3525 done
3526 temp_rpath="$rpath"
3529 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3530 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3532 if test -n "$finalize_shlibpath"; then
3533 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3536 compile_var=
3537 finalize_var=
3538 if test -n "$runpath_var"; then
3539 if test -n "$perm_rpath"; then
3540 # We should set the runpath_var.
3541 rpath=
3542 for dir in $perm_rpath; do
3543 rpath="$rpath$dir:"
3544 done
3545 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3547 if test -n "$finalize_perm_rpath"; then
3548 # We should set the runpath_var.
3549 rpath=
3550 for dir in $finalize_perm_rpath; do
3551 rpath="$rpath$dir:"
3552 done
3553 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3557 if test "$no_install" = yes; then
3558 # We don't need to create a wrapper script.
3559 link_command="$compile_var$compile_command$compile_rpath"
3560 # Replace the output file specification.
3561 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3562 # Delete the old output file.
3563 $run $rm $output
3564 # Link the executable and exit
3565 $show "$link_command"
3566 $run eval "$link_command" || exit $?
3567 exit 0
3570 if test "$hardcode_action" = relink; then
3571 # Fast installation is not supported
3572 link_command="$compile_var$compile_command$compile_rpath"
3573 relink_command="$finalize_var$finalize_command$finalize_rpath"
3575 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3576 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3577 else
3578 if test "$fast_install" != no; then
3579 link_command="$finalize_var$compile_command$finalize_rpath"
3580 if test "$fast_install" = yes; then
3581 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3582 else
3583 # fast_install is set to needless
3584 relink_command=
3586 else
3587 link_command="$compile_var$compile_command$compile_rpath"
3588 relink_command="$finalize_var$finalize_command$finalize_rpath"
3592 # Replace the output file specification.
3593 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3595 # Delete the old output files.
3596 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3598 $show "$link_command"
3599 $run eval "$link_command" || exit $?
3601 # Now create the wrapper script.
3602 $show "creating $output"
3604 # Quote the relink command for shipping.
3605 if test -n "$relink_command"; then
3606 # Preserve any variables that may affect compiler behavior
3607 for var in $variables_saved_for_relink; do
3608 if eval test -z \"\${$var+set}\"; then
3609 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3610 elif eval var_value=\$$var; test -z "$var_value"; then
3611 relink_command="$var=; export $var; $relink_command"
3612 else
3613 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3614 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3616 done
3617 relink_command="cd `pwd`; $relink_command"
3618 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3621 # Quote $echo for shipping.
3622 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3623 case "$0" in
3624 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3625 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3626 esac
3627 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3628 else
3629 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3632 # Only actually do things if our run command is non-null.
3633 if test -z "$run"; then
3634 # win32 will think the script is a binary if it has
3635 # a .exe suffix, so we strip it off here.
3636 case $output in
3637 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3638 esac
3639 $rm $output
3640 trap "$rm $output; exit 1" 1 2 15
3642 $echo > $output "\
3643 #! $SHELL
3645 # $output - temporary wrapper script for $objdir/$outputname
3646 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3648 # The $output program cannot be directly executed until all the libtool
3649 # libraries that it depends on are installed.
3651 # This wrapper script should never be moved out of the build directory.
3652 # If it is, it will not operate correctly.
3654 # Sed substitution that helps us do robust quoting. It backslashifies
3655 # metacharacters that are still active within double-quoted strings.
3656 Xsed='sed -e 1s/^X//'
3657 sed_quote_subst='$sed_quote_subst'
3659 # The HP-UX ksh and POSIX shell print the target directory to stdout
3660 # if CDPATH is set.
3661 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3663 relink_command=\"$relink_command\"
3665 # This environment variable determines our operation mode.
3666 if test \"\$libtool_install_magic\" = \"$magic\"; then
3667 # install mode needs the following variable:
3668 uninst_deplibs='$uninst_deplibs'
3669 else
3670 # When we are sourced in execute mode, \$file and \$echo are already set.
3671 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3672 echo=\"$qecho\"
3673 file=\"\$0\"
3674 # Make sure echo works.
3675 if test \"X\$1\" = X--no-reexec; then
3676 # Discard the --no-reexec flag, and continue.
3677 shift
3678 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3679 # Yippee, \$echo works!
3681 else
3682 # Restart under the correct shell, and then maybe \$echo will work.
3683 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3687 $echo >> $output "\
3689 # Find the directory that this script lives in.
3690 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3691 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3693 # Follow symbolic links until we get to the real thisdir.
3694 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3695 while test -n \"\$file\"; do
3696 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3698 # If there was a directory component, then change thisdir.
3699 if test \"x\$destdir\" != \"x\$file\"; then
3700 case \"\$destdir\" in
3701 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3702 *) thisdir=\"\$thisdir/\$destdir\" ;;
3703 esac
3706 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3707 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3708 done
3710 # Try to get the absolute directory name.
3711 absdir=\`cd \"\$thisdir\" && pwd\`
3712 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3715 if test "$fast_install" = yes; then
3716 echo >> $output "\
3717 program=lt-'$outputname'
3718 progdir=\"\$thisdir/$objdir\"
3720 if test ! -f \"\$progdir/\$program\" || \\
3721 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3722 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3724 file=\"\$\$-\$program\"
3726 if test ! -d \"\$progdir\"; then
3727 $mkdir \"\$progdir\"
3728 else
3729 $rm \"\$progdir/\$file\"
3732 echo >> $output "\
3734 # relink executable if necessary
3735 if test -n \"\$relink_command\"; then
3736 if (eval \$relink_command); then :
3737 else
3738 $rm \"\$progdir/\$file\"
3739 exit 1
3743 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3744 { $rm \"\$progdir/\$program\";
3745 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3746 $rm \"\$progdir/\$file\"
3748 else
3749 echo >> $output "\
3750 program='$outputname'
3751 progdir=\"\$thisdir/$objdir\"
3755 echo >> $output "\
3757 if test -f \"\$progdir/\$program\"; then"
3759 # Export our shlibpath_var if we have one.
3760 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3761 $echo >> $output "\
3762 # Add our own library path to $shlibpath_var
3763 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3765 # Some systems cannot cope with colon-terminated $shlibpath_var
3766 # The second colon is a workaround for a bug in BeOS R4 sed
3767 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3769 export $shlibpath_var
3773 # fixup the dll searchpath if we need to.
3774 if test -n "$dllsearchpath"; then
3775 $echo >> $output "\
3776 # Add the dll search path components to the executable PATH
3777 PATH=$dllsearchpath:\$PATH
3781 $echo >> $output "\
3782 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3783 # Run the actual program with our arguments.
3785 case $host in
3786 # win32 systems need to use the prog path for dll
3787 # lookup to work
3788 *-*-cygwin* | *-*-pw32*)
3789 $echo >> $output "\
3790 exec \$progdir/\$program \${1+\"\$@\"}
3794 # Backslashes separate directories on plain windows
3795 *-*-mingw | *-*-os2*)
3796 $echo >> $output "\
3797 exec \$progdir\\\\\$program \${1+\"\$@\"}
3802 $echo >> $output "\
3803 # Export the path to the program.
3804 PATH=\"\$progdir:\$PATH\"
3805 export PATH
3807 exec \$program \${1+\"\$@\"}
3810 esac
3811 $echo >> $output "\
3812 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3813 exit 1
3815 else
3816 # The program doesn't exist.
3817 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3818 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3819 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3820 exit 1
3824 chmod +x $output
3826 exit 0
3828 esac
3830 # See if we need to build an old-fashioned archive.
3831 for oldlib in $oldlibs; do
3833 if test "$build_libtool_libs" = convenience; then
3834 oldobjs="$libobjs_save"
3835 addlibs="$convenience"
3836 build_libtool_libs=no
3837 else
3838 if test "$build_libtool_libs" = module; then
3839 oldobjs="$libobjs_save"
3840 build_libtool_libs=no
3841 else
3842 oldobjs="$objs$old_deplibs $non_pic_objects"
3844 addlibs="$old_convenience"
3847 if test -n "$addlibs"; then
3848 gentop="$output_objdir/${outputname}x"
3849 $show "${rm}r $gentop"
3850 $run ${rm}r "$gentop"
3851 $show "$mkdir $gentop"
3852 $run $mkdir "$gentop"
3853 status=$?
3854 if test $status -ne 0 && test ! -d "$gentop"; then
3855 exit $status
3857 generated="$generated $gentop"
3859 # Add in members from convenience archives.
3860 for xlib in $addlibs; do
3861 # Extract the objects.
3862 case "$xlib" in
3863 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3864 *) xabs=`pwd`"/$xlib" ;;
3865 esac
3866 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3867 xdir="$gentop/$xlib"
3869 $show "${rm}r $xdir"
3870 $run ${rm}r "$xdir"
3871 $show "$mkdir $xdir"
3872 $run $mkdir "$xdir"
3873 status=$?
3874 if test $status -ne 0 && test ! -d "$xdir"; then
3875 exit $status
3877 $show "(cd $xdir && $AR x $xabs)"
3878 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3880 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
3881 done
3884 # Do each command in the archive commands.
3885 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3886 eval cmds=\"$old_archive_from_new_cmds\"
3887 else
3888 # # Ensure that we have .o objects in place in case we decided
3889 # # not to build a shared library, and have fallen back to building
3890 # # static libs even though --disable-static was passed!
3891 # for oldobj in $oldobjs; do
3892 # if test ! -f $oldobj; then
3893 # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3894 # if test "X$xdir" = "X$oldobj"; then
3895 # xdir="."
3896 # else
3897 # xdir="$xdir"
3898 # fi
3899 # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3900 # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3901 # $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3902 # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3903 # fi
3904 # done
3906 eval cmds=\"$old_archive_cmds\"
3908 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3909 for cmd in $cmds; do
3910 IFS="$save_ifs"
3911 $show "$cmd"
3912 $run eval "$cmd" || exit $?
3913 done
3914 IFS="$save_ifs"
3915 done
3917 if test -n "$generated"; then
3918 $show "${rm}r$generated"
3919 $run ${rm}r$generated
3922 # Now create the libtool archive.
3923 case "$output" in
3924 *.la)
3925 old_library=
3926 test "$build_old_libs" = yes && old_library="$libname.$libext"
3927 $show "creating $output"
3929 # Preserve any variables that may affect compiler behavior
3930 for var in $variables_saved_for_relink; do
3931 if eval test -z \"\${$var+set}\"; then
3932 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3933 elif eval var_value=\$$var; test -z "$var_value"; then
3934 relink_command="$var=; export $var; $relink_command"
3935 else
3936 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3937 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3939 done
3940 # Quote the link command for shipping.
3941 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3942 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3944 # Only create the output if not a dry run.
3945 if test -z "$run"; then
3946 for installed in no yes; do
3947 if test "$installed" = yes; then
3948 if test -z "$install_libdir"; then
3949 break
3951 output="$output_objdir/$outputname"i
3952 # Replace all uninstalled libtool libraries with the installed ones
3953 newdependency_libs=
3954 for deplib in $dependency_libs; do
3955 case "$deplib" in
3956 *.la)
3957 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3958 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3959 if test -z "$libdir"; then
3960 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3961 exit 1
3963 newdependency_libs="$newdependency_libs $libdir/$name"
3965 *) newdependency_libs="$newdependency_libs $deplib" ;;
3966 esac
3967 done
3968 dependency_libs="$newdependency_libs"
3969 newdlfiles=
3970 for lib in $dlfiles; do
3971 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3972 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3973 if test -z "$libdir"; then
3974 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3975 exit 1
3977 newdlfiles="$newdlfiles $libdir/$name"
3978 done
3979 dlfiles="$newdlfiles"
3980 newdlprefiles=
3981 for lib in $dlprefiles; do
3982 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3983 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3984 if test -z "$libdir"; then
3985 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3986 exit 1
3988 newdlprefiles="$newdlprefiles $libdir/$name"
3989 done
3990 dlprefiles="$newdlprefiles"
3992 $rm $output
3993 $echo > $output "\
3994 # $outputname - a libtool library file
3995 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3997 # Please DO NOT delete this file!
3998 # It is necessary for linking the library.
4000 # The name that we can dlopen(3).
4001 dlname='$dlname'
4003 # Names of this library.
4004 library_names='$library_names'
4006 # The name of the static archive.
4007 old_library='$old_library'
4009 # Libraries that this one depends upon.
4010 dependency_libs='$dependency_libs'
4012 # Version information for $libname.
4013 current=$current
4014 age=$age
4015 revision=$revision
4017 # Is this an already installed library?
4018 installed=$installed
4020 # Files to dlopen/dlpreopen
4021 dlopen='$dlfiles'
4022 dlpreopen='$dlprefiles'
4024 # Directory that this library needs to be installed in:
4025 libdir='$install_libdir'"
4026 if test "$installed" = no && test $need_relink = yes; then
4027 $echo >> $output "\
4028 relink_command=\"$relink_command\""
4030 done
4033 # Do a symbolic link so that the libtool archive can be found in
4034 # LD_LIBRARY_PATH before the program is installed.
4035 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4036 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4038 esac
4039 exit 0
4042 # libtool install mode
4043 install)
4044 modename="$modename: install"
4046 # There may be an optional sh(1) argument at the beginning of
4047 # install_prog (especially on Windows NT).
4048 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4049 # Allow the use of GNU shtool's install command.
4050 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4051 # Aesthetically quote it.
4052 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4053 case "$arg" in
4054 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4055 arg="\"$arg\""
4057 esac
4058 install_prog="$arg "
4059 arg="$1"
4060 shift
4061 else
4062 install_prog=
4063 arg="$nonopt"
4066 # The real first argument should be the name of the installation program.
4067 # Aesthetically quote it.
4068 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4069 case "$arg" in
4070 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4071 arg="\"$arg\""
4073 esac
4074 install_prog="$install_prog$arg"
4076 # We need to accept at least all the BSD install flags.
4077 dest=
4078 files=
4079 opts=
4080 prev=
4081 install_type=
4082 isdir=no
4083 stripme=
4084 for arg
4086 if test -n "$dest"; then
4087 files="$files $dest"
4088 dest="$arg"
4089 continue
4092 case "$arg" in
4093 -d) isdir=yes ;;
4094 -f) prev="-f" ;;
4095 -g) prev="-g" ;;
4096 -m) prev="-m" ;;
4097 -o) prev="-o" ;;
4099 stripme=" -s"
4100 continue
4102 -*) ;;
4105 # If the previous option needed an argument, then skip it.
4106 if test -n "$prev"; then
4107 prev=
4108 else
4109 dest="$arg"
4110 continue
4113 esac
4115 # Aesthetically quote the argument.
4116 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4117 case "$arg" in
4118 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4119 arg="\"$arg\""
4121 esac
4122 install_prog="$install_prog $arg"
4123 done
4125 if test -z "$install_prog"; then
4126 $echo "$modename: you must specify an install program" 1>&2
4127 $echo "$help" 1>&2
4128 exit 1
4131 if test -n "$prev"; then
4132 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4133 $echo "$help" 1>&2
4134 exit 1
4137 if test -z "$files"; then
4138 if test -z "$dest"; then
4139 $echo "$modename: no file or destination specified" 1>&2
4140 else
4141 $echo "$modename: you must specify a destination" 1>&2
4143 $echo "$help" 1>&2
4144 exit 1
4147 # Strip any trailing slash from the destination.
4148 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4150 # Check to see that the destination is a directory.
4151 test -d "$dest" && isdir=yes
4152 if test "$isdir" = yes; then
4153 destdir="$dest"
4154 destname=
4155 else
4156 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4157 test "X$destdir" = "X$dest" && destdir=.
4158 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4160 # Not a directory, so check to see that there is only one file specified.
4161 set dummy $files
4162 if test $# -gt 2; then
4163 $echo "$modename: \`$dest' is not a directory" 1>&2
4164 $echo "$help" 1>&2
4165 exit 1
4168 case "$destdir" in
4169 [\\/]* | [A-Za-z]:[\\/]*) ;;
4171 for file in $files; do
4172 case "$file" in
4173 *.lo) ;;
4175 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4176 $echo "$help" 1>&2
4177 exit 1
4179 esac
4180 done
4182 esac
4184 # This variable tells wrapper scripts just to set variables rather
4185 # than running their programs.
4186 libtool_install_magic="$magic"
4188 staticlibs=
4189 future_libdirs=
4190 current_libdirs=
4191 for file in $files; do
4193 # Do each installation.
4194 case "$file" in
4195 *.$libext)
4196 # Do the static libraries later.
4197 staticlibs="$staticlibs $file"
4200 *.la)
4201 # Check to see that this really is a libtool archive.
4202 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4203 else
4204 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4205 $echo "$help" 1>&2
4206 exit 1
4209 library_names=
4210 old_library=
4211 relink_command=
4212 # If there is no directory component, then add one.
4213 case "$file" in
4214 */* | *\\*) . $file ;;
4215 *) . ./$file ;;
4216 esac
4218 # Add the libdir to current_libdirs if it is the destination.
4219 if test "X$destdir" = "X$libdir"; then
4220 case "$current_libdirs " in
4221 *" $libdir "*) ;;
4222 *) current_libdirs="$current_libdirs $libdir" ;;
4223 esac
4224 else
4225 # Note the libdir as a future libdir.
4226 case "$future_libdirs " in
4227 *" $libdir "*) ;;
4228 *) future_libdirs="$future_libdirs $libdir" ;;
4229 esac
4232 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4233 test "X$dir" = "X$file/" && dir=
4234 dir="$dir$objdir"
4236 if test -n "$relink_command"; then
4237 $echo "$modename: warning: relinking \`$file'" 1>&2
4238 $show "$relink_command"
4239 if $run eval "$relink_command"; then :
4240 else
4241 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4242 continue
4246 # See the names of the shared library.
4247 set dummy $library_names
4248 if test -n "$2"; then
4249 realname="$2"
4250 shift
4251 shift
4253 srcname="$realname"
4254 test -n "$relink_command" && srcname="$realname"T
4256 # Install the shared library and build the symlinks.
4257 $show "$install_prog $dir/$srcname $destdir/$realname"
4258 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4259 if test -n "$stripme" && test -n "$striplib"; then
4260 $show "$striplib $destdir/$realname"
4261 $run eval "$striplib $destdir/$realname" || exit $?
4264 if test $# -gt 0; then
4265 # Delete the old symlinks, and create new ones.
4266 for linkname
4268 if test "$linkname" != "$realname"; then
4269 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4270 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4272 done
4275 # Do each command in the postinstall commands.
4276 lib="$destdir/$realname"
4277 eval cmds=\"$postinstall_cmds\"
4278 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4279 for cmd in $cmds; do
4280 IFS="$save_ifs"
4281 $show "$cmd"
4282 $run eval "$cmd" || exit $?
4283 done
4284 IFS="$save_ifs"
4287 # Install the pseudo-library for information purposes.
4288 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4289 instname="$dir/$name"i
4290 $show "$install_prog $instname $destdir/$name"
4291 $run eval "$install_prog $instname $destdir/$name" || exit $?
4293 # Maybe install the static library, too.
4294 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4297 *.lo)
4298 # Install (i.e. copy) a libtool object.
4300 # Figure out destination file name, if it wasn't already specified.
4301 if test -n "$destname"; then
4302 destfile="$destdir/$destname"
4303 else
4304 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4305 destfile="$destdir/$destfile"
4308 # Deduce the name of the destination old-style object file.
4309 case "$destfile" in
4310 *.lo)
4311 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4313 *.$objext)
4314 staticdest="$destfile"
4315 destfile=
4318 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4319 $echo "$help" 1>&2
4320 exit 1
4322 esac
4324 # Install the libtool object if requested.
4325 if test -n "$destfile"; then
4326 $show "$install_prog $file $destfile"
4327 $run eval "$install_prog $file $destfile" || exit $?
4330 # Install the old object if enabled.
4331 if test "$build_old_libs" = yes; then
4332 # Deduce the name of the old-style object file.
4333 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4335 $show "$install_prog $staticobj $staticdest"
4336 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4338 exit 0
4342 # Figure out destination file name, if it wasn't already specified.
4343 if test -n "$destname"; then
4344 destfile="$destdir/$destname"
4345 else
4346 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4347 destfile="$destdir/$destfile"
4350 # Do a test to see if this is really a libtool program.
4351 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4352 uninst_deplibs=
4353 relink_command=
4355 # If there is no directory component, then add one.
4356 case "$file" in
4357 */* | *\\*) . $file ;;
4358 *) . ./$file ;;
4359 esac
4361 # Check the variables that should have been set.
4362 if test -z "$uninst_deplibs"; then
4363 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4364 exit 1
4367 finalize=yes
4368 for lib in $uninst_deplibs; do
4369 # Check to see that each library is installed.
4370 libdir=
4371 if test -f "$lib"; then
4372 # If there is no directory component, then add one.
4373 case "$lib" in
4374 */* | *\\*) . $lib ;;
4375 *) . ./$lib ;;
4376 esac
4378 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4379 if test -n "$libdir" && test ! -f "$libfile"; then
4380 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4381 finalize=no
4383 done
4385 relink_command=
4386 # If there is no directory component, then add one.
4387 case "$file" in
4388 */* | *\\*) . $file ;;
4389 *) . ./$file ;;
4390 esac
4392 outputname=
4393 if test "$fast_install" = no && test -n "$relink_command"; then
4394 if test "$finalize" = yes && test -z "$run"; then
4395 tmpdir="/tmp"
4396 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4397 tmpdir="$tmpdir/libtool-$$"
4398 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4399 else
4400 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4401 continue
4403 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4404 outputname="$tmpdir/$file"
4405 # Replace the output file specification.
4406 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4408 $show "$relink_command"
4409 if $run eval "$relink_command"; then :
4410 else
4411 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4412 ${rm}r "$tmpdir"
4413 continue
4415 file="$outputname"
4416 else
4417 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4419 else
4420 # Install the binary that we compiled earlier.
4421 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4425 $show "$install_prog$stripme $file $destfile"
4426 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4427 test -n "$outputname" && ${rm}r "$tmpdir"
4429 esac
4430 done
4432 for file in $staticlibs; do
4433 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4435 # Set up the ranlib parameters.
4436 oldlib="$destdir/$name"
4438 $show "$install_prog $file $oldlib"
4439 $run eval "$install_prog \$file \$oldlib" || exit $?
4441 if test -n "$stripme" && test -n "$striplib"; then
4442 $show "$old_striplib $oldlib"
4443 $run eval "$old_striplib $oldlib" || exit $?
4446 # Do each command in the postinstall commands.
4447 eval cmds=\"$old_postinstall_cmds\"
4448 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4449 for cmd in $cmds; do
4450 IFS="$save_ifs"
4451 $show "$cmd"
4452 $run eval "$cmd" || exit $?
4453 done
4454 IFS="$save_ifs"
4455 done
4457 if test -n "$future_libdirs"; then
4458 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4461 if test -n "$current_libdirs"; then
4462 # Maybe just do a dry run.
4463 test -n "$run" && current_libdirs=" -n$current_libdirs"
4464 exec $SHELL $0 --finish$current_libdirs
4465 exit 1
4468 exit 0
4471 # libtool finish mode
4472 finish)
4473 modename="$modename: finish"
4474 libdirs="$nonopt"
4475 admincmds=
4477 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4478 for dir
4480 libdirs="$libdirs $dir"
4481 done
4483 for libdir in $libdirs; do
4484 if test -n "$finish_cmds"; then
4485 # Do each command in the finish commands.
4486 eval cmds=\"$finish_cmds\"
4487 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4488 for cmd in $cmds; do
4489 IFS="$save_ifs"
4490 $show "$cmd"
4491 $run eval "$cmd" || admincmds="$admincmds
4492 $cmd"
4493 done
4494 IFS="$save_ifs"
4496 if test -n "$finish_eval"; then
4497 # Do the single finish_eval.
4498 eval cmds=\"$finish_eval\"
4499 $run eval "$cmds" || admincmds="$admincmds
4500 $cmds"
4502 done
4505 # Exit here if they wanted silent mode.
4506 test "$show" = : && exit 0
4508 echo "----------------------------------------------------------------------"
4509 echo "Libraries have been installed in:"
4510 for libdir in $libdirs; do
4511 echo " $libdir"
4512 done
4513 echo
4514 echo "If you ever happen to want to link against installed libraries"
4515 echo "in a given directory, LIBDIR, you must either use libtool, and"
4516 echo "specify the full pathname of the library, or use \`-LLIBDIR'"
4517 echo "flag during linking and do at least one of the following:"
4518 if test -n "$shlibpath_var"; then
4519 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4520 echo " during execution"
4522 if test -n "$runpath_var"; then
4523 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4524 echo " during linking"
4526 if test -n "$hardcode_libdir_flag_spec"; then
4527 libdir=LIBDIR
4528 eval flag=\"$hardcode_libdir_flag_spec\"
4530 echo " - use the \`$flag' linker flag"
4532 if test -n "$admincmds"; then
4533 echo " - have your system administrator run these commands:$admincmds"
4535 if test -f /etc/ld.so.conf; then
4536 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4538 echo
4539 echo "See any operating system documentation about shared libraries for"
4540 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4541 echo "----------------------------------------------------------------------"
4542 exit 0
4545 # libtool execute mode
4546 execute)
4547 modename="$modename: execute"
4549 # The first argument is the command name.
4550 cmd="$nonopt"
4551 if test -z "$cmd"; then
4552 $echo "$modename: you must specify a COMMAND" 1>&2
4553 $echo "$help"
4554 exit 1
4557 # Handle -dlopen flags immediately.
4558 for file in $execute_dlfiles; do
4559 if test ! -f "$file"; then
4560 $echo "$modename: \`$file' is not a file" 1>&2
4561 $echo "$help" 1>&2
4562 exit 1
4565 dir=
4566 case "$file" in
4567 *.la)
4568 # Check to see that this really is a libtool archive.
4569 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4570 else
4571 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4572 $echo "$help" 1>&2
4573 exit 1
4576 # Read the libtool library.
4577 dlname=
4578 library_names=
4580 # If there is no directory component, then add one.
4581 case "$file" in
4582 */* | *\\*) . $file ;;
4583 *) . ./$file ;;
4584 esac
4586 # Skip this library if it cannot be dlopened.
4587 if test -z "$dlname"; then
4588 # Warn if it was a shared library.
4589 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4590 continue
4593 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4594 test "X$dir" = "X$file" && dir=.
4596 if test -f "$dir/$objdir/$dlname"; then
4597 dir="$dir/$objdir"
4598 else
4599 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4600 exit 1
4604 *.lo)
4605 # Just add the directory containing the .lo file.
4606 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4607 test "X$dir" = "X$file" && dir=.
4611 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4612 continue
4614 esac
4616 # Get the absolute pathname.
4617 absdir=`cd "$dir" && pwd`
4618 test -n "$absdir" && dir="$absdir"
4620 # Now add the directory to shlibpath_var.
4621 if eval "test -z \"\$$shlibpath_var\""; then
4622 eval "$shlibpath_var=\"\$dir\""
4623 else
4624 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4626 done
4628 # This variable tells wrapper scripts just to set shlibpath_var
4629 # rather than running their programs.
4630 libtool_execute_magic="$magic"
4632 # Check if any of the arguments is a wrapper script.
4633 args=
4634 for file
4636 case "$file" in
4637 -*) ;;
4639 # Do a test to see if this is really a libtool program.
4640 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4641 # If there is no directory component, then add one.
4642 case "$file" in
4643 */* | *\\*) . $file ;;
4644 *) . ./$file ;;
4645 esac
4647 # Transform arg to wrapped name.
4648 file="$progdir/$program"
4651 esac
4652 # Quote arguments (to preserve shell metacharacters).
4653 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4654 args="$args \"$file\""
4655 done
4657 if test -z "$run"; then
4658 if test -n "$shlibpath_var"; then
4659 # Export the shlibpath_var.
4660 eval "export $shlibpath_var"
4663 # Restore saved enviroment variables
4664 if test "${save_LC_ALL+set}" = set; then
4665 LC_ALL="$save_LC_ALL"; export LC_ALL
4667 if test "${save_LANG+set}" = set; then
4668 LANG="$save_LANG"; export LANG
4671 # Now actually exec the command.
4672 eval "exec \$cmd$args"
4674 $echo "$modename: cannot exec \$cmd$args"
4675 exit 1
4676 else
4677 # Display what would be done.
4678 if test -n "$shlibpath_var"; then
4679 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4680 $echo "export $shlibpath_var"
4682 $echo "$cmd$args"
4683 exit 0
4687 # libtool clean and uninstall mode
4688 clean | uninstall)
4689 modename="$modename: $mode"
4690 rm="$nonopt"
4691 files=
4693 # This variable tells wrapper scripts just to set variables rather
4694 # than running their programs.
4695 libtool_install_magic="$magic"
4697 for arg
4699 case "$arg" in
4700 -*) rm="$rm $arg" ;;
4701 *) files="$files $arg" ;;
4702 esac
4703 done
4705 if test -z "$rm"; then
4706 $echo "$modename: you must specify an RM program" 1>&2
4707 $echo "$help" 1>&2
4708 exit 1
4711 for file in $files; do
4712 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4713 if test "X$dir" = "X$file"; then
4714 dir=.
4715 objdir="$objdir"
4716 else
4717 objdir="$dir/$objdir"
4719 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4720 test $mode = uninstall && objdir="$dir"
4722 rmfiles="$file"
4724 case "$name" in
4725 *.la)
4726 # Possibly a libtool archive, so verify it.
4727 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4728 . $dir/$name
4730 # Delete the libtool libraries and symlinks.
4731 for n in $library_names; do
4732 rmfiles="$rmfiles $objdir/$n"
4733 done
4734 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4735 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4737 if test $mode = uninstall; then
4738 if test -n "$library_names"; then
4739 # Do each command in the postuninstall commands.
4740 eval cmds=\"$postuninstall_cmds\"
4741 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4742 for cmd in $cmds; do
4743 IFS="$save_ifs"
4744 $show "$cmd"
4745 $run eval "$cmd"
4746 done
4747 IFS="$save_ifs"
4750 if test -n "$old_library"; then
4751 # Do each command in the old_postuninstall commands.
4752 eval cmds=\"$old_postuninstall_cmds\"
4753 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4754 for cmd in $cmds; do
4755 IFS="$save_ifs"
4756 $show "$cmd"
4757 $run eval "$cmd"
4758 done
4759 IFS="$save_ifs"
4761 # FIXME: should reinstall the best remaining shared library.
4766 *.lo)
4767 # Possibly a libtool object, so verify it.
4768 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4770 # Read the .lo file
4771 . ./$file
4773 # Add PIC object to the list of files to remove.
4774 if test -n "$pic_object" \
4775 && test "$pic_object" != none; then
4776 rmfiles="$rmfiles $dir/$pic_object"
4779 # Add non-PIC object to the list of files to remove.
4780 if test -n "$non_pic_object" \
4781 && test "$non_pic_object" != none; then
4782 rmfiles="$rmfiles $dir/$non_pic_object"
4788 # Do a test to see if this is a libtool program.
4789 if test $mode = clean &&
4790 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4791 relink_command=
4792 . $dir/$file
4794 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4795 if test "$fast_install" = yes && test -n "$relink_command"; then
4796 rmfiles="$rmfiles $objdir/lt-$name"
4800 esac
4801 $show "$rm $rmfiles"
4802 $run $rm $rmfiles
4803 done
4804 exit 0
4808 $echo "$modename: you must specify a MODE" 1>&2
4809 $echo "$generic_help" 1>&2
4810 exit 1
4812 esac
4814 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4815 $echo "$generic_help" 1>&2
4816 exit 1
4817 fi # test -z "$show_help"
4819 # We need to display help for each of the modes.
4820 case "$mode" in
4821 "") $echo \
4822 "Usage: $modename [OPTION]... [MODE-ARG]...
4824 Provide generalized library-building support services.
4826 --config show all configuration variables
4827 --debug enable verbose shell tracing
4828 -n, --dry-run display commands without modifying any files
4829 --features display basic configuration information and exit
4830 --finish same as \`--mode=finish'
4831 --help display this help message and exit
4832 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4833 --quiet same as \`--silent'
4834 --silent don't print informational messages
4835 --tag=TAG use configuration variables from tag TAG
4836 --version print version information
4838 MODE must be one of the following:
4840 clean remove files from the build directory
4841 compile compile a source file into a libtool object
4842 execute automatically set library path, then run a program
4843 finish complete the installation of libtool libraries
4844 install install libraries or executables
4845 link create a library or an executable
4846 uninstall remove libraries from an installed directory
4848 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4849 a more detailed description of MODE."
4850 exit 0
4853 clean)
4854 $echo \
4855 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4857 Remove files from the build directory.
4859 RM is the name of the program to use to delete files associated with each FILE
4860 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4861 to RM.
4863 If FILE is a libtool library, object or program, all the files associated
4864 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4867 compile)
4868 $echo \
4869 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4871 Compile a source file into a libtool library object.
4873 This mode accepts the following additional options:
4875 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4876 -static always build a \`.o' file suitable for static linking
4878 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4879 from the given SOURCEFILE.
4881 The output file name is determined by removing the directory component from
4882 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4883 library object suffix, \`.lo'."
4886 execute)
4887 $echo \
4888 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4890 Automatically set library path, then run a program.
4892 This mode accepts the following additional options:
4894 -dlopen FILE add the directory containing FILE to the library path
4896 This mode sets the library path environment variable according to \`-dlopen'
4897 flags.
4899 If any of the ARGS are libtool executable wrappers, then they are translated
4900 into their corresponding uninstalled binary, and any of their required library
4901 directories are added to the library path.
4903 Then, COMMAND is executed, with ARGS as arguments."
4906 finish)
4907 $echo \
4908 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4910 Complete the installation of libtool libraries.
4912 Each LIBDIR is a directory that contains libtool libraries.
4914 The commands that this mode executes may require superuser privileges. Use
4915 the \`--dry-run' option if you just want to see what would be executed."
4918 install)
4919 $echo \
4920 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4922 Install executables or libraries.
4924 INSTALL-COMMAND is the installation command. The first component should be
4925 either the \`install' or \`cp' program.
4927 The rest of the components are interpreted as arguments to that command (only
4928 BSD-compatible install options are recognized)."
4931 link)
4932 $echo \
4933 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4935 Link object files or libraries together to form another library, or to
4936 create an executable program.
4938 LINK-COMMAND is a command using the C compiler that you would use to create
4939 a program from several object files.
4941 The following components of LINK-COMMAND are treated specially:
4943 -all-static do not do any dynamic linking at all
4944 -avoid-version do not add a version suffix if possible
4945 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4946 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4947 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4948 -export-symbols SYMFILE
4949 try to export only the symbols listed in SYMFILE
4950 -export-symbols-regex REGEX
4951 try to export only the symbols matching REGEX
4952 -LLIBDIR search LIBDIR for required installed libraries
4953 -lNAME OUTPUT-FILE requires the installed library libNAME
4954 -module build a library that can dlopened
4955 -no-fast-install disable the fast-install mode
4956 -no-install link a not-installable executable
4957 -no-undefined declare that a library does not refer to external symbols
4958 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4959 -release RELEASE specify package release information
4960 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4961 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4962 -static do not do any dynamic linking of libtool libraries
4963 -version-info CURRENT[:REVISION[:AGE]]
4964 specify library version info [each variable defaults to 0]
4966 All other options (arguments beginning with \`-') are ignored.
4968 Every other argument is treated as a filename. Files ending in \`.la' are
4969 treated as uninstalled libtool libraries, other files are standard or library
4970 object files.
4972 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4973 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4974 required, except when creating a convenience library.
4976 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4977 using \`ar' and \`ranlib', or on Windows using \`lib'.
4979 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4980 is created, otherwise an executable program is created."
4983 uninstall)
4984 $echo \
4985 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4987 Remove libraries from an installation directory.
4989 RM is the name of the program to use to delete files associated with each FILE
4990 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4991 to RM.
4993 If FILE is a libtool library, all the files associated with it are deleted.
4994 Otherwise, only FILE itself is deleted using RM."
4998 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4999 $echo "$help" 1>&2
5000 exit 1
5002 esac
5004 echo
5005 $echo "Try \`$modename --help' for more information about other modes."
5007 exit 0
5009 # The TAGs below are defined such that we never get into a situation
5010 # in which we disable both kinds of libraries. Given conflicting
5011 # choices, we go for a static library, that is the most portable,
5012 # since we can't tell whether shared libraries were disabled because
5013 # the user asked for that or because the platform doesn't support
5014 # them. This is particularly important on AIX, because we don't
5015 # support having both static and shared libraries enabled at the same
5016 # time on that platform, so we default to a shared-only configuration.
5017 # If a disable-shared tag is given, we'll fallback to a static-only
5018 # configuration. But we'll never go from static-only to shared-only.
5020 ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5021 build_libtool_libs=no
5022 build_old_libs=yes
5023 ### END LIBTOOL TAG CONFIG: disable-shared
5025 ### BEGIN LIBTOOL TAG CONFIG: disable-static
5026 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5027 ### END LIBTOOL TAG CONFIG: disable-static
5029 # Local Variables:
5030 # mode:shell-script
5031 # sh-indentation:2
5032 # End: