Updated French translation
[binutils.git] / ltmain.sh
blobbd76cfb4da08af7b119bc6f0ff8afcc4fd62f0c4
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
30 shift
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
37 else
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
44 shift
45 cat <<EOF
47 EOF
48 exit 0
51 # The name of this program.
52 progname=`$echo "$0" | sed 's%^.*/%%'`
53 modename="$progname"
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.4a-GCC3.0
59 TIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)"
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed='sed -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 SP2NL='tr \040 \012'
73 NL2SP='tr \015\012 \040\040'
75 # NLS nuisances.
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
83 if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
87 if test "$LTCONFIG_VERSION" != "$VERSION"; then
88 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
90 exit 1
93 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
94 echo "$modename: not configured to build any kind of library" 1>&2
95 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
96 exit 1
99 # Global variables.
100 mode=$default_mode
101 nonopt=
102 prev=
103 prevopt=
104 run=
105 show="$echo"
106 show_help=
107 execute_dlfiles=
108 lo2o="s/\\.lo\$/.${objext}/"
109 o2lo="s/\\.${objext}\$/.lo/"
111 # Parse our command line options once, thoroughly.
112 while test $# -gt 0
114 arg="$1"
115 shift
117 case $arg in
118 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
119 *) optarg= ;;
120 esac
122 # If the previous option needs an argument, assign it.
123 if test -n "$prev"; then
124 case $prev in
125 execute_dlfiles)
126 execute_dlfiles="$execute_dlfiles $arg"
128 tag)
129 tagname="$arg"
131 # Check whether tagname contains only valid characters
132 case $tagname in
133 *[!-_A-Za-z0-9,/]*)
134 echo "$progname: invalid tag name: $tagname" 1>&2
135 exit 1
137 esac
139 case $tagname in
141 # Don't test for the "default" C tag, as we know, it's there, but
142 # not specially marked.
145 if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
146 taglist="$taglist $tagname"
147 # Evaluate the configuration.
148 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
149 else
150 echo "$progname: ignoring unknown tag $tagname" 1>&2
153 esac
156 eval "$prev=\$arg"
158 esac
160 prev=
161 prevopt=
162 continue
165 # Have we seen a non-optional argument yet?
166 case $arg in
167 --help)
168 show_help=yes
171 --version)
172 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
173 exit 0
176 --config)
177 sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0"
178 # Now print the configurations for the tags.
179 for tagname in $taglist; do
180 sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
181 done
182 exit 0
185 --debug)
186 echo "$progname: enabling shell trace mode"
187 set -x
190 --dry-run | -n)
191 run=:
194 --features)
195 echo "host: $host"
196 if test "$build_libtool_libs" = yes; then
197 echo "enable shared libraries"
198 else
199 echo "disable shared libraries"
201 if test "$build_old_libs" = yes; then
202 echo "enable static libraries"
203 else
204 echo "disable static libraries"
206 exit 0
209 --finish) mode="finish" ;;
211 --mode) prevopt="--mode" prev=mode ;;
212 --mode=*) mode="$optarg" ;;
214 --quiet | --silent)
215 show=:
218 --tag) prevopt="--tag" prev=tag ;;
219 --tag=*)
220 set tag "$optarg" ${1+"$@"}
221 shift
222 prev=tag
225 -dlopen)
226 prevopt="-dlopen"
227 prev=execute_dlfiles
231 $echo "$modename: unrecognized option \`$arg'" 1>&2
232 $echo "$help" 1>&2
233 exit 1
237 nonopt="$arg"
238 break
240 esac
241 done
243 if test -n "$prevopt"; then
244 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
245 $echo "$help" 1>&2
246 exit 1
249 # If this variable is set in any of the actions, the command in it
250 # will be execed at the end. This prevents here-documents from being
251 # left over by shells.
252 exec_cmd=
254 if test -z "$show_help"; then
256 # Infer the operation mode.
257 if test -z "$mode"; then
258 case $nonopt in
259 *cc | *++ | gcc* | *-gcc*)
260 mode=link
261 for arg
263 case $arg in
265 mode=compile
266 break
268 esac
269 done
271 *db | *dbx | *strace | *truss)
272 mode=execute
274 *install*|cp|mv)
275 mode=install
277 *rm)
278 mode=uninstall
281 # If we have no mode, but dlfiles were specified, then do execute mode.
282 test -n "$execute_dlfiles" && mode=execute
284 # Just use the default operation mode.
285 if test -z "$mode"; then
286 if test -n "$nonopt"; then
287 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
288 else
289 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
293 esac
296 # Only execute mode is allowed to have -dlopen flags.
297 if test -n "$execute_dlfiles" && test "$mode" != execute; then
298 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
299 $echo "$help" 1>&2
300 exit 1
303 # Change the help message to a mode-specific one.
304 generic_help="$help"
305 help="Try \`$modename --help --mode=$mode' for more information."
307 # These modes are in order of execution frequency so that they run quickly.
308 case $mode in
309 # libtool compile mode
310 compile)
311 modename="$modename: compile"
312 # Get the compilation command and the source file.
313 base_compile=
314 prev=
315 lastarg=
316 srcfile="$nonopt"
317 suppress_output=
319 user_target=no
320 for arg
322 case $prev in
323 "") ;;
324 xcompiler)
325 # Aesthetically quote the previous argument.
326 prev=
327 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
329 case $arg in
330 # Double-quote args containing other shell metacharacters.
331 # Many Bourne shells cannot handle close brackets correctly
332 # in scan sets, so we specify it separately.
333 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
334 arg="\"$arg\""
336 esac
338 # Add the previous argument to base_compile.
339 if test -z "$base_compile"; then
340 base_compile="$lastarg"
341 else
342 base_compile="$base_compile $lastarg"
344 continue
346 esac
348 # Accept any command-line options.
349 case $arg in
351 if test "$user_target" != "no"; then
352 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
353 exit 1
355 user_target=next
358 -static)
359 build_old_libs=yes
360 continue
363 -prefer-pic)
364 pic_mode=yes
365 continue
368 -prefer-non-pic)
369 pic_mode=no
370 continue
373 -Xcompiler)
374 prev=xcompiler
375 continue
378 -Wc,*)
379 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
380 lastarg=
381 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
382 for arg in $args; do
383 IFS="$save_ifs"
385 # Double-quote args containing other shell metacharacters.
386 # Many Bourne shells cannot handle close brackets correctly
387 # in scan sets, so we specify it separately.
388 case $arg in
389 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
390 arg="\"$arg\""
392 esac
393 lastarg="$lastarg $arg"
394 done
395 IFS="$save_ifs"
396 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
398 # Add the arguments to base_compile.
399 if test -z "$base_compile"; then
400 base_compile="$lastarg"
401 else
402 base_compile="$base_compile $lastarg"
404 continue
406 esac
408 case $user_target in
409 next)
410 # The next one is the -o target name
411 user_target=yes
412 continue
414 yes)
415 # We got the output file
416 user_target=set
417 libobj="$arg"
418 continue
420 esac
422 # Accept the current argument as the source file.
423 lastarg="$srcfile"
424 srcfile="$arg"
426 # Aesthetically quote the previous argument.
428 # Backslashify any backslashes, double quotes, and dollar signs.
429 # These are the only characters that are still specially
430 # interpreted inside of double-quoted scrings.
431 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
433 # Double-quote args containing other shell metacharacters.
434 # Many Bourne shells cannot handle close brackets correctly
435 # in scan sets, so we specify it separately.
436 case $lastarg in
437 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
438 lastarg="\"$lastarg\""
440 esac
442 # Add the previous argument to base_compile.
443 if test -z "$base_compile"; then
444 base_compile="$lastarg"
445 else
446 base_compile="$base_compile $lastarg"
448 done
450 case $user_target in
451 set)
454 # Get the name of the library object.
455 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
458 $echo "$modename: you must specify a target with \`-o'" 1>&2
459 exit 1
461 esac
463 # Recognize several different file suffixes.
464 # If the user specifies -o file.o, it is replaced with file.lo
465 xform='[cCFSfmso]'
466 case $libobj in
467 *.ada) xform=ada ;;
468 *.adb) xform=adb ;;
469 *.ads) xform=ads ;;
470 *.asm) xform=asm ;;
471 *.c++) xform=c++ ;;
472 *.cc) xform=cc ;;
473 *.class) xform=class ;;
474 *.cpp) xform=cpp ;;
475 *.cxx) xform=cxx ;;
476 *.f90) xform=f90 ;;
477 *.for) xform=for ;;
478 *.java) xform=java ;;
479 esac
481 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
483 case $libobj in
484 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
486 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
487 exit 1
489 esac
491 # Infer tagged configuration to use if any are available and
492 # if one wasn't chosen via the "--tag" command line option.
493 # Only attempt this if the compiler in the base compile
494 # command doesn't match the default compiler.
495 if test -n "$available_tags" && test -z "$tagname"; then
496 case $base_compile in
497 "$CC "*) ;;
498 # Blanks in the command may have been stripped by the calling shell,
499 # but not from the CC environment variable when ltconfig was run.
500 "`$echo $CC` "*) ;;
502 for z in $available_tags; do
503 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
504 # Evaluate the configuration.
505 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
506 case $base_compile in
507 "$CC "*)
508 # The compiler in the base compile command matches
509 # the one in the tagged configuration.
510 # Assume this is the tagged configuration we want.
511 tagname=$z
512 break
514 "`$echo $CC` "*)
515 tagname=$z
516 break
518 esac
520 done
521 # If $tagname still isn't set, then no tagged configuration
522 # was found and let the user know that the "--tag" command
523 # line option must be used.
524 if test -z "$tagname"; then
525 echo "$modename: unable to infer tagged configuration"
526 echo "$modename: specify a tag with \`--tag'" 1>&2
527 exit 1
528 # else
529 # echo "$modename: using $tagname tagged configuration"
532 esac
535 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
536 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
537 if test "X$xdir" = "X$obj"; then
538 xdir=
539 else
540 xdir=$xdir/
542 lobj=${xdir}$objdir/$objname
544 if test -z "$base_compile"; then
545 $echo "$modename: you must specify a compilation command" 1>&2
546 $echo "$help" 1>&2
547 exit 1
550 # Delete any leftover library objects.
551 if test "$build_old_libs" = yes; then
552 removelist="$obj $lobj $libobj ${libobj}T"
553 else
554 removelist="$lobj $libobj ${libobj}T"
557 $run $rm $removelist
558 trap "$run $rm $removelist; exit 1" 1 2 15
560 # On Cygwin there's no "real" PIC flag so we must build both object types
561 case $host_os in
562 cygwin* | mingw* | pw32* | os2*)
563 pic_mode=default
565 esac
566 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
567 # non-PIC code in shared libraries is not supported
568 pic_mode=default
571 # Calculate the filename of the output object if compiler does
572 # not support -o with -c
573 if test "$compiler_c_o" = no; then
574 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
575 lockfile="$output_obj.lock"
576 removelist="$removelist $output_obj $lockfile"
577 trap "$run $rm $removelist; exit 1" 1 2 15
578 else
579 output_obj=
580 need_locks=no
581 lockfile=
584 # Lock this critical section if it is needed
585 # We use this script file to make the link, it avoids creating a new file
586 if test "$need_locks" = yes; then
587 until $run ln "$0" "$lockfile" 2>/dev/null; do
588 $show "Waiting for $lockfile to be removed"
589 sleep 2
590 done
591 elif test "$need_locks" = warn; then
592 if test -f "$lockfile"; then
593 echo "\
594 *** ERROR, $lockfile exists and contains:
595 `cat $lockfile 2>/dev/null`
597 This indicates that another process is trying to use the same
598 temporary object file, and libtool could not work around it because
599 your compiler does not support \`-c' and \`-o' together. If you
600 repeat this compilation, it may succeed, by chance, but you had better
601 avoid parallel builds (make -j) in this platform, or get a better
602 compiler."
604 $run $rm $removelist
605 exit 1
607 echo $srcfile > "$lockfile"
610 if test -n "$fix_srcfile_path"; then
611 eval srcfile=\"$fix_srcfile_path\"
614 $run $rm "$libobj" "${libobj}T"
616 # Create a libtool object file (analogous to a ".la" file),
617 # but don't create it if we're doing a dry run.
618 test -z "$run" && cat > ${libobj}T <<EOF
619 # $libobj - a libtool object file
620 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
622 # Please DO NOT delete this file!
623 # It is necessary for linking the library.
625 # Name of the PIC object.
628 # Only build a PIC object if we are building libtool libraries.
629 if test "$build_libtool_libs" = yes; then
630 # Without this assignment, base_compile gets emptied.
631 fbsd_hideous_sh_bug=$base_compile
633 if test "$pic_mode" != no; then
634 command="$base_compile $srcfile $pic_flag"
635 else
636 # Don't build PIC code
637 command="$base_compile $srcfile"
640 if test ! -d ${xdir}$objdir; then
641 $show "$mkdir ${xdir}$objdir"
642 $run $mkdir ${xdir}$objdir
643 status=$?
644 if test $status -ne 0 && test ! -d ${xdir}$objdir; then
645 exit $status
649 if test -z "$output_obj"; then
650 # Place PIC objects in $objdir
651 command="$command -o $lobj"
654 $run $rm "$lobj" "$output_obj"
656 $show "$command"
657 if $run eval "$command"; then :
658 else
659 test -n "$output_obj" && $run $rm $removelist
660 exit 1
663 if test "$need_locks" = warn &&
664 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
665 echo "\
666 *** ERROR, $lockfile contains:
667 `cat $lockfile 2>/dev/null`
669 but it should contain:
670 $srcfile
672 This indicates that another process is trying to use the same
673 temporary object file, and libtool could not work around it because
674 your compiler does not support \`-c' and \`-o' together. If you
675 repeat this compilation, it may succeed, by chance, but you had better
676 avoid parallel builds (make -j) in this platform, or get a better
677 compiler."
679 $run $rm $removelist
680 exit 1
683 # Just move the object if needed, then go on to compile the next one
684 if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
685 $show "$mv $output_obj $lobj"
686 if $run $mv $output_obj $lobj; then :
687 else
688 error=$?
689 $run $rm $removelist
690 exit $error
694 # Append the name of the PIC object to the libtool object file.
695 test -z "$run" && cat >> ${libobj}T <<EOF
696 pic_object='$objdir/$objname'
700 # Allow error messages only from the first compilation.
701 suppress_output=' >/dev/null 2>&1'
702 else
703 # No PIC object so indicate it doesn't exist in the libtool
704 # object file.
705 test -z "$run" && cat >> ${libobj}T <<EOF
706 pic_object=none
711 # Only build a position-dependent object if we build old libraries.
712 if test "$build_old_libs" = yes; then
713 if test "$pic_mode" != yes; then
714 # Don't build PIC code
715 command="$base_compile $srcfile"
716 else
717 command="$base_compile $srcfile $pic_flag"
719 if test "$compiler_c_o" = yes; then
720 command="$command -o $obj"
723 # Suppress compiler output if we already did a PIC compilation.
724 command="$command$suppress_output"
725 $run $rm "$obj" "$output_obj"
726 $show "$command"
727 if $run eval "$command"; then :
728 else
729 $run $rm $removelist
730 exit 1
733 if test "$need_locks" = warn &&
734 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
735 echo "\
736 *** ERROR, $lockfile contains:
737 `cat $lockfile 2>/dev/null`
739 but it should contain:
740 $srcfile
742 This indicates that another process is trying to use the same
743 temporary object file, and libtool could not work around it because
744 your compiler does not support \`-c' and \`-o' together. If you
745 repeat this compilation, it may succeed, by chance, but you had better
746 avoid parallel builds (make -j) in this platform, or get a better
747 compiler."
749 $run $rm $removelist
750 exit 1
753 # Just move the object if needed
754 if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
755 $show "$mv $output_obj $obj"
756 if $run $mv $output_obj $obj; then :
757 else
758 error=$?
759 $run $rm $removelist
760 exit $error
764 # Append the name of the non-PIC object the libtool object file.
765 # Only append if the libtool object file exists.
766 test -z "$run" && cat >> ${libobj}T <<EOF
767 # Name of the non-PIC object.
768 non_pic_object='$objname'
771 else
772 # Append the name of the non-PIC object the libtool object file.
773 # Only append if the libtool object file exists.
774 test -z "$run" && cat >> ${libobj}T <<EOF
775 # Name of the non-PIC object.
776 non_pic_object=none
781 $run $mv "${libobj}T" "${libobj}"
783 # Unlock the critical section if it was locked
784 if test "$need_locks" != no; then
785 $run $rm "$lockfile"
788 exit 0
791 # libtool link mode
792 link | relink)
793 modename="$modename: link"
794 case $host in
795 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
796 # It is impossible to link a dll without this setting, and
797 # we shouldn't force the makefile maintainer to figure out
798 # which system we are compiling for in order to pass an extra
799 # flag for every libtool invokation.
800 # allow_undefined=no
802 # FIXME: Unfortunately, there are problems with the above when trying
803 # to make a dll which has undefined symbols, in which case not
804 # even a static library is built. For now, we need to specify
805 # -no-undefined on the libtool link line when we can be certain
806 # that all symbols are satisfied, otherwise we get a static library.
807 allow_undefined=yes
810 allow_undefined=yes
812 esac
813 libtool_args="$nonopt"
814 base_compile="$nonopt"
815 compile_command="$nonopt"
816 finalize_command="$nonopt"
818 compile_rpath=
819 finalize_rpath=
820 compile_shlibpath=
821 finalize_shlibpath=
822 convenience=
823 old_convenience=
824 deplibs=
825 old_deplibs=
826 compiler_flags=
827 linker_flags=
828 dllsearchpath=
829 lib_search_path=`pwd`
831 avoid_version=no
832 dlfiles=
833 dlprefiles=
834 dlself=no
835 export_dynamic=no
836 export_symbols=
837 export_symbols_regex=
838 generated=
839 libobjs=
840 ltlibs=
841 module=no
842 no_install=no
843 objs=
844 non_pic_objects=
845 prefer_static_libs=no
846 preload=no
847 prev=
848 prevarg=
849 release=
850 rpath=
851 xrpath=
852 perm_rpath=
853 temp_rpath=
854 thread_safe=no
855 vinfo=
857 # We need to know -static, to get the right output filenames.
858 for arg
860 case $arg in
861 -all-static | -static)
862 if test "X$arg" = "X-all-static"; then
863 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
864 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
866 if test -n "$link_static_flag"; then
867 dlopen_self=$dlopen_self_static
869 else
870 if test -z "$pic_flag" && test -n "$link_static_flag"; then
871 dlopen_self=$dlopen_self_static
874 build_libtool_libs=no
875 build_old_libs=yes
876 prefer_static_libs=yes
877 break
879 esac
880 done
882 # See if our shared archives depend on static archives.
883 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
885 # Go through the arguments, transforming them on the way.
886 while test $# -gt 0; do
887 arg="$1"
888 base_compile="$base_compile $arg"
889 shift
890 case $arg in
891 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
892 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
894 *) qarg=$arg ;;
895 esac
896 libtool_args="$libtool_args $qarg"
898 # If the previous option needs an argument, assign it.
899 if test -n "$prev"; then
900 case $prev in
901 output)
902 compile_command="$compile_command @OUTPUT@"
903 finalize_command="$finalize_command @OUTPUT@"
905 esac
907 case $prev in
908 dlfiles|dlprefiles)
909 if test "$preload" = no; then
910 # Add the symbol object into the linking commands.
911 compile_command="$compile_command @SYMFILE@"
912 finalize_command="$finalize_command @SYMFILE@"
913 preload=yes
915 case $arg in
916 *.la | *.lo) ;; # We handle these cases below.
917 force)
918 if test "$dlself" = no; then
919 dlself=needless
920 export_dynamic=yes
922 prev=
923 continue
925 self)
926 if test "$prev" = dlprefiles; then
927 dlself=yes
928 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
929 dlself=yes
930 else
931 dlself=needless
932 export_dynamic=yes
934 prev=
935 continue
938 if test "$prev" = dlfiles; then
939 dlfiles="$dlfiles $arg"
940 else
941 dlprefiles="$dlprefiles $arg"
943 prev=
944 continue
946 esac
948 expsyms)
949 export_symbols="$arg"
950 if test ! -f "$arg"; then
951 $echo "$modename: symbol file \`$arg' does not exist"
952 exit 1
954 prev=
955 continue
957 expsyms_regex)
958 export_symbols_regex="$arg"
959 prev=
960 continue
962 release)
963 release="-$arg"
964 prev=
965 continue
967 objectlist)
968 if test -f "$arg"; then
969 save_arg=$arg
970 moreargs=
971 for fil in `cat $save_arg`
973 # moreargs="$moreargs $fil"
974 arg=$fil
975 # A libtool-controlled object.
977 # Check to see that this really is a libtool object.
978 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
979 pic_object=
980 non_pic_object=
982 # Read the .lo file
983 # If there is no directory component, then add one.
984 case $arg in
985 */* | *\\*) . $arg ;;
986 *) . ./$arg ;;
987 esac
989 if test -z "$pic_object" || \
990 test -z "$non_pic_object" ||
991 test "$pic_object" = none && \
992 test "$non_pic_object" = none; then
993 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
994 exit 1
997 # Extract subdirectory from the argument.
998 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
999 if test "X$xdir" = "X$arg"; then
1000 xdir=
1001 else
1002 xdir="$xdir/"
1005 if test "$pic_object" != none; then
1006 # Prepend the subdirectory the object is found in.
1007 pic_object="$xdir$pic_object"
1009 if test "$prev" = dlfiles; then
1010 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1011 dlfiles="$dlfiles $pic_object"
1012 prev=
1013 continue
1014 else
1015 # If libtool objects are unsupported, then we need to preload.
1016 prev=dlprefiles
1020 # CHECK ME: I think I busted this. -Ossama
1021 if test "$prev" = dlprefiles; then
1022 # Preload the old-style object.
1023 dlprefiles="$dlprefiles $pic_object"
1024 prev=
1027 # A PIC object.
1028 libobjs="$libobjs $pic_object"
1029 arg="$pic_object"
1032 # Non-PIC object.
1033 if test "$non_pic_object" != none; then
1034 # Prepend the subdirectory the object is found in.
1035 non_pic_object="$xdir$non_pic_object"
1037 # A standard non-PIC object
1038 non_pic_objects="$non_pic_objects $non_pic_object"
1039 if test -z "$pic_object" || test "$pic_object" = none ; then
1040 arg="$non_pic_object"
1043 else
1044 # Only an error if not doing a dry-run.
1045 if test -z "$run"; then
1046 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1047 exit 1
1048 else
1049 # Dry-run case.
1051 # Extract subdirectory from the argument.
1052 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1053 if test "X$xdir" = "X$arg"; then
1054 xdir=
1055 else
1056 xdir="$xdir/"
1059 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1060 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1061 libobjs="$libobjs $pic_object"
1062 non_pic_objects="$non_pic_objects $non_pic_object"
1065 done
1066 else
1067 $echo "$modename: link input file \`$save_arg' does not exist"
1068 exit 1
1070 arg=$save_arg
1071 prev=
1072 continue
1074 rpath | xrpath)
1075 # We need an absolute path.
1076 case $arg in
1077 [\\/]* | [A-Za-z]:[\\/]*) ;;
1079 $echo "$modename: only absolute run-paths are allowed" 1>&2
1080 exit 1
1082 esac
1083 if test "$prev" = rpath; then
1084 case "$rpath " in
1085 *" $arg "*) ;;
1086 *) rpath="$rpath $arg" ;;
1087 esac
1088 else
1089 case "$xrpath " in
1090 *" $arg "*) ;;
1091 *) xrpath="$xrpath $arg" ;;
1092 esac
1094 prev=
1095 continue
1097 xcompiler)
1098 compiler_flags="$compiler_flags $qarg"
1099 prev=
1100 compile_command="$compile_command $qarg"
1101 finalize_command="$finalize_command $qarg"
1102 continue
1104 xlinker)
1105 linker_flags="$linker_flags $qarg"
1106 compiler_flags="$compiler_flags $wl$qarg"
1107 prev=
1108 compile_command="$compile_command $wl$qarg"
1109 finalize_command="$finalize_command $wl$qarg"
1110 continue
1113 eval "$prev=\"\$arg\""
1114 prev=
1115 continue
1117 esac
1118 fi # test -n $prev
1120 prevarg="$arg"
1122 case $arg in
1123 -all-static)
1124 if test -n "$link_static_flag"; then
1125 compile_command="$compile_command $link_static_flag"
1126 finalize_command="$finalize_command $link_static_flag"
1128 continue
1131 -allow-undefined)
1132 # FIXME: remove this flag sometime in the future.
1133 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1134 continue
1137 -avoid-version)
1138 avoid_version=yes
1139 continue
1142 -dlopen)
1143 prev=dlfiles
1144 continue
1147 -dlpreopen)
1148 prev=dlprefiles
1149 continue
1152 -export-dynamic)
1153 export_dynamic=yes
1154 continue
1157 -export-symbols | -export-symbols-regex)
1158 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1159 $echo "$modename: more than one -exported-symbols argument is not allowed"
1160 exit 1
1162 if test "X$arg" = "X-export-symbols"; then
1163 prev=expsyms
1164 else
1165 prev=expsyms_regex
1167 continue
1170 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1171 # so, if we see these flags be careful not to treat them like -L
1172 -L[A-Z][A-Z]*:*)
1173 case $with_gcc/$host in
1174 no/*-*-irix*)
1175 compile_command="$compile_command $arg"
1176 finalize_command="$finalize_command $arg"
1178 esac
1179 continue
1182 -L*)
1183 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1184 # We need an absolute path.
1185 case $dir in
1186 [\\/]* | [A-Za-z]:[\\/]*) ;;
1188 absdir=`cd "$dir" && pwd`
1189 if test -z "$absdir"; then
1190 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1191 exit 1
1193 dir="$absdir"
1195 esac
1196 case "$deplibs " in
1197 *" -L$dir "*) ;;
1199 deplibs="$deplibs -L$dir"
1200 lib_search_path="$lib_search_path $dir"
1202 esac
1203 case $host in
1204 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1205 case :$dllsearchpath: in
1206 *":$dir:"*) ;;
1207 *) dllsearchpath="$dllsearchpath:$dir";;
1208 esac
1210 esac
1211 continue
1214 -l*)
1215 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1216 case $host in
1217 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1218 # These systems don't actually have a C or math library (as such)
1219 continue
1221 *-*-mingw* | *-*-os2*)
1222 # These systems don't actually have a C library (as such)
1223 test "X$arg" = "X-lc" && continue
1225 esac
1227 deplibs="$deplibs $arg"
1228 continue
1231 -module)
1232 module=yes
1233 continue
1236 -no-fast-install)
1237 fast_install=no
1238 continue
1241 -no-install)
1242 case $host in
1243 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1244 # The PATH hackery in wrapper scripts is required on Windows
1245 # in order for the loader to find any dlls it needs.
1246 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1247 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1248 fast_install=no
1250 *) no_install=yes ;;
1251 esac
1252 continue
1255 -no-undefined)
1256 allow_undefined=no
1257 continue
1260 -objectlist)
1261 prev=objectlist
1262 continue
1265 -o) prev=output ;;
1267 -release)
1268 prev=release
1269 continue
1272 -rpath)
1273 prev=rpath
1274 continue
1278 prev=xrpath
1279 continue
1282 -R*)
1283 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1284 # We need an absolute path.
1285 case $dir in
1286 [\\/]* | [A-Za-z]:[\\/]*) ;;
1288 $echo "$modename: only absolute run-paths are allowed" 1>&2
1289 exit 1
1291 esac
1292 case "$xrpath " in
1293 *" $dir "*) ;;
1294 *) xrpath="$xrpath $dir" ;;
1295 esac
1296 continue
1299 -static)
1300 # The effects of -static are defined in a previous loop.
1301 # We used to do the same as -all-static on platforms that
1302 # didn't have a PIC flag, but the assumption that the effects
1303 # would be equivalent was wrong. It would break on at least
1304 # Digital Unix and AIX.
1305 continue
1308 -thread-safe)
1309 thread_safe=yes
1310 continue
1313 -version-info)
1314 prev=vinfo
1315 continue
1318 -Wc,*)
1319 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1320 arg=
1321 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1322 for flag in $args; do
1323 IFS="$save_ifs"
1324 case $flag in
1325 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1326 flag="\"$flag\""
1328 esac
1329 arg="$arg $wl$flag"
1330 compiler_flags="$compiler_flags $flag"
1331 done
1332 IFS="$save_ifs"
1333 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1336 -Wl,*)
1337 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1338 arg=
1339 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1340 for flag in $args; do
1341 IFS="$save_ifs"
1342 case $flag in
1343 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1344 flag="\"$flag\""
1346 esac
1347 arg="$arg $wl$flag"
1348 compiler_flags="$compiler_flags $wl$flag"
1349 linker_flags="$linker_flags $flag"
1350 done
1351 IFS="$save_ifs"
1352 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1355 -Xcompiler)
1356 prev=xcompiler
1357 continue
1360 -Xlinker)
1361 prev=xlinker
1362 continue
1365 # Some other compiler flag.
1366 -* | +*)
1367 # Unknown arguments in both finalize_command and compile_command need
1368 # to be aesthetically quoted because they are evaled later.
1369 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1370 case $arg in
1371 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1372 arg="\"$arg\""
1374 esac
1377 *.$objext)
1378 # A standard object.
1379 objs="$objs $arg"
1382 *.lo)
1383 # A libtool-controlled object.
1385 # Check to see that this really is a libtool object.
1386 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1387 pic_object=
1388 non_pic_object=
1390 # Read the .lo file
1391 # If there is no directory component, then add one.
1392 case $arg in
1393 */* | *\\*) . $arg ;;
1394 *) . ./$arg ;;
1395 esac
1397 if test -z "$pic_object" || \
1398 test -z "$non_pic_object" ||
1399 test "$pic_object" = none && \
1400 test "$non_pic_object" = none; then
1401 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1402 exit 1
1405 # Extract subdirectory from the argument.
1406 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1407 if test "X$xdir" = "X$arg"; then
1408 xdir=
1409 else
1410 xdir="$xdir/"
1413 if test "$pic_object" != none; then
1414 # Prepend the subdirectory the object is found in.
1415 pic_object="$xdir$pic_object"
1417 if test "$prev" = dlfiles; then
1418 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1419 dlfiles="$dlfiles $pic_object"
1420 prev=
1421 continue
1422 else
1423 # If libtool objects are unsupported, then we need to preload.
1424 prev=dlprefiles
1428 # CHECK ME: I think I busted this. -Ossama
1429 if test "$prev" = dlprefiles; then
1430 # Preload the old-style object.
1431 dlprefiles="$dlprefiles $pic_object"
1432 prev=
1435 # A PIC object.
1436 libobjs="$libobjs $pic_object"
1437 arg="$pic_object"
1440 # Non-PIC object.
1441 if test "$non_pic_object" != none; then
1442 # Prepend the subdirectory the object is found in.
1443 non_pic_object="$xdir$non_pic_object"
1445 # A standard non-PIC object
1446 non_pic_objects="$non_pic_objects $non_pic_object"
1447 if test -z "$pic_object" || test "$pic_object" = none ; then
1448 arg="$non_pic_object"
1451 else
1452 # Only an error if not doing a dry-run.
1453 if test -z "$run"; then
1454 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1455 exit 1
1456 else
1457 # Dry-run case.
1459 # Extract subdirectory from the argument.
1460 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1461 if test "X$xdir" = "X$arg"; then
1462 xdir=
1463 else
1464 xdir="$xdir/"
1467 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1468 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1469 libobjs="$libobjs $pic_object"
1470 non_pic_objects="$non_pic_objects $non_pic_object"
1475 *.$libext)
1476 # An archive.
1477 deplibs="$deplibs $arg"
1478 old_deplibs="$old_deplibs $arg"
1479 continue
1482 *.la)
1483 # A libtool-controlled library.
1485 if test "$prev" = dlfiles; then
1486 # This library was specified with -dlopen.
1487 dlfiles="$dlfiles $arg"
1488 prev=
1489 elif test "$prev" = dlprefiles; then
1490 # The library was specified with -dlpreopen.
1491 dlprefiles="$dlprefiles $arg"
1492 prev=
1493 else
1494 deplibs="$deplibs $arg"
1496 continue
1499 # Some other compiler argument.
1501 # Unknown arguments in both finalize_command and compile_command need
1502 # to be aesthetically quoted because they are evaled later.
1503 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1504 case $arg in
1505 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1506 arg="\"$arg\""
1508 esac
1510 esac # arg
1512 # Now actually substitute the argument into the commands.
1513 if test -n "$arg"; then
1514 compile_command="$compile_command $arg"
1515 finalize_command="$finalize_command $arg"
1517 done # argument parsing loop
1519 if test -n "$prev"; then
1520 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1521 $echo "$help" 1>&2
1522 exit 1
1525 # Infer tagged configuration to use if any are available and
1526 # if one wasn't chosen via the "--tag" command line option.
1527 # Only attempt this if the compiler in the base link
1528 # command doesn't match the default compiler.
1529 if test -n "$available_tags" && test -z "$tagname"; then
1530 case $base_compile in
1531 "$CC "*) ;;
1532 # Blanks in the command may have been stripped by the calling shell,
1533 # but not from the CC environment variable when ltconfig was run.
1534 "`$echo $CC` "*) ;;
1536 for z in $available_tags; do
1537 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1538 # Evaluate the configuration.
1539 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1540 case $base_compile in
1541 "$CC "*)
1542 # The compiler in $compile_command matches
1543 # the one in the tagged configuration.
1544 # Assume this is the tagged configuration we want.
1545 tagname=$z
1546 break
1548 "`$echo $CC` "*)
1549 tagname=$z
1550 break
1552 esac
1554 done
1555 # If $tagname still isn't set, then no tagged configuration
1556 # was found and let the user know that the "--tag" command
1557 # line option must be used.
1558 if test -z "$tagname"; then
1559 echo "$modename: unable to infer tagged configuration"
1560 echo "$modename: specify a tag with \`--tag'" 1>&2
1561 exit 1
1562 # else
1563 # echo "$modename: using $tagname tagged configuration"
1566 esac
1569 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1570 eval arg=\"$export_dynamic_flag_spec\"
1571 compile_command="$compile_command $arg"
1572 finalize_command="$finalize_command $arg"
1575 # calculate the name of the file, without its directory
1576 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1577 libobjs_save="$libobjs"
1579 if test -n "$shlibpath_var"; then
1580 # get the directories listed in $shlibpath_var
1581 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1582 else
1583 shlib_search_path=
1585 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1586 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1588 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1589 if test "X$output_objdir" = "X$output"; then
1590 output_objdir="$objdir"
1591 else
1592 output_objdir="$output_objdir/$objdir"
1594 # Create the object directory.
1595 if test ! -d $output_objdir; then
1596 $show "$mkdir $output_objdir"
1597 $run $mkdir $output_objdir
1598 status=$?
1599 if test $status -ne 0 && test ! -d $output_objdir; then
1600 exit $status
1604 # Determine the type of output
1605 case $output in
1607 $echo "$modename: you must specify an output file" 1>&2
1608 $echo "$help" 1>&2
1609 exit 1
1611 *.$libext) linkmode=oldlib ;;
1612 *.lo | *.$objext) linkmode=obj ;;
1613 *.la) linkmode=lib ;;
1614 *) linkmode=prog ;; # Anything else should be a program.
1615 esac
1617 specialdeplibs=
1618 libs=
1619 # Find all interdependent deplibs by searching for libraries
1620 # that are linked more than once (e.g. -la -lb -la)
1621 for deplib in $deplibs; do
1622 case "$libs " in
1623 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1624 esac
1625 libs="$libs $deplib"
1626 done
1628 if test $linkmode = lib; then
1629 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1631 # Compute libraries that are listed more than once in $predeps
1632 # $postdeps and mark them as special (i.e., whose duplicates are
1633 # not to be eliminated).
1634 pre_post_deps=
1635 for pre_post_dep in $predeps $postdeps; do
1636 case "$pre_post_deps " in
1637 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1638 esac
1639 pre_post_deps="$pre_post_deps $pre_post_dep"
1640 done
1641 pre_post_deps=
1644 deplibs=
1645 newdependency_libs=
1646 newlib_search_path=
1647 need_relink=no # whether we're linking any uninstalled libtool libraries
1648 notinst_deplibs= # not-installed libtool libraries
1649 notinst_path= # paths that contain not-installed libtool libraries
1650 case $linkmode in
1651 lib)
1652 passes="conv link"
1653 for file in $dlfiles $dlprefiles; do
1654 case $file in
1655 *.la) ;;
1657 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1658 exit 1
1660 esac
1661 done
1663 prog)
1664 compile_deplibs=
1665 finalize_deplibs=
1666 alldeplibs=no
1667 newdlfiles=
1668 newdlprefiles=
1669 passes="conv scan dlopen dlpreopen link"
1671 *) passes="conv"
1673 esac
1674 for pass in $passes; do
1675 if test $linkmode = prog; then
1676 # Determine which files to process
1677 case $pass in
1678 dlopen)
1679 libs="$dlfiles"
1680 save_deplibs="$deplibs" # Collect dlpreopened libraries
1681 deplibs=
1683 dlpreopen) libs="$dlprefiles" ;;
1684 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1685 esac
1687 for deplib in $libs; do
1688 lib=
1689 found=no
1690 case $deplib in
1691 -l*)
1692 if test $linkmode = oldlib && test $linkmode = obj; then
1693 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1694 continue
1696 if test $pass = conv; then
1697 deplibs="$deplib $deplibs"
1698 continue
1700 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1701 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1702 # Search the libtool library
1703 lib="$searchdir/lib${name}.la"
1704 if test -f "$lib"; then
1705 found=yes
1706 break
1708 done
1709 if test "$found" != yes; then
1710 # deplib doesn't seem to be a libtool library
1711 if test "$linkmode,$pass" = "prog,link"; then
1712 compile_deplibs="$deplib $compile_deplibs"
1713 finalize_deplibs="$deplib $finalize_deplibs"
1714 else
1715 deplibs="$deplib $deplibs"
1716 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1718 continue
1720 ;; # -l
1721 -L*)
1722 case $linkmode in
1723 lib)
1724 deplibs="$deplib $deplibs"
1725 test $pass = conv && continue
1726 newdependency_libs="$deplib $newdependency_libs"
1727 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1729 prog)
1730 if test $pass = conv; then
1731 deplibs="$deplib $deplibs"
1732 continue
1734 if test $pass = scan; then
1735 deplibs="$deplib $deplibs"
1736 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1737 else
1738 compile_deplibs="$deplib $compile_deplibs"
1739 finalize_deplibs="$deplib $finalize_deplibs"
1743 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1745 esac # linkmode
1746 continue
1747 ;; # -L
1748 -R*)
1749 if test $pass = link; then
1750 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1751 # Make sure the xrpath contains only unique directories.
1752 case "$xrpath " in
1753 *" $dir "*) ;;
1754 *) xrpath="$xrpath $dir" ;;
1755 esac
1757 deplibs="$deplib $deplibs"
1758 continue
1760 *.la) lib="$deplib" ;;
1761 *.$libext)
1762 if test $pass = conv; then
1763 deplibs="$deplib $deplibs"
1764 continue
1766 case $linkmode in
1767 lib)
1768 if test "$deplibs_check_method" != pass_all; then
1769 echo
1770 echo "*** Warning: This library needs some functionality provided by $deplib."
1771 echo "*** I have the capability to make that library automatically link in when"
1772 echo "*** you link to this library. But I can only do this if you have a"
1773 echo "*** shared version of the library, which you do not appear to have."
1774 else
1775 echo
1776 echo "*** Warning: Linking the shared library $output against the"
1777 echo "*** static library $deplib is not portable!"
1778 deplibs="$deplib $deplibs"
1780 continue
1782 prog)
1783 if test $pass != link; then
1784 deplibs="$deplib $deplibs"
1785 else
1786 compile_deplibs="$deplib $compile_deplibs"
1787 finalize_deplibs="$deplib $finalize_deplibs"
1789 continue
1791 esac # linkmode
1792 ;; # *.$libext
1793 *.lo | *.$objext)
1794 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1795 # If there is no dlopen support or we're linking statically,
1796 # we need to preload.
1797 newdlprefiles="$newdlprefiles $deplib"
1798 compile_deplibs="$deplib $compile_deplibs"
1799 finalize_deplibs="$deplib $finalize_deplibs"
1800 else
1801 newdlfiles="$newdlfiles $deplib"
1803 continue
1805 %DEPLIBS%)
1806 alldeplibs=yes
1807 continue
1809 esac # case $deplib
1810 if test $found = yes || test -f "$lib"; then :
1811 else
1812 $echo "$modename: cannot find the library \`$lib'" 1>&2
1813 exit 1
1816 # Check to see that this really is a libtool archive.
1817 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1818 else
1819 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1820 exit 1
1823 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1824 test "X$ladir" = "X$lib" && ladir="."
1826 dlname=
1827 dlopen=
1828 dlpreopen=
1829 libdir=
1830 library_names=
1831 old_library=
1832 # If the library was installed with an old release of libtool,
1833 # it will not redefine variable installed.
1834 installed=yes
1836 # Read the .la file
1837 case $lib in
1838 */* | *\\*) . $lib ;;
1839 *) . ./$lib ;;
1840 esac
1842 if test "$linkmode,$pass" = "lib,link" ||
1843 test "$linkmode,$pass" = "prog,scan" ||
1844 { test $linkmode = oldlib && test $linkmode = obj; }; then
1845 # Add dl[pre]opened files of deplib
1846 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1847 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1850 if test $pass = conv; then
1851 # Only check for convenience libraries
1852 deplibs="$lib $deplibs"
1853 if test -z "$libdir"; then
1854 if test -z "$old_library"; then
1855 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1856 exit 1
1858 # It is a libtool convenience library, so add in its objects.
1859 convenience="$convenience $ladir/$objdir/$old_library"
1860 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1861 tmp_libs=
1862 for deplib in $dependency_libs; do
1863 deplibs="$deplib $deplibs"
1864 case "$tmp_libs " in
1865 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1866 esac
1867 tmp_libs="$tmp_libs $deplib"
1868 done
1869 elif test $linkmode != prog && test $linkmode != lib; then
1870 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1871 exit 1
1873 continue
1874 fi # $pass = conv
1876 # Get the name of the library we link against.
1877 linklib=
1878 for l in $old_library $library_names; do
1879 linklib="$l"
1880 done
1881 if test -z "$linklib"; then
1882 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1883 exit 1
1886 # This library was specified with -dlopen.
1887 if test $pass = dlopen; then
1888 if test -z "$libdir"; then
1889 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1890 exit 1
1892 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1893 # If there is no dlname, no dlopen support or we're linking
1894 # statically, we need to preload.
1895 dlprefiles="$dlprefiles $lib"
1896 else
1897 newdlfiles="$newdlfiles $lib"
1899 continue
1900 fi # $pass = dlopen
1902 # We need an absolute path.
1903 case $ladir in
1904 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1906 abs_ladir=`cd "$ladir" && pwd`
1907 if test -z "$abs_ladir"; then
1908 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1909 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1910 abs_ladir="$ladir"
1913 esac
1914 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1916 # Find the relevant object directory and library name.
1917 if test "X$installed" = Xyes; then
1918 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1919 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1920 dir="$ladir"
1921 absdir="$abs_ladir"
1922 libdir="$abs_ladir"
1923 else
1924 dir="$libdir"
1925 absdir="$libdir"
1927 else
1928 dir="$ladir/$objdir"
1929 absdir="$abs_ladir/$objdir"
1930 # Remove this search path later
1931 notinst_path="$notinst_path $abs_ladir"
1932 fi # $installed = yes
1933 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1935 # This library was specified with -dlpreopen.
1936 if test $pass = dlpreopen; then
1937 if test -z "$libdir"; then
1938 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1939 exit 1
1941 # Prefer using a static library (so that no silly _DYNAMIC symbols
1942 # are required to link).
1943 if test -n "$old_library"; then
1944 newdlprefiles="$newdlprefiles $dir/$old_library"
1945 # Otherwise, use the dlname, so that lt_dlopen finds it.
1946 elif test -n "$dlname"; then
1947 newdlprefiles="$newdlprefiles $dir/$dlname"
1948 else
1949 newdlprefiles="$newdlprefiles $dir/$linklib"
1951 fi # $pass = dlpreopen
1953 if test -z "$libdir"; then
1954 # Link the convenience library
1955 if test $linkmode = lib; then
1956 deplibs="$dir/$old_library $deplibs"
1957 elif test "$linkmode,$pass" = "prog,link"; then
1958 compile_deplibs="$dir/$old_library $compile_deplibs"
1959 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1960 else
1961 deplibs="$lib $deplibs"
1963 continue
1966 if test $linkmode = prog && test $pass != link; then
1967 newlib_search_path="$newlib_search_path $ladir"
1968 deplibs="$lib $deplibs"
1970 linkalldeplibs=no
1971 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1972 test "$build_libtool_libs" = no; then
1973 linkalldeplibs=yes
1976 tmp_libs=
1977 for deplib in $dependency_libs; do
1978 case $deplib in
1979 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1980 esac
1981 # Need to link against all dependency_libs?
1982 if test $linkalldeplibs = yes; then
1983 deplibs="$deplib $deplibs"
1984 else
1985 # Need to hardcode shared library paths
1986 # or/and link against static libraries
1987 newdependency_libs="$deplib $newdependency_libs"
1989 case "$tmp_libs " in
1990 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1991 esac
1992 tmp_libs="$tmp_libs $deplib"
1993 done # for deplib
1994 continue
1995 fi # $linkmode = prog...
1997 link_static=no # Whether the deplib will be linked statically
1998 if test -n "$library_names" &&
1999 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2000 # Link against this shared library
2002 if test "$linkmode,$pass" = "prog,link" ||
2003 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
2004 # Hardcode the library path.
2005 # Skip directories that are in the system default run-time
2006 # search path.
2007 case " $sys_lib_dlsearch_path " in
2008 *" $absdir "*) ;;
2010 case "$compile_rpath " in
2011 *" $absdir "*) ;;
2012 *) compile_rpath="$compile_rpath $absdir"
2013 esac
2015 esac
2016 case " $sys_lib_dlsearch_path " in
2017 *" $libdir "*) ;;
2019 case "$finalize_rpath " in
2020 *" $libdir "*) ;;
2021 *) finalize_rpath="$finalize_rpath $libdir"
2022 esac
2024 esac
2025 if test $linkmode = prog; then
2026 # We need to hardcode the library path
2027 if test -n "$shlibpath_var"; then
2028 # Make sure the rpath contains only unique directories.
2029 case "$temp_rpath " in
2030 *" $dir "*) ;;
2031 *" $absdir "*) ;;
2032 *) temp_rpath="$temp_rpath $dir" ;;
2033 esac
2036 fi # $linkmode,$pass = prog,link...
2038 if test "$alldeplibs" = yes &&
2039 { test "$deplibs_check_method" = pass_all ||
2040 { test "$build_libtool_libs" = yes &&
2041 test -n "$library_names"; }; }; then
2042 # We only need to search for static libraries
2043 continue
2046 if test "$installed" = no; then
2047 notinst_deplibs="$notinst_deplibs $lib"
2048 need_relink=yes
2051 if test -n "$old_archive_from_expsyms_cmds"; then
2052 # figure out the soname
2053 set dummy $library_names
2054 realname="$2"
2055 shift; shift
2056 libname=`eval \\$echo \"$libname_spec\"`
2057 # use dlname if we got it. it's perfectly good, no?
2058 if test -n "$dlname"; then
2059 soname="$dlname"
2060 elif test -n "$soname_spec"; then
2061 # bleh windows
2062 case $host in
2063 *cygwin*)
2064 major=`expr $current - $age`
2065 versuffix="-$major"
2067 esac
2068 eval soname=\"$soname_spec\"
2069 else
2070 soname="$realname"
2073 # Make a new name for the extract_expsyms_cmds to use
2074 soroot="$soname"
2075 soname=`echo $soroot | sed -e 's/^.*\///'`
2076 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2078 # If the library has no export list, then create one now
2079 if test -f "$output_objdir/$soname-def"; then :
2080 else
2081 $show "extracting exported symbol list from \`$soname'"
2082 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2083 eval cmds=\"$extract_expsyms_cmds\"
2084 for cmd in $cmds; do
2085 IFS="$save_ifs"
2086 $show "$cmd"
2087 $run eval "$cmd" || exit $?
2088 done
2089 IFS="$save_ifs"
2092 # Create $newlib
2093 if test -f "$output_objdir/$newlib"; then :; else
2094 $show "generating import library for \`$soname'"
2095 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2096 eval cmds=\"$old_archive_from_expsyms_cmds\"
2097 for cmd in $cmds; do
2098 IFS="$save_ifs"
2099 $show "$cmd"
2100 $run eval "$cmd" || exit $?
2101 done
2102 IFS="$save_ifs"
2104 # make sure the library variables are pointing to the new library
2105 dir=$output_objdir
2106 linklib=$newlib
2107 fi # test -n $old_archive_from_expsyms_cmds
2109 if test $linkmode = prog || test "$mode" != relink; then
2110 add_shlibpath=
2111 add_dir=
2112 add=
2113 lib_linked=yes
2114 case $hardcode_action in
2115 immediate | unsupported)
2116 if test "$hardcode_direct" = no; then
2117 add="$dir/$linklib"
2118 elif test "$hardcode_minus_L" = no; then
2119 case $host in
2120 *-*-sunos*) add_shlibpath="$dir" ;;
2121 esac
2122 add_dir="-L$dir"
2123 add="-l$name"
2124 elif test "$hardcode_shlibpath_var" = no; then
2125 add_shlibpath="$dir"
2126 add="-l$name"
2127 else
2128 lib_linked=no
2131 relink)
2132 if test "$hardcode_direct" = yes; then
2133 add="$dir/$linklib"
2134 elif test "$hardcode_minus_L" = yes; then
2135 add_dir="-L$dir"
2136 add="-l$name"
2137 elif test "$hardcode_shlibpath_var" = yes; then
2138 add_shlibpath="$dir"
2139 add="-l$name"
2140 else
2141 lib_linked=no
2144 *) lib_linked=no ;;
2145 esac
2147 if test "$lib_linked" != yes; then
2148 $echo "$modename: configuration error: unsupported hardcode properties"
2149 exit 1
2152 if test -n "$add_shlibpath"; then
2153 case :$compile_shlibpath: in
2154 *":$add_shlibpath:"*) ;;
2155 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2156 esac
2158 if test $linkmode = prog; then
2159 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2160 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2161 else
2162 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2163 test -n "$add" && deplibs="$add $deplibs"
2164 if test "$hardcode_direct" != yes && \
2165 test "$hardcode_minus_L" != yes && \
2166 test "$hardcode_shlibpath_var" = yes; then
2167 case :$finalize_shlibpath: in
2168 *":$libdir:"*) ;;
2169 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2170 esac
2175 if test $linkmode = prog || test "$mode" = relink; then
2176 add_shlibpath=
2177 add_dir=
2178 add=
2179 # Finalize command for both is simple: just hardcode it.
2180 if test "$hardcode_direct" = yes; then
2181 add="$libdir/$linklib"
2182 elif test "$hardcode_minus_L" = yes; then
2183 add_dir="-L$libdir"
2184 add="-l$name"
2185 elif test "$hardcode_shlibpath_var" = yes; then
2186 case :$finalize_shlibpath: in
2187 *":$libdir:"*) ;;
2188 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2189 esac
2190 add="-l$name"
2191 else
2192 # We cannot seem to hardcode it, guess we'll fake it.
2193 add_dir="-L$libdir"
2194 add="-l$name"
2197 if test $linkmode = prog; then
2198 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2199 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2200 else
2201 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2202 test -n "$add" && deplibs="$add $deplibs"
2205 elif test $linkmode = prog; then
2206 if test "$alldeplibs" = yes &&
2207 { test "$deplibs_check_method" = pass_all ||
2208 { test "$build_libtool_libs" = yes &&
2209 test -n "$library_names"; }; }; then
2210 # We only need to search for static libraries
2211 continue
2214 # Try to link the static library
2215 # Here we assume that one of hardcode_direct or hardcode_minus_L
2216 # is not unsupported. This is valid on all known static and
2217 # shared platforms.
2218 if test "$hardcode_direct" != unsupported; then
2219 test -n "$old_library" && linklib="$old_library"
2220 compile_deplibs="$dir/$linklib $compile_deplibs"
2221 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2222 else
2223 compile_deplibs="-l$name -L$dir $compile_deplibs"
2224 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2226 elif test "$build_libtool_libs" = yes; then
2227 # Not a shared library
2228 if test "$deplibs_check_method" != pass_all; then
2229 # We're trying link a shared library against a static one
2230 # but the system doesn't support it.
2232 # Just print a warning and add the library to dependency_libs so
2233 # that the program can be linked against the static library.
2234 echo
2235 echo "*** Warning: This library needs some functionality provided by $lib."
2236 echo "*** I have the capability to make that library automatically link in when"
2237 echo "*** you link to this library. But I can only do this if you have a"
2238 echo "*** shared version of the library, which you do not appear to have."
2239 if test "$module" = yes; then
2240 echo "*** Therefore, libtool will create a static module, that should work "
2241 echo "*** as long as the dlopening application is linked with the -dlopen flag."
2242 if test -z "$global_symbol_pipe"; then
2243 echo
2244 echo "*** However, this would only work if libtool was able to extract symbol"
2245 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2246 echo "*** not find such a program. So, this module is probably useless."
2247 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2249 if test "$build_old_libs" = no; then
2250 build_libtool_libs=module
2251 build_old_libs=yes
2252 else
2253 build_libtool_libs=no
2256 else
2257 convenience="$convenience $dir/$old_library"
2258 old_convenience="$old_convenience $dir/$old_library"
2259 deplibs="$dir/$old_library $deplibs"
2260 link_static=yes
2262 fi # link shared/static library?
2264 if test $linkmode = lib; then
2265 if test -n "$dependency_libs" &&
2266 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2267 test $link_static = yes; }; then
2268 # Extract -R from dependency_libs
2269 temp_deplibs=
2270 for libdir in $dependency_libs; do
2271 case $libdir in
2272 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2273 case " $xrpath " in
2274 *" $temp_xrpath "*) ;;
2275 *) xrpath="$xrpath $temp_xrpath";;
2276 esac;;
2277 *) temp_deplibs="$temp_deplibs $libdir";;
2278 esac
2279 done
2280 dependency_libs="$temp_deplibs"
2283 newlib_search_path="$newlib_search_path $absdir"
2284 # Link against this library
2285 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2286 # ... and its dependency_libs
2287 tmp_libs=
2288 for deplib in $dependency_libs; do
2289 newdependency_libs="$deplib $newdependency_libs"
2290 case "$tmp_libs " in
2291 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2292 esac
2293 tmp_libs="$tmp_libs $deplib"
2294 done
2296 if test $link_all_deplibs != no; then
2297 # Add the search paths of all dependency libraries
2298 for deplib in $dependency_libs; do
2299 case $deplib in
2300 -L*) path="$deplib" ;;
2301 *.la)
2302 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2303 test "X$dir" = "X$deplib" && dir="."
2304 # We need an absolute path.
2305 case $dir in
2306 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2308 absdir=`cd "$dir" && pwd`
2309 if test -z "$absdir"; then
2310 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2311 absdir="$dir"
2314 esac
2315 if grep "^installed=no" $deplib > /dev/null; then
2316 path="-L$absdir/$objdir"
2317 else
2318 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2319 if test -z "$libdir"; then
2320 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2321 exit 1
2323 if test "$absdir" != "$libdir"; then
2324 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2326 path="-L$absdir"
2329 *) continue ;;
2330 esac
2331 case " $deplibs " in
2332 *" $path "*) ;;
2333 *) deplibs="$path $deplibs" ;;
2334 esac
2335 done
2336 fi # link_all_deplibs != no
2337 fi # linkmode = lib
2338 done # for deplib in $libs
2339 if test $pass = dlpreopen; then
2340 # Link the dlpreopened libraries before other libraries
2341 for deplib in $save_deplibs; do
2342 deplibs="$deplib $deplibs"
2343 done
2345 if test $pass != dlopen; then
2346 test $pass != scan && dependency_libs="$newdependency_libs"
2347 if test $pass != conv; then
2348 # Make sure lib_search_path contains only unique directories.
2349 lib_search_path=
2350 for dir in $newlib_search_path; do
2351 case "$lib_search_path " in
2352 *" $dir "*) ;;
2353 *) lib_search_path="$lib_search_path $dir" ;;
2354 esac
2355 done
2356 newlib_search_path=
2359 if test "$linkmode,$pass" != "prog,link"; then
2360 vars="deplibs"
2361 else
2362 vars="compile_deplibs finalize_deplibs"
2364 for var in $vars dependency_libs; do
2365 # Add libraries to $var in reverse order
2366 eval tmp_libs=\"\$$var\"
2367 new_libs=
2368 for deplib in $tmp_libs; do
2369 case $deplib in
2370 -L*) new_libs="$deplib $new_libs" ;;
2372 case " $specialdeplibs " in
2373 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2375 case " $new_libs " in
2376 *" $deplib "*) ;;
2377 *) new_libs="$deplib $new_libs" ;;
2378 esac
2380 esac
2382 esac
2383 done
2384 tmp_libs=
2385 for deplib in $new_libs; do
2386 case $deplib in
2387 -L*)
2388 case " $tmp_libs " in
2389 *" $deplib "*) ;;
2390 *) tmp_libs="$tmp_libs $deplib" ;;
2391 esac
2393 *) tmp_libs="$tmp_libs $deplib" ;;
2394 esac
2395 done
2396 eval $var=\"$tmp_libs\"
2397 done # for var
2399 if test "$pass" = "conv" &&
2400 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2401 libs="$deplibs" # reset libs
2402 deplibs=
2404 done # for pass
2405 if test $linkmode = prog; then
2406 dlfiles="$newdlfiles"
2407 dlprefiles="$newdlprefiles"
2410 case $linkmode in
2411 oldlib)
2412 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2413 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2416 if test -n "$rpath"; then
2417 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2420 if test -n "$xrpath"; then
2421 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2424 if test -n "$vinfo"; then
2425 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2428 if test -n "$release"; then
2429 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2432 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2433 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2436 # Now set the variables for building old libraries.
2437 build_libtool_libs=no
2438 oldlibs="$output"
2439 objs="$objs$old_deplibs"
2442 lib)
2443 # Make sure we only generate libraries of the form `libNAME.la'.
2444 case $outputname in
2445 lib*)
2446 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2447 eval libname=\"$libname_spec\"
2450 if test "$module" = no; then
2451 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2452 $echo "$help" 1>&2
2453 exit 1
2455 if test "$need_lib_prefix" != no; then
2456 # Add the "lib" prefix for modules if required
2457 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2458 eval libname=\"$libname_spec\"
2459 else
2460 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2463 esac
2465 if test -n "$objs"; then
2466 if test "$deplibs_check_method" != pass_all; then
2467 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2468 exit 1
2469 else
2470 echo
2471 echo "*** Warning: Linking the shared library $output against the non-libtool"
2472 echo "*** objects $objs is not portable!"
2473 libobjs="$libobjs $objs"
2477 if test "$dlself" != no; then
2478 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2481 set dummy $rpath
2482 if test $# -gt 2; then
2483 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2485 install_libdir="$2"
2487 oldlibs=
2488 if test -z "$rpath"; then
2489 if test "$build_libtool_libs" = yes; then
2490 # Building a libtool convenience library.
2491 # Some compilers have problems with a `.al' extension so
2492 # convenience libraries should have the same extension an
2493 # archive normally would.
2494 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2495 build_libtool_libs=convenience
2496 build_old_libs=yes
2499 if test -n "$vinfo"; then
2500 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2503 if test -n "$release"; then
2504 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2506 else
2508 # Parse the version information argument.
2509 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2510 set dummy $vinfo 0 0 0
2511 IFS="$save_ifs"
2513 if test -n "$8"; then
2514 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2515 $echo "$help" 1>&2
2516 exit 1
2519 current="$2"
2520 revision="$3"
2521 age="$4"
2523 # Check that each of the things are valid numbers.
2524 case $current in
2525 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2527 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2528 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2529 exit 1
2531 esac
2533 case $revision in
2534 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2536 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2537 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2538 exit 1
2540 esac
2542 case $age in
2543 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2545 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2546 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2547 exit 1
2549 esac
2551 if test $age -gt $current; then
2552 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2553 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2554 exit 1
2557 # Calculate the version variables.
2558 major=
2559 versuffix=
2560 verstring=
2561 case $version_type in
2562 none) ;;
2564 darwin)
2565 # Like Linux, but with the current version available in
2566 # verstring for coding it into the library header
2567 major=.`expr $current - $age`
2568 versuffix="$major.$age.$revision"
2569 # Darwin ld doesn't like 0 for these options...
2570 minor_current=`expr $current + 1`
2571 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2574 freebsd-aout)
2575 major=".$current"
2576 versuffix=".$current.$revision";
2579 freebsd-elf)
2580 major=".$current"
2581 versuffix=".$current";
2584 irix)
2585 major=`expr $current - $age + 1`
2586 verstring="sgi$major.$revision"
2588 # Add in all the interfaces that we are compatible with.
2589 loop=$revision
2590 while test $loop != 0; do
2591 iface=`expr $revision - $loop`
2592 loop=`expr $loop - 1`
2593 verstring="sgi$major.$iface:$verstring"
2594 done
2596 # Before this point, $major must not contain `.'.
2597 major=.$major
2598 versuffix="$major.$revision"
2601 linux)
2602 major=.`expr $current - $age`
2603 versuffix="$major.$age.$revision"
2606 osf)
2607 major=`expr $current - $age`
2608 versuffix=".$current.$age.$revision"
2609 verstring="$current.$age.$revision"
2611 # Add in all the interfaces that we are compatible with.
2612 loop=$age
2613 while test $loop != 0; do
2614 iface=`expr $current - $loop`
2615 loop=`expr $loop - 1`
2616 verstring="$verstring:${iface}.0"
2617 done
2619 # Make executables depend on our current version.
2620 verstring="$verstring:${current}.0"
2623 sunos)
2624 major=".$current"
2625 versuffix=".$current.$revision"
2628 windows)
2629 # Use '-' rather than '.', since we only want one
2630 # extension on DOS 8.3 filesystems.
2631 major=`expr $current - $age`
2632 versuffix="-$major"
2636 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2637 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2638 exit 1
2640 esac
2642 # Clear the version info if we defaulted, and they specified a release.
2643 if test -z "$vinfo" && test -n "$release"; then
2644 major=
2645 verstring="0.0"
2646 if test "$need_version" = no; then
2647 versuffix=
2648 else
2649 versuffix=".0.0"
2653 # Remove version info from name if versioning should be avoided
2654 if test "$avoid_version" = yes && test "$need_version" = no; then
2655 major=
2656 versuffix=
2657 verstring=""
2660 # Check to see if the archive will have undefined symbols.
2661 if test "$allow_undefined" = yes; then
2662 if test "$allow_undefined_flag" = unsupported; then
2663 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2664 build_libtool_libs=no
2665 build_old_libs=yes
2667 else
2668 # Don't allow undefined symbols.
2669 allow_undefined_flag="$no_undefined_flag"
2673 if test "$mode" != relink; then
2674 # Remove our outputs, but don't remove object files since they
2675 # may have been created when compiling PIC objects.
2676 removelist=
2677 tempremovelist=`echo "$output_objdir/*"`
2678 for p in $tempremovelist; do
2679 case $p in
2680 *.$objext)
2682 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2683 removelist="$removelist $p"
2685 *) ;;
2686 esac
2687 done
2688 if test -n "$removelist"; then
2689 $show "${rm}r $removelist"
2690 $run ${rm}r $removelist
2694 # Now set the variables for building old libraries.
2695 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2696 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2698 # Transform .lo files to .o files.
2699 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2702 # Eliminate all temporary directories.
2703 for path in $notinst_path; do
2704 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2705 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2706 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2707 done
2709 if test -n "$xrpath"; then
2710 # If the user specified any rpath flags, then add them.
2711 temp_xrpath=
2712 for libdir in $xrpath; do
2713 temp_xrpath="$temp_xrpath -R$libdir"
2714 case "$finalize_rpath " in
2715 *" $libdir "*) ;;
2716 *) finalize_rpath="$finalize_rpath $libdir" ;;
2717 esac
2718 done
2719 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2720 dependency_libs="$temp_xrpath $dependency_libs"
2724 # Make sure dlfiles contains only unique files that won't be dlpreopened
2725 old_dlfiles="$dlfiles"
2726 dlfiles=
2727 for lib in $old_dlfiles; do
2728 case " $dlprefiles $dlfiles " in
2729 *" $lib "*) ;;
2730 *) dlfiles="$dlfiles $lib" ;;
2731 esac
2732 done
2734 # Make sure dlprefiles contains only unique files
2735 old_dlprefiles="$dlprefiles"
2736 dlprefiles=
2737 for lib in $old_dlprefiles; do
2738 case "$dlprefiles " in
2739 *" $lib "*) ;;
2740 *) dlprefiles="$dlprefiles $lib" ;;
2741 esac
2742 done
2744 if test "$build_libtool_libs" = yes; then
2745 if test -n "$rpath"; then
2746 case $host in
2747 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2748 # these systems don't actually have a c library (as such)!
2750 *-*-rhapsody* | *-*-darwin1.[012])
2751 # Rhapsody C library is in the System framework
2752 deplibs="$deplibs -framework System"
2754 *-*-netbsd*)
2755 # Don't link with libc until the a.out ld.so is fixed.
2758 # Add libc to deplibs on all other systems if necessary.
2759 if test $build_libtool_need_lc = "yes"; then
2760 deplibs="$deplibs -lc"
2763 esac
2766 # Transform deplibs into only deplibs that can be linked in shared.
2767 name_save=$name
2768 libname_save=$libname
2769 release_save=$release
2770 versuffix_save=$versuffix
2771 major_save=$major
2772 # I'm not sure if I'm treating the release correctly. I think
2773 # release should show up in the -l (ie -lgmp5) so we don't want to
2774 # add it in twice. Is that correct?
2775 release=""
2776 versuffix=""
2777 major=""
2778 newdeplibs=
2779 droppeddeps=no
2780 case $deplibs_check_method in
2781 pass_all)
2782 # Don't check for shared/static. Everything works.
2783 # This might be a little naive. We might want to check
2784 # whether the library exists or not. But this is on
2785 # osf3 & osf4 and I'm not really sure... Just
2786 # implementing what was already the behaviour.
2787 newdeplibs=$deplibs
2789 test_compile)
2790 # This code stresses the "libraries are programs" paradigm to its
2791 # limits. Maybe even breaks it. We compile a program, linking it
2792 # against the deplibs as a proxy for the library. Then we can check
2793 # whether they linked in statically or dynamically with ldd.
2794 $rm conftest.c
2795 cat > conftest.c <<EOF
2796 int main() { return 0; }
2798 $rm conftest
2799 $LTCC -o conftest conftest.c $deplibs
2800 if test $? -eq 0 ; then
2801 ldd_output=`ldd conftest`
2802 for i in $deplibs; do
2803 name="`expr $i : '-l\(.*\)'`"
2804 # If $name is empty we are operating on a -L argument.
2805 if test -n "$name" && test "$name" != "0"; then
2806 libname=`eval \\$echo \"$libname_spec\"`
2807 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2808 set dummy $deplib_matches
2809 deplib_match=$2
2810 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2811 newdeplibs="$newdeplibs $i"
2812 else
2813 droppeddeps=yes
2814 echo
2815 echo "*** Warning: This library needs some functionality provided by $i."
2816 echo "*** I have the capability to make that library automatically link in when"
2817 echo "*** you link to this library. But I can only do this if you have a"
2818 echo "*** shared version of the library, which you do not appear to have."
2820 else
2821 newdeplibs="$newdeplibs $i"
2823 done
2824 else
2825 # Error occured in the first compile. Let's try to salvage the situation:
2826 # Compile a seperate program for each library.
2827 for i in $deplibs; do
2828 name="`expr $i : '-l\(.*\)'`"
2829 # If $name is empty we are operating on a -L argument.
2830 if test -n "$name" && test "$name" != "0"; then
2831 $rm conftest
2832 $LTCC -o conftest conftest.c $i
2833 # Did it work?
2834 if test $? -eq 0 ; then
2835 ldd_output=`ldd conftest`
2836 libname=`eval \\$echo \"$libname_spec\"`
2837 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2838 set dummy $deplib_matches
2839 deplib_match=$2
2840 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2841 newdeplibs="$newdeplibs $i"
2842 else
2843 droppeddeps=yes
2844 echo
2845 echo "*** Warning: This library needs some functionality provided by $i."
2846 echo "*** I have the capability to make that library automatically link in when"
2847 echo "*** you link to this library. But I can only do this if you have a"
2848 echo "*** shared version of the library, which you do not appear to have."
2850 else
2851 droppeddeps=yes
2852 echo
2853 echo "*** Warning! Library $i is needed by this library but I was not able to"
2854 echo "*** make it link in! You will probably need to install it or some"
2855 echo "*** library that it depends on before this library will be fully"
2856 echo "*** functional. Installing it before continuing would be even better."
2858 else
2859 newdeplibs="$newdeplibs $i"
2861 done
2864 file_magic*)
2865 set dummy $deplibs_check_method
2866 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2867 for a_deplib in $deplibs; do
2868 name="`expr $a_deplib : '-l\(.*\)'`"
2869 # If $name is empty we are operating on a -L argument.
2870 if test -n "$name" && test "$name" != "0"; then
2871 libname=`eval \\$echo \"$libname_spec\"`
2872 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2873 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2874 for potent_lib in $potential_libs; do
2875 # Follow soft links.
2876 if ls -lLd "$potent_lib" 2>/dev/null \
2877 | grep " -> " >/dev/null; then
2878 continue
2880 # The statement above tries to avoid entering an
2881 # endless loop below, in case of cyclic links.
2882 # We might still enter an endless loop, since a link
2883 # loop can be closed while we follow links,
2884 # but so what?
2885 potlib="$potent_lib"
2886 while test -h "$potlib" 2>/dev/null; do
2887 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2888 case $potliblink in
2889 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2890 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2891 esac
2892 done
2893 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2894 | sed 10q \
2895 | egrep "$file_magic_regex" > /dev/null; then
2896 newdeplibs="$newdeplibs $a_deplib"
2897 a_deplib=""
2898 break 2
2900 done
2901 done
2902 if test -n "$a_deplib" ; then
2903 droppeddeps=yes
2904 echo
2905 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2906 echo "*** I have the capability to make that library automatically link in when"
2907 echo "*** you link to this library. But I can only do this if you have a"
2908 echo "*** shared version of the library, which you do not appear to have."
2910 else
2911 # Add a -L argument.
2912 newdeplibs="$newdeplibs $a_deplib"
2914 done # Gone through all deplibs.
2916 match_pattern*)
2917 set dummy $deplibs_check_method
2918 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2919 for a_deplib in $deplibs; do
2920 name="`expr $a_deplib : '-l\(.*\)'`"
2921 # If $name is empty we are operating on a -L argument.
2922 if test -n "$name" && test "$name" != "0"; then
2923 libname=`eval \\$echo \"$libname_spec\"`
2924 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2925 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2926 for potent_lib in $potential_libs; do
2927 if eval echo \"$potent_lib\" 2>/dev/null \
2928 | sed 10q \
2929 | egrep "$match_pattern_regex" > /dev/null; then
2930 newdeplibs="$newdeplibs $a_deplib"
2931 a_deplib=""
2932 break 2
2934 done
2935 done
2936 if test -n "$a_deplib" ; then
2937 droppeddeps=yes
2938 echo
2939 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2940 echo "*** I have the capability to make that library automatically link in when"
2941 echo "*** you link to this library. But I can only do this if you have a"
2942 echo "*** shared version of the library, which you do not appear to have."
2944 else
2945 # Add a -L argument.
2946 newdeplibs="$newdeplibs $a_deplib"
2948 done # Gone through all deplibs.
2950 none | unknown | *)
2951 newdeplibs=""
2952 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2953 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2954 grep . >/dev/null; then
2955 echo
2956 if test "X$deplibs_check_method" = "Xnone"; then
2957 echo "*** Warning: inter-library dependencies are not supported in this platform."
2958 else
2959 echo "*** Warning: inter-library dependencies are not known to be supported."
2961 echo "*** All declared inter-library dependencies are being dropped."
2962 droppeddeps=yes
2965 esac
2966 versuffix=$versuffix_save
2967 major=$major_save
2968 release=$release_save
2969 libname=$libname_save
2970 name=$name_save
2972 case $host in
2973 *-*-rhapsody* | *-*-darwin1.[012])
2974 # On Rhapsody replace the C library is the System framework
2975 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2977 esac
2979 if test "$droppeddeps" = yes; then
2980 if test "$module" = yes; then
2981 echo
2982 echo "*** Warning: libtool could not satisfy all declared inter-library"
2983 echo "*** dependencies of module $libname. Therefore, libtool will create"
2984 echo "*** a static module, that should work as long as the dlopening"
2985 echo "*** application is linked with the -dlopen flag."
2986 if test -z "$global_symbol_pipe"; then
2987 echo
2988 echo "*** However, this would only work if libtool was able to extract symbol"
2989 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2990 echo "*** not find such a program. So, this module is probably useless."
2991 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2993 if test "$build_old_libs" = no; then
2994 oldlibs="$output_objdir/$libname.$libext"
2995 build_libtool_libs=module
2996 build_old_libs=yes
2997 else
2998 build_libtool_libs=no
3000 else
3001 echo "*** The inter-library dependencies that have been dropped here will be"
3002 echo "*** automatically added whenever a program is linked with this library"
3003 echo "*** or is declared to -dlopen it."
3005 if test $allow_undefined = no; then
3006 echo
3007 echo "*** Since this library must not contain undefined symbols,"
3008 echo "*** because either the platform does not support them or"
3009 echo "*** it was explicitly requested with -no-undefined,"
3010 echo "*** libtool will only create a static version of it."
3011 if test "$build_old_libs" = no; then
3012 oldlibs="$output_objdir/$libname.$libext"
3013 build_libtool_libs=module
3014 build_old_libs=yes
3015 else
3016 build_libtool_libs=no
3021 # Done checking deplibs!
3022 deplibs=$newdeplibs
3025 # All the library-specific variables (install_libdir is set above).
3026 library_names=
3027 old_library=
3028 dlname=
3030 # Test again, we may have decided not to build it any more
3031 if test "$build_libtool_libs" = yes; then
3032 if test $hardcode_into_libs = yes; then
3033 # Hardcode the library paths
3034 hardcode_libdirs=
3035 dep_rpath=
3036 rpath="$finalize_rpath"
3037 test "$mode" != relink && rpath="$compile_rpath$rpath"
3038 for libdir in $rpath; do
3039 if test -n "$hardcode_libdir_flag_spec"; then
3040 if test -n "$hardcode_libdir_separator"; then
3041 if test -z "$hardcode_libdirs"; then
3042 hardcode_libdirs="$libdir"
3043 else
3044 # Just accumulate the unique libdirs.
3045 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3046 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3049 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3051 esac
3053 else
3054 eval flag=\"$hardcode_libdir_flag_spec\"
3055 dep_rpath="$dep_rpath $flag"
3057 elif test -n "$runpath_var"; then
3058 case "$perm_rpath " in
3059 *" $libdir "*) ;;
3060 *) perm_rpath="$perm_rpath $libdir" ;;
3061 esac
3063 done
3064 # Substitute the hardcoded libdirs into the rpath.
3065 if test -n "$hardcode_libdir_separator" &&
3066 test -n "$hardcode_libdirs"; then
3067 libdir="$hardcode_libdirs"
3068 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3070 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3071 # We should set the runpath_var.
3072 rpath=
3073 for dir in $perm_rpath; do
3074 rpath="$rpath$dir:"
3075 done
3076 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3078 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3081 shlibpath="$finalize_shlibpath"
3082 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3083 if test -n "$shlibpath"; then
3084 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3087 # Get the real and link names of the library.
3088 eval library_names=\"$library_names_spec\"
3089 set dummy $library_names
3090 realname="$2"
3091 shift; shift
3093 if test -n "$soname_spec"; then
3094 eval soname=\"$soname_spec\"
3095 else
3096 soname="$realname"
3098 test -z "$dlname" && dlname=$soname
3100 lib="$output_objdir/$realname"
3101 for link
3103 linknames="$linknames $link"
3104 done
3106 # # Ensure that we have .o objects for linkers which dislike .lo
3107 # # (e.g. aix) in case we are running --disable-static
3108 # for obj in $libobjs; do
3109 # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3110 # if test "X$xdir" = "X$obj"; then
3111 # xdir="."
3112 # else
3113 # xdir="$xdir"
3114 # fi
3115 # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3116 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3117 # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
3118 # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3119 # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3120 # fi
3121 # done
3123 # Use standard objects if they are pic
3124 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3126 # Prepare the list of exported symbols
3127 if test -z "$export_symbols"; then
3128 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3129 $show "generating symbol list for \`$libname.la'"
3130 export_symbols="$output_objdir/$libname.exp"
3131 $run $rm $export_symbols
3132 eval cmds=\"$export_symbols_cmds\"
3133 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3134 for cmd in $cmds; do
3135 IFS="$save_ifs"
3136 $show "$cmd"
3137 $run eval "$cmd" || exit $?
3138 done
3139 IFS="$save_ifs"
3140 if test -n "$export_symbols_regex"; then
3141 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3142 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3143 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3144 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3149 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3150 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3153 if test -n "$convenience"; then
3154 if test -n "$whole_archive_flag_spec"; then
3155 save_libobjs=$libobjs
3156 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3157 else
3158 gentop="$output_objdir/${outputname}x"
3159 $show "${rm}r $gentop"
3160 $run ${rm}r "$gentop"
3161 $show "$mkdir $gentop"
3162 $run $mkdir "$gentop"
3163 status=$?
3164 if test $status -ne 0 && test ! -d "$gentop"; then
3165 exit $status
3167 generated="$generated $gentop"
3169 for xlib in $convenience; do
3170 # Extract the objects.
3171 case $xlib in
3172 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3173 *) xabs=`pwd`"/$xlib" ;;
3174 esac
3175 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3176 xdir="$gentop/$xlib"
3178 $show "${rm}r $xdir"
3179 $run ${rm}r "$xdir"
3180 $show "$mkdir $xdir"
3181 $run $mkdir "$xdir"
3182 status=$?
3183 if test $status -ne 0 && test ! -d "$xdir"; then
3184 exit $status
3186 $show "(cd $xdir && $AR x $xabs)"
3187 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3189 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3190 done
3194 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3195 eval flag=\"$thread_safe_flag_spec\"
3196 linker_flags="$linker_flags $flag"
3199 # Make a backup of the uninstalled library when relinking
3200 if test "$mode" = relink; then
3201 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3204 # Do each of the archive commands.
3205 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3206 eval cmds=\"$archive_expsym_cmds\"
3207 else
3208 eval cmds=\"$archive_cmds\"
3210 if len=`expr "X$cmds" : ".*"` &&
3211 test $len -le $max_cmd_len; then
3213 else
3214 # The command line is too long to link in one step, link piecewise.
3215 $echo "creating reloadable object files..."
3217 # Save the value of $output and $libobjs because we want to
3218 # use them later. If we have whole_archive_flag_spec, we
3219 # want to use save_libobjs as it was before
3220 # whole_archive_flag_spec was expanded, because we can't
3221 # assume the linker understands whole_archive_flag_spec.
3222 # This may have to be revisited, in case too many
3223 # convenience libraries get linked in and end up exceeding
3224 # the spec.
3225 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3226 save_libobjs=$libobjs
3228 save_output=$output
3230 # Clear the reloadable object creation command queue and
3231 # initialize k to one.
3232 test_cmds=
3233 concat_cmds=
3234 objlist=
3235 delfiles=
3236 last_robj=
3238 output=$output_objdir/$save_output-${k}.$objext
3239 # Loop over the list of objects to be linked.
3240 for obj in $save_libobjs
3242 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3243 if test "X$objlist" = X ||
3244 { len=`expr "X$test_cmds" : ".*"` &&
3245 test $len -le $max_cmd_len; }; then
3246 objlist="$objlist $obj"
3247 else
3248 # The command $test_cmds is almost too long, add a
3249 # command to the queue.
3250 if test $k -eq 1 ; then
3251 # The first file doesn't have a previous command to add.
3252 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3253 else
3254 # All subsequent reloadable object files will link in
3255 # the last one created.
3256 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3258 last_robj=$output_objdir/$save_output-${k}.$objext
3259 k=`expr $k + 1`
3260 output=$output_objdir/$save_output-${k}.$objext
3261 objlist=$obj
3262 len=1
3264 done
3265 # Handle the remaining objects by creating one last
3266 # reloadable object file. All subsequent reloadable object
3267 # files will link in the last one created.
3268 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3269 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3271 # Set up a command to remove the reloadale object files
3272 # after they are used.
3274 while test $i -lt $k
3276 i=`expr $i + 1`
3277 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3278 done
3280 $echo "creating a temporary reloadable object file: $output"
3282 # Loop through the commands generated above and execute them.
3283 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3284 for cmd in $concat_cmds; do
3285 IFS="$save_ifs"
3286 $show "$cmd"
3287 $run eval "$cmd" || exit $?
3288 done
3289 IFS="$save_ifs"
3291 libobjs=$output
3292 # Restore the value of output.
3293 output=$save_output
3295 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3296 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3298 # Expand the library linking commands again to reset the
3299 # value of $libobjs for piecewise linking.
3301 # Do each of the archive commands.
3302 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3303 eval cmds=\"$archive_expsym_cmds\"
3304 else
3305 eval cmds=\"$archive_cmds\"
3308 # Append the command to remove the reloadable object files
3309 # to the just-reset $cmds.
3310 eval cmds=\"\$cmds~$rm $delfiles\"
3312 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3313 for cmd in $cmds; do
3314 IFS="$save_ifs"
3315 $show "$cmd"
3316 $run eval "$cmd" || exit $?
3317 done
3318 IFS="$save_ifs"
3320 # Restore the uninstalled library and exit
3321 if test "$mode" = relink; then
3322 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3323 exit 0
3326 # Create links to the real library.
3327 for linkname in $linknames; do
3328 if test "$realname" != "$linkname"; then
3329 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3330 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3332 done
3334 # If -module or -export-dynamic was specified, set the dlname.
3335 if test "$module" = yes || test "$export_dynamic" = yes; then
3336 # On all known operating systems, these are identical.
3337 dlname="$soname"
3342 obj)
3343 if test -n "$deplibs"; then
3344 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3347 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3348 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3351 if test -n "$rpath"; then
3352 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3355 if test -n "$xrpath"; then
3356 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3359 if test -n "$vinfo"; then
3360 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3363 if test -n "$release"; then
3364 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3367 case $output in
3368 *.lo)
3369 if test -n "$objs$old_deplibs"; then
3370 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3371 exit 1
3373 libobj="$output"
3374 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3377 libobj=
3378 obj="$output"
3380 esac
3382 # Delete the old objects.
3383 $run $rm $obj $libobj
3385 # Objects from convenience libraries. This assumes
3386 # single-version convenience libraries. Whenever we create
3387 # different ones for PIC/non-PIC, this we'll have to duplicate
3388 # the extraction.
3389 reload_conv_objs=
3390 gentop=
3391 # reload_cmds runs $LD directly, so let us get rid of
3392 # -Wl from whole_archive_flag_spec
3395 if test -n "$convenience"; then
3396 if test -n "$whole_archive_flag_spec"; then
3397 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3398 else
3399 gentop="$output_objdir/${obj}x"
3400 $show "${rm}r $gentop"
3401 $run ${rm}r "$gentop"
3402 $show "$mkdir $gentop"
3403 $run $mkdir "$gentop"
3404 status=$?
3405 if test $status -ne 0 && test ! -d "$gentop"; then
3406 exit $status
3408 generated="$generated $gentop"
3410 for xlib in $convenience; do
3411 # Extract the objects.
3412 case $xlib in
3413 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3414 *) xabs=`pwd`"/$xlib" ;;
3415 esac
3416 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3417 xdir="$gentop/$xlib"
3419 $show "${rm}r $xdir"
3420 $run ${rm}r "$xdir"
3421 $show "$mkdir $xdir"
3422 $run $mkdir "$xdir"
3423 status=$?
3424 if test $status -ne 0 && test ! -d "$xdir"; then
3425 exit $status
3427 $show "(cd $xdir && $AR x $xabs)"
3428 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3430 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3431 done
3435 # Create the old-style object.
3436 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
3438 output="$obj"
3439 eval cmds=\"$reload_cmds\"
3440 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3441 for cmd in $cmds; do
3442 IFS="$save_ifs"
3443 $show "$cmd"
3444 $run eval "$cmd" || exit $?
3445 done
3446 IFS="$save_ifs"
3448 # Exit if we aren't doing a library object file.
3449 if test -z "$libobj"; then
3450 if test -n "$gentop"; then
3451 $show "${rm}r $gentop"
3452 $run ${rm}r $gentop
3455 exit 0
3458 if test "$build_libtool_libs" != yes; then
3459 if test -n "$gentop"; then
3460 $show "${rm}r $gentop"
3461 $run ${rm}r $gentop
3464 # Create an invalid libtool object if no PIC, so that we don't
3465 # accidentally link it into a program.
3466 # $show "echo timestamp > $libobj"
3467 # $run eval "echo timestamp > $libobj" || exit $?
3468 exit 0
3471 if test -n "$pic_flag" || test "$pic_mode" != default; then
3472 # Only do commands if we really have different PIC objects.
3473 reload_objs="$libobjs $reload_conv_objs"
3474 output="$libobj"
3475 eval cmds=\"$reload_cmds\"
3476 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3477 for cmd in $cmds; do
3478 IFS="$save_ifs"
3479 $show "$cmd"
3480 $run eval "$cmd" || exit $?
3481 done
3482 IFS="$save_ifs"
3483 # else
3484 # # Just create a symlink.
3485 # $show $rm $libobj
3486 # $run $rm $libobj
3487 # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3488 # if test "X$xdir" = "X$libobj"; then
3489 # xdir="."
3490 # else
3491 # xdir="$xdir"
3492 # fi
3493 # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3494 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3495 # $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3496 # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3499 if test -n "$gentop"; then
3500 $show "${rm}r $gentop"
3501 $run ${rm}r $gentop
3504 exit 0
3507 prog)
3508 case $host in
3509 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3510 esac
3511 if test -n "$vinfo"; then
3512 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3515 if test -n "$release"; then
3516 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3519 if test "$preload" = yes; then
3520 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3521 test "$dlopen_self_static" = unknown; then
3522 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3526 case $host in
3527 *-*-rhapsody* | *-*-darwin1.[012])
3528 # On Rhapsody replace the C library is the System framework
3529 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3530 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3532 esac
3534 compile_command="$compile_command $compile_deplibs"
3535 finalize_command="$finalize_command $finalize_deplibs"
3537 if test -n "$rpath$xrpath"; then
3538 # If the user specified any rpath flags, then add them.
3539 for libdir in $rpath $xrpath; do
3540 # This is the magic to use -rpath.
3541 case "$finalize_rpath " in
3542 *" $libdir "*) ;;
3543 *) finalize_rpath="$finalize_rpath $libdir" ;;
3544 esac
3545 done
3548 # Now hardcode the library paths
3549 rpath=
3550 hardcode_libdirs=
3551 for libdir in $compile_rpath $finalize_rpath; do
3552 if test -n "$hardcode_libdir_flag_spec"; then
3553 if test -n "$hardcode_libdir_separator"; then
3554 if test -z "$hardcode_libdirs"; then
3555 hardcode_libdirs="$libdir"
3556 else
3557 # Just accumulate the unique libdirs.
3558 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3559 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3562 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3564 esac
3566 else
3567 eval flag=\"$hardcode_libdir_flag_spec\"
3568 rpath="$rpath $flag"
3570 elif test -n "$runpath_var"; then
3571 case "$perm_rpath " in
3572 *" $libdir "*) ;;
3573 *) perm_rpath="$perm_rpath $libdir" ;;
3574 esac
3576 case $host in
3577 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3578 case :$dllsearchpath: in
3579 *":$libdir:"*) ;;
3580 *) dllsearchpath="$dllsearchpath:$libdir";;
3581 esac
3583 esac
3584 done
3585 # Substitute the hardcoded libdirs into the rpath.
3586 if test -n "$hardcode_libdir_separator" &&
3587 test -n "$hardcode_libdirs"; then
3588 libdir="$hardcode_libdirs"
3589 eval rpath=\" $hardcode_libdir_flag_spec\"
3591 compile_rpath="$rpath"
3593 rpath=
3594 hardcode_libdirs=
3595 for libdir in $finalize_rpath; do
3596 if test -n "$hardcode_libdir_flag_spec"; then
3597 if test -n "$hardcode_libdir_separator"; then
3598 if test -z "$hardcode_libdirs"; then
3599 hardcode_libdirs="$libdir"
3600 else
3601 # Just accumulate the unique libdirs.
3602 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3603 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3606 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3608 esac
3610 else
3611 eval flag=\"$hardcode_libdir_flag_spec\"
3612 rpath="$rpath $flag"
3614 elif test -n "$runpath_var"; then
3615 case "$finalize_perm_rpath " in
3616 *" $libdir "*) ;;
3617 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3618 esac
3620 done
3621 # Substitute the hardcoded libdirs into the rpath.
3622 if test -n "$hardcode_libdir_separator" &&
3623 test -n "$hardcode_libdirs"; then
3624 libdir="$hardcode_libdirs"
3625 eval rpath=\" $hardcode_libdir_flag_spec\"
3627 finalize_rpath="$rpath"
3629 dlsyms=
3630 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3631 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3632 dlsyms="${outputname}S.c"
3633 else
3634 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3638 if test -n "$dlsyms"; then
3639 case $dlsyms in
3640 "") ;;
3641 *.c)
3642 # Discover the nlist of each of the dlfiles.
3643 nlist="$output_objdir/${outputname}.nm"
3645 $show "$rm $nlist ${nlist}S ${nlist}T"
3646 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3648 # Parse the name list into a source file.
3649 $show "creating $output_objdir/$dlsyms"
3651 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3652 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3653 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3655 #ifdef __cplusplus
3656 extern \"C\" {
3657 #endif
3659 /* Prevent the only kind of declaration conflicts we can make. */
3660 #define lt_preloaded_symbols some_other_symbol
3662 /* External symbol declarations for the compiler. */\
3665 if test "$dlself" = yes; then
3666 $show "generating symbol list for \`$output'"
3668 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3670 # Add our own program objects to the symbol list.
3671 progfiles="$objs$old_deplibs"
3672 for arg in $progfiles; do
3673 $show "extracting global C symbols from \`$arg'"
3674 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3675 done
3677 if test -n "$exclude_expsyms"; then
3678 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3679 $run eval '$mv "$nlist"T "$nlist"'
3682 if test -n "$export_symbols_regex"; then
3683 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3684 $run eval '$mv "$nlist"T "$nlist"'
3687 # Prepare the list of exported symbols
3688 if test -z "$export_symbols"; then
3689 export_symbols="$output_objdir/$output.exp"
3690 $run $rm $export_symbols
3691 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3692 else
3693 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3694 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3695 $run eval 'mv "$nlist"T "$nlist"'
3699 for arg in $dlprefiles; do
3700 $show "extracting global C symbols from \`$arg'"
3701 name=`echo "$arg" | sed -e 's%^.*/%%'`
3702 $run eval 'echo ": $name " >> "$nlist"'
3703 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3704 done
3706 if test -z "$run"; then
3707 # Make sure we have at least an empty file.
3708 test -f "$nlist" || : > "$nlist"
3710 if test -n "$exclude_expsyms"; then
3711 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3712 $mv "$nlist"T "$nlist"
3715 # Try sorting and uniquifying the output.
3716 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3718 else
3719 grep -v "^: " < "$nlist" > "$nlist"S
3722 if test -f "$nlist"S; then
3723 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3724 else
3725 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3728 $echo >> "$output_objdir/$dlsyms" "\
3730 #undef lt_preloaded_symbols
3732 #if defined (__STDC__) && __STDC__
3733 # define lt_ptr_t void *
3734 #else
3735 # define lt_ptr_t char *
3736 # define const
3737 #endif
3739 /* The mapping between symbol names and symbols. */
3740 const struct {
3741 const char *name;
3742 lt_ptr_t address;
3744 lt_preloaded_symbols[] =
3748 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3749 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3750 < "$nlist" >> "$output_objdir/$dlsyms"
3752 $echo >> "$output_objdir/$dlsyms" "\
3753 {0, (lt_ptr_t) 0}
3756 /* This works around a problem in FreeBSD linker */
3757 #ifdef FREEBSD_WORKAROUND
3758 static const void *lt_preloaded_setup() {
3759 return lt_preloaded_symbols;
3761 #endif
3763 #ifdef __cplusplus
3765 #endif\
3769 pic_flag_for_symtable=
3770 case $host in
3771 # compiling the symbol table file with pic_flag works around
3772 # a FreeBSD bug that causes programs to crash when -lm is
3773 # linked before any other PIC object. But we must not use
3774 # pic_flag when linking with -static. The problem exists in
3775 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3776 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3777 case "$compile_command " in
3778 *" -static "*) ;;
3779 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3780 esac;;
3781 *-*-hpux*)
3782 case "$compile_command " in
3783 *" -static "*) ;;
3784 *) pic_flag_for_symtable=" $pic_flag";;
3785 esac
3786 esac
3788 # Now compile the dynamic symbol file.
3789 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3790 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3792 # Clean up the generated files.
3793 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3794 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3796 # Transform the symbol file into the correct name.
3797 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3798 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3801 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3802 exit 1
3804 esac
3805 else
3806 # We keep going just in case the user didn't refer to
3807 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3808 # really was required.
3810 # Nullify the symbol file.
3811 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3812 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3815 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3816 # Replace the output file specification.
3817 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3818 link_command="$compile_command$compile_rpath"
3820 # We have no uninstalled library dependencies, so finalize right now.
3821 $show "$link_command"
3822 $run eval "$link_command"
3823 status=$?
3825 # Delete the generated files.
3826 if test -n "$dlsyms"; then
3827 $show "$rm $output_objdir/${outputname}S.${objext}"
3828 $run $rm "$output_objdir/${outputname}S.${objext}"
3831 exit $status
3834 if test -n "$shlibpath_var"; then
3835 # We should set the shlibpath_var
3836 rpath=
3837 for dir in $temp_rpath; do
3838 case $dir in
3839 [\\/]* | [A-Za-z]:[\\/]*)
3840 # Absolute path.
3841 rpath="$rpath$dir:"
3844 # Relative path: add a thisdir entry.
3845 rpath="$rpath\$thisdir/$dir:"
3847 esac
3848 done
3849 temp_rpath="$rpath"
3852 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3853 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3855 if test -n "$finalize_shlibpath"; then
3856 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3859 compile_var=
3860 finalize_var=
3861 if test -n "$runpath_var"; then
3862 if test -n "$perm_rpath"; then
3863 # We should set the runpath_var.
3864 rpath=
3865 for dir in $perm_rpath; do
3866 rpath="$rpath$dir:"
3867 done
3868 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3870 if test -n "$finalize_perm_rpath"; then
3871 # We should set the runpath_var.
3872 rpath=
3873 for dir in $finalize_perm_rpath; do
3874 rpath="$rpath$dir:"
3875 done
3876 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3880 if test "$no_install" = yes; then
3881 # We don't need to create a wrapper script.
3882 link_command="$compile_var$compile_command$compile_rpath"
3883 # Replace the output file specification.
3884 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3885 # Delete the old output file.
3886 $run $rm $output
3887 # Link the executable and exit
3888 $show "$link_command"
3889 $run eval "$link_command" || exit $?
3890 exit 0
3893 if test "$hardcode_action" = relink; then
3894 # Fast installation is not supported
3895 link_command="$compile_var$compile_command$compile_rpath"
3896 relink_command="$finalize_var$finalize_command$finalize_rpath"
3898 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3899 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3900 else
3901 if test "$fast_install" != no; then
3902 link_command="$finalize_var$compile_command$finalize_rpath"
3903 if test "$fast_install" = yes; then
3904 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3905 else
3906 # fast_install is set to needless
3907 relink_command=
3909 else
3910 link_command="$compile_var$compile_command$compile_rpath"
3911 relink_command="$finalize_var$finalize_command$finalize_rpath"
3915 # Replace the output file specification.
3916 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3918 # Delete the old output files.
3919 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3921 $show "$link_command"
3922 $run eval "$link_command" || exit $?
3924 # Now create the wrapper script.
3925 $show "creating $output"
3927 # Quote the relink command for shipping.
3928 if test -n "$relink_command"; then
3929 # Preserve any variables that may affect compiler behavior
3930 for var in $variables_saved_for_relink; do
3931 if eval test -z \"\${$var+set}\"; then
3932 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3933 elif eval var_value=\$$var; test -z "$var_value"; then
3934 relink_command="$var=; export $var; $relink_command"
3935 else
3936 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3937 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3939 done
3940 relink_command="cd `pwd`; $relink_command"
3941 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3944 # Quote $echo for shipping.
3945 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3946 case $0 in
3947 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3948 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3949 esac
3950 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3951 else
3952 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3955 # Only actually do things if our run command is non-null.
3956 if test -z "$run"; then
3957 # win32 will think the script is a binary if it has
3958 # a .exe suffix, so we strip it off here.
3959 case $output in
3960 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3961 esac
3962 # test for cygwin because mv fails w/o .exe extensions
3963 case $host in
3964 *cygwin*) exeext=.exe ;;
3965 *) exeext= ;;
3966 esac
3967 $rm $output
3968 trap "$rm $output; exit 1" 1 2 15
3970 $echo > $output "\
3971 #! $SHELL
3973 # $output - temporary wrapper script for $objdir/$outputname
3974 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3976 # The $output program cannot be directly executed until all the libtool
3977 # libraries that it depends on are installed.
3979 # This wrapper script should never be moved out of the build directory.
3980 # If it is, it will not operate correctly.
3982 # Sed substitution that helps us do robust quoting. It backslashifies
3983 # metacharacters that are still active within double-quoted strings.
3984 Xsed='sed -e 1s/^X//'
3985 sed_quote_subst='$sed_quote_subst'
3987 # The HP-UX ksh and POSIX shell print the target directory to stdout
3988 # if CDPATH is set.
3989 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3991 relink_command=\"$relink_command\"
3993 # This environment variable determines our operation mode.
3994 if test \"\$libtool_install_magic\" = \"$magic\"; then
3995 # install mode needs the following variable:
3996 notinst_deplibs='$notinst_deplibs'
3997 else
3998 # When we are sourced in execute mode, \$file and \$echo are already set.
3999 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4000 echo=\"$qecho\"
4001 file=\"\$0\"
4002 # Make sure echo works.
4003 if test \"X\$1\" = X--no-reexec; then
4004 # Discard the --no-reexec flag, and continue.
4005 shift
4006 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4007 # Yippee, \$echo works!
4009 else
4010 # Restart under the correct shell, and then maybe \$echo will work.
4011 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4015 $echo >> $output "\
4017 # Find the directory that this script lives in.
4018 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4019 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4021 # Follow symbolic links until we get to the real thisdir.
4022 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
4023 while test -n \"\$file\"; do
4024 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4026 # If there was a directory component, then change thisdir.
4027 if test \"x\$destdir\" != \"x\$file\"; then
4028 case \"\$destdir\" in
4029 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4030 *) thisdir=\"\$thisdir/\$destdir\" ;;
4031 esac
4034 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4035 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
4036 done
4038 # Try to get the absolute directory name.
4039 absdir=\`cd \"\$thisdir\" && pwd\`
4040 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4043 if test "$fast_install" = yes; then
4044 echo >> $output "\
4045 program=lt-'$outputname'$exeext
4046 progdir=\"\$thisdir/$objdir\"
4048 if test ! -f \"\$progdir/\$program\" || \\
4049 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
4050 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4052 file=\"\$\$-\$program\"
4054 if test ! -d \"\$progdir\"; then
4055 $mkdir \"\$progdir\"
4056 else
4057 $rm \"\$progdir/\$file\"
4060 echo >> $output "\
4062 # relink executable if necessary
4063 if test -n \"\$relink_command\"; then
4064 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4065 else
4066 $echo \"\$relink_command_output\" >&2
4067 $rm \"\$progdir/\$file\"
4068 exit 1
4072 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4073 { $rm \"\$progdir/\$program\";
4074 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4075 $rm \"\$progdir/\$file\"
4077 else
4078 echo >> $output "\
4079 program='$outputname'
4080 progdir=\"\$thisdir/$objdir\"
4084 echo >> $output "\
4086 if test -f \"\$progdir/\$program\"; then"
4088 # Export our shlibpath_var if we have one.
4089 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4090 $echo >> $output "\
4091 # Add our own library path to $shlibpath_var
4092 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4094 # Some systems cannot cope with colon-terminated $shlibpath_var
4095 # The second colon is a workaround for a bug in BeOS R4 sed
4096 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4098 export $shlibpath_var
4102 # fixup the dll searchpath if we need to.
4103 if test -n "$dllsearchpath"; then
4104 $echo >> $output "\
4105 # Add the dll search path components to the executable PATH
4106 PATH=$dllsearchpath:\$PATH
4110 $echo >> $output "\
4111 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4112 # Run the actual program with our arguments.
4114 case $host in
4115 # win32 systems need to use the prog path for dll
4116 # lookup to work
4117 *-*-cygwin* | *-*-pw32*)
4118 $echo >> $output "\
4119 exec \$progdir/\$program \${1+\"\$@\"}
4123 # Backslashes separate directories on plain windows
4124 *-*-mingw | *-*-os2*)
4125 $echo >> $output "\
4126 exec \$progdir\\\\\$program \${1+\"\$@\"}
4131 $echo >> $output "\
4132 # Export the path to the program.
4133 PATH=\"\$progdir:\$PATH\"
4134 export PATH
4136 exec \$program \${1+\"\$@\"}
4139 esac
4140 $echo >> $output "\
4141 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4142 exit 1
4144 else
4145 # The program doesn't exist.
4146 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4147 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4148 echo \"See the $PACKAGE documentation for more information.\" 1>&2
4149 exit 1
4153 chmod +x $output
4155 exit 0
4157 esac
4159 # See if we need to build an old-fashioned archive.
4160 for oldlib in $oldlibs; do
4162 if test "$build_libtool_libs" = convenience; then
4163 oldobjs="$libobjs_save"
4164 addlibs="$convenience"
4165 build_libtool_libs=no
4166 else
4167 if test "$build_libtool_libs" = module; then
4168 oldobjs="$libobjs_save"
4169 build_libtool_libs=no
4170 else
4171 oldobjs="$objs$old_deplibs $non_pic_objects"
4173 addlibs="$old_convenience"
4176 if test -n "$addlibs"; then
4177 gentop="$output_objdir/${outputname}x"
4178 $show "${rm}r $gentop"
4179 $run ${rm}r "$gentop"
4180 $show "$mkdir $gentop"
4181 $run $mkdir "$gentop"
4182 status=$?
4183 if test $status -ne 0 && test ! -d "$gentop"; then
4184 exit $status
4186 generated="$generated $gentop"
4188 # Add in members from convenience archives.
4189 for xlib in $addlibs; do
4190 # Extract the objects.
4191 case $xlib in
4192 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4193 *) xabs=`pwd`"/$xlib" ;;
4194 esac
4195 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4196 xdir="$gentop/$xlib"
4198 $show "${rm}r $xdir"
4199 $run ${rm}r "$xdir"
4200 $show "$mkdir $xdir"
4201 $run $mkdir "$xdir"
4202 status=$?
4203 if test $status -ne 0 && test ! -d "$xdir"; then
4204 exit $status
4206 $show "(cd $xdir && $AR x $xabs)"
4207 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4209 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
4210 done
4213 # Do each command in the archive commands.
4214 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4215 eval cmds=\"$old_archive_from_new_cmds\"
4216 else
4217 # # Ensure that we have .o objects in place in case we decided
4218 # # not to build a shared library, and have fallen back to building
4219 # # static libs even though --disable-static was passed!
4220 # for oldobj in $oldobjs; do
4221 # if test ! -f $oldobj; then
4222 # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
4223 # if test "X$xdir" = "X$oldobj"; then
4224 # xdir="."
4225 # else
4226 # xdir="$xdir"
4227 # fi
4228 # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
4229 # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
4230 # $show "(cd $xdir && ${LN_S} $obj $baseobj)"
4231 # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4232 # fi
4233 # done
4235 eval cmds=\"$old_archive_cmds\"
4237 if len=`expr "X$cmds" : ".*"` &&
4238 test $len -le $max_cmd_len; then
4240 else
4241 # the command line is too long to link in one step, link in parts
4242 $echo "using piecewise archive linking..."
4243 save_RANLIB=$RANLIB
4244 RANLIB=:
4245 objlist=
4246 concat_cmds=
4247 save_oldobjs=$oldobjs
4248 for obj in $save_oldobjs
4250 oldobjs="$objlist $obj"
4251 objlist="$objlist $obj"
4252 eval test_cmds=\"$old_archive_cmds\"
4253 if len=`expr "X$test_cmds" : ".*"` &&
4254 test $len -le $max_cmd_len; then
4256 else
4257 # the above command should be used before it gets too long
4258 oldobjs=$objlist
4259 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4260 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4261 objlist=
4263 done
4264 RANLIB=$save_RANLIB
4265 oldobjs=$objlist
4266 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4269 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4270 for cmd in $cmds; do
4271 IFS="$save_ifs"
4272 $show "$cmd"
4273 $run eval "$cmd" || exit $?
4274 done
4275 IFS="$save_ifs"
4276 done
4278 if test -n "$generated"; then
4279 $show "${rm}r$generated"
4280 $run ${rm}r$generated
4283 # Now create the libtool archive.
4284 case $output in
4285 *.la)
4286 old_library=
4287 test "$build_old_libs" = yes && old_library="$libname.$libext"
4288 $show "creating $output"
4290 # Preserve any variables that may affect compiler behavior
4291 for var in $variables_saved_for_relink; do
4292 if eval test -z \"\${$var+set}\"; then
4293 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4294 elif eval var_value=\$$var; test -z "$var_value"; then
4295 relink_command="$var=; export $var; $relink_command"
4296 else
4297 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4298 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4300 done
4301 # Quote the link command for shipping.
4302 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
4303 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4305 # Only create the output if not a dry run.
4306 if test -z "$run"; then
4307 for installed in no yes; do
4308 if test "$installed" = yes; then
4309 if test -z "$install_libdir"; then
4310 break
4312 output="$output_objdir/$outputname"i
4313 # Replace all uninstalled libtool libraries with the installed ones
4314 newdependency_libs=
4315 for deplib in $dependency_libs; do
4316 case $deplib in
4317 *.la)
4318 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4319 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4320 if test -z "$libdir"; then
4321 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4322 exit 1
4324 newdependency_libs="$newdependency_libs $libdir/$name"
4326 *) newdependency_libs="$newdependency_libs $deplib" ;;
4327 esac
4328 done
4329 dependency_libs="$newdependency_libs"
4330 newdlfiles=
4331 for lib in $dlfiles; do
4332 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4333 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4334 if test -z "$libdir"; then
4335 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4336 exit 1
4338 newdlfiles="$newdlfiles $libdir/$name"
4339 done
4340 dlfiles="$newdlfiles"
4341 newdlprefiles=
4342 for lib in $dlprefiles; do
4343 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4344 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4345 if test -z "$libdir"; then
4346 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4347 exit 1
4349 newdlprefiles="$newdlprefiles $libdir/$name"
4350 done
4351 dlprefiles="$newdlprefiles"
4353 $rm $output
4354 # place dlname in correct position for cygwin
4355 tdlname=$dlname
4356 case $host,$output,$installed,$module,$dlname in
4357 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4358 esac
4359 $echo > $output "\
4360 # $outputname - a libtool library file
4361 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4363 # Please DO NOT delete this file!
4364 # It is necessary for linking the library.
4366 # The name that we can dlopen(3).
4367 dlname='$tdlname'
4369 # Names of this library.
4370 library_names='$library_names'
4372 # The name of the static archive.
4373 old_library='$old_library'
4375 # Libraries that this one depends upon.
4376 dependency_libs='$dependency_libs'
4378 # Version information for $libname.
4379 current=$current
4380 age=$age
4381 revision=$revision
4383 # Is this an already installed library?
4384 installed=$installed
4386 # Files to dlopen/dlpreopen
4387 dlopen='$dlfiles'
4388 dlpreopen='$dlprefiles'
4390 # Directory that this library needs to be installed in:
4391 libdir='$install_libdir'"
4392 if test "$installed" = no && test $need_relink = yes; then
4393 $echo >> $output "\
4394 relink_command=\"$relink_command\""
4396 done
4399 # Do a symbolic link so that the libtool archive can be found in
4400 # LD_LIBRARY_PATH before the program is installed.
4401 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4402 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4404 esac
4405 exit 0
4408 # libtool install mode
4409 install)
4410 modename="$modename: install"
4412 # There may be an optional sh(1) argument at the beginning of
4413 # install_prog (especially on Windows NT).
4414 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4415 # Allow the use of GNU shtool's install command.
4416 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4417 # Aesthetically quote it.
4418 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4419 case $arg in
4420 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4421 arg="\"$arg\""
4423 esac
4424 install_prog="$arg "
4425 arg="$1"
4426 shift
4427 else
4428 install_prog=
4429 arg="$nonopt"
4432 # The real first argument should be the name of the installation program.
4433 # Aesthetically quote it.
4434 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4435 case $arg in
4436 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4437 arg="\"$arg\""
4439 esac
4440 install_prog="$install_prog$arg"
4442 # We need to accept at least all the BSD install flags.
4443 dest=
4444 files=
4445 opts=
4446 prev=
4447 install_type=
4448 isdir=no
4449 stripme=
4450 for arg
4452 if test -n "$dest"; then
4453 files="$files $dest"
4454 dest="$arg"
4455 continue
4458 case $arg in
4459 -d) isdir=yes ;;
4460 -f) prev="-f" ;;
4461 -g) prev="-g" ;;
4462 -m) prev="-m" ;;
4463 -o) prev="-o" ;;
4465 stripme=" -s"
4466 continue
4468 -*) ;;
4471 # If the previous option needed an argument, then skip it.
4472 if test -n "$prev"; then
4473 prev=
4474 else
4475 dest="$arg"
4476 continue
4479 esac
4481 # Aesthetically quote the argument.
4482 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4483 case $arg in
4484 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4485 arg="\"$arg\""
4487 esac
4488 install_prog="$install_prog $arg"
4489 done
4491 if test -z "$install_prog"; then
4492 $echo "$modename: you must specify an install program" 1>&2
4493 $echo "$help" 1>&2
4494 exit 1
4497 if test -n "$prev"; then
4498 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4499 $echo "$help" 1>&2
4500 exit 1
4503 if test -z "$files"; then
4504 if test -z "$dest"; then
4505 $echo "$modename: no file or destination specified" 1>&2
4506 else
4507 $echo "$modename: you must specify a destination" 1>&2
4509 $echo "$help" 1>&2
4510 exit 1
4513 # Strip any trailing slash from the destination.
4514 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4516 # Check to see that the destination is a directory.
4517 test -d "$dest" && isdir=yes
4518 if test "$isdir" = yes; then
4519 destdir="$dest"
4520 destname=
4521 else
4522 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4523 test "X$destdir" = "X$dest" && destdir=.
4524 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4526 # Not a directory, so check to see that there is only one file specified.
4527 set dummy $files
4528 if test $# -gt 2; then
4529 $echo "$modename: \`$dest' is not a directory" 1>&2
4530 $echo "$help" 1>&2
4531 exit 1
4534 case $destdir in
4535 [\\/]* | [A-Za-z]:[\\/]*) ;;
4537 for file in $files; do
4538 case $file in
4539 *.lo) ;;
4541 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4542 $echo "$help" 1>&2
4543 exit 1
4545 esac
4546 done
4548 esac
4550 # This variable tells wrapper scripts just to set variables rather
4551 # than running their programs.
4552 libtool_install_magic="$magic"
4554 staticlibs=
4555 future_libdirs=
4556 current_libdirs=
4557 for file in $files; do
4559 # Do each installation.
4560 case $file in
4561 *.$libext)
4562 # Do the static libraries later.
4563 staticlibs="$staticlibs $file"
4566 *.la)
4567 # Check to see that this really is a libtool archive.
4568 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4569 else
4570 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4571 $echo "$help" 1>&2
4572 exit 1
4575 library_names=
4576 old_library=
4577 relink_command=
4578 # If there is no directory component, then add one.
4579 case $file in
4580 */* | *\\*) . $file ;;
4581 *) . ./$file ;;
4582 esac
4584 # Add the libdir to current_libdirs if it is the destination.
4585 if test "X$destdir" = "X$libdir"; then
4586 case "$current_libdirs " in
4587 *" $libdir "*) ;;
4588 *) current_libdirs="$current_libdirs $libdir" ;;
4589 esac
4590 else
4591 # Note the libdir as a future libdir.
4592 case "$future_libdirs " in
4593 *" $libdir "*) ;;
4594 *) future_libdirs="$future_libdirs $libdir" ;;
4595 esac
4598 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4599 test "X$dir" = "X$file/" && dir=
4600 dir="$dir$objdir"
4602 if test -n "$relink_command"; then
4603 $echo "$modename: warning: relinking \`$file'" 1>&2
4604 $show "$relink_command"
4605 if $run eval "$relink_command"; then :
4606 else
4607 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4608 continue
4612 # See the names of the shared library.
4613 set dummy $library_names
4614 if test -n "$2"; then
4615 realname="$2"
4616 shift
4617 shift
4619 srcname="$realname"
4620 test -n "$relink_command" && srcname="$realname"T
4622 # Install the shared library and build the symlinks.
4623 $show "$install_prog $dir/$srcname $destdir/$realname"
4624 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4625 if test -n "$stripme" && test -n "$striplib"; then
4626 $show "$striplib $destdir/$realname"
4627 $run eval "$striplib $destdir/$realname" || exit $?
4630 if test $# -gt 0; then
4631 # Delete the old symlinks, and create new ones.
4632 for linkname
4634 if test "$linkname" != "$realname"; then
4635 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4636 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4638 done
4641 # Do each command in the postinstall commands.
4642 lib="$destdir/$realname"
4643 eval cmds=\"$postinstall_cmds\"
4644 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4645 for cmd in $cmds; do
4646 IFS="$save_ifs"
4647 $show "$cmd"
4648 $run eval "$cmd" || exit $?
4649 done
4650 IFS="$save_ifs"
4653 # Install the pseudo-library for information purposes.
4654 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4655 instname="$dir/$name"i
4656 $show "$install_prog $instname $destdir/$name"
4657 $run eval "$install_prog $instname $destdir/$name" || exit $?
4659 # Maybe install the static library, too.
4660 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4663 *.lo)
4664 # Install (i.e. copy) a libtool object.
4666 # Figure out destination file name, if it wasn't already specified.
4667 if test -n "$destname"; then
4668 destfile="$destdir/$destname"
4669 else
4670 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4671 destfile="$destdir/$destfile"
4674 # Deduce the name of the destination old-style object file.
4675 case $destfile in
4676 *.lo)
4677 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4679 *.$objext)
4680 staticdest="$destfile"
4681 destfile=
4684 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4685 $echo "$help" 1>&2
4686 exit 1
4688 esac
4690 # Install the libtool object if requested.
4691 if test -n "$destfile"; then
4692 $show "$install_prog $file $destfile"
4693 $run eval "$install_prog $file $destfile" || exit $?
4696 # Install the old object if enabled.
4697 if test "$build_old_libs" = yes; then
4698 # Deduce the name of the old-style object file.
4699 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4701 $show "$install_prog $staticobj $staticdest"
4702 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4704 exit 0
4708 # Figure out destination file name, if it wasn't already specified.
4709 if test -n "$destname"; then
4710 destfile="$destdir/$destname"
4711 else
4712 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4713 destfile="$destdir/$destfile"
4716 # Do a test to see if this is really a libtool program.
4717 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4718 notinst_deplibs=
4719 relink_command=
4721 # If there is no directory component, then add one.
4722 case $file in
4723 */* | *\\*) . $file ;;
4724 *) . ./$file ;;
4725 esac
4727 # Check the variables that should have been set.
4728 if test -z "$notinst_deplibs"; then
4729 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4730 exit 1
4733 finalize=yes
4734 for lib in $notinst_deplibs; do
4735 # Check to see that each library is installed.
4736 libdir=
4737 if test -f "$lib"; then
4738 # If there is no directory component, then add one.
4739 case $lib in
4740 */* | *\\*) . $lib ;;
4741 *) . ./$lib ;;
4742 esac
4744 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4745 if test -n "$libdir" && test ! -f "$libfile"; then
4746 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4747 finalize=no
4749 done
4751 relink_command=
4752 # If there is no directory component, then add one.
4753 case $file in
4754 */* | *\\*) . $file ;;
4755 *) . ./$file ;;
4756 esac
4758 outputname=
4759 if test "$fast_install" = no && test -n "$relink_command"; then
4760 if test "$finalize" = yes && test -z "$run"; then
4761 tmpdir="/tmp"
4762 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4763 tmpdir="$tmpdir/libtool-$$"
4764 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4765 else
4766 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4767 continue
4769 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4770 outputname="$tmpdir/$file"
4771 # Replace the output file specification.
4772 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4774 $show "$relink_command"
4775 if $run eval "$relink_command"; then :
4776 else
4777 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4778 ${rm}r "$tmpdir"
4779 continue
4781 file="$outputname"
4782 else
4783 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4785 else
4786 # Install the binary that we compiled earlier.
4787 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4792 # remove .exe since cygwin /usr/bin/install will append another
4793 # one anyways
4794 case $install_prog,$host in
4795 */usr/bin/install*,*cygwin*)
4796 case $file:$destfile in
4797 *.exe:*.exe)
4798 # this is ok
4800 *.exe:*)
4801 destfile=$destfile.exe
4803 *:*.exe)
4804 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4806 esac
4808 esac
4810 $show "$install_prog$stripme $file $destfile"
4811 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4812 test -n "$outputname" && ${rm}r "$tmpdir"
4814 esac
4815 done
4817 for file in $staticlibs; do
4818 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4820 # Set up the ranlib parameters.
4821 oldlib="$destdir/$name"
4823 $show "$install_prog $file $oldlib"
4824 $run eval "$install_prog \$file \$oldlib" || exit $?
4826 if test -n "$stripme" && test -n "$striplib"; then
4827 $show "$old_striplib $oldlib"
4828 $run eval "$old_striplib $oldlib" || exit $?
4831 # Do each command in the postinstall commands.
4832 eval cmds=\"$old_postinstall_cmds\"
4833 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4834 for cmd in $cmds; do
4835 IFS="$save_ifs"
4836 $show "$cmd"
4837 $run eval "$cmd" || exit $?
4838 done
4839 IFS="$save_ifs"
4840 done
4842 if test -n "$future_libdirs"; then
4843 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4846 if test -n "$current_libdirs"; then
4847 # Maybe just do a dry run.
4848 test -n "$run" && current_libdirs=" -n$current_libdirs"
4849 exec_cmd='$SHELL $0 --finish$current_libdirs'
4850 else
4851 exit 0
4855 # libtool finish mode
4856 finish)
4857 modename="$modename: finish"
4858 libdirs="$nonopt"
4859 admincmds=
4861 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4862 for dir
4864 libdirs="$libdirs $dir"
4865 done
4867 for libdir in $libdirs; do
4868 if test -n "$finish_cmds"; then
4869 # Do each command in the finish commands.
4870 eval cmds=\"$finish_cmds\"
4871 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4872 for cmd in $cmds; do
4873 IFS="$save_ifs"
4874 $show "$cmd"
4875 $run eval "$cmd" || admincmds="$admincmds
4876 $cmd"
4877 done
4878 IFS="$save_ifs"
4880 if test -n "$finish_eval"; then
4881 # Do the single finish_eval.
4882 eval cmds=\"$finish_eval\"
4883 $run eval "$cmds" || admincmds="$admincmds
4884 $cmds"
4886 done
4889 # Exit here if they wanted silent mode.
4890 test "$show" = ":" && exit 0
4892 echo "----------------------------------------------------------------------"
4893 echo "Libraries have been installed in:"
4894 for libdir in $libdirs; do
4895 echo " $libdir"
4896 done
4897 echo
4898 echo "If you ever happen to want to link against installed libraries"
4899 echo "in a given directory, LIBDIR, you must either use libtool, and"
4900 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4901 echo "flag during linking and do at least one of the following:"
4902 if test -n "$shlibpath_var"; then
4903 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4904 echo " during execution"
4906 if test -n "$runpath_var"; then
4907 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4908 echo " during linking"
4910 if test -n "$hardcode_libdir_flag_spec"; then
4911 libdir=LIBDIR
4912 eval flag=\"$hardcode_libdir_flag_spec\"
4914 echo " - use the \`$flag' linker flag"
4916 if test -n "$admincmds"; then
4917 echo " - have your system administrator run these commands:$admincmds"
4919 if test -f /etc/ld.so.conf; then
4920 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4922 echo
4923 echo "See any operating system documentation about shared libraries for"
4924 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4925 echo "----------------------------------------------------------------------"
4926 exit 0
4929 # libtool execute mode
4930 execute)
4931 modename="$modename: execute"
4933 # The first argument is the command name.
4934 cmd="$nonopt"
4935 if test -z "$cmd"; then
4936 $echo "$modename: you must specify a COMMAND" 1>&2
4937 $echo "$help"
4938 exit 1
4941 # Handle -dlopen flags immediately.
4942 for file in $execute_dlfiles; do
4943 if test ! -f "$file"; then
4944 $echo "$modename: \`$file' is not a file" 1>&2
4945 $echo "$help" 1>&2
4946 exit 1
4949 dir=
4950 case $file in
4951 *.la)
4952 # Check to see that this really is a libtool archive.
4953 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4954 else
4955 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4956 $echo "$help" 1>&2
4957 exit 1
4960 # Read the libtool library.
4961 dlname=
4962 library_names=
4964 # If there is no directory component, then add one.
4965 case $file in
4966 */* | *\\*) . $file ;;
4967 *) . ./$file ;;
4968 esac
4970 # Skip this library if it cannot be dlopened.
4971 if test -z "$dlname"; then
4972 # Warn if it was a shared library.
4973 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4974 continue
4977 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4978 test "X$dir" = "X$file" && dir=.
4980 if test -f "$dir/$objdir/$dlname"; then
4981 dir="$dir/$objdir"
4982 else
4983 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4984 exit 1
4988 *.lo)
4989 # Just add the directory containing the .lo file.
4990 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4991 test "X$dir" = "X$file" && dir=.
4995 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4996 continue
4998 esac
5000 # Get the absolute pathname.
5001 absdir=`cd "$dir" && pwd`
5002 test -n "$absdir" && dir="$absdir"
5004 # Now add the directory to shlibpath_var.
5005 if eval "test -z \"\$$shlibpath_var\""; then
5006 eval "$shlibpath_var=\"\$dir\""
5007 else
5008 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5010 done
5012 # This variable tells wrapper scripts just to set shlibpath_var
5013 # rather than running their programs.
5014 libtool_execute_magic="$magic"
5016 # Check if any of the arguments is a wrapper script.
5017 args=
5018 for file
5020 case $file in
5021 -*) ;;
5023 # Do a test to see if this is really a libtool program.
5024 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5025 # If there is no directory component, then add one.
5026 case $file in
5027 */* | *\\*) . $file ;;
5028 *) . ./$file ;;
5029 esac
5031 # Transform arg to wrapped name.
5032 file="$progdir/$program"
5035 esac
5036 # Quote arguments (to preserve shell metacharacters).
5037 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5038 args="$args \"$file\""
5039 done
5041 if test -z "$run"; then
5042 if test -n "$shlibpath_var"; then
5043 # Export the shlibpath_var.
5044 eval "export $shlibpath_var"
5047 # Restore saved enviroment variables
5048 if test "${save_LC_ALL+set}" = set; then
5049 LC_ALL="$save_LC_ALL"; export LC_ALL
5051 if test "${save_LANG+set}" = set; then
5052 LANG="$save_LANG"; export LANG
5055 # Now prepare to actually exec the command.
5056 exec_cmd='"$cmd"$args'
5057 else
5058 # Display what would be done.
5059 if test -n "$shlibpath_var"; then
5060 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5061 $echo "export $shlibpath_var"
5063 $echo "$cmd$args"
5064 exit 0
5068 # libtool clean and uninstall mode
5069 clean | uninstall)
5070 modename="$modename: $mode"
5071 rm="$nonopt"
5072 files=
5073 rmforce=
5074 exit_status=0
5076 # This variable tells wrapper scripts just to set variables rather
5077 # than running their programs.
5078 libtool_install_magic="$magic"
5080 for arg
5082 case $arg in
5083 -f) rm="$rm $arg"; rmforce=yes ;;
5084 -*) rm="$rm $arg" ;;
5085 *) files="$files $arg" ;;
5086 esac
5087 done
5089 if test -z "$rm"; then
5090 $echo "$modename: you must specify an RM program" 1>&2
5091 $echo "$help" 1>&2
5092 exit 1
5095 rmdirs=
5097 for file in $files; do
5098 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5099 if test "X$dir" = "X$file"; then
5100 dir=.
5101 objdir="$objdir"
5102 else
5103 objdir="$dir/$objdir"
5105 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5106 test $mode = uninstall && objdir="$dir"
5108 # Remember objdir for removal later, being careful to avoid duplicates
5109 if test $mode = clean; then
5110 case " $rmdirs " in
5111 *" $objdir "*) ;;
5112 *) rmdirs="$rmdirs $objdir" ;;
5113 esac
5116 # Don't error if the file doesn't exist and rm -f was used.
5117 if (test -L "$file") >/dev/null 2>&1 \
5118 || (test -h "$file") >/dev/null 2>&1 \
5119 || test -f "$file"; then
5121 elif test -d "$file"; then
5122 exit_status=1
5123 continue
5124 elif test "$rmforce" = yes; then
5125 continue
5128 rmfiles="$file"
5130 case $name in
5131 *.la)
5132 # Possibly a libtool archive, so verify it.
5133 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5134 . $dir/$name
5136 # Delete the libtool libraries and symlinks.
5137 for n in $library_names; do
5138 rmfiles="$rmfiles $objdir/$n"
5139 done
5140 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5141 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5143 if test $mode = uninstall; then
5144 if test -n "$library_names"; then
5145 # Do each command in the postuninstall commands.
5146 eval cmds=\"$postuninstall_cmds\"
5147 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5148 for cmd in $cmds; do
5149 IFS="$save_ifs"
5150 $show "$cmd"
5151 $run eval "$cmd"
5152 if test $? != 0 && test "$rmforce" != yes; then
5153 exit_status=1
5155 done
5156 IFS="$save_ifs"
5159 if test -n "$old_library"; then
5160 # Do each command in the old_postuninstall commands.
5161 eval cmds=\"$old_postuninstall_cmds\"
5162 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5163 for cmd in $cmds; do
5164 IFS="$save_ifs"
5165 $show "$cmd"
5166 $run eval "$cmd"
5167 if test $? != 0 && test "$rmforce" != yes; then
5168 exit_status=1
5170 done
5171 IFS="$save_ifs"
5173 # FIXME: should reinstall the best remaining shared library.
5178 *.lo)
5179 # Possibly a libtool object, so verify it.
5180 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5182 # Read the .lo file
5183 . $dir/$name
5185 # Add PIC object to the list of files to remove.
5186 if test -n "$pic_object" \
5187 && test "$pic_object" != none; then
5188 rmfiles="$rmfiles $dir/$pic_object"
5191 # Add non-PIC object to the list of files to remove.
5192 if test -n "$non_pic_object" \
5193 && test "$non_pic_object" != none; then
5194 rmfiles="$rmfiles $dir/$non_pic_object"
5200 # Do a test to see if this is a libtool program.
5201 if test $mode = clean &&
5202 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5203 relink_command=
5204 . $dir/$file
5206 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5207 if test "$fast_install" = yes && test -n "$relink_command"; then
5208 rmfiles="$rmfiles $objdir/lt-$name"
5212 esac
5213 $show "$rm $rmfiles"
5214 $run $rm $rmfiles || exit_status=1
5215 done
5217 # Try to remove the ${objdir}s in the directories where we deleted files
5218 for dir in $rmdirs; do
5219 if test -d "$dir"; then
5220 $show "rmdir $dir"
5221 $run rmdir $dir >/dev/null 2>&1
5223 done
5225 exit $exit_status
5229 $echo "$modename: you must specify a MODE" 1>&2
5230 $echo "$generic_help" 1>&2
5231 exit 1
5233 esac
5235 if test -z "$exec_cmd"; then
5236 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5237 $echo "$generic_help" 1>&2
5238 exit 1
5240 fi # test -z "$show_help"
5242 if test -n "$exec_cmd"; then
5243 eval exec $exec_cmd
5244 exit 1
5247 # We need to display help for each of the modes.
5248 case $mode in
5249 "") $echo \
5250 "Usage: $modename [OPTION]... [MODE-ARG]...
5252 Provide generalized library-building support services.
5254 --config show all configuration variables
5255 --debug enable verbose shell tracing
5256 -n, --dry-run display commands without modifying any files
5257 --features display basic configuration information and exit
5258 --finish same as \`--mode=finish'
5259 --help display this help message and exit
5260 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
5261 --quiet same as \`--silent'
5262 --silent don't print informational messages
5263 --tag=TAG use configuration variables from tag TAG
5264 --version print version information
5266 MODE must be one of the following:
5268 clean remove files from the build directory
5269 compile compile a source file into a libtool object
5270 execute automatically set library path, then run a program
5271 finish complete the installation of libtool libraries
5272 install install libraries or executables
5273 link create a library or an executable
5274 uninstall remove libraries from an installed directory
5276 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5277 a more detailed description of MODE."
5278 exit 0
5281 clean)
5282 $echo \
5283 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5285 Remove files from the build directory.
5287 RM is the name of the program to use to delete files associated with each FILE
5288 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5289 to RM.
5291 If FILE is a libtool library, object or program, all the files associated
5292 with it are deleted. Otherwise, only FILE itself is deleted using RM."
5295 compile)
5296 $echo \
5297 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5299 Compile a source file into a libtool library object.
5301 This mode accepts the following additional options:
5303 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5304 -prefer-pic try to building PIC objects only
5305 -prefer-non-pic try to building non-PIC objects only
5306 -static always build a \`.o' file suitable for static linking
5308 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5309 from the given SOURCEFILE.
5311 The output file name is determined by removing the directory component from
5312 SOURCEFILE, then substituting the C source code suffix \`.c' with the
5313 library object suffix, \`.lo'."
5316 execute)
5317 $echo \
5318 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5320 Automatically set library path, then run a program.
5322 This mode accepts the following additional options:
5324 -dlopen FILE add the directory containing FILE to the library path
5326 This mode sets the library path environment variable according to \`-dlopen'
5327 flags.
5329 If any of the ARGS are libtool executable wrappers, then they are translated
5330 into their corresponding uninstalled binary, and any of their required library
5331 directories are added to the library path.
5333 Then, COMMAND is executed, with ARGS as arguments."
5336 finish)
5337 $echo \
5338 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5340 Complete the installation of libtool libraries.
5342 Each LIBDIR is a directory that contains libtool libraries.
5344 The commands that this mode executes may require superuser privileges. Use
5345 the \`--dry-run' option if you just want to see what would be executed."
5348 install)
5349 $echo \
5350 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5352 Install executables or libraries.
5354 INSTALL-COMMAND is the installation command. The first component should be
5355 either the \`install' or \`cp' program.
5357 The rest of the components are interpreted as arguments to that command (only
5358 BSD-compatible install options are recognized)."
5361 link)
5362 $echo \
5363 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5365 Link object files or libraries together to form another library, or to
5366 create an executable program.
5368 LINK-COMMAND is a command using the C compiler that you would use to create
5369 a program from several object files.
5371 The following components of LINK-COMMAND are treated specially:
5373 -all-static do not do any dynamic linking at all
5374 -avoid-version do not add a version suffix if possible
5375 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5376 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5377 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5378 -export-symbols SYMFILE
5379 try to export only the symbols listed in SYMFILE
5380 -export-symbols-regex REGEX
5381 try to export only the symbols matching REGEX
5382 -LLIBDIR search LIBDIR for required installed libraries
5383 -lNAME OUTPUT-FILE requires the installed library libNAME
5384 -module build a library that can dlopened
5385 -no-fast-install disable the fast-install mode
5386 -no-install link a not-installable executable
5387 -no-undefined declare that a library does not refer to external symbols
5388 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5389 -objectlist FILE Use a list of object files found in FILE to specify objects
5390 -release RELEASE specify package release information
5391 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5392 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5393 -static do not do any dynamic linking of libtool libraries
5394 -version-info CURRENT[:REVISION[:AGE]]
5395 specify library version info [each variable defaults to 0]
5397 All other options (arguments beginning with \`-') are ignored.
5399 Every other argument is treated as a filename. Files ending in \`.la' are
5400 treated as uninstalled libtool libraries, other files are standard or library
5401 object files.
5403 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5404 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5405 required, except when creating a convenience library.
5407 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5408 using \`ar' and \`ranlib', or on Windows using \`lib'.
5410 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5411 is created, otherwise an executable program is created."
5414 uninstall)
5415 $echo \
5416 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5418 Remove libraries from an installation directory.
5420 RM is the name of the program to use to delete files associated with each FILE
5421 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5422 to RM.
5424 If FILE is a libtool library, all the files associated with it are deleted.
5425 Otherwise, only FILE itself is deleted using RM."
5429 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5430 $echo "$help" 1>&2
5431 exit 1
5433 esac
5435 echo
5436 $echo "Try \`$modename --help' for more information about other modes."
5438 exit 0
5440 # The TAGs below are defined such that we never get into a situation
5441 # in which we disable both kinds of libraries. Given conflicting
5442 # choices, we go for a static library, that is the most portable,
5443 # since we can't tell whether shared libraries were disabled because
5444 # the user asked for that or because the platform doesn't support
5445 # them. This is particularly important on AIX, because we don't
5446 # support having both static and shared libraries enabled at the same
5447 # time on that platform, so we default to a shared-only configuration.
5448 # If a disable-shared tag is given, we'll fallback to a static-only
5449 # configuration. But we'll never go from static-only to shared-only.
5451 ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5452 build_libtool_libs=no
5453 build_old_libs=yes
5454 ### END LIBTOOL TAG CONFIG: disable-shared
5456 ### BEGIN LIBTOOL TAG CONFIG: disable-static
5457 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5458 ### END LIBTOOL TAG CONFIG: disable-static
5460 # Local Variables:
5461 # mode:shell-script
5462 # sh-indentation:2
5463 # End: