* elf32-sh.c (sh_elf_merge_private_data): If ibfd's elf header flags
[binutils.git] / ltmain.sh
blob056c1dae57146e37e4ad245d0320d4a6762ed787
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 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.77 2000/08/01 04:25:15)"
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 X$CC | $Xsed` "*) ;;
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 X$CC | $Xsed` "*)
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* | 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 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 $rm "$lockfile"
774 exit 0
777 # libtool link mode
778 link | relink)
779 modename="$modename: link"
780 case "$host" in
781 *-*-cygwin* | *-*-mingw* | *-*-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 -L*)
1050 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1051 # We need an absolute path.
1052 case "$dir" in
1053 [\\/]* | [A-Za-z]:[\\/]*) ;;
1055 absdir=`cd "$dir" && pwd`
1056 if test -z "$absdir"; then
1057 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1058 exit 1
1060 dir="$absdir"
1062 esac
1063 case "$deplibs " in
1064 *" -L$dir "*) ;;
1066 deplibs="$deplibs -L$dir"
1067 lib_search_path="$lib_search_path $dir"
1069 esac
1070 case "$host" in
1071 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1072 case ":$dllsearchpath:" in
1073 *":$dir:"*) ;;
1074 *) dllsearchpath="$dllsearchpath:$dir";;
1075 esac
1077 esac
1078 continue
1081 -l*)
1082 if test "$arg" = "-lc"; then
1083 case "$host" in
1084 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1085 # These systems don't actually have c library (as such)
1086 continue
1088 esac
1089 elif test "$arg" = "-lm"; then
1090 case "$host" in
1091 *-*-cygwin* | *-*-beos*)
1092 # These systems don't actually have math library (as such)
1093 continue
1095 esac
1097 deplibs="$deplibs $arg"
1098 continue
1101 -module)
1102 module=yes
1103 continue
1106 -no-fast-install)
1107 fast_install=no
1108 continue
1111 -no-install)
1112 case "$host" in
1113 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1114 # The PATH hackery in wrapper scripts is required on Windows
1115 # in order for the loader to find any dlls it needs.
1116 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1117 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1118 fast_install=no
1120 *-*-rhapsody*)
1121 # rhapsody is a little odd...
1122 deplibs="$deplibs -framework System"
1125 no_install=yes
1127 esac
1128 continue
1131 -no-undefined)
1132 allow_undefined=no
1133 continue
1136 -o) prev=output ;;
1138 -release)
1139 prev=release
1140 continue
1143 -rpath)
1144 prev=rpath
1145 continue
1149 prev=xrpath
1150 continue
1153 -R*)
1154 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1155 # We need an absolute path.
1156 case "$dir" in
1157 [\\/]* | [A-Za-z]:[\\/]*) ;;
1159 $echo "$modename: only absolute run-paths are allowed" 1>&2
1160 exit 1
1162 esac
1163 case "$xrpath " in
1164 *" $dir "*) ;;
1165 *) xrpath="$xrpath $dir" ;;
1166 esac
1167 continue
1170 -static)
1171 # If we have no pic_flag, then this is the same as -all-static.
1172 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1173 compile_command="$compile_command $link_static_flag"
1174 finalize_command="$finalize_command $link_static_flag"
1176 continue
1179 -thread-safe)
1180 thread_safe=yes
1181 continue
1184 -version-info)
1185 prev=vinfo
1186 continue
1189 -Wc,*)
1190 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1191 arg=
1192 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1193 for flag in $args; do
1194 IFS="$save_ifs"
1195 case "$flag" in
1196 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1197 flag="\"$flag\""
1199 esac
1200 arg="$arg $wl$flag"
1201 compiler_flags="$compiler_flags $flag"
1202 done
1203 IFS="$save_ifs"
1204 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1207 -Wl,*)
1208 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1209 arg=
1210 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1211 for flag in $args; do
1212 IFS="$save_ifs"
1213 case "$flag" in
1214 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1215 flag="\"$flag\""
1217 esac
1218 arg="$arg $wl$flag"
1219 compiler_flags="$compiler_flags $wl$flag"
1220 linker_flags="$linker_flags $flag"
1221 done
1222 IFS="$save_ifs"
1223 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1226 -Xcompiler)
1227 prev=xcompiler
1228 continue
1231 -Xlinker)
1232 prev=xlinker
1233 continue
1236 # Some other compiler flag.
1237 -* | +*)
1238 # Unknown arguments in both finalize_command and compile_command need
1239 # to be aesthetically quoted because they are evaled later.
1240 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1241 case "$arg" in
1242 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1243 arg="\"$arg\""
1245 esac
1248 *.$objext)
1249 # A standard object.
1250 objs="$objs $arg"
1253 *.lo)
1254 # A libtool-controlled object.
1256 # Check to see that this really is a libtool object.
1257 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1258 pic_object=
1259 non_pic_object=
1261 # Read the .lo file
1262 # If there is no directory component, then add one.
1263 case "$arg" in
1264 */* | *\\*) . $arg ;;
1265 *) . ./$arg ;;
1266 esac
1268 if test -z "$pic_object" || \
1269 test -z "$non_pic_object" ||
1270 test "$pic_object" = none && \
1271 test "$non_pic_object" = none; then
1272 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1273 exit 1
1276 # Extract subdirectory from the argument.
1277 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1278 if test "X$xdir" = "X$arg"; then
1279 xdir=
1280 else
1281 xdir="$xdir/"
1284 if test "$pic_object" != none; then
1285 # Prepend the subdirectory the object is found in.
1286 pic_object="$xdir$pic_object"
1288 if test "$prev" = dlfiles; then
1289 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1290 dlfiles="$dlfiles $pic_object"
1291 prev=
1292 continue
1293 else
1294 # If libtool objects are unsupported, then we need to preload.
1295 prev=dlprefiles
1299 # CHECK ME: I think I busted this. -Ossama
1300 if test "$prev" = dlprefiles; then
1301 # Preload the old-style object.
1302 dlprefiles="$dlprefiles $pic_object"
1303 prev=
1306 # A PIC object.
1307 libobjs="$libobjs $pic_object"
1308 arg="$pic_object"
1311 # Non-PIC object.
1312 if test "$non_pic_object" != none; then
1313 # Prepend the subdirectory the object is found in.
1314 non_pic_object="$xdir$non_pic_object"
1316 # A standard non-PIC object
1317 non_pic_objects="$non_pic_objects $non_pic_object"
1318 if test -z "$pic_object" || test "$pic_object" = none ; then
1319 arg="$non_pic_object"
1322 else
1323 # Only an error if not doing a dry-run.
1324 if test -z "$run"; then
1325 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1326 exit 1
1327 else
1328 # Dry-run case.
1330 # Extract subdirectory from the argument.
1331 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1332 if test "X$xdir" = "X$arg"; then
1333 xdir=
1334 else
1335 xdir="$xdir/"
1338 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1339 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1340 libobjs="$libobjs $pic_object"
1341 non_pic_objects="$non_pic_objects $non_pic_object"
1346 *.$libext)
1347 # An archive.
1348 deplibs="$deplibs $arg"
1349 old_deplibs="$old_deplibs $arg"
1350 continue
1353 *.la)
1354 # A libtool-controlled library.
1356 if test "$prev" = dlfiles; then
1357 # This library was specified with -dlopen.
1358 dlfiles="$dlfiles $arg"
1359 prev=
1360 elif test "$prev" = dlprefiles; then
1361 # The library was specified with -dlpreopen.
1362 dlprefiles="$dlprefiles $arg"
1363 prev=
1364 else
1365 deplibs="$deplibs $arg"
1367 continue
1370 # Some other compiler argument.
1372 # Unknown arguments in both finalize_command and compile_command need
1373 # to be aesthetically quoted because they are evaled later.
1374 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1375 case "$arg" in
1376 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1377 arg="\"$arg\""
1379 esac
1381 esac
1383 # Now actually substitute the argument into the commands.
1384 if test -n "$arg"; then
1385 compile_command="$compile_command $arg"
1386 finalize_command="$finalize_command $arg"
1388 done
1390 if test -n "$prev"; then
1391 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1392 $echo "$help" 1>&2
1393 exit 1
1396 # Infer tagged configuration to use if any are available and
1397 # if one wasn't chosen via the "--tag" command line option.
1398 # Only attempt this if the compiler in the base link
1399 # command doesn't match the default compiler.
1400 if test -n "$available_tags" && test -z "$tagname"; then
1401 case $base_compile in
1402 "$CC "*) ;;
1403 # Blanks in the command may have been stripped by the calling shell,
1404 # but not from the CC environment variable when ltconfig was run.
1405 "`$echo X$CC | $Xsed` "*) ;;
1407 for z in $available_tags; do
1408 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1409 # Evaluate the configuration.
1410 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1411 case $base_compile in
1412 "$CC "*)
1413 # The compiler in $compile_command matches
1414 # the one in the tagged configuration.
1415 # Assume this is the tagged configuration we want.
1416 tagname=$z
1417 break
1419 "`$echo X$CC | $Xsed` "*)
1420 tagname=$z
1421 break
1423 esac
1425 done
1426 # If $tagname still isn't set, then no tagged configuration
1427 # was found and let the user know that the "--tag" command
1428 # line option must be used.
1429 if test -z "$tagname"; then
1430 echo "$modename: unable to infer tagged configuration"
1431 echo "$modename: specify a tag with \`--tag'" 1>&2
1432 exit 1
1433 # else
1434 # echo "$modename: using $tagname tagged configuration"
1437 esac
1440 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1441 eval arg=\"$export_dynamic_flag_spec\"
1442 compile_command="$compile_command $arg"
1443 finalize_command="$finalize_command $arg"
1446 oldlibs=
1447 # calculate the name of the file, without its directory
1448 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1449 libobjs_save="$libobjs"
1451 if test -n "$shlibpath_var"; then
1452 # get the directories listed in $shlibpath_var
1453 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1454 else
1455 shlib_search_path=
1457 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1458 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1460 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1461 if test "X$output_objdir" = "X$output"; then
1462 output_objdir="$objdir"
1463 else
1464 output_objdir="$output_objdir/$objdir"
1466 # Create the object directory.
1467 if test ! -d $output_objdir; then
1468 $show "$mkdir $output_objdir"
1469 $run $mkdir $output_objdir
1470 status=$?
1471 if test $status -ne 0 && test ! -d $output_objdir; then
1472 exit $status
1476 # Determine the type of output
1477 case "$output" in
1479 $echo "$modename: you must specify an output file" 1>&2
1480 $echo "$help" 1>&2
1481 exit 1
1483 *.$libext) linkmode=oldlib ;;
1484 *.lo | *.$objext) linkmode=obj ;;
1485 *.la) linkmode=lib ;;
1486 *) linkmode=prog ;; # Anything else should be a program.
1487 esac
1489 specialdeplibs=
1490 libs=
1491 # Find all interdependent deplibs by searching for libraries
1492 # that are linked more than once (e.g. -la -lb -la)
1493 for deplib in $deplibs; do
1494 case "$libs " in
1495 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1496 esac
1497 libs="$libs $deplib"
1498 done
1500 if test $linkmode = lib; then
1501 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1504 deplibs=
1505 newdependency_libs=
1506 newlib_search_path=
1507 need_relink=no # whether we're linking any uninstalled libtool libraries
1508 uninst_deplibs= # uninstalled libtool libraries
1509 uninst_path= # paths that contain uninstalled libtool libraries
1510 case $linkmode in
1511 lib)
1512 passes="conv link"
1513 for file in $dlfiles $dlprefiles; do
1514 case "$file" in
1515 *.la) ;;
1517 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1518 exit 1
1520 esac
1521 done
1523 prog)
1524 compile_deplibs=
1525 finalize_deplibs=
1526 alldeplibs=no
1527 newdlfiles=
1528 newdlprefiles=
1529 passes="conv scan dlopen dlpreopen link"
1531 *) passes="conv"
1533 esac
1534 for pass in $passes; do
1535 if test "$linkmode,$pass" = "lib,link" ||
1536 test "$linkmode,$pass" = "prog,scan"; then
1537 libs="$deplibs"
1538 deplibs=
1540 if test $linkmode = prog; then
1541 case $pass in
1542 dlopen) libs="$dlfiles" ;;
1543 dlpreopen) libs="$dlprefiles" ;;
1544 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1545 esac
1547 if test $pass = dlopen; then
1548 # Collect dlpreopened libraries
1549 save_deplibs="$deplibs"
1550 deplibs=
1552 for deplib in $libs; do
1553 lib=
1554 found=no
1555 case "$deplib" in
1556 -l*)
1557 if test $linkmode != lib && test $linkmode != prog; then
1558 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1559 continue
1561 if test $pass = conv; then
1562 deplibs="$deplib $deplibs"
1563 continue
1565 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1566 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1567 # Search the libtool library
1568 lib="$searchdir/lib${name}.la"
1569 if test -f "$lib"; then
1570 found=yes
1571 break
1573 done
1574 if test "$found" != yes; then
1575 if test "$linkmode,$pass" = "prog,link"; then
1576 compile_deplibs="$deplib $compile_deplibs"
1577 finalize_deplibs="$deplib $finalize_deplibs"
1578 else
1579 deplibs="$deplib $deplibs"
1580 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1582 continue
1585 -L*)
1586 case $linkmode in
1587 lib)
1588 deplibs="$deplib $deplibs"
1589 test $pass = conv && continue
1590 newdependency_libs="$deplib $newdependency_libs"
1591 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1593 prog)
1594 if test $pass = conv; then
1595 deplibs="$deplib $deplibs"
1596 continue
1598 if test $pass = scan; then
1599 deplibs="$deplib $deplibs"
1600 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1601 else
1602 compile_deplibs="$deplib $compile_deplibs"
1603 finalize_deplibs="$deplib $finalize_deplibs"
1607 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1609 esac
1610 continue
1612 -R*)
1613 if test $pass = link; then
1614 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1615 # Make sure the xrpath contains only unique directories.
1616 case "$xrpath " in
1617 *" $dir "*) ;;
1618 *) xrpath="$xrpath $dir" ;;
1619 esac
1621 deplibs="$deplib $deplibs"
1622 continue
1624 *.la) lib="$deplib" ;;
1625 *.$libext)
1626 if test $pass = conv; then
1627 deplibs="$deplib $deplibs"
1628 continue
1630 case $linkmode in
1631 lib)
1632 if test "$deplibs_check_method" != pass_all; then
1633 echo
1634 echo "*** Warning: This library needs some functionality provided by $deplib."
1635 echo "*** I have the capability to make that library automatically link in when"
1636 echo "*** you link to this library. But I can only do this if you have a"
1637 echo "*** shared version of the library, which you do not appear to have."
1638 else
1639 echo
1640 echo "*** Warning: Linking the shared library $output against the"
1641 echo "*** static library $deplib is not portable!"
1642 deplibs="$deplib $deplibs"
1644 continue
1646 prog)
1647 if test $pass != link; then
1648 deplibs="$deplib $deplibs"
1649 else
1650 compile_deplibs="$deplib $compile_deplibs"
1651 finalize_deplibs="$deplib $finalize_deplibs"
1653 continue
1655 esac
1657 *.lo | *.$objext)
1658 if test $pass = conv; then
1659 deplibs="$deplib $deplibs"
1660 elif test $linkmode = prog; then
1661 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1662 # If there is no dlopen support or we're linking statically,
1663 # we need to preload.
1664 newdlprefiles="$newdlprefiles $deplib"
1665 compile_deplibs="$deplib $compile_deplibs"
1666 finalize_deplibs="$deplib $finalize_deplibs"
1667 else
1668 newdlfiles="$newdlfiles $deplib"
1671 continue
1673 %DEPLIBS%)
1674 alldeplibs=yes
1675 continue
1677 esac
1678 if test $found = yes || test -f "$lib"; then :
1679 else
1680 $echo "$modename: cannot find the library \`$lib'" 1>&2
1681 exit 1
1684 # Check to see that this really is a libtool archive.
1685 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1686 else
1687 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1688 exit 1
1691 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1692 test "X$ladir" = "X$lib" && ladir="."
1694 dlname=
1695 dlopen=
1696 dlpreopen=
1697 libdir=
1698 library_names=
1699 old_library=
1700 # If the library was installed with an old release of libtool,
1701 # it will not redefine variable installed.
1702 installed=yes
1704 # Read the .la file
1705 case "$lib" in
1706 */* | *\\*) . $lib ;;
1707 *) . ./$lib ;;
1708 esac
1710 if test "$linkmode,$pass" = "lib,link" ||
1711 test "$linkmode,$pass" = "prog,scan" ||
1712 { test $linkmode != prog && test $linkmode != lib; }; then
1713 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1714 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1717 if test $pass = conv; then
1718 # only check for convenience libraries
1719 deplibs="$lib $deplibs"
1720 if test -z "$libdir"; then
1721 if test -z "$old_library"; then
1722 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1723 exit 1
1725 # It is a libtool convenience library, so add in its objects.
1726 convenience="$convenience $ladir/$objdir/$old_library"
1727 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1728 tmp_libs=
1729 for deplib in $dependency_libs; do
1730 deplibs="$deplib $deplibs"
1731 case "$tmp_libs " in
1732 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1733 esac
1734 tmp_libs="$tmp_libs $deplib"
1735 done
1736 elif test $linkmode != prog && test $linkmode != lib; then
1737 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1738 exit 1
1740 continue
1743 # Get the name of the library we link against.
1744 linklib=
1745 for l in $old_library $library_names; do
1746 linklib="$l"
1747 done
1748 if test -z "$linklib"; then
1749 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1750 exit 1
1753 # This library was specified with -dlopen.
1754 if test $pass = dlopen; then
1755 if test -z "$libdir"; then
1756 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1757 exit 1
1759 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1760 # If there is no dlname, no dlopen support or we're linking statically,
1761 # we need to preload.
1762 dlprefiles="$dlprefiles $lib"
1763 else
1764 newdlfiles="$newdlfiles $lib"
1766 continue
1769 # We need an absolute path.
1770 case "$ladir" in
1771 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1773 abs_ladir=`cd "$ladir" && pwd`
1774 if test -z "$abs_ladir"; then
1775 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1776 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1777 abs_ladir="$ladir"
1780 esac
1781 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1783 # Find the relevant object directory and library name.
1784 if test "X$installed" = Xyes; then
1785 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1786 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1787 dir="$ladir"
1788 absdir="$abs_ladir"
1789 libdir="$abs_ladir"
1790 else
1791 dir="$libdir"
1792 absdir="$libdir"
1794 else
1795 dir="$ladir/$objdir"
1796 absdir="$abs_ladir/$objdir"
1797 # Remove this search path later
1798 uninst_path="$uninst_path $abs_ladir"
1800 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1802 # This library was specified with -dlpreopen.
1803 if test $pass = dlpreopen; then
1804 if test -z "$libdir"; then
1805 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1806 exit 1
1808 # Prefer using a static library (so that no silly _DYNAMIC symbols
1809 # are required to link).
1810 if test -n "$old_library"; then
1811 newdlprefiles="$newdlprefiles $dir/$old_library"
1812 else
1813 newdlprefiles="$newdlprefiles $dir/$linklib"
1817 if test -z "$libdir"; then
1818 # link the convenience library
1819 if test $linkmode = lib; then
1820 deplibs="$dir/$old_library $deplibs"
1821 elif test "$linkmode,$pass" = "prog,link"; then
1822 compile_deplibs="$dir/$old_library $compile_deplibs"
1823 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1824 else
1825 deplibs="$lib $deplibs" # used for prog,scan pass
1827 continue
1830 if test $linkmode = prog && test $pass != link; then
1831 newlib_search_path="$newlib_search_path $ladir"
1832 deplibs="$lib $deplibs"
1834 linkalldeplibs=no
1835 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1836 test "$build_libtool_libs" = no; then
1837 linkalldeplibs=yes
1840 tmp_libs=
1841 for deplib in $dependency_libs; do
1842 case "$deplib" in
1843 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1844 esac
1845 # Need to link against all dependency_libs?
1846 if test $linkalldeplibs = yes; then
1847 deplibs="$deplib $deplibs"
1848 else
1849 # Need to hardcode shared library paths
1850 # or/and link against static libraries
1851 newdependency_libs="$deplib $newdependency_libs"
1853 case "$tmp_libs " in
1854 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1855 esac
1856 tmp_libs="$tmp_libs $deplib"
1857 done
1858 continue
1861 if test "$linkmode,$pass" = "prog,link"; then
1862 if test -n "$library_names" &&
1863 { test "$hardcode_into_libs" != all || test "$alldeplibs" != yes; } &&
1864 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1865 # We need to hardcode the library path
1866 if test -n "$shlibpath_var"; then
1867 # Make sure the rpath contains only unique directories.
1868 case "$temp_rpath " in
1869 *" $dir "*) ;;
1870 *" $absdir "*) ;;
1871 *) temp_rpath="$temp_rpath $dir" ;;
1872 esac
1875 # Hardcode the library path.
1876 # Skip directories that are in the system default run-time
1877 # search path.
1878 case " $sys_lib_dlsearch_path " in
1879 *" $absdir "*) ;;
1881 case "$compile_rpath " in
1882 *" $absdir "*) ;;
1883 *) compile_rpath="$compile_rpath $absdir"
1884 esac
1886 esac
1888 case " $sys_lib_dlsearch_path " in
1889 *" $libdir "*) ;;
1891 case "$finalize_rpath " in
1892 *" $libdir "*) ;;
1893 *) finalize_rpath="$finalize_rpath $libdir"
1894 esac
1896 esac
1899 if test "$alldeplibs" = yes &&
1900 { test "$deplibs_check_method" = pass_all ||
1901 { test "$build_libtool_libs" = yes &&
1902 test -n "$library_names"; }; }; then
1903 # We only need to search for static libraries
1904 continue
1908 link_static=no # Whether the deplib will be linked statically
1909 if test -n "$library_names" &&
1910 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1911 if test "$installed" = no; then
1912 uninst_deplibs="$uninst_deplibs $lib"
1913 need_relink=yes
1915 # This is a shared library
1916 if test $linkmode = lib && test "$hardcode_into_libs" = all; then
1917 # Hardcode the library path.
1918 # Skip directories that are in the system default run-time
1919 # search path.
1920 case " $sys_lib_dlsearch_path " in
1921 *" $absdir "*) ;;
1923 case "$compile_rpath " in
1924 *" $absdir "*) ;;
1925 *) compile_rpath="$compile_rpath $absdir"
1926 esac
1928 esac
1929 case " $sys_lib_dlsearch_path " in
1930 *" $libdir "*) ;;
1932 case "$finalize_rpath " in
1933 *" $libdir "*) ;;
1934 *) finalize_rpath="$finalize_rpath $libdir"
1935 esac
1937 esac
1940 if test -n "$old_archive_from_expsyms_cmds"; then
1941 # figure out the soname
1942 set dummy $library_names
1943 realname="$2"
1944 shift; shift
1945 libname=`eval \\$echo \"$libname_spec\"`
1946 if test -n "$soname_spec"; then
1947 eval soname=\"$soname_spec\"
1948 else
1949 soname="$realname"
1952 # Make a new name for the extract_expsyms_cmds to use
1953 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1955 # If the library has no export list, then create one now
1956 if test -f "$output_objdir/$soname-def"; then :
1957 else
1958 $show "extracting exported symbol list from \`$soname'"
1959 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1960 eval cmds=\"$extract_expsyms_cmds\"
1961 for cmd in $cmds; do
1962 IFS="$save_ifs"
1963 $show "$cmd"
1964 $run eval "$cmd" || exit $?
1965 done
1966 IFS="$save_ifs"
1969 # Create $newlib
1970 if test -f "$output_objdir/$newlib"; then :; else
1971 $show "generating import library for \`$soname'"
1972 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1973 eval cmds=\"$old_archive_from_expsyms_cmds\"
1974 for cmd in $cmds; do
1975 IFS="$save_ifs"
1976 $show "$cmd"
1977 $run eval "$cmd" || exit $?
1978 done
1979 IFS="$save_ifs"
1981 # make sure the library variables are pointing to the new library
1982 dir=$output_objdir
1983 linklib=$newlib
1986 if test $linkmode = prog || test "$mode" != relink; then
1987 add_shlibpath=
1988 add_dir=
1989 add=
1990 lib_linked=yes
1991 case "$hardcode_action" in
1992 immediate | unsupported)
1993 if test "$hardcode_direct" = no; then
1994 add="$dir/$linklib"
1995 elif test "$hardcode_minus_L" = no; then
1996 case "$host" in
1997 *-*-sunos*) add_shlibpath="$dir" ;;
1998 esac
1999 add_dir="-L$dir"
2000 add="-l$name"
2001 elif test "$hardcode_shlibpath_var" = no; then
2002 add_shlibpath="$dir"
2003 add="-l$name"
2004 else
2005 lib_linked=no
2008 relink)
2009 if test "$hardcode_direct" = yes; then
2010 add="$dir/$linklib"
2011 elif test "$hardcode_minus_L" = yes; then
2012 add_dir="-L$dir"
2013 add="-l$name"
2014 elif test "$hardcode_shlibpath_var" = yes; then
2015 add_shlibpath="$dir"
2016 add="-l$name"
2017 else
2018 lib_linked=no
2021 *) lib_linked=no ;;
2022 esac
2024 if test "$lib_linked" != yes; then
2025 $echo "$modename: configuration error: unsupported hardcode properties"
2026 exit 1
2029 if test -n "$add_shlibpath"; then
2030 case ":$compile_shlibpath:" in
2031 *":$add_shlibpath:"*) ;;
2032 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2033 esac
2035 if test $linkmode = prog; then
2036 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2037 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2038 else
2039 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2040 test -n "$add" && deplibs="$add $deplibs"
2041 if test "$hardcode_direct" != yes && \
2042 test "$hardcode_minus_L" != yes && \
2043 test "$hardcode_shlibpath_var" = yes; then
2044 case ":$finalize_shlibpath:" in
2045 *":$libdir:"*) ;;
2046 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2047 esac
2052 if test $linkmode = prog || test "$mode" = relink; then
2053 add_shlibpath=
2054 add_dir=
2055 add=
2056 # Finalize command for both is simple: just hardcode it.
2057 if test "$hardcode_direct" = yes; then
2058 add="$libdir/$linklib"
2059 elif test "$hardcode_minus_L" = yes; then
2060 add_dir="-L$libdir"
2061 add="-l$name"
2062 elif test "$hardcode_shlibpath_var" = yes; then
2063 case ":$finalize_shlibpath:" in
2064 *":$libdir:"*) ;;
2065 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2066 esac
2067 add="-l$name"
2068 else
2069 # We cannot seem to hardcode it, guess we'll fake it.
2070 add_dir="-L$libdir"
2071 add="-l$name"
2074 if test $linkmode = prog; then
2075 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2076 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2077 else
2078 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2079 test -n "$add" && deplibs="$add $deplibs"
2082 elif test $linkmode = prog; then
2083 # Here we assume that one of hardcode_direct or hardcode_minus_L
2084 # is not unsupported. This is valid on all known static and
2085 # shared platforms.
2086 if test "$hardcode_direct" != unsupported; then
2087 test -n "$old_library" && linklib="$old_library"
2088 compile_deplibs="$dir/$linklib $compile_deplibs"
2089 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2090 else
2091 compile_deplibs="-l$name -L$dir $compile_deplibs"
2092 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2094 elif test "$build_libtool_libs" = yes; then
2095 # Not a shared library
2096 if test "$deplibs_check_method" != pass_all; then
2097 # We're trying link a shared library against a static one
2098 # but the system doesn't support it.
2099 # Just print a warning and add the library to dependency_libs so
2100 # that the program can be linked against the static library.
2101 echo
2102 echo "*** Warning: This library needs some functionality provided by $lib."
2103 echo "*** I have the capability to make that library automatically link in when"
2104 echo "*** you link to this library. But I can only do this if you have a"
2105 echo "*** shared version of the library, which you do not appear to have."
2106 else
2107 convenience="$convenience $dir/$old_library"
2108 old_convenience="$old_convenience $dir/$old_library"
2109 deplibs="$dir/$old_library $deplibs"
2110 link_static=yes
2114 if test $linkmode = lib; then
2115 if test -n "$dependency_libs" &&
2116 { test "$hardcode_into_libs" = no || test $build_old_libs = yes ||
2117 test $link_static = yes; }; then
2118 # Extract -R from dependency_libs
2119 temp_deplibs=
2120 for libdir in $dependency_libs; do
2121 case "$libdir" in
2122 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2123 case " $xrpath " in
2124 *" $temp_xrpath "*) ;;
2125 *) xrpath="$xrpath $temp_xrpath";;
2126 esac;;
2127 *) temp_deplibs="$temp_deplibs $libdir";;
2128 esac
2129 done
2130 dependency_libs="$temp_deplibs"
2133 newlib_search_path="$newlib_search_path $absdir"
2134 # Link against this library
2135 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2136 # ... and its dependency_libs
2137 tmp_libs=
2138 for deplib in $dependency_libs; do
2139 newdependency_libs="$deplib $newdependency_libs"
2140 case "$tmp_libs " in
2141 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2142 esac
2143 tmp_libs="$tmp_libs $deplib"
2144 done
2146 if test $link_all_deplibs != no; then
2147 # Add the search paths of all dependency libraries
2148 for deplib in $dependency_libs; do
2149 case "$deplib" in
2150 -L*) path="$deplib" ;;
2151 *.la)
2152 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2153 test "X$dir" = "X$deplib" && dir="."
2154 # We need an absolute path.
2155 case "$dir" in
2156 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2158 absdir=`cd "$dir" && pwd`
2159 if test -z "$absdir"; then
2160 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2161 absdir="$dir"
2164 esac
2165 if grep "^installed=no" $deplib > /dev/null; then
2166 path="-L$absdir/$objdir"
2167 else
2168 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2169 if test -z "$libdir"; then
2170 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2171 exit 1
2173 if test "$absdir" != "$libdir"; then
2174 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2176 path="-L$absdir"
2179 *) continue ;;
2180 esac
2181 case " $deplibs " in
2182 *" $path "*) ;;
2183 *) deplibs="$path $deplibs" ;;
2184 esac
2185 done
2188 done
2189 dependency_libs="$newdependency_libs"
2190 if test $pass = dlpreopen; then
2191 # Link the dlpreopened libraries before other libraries
2192 for deplib in $save_deplibs; do
2193 deplibs="$deplib $deplibs"
2194 done
2196 if test $pass != dlopen; then
2197 if test $pass != conv; then
2198 # Make sure lib_search_path contains only unique directories.
2199 lib_search_path=
2200 for dir in $newlib_search_path; do
2201 case "$lib_search_path " in
2202 *" $dir "*) ;;
2203 *) lib_search_path="$lib_search_path $dir" ;;
2204 esac
2205 done
2206 newlib_search_path=
2209 if test "$linkmode,$pass" != "prog,link"; then
2210 vars="deplibs"
2211 else
2212 vars="compile_deplibs finalize_deplibs"
2214 for var in $vars dependency_libs; do
2215 # Make sure that $var contains only unique libraries
2216 # and add them in reverse order
2217 eval tmp_libs=\"\$$var\"
2218 new_libs=
2219 for deplib in $tmp_libs; do
2220 case "$deplib" in
2221 -L*) new_libs="$deplib $new_libs" ;;
2223 case " $specialdeplibs " in
2224 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2226 case " $new_libs " in
2227 *" $deplib "*) ;;
2228 *) new_libs="$deplib $new_libs" ;;
2229 esac
2231 esac
2233 esac
2234 done
2235 tmp_libs=
2236 for deplib in $new_libs; do
2237 case "$deplib" in
2238 -L*)
2239 case " $tmp_libs " in
2240 *" $deplib "*) ;;
2241 *) tmp_libs="$tmp_libs $deplib" ;;
2242 esac
2244 *) tmp_libs="$tmp_libs $deplib" ;;
2245 esac
2246 done
2247 eval $var=\"$tmp_libs\"
2248 done
2250 done
2251 if test $linkmode = prog; then
2252 dlfiles="$newdlfiles"
2253 dlprefiles="$newdlprefiles"
2256 case $linkmode in
2257 oldlib)
2258 if test -n "$deplibs"; then
2259 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2262 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2263 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2266 if test -n "$rpath"; then
2267 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2270 if test -n "$xrpath"; then
2271 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2274 if test -n "$vinfo"; then
2275 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2278 if test -n "$release"; then
2279 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2282 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2283 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2286 # Now set the variables for building old libraries.
2287 build_libtool_libs=no
2288 oldlibs="$output"
2289 objs="$objs$old_deplibs"
2292 lib)
2293 # Make sure we only generate libraries of the form `libNAME.la'.
2294 case "$outputname" in
2295 lib*)
2296 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2297 eval libname=\"$libname_spec\"
2300 if test "$module" = no; then
2301 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2302 $echo "$help" 1>&2
2303 exit 1
2305 if test "$need_lib_prefix" != no; then
2306 # Add the "lib" prefix for modules if required
2307 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2308 eval libname=\"$libname_spec\"
2309 else
2310 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2313 esac
2315 if test -n "$objs"; then
2316 if test "$deplibs_check_method" != pass_all; then
2317 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2318 exit 1
2319 else
2320 echo
2321 echo "*** Warning: Linking the shared library $output against the non-libtool"
2322 echo "*** objects $objs is not portable!"
2323 libobjs="$libobjs $objs"
2327 if test "$dlself" != no; then
2328 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2331 set dummy $rpath
2332 if test $# -gt 2; then
2333 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2335 install_libdir="$2"
2337 oldlibs=
2338 if test -z "$rpath"; then
2339 if test "$build_libtool_libs" = yes; then
2340 # Building a libtool convenience library.
2341 # Some compilers have problems with a `.al' extension so
2342 # convenience libraries should have the same extension an
2343 # archive normally would.
2344 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2345 build_libtool_libs=convenience
2346 build_old_libs=yes
2349 if test -n "$vinfo"; then
2350 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2353 if test -n "$release"; then
2354 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2356 else
2358 # Parse the version information argument.
2359 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2360 set dummy $vinfo 0 0 0
2361 IFS="$save_ifs"
2363 if test -n "$8"; then
2364 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2365 $echo "$help" 1>&2
2366 exit 1
2369 current="$2"
2370 revision="$3"
2371 age="$4"
2373 # Check that each of the things are valid numbers.
2374 case "$current" in
2375 0 | [1-9] | [1-9][0-9]*) ;;
2377 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2378 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2379 exit 1
2381 esac
2383 case "$revision" in
2384 0 | [1-9] | [1-9][0-9]*) ;;
2386 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2387 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2388 exit 1
2390 esac
2392 case "$age" in
2393 0 | [1-9] | [1-9][0-9]*) ;;
2395 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2396 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2397 exit 1
2399 esac
2401 if test $age -gt $current; then
2402 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2403 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2404 exit 1
2407 # Calculate the version variables.
2408 major=
2409 versuffix=
2410 verstring=
2411 case "$version_type" in
2412 none) ;;
2414 irix)
2415 major=`expr $current - $age + 1`
2416 verstring="sgi$major.$revision"
2418 # Add in all the interfaces that we are compatible with.
2419 loop=$revision
2420 while test $loop != 0; do
2421 iface=`expr $revision - $loop`
2422 loop=`expr $loop - 1`
2423 verstring="sgi$major.$iface:$verstring"
2424 done
2426 # Before this point, $major must not contain `.'.
2427 major=.$major
2428 versuffix="$major.$revision"
2431 linux)
2432 major=.`expr $current - $age`
2433 versuffix="$major.$age.$revision"
2436 osf)
2437 major=`expr $current - $age`
2438 versuffix=".$current.$age.$revision"
2439 verstring="$current.$age.$revision"
2441 # Add in all the interfaces that we are compatible with.
2442 loop=$age
2443 while test $loop != 0; do
2444 iface=`expr $current - $loop`
2445 loop=`expr $loop - 1`
2446 verstring="$verstring:${iface}.0"
2447 done
2449 # Make executables depend on our current version.
2450 verstring="$verstring:${current}.0"
2453 sunos)
2454 major=".$current"
2455 versuffix=".$current.$revision"
2458 freebsd-aout)
2459 major=".$current"
2460 versuffix=".$current.$revision";
2463 freebsd-elf)
2464 major=".$current"
2465 versuffix=".$current";
2468 windows)
2469 # Like Linux, but with '-' rather than '.', since we only
2470 # want one extension on Windows 95.
2471 major=`expr $current - $age`
2472 versuffix="-$major-$age-$revision"
2476 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2477 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2478 exit 1
2480 esac
2482 # Clear the version info if we defaulted, and they specified a release.
2483 if test -z "$vinfo" && test -n "$release"; then
2484 major=
2485 verstring="0.0"
2486 if test "$need_version" = no; then
2487 versuffix=
2488 else
2489 versuffix=".0.0"
2493 # Remove version info from name if versioning should be avoided
2494 if test "$avoid_version" = yes && test "$need_version" = no; then
2495 major=
2496 versuffix=
2497 verstring=""
2500 # Check to see if the archive will have undefined symbols.
2501 if test "$allow_undefined" = yes; then
2502 if test "$allow_undefined_flag" = unsupported; then
2503 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2504 build_libtool_libs=no
2505 build_old_libs=yes
2507 else
2508 # Don't allow undefined symbols.
2509 allow_undefined_flag="$no_undefined_flag"
2513 if test "$mode" != relink; then
2514 # Remove our outputs, but don't remove object files since they
2515 # may have been created when compiling PIC objects.
2516 removelist=
2517 tempremovelist=`echo "$output_objdir/*"`
2518 for p in $tempremovelist; do
2519 case "$p" in
2520 *.$objext)
2522 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2523 removelist="$removelist $p"
2525 *) ;;
2526 esac
2527 done
2528 if test -n "$removelist"; then
2529 $show "${rm}r $removelist"
2530 $run ${rm}r $removelist
2534 # Now set the variables for building old libraries.
2535 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2536 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2538 # Transform .lo files to .o files.
2539 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2542 # Eliminate all temporary directories.
2543 for path in $uninst_path; do
2544 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2545 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2546 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2547 done
2549 if test -n "$xrpath"; then
2550 # If the user specified any rpath flags, then add them.
2551 temp_xrpath=
2552 for libdir in $xrpath; do
2553 temp_xrpath="$temp_xrpath -R$libdir"
2554 case "$finalize_rpath " in
2555 *" $libdir "*) ;;
2556 *) finalize_rpath="$finalize_rpath $libdir" ;;
2557 esac
2558 done
2559 if test "$hardcode_into_libs" = no || test $build_old_libs = yes; then
2560 dependency_libs="$temp_xrpath $dependency_libs"
2564 # Make sure dlfiles contains only unique files that won't be dlpreopened
2565 old_dlfiles="$dlfiles"
2566 dlfiles=
2567 for lib in $old_dlfiles; do
2568 case " $dlprefiles $dlfiles " in
2569 *" $lib "*) ;;
2570 *) dlfiles="$dlfiles $lib" ;;
2571 esac
2572 done
2574 # Make sure dlprefiles contains only unique files
2575 old_dlprefiles="$dlprefiles"
2576 dlprefiles=
2577 for lib in $old_dlprefiles; do
2578 case "$dlprefiles " in
2579 *" $lib "*) ;;
2580 *) dlprefiles="$dlprefiles $lib" ;;
2581 esac
2582 done
2584 if test "$build_libtool_libs" = yes; then
2585 if test -n "$rpath"; then
2586 case "$host" in
2587 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
2588 # these systems don't actually have a c library (as such)!
2591 # Add libc to deplibs on all other systems if necessary.
2592 if test $build_libtool_need_lc = "yes"; then
2593 deplibs="$deplibs -lc"
2596 esac
2599 # Transform deplibs into only deplibs that can be linked in shared.
2600 name_save=$name
2601 libname_save=$libname
2602 release_save=$release
2603 versuffix_save=$versuffix
2604 major_save=$major
2605 # I'm not sure if I'm treating the release correctly. I think
2606 # release should show up in the -l (ie -lgmp5) so we don't want to
2607 # add it in twice. Is that correct?
2608 release=""
2609 versuffix=""
2610 major=""
2611 newdeplibs=
2612 droppeddeps=no
2613 case "$deplibs_check_method" in
2614 pass_all)
2615 # Don't check for shared/static. Everything works.
2616 # This might be a little naive. We might want to check
2617 # whether the library exists or not. But this is on
2618 # osf3 & osf4 and I'm not really sure... Just
2619 # implementing what was already the behaviour.
2620 newdeplibs=$deplibs
2622 test_compile)
2623 # This code stresses the "libraries are programs" paradigm to its
2624 # limits. Maybe even breaks it. We compile a program, linking it
2625 # against the deplibs as a proxy for the library. Then we can check
2626 # whether they linked in statically or dynamically with ldd.
2627 $rm conftest.c
2628 cat > conftest.c <<EOF
2629 int main() { return 0; }
2631 $rm conftest
2632 $LTCC -o conftest conftest.c $deplibs
2633 if test $? -eq 0 ; then
2634 ldd_output=`ldd conftest`
2635 for i in $deplibs; do
2636 name="`expr $i : '-l\(.*\)'`"
2637 # If $name is empty we are operating on a -L argument.
2638 if test "$name" != "" ; then
2639 libname=`eval \\$echo \"$libname_spec\"`
2640 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2641 set dummy $deplib_matches
2642 deplib_match=$2
2643 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2644 newdeplibs="$newdeplibs $i"
2645 else
2646 droppeddeps=yes
2647 echo
2648 echo "*** Warning: This library needs some functionality provided by $i."
2649 echo "*** I have the capability to make that library automatically link in when"
2650 echo "*** you link to this library. But I can only do this if you have a"
2651 echo "*** shared version of the library, which you do not appear to have."
2653 else
2654 newdeplibs="$newdeplibs $i"
2656 done
2657 else
2658 # Error occured in the first compile. Let's try to salvage the situation:
2659 # Compile a seperate program for each library.
2660 for i in $deplibs; do
2661 name="`expr $i : '-l\(.*\)'`"
2662 # If $name is empty we are operating on a -L argument.
2663 if test "$name" != "" ; then
2664 $rm conftest
2665 $LTCC -o conftest conftest.c $i
2666 # Did it work?
2667 if test $? -eq 0 ; then
2668 ldd_output=`ldd conftest`
2669 libname=`eval \\$echo \"$libname_spec\"`
2670 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2671 set dummy $deplib_matches
2672 deplib_match=$2
2673 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2674 newdeplibs="$newdeplibs $i"
2675 else
2676 droppeddeps=yes
2677 echo
2678 echo "*** Warning: This library needs some functionality provided by $i."
2679 echo "*** I have the capability to make that library automatically link in when"
2680 echo "*** you link to this library. But I can only do this if you have a"
2681 echo "*** shared version of the library, which you do not appear to have."
2683 else
2684 droppeddeps=yes
2685 echo
2686 echo "*** Warning! Library $i is needed by this library but I was not able to"
2687 echo "*** make it link in! You will probably need to install it or some"
2688 echo "*** library that it depends on before this library will be fully"
2689 echo "*** functional. Installing it before continuing would be even better."
2691 else
2692 newdeplibs="$newdeplibs $i"
2694 done
2697 file_magic*)
2698 set dummy $deplibs_check_method
2699 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2700 for a_deplib in $deplibs; do
2701 name="`expr $a_deplib : '-l\(.*\)'`"
2702 # If $name is empty we are operating on a -L argument.
2703 if test "$name" != "" ; then
2704 libname=`eval \\$echo \"$libname_spec\"`
2705 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2706 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2707 for potent_lib in $potential_libs; do
2708 # Follow soft links.
2709 if ls -lLd "$potent_lib" 2>/dev/null \
2710 | grep " -> " >/dev/null; then
2711 continue
2713 # The statement above tries to avoid entering an
2714 # endless loop below, in case of cyclic links.
2715 # We might still enter an endless loop, since a link
2716 # loop can be closed while we follow links,
2717 # but so what?
2718 potlib="$potent_lib"
2719 while test -h "$potlib" 2>/dev/null; do
2720 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2721 case "$potliblink" in
2722 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2723 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2724 esac
2725 done
2726 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2727 | sed 10q \
2728 | egrep "$file_magic_regex" > /dev/null; then
2729 newdeplibs="$newdeplibs $a_deplib"
2730 a_deplib=""
2731 break 2
2733 done
2734 done
2735 if test -n "$a_deplib" ; then
2736 droppeddeps=yes
2737 echo
2738 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2739 echo "*** I have the capability to make that library automatically link in when"
2740 echo "*** you link to this library. But I can only do this if you have a"
2741 echo "*** shared version of the library, which you do not appear to have."
2743 else
2744 # Add a -L argument.
2745 newdeplibs="$newdeplibs $a_deplib"
2747 done # Gone through all deplibs.
2749 none | unknown | *)
2750 newdeplibs=""
2751 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2752 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2753 grep . >/dev/null; then
2754 echo
2755 if test "X$deplibs_check_method" = "Xnone"; then
2756 echo "*** Warning: inter-library dependencies are not supported in this platform."
2757 else
2758 echo "*** Warning: inter-library dependencies are not known to be supported."
2760 echo "*** All declared inter-library dependencies are being dropped."
2761 droppeddeps=yes
2764 esac
2765 versuffix=$versuffix_save
2766 major=$major_save
2767 release=$release_save
2768 libname=$libname_save
2769 name=$name_save
2771 if test "$droppeddeps" = yes; then
2772 if test "$module" = yes; then
2773 echo
2774 echo "*** Warning: libtool could not satisfy all declared inter-library"
2775 echo "*** dependencies of module $libname. Therefore, libtool will create"
2776 echo "*** a static module, that should work as long as the dlopening"
2777 echo "*** application is linked with the -dlopen flag."
2778 if test -z "$global_symbol_pipe"; then
2779 echo
2780 echo "*** However, this would only work if libtool was able to extract symbol"
2781 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2782 echo "*** not find such a program. So, this module is probably useless."
2783 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2785 if test "$build_old_libs" = no; then
2786 oldlibs="$output_objdir/$libname.$libext"
2787 build_libtool_libs=module
2788 build_old_libs=yes
2789 else
2790 build_libtool_libs=no
2792 else
2793 echo "*** The inter-library dependencies that have been dropped here will be"
2794 echo "*** automatically added whenever a program is linked with this library"
2795 echo "*** or is declared to -dlopen it."
2798 # Done checking deplibs!
2799 deplibs=$newdeplibs
2802 # All the library-specific variables (install_libdir is set above).
2803 library_names=
2804 old_library=
2805 dlname=
2807 # Test again, we may have decided not to build it any more
2808 if test "$build_libtool_libs" = yes; then
2809 if test "$hardcode_into_libs" != no; then
2810 # Hardcode the library paths
2811 hardcode_libdirs=
2812 dep_rpath=
2813 rpath="$finalize_rpath"
2814 test "$mode" != relink && rpath="$compile_rpath$rpath"
2815 for libdir in $rpath; do
2816 if test -n "$hardcode_libdir_flag_spec"; then
2817 if test -n "$hardcode_libdir_separator"; then
2818 if test -z "$hardcode_libdirs"; then
2819 hardcode_libdirs="$libdir"
2820 else
2821 # Just accumulate the unique libdirs.
2822 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
2823 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2826 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2828 esac
2830 else
2831 eval flag=\"$hardcode_libdir_flag_spec\"
2832 dep_rpath="$dep_rpath $flag"
2834 elif test -n "$runpath_var"; then
2835 case "$perm_rpath " in
2836 *" $libdir "*) ;;
2837 *) perm_rpath="$perm_rpath $libdir" ;;
2838 esac
2840 done
2841 # Substitute the hardcoded libdirs into the rpath.
2842 if test -n "$hardcode_libdir_separator" &&
2843 test -n "$hardcode_libdirs"; then
2844 libdir="$hardcode_libdirs"
2845 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2847 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2848 # We should set the runpath_var.
2849 rpath=
2850 for dir in $perm_rpath; do
2851 rpath="$rpath$dir:"
2852 done
2853 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2855 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2858 shlibpath="$finalize_shlibpath"
2859 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2860 if test -n "$shlibpath"; then
2861 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2864 # Get the real and link names of the library.
2865 eval library_names=\"$library_names_spec\"
2866 set dummy $library_names
2867 realname="$2"
2868 shift; shift
2870 if test -n "$soname_spec"; then
2871 eval soname=\"$soname_spec\"
2872 else
2873 soname="$realname"
2876 lib="$output_objdir/$realname"
2877 for link
2879 linknames="$linknames $link"
2880 done
2882 # # Ensure that we have .o objects for linkers which dislike .lo
2883 # # (e.g. aix) in case we are running --disable-static
2884 # for obj in $libobjs; do
2885 # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2886 # if test "X$xdir" = "X$obj"; then
2887 # xdir="."
2888 # else
2889 # xdir="$xdir"
2890 # fi
2891 # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2892 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2893 # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
2894 # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2895 # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2896 # fi
2897 # done
2899 # Use standard objects if they are pic
2900 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2902 # Prepare the list of exported symbols
2903 if test -z "$export_symbols"; then
2904 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2905 $show "generating symbol list for \`$libname.la'"
2906 export_symbols="$output_objdir/$libname.exp"
2907 $run $rm $export_symbols
2908 eval cmds=\"$export_symbols_cmds\"
2909 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2910 for cmd in $cmds; do
2911 IFS="$save_ifs"
2912 $show "$cmd"
2913 $run eval "$cmd" || exit $?
2914 done
2915 IFS="$save_ifs"
2916 if test -n "$export_symbols_regex"; then
2917 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2918 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2919 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2920 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2925 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2926 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2929 if test -n "$convenience"; then
2930 if test -n "$whole_archive_flag_spec"; then
2931 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2932 else
2933 gentop="$output_objdir/${outputname}x"
2934 $show "${rm}r $gentop"
2935 $run ${rm}r "$gentop"
2936 $show "$mkdir $gentop"
2937 $run $mkdir "$gentop"
2938 status=$?
2939 if test $status -ne 0 && test ! -d "$gentop"; then
2940 exit $status
2942 generated="$generated $gentop"
2944 for xlib in $convenience; do
2945 # Extract the objects.
2946 case "$xlib" in
2947 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2948 *) xabs=`pwd`"/$xlib" ;;
2949 esac
2950 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2951 xdir="$gentop/$xlib"
2953 $show "${rm}r $xdir"
2954 $run ${rm}r "$xdir"
2955 $show "$mkdir $xdir"
2956 $run $mkdir "$xdir"
2957 status=$?
2958 if test $status -ne 0 && test ! -d "$xdir"; then
2959 exit $status
2961 $show "(cd $xdir && $AR x $xabs)"
2962 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2964 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2965 done
2969 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2970 eval flag=\"$thread_safe_flag_spec\"
2971 linker_flags="$linker_flags $flag"
2974 # Make a backup of the uninstalled library when relinking
2975 if test "$mode" = relink && test "$hardcode_into_libs" = all; then
2976 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2979 # Do each of the archive commands.
2980 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2981 eval cmds=\"$archive_expsym_cmds\"
2982 else
2983 eval cmds=\"$archive_cmds\"
2985 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2986 for cmd in $cmds; do
2987 IFS="$save_ifs"
2988 $show "$cmd"
2989 $run eval "$cmd" || exit $?
2990 done
2991 IFS="$save_ifs"
2993 # Restore the uninstalled library and exit
2994 if test "$mode" = relink && test "$hardcode_into_libs" = all; then
2995 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2996 exit 0
2999 # Create links to the real library.
3000 for linkname in $linknames; do
3001 if test "$realname" != "$linkname"; then
3002 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3003 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3005 done
3007 # If -module or -export-dynamic was specified, set the dlname.
3008 if test "$module" = yes || test "$export_dynamic" = yes; then
3009 # On all known operating systems, these are identical.
3010 dlname="$soname"
3015 obj)
3016 if test -n "$deplibs"; then
3017 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3020 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3021 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3024 if test -n "$rpath"; then
3025 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3028 if test -n "$xrpath"; then
3029 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3032 if test -n "$vinfo"; then
3033 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3036 if test -n "$release"; then
3037 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3040 case "$output" in
3041 *.lo)
3042 if test -n "$objs$old_deplibs"; then
3043 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3044 exit 1
3046 libobj="$output"
3047 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3050 libobj=
3051 obj="$output"
3053 esac
3055 # Delete the old objects.
3056 $run $rm $obj $libobj
3058 # Objects from convenience libraries. This assumes
3059 # single-version convenience libraries. Whenever we create
3060 # different ones for PIC/non-PIC, this we'll have to duplicate
3061 # the extraction.
3062 reload_conv_objs=
3063 gentop=
3064 # reload_cmds runs $LD directly, so let us get rid of
3065 # -Wl from whole_archive_flag_spec
3068 if test -n "$convenience"; then
3069 if test -n "$whole_archive_flag_spec"; then
3070 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3071 else
3072 gentop="$output_objdir/${obj}x"
3073 $show "${rm}r $gentop"
3074 $run ${rm}r "$gentop"
3075 $show "$mkdir $gentop"
3076 $run $mkdir "$gentop"
3077 status=$?
3078 if test $status -ne 0 && test ! -d "$gentop"; then
3079 exit $status
3081 generated="$generated $gentop"
3083 for xlib in $convenience; do
3084 # Extract the objects.
3085 case "$xlib" in
3086 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3087 *) xabs=`pwd`"/$xlib" ;;
3088 esac
3089 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3090 xdir="$gentop/$xlib"
3092 $show "${rm}r $xdir"
3093 $run ${rm}r "$xdir"
3094 $show "$mkdir $xdir"
3095 $run $mkdir "$xdir"
3096 status=$?
3097 if test $status -ne 0 && test ! -d "$xdir"; then
3098 exit $status
3100 $show "(cd $xdir && $AR x $xabs)"
3101 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3103 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3104 done
3108 # Create the old-style object.
3109 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
3111 output="$obj"
3112 eval cmds=\"$reload_cmds\"
3113 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3114 for cmd in $cmds; do
3115 IFS="$save_ifs"
3116 $show "$cmd"
3117 $run eval "$cmd" || exit $?
3118 done
3119 IFS="$save_ifs"
3121 # Exit if we aren't doing a library object file.
3122 if test -z "$libobj"; then
3123 if test -n "$gentop"; then
3124 $show "${rm}r $gentop"
3125 $run ${rm}r $gentop
3128 exit 0
3131 if test "$build_libtool_libs" != yes; then
3132 if test -n "$gentop"; then
3133 $show "${rm}r $gentop"
3134 $run ${rm}r $gentop
3137 # Create an invalid libtool object if no PIC, so that we don't
3138 # accidentally link it into a program.
3139 # $show "echo timestamp > $libobj"
3140 # $run eval "echo timestamp > $libobj" || exit $?
3141 exit 0
3144 if test -n "$pic_flag" || test "$pic_mode" != default; then
3145 # Only do commands if we really have different PIC objects.
3146 reload_objs="$libobjs $reload_conv_objs"
3147 output="$libobj"
3148 eval cmds=\"$reload_cmds\"
3149 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3150 for cmd in $cmds; do
3151 IFS="$save_ifs"
3152 $show "$cmd"
3153 $run eval "$cmd" || exit $?
3154 done
3155 IFS="$save_ifs"
3156 # else
3157 # # Just create a symlink.
3158 # $show $rm $libobj
3159 # $run $rm $libobj
3160 # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3161 # if test "X$xdir" = "X$libobj"; then
3162 # xdir="."
3163 # else
3164 # xdir="$xdir"
3165 # fi
3166 # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3167 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3168 # $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3169 # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3172 if test -n "$gentop"; then
3173 $show "${rm}r $gentop"
3174 $run ${rm}r $gentop
3177 exit 0
3180 prog)
3181 if test -n "$vinfo"; then
3182 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3185 if test -n "$release"; then
3186 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3189 if test "$preload" = yes; then
3190 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3191 test "$dlopen_self_static" = unknown; then
3192 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3196 compile_command="$compile_command $compile_deplibs"
3197 finalize_command="$finalize_command $finalize_deplibs"
3199 if test -n "$rpath$xrpath"; then
3200 # If the user specified any rpath flags, then add them.
3201 for libdir in $rpath $xrpath; do
3202 # This is the magic to use -rpath.
3203 case "$finalize_rpath " in
3204 *" $libdir "*) ;;
3205 *) finalize_rpath="$finalize_rpath $libdir" ;;
3206 esac
3207 done
3210 # Now hardcode the library paths
3211 rpath=
3212 hardcode_libdirs=
3213 for libdir in $compile_rpath $finalize_rpath; do
3214 if test -n "$hardcode_libdir_flag_spec"; then
3215 if test -n "$hardcode_libdir_separator"; then
3216 if test -z "$hardcode_libdirs"; then
3217 hardcode_libdirs="$libdir"
3218 else
3219 # Just accumulate the unique libdirs.
3220 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
3221 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3224 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3226 esac
3228 else
3229 eval flag=\"$hardcode_libdir_flag_spec\"
3230 rpath="$rpath $flag"
3232 elif test -n "$runpath_var"; then
3233 case "$perm_rpath " in
3234 *" $libdir "*) ;;
3235 *) perm_rpath="$perm_rpath $libdir" ;;
3236 esac
3238 case "$host" in
3239 *-*-cygwin* | *-*-mingw* | *-*-os2*)
3240 case ":$dllsearchpath:" in
3241 *":$libdir:"*) ;;
3242 *) dllsearchpath="$dllsearchpath:$libdir";;
3243 esac
3245 esac
3246 done
3247 # Substitute the hardcoded libdirs into the rpath.
3248 if test -n "$hardcode_libdir_separator" &&
3249 test -n "$hardcode_libdirs"; then
3250 libdir="$hardcode_libdirs"
3251 eval rpath=\" $hardcode_libdir_flag_spec\"
3253 compile_rpath="$rpath"
3255 rpath=
3256 hardcode_libdirs=
3257 for libdir in $finalize_rpath; do
3258 if test -n "$hardcode_libdir_flag_spec"; then
3259 if test -n "$hardcode_libdir_separator"; then
3260 if test -z "$hardcode_libdirs"; then
3261 hardcode_libdirs="$libdir"
3262 else
3263 # Just accumulate the unique libdirs.
3264 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
3265 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3268 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3270 esac
3272 else
3273 eval flag=\"$hardcode_libdir_flag_spec\"
3274 rpath="$rpath $flag"
3276 elif test -n "$runpath_var"; then
3277 case "$finalize_perm_rpath " in
3278 *" $libdir "*) ;;
3279 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3280 esac
3282 done
3283 # Substitute the hardcoded libdirs into the rpath.
3284 if test -n "$hardcode_libdir_separator" &&
3285 test -n "$hardcode_libdirs"; then
3286 libdir="$hardcode_libdirs"
3287 eval rpath=\" $hardcode_libdir_flag_spec\"
3289 finalize_rpath="$rpath"
3291 dlsyms=
3292 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3293 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3294 dlsyms="${outputname}S.c"
3295 else
3296 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3300 if test -n "$dlsyms"; then
3301 case "$dlsyms" in
3302 "") ;;
3303 *.c)
3304 # Discover the nlist of each of the dlfiles.
3305 nlist="$output_objdir/${outputname}.nm"
3307 $show "$rm $nlist ${nlist}S ${nlist}T"
3308 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3310 # Parse the name list into a source file.
3311 $show "creating $output_objdir/$dlsyms"
3313 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3314 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3315 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3317 #ifdef __cplusplus
3318 extern \"C\" {
3319 #endif
3321 /* Prevent the only kind of declaration conflicts we can make. */
3322 #define lt_preloaded_symbols some_other_symbol
3324 /* External symbol declarations for the compiler. */\
3327 if test "$dlself" = yes; then
3328 $show "generating symbol list for \`$output'"
3330 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3332 # Add our own program objects to the symbol list.
3333 progfiles="$objs$old_deplibs"
3334 for arg in $progfiles; do
3335 $show "extracting global C symbols from \`$arg'"
3336 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3337 done
3339 if test -n "$exclude_expsyms"; then
3340 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3341 $run eval '$mv "$nlist"T "$nlist"'
3344 if test -n "$export_symbols_regex"; then
3345 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3346 $run eval '$mv "$nlist"T "$nlist"'
3349 # Prepare the list of exported symbols
3350 if test -z "$export_symbols"; then
3351 export_symbols="$output_objdir/$output.exp"
3352 $run $rm $export_symbols
3353 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3354 else
3355 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3356 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3357 $run eval 'mv "$nlist"T "$nlist"'
3361 for arg in $dlprefiles; do
3362 $show "extracting global C symbols from \`$arg'"
3363 name=`echo "$arg" | sed -e 's%^.*/%%'`
3364 $run eval 'echo ": $name " >> "$nlist"'
3365 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3366 done
3368 if test -z "$run"; then
3369 # Make sure we have at least an empty file.
3370 test -f "$nlist" || : > "$nlist"
3372 if test -n "$exclude_expsyms"; then
3373 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3374 $mv "$nlist"T "$nlist"
3377 # Try sorting and uniquifying the output.
3378 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3380 else
3381 grep -v "^: " < "$nlist" > "$nlist"S
3384 if test -f "$nlist"S; then
3385 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3386 else
3387 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3390 $echo >> "$output_objdir/$dlsyms" "\
3392 #undef lt_preloaded_symbols
3394 #if defined (__STDC__) && __STDC__
3395 # define lt_ptr_t void *
3396 #else
3397 # define lt_ptr_t char *
3398 # define const
3399 #endif
3401 /* The mapping between symbol names and symbols. */
3402 const struct {
3403 const char *name;
3404 lt_ptr_t address;
3406 lt_preloaded_symbols[] =
3410 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3411 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3412 < "$nlist" >> "$output_objdir/$dlsyms"
3414 $echo >> "$output_objdir/$dlsyms" "\
3415 {0, (lt_ptr_t) 0}
3418 /* This works around a problem in FreeBSD linker */
3419 #ifdef FREEBSD_WORKAROUND
3420 static const void *lt_preloaded_setup() {
3421 return lt_preloaded_symbols;
3423 #endif
3425 #ifdef __cplusplus
3427 #endif\
3431 pic_flag_for_symtable=
3432 case "$host" in
3433 # compiling the symbol table file with pic_flag works around
3434 # a FreeBSD bug that causes programs to crash when -lm is
3435 # linked before any other PIC object. But we must not use
3436 # pic_flag when linking with -static. The problem exists in
3437 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3438 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3439 case "$compile_command " in
3440 *" -static "*) ;;
3441 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3442 esac;;
3443 *-*-hpux*)
3444 case "$compile_command " in
3445 *" -static "*) ;;
3446 *) pic_flag_for_symtable=" $pic_flag";;
3447 esac
3448 esac
3450 # Now compile the dynamic symbol file.
3451 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3452 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3454 # Clean up the generated files.
3455 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3456 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3458 # Transform the symbol file into the correct name.
3459 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3460 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3463 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3464 exit 1
3466 esac
3467 else
3468 # We keep going just in case the user didn't refer to
3469 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3470 # really was required.
3472 # Nullify the symbol file.
3473 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3474 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3477 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3478 # Replace the output file specification.
3479 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3480 link_command="$compile_command$compile_rpath"
3482 # We have no uninstalled library dependencies, so finalize right now.
3483 $show "$link_command"
3484 $run eval "$link_command"
3485 status=$?
3487 # Delete the generated files.
3488 if test -n "$dlsyms"; then
3489 $show "$rm $output_objdir/${outputname}S.${objext}"
3490 $run $rm "$output_objdir/${outputname}S.${objext}"
3493 exit $status
3496 if test -n "$shlibpath_var"; then
3497 # We should set the shlibpath_var
3498 rpath=
3499 for dir in $temp_rpath; do
3500 case "$dir" in
3501 [\\/]* | [A-Za-z]:[\\/]*)
3502 # Absolute path.
3503 rpath="$rpath$dir:"
3506 # Relative path: add a thisdir entry.
3507 rpath="$rpath\$thisdir/$dir:"
3509 esac
3510 done
3511 temp_rpath="$rpath"
3514 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3515 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3517 if test -n "$finalize_shlibpath"; then
3518 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3521 compile_var=
3522 finalize_var=
3523 if test -n "$runpath_var"; then
3524 if test -n "$perm_rpath"; then
3525 # We should set the runpath_var.
3526 rpath=
3527 for dir in $perm_rpath; do
3528 rpath="$rpath$dir:"
3529 done
3530 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3532 if test -n "$finalize_perm_rpath"; then
3533 # We should set the runpath_var.
3534 rpath=
3535 for dir in $finalize_perm_rpath; do
3536 rpath="$rpath$dir:"
3537 done
3538 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3542 if test "$no_install" = yes; then
3543 # We don't need to create a wrapper script.
3544 link_command="$compile_var$compile_command$compile_rpath"
3545 # Replace the output file specification.
3546 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3547 # Delete the old output file.
3548 $run $rm $output
3549 # Link the executable and exit
3550 $show "$link_command"
3551 $run eval "$link_command" || exit $?
3552 exit 0
3555 if test "$hardcode_action" = relink || test "$hardcode_into_libs" = all; then
3556 # Fast installation is not supported
3557 link_command="$compile_var$compile_command$compile_rpath"
3558 relink_command="$finalize_var$finalize_command$finalize_rpath"
3560 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3561 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3562 else
3563 if test "$fast_install" != no; then
3564 link_command="$finalize_var$compile_command$finalize_rpath"
3565 if test "$fast_install" = yes; then
3566 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3567 else
3568 # fast_install is set to needless
3569 relink_command=
3571 else
3572 link_command="$compile_var$compile_command$compile_rpath"
3573 relink_command="$finalize_var$finalize_command$finalize_rpath"
3577 # Replace the output file specification.
3578 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3580 # Delete the old output files.
3581 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3583 $show "$link_command"
3584 $run eval "$link_command" || exit $?
3586 # Now create the wrapper script.
3587 $show "creating $output"
3589 # Quote the relink command for shipping.
3590 if test -n "$relink_command"; then
3591 # Preserve any variables that may affect compiler behavior
3592 for var in $variables_saved_for_relink; do
3593 eval var_value=\$$var
3594 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3595 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3596 done
3597 relink_command="cd `pwd`; $relink_command"
3598 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3601 # Quote $echo for shipping.
3602 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3603 case "$0" in
3604 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3605 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3606 esac
3607 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3608 else
3609 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3612 # Only actually do things if our run command is non-null.
3613 if test -z "$run"; then
3614 # win32 will think the script is a binary if it has
3615 # a .exe suffix, so we strip it off here.
3616 case $output in
3617 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3618 esac
3619 $rm $output
3620 trap "$rm $output; exit 1" 1 2 15
3622 $echo > $output "\
3623 #! $SHELL
3625 # $output - temporary wrapper script for $objdir/$outputname
3626 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3628 # The $output program cannot be directly executed until all the libtool
3629 # libraries that it depends on are installed.
3631 # This wrapper script should never be moved out of the build directory.
3632 # If it is, it will not operate correctly.
3634 # Sed substitution that helps us do robust quoting. It backslashifies
3635 # metacharacters that are still active within double-quoted strings.
3636 Xsed='sed -e 1s/^X//'
3637 sed_quote_subst='$sed_quote_subst'
3639 # The HP-UX ksh and POSIX shell print the target directory to stdout
3640 # if CDPATH is set.
3641 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3643 relink_command=\"$relink_command\"
3645 # This environment variable determines our operation mode.
3646 if test \"\$libtool_install_magic\" = \"$magic\"; then
3647 # install mode needs the following variable:
3648 uninst_deplibs='$uninst_deplibs'
3649 else
3650 # When we are sourced in execute mode, \$file and \$echo are already set.
3651 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3652 echo=\"$qecho\"
3653 file=\"\$0\"
3654 # Make sure echo works.
3655 if test \"X\$1\" = X--no-reexec; then
3656 # Discard the --no-reexec flag, and continue.
3657 shift
3658 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3659 # Yippee, \$echo works!
3661 else
3662 # Restart under the correct shell, and then maybe \$echo will work.
3663 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3667 $echo >> $output "\
3669 # Find the directory that this script lives in.
3670 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3671 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3673 # Follow symbolic links until we get to the real thisdir.
3674 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3675 while test -n \"\$file\"; do
3676 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3678 # If there was a directory component, then change thisdir.
3679 if test \"x\$destdir\" != \"x\$file\"; then
3680 case \"\$destdir\" in
3681 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3682 *) thisdir=\"\$thisdir/\$destdir\" ;;
3683 esac
3686 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3687 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3688 done
3690 # Try to get the absolute directory name.
3691 absdir=\`cd \"\$thisdir\" && pwd\`
3692 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3695 if test "$fast_install" = yes; then
3696 echo >> $output "\
3697 program=lt-'$outputname'
3698 progdir=\"\$thisdir/$objdir\"
3700 if test ! -f \"\$progdir/\$program\" || \\
3701 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3702 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3704 file=\"\$\$-\$program\"
3706 if test ! -d \"\$progdir\"; then
3707 $mkdir \"\$progdir\"
3708 else
3709 $rm \"\$progdir/\$file\"
3712 echo >> $output "\
3714 # relink executable if necessary
3715 if test -n \"\$relink_command\"; then
3716 if (eval \$relink_command); then :
3717 else
3718 $rm \"\$progdir/\$file\"
3719 exit 1
3723 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3724 { $rm \"\$progdir/\$program\";
3725 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3726 $rm \"\$progdir/\$file\"
3728 else
3729 echo >> $output "\
3730 program='$outputname'
3731 progdir=\"\$thisdir/$objdir\"
3735 echo >> $output "\
3737 if test -f \"\$progdir/\$program\"; then"
3739 # Export our shlibpath_var if we have one.
3740 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3741 $echo >> $output "\
3742 # Add our own library path to $shlibpath_var
3743 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3745 # Some systems cannot cope with colon-terminated $shlibpath_var
3746 # The second colon is a workaround for a bug in BeOS R4 sed
3747 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3749 export $shlibpath_var
3753 # fixup the dll searchpath if we need to.
3754 if test -n "$dllsearchpath"; then
3755 $echo >> $output "\
3756 # Add the dll search path components to the executable PATH
3757 PATH=$dllsearchpath:\$PATH
3761 $echo >> $output "\
3762 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3763 # Run the actual program with our arguments.
3765 case $host in
3766 # win32 systems need to use the prog path for dll
3767 # lookup to work
3768 *-*-cygwin*)
3769 $echo >> $output "\
3770 exec \$progdir/\$program \${1+\"\$@\"}
3774 # Backslashes separate directories on plain windows
3775 *-*-mingw | *-*-os2*)
3776 $echo >> $output "\
3777 exec \$progdir\\\\\$program \${1+\"\$@\"}
3782 $echo >> $output "\
3783 # Export the path to the program.
3784 PATH=\"\$progdir:\$PATH\"
3785 export PATH
3787 exec \$program \${1+\"\$@\"}
3790 esac
3791 $echo >> $output "\
3792 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3793 exit 1
3795 else
3796 # The program doesn't exist.
3797 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3798 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3799 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3800 exit 1
3804 chmod +x $output
3806 exit 0
3808 esac
3810 # See if we need to build an old-fashioned archive.
3811 for oldlib in $oldlibs; do
3813 if test "$build_libtool_libs" = convenience; then
3814 oldobjs="$libobjs_save"
3815 addlibs="$convenience"
3816 build_libtool_libs=no
3817 else
3818 if test "$build_libtool_libs" = module; then
3819 oldobjs="$libobjs_save"
3820 build_libtool_libs=no
3821 else
3822 oldobjs="$objs$old_deplibs $non_pic_objects"
3824 addlibs="$old_convenience"
3827 if test -n "$addlibs"; then
3828 gentop="$output_objdir/${outputname}x"
3829 $show "${rm}r $gentop"
3830 $run ${rm}r "$gentop"
3831 $show "$mkdir $gentop"
3832 $run $mkdir "$gentop"
3833 status=$?
3834 if test $status -ne 0 && test ! -d "$gentop"; then
3835 exit $status
3837 generated="$generated $gentop"
3839 # Add in members from convenience archives.
3840 for xlib in $addlibs; do
3841 # Extract the objects.
3842 case "$xlib" in
3843 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3844 *) xabs=`pwd`"/$xlib" ;;
3845 esac
3846 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3847 xdir="$gentop/$xlib"
3849 $show "${rm}r $xdir"
3850 $run ${rm}r "$xdir"
3851 $show "$mkdir $xdir"
3852 $run $mkdir "$xdir"
3853 status=$?
3854 if test $status -ne 0 && test ! -d "$xdir"; then
3855 exit $status
3857 $show "(cd $xdir && $AR x $xabs)"
3858 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3860 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
3861 done
3864 # Do each command in the archive commands.
3865 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3866 eval cmds=\"$old_archive_from_new_cmds\"
3867 else
3868 # # Ensure that we have .o objects in place in case we decided
3869 # # not to build a shared library, and have fallen back to building
3870 # # static libs even though --disable-static was passed!
3871 # for oldobj in $oldobjs; do
3872 # if test ! -f $oldobj; then
3873 # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3874 # if test "X$xdir" = "X$oldobj"; then
3875 # xdir="."
3876 # else
3877 # xdir="$xdir"
3878 # fi
3879 # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3880 # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3881 # $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3882 # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3883 # fi
3884 # done
3886 eval cmds=\"$old_archive_cmds\"
3888 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3889 for cmd in $cmds; do
3890 IFS="$save_ifs"
3891 $show "$cmd"
3892 $run eval "$cmd" || exit $?
3893 done
3894 IFS="$save_ifs"
3895 done
3897 if test -n "$generated"; then
3898 $show "${rm}r$generated"
3899 $run ${rm}r$generated
3902 # Now create the libtool archive.
3903 case "$output" in
3904 *.la)
3905 old_library=
3906 test "$build_old_libs" = yes && old_library="$libname.$libext"
3907 $show "creating $output"
3909 # Preserve any variables that may affect compiler behavior
3910 for var in $variables_saved_for_relink; do
3911 eval var_value=\$$var
3912 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3913 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3914 done
3915 # Quote the link command for shipping.
3916 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3917 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3919 # Only create the output if not a dry run.
3920 if test -z "$run"; then
3921 for installed in no yes; do
3922 if test "$installed" = yes; then
3923 if test -z "$install_libdir"; then
3924 break
3926 output="$output_objdir/$outputname"i
3927 # Replace all uninstalled libtool libraries with the installed ones
3928 newdependency_libs=
3929 for deplib in $dependency_libs; do
3930 case "$deplib" in
3931 *.la)
3932 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3933 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3934 if test -z "$libdir"; then
3935 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3936 exit 1
3938 newdependency_libs="$newdependency_libs $libdir/$name"
3940 *) newdependency_libs="$newdependency_libs $deplib" ;;
3941 esac
3942 done
3943 dependency_libs="$newdependency_libs"
3944 newdlfiles=
3945 for lib in $dlfiles; do
3946 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3947 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3948 if test -z "$libdir"; then
3949 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3950 exit 1
3952 newdlfiles="$newdlfiles $libdir/$name"
3953 done
3954 dlfiles="$newdlfiles"
3955 newdlprefiles=
3956 for lib in $dlprefiles; do
3957 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3958 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3959 if test -z "$libdir"; then
3960 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3961 exit 1
3963 newdlprefiles="$newdlprefiles $libdir/$name"
3964 done
3965 dlprefiles="$newdlprefiles"
3967 $rm $output
3968 $echo > $output "\
3969 # $outputname - a libtool library file
3970 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3972 # Please DO NOT delete this file!
3973 # It is necessary for linking the library.
3975 # The name that we can dlopen(3).
3976 dlname='$dlname'
3978 # Names of this library.
3979 library_names='$library_names'
3981 # The name of the static archive.
3982 old_library='$old_library'
3984 # Libraries that this one depends upon.
3985 dependency_libs='$dependency_libs'
3987 # Version information for $libname.
3988 current=$current
3989 age=$age
3990 revision=$revision
3992 # Is this an already installed library?
3993 installed=$installed
3995 # Files to dlopen/dlpreopen
3996 dlopen='$dlfiles'
3997 dlpreopen='$dlprefiles'
3999 # Directory that this library needs to be installed in:
4000 libdir='$install_libdir'"
4001 if test $hardcode_into_libs = all &&
4002 test "$installed" = no && test $need_relink = yes; then
4003 $echo >> $output "\
4004 relink_command=\"$relink_command\""
4006 done
4009 # Do a symbolic link so that the libtool archive can be found in
4010 # LD_LIBRARY_PATH before the program is installed.
4011 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4012 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4014 esac
4015 exit 0
4018 # libtool install mode
4019 install)
4020 modename="$modename: install"
4022 # There may be an optional sh(1) argument at the beginning of
4023 # install_prog (especially on Windows NT).
4024 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4025 # Allow the use of GNU shtool's install command.
4026 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4027 # Aesthetically quote it.
4028 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4029 case "$arg" in
4030 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4031 arg="\"$arg\""
4033 esac
4034 install_prog="$arg "
4035 arg="$1"
4036 shift
4037 else
4038 install_prog=
4039 arg="$nonopt"
4042 # The real first argument should be the name of the installation program.
4043 # Aesthetically quote it.
4044 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4045 case "$arg" in
4046 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4047 arg="\"$arg\""
4049 esac
4050 install_prog="$install_prog$arg"
4052 # We need to accept at least all the BSD install flags.
4053 dest=
4054 files=
4055 opts=
4056 prev=
4057 install_type=
4058 isdir=no
4059 stripme=
4060 for arg
4062 if test -n "$dest"; then
4063 files="$files $dest"
4064 dest="$arg"
4065 continue
4068 case "$arg" in
4069 -d) isdir=yes ;;
4070 -f) prev="-f" ;;
4071 -g) prev="-g" ;;
4072 -m) prev="-m" ;;
4073 -o) prev="-o" ;;
4075 stripme=" -s"
4076 continue
4078 -*) ;;
4081 # If the previous option needed an argument, then skip it.
4082 if test -n "$prev"; then
4083 prev=
4084 else
4085 dest="$arg"
4086 continue
4089 esac
4091 # Aesthetically quote the argument.
4092 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4093 case "$arg" in
4094 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4095 arg="\"$arg\""
4097 esac
4098 install_prog="$install_prog $arg"
4099 done
4101 if test -z "$install_prog"; then
4102 $echo "$modename: you must specify an install program" 1>&2
4103 $echo "$help" 1>&2
4104 exit 1
4107 if test -n "$prev"; then
4108 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4109 $echo "$help" 1>&2
4110 exit 1
4113 if test -z "$files"; then
4114 if test -z "$dest"; then
4115 $echo "$modename: no file or destination specified" 1>&2
4116 else
4117 $echo "$modename: you must specify a destination" 1>&2
4119 $echo "$help" 1>&2
4120 exit 1
4123 # Strip any trailing slash from the destination.
4124 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4126 # Check to see that the destination is a directory.
4127 test -d "$dest" && isdir=yes
4128 if test "$isdir" = yes; then
4129 destdir="$dest"
4130 destname=
4131 else
4132 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4133 test "X$destdir" = "X$dest" && destdir=.
4134 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4136 # Not a directory, so check to see that there is only one file specified.
4137 set dummy $files
4138 if test $# -gt 2; then
4139 $echo "$modename: \`$dest' is not a directory" 1>&2
4140 $echo "$help" 1>&2
4141 exit 1
4144 case "$destdir" in
4145 [\\/]* | [A-Za-z]:[\\/]*) ;;
4147 for file in $files; do
4148 case "$file" in
4149 *.lo) ;;
4151 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4152 $echo "$help" 1>&2
4153 exit 1
4155 esac
4156 done
4158 esac
4160 # This variable tells wrapper scripts just to set variables rather
4161 # than running their programs.
4162 libtool_install_magic="$magic"
4164 staticlibs=
4165 future_libdirs=
4166 current_libdirs=
4167 for file in $files; do
4169 # Do each installation.
4170 case "$file" in
4171 *.$libext)
4172 # Do the static libraries later.
4173 staticlibs="$staticlibs $file"
4176 *.la)
4177 # Check to see that this really is a libtool archive.
4178 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4179 else
4180 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4181 $echo "$help" 1>&2
4182 exit 1
4185 library_names=
4186 old_library=
4187 relink_command=
4188 # If there is no directory component, then add one.
4189 case "$file" in
4190 */* | *\\*) . $file ;;
4191 *) . ./$file ;;
4192 esac
4194 # Add the libdir to current_libdirs if it is the destination.
4195 if test "X$destdir" = "X$libdir"; then
4196 case "$current_libdirs " in
4197 *" $libdir "*) ;;
4198 *) current_libdirs="$current_libdirs $libdir" ;;
4199 esac
4200 else
4201 # Note the libdir as a future libdir.
4202 case "$future_libdirs " in
4203 *" $libdir "*) ;;
4204 *) future_libdirs="$future_libdirs $libdir" ;;
4205 esac
4208 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4209 test "X$dir" = "X$file/" && dir=
4210 dir="$dir$objdir"
4212 if test "$hardcode_into_libs" = all && test -n "$relink_command"; then
4213 $echo "$modename: warning: relinking \`$file'" 1>&2
4214 $show "$relink_command"
4215 if $run eval "$relink_command"; then :
4216 else
4217 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4218 continue
4222 # See the names of the shared library.
4223 set dummy $library_names
4224 if test -n "$2"; then
4225 realname="$2"
4226 shift
4227 shift
4229 srcname="$realname"
4230 test "$hardcode_into_libs" = all && test -n "$relink_command" && srcname="$realname"T
4232 # Install the shared library and build the symlinks.
4233 $show "$install_prog $dir/$srcname $destdir/$realname"
4234 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4235 if test -n "$stripme" && test -n "$striplib"; then
4236 $show "$striplib $destdir/$realname"
4237 $run eval "$striplib $destdir/$realname" || exit $?
4240 if test $# -gt 0; then
4241 # Delete the old symlinks, and create new ones.
4242 for linkname
4244 if test "$linkname" != "$realname"; then
4245 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4246 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4248 done
4251 # Do each command in the postinstall commands.
4252 lib="$destdir/$realname"
4253 eval cmds=\"$postinstall_cmds\"
4254 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4255 for cmd in $cmds; do
4256 IFS="$save_ifs"
4257 $show "$cmd"
4258 $run eval "$cmd" || exit $?
4259 done
4260 IFS="$save_ifs"
4263 # Install the pseudo-library for information purposes.
4264 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4265 instname="$dir/$name"i
4266 $show "$install_prog $instname $destdir/$name"
4267 $run eval "$install_prog $instname $destdir/$name" || exit $?
4269 # Maybe install the static library, too.
4270 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4273 *.lo)
4274 # Install (i.e. copy) a libtool object.
4276 # Figure out destination file name, if it wasn't already specified.
4277 if test -n "$destname"; then
4278 destfile="$destdir/$destname"
4279 else
4280 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4281 destfile="$destdir/$destfile"
4284 # Deduce the name of the destination old-style object file.
4285 case "$destfile" in
4286 *.lo)
4287 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4289 *.$objext)
4290 staticdest="$destfile"
4291 destfile=
4294 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4295 $echo "$help" 1>&2
4296 exit 1
4298 esac
4300 # Install the libtool object if requested.
4301 if test -n "$destfile"; then
4302 $show "$install_prog $file $destfile"
4303 $run eval "$install_prog $file $destfile" || exit $?
4306 # Install the old object if enabled.
4307 if test "$build_old_libs" = yes; then
4308 # Deduce the name of the old-style object file.
4309 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4311 $show "$install_prog $staticobj $staticdest"
4312 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4314 exit 0
4318 # Figure out destination file name, if it wasn't already specified.
4319 if test -n "$destname"; then
4320 destfile="$destdir/$destname"
4321 else
4322 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4323 destfile="$destdir/$destfile"
4326 # Do a test to see if this is really a libtool program.
4327 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4328 uninst_deplibs=
4329 relink_command=
4331 # If there is no directory component, then add one.
4332 case "$file" in
4333 */* | *\\*) . $file ;;
4334 *) . ./$file ;;
4335 esac
4337 # Check the variables that should have been set.
4338 if test -z "$uninst_deplibs"; then
4339 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4340 exit 1
4343 finalize=yes
4344 for lib in $uninst_deplibs; do
4345 # Check to see that each library is installed.
4346 libdir=
4347 if test -f "$lib"; then
4348 # If there is no directory component, then add one.
4349 case "$lib" in
4350 */* | *\\*) . $lib ;;
4351 *) . ./$lib ;;
4352 esac
4354 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4355 if test -n "$libdir" && test ! -f "$libfile"; then
4356 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4357 finalize=no
4359 done
4361 relink_command=
4362 # If there is no directory component, then add one.
4363 case "$file" in
4364 */* | *\\*) . $file ;;
4365 *) . ./$file ;;
4366 esac
4368 outputname=
4369 if test "$fast_install" = no && test -n "$relink_command"; then
4370 if test "$finalize" = yes && test -z "$run"; then
4371 tmpdir="/tmp"
4372 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4373 tmpdir="$tmpdir/libtool-$$"
4374 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4375 else
4376 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4377 continue
4379 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4380 outputname="$tmpdir/$file"
4381 # Replace the output file specification.
4382 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4384 $show "$relink_command"
4385 if $run eval "$relink_command"; then :
4386 else
4387 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4388 ${rm}r "$tmpdir"
4389 continue
4391 file="$outputname"
4392 else
4393 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4395 else
4396 # Install the binary that we compiled earlier.
4397 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4401 $show "$install_prog$stripme $file $destfile"
4402 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4403 test -n "$outputname" && ${rm}r "$tmpdir"
4405 esac
4406 done
4408 for file in $staticlibs; do
4409 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4411 # Set up the ranlib parameters.
4412 oldlib="$destdir/$name"
4414 $show "$install_prog $file $oldlib"
4415 $run eval "$install_prog \$file \$oldlib" || exit $?
4417 if test -n "$stripme" && test -n "$striplib"; then
4418 $show "$old_striplib $oldlib"
4419 $run eval "$old_striplib $oldlib" || exit $?
4422 # Do each command in the postinstall commands.
4423 eval cmds=\"$old_postinstall_cmds\"
4424 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4425 for cmd in $cmds; do
4426 IFS="$save_ifs"
4427 $show "$cmd"
4428 $run eval "$cmd" || exit $?
4429 done
4430 IFS="$save_ifs"
4431 done
4433 if test -n "$future_libdirs"; then
4434 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4437 if test -n "$current_libdirs"; then
4438 # Maybe just do a dry run.
4439 test -n "$run" && current_libdirs=" -n$current_libdirs"
4440 exec $SHELL $0 --finish$current_libdirs
4441 exit 1
4444 exit 0
4447 # libtool finish mode
4448 finish)
4449 modename="$modename: finish"
4450 libdirs="$nonopt"
4451 admincmds=
4453 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4454 for dir
4456 libdirs="$libdirs $dir"
4457 done
4459 for libdir in $libdirs; do
4460 if test -n "$finish_cmds"; then
4461 # Do each command in the finish commands.
4462 eval cmds=\"$finish_cmds\"
4463 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4464 for cmd in $cmds; do
4465 IFS="$save_ifs"
4466 $show "$cmd"
4467 $run eval "$cmd" || admincmds="$admincmds
4468 $cmd"
4469 done
4470 IFS="$save_ifs"
4472 if test -n "$finish_eval"; then
4473 # Do the single finish_eval.
4474 eval cmds=\"$finish_eval\"
4475 $run eval "$cmds" || admincmds="$admincmds
4476 $cmds"
4478 done
4481 # Exit here if they wanted silent mode.
4482 test "$show" = : && exit 0
4484 echo "----------------------------------------------------------------------"
4485 echo "Libraries have been installed in:"
4486 for libdir in $libdirs; do
4487 echo " $libdir"
4488 done
4489 echo
4490 echo "If you ever happen to want to link against installed libraries"
4491 echo "in a given directory, LIBDIR, you must either use libtool, and"
4492 echo "specify the full pathname of the library, or use \`-LLIBDIR'"
4493 echo "flag during linking and do at least one of the following:"
4494 if test -n "$shlibpath_var"; then
4495 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4496 echo " during execution"
4498 if test -n "$runpath_var"; then
4499 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4500 echo " during linking"
4502 if test -n "$hardcode_libdir_flag_spec"; then
4503 libdir=LIBDIR
4504 eval flag=\"$hardcode_libdir_flag_spec\"
4506 echo " - use the \`$flag' linker flag"
4508 if test -n "$admincmds"; then
4509 echo " - have your system administrator run these commands:$admincmds"
4511 if test -f /etc/ld.so.conf; then
4512 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4514 echo
4515 echo "See any operating system documentation about shared libraries for"
4516 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4517 echo "----------------------------------------------------------------------"
4518 exit 0
4521 # libtool execute mode
4522 execute)
4523 modename="$modename: execute"
4525 # The first argument is the command name.
4526 cmd="$nonopt"
4527 if test -z "$cmd"; then
4528 $echo "$modename: you must specify a COMMAND" 1>&2
4529 $echo "$help"
4530 exit 1
4533 # Handle -dlopen flags immediately.
4534 for file in $execute_dlfiles; do
4535 if test ! -f "$file"; then
4536 $echo "$modename: \`$file' is not a file" 1>&2
4537 $echo "$help" 1>&2
4538 exit 1
4541 dir=
4542 case "$file" in
4543 *.la)
4544 # Check to see that this really is a libtool archive.
4545 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4546 else
4547 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4548 $echo "$help" 1>&2
4549 exit 1
4552 # Read the libtool library.
4553 dlname=
4554 library_names=
4556 # If there is no directory component, then add one.
4557 case "$file" in
4558 */* | *\\*) . $file ;;
4559 *) . ./$file ;;
4560 esac
4562 # Skip this library if it cannot be dlopened.
4563 if test -z "$dlname"; then
4564 # Warn if it was a shared library.
4565 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4566 continue
4569 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4570 test "X$dir" = "X$file" && dir=.
4572 if test -f "$dir/$objdir/$dlname"; then
4573 dir="$dir/$objdir"
4574 else
4575 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4576 exit 1
4580 *.lo)
4581 # Just add the directory containing the .lo file.
4582 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4583 test "X$dir" = "X$file" && dir=.
4587 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4588 continue
4590 esac
4592 # Get the absolute pathname.
4593 absdir=`cd "$dir" && pwd`
4594 test -n "$absdir" && dir="$absdir"
4596 # Now add the directory to shlibpath_var.
4597 if eval "test -z \"\$$shlibpath_var\""; then
4598 eval "$shlibpath_var=\"\$dir\""
4599 else
4600 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4602 done
4604 # This variable tells wrapper scripts just to set shlibpath_var
4605 # rather than running their programs.
4606 libtool_execute_magic="$magic"
4608 # Check if any of the arguments is a wrapper script.
4609 args=
4610 for file
4612 case "$file" in
4613 -*) ;;
4615 # Do a test to see if this is really a libtool program.
4616 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4617 # If there is no directory component, then add one.
4618 case "$file" in
4619 */* | *\\*) . $file ;;
4620 *) . ./$file ;;
4621 esac
4623 # Transform arg to wrapped name.
4624 file="$progdir/$program"
4627 esac
4628 # Quote arguments (to preserve shell metacharacters).
4629 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4630 args="$args \"$file\""
4631 done
4633 if test -z "$run"; then
4634 if test -n "$shlibpath_var"; then
4635 # Export the shlibpath_var.
4636 eval "export $shlibpath_var"
4639 # Restore saved enviroment variables
4640 if test "${save_LC_ALL+set}" = set; then
4641 LC_ALL="$save_LC_ALL"; export LC_ALL
4643 if test "${save_LANG+set}" = set; then
4644 LANG="$save_LANG"; export LANG
4647 # Now actually exec the command.
4648 eval "exec \$cmd$args"
4650 $echo "$modename: cannot exec \$cmd$args"
4651 exit 1
4652 else
4653 # Display what would be done.
4654 if test -n "$shlibpath_var"; then
4655 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4656 $echo "export $shlibpath_var"
4658 $echo "$cmd$args"
4659 exit 0
4663 # libtool clean and uninstall mode
4664 clean | uninstall)
4665 modename="$modename: $mode"
4666 rm="$nonopt"
4667 files=
4669 # This variable tells wrapper scripts just to set variables rather
4670 # than running their programs.
4671 libtool_install_magic="$magic"
4673 for arg
4675 case "$arg" in
4676 -*) rm="$rm $arg" ;;
4677 *) files="$files $arg" ;;
4678 esac
4679 done
4681 if test -z "$rm"; then
4682 $echo "$modename: you must specify an RM program" 1>&2
4683 $echo "$help" 1>&2
4684 exit 1
4687 for file in $files; do
4688 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4689 if test "X$dir" = "X$file"; then
4690 dir=.
4691 objdir="$objdir"
4692 else
4693 objdir="$dir/$objdir"
4695 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4696 test $mode = uninstall && objdir="$dir"
4698 rmfiles="$file"
4700 case "$name" in
4701 *.la)
4702 # Possibly a libtool archive, so verify it.
4703 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4704 . $dir/$name
4706 # Delete the libtool libraries and symlinks.
4707 for n in $library_names; do
4708 rmfiles="$rmfiles $objdir/$n"
4709 done
4710 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4711 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4713 if test $mode = uninstall; then
4714 if test -n "$library_names"; then
4715 # Do each command in the postuninstall commands.
4716 eval cmds=\"$postuninstall_cmds\"
4717 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4718 for cmd in $cmds; do
4719 IFS="$save_ifs"
4720 $show "$cmd"
4721 $run eval "$cmd"
4722 done
4723 IFS="$save_ifs"
4726 if test -n "$old_library"; then
4727 # Do each command in the old_postuninstall commands.
4728 eval cmds=\"$old_postuninstall_cmds\"
4729 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4730 for cmd in $cmds; do
4731 IFS="$save_ifs"
4732 $show "$cmd"
4733 $run eval "$cmd"
4734 done
4735 IFS="$save_ifs"
4737 # FIXME: should reinstall the best remaining shared library.
4742 *.lo)
4743 # Possibly a libtool object, so verify it.
4744 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4746 # Read the .lo file
4747 . ./$file
4749 # Add PIC object to the list of files to remove.
4750 if test -n "$pic_object" \
4751 && test "$pic_object" != none; then
4752 rmfiles="$rmfiles $dir/$pic_object"
4755 # Add non-PIC object to the list of files to remove.
4756 if test -n "$non_pic_object" \
4757 && test "$non_pic_object" != none; then
4758 rmfiles="$rmfiles $dir/$non_pic_object"
4764 # Do a test to see if this is a libtool program.
4765 if test $mode = clean &&
4766 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4767 relink_command=
4768 . $dir/$file
4770 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4771 if test "$fast_install" = yes && test -n "$relink_command"; then
4772 rmfiles="$rmfiles $objdir/lt-$name"
4776 esac
4777 $show "$rm $rmfiles"
4778 $run $rm $rmfiles
4779 done
4780 exit 0
4784 $echo "$modename: you must specify a MODE" 1>&2
4785 $echo "$generic_help" 1>&2
4786 exit 1
4788 esac
4790 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4791 $echo "$generic_help" 1>&2
4792 exit 1
4793 fi # test -z "$show_help"
4795 # We need to display help for each of the modes.
4796 case "$mode" in
4797 "") $echo \
4798 "Usage: $modename [OPTION]... [MODE-ARG]...
4800 Provide generalized library-building support services.
4802 --config show all configuration variables
4803 --debug enable verbose shell tracing
4804 -n, --dry-run display commands without modifying any files
4805 --features display basic configuration information and exit
4806 --finish same as \`--mode=finish'
4807 --help display this help message and exit
4808 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4809 --quiet same as \`--silent'
4810 --silent don't print informational messages
4811 --tag=TAG use configuration variables from tag TAG
4812 --version print version information
4814 MODE must be one of the following:
4816 clean remove files from the build directory
4817 compile compile a source file into a libtool object
4818 execute automatically set library path, then run a program
4819 finish complete the installation of libtool libraries
4820 install install libraries or executables
4821 link create a library or an executable
4822 uninstall remove libraries from an installed directory
4824 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4825 a more detailed description of MODE."
4826 exit 0
4829 clean)
4830 $echo \
4831 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4833 Remove files from the build directory.
4835 RM is the name of the program to use to delete files associated with each FILE
4836 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4837 to RM.
4839 If FILE is a libtool library, object or program, all the files associated
4840 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4843 compile)
4844 $echo \
4845 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4847 Compile a source file into a libtool library object.
4849 This mode accepts the following additional options:
4851 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4852 -static always build a \`.o' file suitable for static linking
4854 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4855 from the given SOURCEFILE.
4857 The output file name is determined by removing the directory component from
4858 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4859 library object suffix, \`.lo'."
4862 execute)
4863 $echo \
4864 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4866 Automatically set library path, then run a program.
4868 This mode accepts the following additional options:
4870 -dlopen FILE add the directory containing FILE to the library path
4872 This mode sets the library path environment variable according to \`-dlopen'
4873 flags.
4875 If any of the ARGS are libtool executable wrappers, then they are translated
4876 into their corresponding uninstalled binary, and any of their required library
4877 directories are added to the library path.
4879 Then, COMMAND is executed, with ARGS as arguments."
4882 finish)
4883 $echo \
4884 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4886 Complete the installation of libtool libraries.
4888 Each LIBDIR is a directory that contains libtool libraries.
4890 The commands that this mode executes may require superuser privileges. Use
4891 the \`--dry-run' option if you just want to see what would be executed."
4894 install)
4895 $echo \
4896 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4898 Install executables or libraries.
4900 INSTALL-COMMAND is the installation command. The first component should be
4901 either the \`install' or \`cp' program.
4903 The rest of the components are interpreted as arguments to that command (only
4904 BSD-compatible install options are recognized)."
4907 link)
4908 $echo \
4909 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4911 Link object files or libraries together to form another library, or to
4912 create an executable program.
4914 LINK-COMMAND is a command using the C compiler that you would use to create
4915 a program from several object files.
4917 The following components of LINK-COMMAND are treated specially:
4919 -all-static do not do any dynamic linking at all
4920 -avoid-version do not add a version suffix if possible
4921 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4922 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4923 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4924 -export-symbols SYMFILE
4925 try to export only the symbols listed in SYMFILE
4926 -export-symbols-regex REGEX
4927 try to export only the symbols matching REGEX
4928 -LLIBDIR search LIBDIR for required installed libraries
4929 -lNAME OUTPUT-FILE requires the installed library libNAME
4930 -module build a library that can dlopened
4931 -no-fast-install disable the fast-install mode
4932 -no-install link a not-installable executable
4933 -no-undefined declare that a library does not refer to external symbols
4934 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4935 -release RELEASE specify package release information
4936 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4937 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4938 -static do not do any dynamic linking of libtool libraries
4939 -version-info CURRENT[:REVISION[:AGE]]
4940 specify library version info [each variable defaults to 0]
4942 All other options (arguments beginning with \`-') are ignored.
4944 Every other argument is treated as a filename. Files ending in \`.la' are
4945 treated as uninstalled libtool libraries, other files are standard or library
4946 object files.
4948 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4949 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4950 required, except when creating a convenience library.
4952 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4953 using \`ar' and \`ranlib', or on Windows using \`lib'.
4955 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4956 is created, otherwise an executable program is created."
4959 uninstall)
4960 $echo \
4961 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4963 Remove libraries from an installation directory.
4965 RM is the name of the program to use to delete files associated with each FILE
4966 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4967 to RM.
4969 If FILE is a libtool library, all the files associated with it are deleted.
4970 Otherwise, only FILE itself is deleted using RM."
4974 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4975 $echo "$help" 1>&2
4976 exit 1
4978 esac
4980 echo
4981 $echo "Try \`$modename --help' for more information about other modes."
4983 exit 0
4985 ### BEGIN LIBTOOL TAG CONFIG: disable-shared
4986 build_libtool_libs=no
4987 ### END LIBTOOL TAG CONFIG: disable-shared
4989 ### BEGIN LIBTOOL TAG CONFIG: disable-static
4990 build_old_libs=no
4991 ### END LIBTOOL TAG CONFIG: disable-static
4993 # Local Variables:
4994 # mode:shell-script
4995 # sh-indentation:2
4996 # End: