tagging release
[dasher.git] / Src / Common / Expat / conftools / ltmain.sh
blob6e5bf3657c9442175098eace40ec71d05e1ff798
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
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.4.2
59 TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)"
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 # Make sure IFS has a sensible default
88 : ${IFS=" "}
90 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91 echo "$modename: not configured to build any kind of library" 1>&2
92 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
93 exit 1
96 # Global variables.
97 mode=$default_mode
98 nonopt=
99 prev=
100 prevopt=
101 run=
102 show="$echo"
103 show_help=
104 execute_dlfiles=
105 lo2o="s/\\.lo\$/.${objext}/"
106 o2lo="s/\\.${objext}\$/.lo/"
108 # Parse our command line options once, thoroughly.
109 while test $# -gt 0
111 arg="$1"
112 shift
114 case $arg in
115 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
116 *) optarg= ;;
117 esac
119 # If the previous option needs an argument, assign it.
120 if test -n "$prev"; then
121 case $prev in
122 execute_dlfiles)
123 execute_dlfiles="$execute_dlfiles $arg"
126 eval "$prev=\$arg"
128 esac
130 prev=
131 prevopt=
132 continue
135 # Have we seen a non-optional argument yet?
136 case $arg in
137 --help)
138 show_help=yes
141 --version)
142 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
143 exit 0
146 --config)
147 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
148 exit 0
151 --debug)
152 echo "$progname: enabling shell trace mode"
153 set -x
156 --dry-run | -n)
157 run=:
160 --features)
161 echo "host: $host"
162 if test "$build_libtool_libs" = yes; then
163 echo "enable shared libraries"
164 else
165 echo "disable shared libraries"
167 if test "$build_old_libs" = yes; then
168 echo "enable static libraries"
169 else
170 echo "disable static libraries"
172 exit 0
175 --finish) mode="finish" ;;
177 --mode) prevopt="--mode" prev=mode ;;
178 --mode=*) mode="$optarg" ;;
180 --quiet | --silent)
181 show=:
184 -dlopen)
185 prevopt="-dlopen"
186 prev=execute_dlfiles
190 $echo "$modename: unrecognized option \`$arg'" 1>&2
191 $echo "$help" 1>&2
192 exit 1
196 nonopt="$arg"
197 break
199 esac
200 done
202 if test -n "$prevopt"; then
203 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
204 $echo "$help" 1>&2
205 exit 1
208 # If this variable is set in any of the actions, the command in it
209 # will be execed at the end. This prevents here-documents from being
210 # left over by shells.
211 exec_cmd=
213 if test -z "$show_help"; then
215 # Infer the operation mode.
216 if test -z "$mode"; then
217 case $nonopt in
218 *cc | *++ | gcc* | *-gcc*)
219 mode=link
220 for arg
222 case $arg in
224 mode=compile
225 break
227 esac
228 done
230 *db | *dbx | *strace | *truss)
231 mode=execute
233 *install*|cp|mv)
234 mode=install
236 *rm)
237 mode=uninstall
240 # If we have no mode, but dlfiles were specified, then do execute mode.
241 test -n "$execute_dlfiles" && mode=execute
243 # Just use the default operation mode.
244 if test -z "$mode"; then
245 if test -n "$nonopt"; then
246 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
247 else
248 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
252 esac
255 # Only execute mode is allowed to have -dlopen flags.
256 if test -n "$execute_dlfiles" && test "$mode" != execute; then
257 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
258 $echo "$help" 1>&2
259 exit 1
262 # Change the help message to a mode-specific one.
263 generic_help="$help"
264 help="Try \`$modename --help --mode=$mode' for more information."
266 # These modes are in order of execution frequency so that they run quickly.
267 case $mode in
268 # libtool compile mode
269 compile)
270 modename="$modename: compile"
271 # Get the compilation command and the source file.
272 base_compile=
273 prev=
274 lastarg=
275 srcfile="$nonopt"
276 suppress_output=
278 user_target=no
279 for arg
281 case $prev in
282 "") ;;
283 xcompiler)
284 # Aesthetically quote the previous argument.
285 prev=
286 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
288 case $arg in
289 # Double-quote args containing other shell metacharacters.
290 # Many Bourne shells cannot handle close brackets correctly
291 # in scan sets, so we specify it separately.
292 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
293 arg="\"$arg\""
295 esac
297 # Add the previous argument to base_compile.
298 if test -z "$base_compile"; then
299 base_compile="$lastarg"
300 else
301 base_compile="$base_compile $lastarg"
303 continue
305 esac
307 # Accept any command-line options.
308 case $arg in
310 if test "$user_target" != "no"; then
311 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
312 exit 1
314 user_target=next
317 -static)
318 build_old_libs=yes
319 continue
322 -prefer-pic)
323 pic_mode=yes
324 continue
327 -prefer-non-pic)
328 pic_mode=no
329 continue
332 -Xcompiler)
333 prev=xcompiler
334 continue
337 -Wc,*)
338 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
339 lastarg=
340 save_ifs="$IFS"; IFS=','
341 for arg in $args; do
342 IFS="$save_ifs"
344 # Double-quote args containing other shell metacharacters.
345 # Many Bourne shells cannot handle close brackets correctly
346 # in scan sets, so we specify it separately.
347 case $arg in
348 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
349 arg="\"$arg\""
351 esac
352 lastarg="$lastarg $arg"
353 done
354 IFS="$save_ifs"
355 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
357 # Add the arguments to base_compile.
358 if test -z "$base_compile"; then
359 base_compile="$lastarg"
360 else
361 base_compile="$base_compile $lastarg"
363 continue
365 esac
367 case $user_target in
368 next)
369 # The next one is the -o target name
370 user_target=yes
371 continue
373 yes)
374 # We got the output file
375 user_target=set
376 libobj="$arg"
377 continue
379 esac
381 # Accept the current argument as the source file.
382 lastarg="$srcfile"
383 srcfile="$arg"
385 # Aesthetically quote the previous argument.
387 # Backslashify any backslashes, double quotes, and dollar signs.
388 # These are the only characters that are still specially
389 # interpreted inside of double-quoted scrings.
390 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
392 # Double-quote args containing other shell metacharacters.
393 # Many Bourne shells cannot handle close brackets correctly
394 # in scan sets, so we specify it separately.
395 case $lastarg in
396 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
397 lastarg="\"$lastarg\""
399 esac
401 # Add the previous argument to base_compile.
402 if test -z "$base_compile"; then
403 base_compile="$lastarg"
404 else
405 base_compile="$base_compile $lastarg"
407 done
409 case $user_target in
410 set)
413 # Get the name of the library object.
414 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
417 $echo "$modename: you must specify a target with \`-o'" 1>&2
418 exit 1
420 esac
422 # Recognize several different file suffixes.
423 # If the user specifies -o file.o, it is replaced with file.lo
424 xform='[cCFSfmso]'
425 case $libobj in
426 *.ada) xform=ada ;;
427 *.adb) xform=adb ;;
428 *.ads) xform=ads ;;
429 *.asm) xform=asm ;;
430 *.c++) xform=c++ ;;
431 *.cc) xform=cc ;;
432 *.cpp) xform=cpp ;;
433 *.cxx) xform=cxx ;;
434 *.f90) xform=f90 ;;
435 *.for) xform=for ;;
436 esac
438 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
440 case $libobj in
441 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
443 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
444 exit 1
446 esac
448 if test -z "$base_compile"; then
449 $echo "$modename: you must specify a compilation command" 1>&2
450 $echo "$help" 1>&2
451 exit 1
454 # Delete any leftover library objects.
455 if test "$build_old_libs" = yes; then
456 removelist="$obj $libobj"
457 else
458 removelist="$libobj"
461 $run $rm $removelist
462 trap "$run $rm $removelist; exit 1" 1 2 15
464 # On Cygwin there's no "real" PIC flag so we must build both object types
465 case $host_os in
466 cygwin* | mingw* | pw32* | os2*)
467 pic_mode=default
469 esac
470 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
471 # non-PIC code in shared libraries is not supported
472 pic_mode=default
475 # Calculate the filename of the output object if compiler does
476 # not support -o with -c
477 if test "$compiler_c_o" = no; then
478 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
479 lockfile="$output_obj.lock"
480 removelist="$removelist $output_obj $lockfile"
481 trap "$run $rm $removelist; exit 1" 1 2 15
482 else
483 need_locks=no
484 lockfile=
487 # Lock this critical section if it is needed
488 # We use this script file to make the link, it avoids creating a new file
489 if test "$need_locks" = yes; then
490 until $run ln "$0" "$lockfile" 2>/dev/null; do
491 $show "Waiting for $lockfile to be removed"
492 sleep 2
493 done
494 elif test "$need_locks" = warn; then
495 if test -f "$lockfile"; then
496 echo "\
497 *** ERROR, $lockfile exists and contains:
498 `cat $lockfile 2>/dev/null`
500 This indicates that another process is trying to use the same
501 temporary object file, and libtool could not work around it because
502 your compiler does not support \`-c' and \`-o' together. If you
503 repeat this compilation, it may succeed, by chance, but you had better
504 avoid parallel builds (make -j) in this platform, or get a better
505 compiler."
507 $run $rm $removelist
508 exit 1
510 echo $srcfile > "$lockfile"
513 if test -n "$fix_srcfile_path"; then
514 eval srcfile=\"$fix_srcfile_path\"
517 # Only build a PIC object if we are building libtool libraries.
518 if test "$build_libtool_libs" = yes; then
519 # Without this assignment, base_compile gets emptied.
520 fbsd_hideous_sh_bug=$base_compile
522 if test "$pic_mode" != no; then
523 # All platforms use -DPIC, to notify preprocessed assembler code.
524 command="$base_compile $srcfile $pic_flag -DPIC"
525 else
526 # Don't build PIC code
527 command="$base_compile $srcfile"
529 if test "$build_old_libs" = yes; then
530 lo_libobj="$libobj"
531 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
532 if test "X$dir" = "X$libobj"; then
533 dir="$objdir"
534 else
535 dir="$dir/$objdir"
537 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
539 if test -d "$dir"; then
540 $show "$rm $libobj"
541 $run $rm $libobj
542 else
543 $show "$mkdir $dir"
544 $run $mkdir $dir
545 status=$?
546 if test $status -ne 0 && test ! -d $dir; then
547 exit $status
551 if test "$compiler_o_lo" = yes; then
552 output_obj="$libobj"
553 command="$command -o $output_obj"
554 elif test "$compiler_c_o" = yes; then
555 output_obj="$obj"
556 command="$command -o $output_obj"
559 $run $rm "$output_obj"
560 $show "$command"
561 if $run eval "$command"; then :
562 else
563 test -n "$output_obj" && $run $rm $removelist
564 exit 1
567 if test "$need_locks" = warn &&
568 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
569 echo "\
570 *** ERROR, $lockfile contains:
571 `cat $lockfile 2>/dev/null`
573 but it should contain:
574 $srcfile
576 This indicates that another process is trying to use the same
577 temporary object file, and libtool could not work around it because
578 your compiler does not support \`-c' and \`-o' together. If you
579 repeat this compilation, it may succeed, by chance, but you had better
580 avoid parallel builds (make -j) in this platform, or get a better
581 compiler."
583 $run $rm $removelist
584 exit 1
587 # Just move the object if needed, then go on to compile the next one
588 if test x"$output_obj" != x"$libobj"; then
589 $show "$mv $output_obj $libobj"
590 if $run $mv $output_obj $libobj; then :
591 else
592 error=$?
593 $run $rm $removelist
594 exit $error
598 # If we have no pic_flag, then copy the object into place and finish.
599 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
600 test "$build_old_libs" = yes; then
601 # Rename the .lo from within objdir to obj
602 if test -f $obj; then
603 $show $rm $obj
604 $run $rm $obj
607 $show "$mv $libobj $obj"
608 if $run $mv $libobj $obj; then :
609 else
610 error=$?
611 $run $rm $removelist
612 exit $error
615 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
616 if test "X$xdir" = "X$obj"; then
617 xdir="."
618 else
619 xdir="$xdir"
621 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
622 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
623 # Now arrange that obj and lo_libobj become the same file
624 $show "(cd $xdir && $LN_S $baseobj $libobj)"
625 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
626 # Unlock the critical section if it was locked
627 if test "$need_locks" != no; then
628 $run $rm "$lockfile"
630 exit 0
631 else
632 error=$?
633 $run $rm $removelist
634 exit $error
638 # Allow error messages only from the first compilation.
639 suppress_output=' >/dev/null 2>&1'
642 # Only build a position-dependent object if we build old libraries.
643 if test "$build_old_libs" = yes; then
644 if test "$pic_mode" != yes; then
645 # Don't build PIC code
646 command="$base_compile $srcfile"
647 else
648 # All platforms use -DPIC, to notify preprocessed assembler code.
649 command="$base_compile $srcfile $pic_flag -DPIC"
651 if test "$compiler_c_o" = yes; then
652 command="$command -o $obj"
653 output_obj="$obj"
656 # Suppress compiler output if we already did a PIC compilation.
657 command="$command$suppress_output"
658 $run $rm "$output_obj"
659 $show "$command"
660 if $run eval "$command"; then :
661 else
662 $run $rm $removelist
663 exit 1
666 if test "$need_locks" = warn &&
667 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
668 echo "\
669 *** ERROR, $lockfile contains:
670 `cat $lockfile 2>/dev/null`
672 but it should contain:
673 $srcfile
675 This indicates that another process is trying to use the same
676 temporary object file, and libtool could not work around it because
677 your compiler does not support \`-c' and \`-o' together. If you
678 repeat this compilation, it may succeed, by chance, but you had better
679 avoid parallel builds (make -j) in this platform, or get a better
680 compiler."
682 $run $rm $removelist
683 exit 1
686 # Just move the object if needed
687 if test x"$output_obj" != x"$obj"; then
688 $show "$mv $output_obj $obj"
689 if $run $mv $output_obj $obj; then :
690 else
691 error=$?
692 $run $rm $removelist
693 exit $error
697 # Create an invalid libtool object if no PIC, so that we do not
698 # accidentally link it into a program.
699 if test "$build_libtool_libs" != yes; then
700 $show "echo timestamp > $libobj"
701 $run eval "echo timestamp > \$libobj" || exit $?
702 else
703 # Move the .lo from within objdir
704 $show "$mv $libobj $lo_libobj"
705 if $run $mv $libobj $lo_libobj; then :
706 else
707 error=$?
708 $run $rm $removelist
709 exit $error
714 # Unlock the critical section if it was locked
715 if test "$need_locks" != no; then
716 $run $rm "$lockfile"
719 exit 0
722 # libtool link mode
723 link | relink)
724 modename="$modename: link"
725 case $host in
726 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
727 # It is impossible to link a dll without this setting, and
728 # we shouldn't force the makefile maintainer to figure out
729 # which system we are compiling for in order to pass an extra
730 # flag for every libtool invokation.
731 # allow_undefined=no
733 # FIXME: Unfortunately, there are problems with the above when trying
734 # to make a dll which has undefined symbols, in which case not
735 # even a static library is built. For now, we need to specify
736 # -no-undefined on the libtool link line when we can be certain
737 # that all symbols are satisfied, otherwise we get a static library.
738 allow_undefined=yes
741 allow_undefined=yes
743 esac
744 libtool_args="$nonopt"
745 compile_command="$nonopt"
746 finalize_command="$nonopt"
748 compile_rpath=
749 finalize_rpath=
750 compile_shlibpath=
751 finalize_shlibpath=
752 convenience=
753 old_convenience=
754 deplibs=
755 old_deplibs=
756 compiler_flags=
757 linker_flags=
758 dllsearchpath=
759 lib_search_path=`pwd`
761 avoid_version=no
762 dlfiles=
763 dlprefiles=
764 dlself=no
765 export_dynamic=no
766 export_symbols=
767 export_symbols_regex=
768 generated=
769 libobjs=
770 ltlibs=
771 module=no
772 no_install=no
773 objs=
774 prefer_static_libs=no
775 preload=no
776 prev=
777 prevarg=
778 release=
779 rpath=
780 xrpath=
781 perm_rpath=
782 temp_rpath=
783 thread_safe=no
784 vinfo=
786 # We need to know -static, to get the right output filenames.
787 for arg
789 case $arg in
790 -all-static | -static)
791 if test "X$arg" = "X-all-static"; then
792 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
793 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
795 if test -n "$link_static_flag"; then
796 dlopen_self=$dlopen_self_static
798 else
799 if test -z "$pic_flag" && test -n "$link_static_flag"; then
800 dlopen_self=$dlopen_self_static
803 build_libtool_libs=no
804 build_old_libs=yes
805 prefer_static_libs=yes
806 break
808 esac
809 done
811 # See if our shared archives depend on static archives.
812 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
814 # Go through the arguments, transforming them on the way.
815 while test $# -gt 0; do
816 arg="$1"
817 shift
818 case $arg in
819 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
820 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
822 *) qarg=$arg ;;
823 esac
824 libtool_args="$libtool_args $qarg"
826 # If the previous option needs an argument, assign it.
827 if test -n "$prev"; then
828 case $prev in
829 output)
830 compile_command="$compile_command @OUTPUT@"
831 finalize_command="$finalize_command @OUTPUT@"
833 esac
835 case $prev in
836 dlfiles|dlprefiles)
837 if test "$preload" = no; then
838 # Add the symbol object into the linking commands.
839 compile_command="$compile_command @SYMFILE@"
840 finalize_command="$finalize_command @SYMFILE@"
841 preload=yes
843 case $arg in
844 *.la | *.lo) ;; # We handle these cases below.
845 force)
846 if test "$dlself" = no; then
847 dlself=needless
848 export_dynamic=yes
850 prev=
851 continue
853 self)
854 if test "$prev" = dlprefiles; then
855 dlself=yes
856 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
857 dlself=yes
858 else
859 dlself=needless
860 export_dynamic=yes
862 prev=
863 continue
866 if test "$prev" = dlfiles; then
867 dlfiles="$dlfiles $arg"
868 else
869 dlprefiles="$dlprefiles $arg"
871 prev=
872 continue
874 esac
876 expsyms)
877 export_symbols="$arg"
878 if test ! -f "$arg"; then
879 $echo "$modename: symbol file \`$arg' does not exist"
880 exit 1
882 prev=
883 continue
885 expsyms_regex)
886 export_symbols_regex="$arg"
887 prev=
888 continue
890 release)
891 release="-$arg"
892 prev=
893 continue
895 rpath | xrpath)
896 # We need an absolute path.
897 case $arg in
898 [\\/]* | [A-Za-z]:[\\/]*) ;;
900 $echo "$modename: only absolute run-paths are allowed" 1>&2
901 exit 1
903 esac
904 if test "$prev" = rpath; then
905 case "$rpath " in
906 *" $arg "*) ;;
907 *) rpath="$rpath $arg" ;;
908 esac
909 else
910 case "$xrpath " in
911 *" $arg "*) ;;
912 *) xrpath="$xrpath $arg" ;;
913 esac
915 prev=
916 continue
918 xcompiler)
919 compiler_flags="$compiler_flags $qarg"
920 prev=
921 compile_command="$compile_command $qarg"
922 finalize_command="$finalize_command $qarg"
923 continue
925 xlinker)
926 linker_flags="$linker_flags $qarg"
927 compiler_flags="$compiler_flags $wl$qarg"
928 prev=
929 compile_command="$compile_command $wl$qarg"
930 finalize_command="$finalize_command $wl$qarg"
931 continue
934 eval "$prev=\"\$arg\""
935 prev=
936 continue
938 esac
939 fi # test -n $prev
941 prevarg="$arg"
943 case $arg in
944 -all-static)
945 if test -n "$link_static_flag"; then
946 compile_command="$compile_command $link_static_flag"
947 finalize_command="$finalize_command $link_static_flag"
949 continue
952 -allow-undefined)
953 # FIXME: remove this flag sometime in the future.
954 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
955 continue
958 -avoid-version)
959 avoid_version=yes
960 continue
963 -dlopen)
964 prev=dlfiles
965 continue
968 -dlpreopen)
969 prev=dlprefiles
970 continue
973 -export-dynamic)
974 export_dynamic=yes
975 continue
978 -export-symbols | -export-symbols-regex)
979 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
980 $echo "$modename: more than one -exported-symbols argument is not allowed"
981 exit 1
983 if test "X$arg" = "X-export-symbols"; then
984 prev=expsyms
985 else
986 prev=expsyms_regex
988 continue
991 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
992 # so, if we see these flags be careful not to treat them like -L
993 -L[A-Z][A-Z]*:*)
994 case $with_gcc/$host in
995 no/*-*-irix*)
996 compile_command="$compile_command $arg"
997 finalize_command="$finalize_command $arg"
999 esac
1000 continue
1003 -L*)
1004 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1005 # We need an absolute path.
1006 case $dir in
1007 [\\/]* | [A-Za-z]:[\\/]*) ;;
1009 absdir=`cd "$dir" && pwd`
1010 if test -z "$absdir"; then
1011 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1012 exit 1
1014 dir="$absdir"
1016 esac
1017 case "$deplibs " in
1018 *" -L$dir "*) ;;
1020 deplibs="$deplibs -L$dir"
1021 lib_search_path="$lib_search_path $dir"
1023 esac
1024 case $host in
1025 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1026 case :$dllsearchpath: in
1027 *":$dir:"*) ;;
1028 *) dllsearchpath="$dllsearchpath:$dir";;
1029 esac
1031 esac
1032 continue
1035 -l*)
1036 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1037 case $host in
1038 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1039 # These systems don't actually have a C or math library (as such)
1040 continue
1042 *-*-mingw* | *-*-os2*)
1043 # These systems don't actually have a C library (as such)
1044 test "X$arg" = "X-lc" && continue
1046 *-*-openbsd*)
1047 # Do not include libc due to us having libc/libc_r.
1048 test "X$arg" = "X-lc" && continue
1050 esac
1051 elif test "X$arg" = "X-lc_r"; then
1052 case $host in
1053 *-*-openbsd*)
1054 # Do not include libc_r directly, use -pthread flag.
1055 continue
1057 esac
1059 deplibs="$deplibs $arg"
1060 continue
1063 -module)
1064 module=yes
1065 continue
1068 -no-fast-install)
1069 fast_install=no
1070 continue
1073 -no-install)
1074 case $host in
1075 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1076 # The PATH hackery in wrapper scripts is required on Windows
1077 # in order for the loader to find any dlls it needs.
1078 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1079 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1080 fast_install=no
1082 *) no_install=yes ;;
1083 esac
1084 continue
1087 -no-undefined)
1088 allow_undefined=no
1089 continue
1092 -o) prev=output ;;
1094 -release)
1095 prev=release
1096 continue
1099 -rpath)
1100 prev=rpath
1101 continue
1105 prev=xrpath
1106 continue
1109 -R*)
1110 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1111 # We need an absolute path.
1112 case $dir in
1113 [\\/]* | [A-Za-z]:[\\/]*) ;;
1115 $echo "$modename: only absolute run-paths are allowed" 1>&2
1116 exit 1
1118 esac
1119 case "$xrpath " in
1120 *" $dir "*) ;;
1121 *) xrpath="$xrpath $dir" ;;
1122 esac
1123 continue
1126 -static)
1127 # The effects of -static are defined in a previous loop.
1128 # We used to do the same as -all-static on platforms that
1129 # didn't have a PIC flag, but the assumption that the effects
1130 # would be equivalent was wrong. It would break on at least
1131 # Digital Unix and AIX.
1132 continue
1135 -thread-safe)
1136 thread_safe=yes
1137 continue
1140 -version-info)
1141 prev=vinfo
1142 continue
1145 -Wc,*)
1146 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1147 arg=
1148 save_ifs="$IFS"; IFS=','
1149 for flag in $args; do
1150 IFS="$save_ifs"
1151 case $flag in
1152 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1153 flag="\"$flag\""
1155 esac
1156 arg="$arg $wl$flag"
1157 compiler_flags="$compiler_flags $flag"
1158 done
1159 IFS="$save_ifs"
1160 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1163 -Wl,*)
1164 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1165 arg=
1166 save_ifs="$IFS"; IFS=','
1167 for flag in $args; do
1168 IFS="$save_ifs"
1169 case $flag in
1170 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1171 flag="\"$flag\""
1173 esac
1174 arg="$arg $wl$flag"
1175 compiler_flags="$compiler_flags $wl$flag"
1176 linker_flags="$linker_flags $flag"
1177 done
1178 IFS="$save_ifs"
1179 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1182 -Xcompiler)
1183 prev=xcompiler
1184 continue
1187 -Xlinker)
1188 prev=xlinker
1189 continue
1192 # Some other compiler flag.
1193 -* | +*)
1194 # Unknown arguments in both finalize_command and compile_command need
1195 # to be aesthetically quoted because they are evaled later.
1196 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1197 case $arg in
1198 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1199 arg="\"$arg\""
1201 esac
1204 *.lo | *.$objext)
1205 # A library or standard object.
1206 if test "$prev" = dlfiles; then
1207 # This file was specified with -dlopen.
1208 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1209 dlfiles="$dlfiles $arg"
1210 prev=
1211 continue
1212 else
1213 # If libtool objects are unsupported, then we need to preload.
1214 prev=dlprefiles
1218 if test "$prev" = dlprefiles; then
1219 # Preload the old-style object.
1220 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1221 prev=
1222 else
1223 case $arg in
1224 *.lo) libobjs="$libobjs $arg" ;;
1225 *) objs="$objs $arg" ;;
1226 esac
1230 *.$libext)
1231 # An archive.
1232 deplibs="$deplibs $arg"
1233 old_deplibs="$old_deplibs $arg"
1234 continue
1237 *.la)
1238 # A libtool-controlled library.
1240 if test "$prev" = dlfiles; then
1241 # This library was specified with -dlopen.
1242 dlfiles="$dlfiles $arg"
1243 prev=
1244 elif test "$prev" = dlprefiles; then
1245 # The library was specified with -dlpreopen.
1246 dlprefiles="$dlprefiles $arg"
1247 prev=
1248 else
1249 deplibs="$deplibs $arg"
1251 continue
1254 # Some other compiler argument.
1256 # Unknown arguments in both finalize_command and compile_command need
1257 # to be aesthetically quoted because they are evaled later.
1258 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1259 case $arg in
1260 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1261 arg="\"$arg\""
1263 esac
1265 esac # arg
1267 # Now actually substitute the argument into the commands.
1268 if test -n "$arg"; then
1269 compile_command="$compile_command $arg"
1270 finalize_command="$finalize_command $arg"
1272 done # argument parsing loop
1274 if test -n "$prev"; then
1275 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1276 $echo "$help" 1>&2
1277 exit 1
1280 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1281 eval arg=\"$export_dynamic_flag_spec\"
1282 compile_command="$compile_command $arg"
1283 finalize_command="$finalize_command $arg"
1286 # calculate the name of the file, without its directory
1287 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1288 libobjs_save="$libobjs"
1290 if test -n "$shlibpath_var"; then
1291 # get the directories listed in $shlibpath_var
1292 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1293 else
1294 shlib_search_path=
1296 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1297 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1299 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1300 if test "X$output_objdir" = "X$output"; then
1301 output_objdir="$objdir"
1302 else
1303 output_objdir="$output_objdir/$objdir"
1305 # Create the object directory.
1306 if test ! -d $output_objdir; then
1307 $show "$mkdir $output_objdir"
1308 $run $mkdir $output_objdir
1309 status=$?
1310 if test $status -ne 0 && test ! -d $output_objdir; then
1311 exit $status
1315 # Determine the type of output
1316 case $output in
1318 $echo "$modename: you must specify an output file" 1>&2
1319 $echo "$help" 1>&2
1320 exit 1
1322 *.$libext) linkmode=oldlib ;;
1323 *.lo | *.$objext) linkmode=obj ;;
1324 *.la) linkmode=lib ;;
1325 *) linkmode=prog ;; # Anything else should be a program.
1326 esac
1328 specialdeplibs=
1329 libs=
1330 # Find all interdependent deplibs by searching for libraries
1331 # that are linked more than once (e.g. -la -lb -la)
1332 for deplib in $deplibs; do
1333 case "$libs " in
1334 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1335 esac
1336 libs="$libs $deplib"
1337 done
1338 deplibs=
1339 newdependency_libs=
1340 newlib_search_path=
1341 need_relink=no # whether we're linking any uninstalled libtool libraries
1342 notinst_deplibs= # not-installed libtool libraries
1343 notinst_path= # paths that contain not-installed libtool libraries
1344 case $linkmode in
1345 lib)
1346 passes="conv link"
1347 for file in $dlfiles $dlprefiles; do
1348 case $file in
1349 *.la) ;;
1351 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1352 exit 1
1354 esac
1355 done
1357 prog)
1358 compile_deplibs=
1359 finalize_deplibs=
1360 alldeplibs=no
1361 newdlfiles=
1362 newdlprefiles=
1363 passes="conv scan dlopen dlpreopen link"
1365 *) passes="conv"
1367 esac
1368 for pass in $passes; do
1369 if test $linkmode = prog; then
1370 # Determine which files to process
1371 case $pass in
1372 dlopen)
1373 libs="$dlfiles"
1374 save_deplibs="$deplibs" # Collect dlpreopened libraries
1375 deplibs=
1377 dlpreopen) libs="$dlprefiles" ;;
1378 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1379 esac
1381 for deplib in $libs; do
1382 lib=
1383 found=no
1384 case $deplib in
1385 -l*)
1386 if test $linkmode = oldlib && test $linkmode = obj; then
1387 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1388 continue
1390 if test $pass = conv; then
1391 deplibs="$deplib $deplibs"
1392 continue
1394 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1395 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1396 # Search the libtool library
1397 lib="$searchdir/lib${name}.la"
1398 if test -f "$lib"; then
1399 found=yes
1400 break
1402 done
1403 if test "$found" != yes; then
1404 # deplib doesn't seem to be a libtool library
1405 if test "$linkmode,$pass" = "prog,link"; then
1406 compile_deplibs="$deplib $compile_deplibs"
1407 finalize_deplibs="$deplib $finalize_deplibs"
1408 else
1409 deplibs="$deplib $deplibs"
1410 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1412 continue
1414 ;; # -l
1415 -L*)
1416 case $linkmode in
1417 lib)
1418 deplibs="$deplib $deplibs"
1419 test $pass = conv && continue
1420 newdependency_libs="$deplib $newdependency_libs"
1421 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1423 prog)
1424 if test $pass = conv; then
1425 deplibs="$deplib $deplibs"
1426 continue
1428 if test $pass = scan; then
1429 deplibs="$deplib $deplibs"
1430 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1431 else
1432 compile_deplibs="$deplib $compile_deplibs"
1433 finalize_deplibs="$deplib $finalize_deplibs"
1437 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1439 esac # linkmode
1440 continue
1441 ;; # -L
1442 -R*)
1443 if test $pass = link; then
1444 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1445 # Make sure the xrpath contains only unique directories.
1446 case "$xrpath " in
1447 *" $dir "*) ;;
1448 *) xrpath="$xrpath $dir" ;;
1449 esac
1451 deplibs="$deplib $deplibs"
1452 continue
1454 *.la) lib="$deplib" ;;
1455 *.$libext)
1456 if test $pass = conv; then
1457 deplibs="$deplib $deplibs"
1458 continue
1460 case $linkmode in
1461 lib)
1462 if test "$deplibs_check_method" != pass_all; then
1463 echo
1464 echo "*** Warning: This library needs some functionality provided by $deplib."
1465 echo "*** I have the capability to make that library automatically link in when"
1466 echo "*** you link to this library. But I can only do this if you have a"
1467 echo "*** shared version of the library, which you do not appear to have."
1468 else
1469 echo
1470 echo "*** Warning: Linking the shared library $output against the"
1471 echo "*** static library $deplib is not portable!"
1472 deplibs="$deplib $deplibs"
1474 continue
1476 prog)
1477 if test $pass != link; then
1478 deplibs="$deplib $deplibs"
1479 else
1480 compile_deplibs="$deplib $compile_deplibs"
1481 finalize_deplibs="$deplib $finalize_deplibs"
1483 continue
1485 esac # linkmode
1486 ;; # *.$libext
1487 *.lo | *.$objext)
1488 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1489 # If there is no dlopen support or we're linking statically,
1490 # we need to preload.
1491 newdlprefiles="$newdlprefiles $deplib"
1492 compile_deplibs="$deplib $compile_deplibs"
1493 finalize_deplibs="$deplib $finalize_deplibs"
1494 else
1495 newdlfiles="$newdlfiles $deplib"
1497 continue
1499 %DEPLIBS%)
1500 alldeplibs=yes
1501 continue
1503 esac # case $deplib
1504 if test $found = yes || test -f "$lib"; then :
1505 else
1506 $echo "$modename: cannot find the library \`$lib'" 1>&2
1507 exit 1
1510 # Check to see that this really is a libtool archive.
1511 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1512 else
1513 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1514 exit 1
1517 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1518 test "X$ladir" = "X$lib" && ladir="."
1520 dlname=
1521 dlopen=
1522 dlpreopen=
1523 libdir=
1524 library_names=
1525 old_library=
1526 # If the library was installed with an old release of libtool,
1527 # it will not redefine variable installed.
1528 installed=yes
1530 # Read the .la file
1531 case $lib in
1532 */* | *\\*) . $lib ;;
1533 *) . ./$lib ;;
1534 esac
1536 if test "$linkmode,$pass" = "lib,link" ||
1537 test "$linkmode,$pass" = "prog,scan" ||
1538 { test $linkmode = oldlib && test $linkmode = obj; }; then
1539 # Add dl[pre]opened files of deplib
1540 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1541 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1544 if test $pass = conv; then
1545 # Only check for convenience libraries
1546 deplibs="$lib $deplibs"
1547 if test -z "$libdir"; then
1548 if test -z "$old_library"; then
1549 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1550 exit 1
1552 # It is a libtool convenience library, so add in its objects.
1553 convenience="$convenience $ladir/$objdir/$old_library"
1554 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1555 tmp_libs=
1556 for deplib in $dependency_libs; do
1557 deplibs="$deplib $deplibs"
1558 case "$tmp_libs " in
1559 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1560 esac
1561 tmp_libs="$tmp_libs $deplib"
1562 done
1563 elif test $linkmode != prog && test $linkmode != lib; then
1564 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1565 exit 1
1567 continue
1568 fi # $pass = conv
1570 # Get the name of the library we link against.
1571 linklib=
1572 for l in $old_library $library_names; do
1573 linklib="$l"
1574 done
1575 if test -z "$linklib"; then
1576 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1577 exit 1
1580 # This library was specified with -dlopen.
1581 if test $pass = dlopen; then
1582 if test -z "$libdir"; then
1583 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1584 exit 1
1586 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1587 # If there is no dlname, no dlopen support or we're linking
1588 # statically, we need to preload.
1589 dlprefiles="$dlprefiles $lib"
1590 else
1591 newdlfiles="$newdlfiles $lib"
1593 continue
1594 fi # $pass = dlopen
1596 # We need an absolute path.
1597 case $ladir in
1598 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1600 abs_ladir=`cd "$ladir" && pwd`
1601 if test -z "$abs_ladir"; then
1602 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1603 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1604 abs_ladir="$ladir"
1607 esac
1608 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1610 # Find the relevant object directory and library name.
1611 if test "X$installed" = Xyes; then
1612 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1613 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1614 dir="$ladir"
1615 absdir="$abs_ladir"
1616 libdir="$abs_ladir"
1617 else
1618 dir="$libdir"
1619 absdir="$libdir"
1621 else
1622 dir="$ladir/$objdir"
1623 absdir="$abs_ladir/$objdir"
1624 # Remove this search path later
1625 notinst_path="$notinst_path $abs_ladir"
1626 fi # $installed = yes
1627 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1629 # This library was specified with -dlpreopen.
1630 if test $pass = dlpreopen; then
1631 if test -z "$libdir"; then
1632 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1633 exit 1
1635 # Prefer using a static library (so that no silly _DYNAMIC symbols
1636 # are required to link).
1637 if test -n "$old_library"; then
1638 newdlprefiles="$newdlprefiles $dir/$old_library"
1639 # Otherwise, use the dlname, so that lt_dlopen finds it.
1640 elif test -n "$dlname"; then
1641 newdlprefiles="$newdlprefiles $dir/$dlname"
1642 else
1643 newdlprefiles="$newdlprefiles $dir/$linklib"
1645 fi # $pass = dlpreopen
1647 if test -z "$libdir"; then
1648 # Link the convenience library
1649 if test $linkmode = lib; then
1650 deplibs="$dir/$old_library $deplibs"
1651 elif test "$linkmode,$pass" = "prog,link"; then
1652 compile_deplibs="$dir/$old_library $compile_deplibs"
1653 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1654 else
1655 deplibs="$lib $deplibs"
1657 continue
1660 if test $linkmode = prog && test $pass != link; then
1661 newlib_search_path="$newlib_search_path $ladir"
1662 deplibs="$lib $deplibs"
1664 linkalldeplibs=no
1665 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1666 test "$build_libtool_libs" = no; then
1667 linkalldeplibs=yes
1670 tmp_libs=
1671 for deplib in $dependency_libs; do
1672 case $deplib in
1673 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1674 esac
1675 # Need to link against all dependency_libs?
1676 if test $linkalldeplibs = yes; then
1677 deplibs="$deplib $deplibs"
1678 else
1679 # Need to hardcode shared library paths
1680 # or/and link against static libraries
1681 newdependency_libs="$deplib $newdependency_libs"
1683 case "$tmp_libs " in
1684 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1685 esac
1686 tmp_libs="$tmp_libs $deplib"
1687 done # for deplib
1688 continue
1689 fi # $linkmode = prog...
1691 link_static=no # Whether the deplib will be linked statically
1692 if test -n "$library_names" &&
1693 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1694 # Link against this shared library
1696 if test "$linkmode,$pass" = "prog,link" ||
1697 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1698 # Hardcode the library path.
1699 # Skip directories that are in the system default run-time
1700 # search path.
1701 case " $sys_lib_dlsearch_path " in
1702 *" $absdir "*) ;;
1704 case "$compile_rpath " in
1705 *" $absdir "*) ;;
1706 *) compile_rpath="$compile_rpath $absdir"
1707 esac
1709 esac
1710 case " $sys_lib_dlsearch_path " in
1711 *" $libdir "*) ;;
1713 case "$finalize_rpath " in
1714 *" $libdir "*) ;;
1715 *) finalize_rpath="$finalize_rpath $libdir"
1716 esac
1718 esac
1719 if test $linkmode = prog; then
1720 # We need to hardcode the library path
1721 if test -n "$shlibpath_var"; then
1722 # Make sure the rpath contains only unique directories.
1723 case "$temp_rpath " in
1724 *" $dir "*) ;;
1725 *" $absdir "*) ;;
1726 *) temp_rpath="$temp_rpath $dir" ;;
1727 esac
1730 fi # $linkmode,$pass = prog,link...
1732 if test "$alldeplibs" = yes &&
1733 { test "$deplibs_check_method" = pass_all ||
1734 { test "$build_libtool_libs" = yes &&
1735 test -n "$library_names"; }; }; then
1736 # We only need to search for static libraries
1737 continue
1740 if test "$installed" = no; then
1741 notinst_deplibs="$notinst_deplibs $lib"
1742 need_relink=yes
1745 if test -n "$old_archive_from_expsyms_cmds"; then
1746 # figure out the soname
1747 set dummy $library_names
1748 realname="$2"
1749 shift; shift
1750 libname=`eval \\$echo \"$libname_spec\"`
1751 # use dlname if we got it. it's perfectly good, no?
1752 if test -n "$dlname"; then
1753 soname="$dlname"
1754 elif test -n "$soname_spec"; then
1755 # bleh windows
1756 case $host in
1757 *cygwin*)
1758 major=`expr $current - $age`
1759 versuffix="-$major"
1761 esac
1762 eval soname=\"$soname_spec\"
1763 else
1764 soname="$realname"
1767 # Make a new name for the extract_expsyms_cmds to use
1768 soroot="$soname"
1769 soname=`echo $soroot | sed -e 's/^.*\///'`
1770 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1772 # If the library has no export list, then create one now
1773 if test -f "$output_objdir/$soname-def"; then :
1774 else
1775 $show "extracting exported symbol list from \`$soname'"
1776 save_ifs="$IFS"; IFS='~'
1777 eval cmds=\"$extract_expsyms_cmds\"
1778 for cmd in $cmds; do
1779 IFS="$save_ifs"
1780 $show "$cmd"
1781 $run eval "$cmd" || exit $?
1782 done
1783 IFS="$save_ifs"
1786 # Create $newlib
1787 if test -f "$output_objdir/$newlib"; then :; else
1788 $show "generating import library for \`$soname'"
1789 save_ifs="$IFS"; IFS='~'
1790 eval cmds=\"$old_archive_from_expsyms_cmds\"
1791 for cmd in $cmds; do
1792 IFS="$save_ifs"
1793 $show "$cmd"
1794 $run eval "$cmd" || exit $?
1795 done
1796 IFS="$save_ifs"
1798 # make sure the library variables are pointing to the new library
1799 dir=$output_objdir
1800 linklib=$newlib
1801 fi # test -n $old_archive_from_expsyms_cmds
1803 if test $linkmode = prog || test "$mode" != relink; then
1804 add_shlibpath=
1805 add_dir=
1806 add=
1807 lib_linked=yes
1808 case $hardcode_action in
1809 immediate | unsupported)
1810 if test "$hardcode_direct" = no; then
1811 add="$dir/$linklib"
1812 elif test "$hardcode_minus_L" = no; then
1813 case $host in
1814 *-*-sunos*) add_shlibpath="$dir" ;;
1815 esac
1816 add_dir="-L$dir"
1817 add="-l$name"
1818 elif test "$hardcode_shlibpath_var" = no; then
1819 add_shlibpath="$dir"
1820 add="-l$name"
1821 else
1822 lib_linked=no
1825 relink)
1826 if test "$hardcode_direct" = yes; then
1827 add="$dir/$linklib"
1828 elif test "$hardcode_minus_L" = yes; then
1829 add_dir="-L$dir"
1830 add="-l$name"
1831 elif test "$hardcode_shlibpath_var" = yes; then
1832 add_shlibpath="$dir"
1833 add="-l$name"
1834 else
1835 lib_linked=no
1838 *) lib_linked=no ;;
1839 esac
1841 if test "$lib_linked" != yes; then
1842 $echo "$modename: configuration error: unsupported hardcode properties"
1843 exit 1
1846 if test -n "$add_shlibpath"; then
1847 case :$compile_shlibpath: in
1848 *":$add_shlibpath:"*) ;;
1849 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1850 esac
1852 if test $linkmode = prog; then
1853 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1854 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1855 else
1856 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1857 test -n "$add" && deplibs="$add $deplibs"
1858 if test "$hardcode_direct" != yes && \
1859 test "$hardcode_minus_L" != yes && \
1860 test "$hardcode_shlibpath_var" = yes; then
1861 case :$finalize_shlibpath: in
1862 *":$libdir:"*) ;;
1863 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1864 esac
1869 if test $linkmode = prog || test "$mode" = relink; then
1870 add_shlibpath=
1871 add_dir=
1872 add=
1873 # Finalize command for both is simple: just hardcode it.
1874 if test "$hardcode_direct" = yes; then
1875 add="$libdir/$linklib"
1876 elif test "$hardcode_minus_L" = yes; then
1877 add_dir="-L$libdir"
1878 add="-l$name"
1879 elif test "$hardcode_shlibpath_var" = yes; then
1880 case :$finalize_shlibpath: in
1881 *":$libdir:"*) ;;
1882 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1883 esac
1884 add="-l$name"
1885 else
1886 # We cannot seem to hardcode it, guess we'll fake it.
1887 add_dir="-L$libdir"
1888 add="-l$name"
1891 if test $linkmode = prog; then
1892 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1893 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1894 else
1895 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1896 test -n "$add" && deplibs="$add $deplibs"
1899 elif test $linkmode = prog; then
1900 if test "$alldeplibs" = yes &&
1901 { test "$deplibs_check_method" = pass_all ||
1902 { test "$build_libtool_libs" = yes &&
1903 test -n "$library_names"; }; }; then
1904 # We only need to search for static libraries
1905 continue
1908 # Try to link the static library
1909 # Here we assume that one of hardcode_direct or hardcode_minus_L
1910 # is not unsupported. This is valid on all known static and
1911 # shared platforms.
1912 if test "$hardcode_direct" != unsupported; then
1913 test -n "$old_library" && linklib="$old_library"
1914 compile_deplibs="$dir/$linklib $compile_deplibs"
1915 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1916 else
1917 compile_deplibs="-l$name -L$dir $compile_deplibs"
1918 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1920 elif test "$build_libtool_libs" = yes; then
1921 # Not a shared library
1922 if test "$deplibs_check_method" != pass_all; then
1923 # We're trying link a shared library against a static one
1924 # but the system doesn't support it.
1926 # Just print a warning and add the library to dependency_libs so
1927 # that the program can be linked against the static library.
1928 echo
1929 echo "*** Warning: This library needs some functionality provided by $lib."
1930 echo "*** I have the capability to make that library automatically link in when"
1931 echo "*** you link to this library. But I can only do this if you have a"
1932 echo "*** shared version of the library, which you do not appear to have."
1933 if test "$module" = yes; then
1934 echo "*** Therefore, libtool will create a static module, that should work "
1935 echo "*** as long as the dlopening application is linked with the -dlopen flag."
1936 if test -z "$global_symbol_pipe"; then
1937 echo
1938 echo "*** However, this would only work if libtool was able to extract symbol"
1939 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1940 echo "*** not find such a program. So, this module is probably useless."
1941 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1943 if test "$build_old_libs" = no; then
1944 build_libtool_libs=module
1945 build_old_libs=yes
1946 else
1947 build_libtool_libs=no
1950 else
1951 convenience="$convenience $dir/$old_library"
1952 old_convenience="$old_convenience $dir/$old_library"
1953 deplibs="$dir/$old_library $deplibs"
1954 link_static=yes
1956 fi # link shared/static library?
1958 if test $linkmode = lib; then
1959 if test -n "$dependency_libs" &&
1960 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1961 test $link_static = yes; }; then
1962 # Extract -R from dependency_libs
1963 temp_deplibs=
1964 for libdir in $dependency_libs; do
1965 case $libdir in
1966 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1967 case " $xrpath " in
1968 *" $temp_xrpath "*) ;;
1969 *) xrpath="$xrpath $temp_xrpath";;
1970 esac;;
1971 *) temp_deplibs="$temp_deplibs $libdir";;
1972 esac
1973 done
1974 dependency_libs="$temp_deplibs"
1977 newlib_search_path="$newlib_search_path $absdir"
1978 # Link against this library
1979 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1980 # ... and its dependency_libs
1981 tmp_libs=
1982 for deplib in $dependency_libs; do
1983 newdependency_libs="$deplib $newdependency_libs"
1984 case "$tmp_libs " in
1985 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1986 esac
1987 tmp_libs="$tmp_libs $deplib"
1988 done
1990 if test $link_all_deplibs != no; then
1991 # Add the search paths of all dependency libraries
1992 for deplib in $dependency_libs; do
1993 case $deplib in
1994 -L*) path="$deplib" ;;
1995 *.la)
1996 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
1997 test "X$dir" = "X$deplib" && dir="."
1998 # We need an absolute path.
1999 case $dir in
2000 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2002 absdir=`cd "$dir" && pwd`
2003 if test -z "$absdir"; then
2004 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2005 absdir="$dir"
2008 esac
2009 if grep "^installed=no" $deplib > /dev/null; then
2010 path="-L$absdir/$objdir"
2011 else
2012 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2013 if test -z "$libdir"; then
2014 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2015 exit 1
2017 if test "$absdir" != "$libdir"; then
2018 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2020 path="-L$absdir"
2023 *) continue ;;
2024 esac
2025 case " $deplibs " in
2026 *" $path "*) ;;
2027 *) deplibs="$deplibs $path" ;;
2028 esac
2029 done
2030 fi # link_all_deplibs != no
2031 fi # linkmode = lib
2032 done # for deplib in $libs
2033 if test $pass = dlpreopen; then
2034 # Link the dlpreopened libraries before other libraries
2035 for deplib in $save_deplibs; do
2036 deplibs="$deplib $deplibs"
2037 done
2039 if test $pass != dlopen; then
2040 test $pass != scan && dependency_libs="$newdependency_libs"
2041 if test $pass != conv; then
2042 # Make sure lib_search_path contains only unique directories.
2043 lib_search_path=
2044 for dir in $newlib_search_path; do
2045 case "$lib_search_path " in
2046 *" $dir "*) ;;
2047 *) lib_search_path="$lib_search_path $dir" ;;
2048 esac
2049 done
2050 newlib_search_path=
2053 if test "$linkmode,$pass" != "prog,link"; then
2054 vars="deplibs"
2055 else
2056 vars="compile_deplibs finalize_deplibs"
2058 for var in $vars dependency_libs; do
2059 # Add libraries to $var in reverse order
2060 eval tmp_libs=\"\$$var\"
2061 new_libs=
2062 for deplib in $tmp_libs; do
2063 case $deplib in
2064 -L*) new_libs="$deplib $new_libs" ;;
2066 case " $specialdeplibs " in
2067 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2069 case " $new_libs " in
2070 *" $deplib "*) ;;
2071 *) new_libs="$deplib $new_libs" ;;
2072 esac
2074 esac
2076 esac
2077 done
2078 tmp_libs=
2079 for deplib in $new_libs; do
2080 case $deplib in
2081 -L*)
2082 case " $tmp_libs " in
2083 *" $deplib "*) ;;
2084 *) tmp_libs="$tmp_libs $deplib" ;;
2085 esac
2087 *) tmp_libs="$tmp_libs $deplib" ;;
2088 esac
2089 done
2090 eval $var=\"$tmp_libs\"
2091 done # for var
2093 if test "$pass" = "conv" &&
2094 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2095 libs="$deplibs" # reset libs
2096 deplibs=
2098 done # for pass
2099 if test $linkmode = prog; then
2100 dlfiles="$newdlfiles"
2101 dlprefiles="$newdlprefiles"
2104 case $linkmode in
2105 oldlib)
2106 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2107 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2110 if test -n "$rpath"; then
2111 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2114 if test -n "$xrpath"; then
2115 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2118 if test -n "$vinfo"; then
2119 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2122 if test -n "$release"; then
2123 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2126 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2127 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2130 # Now set the variables for building old libraries.
2131 build_libtool_libs=no
2132 oldlibs="$output"
2133 objs="$objs$old_deplibs"
2136 lib)
2137 # Make sure we only generate libraries of the form `libNAME.la'.
2138 case $outputname in
2139 lib*)
2140 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2141 eval libname=\"$libname_spec\"
2144 if test "$module" = no; then
2145 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2146 $echo "$help" 1>&2
2147 exit 1
2149 if test "$need_lib_prefix" != no; then
2150 # Add the "lib" prefix for modules if required
2151 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2152 eval libname=\"$libname_spec\"
2153 else
2154 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2157 esac
2159 if test -n "$objs"; then
2160 if test "$deplibs_check_method" != pass_all; then
2161 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2162 exit 1
2163 else
2164 echo
2165 echo "*** Warning: Linking the shared library $output against the non-libtool"
2166 echo "*** objects $objs is not portable!"
2167 libobjs="$libobjs $objs"
2171 if test "$dlself" != no; then
2172 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2175 set dummy $rpath
2176 if test $# -gt 2; then
2177 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2179 install_libdir="$2"
2181 oldlibs=
2182 if test -z "$rpath"; then
2183 if test "$build_libtool_libs" = yes; then
2184 # Building a libtool convenience library.
2185 libext=al
2186 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2187 build_libtool_libs=convenience
2188 build_old_libs=yes
2191 if test -n "$vinfo"; then
2192 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2195 if test -n "$release"; then
2196 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2198 else
2200 # Parse the version information argument.
2201 save_ifs="$IFS"; IFS=':'
2202 set dummy $vinfo 0 0 0
2203 IFS="$save_ifs"
2205 if test -n "$8"; then
2206 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2207 $echo "$help" 1>&2
2208 exit 1
2211 current="$2"
2212 revision="$3"
2213 age="$4"
2215 # Check that each of the things are valid numbers.
2216 case $current in
2217 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2219 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2220 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2221 exit 1
2223 esac
2225 case $revision in
2226 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2228 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2229 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2230 exit 1
2232 esac
2234 case $age in
2235 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2237 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2238 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2239 exit 1
2241 esac
2243 if test $age -gt $current; then
2244 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2245 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2246 exit 1
2249 # Calculate the version variables.
2250 major=
2251 versuffix=
2252 verstring=
2253 case $version_type in
2254 none) ;;
2256 darwin)
2257 # Like Linux, but with the current version available in
2258 # verstring for coding it into the library header
2259 major=.`expr $current - $age`
2260 versuffix="$major.$age.$revision"
2261 # Darwin ld doesn't like 0 for these options...
2262 minor_current=`expr $current + 1`
2263 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2266 freebsd-aout)
2267 major=".$current"
2268 versuffix=".$current.$revision";
2271 freebsd-elf)
2272 major=".$current"
2273 versuffix=".$current";
2276 irix)
2277 major=`expr $current - $age + 1`
2278 verstring="sgi$major.$revision"
2280 # Add in all the interfaces that we are compatible with.
2281 loop=$revision
2282 while test $loop != 0; do
2283 iface=`expr $revision - $loop`
2284 loop=`expr $loop - 1`
2285 verstring="sgi$major.$iface:$verstring"
2286 done
2288 # Before this point, $major must not contain `.'.
2289 major=.$major
2290 versuffix="$major.$revision"
2293 linux)
2294 major=.`expr $current - $age`
2295 versuffix="$major.$age.$revision"
2298 osf)
2299 major=`expr $current - $age`
2300 versuffix=".$current.$age.$revision"
2301 verstring="$current.$age.$revision"
2303 # Add in all the interfaces that we are compatible with.
2304 loop=$age
2305 while test $loop != 0; do
2306 iface=`expr $current - $loop`
2307 loop=`expr $loop - 1`
2308 verstring="$verstring:${iface}.0"
2309 done
2311 # Make executables depend on our current version.
2312 verstring="$verstring:${current}.0"
2315 sunos)
2316 major=".$current"
2317 versuffix=".$current.$revision"
2320 windows)
2321 # Use '-' rather than '.', since we only want one
2322 # extension on DOS 8.3 filesystems.
2323 major=`expr $current - $age`
2324 versuffix="-$major"
2328 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2329 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2330 exit 1
2332 esac
2334 # Clear the version info if we defaulted, and they specified a release.
2335 if test -z "$vinfo" && test -n "$release"; then
2336 major=
2337 verstring="0.0"
2338 case $version_type in
2339 darwin)
2340 # we can't check for "0.0" in archive_cmds due to quoting
2341 # problems, so we reset it completely
2342 verstring=""
2345 verstring="0.0"
2347 esac
2348 if test "$need_version" = no; then
2349 versuffix=
2350 else
2351 versuffix=".0.0"
2355 # Remove version info from name if versioning should be avoided
2356 if test "$avoid_version" = yes && test "$need_version" = no; then
2357 major=
2358 versuffix=
2359 verstring=""
2362 # Check to see if the archive will have undefined symbols.
2363 if test "$allow_undefined" = yes; then
2364 if test "$allow_undefined_flag" = unsupported; then
2365 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2366 build_libtool_libs=no
2367 build_old_libs=yes
2369 else
2370 # Don't allow undefined symbols.
2371 allow_undefined_flag="$no_undefined_flag"
2375 if test "$mode" != relink; then
2376 # Remove our outputs.
2377 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2378 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2381 # Now set the variables for building old libraries.
2382 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2383 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2385 # Transform .lo files to .o files.
2386 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2389 # Eliminate all temporary directories.
2390 for path in $notinst_path; do
2391 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2392 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2393 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2394 done
2396 if test -n "$xrpath"; then
2397 # If the user specified any rpath flags, then add them.
2398 temp_xrpath=
2399 for libdir in $xrpath; do
2400 temp_xrpath="$temp_xrpath -R$libdir"
2401 case "$finalize_rpath " in
2402 *" $libdir "*) ;;
2403 *) finalize_rpath="$finalize_rpath $libdir" ;;
2404 esac
2405 done
2406 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2407 dependency_libs="$temp_xrpath $dependency_libs"
2411 # Make sure dlfiles contains only unique files that won't be dlpreopened
2412 old_dlfiles="$dlfiles"
2413 dlfiles=
2414 for lib in $old_dlfiles; do
2415 case " $dlprefiles $dlfiles " in
2416 *" $lib "*) ;;
2417 *) dlfiles="$dlfiles $lib" ;;
2418 esac
2419 done
2421 # Make sure dlprefiles contains only unique files
2422 old_dlprefiles="$dlprefiles"
2423 dlprefiles=
2424 for lib in $old_dlprefiles; do
2425 case "$dlprefiles " in
2426 *" $lib "*) ;;
2427 *) dlprefiles="$dlprefiles $lib" ;;
2428 esac
2429 done
2431 if test "$build_libtool_libs" = yes; then
2432 if test -n "$rpath"; then
2433 case $host in
2434 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2435 # these systems don't actually have a c library (as such)!
2437 *-*-rhapsody* | *-*-darwin1.[012])
2438 # Rhapsody C library is in the System framework
2439 deplibs="$deplibs -framework System"
2441 *-*-netbsd*)
2442 # Don't link with libc until the a.out ld.so is fixed.
2444 *-*-openbsd*)
2445 # Do not include libc due to us having libc/libc_r.
2448 # Add libc to deplibs on all other systems if necessary.
2449 if test $build_libtool_need_lc = "yes"; then
2450 deplibs="$deplibs -lc"
2453 esac
2456 # Transform deplibs into only deplibs that can be linked in shared.
2457 name_save=$name
2458 libname_save=$libname
2459 release_save=$release
2460 versuffix_save=$versuffix
2461 major_save=$major
2462 # I'm not sure if I'm treating the release correctly. I think
2463 # release should show up in the -l (ie -lgmp5) so we don't want to
2464 # add it in twice. Is that correct?
2465 release=""
2466 versuffix=""
2467 major=""
2468 newdeplibs=
2469 droppeddeps=no
2470 case $deplibs_check_method in
2471 pass_all)
2472 # Don't check for shared/static. Everything works.
2473 # This might be a little naive. We might want to check
2474 # whether the library exists or not. But this is on
2475 # osf3 & osf4 and I'm not really sure... Just
2476 # implementing what was already the behaviour.
2477 newdeplibs=$deplibs
2479 test_compile)
2480 # This code stresses the "libraries are programs" paradigm to its
2481 # limits. Maybe even breaks it. We compile a program, linking it
2482 # against the deplibs as a proxy for the library. Then we can check
2483 # whether they linked in statically or dynamically with ldd.
2484 $rm conftest.c
2485 cat > conftest.c <<EOF
2486 int main() { return 0; }
2488 $rm conftest
2489 $CC -o conftest conftest.c $deplibs
2490 if test $? -eq 0 ; then
2491 ldd_output=`ldd conftest`
2492 for i in $deplibs; do
2493 name="`expr $i : '-l\(.*\)'`"
2494 # If $name is empty we are operating on a -L argument.
2495 if test -n "$name" && test "$name" != "0"; then
2496 libname=`eval \\$echo \"$libname_spec\"`
2497 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2498 set dummy $deplib_matches
2499 deplib_match=$2
2500 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2501 newdeplibs="$newdeplibs $i"
2502 else
2503 droppeddeps=yes
2504 echo
2505 echo "*** Warning: This library needs some functionality provided by $i."
2506 echo "*** I have the capability to make that library automatically link in when"
2507 echo "*** you link to this library. But I can only do this if you have a"
2508 echo "*** shared version of the library, which you do not appear to have."
2510 else
2511 newdeplibs="$newdeplibs $i"
2513 done
2514 else
2515 # Error occured in the first compile. Let's try to salvage the situation:
2516 # Compile a seperate program for each library.
2517 for i in $deplibs; do
2518 name="`expr $i : '-l\(.*\)'`"
2519 # If $name is empty we are operating on a -L argument.
2520 if test -n "$name" && test "$name" != "0"; then
2521 $rm conftest
2522 $CC -o conftest conftest.c $i
2523 # Did it work?
2524 if test $? -eq 0 ; then
2525 ldd_output=`ldd conftest`
2526 libname=`eval \\$echo \"$libname_spec\"`
2527 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2528 set dummy $deplib_matches
2529 deplib_match=$2
2530 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2531 newdeplibs="$newdeplibs $i"
2532 else
2533 droppeddeps=yes
2534 echo
2535 echo "*** Warning: This library needs some functionality provided by $i."
2536 echo "*** I have the capability to make that library automatically link in when"
2537 echo "*** you link to this library. But I can only do this if you have a"
2538 echo "*** shared version of the library, which you do not appear to have."
2540 else
2541 droppeddeps=yes
2542 echo
2543 echo "*** Warning! Library $i is needed by this library but I was not able to"
2544 echo "*** make it link in! You will probably need to install it or some"
2545 echo "*** library that it depends on before this library will be fully"
2546 echo "*** functional. Installing it before continuing would be even better."
2548 else
2549 newdeplibs="$newdeplibs $i"
2551 done
2554 file_magic*)
2555 set dummy $deplibs_check_method
2556 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2557 for a_deplib in $deplibs; do
2558 name="`expr $a_deplib : '-l\(.*\)'`"
2559 # If $name is empty we are operating on a -L argument.
2560 if test -n "$name" && test "$name" != "0"; then
2561 libname=`eval \\$echo \"$libname_spec\"`
2562 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2563 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2564 for potent_lib in $potential_libs; do
2565 # Follow soft links.
2566 if ls -lLd "$potent_lib" 2>/dev/null \
2567 | grep " -> " >/dev/null; then
2568 continue
2570 # The statement above tries to avoid entering an
2571 # endless loop below, in case of cyclic links.
2572 # We might still enter an endless loop, since a link
2573 # loop can be closed while we follow links,
2574 # but so what?
2575 potlib="$potent_lib"
2576 while test -h "$potlib" 2>/dev/null; do
2577 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2578 case $potliblink in
2579 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2580 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2581 esac
2582 done
2583 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2584 | sed 10q \
2585 | egrep "$file_magic_regex" > /dev/null; then
2586 newdeplibs="$newdeplibs $a_deplib"
2587 a_deplib=""
2588 break 2
2590 done
2591 done
2592 if test -n "$a_deplib" ; then
2593 droppeddeps=yes
2594 echo
2595 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2596 echo "*** I have the capability to make that library automatically link in when"
2597 echo "*** you link to this library. But I can only do this if you have a"
2598 echo "*** shared version of the library, which you do not appear to have."
2600 else
2601 # Add a -L argument.
2602 newdeplibs="$newdeplibs $a_deplib"
2604 done # Gone through all deplibs.
2606 match_pattern*)
2607 set dummy $deplibs_check_method
2608 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2609 for a_deplib in $deplibs; do
2610 name="`expr $a_deplib : '-l\(.*\)'`"
2611 # If $name is empty we are operating on a -L argument.
2612 if test -n "$name" && test "$name" != "0"; then
2613 libname=`eval \\$echo \"$libname_spec\"`
2614 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2615 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2616 for potent_lib in $potential_libs; do
2617 if eval echo \"$potent_lib\" 2>/dev/null \
2618 | sed 10q \
2619 | egrep "$match_pattern_regex" > /dev/null; then
2620 newdeplibs="$newdeplibs $a_deplib"
2621 a_deplib=""
2622 break 2
2624 done
2625 done
2626 if test -n "$a_deplib" ; then
2627 droppeddeps=yes
2628 echo
2629 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2630 echo "*** I have the capability to make that library automatically link in when"
2631 echo "*** you link to this library. But I can only do this if you have a"
2632 echo "*** shared version of the library, which you do not appear to have."
2634 else
2635 # Add a -L argument.
2636 newdeplibs="$newdeplibs $a_deplib"
2638 done # Gone through all deplibs.
2640 none | unknown | *)
2641 newdeplibs=""
2642 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2643 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2644 grep . >/dev/null; then
2645 echo
2646 if test "X$deplibs_check_method" = "Xnone"; then
2647 echo "*** Warning: inter-library dependencies are not supported in this platform."
2648 else
2649 echo "*** Warning: inter-library dependencies are not known to be supported."
2651 echo "*** All declared inter-library dependencies are being dropped."
2652 droppeddeps=yes
2655 esac
2656 versuffix=$versuffix_save
2657 major=$major_save
2658 release=$release_save
2659 libname=$libname_save
2660 name=$name_save
2662 case $host in
2663 *-*-rhapsody* | *-*-darwin1.[012])
2664 # On Rhapsody replace the C library is the System framework
2665 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2667 esac
2669 if test "$droppeddeps" = yes; then
2670 if test "$module" = yes; then
2671 echo
2672 echo "*** Warning: libtool could not satisfy all declared inter-library"
2673 echo "*** dependencies of module $libname. Therefore, libtool will create"
2674 echo "*** a static module, that should work as long as the dlopening"
2675 echo "*** application is linked with the -dlopen flag."
2676 if test -z "$global_symbol_pipe"; then
2677 echo
2678 echo "*** However, this would only work if libtool was able to extract symbol"
2679 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2680 echo "*** not find such a program. So, this module is probably useless."
2681 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2683 if test "$build_old_libs" = no; then
2684 oldlibs="$output_objdir/$libname.$libext"
2685 build_libtool_libs=module
2686 build_old_libs=yes
2687 else
2688 build_libtool_libs=no
2690 else
2691 echo "*** The inter-library dependencies that have been dropped here will be"
2692 echo "*** automatically added whenever a program is linked with this library"
2693 echo "*** or is declared to -dlopen it."
2695 if test $allow_undefined = no; then
2696 echo
2697 echo "*** Since this library must not contain undefined symbols,"
2698 echo "*** because either the platform does not support them or"
2699 echo "*** it was explicitly requested with -no-undefined,"
2700 echo "*** libtool will only create a static version of it."
2701 if test "$build_old_libs" = no; then
2702 oldlibs="$output_objdir/$libname.$libext"
2703 build_libtool_libs=module
2704 build_old_libs=yes
2705 else
2706 build_libtool_libs=no
2711 # Done checking deplibs!
2712 deplibs=$newdeplibs
2715 # All the library-specific variables (install_libdir is set above).
2716 library_names=
2717 old_library=
2718 dlname=
2720 # Test again, we may have decided not to build it any more
2721 if test "$build_libtool_libs" = yes; then
2722 if test $hardcode_into_libs = yes; then
2723 # Hardcode the library paths
2724 hardcode_libdirs=
2725 dep_rpath=
2726 rpath="$finalize_rpath"
2727 test "$mode" != relink && rpath="$compile_rpath$rpath"
2728 for libdir in $rpath; do
2729 if test -n "$hardcode_libdir_flag_spec"; then
2730 if test -n "$hardcode_libdir_separator"; then
2731 if test -z "$hardcode_libdirs"; then
2732 hardcode_libdirs="$libdir"
2733 else
2734 # Just accumulate the unique libdirs.
2735 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2736 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2739 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2741 esac
2743 else
2744 eval flag=\"$hardcode_libdir_flag_spec\"
2745 dep_rpath="$dep_rpath $flag"
2747 elif test -n "$runpath_var"; then
2748 case "$perm_rpath " in
2749 *" $libdir "*) ;;
2750 *) perm_rpath="$perm_rpath $libdir" ;;
2751 esac
2753 done
2754 # Substitute the hardcoded libdirs into the rpath.
2755 if test -n "$hardcode_libdir_separator" &&
2756 test -n "$hardcode_libdirs"; then
2757 libdir="$hardcode_libdirs"
2758 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2760 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2761 # We should set the runpath_var.
2762 rpath=
2763 for dir in $perm_rpath; do
2764 rpath="$rpath$dir:"
2765 done
2766 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2768 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2771 shlibpath="$finalize_shlibpath"
2772 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2773 if test -n "$shlibpath"; then
2774 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2777 # Get the real and link names of the library.
2778 eval library_names=\"$library_names_spec\"
2779 set dummy $library_names
2780 realname="$2"
2781 shift; shift
2783 if test -n "$soname_spec"; then
2784 eval soname=\"$soname_spec\"
2785 else
2786 soname="$realname"
2788 test -z "$dlname" && dlname=$soname
2790 lib="$output_objdir/$realname"
2791 for link
2793 linknames="$linknames $link"
2794 done
2796 # Ensure that we have .o objects for linkers which dislike .lo
2797 # (e.g. aix) in case we are running --disable-static
2798 for obj in $libobjs; do
2799 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2800 if test "X$xdir" = "X$obj"; then
2801 xdir="."
2802 else
2803 xdir="$xdir"
2805 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2806 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2807 if test ! -f $xdir/$oldobj; then
2808 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2809 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2811 done
2813 # Use standard objects if they are pic
2814 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2816 # Prepare the list of exported symbols
2817 if test -z "$export_symbols"; then
2818 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2819 $show "generating symbol list for \`$libname.la'"
2820 export_symbols="$output_objdir/$libname.exp"
2821 $run $rm $export_symbols
2822 eval cmds=\"$export_symbols_cmds\"
2823 save_ifs="$IFS"; IFS='~'
2824 for cmd in $cmds; do
2825 IFS="$save_ifs"
2826 $show "$cmd"
2827 $run eval "$cmd" || exit $?
2828 done
2829 IFS="$save_ifs"
2830 if test -n "$export_symbols_regex"; then
2831 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2832 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2833 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2834 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2839 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2840 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2843 if test -n "$convenience"; then
2844 if test -n "$whole_archive_flag_spec"; then
2845 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2846 else
2847 gentop="$output_objdir/${outputname}x"
2848 $show "${rm}r $gentop"
2849 $run ${rm}r "$gentop"
2850 $show "mkdir $gentop"
2851 $run mkdir "$gentop"
2852 status=$?
2853 if test $status -ne 0 && test ! -d "$gentop"; then
2854 exit $status
2856 generated="$generated $gentop"
2858 for xlib in $convenience; do
2859 # Extract the objects.
2860 case $xlib in
2861 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2862 *) xabs=`pwd`"/$xlib" ;;
2863 esac
2864 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2865 xdir="$gentop/$xlib"
2867 $show "${rm}r $xdir"
2868 $run ${rm}r "$xdir"
2869 $show "mkdir $xdir"
2870 $run mkdir "$xdir"
2871 status=$?
2872 if test $status -ne 0 && test ! -d "$xdir"; then
2873 exit $status
2875 $show "(cd $xdir && $AR x $xabs)"
2876 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2878 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2879 done
2883 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2884 eval flag=\"$thread_safe_flag_spec\"
2885 linker_flags="$linker_flags $flag"
2888 # Make a backup of the uninstalled library when relinking
2889 if test "$mode" = relink; then
2890 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2893 # Do each of the archive commands.
2894 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2895 eval cmds=\"$archive_expsym_cmds\"
2896 else
2897 eval cmds=\"$archive_cmds\"
2899 save_ifs="$IFS"; IFS='~'
2900 for cmd in $cmds; do
2901 IFS="$save_ifs"
2902 $show "$cmd"
2903 $run eval "$cmd" || exit $?
2904 done
2905 IFS="$save_ifs"
2907 # Restore the uninstalled library and exit
2908 if test "$mode" = relink; then
2909 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2910 exit 0
2913 # Create links to the real library.
2914 for linkname in $linknames; do
2915 if test "$realname" != "$linkname"; then
2916 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2917 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2919 done
2921 # If -module or -export-dynamic was specified, set the dlname.
2922 if test "$module" = yes || test "$export_dynamic" = yes; then
2923 # On all known operating systems, these are identical.
2924 dlname="$soname"
2929 obj)
2930 if test -n "$deplibs"; then
2931 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2934 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2935 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2938 if test -n "$rpath"; then
2939 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2942 if test -n "$xrpath"; then
2943 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2946 if test -n "$vinfo"; then
2947 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2950 if test -n "$release"; then
2951 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2954 case $output in
2955 *.lo)
2956 if test -n "$objs$old_deplibs"; then
2957 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2958 exit 1
2960 libobj="$output"
2961 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2964 libobj=
2965 obj="$output"
2967 esac
2969 # Delete the old objects.
2970 $run $rm $obj $libobj
2972 # Objects from convenience libraries. This assumes
2973 # single-version convenience libraries. Whenever we create
2974 # different ones for PIC/non-PIC, this we'll have to duplicate
2975 # the extraction.
2976 reload_conv_objs=
2977 gentop=
2978 # reload_cmds runs $LD directly, so let us get rid of
2979 # -Wl from whole_archive_flag_spec
2982 if test -n "$convenience"; then
2983 if test -n "$whole_archive_flag_spec"; then
2984 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2985 else
2986 gentop="$output_objdir/${obj}x"
2987 $show "${rm}r $gentop"
2988 $run ${rm}r "$gentop"
2989 $show "mkdir $gentop"
2990 $run mkdir "$gentop"
2991 status=$?
2992 if test $status -ne 0 && test ! -d "$gentop"; then
2993 exit $status
2995 generated="$generated $gentop"
2997 for xlib in $convenience; do
2998 # Extract the objects.
2999 case $xlib in
3000 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3001 *) xabs=`pwd`"/$xlib" ;;
3002 esac
3003 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3004 xdir="$gentop/$xlib"
3006 $show "${rm}r $xdir"
3007 $run ${rm}r "$xdir"
3008 $show "mkdir $xdir"
3009 $run mkdir "$xdir"
3010 status=$?
3011 if test $status -ne 0 && test ! -d "$xdir"; then
3012 exit $status
3014 $show "(cd $xdir && $AR x $xabs)"
3015 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3017 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3018 done
3022 # Create the old-style object.
3023 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
3025 output="$obj"
3026 eval cmds=\"$reload_cmds\"
3027 save_ifs="$IFS"; IFS='~'
3028 for cmd in $cmds; do
3029 IFS="$save_ifs"
3030 $show "$cmd"
3031 $run eval "$cmd" || exit $?
3032 done
3033 IFS="$save_ifs"
3035 # Exit if we aren't doing a library object file.
3036 if test -z "$libobj"; then
3037 if test -n "$gentop"; then
3038 $show "${rm}r $gentop"
3039 $run ${rm}r $gentop
3042 exit 0
3045 if test "$build_libtool_libs" != yes; then
3046 if test -n "$gentop"; then
3047 $show "${rm}r $gentop"
3048 $run ${rm}r $gentop
3051 # Create an invalid libtool object if no PIC, so that we don't
3052 # accidentally link it into a program.
3053 $show "echo timestamp > $libobj"
3054 $run eval "echo timestamp > $libobj" || exit $?
3055 exit 0
3058 if test -n "$pic_flag" || test "$pic_mode" != default; then
3059 # Only do commands if we really have different PIC objects.
3060 reload_objs="$libobjs $reload_conv_objs"
3061 output="$libobj"
3062 eval cmds=\"$reload_cmds\"
3063 save_ifs="$IFS"; IFS='~'
3064 for cmd in $cmds; do
3065 IFS="$save_ifs"
3066 $show "$cmd"
3067 $run eval "$cmd" || exit $?
3068 done
3069 IFS="$save_ifs"
3070 else
3071 # Just create a symlink.
3072 $show $rm $libobj
3073 $run $rm $libobj
3074 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3075 if test "X$xdir" = "X$libobj"; then
3076 xdir="."
3077 else
3078 xdir="$xdir"
3080 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3081 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3082 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3083 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3086 if test -n "$gentop"; then
3087 $show "${rm}r $gentop"
3088 $run ${rm}r $gentop
3091 exit 0
3094 prog)
3095 case $host in
3096 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3097 esac
3098 if test -n "$vinfo"; then
3099 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3102 if test -n "$release"; then
3103 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3106 if test "$preload" = yes; then
3107 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3108 test "$dlopen_self_static" = unknown; then
3109 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3113 case $host in
3114 *-*-rhapsody* | *-*-darwin1.[012])
3115 # On Rhapsody replace the C library is the System framework
3116 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3117 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3119 esac
3121 compile_command="$compile_command $compile_deplibs"
3122 finalize_command="$finalize_command $finalize_deplibs"
3124 if test -n "$rpath$xrpath"; then
3125 # If the user specified any rpath flags, then add them.
3126 for libdir in $rpath $xrpath; do
3127 # This is the magic to use -rpath.
3128 case "$finalize_rpath " in
3129 *" $libdir "*) ;;
3130 *) finalize_rpath="$finalize_rpath $libdir" ;;
3131 esac
3132 done
3135 # Now hardcode the library paths
3136 rpath=
3137 hardcode_libdirs=
3138 for libdir in $compile_rpath $finalize_rpath; do
3139 if test -n "$hardcode_libdir_flag_spec"; then
3140 if test -n "$hardcode_libdir_separator"; then
3141 if test -z "$hardcode_libdirs"; then
3142 hardcode_libdirs="$libdir"
3143 else
3144 # Just accumulate the unique libdirs.
3145 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3146 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3149 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3151 esac
3153 else
3154 eval flag=\"$hardcode_libdir_flag_spec\"
3155 rpath="$rpath $flag"
3157 elif test -n "$runpath_var"; then
3158 case "$perm_rpath " in
3159 *" $libdir "*) ;;
3160 *) perm_rpath="$perm_rpath $libdir" ;;
3161 esac
3163 case $host in
3164 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3165 case :$dllsearchpath: in
3166 *":$libdir:"*) ;;
3167 *) dllsearchpath="$dllsearchpath:$libdir";;
3168 esac
3170 esac
3171 done
3172 # Substitute the hardcoded libdirs into the rpath.
3173 if test -n "$hardcode_libdir_separator" &&
3174 test -n "$hardcode_libdirs"; then
3175 libdir="$hardcode_libdirs"
3176 eval rpath=\" $hardcode_libdir_flag_spec\"
3178 compile_rpath="$rpath"
3180 rpath=
3181 hardcode_libdirs=
3182 for libdir in $finalize_rpath; do
3183 if test -n "$hardcode_libdir_flag_spec"; then
3184 if test -n "$hardcode_libdir_separator"; then
3185 if test -z "$hardcode_libdirs"; then
3186 hardcode_libdirs="$libdir"
3187 else
3188 # Just accumulate the unique libdirs.
3189 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3190 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3193 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3195 esac
3197 else
3198 eval flag=\"$hardcode_libdir_flag_spec\"
3199 rpath="$rpath $flag"
3201 elif test -n "$runpath_var"; then
3202 case "$finalize_perm_rpath " in
3203 *" $libdir "*) ;;
3204 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3205 esac
3207 done
3208 # Substitute the hardcoded libdirs into the rpath.
3209 if test -n "$hardcode_libdir_separator" &&
3210 test -n "$hardcode_libdirs"; then
3211 libdir="$hardcode_libdirs"
3212 eval rpath=\" $hardcode_libdir_flag_spec\"
3214 finalize_rpath="$rpath"
3216 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3217 # Transform all the library objects into standard objects.
3218 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3219 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3222 dlsyms=
3223 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3224 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3225 dlsyms="${outputname}S.c"
3226 else
3227 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3231 if test -n "$dlsyms"; then
3232 case $dlsyms in
3233 "") ;;
3234 *.c)
3235 # Discover the nlist of each of the dlfiles.
3236 nlist="$output_objdir/${outputname}.nm"
3238 $show "$rm $nlist ${nlist}S ${nlist}T"
3239 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3241 # Parse the name list into a source file.
3242 $show "creating $output_objdir/$dlsyms"
3244 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3245 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3246 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3248 #ifdef __cplusplus
3249 extern \"C\" {
3250 #endif
3252 /* Prevent the only kind of declaration conflicts we can make. */
3253 #define lt_preloaded_symbols some_other_symbol
3255 /* External symbol declarations for the compiler. */\
3258 if test "$dlself" = yes; then
3259 $show "generating symbol list for \`$output'"
3261 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3263 # Add our own program objects to the symbol list.
3264 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3265 for arg in $progfiles; do
3266 $show "extracting global C symbols from \`$arg'"
3267 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3268 done
3270 if test -n "$exclude_expsyms"; then
3271 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3272 $run eval '$mv "$nlist"T "$nlist"'
3275 if test -n "$export_symbols_regex"; then
3276 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3277 $run eval '$mv "$nlist"T "$nlist"'
3280 # Prepare the list of exported symbols
3281 if test -z "$export_symbols"; then
3282 export_symbols="$output_objdir/$output.exp"
3283 $run $rm $export_symbols
3284 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3285 else
3286 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3287 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3288 $run eval 'mv "$nlist"T "$nlist"'
3292 for arg in $dlprefiles; do
3293 $show "extracting global C symbols from \`$arg'"
3294 name=`echo "$arg" | sed -e 's%^.*/%%'`
3295 $run eval 'echo ": $name " >> "$nlist"'
3296 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3297 done
3299 if test -z "$run"; then
3300 # Make sure we have at least an empty file.
3301 test -f "$nlist" || : > "$nlist"
3303 if test -n "$exclude_expsyms"; then
3304 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3305 $mv "$nlist"T "$nlist"
3308 # Try sorting and uniquifying the output.
3309 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3311 else
3312 grep -v "^: " < "$nlist" > "$nlist"S
3315 if test -f "$nlist"S; then
3316 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3317 else
3318 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3321 $echo >> "$output_objdir/$dlsyms" "\
3323 #undef lt_preloaded_symbols
3325 #if defined (__STDC__) && __STDC__
3326 # define lt_ptr void *
3327 #else
3328 # define lt_ptr char *
3329 # define const
3330 #endif
3332 /* The mapping between symbol names and symbols. */
3333 const struct {
3334 const char *name;
3335 lt_ptr address;
3337 lt_preloaded_symbols[] =
3341 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3343 $echo >> "$output_objdir/$dlsyms" "\
3344 {0, (lt_ptr) 0}
3347 /* This works around a problem in FreeBSD linker */
3348 #ifdef FREEBSD_WORKAROUND
3349 static const void *lt_preloaded_setup() {
3350 return lt_preloaded_symbols;
3352 #endif
3354 #ifdef __cplusplus
3356 #endif\
3360 pic_flag_for_symtable=
3361 case $host in
3362 # compiling the symbol table file with pic_flag works around
3363 # a FreeBSD bug that causes programs to crash when -lm is
3364 # linked before any other PIC object. But we must not use
3365 # pic_flag when linking with -static. The problem exists in
3366 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3367 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3368 case "$compile_command " in
3369 *" -static "*) ;;
3370 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3371 esac;;
3372 *-*-hpux*)
3373 case "$compile_command " in
3374 *" -static "*) ;;
3375 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3376 esac
3377 esac
3379 # Now compile the dynamic symbol file.
3380 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3381 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3383 # Clean up the generated files.
3384 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3385 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3387 # Transform the symbol file into the correct name.
3388 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3389 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3392 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3393 exit 1
3395 esac
3396 else
3397 # We keep going just in case the user didn't refer to
3398 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3399 # really was required.
3401 # Nullify the symbol file.
3402 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3403 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3406 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3407 # Replace the output file specification.
3408 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3409 link_command="$compile_command$compile_rpath"
3411 # We have no uninstalled library dependencies, so finalize right now.
3412 $show "$link_command"
3413 $run eval "$link_command"
3414 status=$?
3416 # Delete the generated files.
3417 if test -n "$dlsyms"; then
3418 $show "$rm $output_objdir/${outputname}S.${objext}"
3419 $run $rm "$output_objdir/${outputname}S.${objext}"
3422 exit $status
3425 if test -n "$shlibpath_var"; then
3426 # We should set the shlibpath_var
3427 rpath=
3428 for dir in $temp_rpath; do
3429 case $dir in
3430 [\\/]* | [A-Za-z]:[\\/]*)
3431 # Absolute path.
3432 rpath="$rpath$dir:"
3435 # Relative path: add a thisdir entry.
3436 rpath="$rpath\$thisdir/$dir:"
3438 esac
3439 done
3440 temp_rpath="$rpath"
3443 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3444 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3446 if test -n "$finalize_shlibpath"; then
3447 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3450 compile_var=
3451 finalize_var=
3452 if test -n "$runpath_var"; then
3453 if test -n "$perm_rpath"; then
3454 # We should set the runpath_var.
3455 rpath=
3456 for dir in $perm_rpath; do
3457 rpath="$rpath$dir:"
3458 done
3459 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3461 if test -n "$finalize_perm_rpath"; then
3462 # We should set the runpath_var.
3463 rpath=
3464 for dir in $finalize_perm_rpath; do
3465 rpath="$rpath$dir:"
3466 done
3467 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3471 if test "$no_install" = yes; then
3472 # We don't need to create a wrapper script.
3473 link_command="$compile_var$compile_command$compile_rpath"
3474 # Replace the output file specification.
3475 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3476 # Delete the old output file.
3477 $run $rm $output
3478 # Link the executable and exit
3479 $show "$link_command"
3480 $run eval "$link_command" || exit $?
3481 exit 0
3484 if test "$hardcode_action" = relink; then
3485 # Fast installation is not supported
3486 link_command="$compile_var$compile_command$compile_rpath"
3487 relink_command="$finalize_var$finalize_command$finalize_rpath"
3489 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3490 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3491 else
3492 if test "$fast_install" != no; then
3493 link_command="$finalize_var$compile_command$finalize_rpath"
3494 if test "$fast_install" = yes; then
3495 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3496 else
3497 # fast_install is set to needless
3498 relink_command=
3500 else
3501 link_command="$compile_var$compile_command$compile_rpath"
3502 relink_command="$finalize_var$finalize_command$finalize_rpath"
3506 # Replace the output file specification.
3507 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3509 # Delete the old output files.
3510 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3512 $show "$link_command"
3513 $run eval "$link_command" || exit $?
3515 # Now create the wrapper script.
3516 $show "creating $output"
3518 # Quote the relink command for shipping.
3519 if test -n "$relink_command"; then
3520 # Preserve any variables that may affect compiler behavior
3521 for var in $variables_saved_for_relink; do
3522 if eval test -z \"\${$var+set}\"; then
3523 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3524 elif eval var_value=\$$var; test -z "$var_value"; then
3525 relink_command="$var=; export $var; $relink_command"
3526 else
3527 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3528 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3530 done
3531 relink_command="cd `pwd`; $relink_command"
3532 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3535 # Quote $echo for shipping.
3536 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3537 case $0 in
3538 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3539 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3540 esac
3541 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3542 else
3543 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3546 # Only actually do things if our run command is non-null.
3547 if test -z "$run"; then
3548 # win32 will think the script is a binary if it has
3549 # a .exe suffix, so we strip it off here.
3550 case $output in
3551 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3552 esac
3553 # test for cygwin because mv fails w/o .exe extensions
3554 case $host in
3555 *cygwin*) exeext=.exe ;;
3556 *) exeext= ;;
3557 esac
3558 $rm $output
3559 trap "$rm $output; exit 1" 1 2 15
3561 $echo > $output "\
3562 #! $SHELL
3564 # $output - temporary wrapper script for $objdir/$outputname
3565 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3567 # The $output program cannot be directly executed until all the libtool
3568 # libraries that it depends on are installed.
3570 # This wrapper script should never be moved out of the build directory.
3571 # If it is, it will not operate correctly.
3573 # Sed substitution that helps us do robust quoting. It backslashifies
3574 # metacharacters that are still active within double-quoted strings.
3575 Xsed='sed -e 1s/^X//'
3576 sed_quote_subst='$sed_quote_subst'
3578 # The HP-UX ksh and POSIX shell print the target directory to stdout
3579 # if CDPATH is set.
3580 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3582 relink_command=\"$relink_command\"
3584 # This environment variable determines our operation mode.
3585 if test \"\$libtool_install_magic\" = \"$magic\"; then
3586 # install mode needs the following variable:
3587 notinst_deplibs='$notinst_deplibs'
3588 else
3589 # When we are sourced in execute mode, \$file and \$echo are already set.
3590 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3591 echo=\"$qecho\"
3592 file=\"\$0\"
3593 # Make sure echo works.
3594 if test \"X\$1\" = X--no-reexec; then
3595 # Discard the --no-reexec flag, and continue.
3596 shift
3597 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3598 # Yippee, \$echo works!
3600 else
3601 # Restart under the correct shell, and then maybe \$echo will work.
3602 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3606 $echo >> $output "\
3608 # Find the directory that this script lives in.
3609 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3610 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3612 # Follow symbolic links until we get to the real thisdir.
3613 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3614 while test -n \"\$file\"; do
3615 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3617 # If there was a directory component, then change thisdir.
3618 if test \"x\$destdir\" != \"x\$file\"; then
3619 case \"\$destdir\" in
3620 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3621 *) thisdir=\"\$thisdir/\$destdir\" ;;
3622 esac
3625 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3626 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3627 done
3629 # Try to get the absolute directory name.
3630 absdir=\`cd \"\$thisdir\" && pwd\`
3631 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3634 if test "$fast_install" = yes; then
3635 echo >> $output "\
3636 program=lt-'$outputname'$exeext
3637 progdir=\"\$thisdir/$objdir\"
3639 if test ! -f \"\$progdir/\$program\" || \\
3640 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3641 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3643 file=\"\$\$-\$program\"
3645 if test ! -d \"\$progdir\"; then
3646 $mkdir \"\$progdir\"
3647 else
3648 $rm \"\$progdir/\$file\"
3651 echo >> $output "\
3653 # relink executable if necessary
3654 if test -n \"\$relink_command\"; then
3655 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3656 else
3657 $echo \"\$relink_command_output\" >&2
3658 $rm \"\$progdir/\$file\"
3659 exit 1
3663 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3664 { $rm \"\$progdir/\$program\";
3665 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3666 $rm \"\$progdir/\$file\"
3668 else
3669 echo >> $output "\
3670 program='$outputname'
3671 progdir=\"\$thisdir/$objdir\"
3675 echo >> $output "\
3677 if test -f \"\$progdir/\$program\"; then"
3679 # Export our shlibpath_var if we have one.
3680 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3681 $echo >> $output "\
3682 # Add our own library path to $shlibpath_var
3683 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3685 # Some systems cannot cope with colon-terminated $shlibpath_var
3686 # The second colon is a workaround for a bug in BeOS R4 sed
3687 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3689 export $shlibpath_var
3693 # fixup the dll searchpath if we need to.
3694 if test -n "$dllsearchpath"; then
3695 $echo >> $output "\
3696 # Add the dll search path components to the executable PATH
3697 PATH=$dllsearchpath:\$PATH
3701 $echo >> $output "\
3702 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3703 # Run the actual program with our arguments.
3705 case $host in
3706 # win32 systems need to use the prog path for dll
3707 # lookup to work
3708 *-*-cygwin* | *-*-pw32*)
3709 $echo >> $output "\
3710 exec \$progdir/\$program \${1+\"\$@\"}
3714 # Backslashes separate directories on plain windows
3715 *-*-mingw | *-*-os2*)
3716 $echo >> $output "\
3717 exec \$progdir\\\\\$program \${1+\"\$@\"}
3722 $echo >> $output "\
3723 # Export the path to the program.
3724 PATH=\"\$progdir:\$PATH\"
3725 export PATH
3727 exec \$program \${1+\"\$@\"}
3730 esac
3731 $echo >> $output "\
3732 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3733 exit 1
3735 else
3736 # The program doesn't exist.
3737 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3738 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3739 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3740 exit 1
3744 chmod +x $output
3746 exit 0
3748 esac
3750 # See if we need to build an old-fashioned archive.
3751 for oldlib in $oldlibs; do
3753 if test "$build_libtool_libs" = convenience; then
3754 oldobjs="$libobjs_save"
3755 addlibs="$convenience"
3756 build_libtool_libs=no
3757 else
3758 if test "$build_libtool_libs" = module; then
3759 oldobjs="$libobjs_save"
3760 build_libtool_libs=no
3761 else
3762 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3764 addlibs="$old_convenience"
3767 if test -n "$addlibs"; then
3768 gentop="$output_objdir/${outputname}x"
3769 $show "${rm}r $gentop"
3770 $run ${rm}r "$gentop"
3771 $show "mkdir $gentop"
3772 $run mkdir "$gentop"
3773 status=$?
3774 if test $status -ne 0 && test ! -d "$gentop"; then
3775 exit $status
3777 generated="$generated $gentop"
3779 # Add in members from convenience archives.
3780 for xlib in $addlibs; do
3781 # Extract the objects.
3782 case $xlib in
3783 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3784 *) xabs=`pwd`"/$xlib" ;;
3785 esac
3786 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3787 xdir="$gentop/$xlib"
3789 $show "${rm}r $xdir"
3790 $run ${rm}r "$xdir"
3791 $show "mkdir $xdir"
3792 $run mkdir "$xdir"
3793 status=$?
3794 if test $status -ne 0 && test ! -d "$xdir"; then
3795 exit $status
3797 $show "(cd $xdir && $AR x $xabs)"
3798 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3800 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3801 done
3804 # Do each command in the archive commands.
3805 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3806 eval cmds=\"$old_archive_from_new_cmds\"
3807 else
3808 # Ensure that we have .o objects in place in case we decided
3809 # not to build a shared library, and have fallen back to building
3810 # static libs even though --disable-static was passed!
3811 for oldobj in $oldobjs; do
3812 if test ! -f $oldobj; then
3813 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3814 if test "X$xdir" = "X$oldobj"; then
3815 xdir="."
3816 else
3817 xdir="$xdir"
3819 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3820 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3821 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3822 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3824 done
3826 eval cmds=\"$old_archive_cmds\"
3828 save_ifs="$IFS"; IFS='~'
3829 for cmd in $cmds; do
3830 IFS="$save_ifs"
3831 $show "$cmd"
3832 $run eval "$cmd" || exit $?
3833 done
3834 IFS="$save_ifs"
3835 done
3837 if test -n "$generated"; then
3838 $show "${rm}r$generated"
3839 $run ${rm}r$generated
3842 # Now create the libtool archive.
3843 case $output in
3844 *.la)
3845 old_library=
3846 test "$build_old_libs" = yes && old_library="$libname.$libext"
3847 $show "creating $output"
3849 # Preserve any variables that may affect compiler behavior
3850 for var in $variables_saved_for_relink; do
3851 if eval test -z \"\${$var+set}\"; then
3852 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3853 elif eval var_value=\$$var; test -z "$var_value"; then
3854 relink_command="$var=; export $var; $relink_command"
3855 else
3856 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3857 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3859 done
3860 # Quote the link command for shipping.
3861 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3862 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3864 # Only create the output if not a dry run.
3865 if test -z "$run"; then
3866 for installed in no yes; do
3867 if test "$installed" = yes; then
3868 if test -z "$install_libdir"; then
3869 break
3871 output="$output_objdir/$outputname"i
3872 # Replace all uninstalled libtool libraries with the installed ones
3873 newdependency_libs=
3874 for deplib in $dependency_libs; do
3875 case $deplib in
3876 *.la)
3877 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3878 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3879 if test -z "$libdir"; then
3880 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3881 exit 1
3883 newdependency_libs="$newdependency_libs $libdir/$name"
3885 *) newdependency_libs="$newdependency_libs $deplib" ;;
3886 esac
3887 done
3888 dependency_libs="$newdependency_libs"
3889 newdlfiles=
3890 for lib in $dlfiles; do
3891 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3892 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3893 if test -z "$libdir"; then
3894 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3895 exit 1
3897 newdlfiles="$newdlfiles $libdir/$name"
3898 done
3899 dlfiles="$newdlfiles"
3900 newdlprefiles=
3901 for lib in $dlprefiles; do
3902 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3903 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3904 if test -z "$libdir"; then
3905 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3906 exit 1
3908 newdlprefiles="$newdlprefiles $libdir/$name"
3909 done
3910 dlprefiles="$newdlprefiles"
3912 $rm $output
3913 # place dlname in correct position for cygwin
3914 tdlname=$dlname
3915 case $host,$output,$installed,$module,$dlname in
3916 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3917 esac
3918 $echo > $output "\
3919 # $outputname - a libtool library file
3920 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3922 # Please DO NOT delete this file!
3923 # It is necessary for linking the library.
3925 # The name that we can dlopen(3).
3926 dlname='$tdlname'
3928 # Names of this library.
3929 library_names='$library_names'
3931 # The name of the static archive.
3932 old_library='$old_library'
3934 # Libraries that this one depends upon.
3935 dependency_libs='$dependency_libs'
3937 # Version information for $libname.
3938 current=$current
3939 age=$age
3940 revision=$revision
3942 # Is this an already installed library?
3943 installed=$installed
3945 # Files to dlopen/dlpreopen
3946 dlopen='$dlfiles'
3947 dlpreopen='$dlprefiles'
3949 # Directory that this library needs to be installed in:
3950 libdir='$install_libdir'"
3951 if test "$installed" = no && test $need_relink = yes; then
3952 $echo >> $output "\
3953 relink_command=\"$relink_command\""
3955 done
3958 # Do a symbolic link so that the libtool archive can be found in
3959 # LD_LIBRARY_PATH before the program is installed.
3960 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3961 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3963 esac
3964 exit 0
3967 # libtool install mode
3968 install)
3969 modename="$modename: install"
3971 # There may be an optional sh(1) argument at the beginning of
3972 # install_prog (especially on Windows NT).
3973 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3974 # Allow the use of GNU shtool's install command.
3975 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3976 # Aesthetically quote it.
3977 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3978 case $arg in
3979 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3980 arg="\"$arg\""
3982 esac
3983 install_prog="$arg "
3984 arg="$1"
3985 shift
3986 else
3987 install_prog=
3988 arg="$nonopt"
3991 # The real first argument should be the name of the installation program.
3992 # Aesthetically quote it.
3993 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3994 case $arg in
3995 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3996 arg="\"$arg\""
3998 esac
3999 install_prog="$install_prog$arg"
4001 # We need to accept at least all the BSD install flags.
4002 dest=
4003 files=
4004 opts=
4005 prev=
4006 install_type=
4007 isdir=no
4008 stripme=
4009 for arg
4011 if test -n "$dest"; then
4012 files="$files $dest"
4013 dest="$arg"
4014 continue
4017 case $arg in
4018 -d) isdir=yes ;;
4019 -f) prev="-f" ;;
4020 -g) prev="-g" ;;
4021 -m) prev="-m" ;;
4022 -o) prev="-o" ;;
4024 stripme=" -s"
4025 continue
4027 -*) ;;
4030 # If the previous option needed an argument, then skip it.
4031 if test -n "$prev"; then
4032 prev=
4033 else
4034 dest="$arg"
4035 continue
4038 esac
4040 # Aesthetically quote the argument.
4041 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4042 case $arg in
4043 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4044 arg="\"$arg\""
4046 esac
4047 install_prog="$install_prog $arg"
4048 done
4050 if test -z "$install_prog"; then
4051 $echo "$modename: you must specify an install program" 1>&2
4052 $echo "$help" 1>&2
4053 exit 1
4056 if test -n "$prev"; then
4057 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4058 $echo "$help" 1>&2
4059 exit 1
4062 if test -z "$files"; then
4063 if test -z "$dest"; then
4064 $echo "$modename: no file or destination specified" 1>&2
4065 else
4066 $echo "$modename: you must specify a destination" 1>&2
4068 $echo "$help" 1>&2
4069 exit 1
4072 # Strip any trailing slash from the destination.
4073 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4075 # Check to see that the destination is a directory.
4076 test -d "$dest" && isdir=yes
4077 if test "$isdir" = yes; then
4078 destdir="$dest"
4079 destname=
4080 else
4081 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4082 test "X$destdir" = "X$dest" && destdir=.
4083 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4085 # Not a directory, so check to see that there is only one file specified.
4086 set dummy $files
4087 if test $# -gt 2; then
4088 $echo "$modename: \`$dest' is not a directory" 1>&2
4089 $echo "$help" 1>&2
4090 exit 1
4093 case $destdir in
4094 [\\/]* | [A-Za-z]:[\\/]*) ;;
4096 for file in $files; do
4097 case $file in
4098 *.lo) ;;
4100 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4101 $echo "$help" 1>&2
4102 exit 1
4104 esac
4105 done
4107 esac
4109 # This variable tells wrapper scripts just to set variables rather
4110 # than running their programs.
4111 libtool_install_magic="$magic"
4113 staticlibs=
4114 future_libdirs=
4115 current_libdirs=
4116 for file in $files; do
4118 # Do each installation.
4119 case $file in
4120 *.$libext)
4121 # Do the static libraries later.
4122 staticlibs="$staticlibs $file"
4125 *.la)
4126 # Check to see that this really is a libtool archive.
4127 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4128 else
4129 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4130 $echo "$help" 1>&2
4131 exit 1
4134 library_names=
4135 old_library=
4136 relink_command=
4137 # If there is no directory component, then add one.
4138 case $file in
4139 */* | *\\*) . $file ;;
4140 *) . ./$file ;;
4141 esac
4143 # Add the libdir to current_libdirs if it is the destination.
4144 if test "X$destdir" = "X$libdir"; then
4145 case "$current_libdirs " in
4146 *" $libdir "*) ;;
4147 *) current_libdirs="$current_libdirs $libdir" ;;
4148 esac
4149 else
4150 # Note the libdir as a future libdir.
4151 case "$future_libdirs " in
4152 *" $libdir "*) ;;
4153 *) future_libdirs="$future_libdirs $libdir" ;;
4154 esac
4157 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4158 test "X$dir" = "X$file/" && dir=
4159 dir="$dir$objdir"
4161 if test -n "$relink_command"; then
4162 $echo "$modename: warning: relinking \`$file'" 1>&2
4163 $show "$relink_command"
4164 if $run eval "$relink_command"; then :
4165 else
4166 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4167 continue
4171 # See the names of the shared library.
4172 set dummy $library_names
4173 if test -n "$2"; then
4174 realname="$2"
4175 shift
4176 shift
4178 srcname="$realname"
4179 test -n "$relink_command" && srcname="$realname"T
4181 # Install the shared library and build the symlinks.
4182 $show "$install_prog $dir/$srcname $destdir/$realname"
4183 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4184 if test -n "$stripme" && test -n "$striplib"; then
4185 $show "$striplib $destdir/$realname"
4186 $run eval "$striplib $destdir/$realname" || exit $?
4189 if test $# -gt 0; then
4190 # Delete the old symlinks, and create new ones.
4191 for linkname
4193 if test "$linkname" != "$realname"; then
4194 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4195 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4197 done
4200 # Do each command in the postinstall commands.
4201 lib="$destdir/$realname"
4202 eval cmds=\"$postinstall_cmds\"
4203 save_ifs="$IFS"; IFS='~'
4204 for cmd in $cmds; do
4205 IFS="$save_ifs"
4206 $show "$cmd"
4207 $run eval "$cmd" || exit $?
4208 done
4209 IFS="$save_ifs"
4212 # Install the pseudo-library for information purposes.
4213 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4214 instname="$dir/$name"i
4215 $show "$install_prog $instname $destdir/$name"
4216 $run eval "$install_prog $instname $destdir/$name" || exit $?
4218 # Maybe install the static library, too.
4219 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4222 *.lo)
4223 # Install (i.e. copy) a libtool object.
4225 # Figure out destination file name, if it wasn't already specified.
4226 if test -n "$destname"; then
4227 destfile="$destdir/$destname"
4228 else
4229 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4230 destfile="$destdir/$destfile"
4233 # Deduce the name of the destination old-style object file.
4234 case $destfile in
4235 *.lo)
4236 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4238 *.$objext)
4239 staticdest="$destfile"
4240 destfile=
4243 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4244 $echo "$help" 1>&2
4245 exit 1
4247 esac
4249 # Install the libtool object if requested.
4250 if test -n "$destfile"; then
4251 $show "$install_prog $file $destfile"
4252 $run eval "$install_prog $file $destfile" || exit $?
4255 # Install the old object if enabled.
4256 if test "$build_old_libs" = yes; then
4257 # Deduce the name of the old-style object file.
4258 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4260 $show "$install_prog $staticobj $staticdest"
4261 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4263 exit 0
4267 # Figure out destination file name, if it wasn't already specified.
4268 if test -n "$destname"; then
4269 destfile="$destdir/$destname"
4270 else
4271 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4272 destfile="$destdir/$destfile"
4275 # Do a test to see if this is really a libtool program.
4276 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4277 notinst_deplibs=
4278 relink_command=
4280 # If there is no directory component, then add one.
4281 case $file in
4282 */* | *\\*) . $file ;;
4283 *) . ./$file ;;
4284 esac
4286 # Check the variables that should have been set.
4287 if test -z "$notinst_deplibs"; then
4288 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4289 exit 1
4292 finalize=yes
4293 for lib in $notinst_deplibs; do
4294 # Check to see that each library is installed.
4295 libdir=
4296 if test -f "$lib"; then
4297 # If there is no directory component, then add one.
4298 case $lib in
4299 */* | *\\*) . $lib ;;
4300 *) . ./$lib ;;
4301 esac
4303 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4304 if test -n "$libdir" && test ! -f "$libfile"; then
4305 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4306 finalize=no
4308 done
4310 relink_command=
4311 # If there is no directory component, then add one.
4312 case $file in
4313 */* | *\\*) . $file ;;
4314 *) . ./$file ;;
4315 esac
4317 outputname=
4318 if test "$fast_install" = no && test -n "$relink_command"; then
4319 if test "$finalize" = yes && test -z "$run"; then
4320 tmpdir="/tmp"
4321 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4322 tmpdir="$tmpdir/libtool-$$"
4323 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4324 else
4325 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4326 continue
4328 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4329 outputname="$tmpdir/$file"
4330 # Replace the output file specification.
4331 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4333 $show "$relink_command"
4334 if $run eval "$relink_command"; then :
4335 else
4336 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4337 ${rm}r "$tmpdir"
4338 continue
4340 file="$outputname"
4341 else
4342 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4344 else
4345 # Install the binary that we compiled earlier.
4346 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4350 # remove .exe since cygwin /usr/bin/install will append another
4351 # one anyways
4352 case $install_prog,$host in
4353 /usr/bin/install*,*cygwin*)
4354 case $file:$destfile in
4355 *.exe:*.exe)
4356 # this is ok
4358 *.exe:*)
4359 destfile=$destfile.exe
4361 *:*.exe)
4362 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4364 esac
4366 esac
4367 $show "$install_prog$stripme $file $destfile"
4368 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4369 test -n "$outputname" && ${rm}r "$tmpdir"
4371 esac
4372 done
4374 for file in $staticlibs; do
4375 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4377 # Set up the ranlib parameters.
4378 oldlib="$destdir/$name"
4380 $show "$install_prog $file $oldlib"
4381 $run eval "$install_prog \$file \$oldlib" || exit $?
4383 if test -n "$stripme" && test -n "$striplib"; then
4384 $show "$old_striplib $oldlib"
4385 $run eval "$old_striplib $oldlib" || exit $?
4388 # Do each command in the postinstall commands.
4389 eval cmds=\"$old_postinstall_cmds\"
4390 save_ifs="$IFS"; IFS='~'
4391 for cmd in $cmds; do
4392 IFS="$save_ifs"
4393 $show "$cmd"
4394 $run eval "$cmd" || exit $?
4395 done
4396 IFS="$save_ifs"
4397 done
4399 if test -n "$future_libdirs"; then
4400 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4403 if test -n "$current_libdirs"; then
4404 # Maybe just do a dry run.
4405 test -n "$run" && current_libdirs=" -n$current_libdirs"
4406 exec_cmd='$SHELL $0 --finish$current_libdirs'
4407 else
4408 exit 0
4412 # libtool finish mode
4413 finish)
4414 modename="$modename: finish"
4415 libdirs="$nonopt"
4416 admincmds=
4418 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4419 for dir
4421 libdirs="$libdirs $dir"
4422 done
4424 for libdir in $libdirs; do
4425 if test -n "$finish_cmds"; then
4426 # Do each command in the finish commands.
4427 eval cmds=\"$finish_cmds\"
4428 save_ifs="$IFS"; IFS='~'
4429 for cmd in $cmds; do
4430 IFS="$save_ifs"
4431 $show "$cmd"
4432 $run eval "$cmd" || admincmds="$admincmds
4433 $cmd"
4434 done
4435 IFS="$save_ifs"
4437 if test -n "$finish_eval"; then
4438 # Do the single finish_eval.
4439 eval cmds=\"$finish_eval\"
4440 $run eval "$cmds" || admincmds="$admincmds
4441 $cmds"
4443 done
4446 # Exit here if they wanted silent mode.
4447 test "$show" = ":" && exit 0
4449 echo "----------------------------------------------------------------------"
4450 echo "Libraries have been installed in:"
4451 for libdir in $libdirs; do
4452 echo " $libdir"
4453 done
4454 echo
4455 echo "If you ever happen to want to link against installed libraries"
4456 echo "in a given directory, LIBDIR, you must either use libtool, and"
4457 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4458 echo "flag during linking and do at least one of the following:"
4459 if test -n "$shlibpath_var"; then
4460 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4461 echo " during execution"
4463 if test -n "$runpath_var"; then
4464 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4465 echo " during linking"
4467 if test -n "$hardcode_libdir_flag_spec"; then
4468 libdir=LIBDIR
4469 eval flag=\"$hardcode_libdir_flag_spec\"
4471 echo " - use the \`$flag' linker flag"
4473 if test -n "$admincmds"; then
4474 echo " - have your system administrator run these commands:$admincmds"
4476 if test -f /etc/ld.so.conf; then
4477 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4479 echo
4480 echo "See any operating system documentation about shared libraries for"
4481 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4482 echo "----------------------------------------------------------------------"
4483 exit 0
4486 # libtool execute mode
4487 execute)
4488 modename="$modename: execute"
4490 # The first argument is the command name.
4491 cmd="$nonopt"
4492 if test -z "$cmd"; then
4493 $echo "$modename: you must specify a COMMAND" 1>&2
4494 $echo "$help"
4495 exit 1
4498 # Handle -dlopen flags immediately.
4499 for file in $execute_dlfiles; do
4500 if test ! -f "$file"; then
4501 $echo "$modename: \`$file' is not a file" 1>&2
4502 $echo "$help" 1>&2
4503 exit 1
4506 dir=
4507 case $file in
4508 *.la)
4509 # Check to see that this really is a libtool archive.
4510 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4511 else
4512 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4513 $echo "$help" 1>&2
4514 exit 1
4517 # Read the libtool library.
4518 dlname=
4519 library_names=
4521 # If there is no directory component, then add one.
4522 case $file in
4523 */* | *\\*) . $file ;;
4524 *) . ./$file ;;
4525 esac
4527 # Skip this library if it cannot be dlopened.
4528 if test -z "$dlname"; then
4529 # Warn if it was a shared library.
4530 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4531 continue
4534 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4535 test "X$dir" = "X$file" && dir=.
4537 if test -f "$dir/$objdir/$dlname"; then
4538 dir="$dir/$objdir"
4539 else
4540 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4541 exit 1
4545 *.lo)
4546 # Just add the directory containing the .lo file.
4547 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4548 test "X$dir" = "X$file" && dir=.
4552 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4553 continue
4555 esac
4557 # Get the absolute pathname.
4558 absdir=`cd "$dir" && pwd`
4559 test -n "$absdir" && dir="$absdir"
4561 # Now add the directory to shlibpath_var.
4562 if eval "test -z \"\$$shlibpath_var\""; then
4563 eval "$shlibpath_var=\"\$dir\""
4564 else
4565 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4567 done
4569 # This variable tells wrapper scripts just to set shlibpath_var
4570 # rather than running their programs.
4571 libtool_execute_magic="$magic"
4573 # Check if any of the arguments is a wrapper script.
4574 args=
4575 for file
4577 case $file in
4578 -*) ;;
4580 # Do a test to see if this is really a libtool program.
4581 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4582 # If there is no directory component, then add one.
4583 case $file in
4584 */* | *\\*) . $file ;;
4585 *) . ./$file ;;
4586 esac
4588 # Transform arg to wrapped name.
4589 file="$progdir/$program"
4592 esac
4593 # Quote arguments (to preserve shell metacharacters).
4594 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4595 args="$args \"$file\""
4596 done
4598 if test -z "$run"; then
4599 if test -n "$shlibpath_var"; then
4600 # Export the shlibpath_var.
4601 eval "export $shlibpath_var"
4604 # Restore saved enviroment variables
4605 if test "${save_LC_ALL+set}" = set; then
4606 LC_ALL="$save_LC_ALL"; export LC_ALL
4608 if test "${save_LANG+set}" = set; then
4609 LANG="$save_LANG"; export LANG
4612 # Now prepare to actually exec the command.
4613 exec_cmd='"$cmd"$args'
4614 else
4615 # Display what would be done.
4616 if test -n "$shlibpath_var"; then
4617 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4618 $echo "export $shlibpath_var"
4620 $echo "$cmd$args"
4621 exit 0
4625 # libtool clean and uninstall mode
4626 clean | uninstall)
4627 modename="$modename: $mode"
4628 rm="$nonopt"
4629 files=
4630 rmforce=
4631 exit_status=0
4633 # This variable tells wrapper scripts just to set variables rather
4634 # than running their programs.
4635 libtool_install_magic="$magic"
4637 for arg
4639 case $arg in
4640 -f) rm="$rm $arg"; rmforce=yes ;;
4641 -*) rm="$rm $arg" ;;
4642 *) files="$files $arg" ;;
4643 esac
4644 done
4646 if test -z "$rm"; then
4647 $echo "$modename: you must specify an RM program" 1>&2
4648 $echo "$help" 1>&2
4649 exit 1
4652 rmdirs=
4654 for file in $files; do
4655 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4656 if test "X$dir" = "X$file"; then
4657 dir=.
4658 objdir="$objdir"
4659 else
4660 objdir="$dir/$objdir"
4662 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4663 test $mode = uninstall && objdir="$dir"
4665 # Remember objdir for removal later, being careful to avoid duplicates
4666 if test $mode = clean; then
4667 case " $rmdirs " in
4668 *" $objdir "*) ;;
4669 *) rmdirs="$rmdirs $objdir" ;;
4670 esac
4673 # Don't error if the file doesn't exist and rm -f was used.
4674 if (test -L "$file") >/dev/null 2>&1 \
4675 || (test -h "$file") >/dev/null 2>&1 \
4676 || test -f "$file"; then
4678 elif test -d "$file"; then
4679 exit_status=1
4680 continue
4681 elif test "$rmforce" = yes; then
4682 continue
4685 rmfiles="$file"
4687 case $name in
4688 *.la)
4689 # Possibly a libtool archive, so verify it.
4690 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4691 . $dir/$name
4693 # Delete the libtool libraries and symlinks.
4694 for n in $library_names; do
4695 rmfiles="$rmfiles $objdir/$n"
4696 done
4697 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4698 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4700 if test $mode = uninstall; then
4701 if test -n "$library_names"; then
4702 # Do each command in the postuninstall commands.
4703 eval cmds=\"$postuninstall_cmds\"
4704 save_ifs="$IFS"; IFS='~'
4705 for cmd in $cmds; do
4706 IFS="$save_ifs"
4707 $show "$cmd"
4708 $run eval "$cmd"
4709 if test $? != 0 && test "$rmforce" != yes; then
4710 exit_status=1
4712 done
4713 IFS="$save_ifs"
4716 if test -n "$old_library"; then
4717 # Do each command in the old_postuninstall commands.
4718 eval cmds=\"$old_postuninstall_cmds\"
4719 save_ifs="$IFS"; IFS='~'
4720 for cmd in $cmds; do
4721 IFS="$save_ifs"
4722 $show "$cmd"
4723 $run eval "$cmd"
4724 if test $? != 0 && test "$rmforce" != yes; then
4725 exit_status=1
4727 done
4728 IFS="$save_ifs"
4730 # FIXME: should reinstall the best remaining shared library.
4735 *.lo)
4736 if test "$build_old_libs" = yes; then
4737 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4738 rmfiles="$rmfiles $dir/$oldobj"
4743 # Do a test to see if this is a libtool program.
4744 if test $mode = clean &&
4745 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4746 relink_command=
4747 . $dir/$file
4749 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4750 if test "$fast_install" = yes && test -n "$relink_command"; then
4751 rmfiles="$rmfiles $objdir/lt-$name"
4755 esac
4756 $show "$rm $rmfiles"
4757 $run $rm $rmfiles || exit_status=1
4758 done
4760 # Try to remove the ${objdir}s in the directories where we deleted files
4761 for dir in $rmdirs; do
4762 if test -d "$dir"; then
4763 $show "rmdir $dir"
4764 $run rmdir $dir >/dev/null 2>&1
4766 done
4768 exit $exit_status
4772 $echo "$modename: you must specify a MODE" 1>&2
4773 $echo "$generic_help" 1>&2
4774 exit 1
4776 esac
4778 if test -z "$exec_cmd"; then
4779 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4780 $echo "$generic_help" 1>&2
4781 exit 1
4783 fi # test -z "$show_help"
4785 if test -n "$exec_cmd"; then
4786 eval exec $exec_cmd
4787 exit 1
4790 # We need to display help for each of the modes.
4791 case $mode in
4792 "") $echo \
4793 "Usage: $modename [OPTION]... [MODE-ARG]...
4795 Provide generalized library-building support services.
4797 --config show all configuration variables
4798 --debug enable verbose shell tracing
4799 -n, --dry-run display commands without modifying any files
4800 --features display basic configuration information and exit
4801 --finish same as \`--mode=finish'
4802 --help display this help message and exit
4803 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4804 --quiet same as \`--silent'
4805 --silent don't print informational messages
4806 --version print version information
4808 MODE must be one of the following:
4810 clean remove files from the build directory
4811 compile compile a source file into a libtool object
4812 execute automatically set library path, then run a program
4813 finish complete the installation of libtool libraries
4814 install install libraries or executables
4815 link create a library or an executable
4816 uninstall remove libraries from an installed directory
4818 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4819 a more detailed description of MODE."
4820 exit 0
4823 clean)
4824 $echo \
4825 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4827 Remove files from the build directory.
4829 RM is the name of the program to use to delete files associated with each FILE
4830 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4831 to RM.
4833 If FILE is a libtool library, object or program, all the files associated
4834 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4837 compile)
4838 $echo \
4839 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4841 Compile a source file into a libtool library object.
4843 This mode accepts the following additional options:
4845 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4846 -prefer-pic try to building PIC objects only
4847 -prefer-non-pic try to building non-PIC objects only
4848 -static always build a \`.o' file suitable for static linking
4850 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4851 from the given SOURCEFILE.
4853 The output file name is determined by removing the directory component from
4854 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4855 library object suffix, \`.lo'."
4858 execute)
4859 $echo \
4860 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4862 Automatically set library path, then run a program.
4864 This mode accepts the following additional options:
4866 -dlopen FILE add the directory containing FILE to the library path
4868 This mode sets the library path environment variable according to \`-dlopen'
4869 flags.
4871 If any of the ARGS are libtool executable wrappers, then they are translated
4872 into their corresponding uninstalled binary, and any of their required library
4873 directories are added to the library path.
4875 Then, COMMAND is executed, with ARGS as arguments."
4878 finish)
4879 $echo \
4880 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4882 Complete the installation of libtool libraries.
4884 Each LIBDIR is a directory that contains libtool libraries.
4886 The commands that this mode executes may require superuser privileges. Use
4887 the \`--dry-run' option if you just want to see what would be executed."
4890 install)
4891 $echo \
4892 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4894 Install executables or libraries.
4896 INSTALL-COMMAND is the installation command. The first component should be
4897 either the \`install' or \`cp' program.
4899 The rest of the components are interpreted as arguments to that command (only
4900 BSD-compatible install options are recognized)."
4903 link)
4904 $echo \
4905 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4907 Link object files or libraries together to form another library, or to
4908 create an executable program.
4910 LINK-COMMAND is a command using the C compiler that you would use to create
4911 a program from several object files.
4913 The following components of LINK-COMMAND are treated specially:
4915 -all-static do not do any dynamic linking at all
4916 -avoid-version do not add a version suffix if possible
4917 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4918 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4919 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4920 -export-symbols SYMFILE
4921 try to export only the symbols listed in SYMFILE
4922 -export-symbols-regex REGEX
4923 try to export only the symbols matching REGEX
4924 -LLIBDIR search LIBDIR for required installed libraries
4925 -lNAME OUTPUT-FILE requires the installed library libNAME
4926 -module build a library that can dlopened
4927 -no-fast-install disable the fast-install mode
4928 -no-install link a not-installable executable
4929 -no-undefined declare that a library does not refer to external symbols
4930 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4931 -release RELEASE specify package release information
4932 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4933 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4934 -static do not do any dynamic linking of libtool libraries
4935 -version-info CURRENT[:REVISION[:AGE]]
4936 specify library version info [each variable defaults to 0]
4938 All other options (arguments beginning with \`-') are ignored.
4940 Every other argument is treated as a filename. Files ending in \`.la' are
4941 treated as uninstalled libtool libraries, other files are standard or library
4942 object files.
4944 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4945 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4946 required, except when creating a convenience library.
4948 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4949 using \`ar' and \`ranlib', or on Windows using \`lib'.
4951 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4952 is created, otherwise an executable program is created."
4955 uninstall)
4956 $echo \
4957 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4959 Remove libraries from an installation directory.
4961 RM is the name of the program to use to delete files associated with each FILE
4962 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4963 to RM.
4965 If FILE is a libtool library, all the files associated with it are deleted.
4966 Otherwise, only FILE itself is deleted using RM."
4970 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4971 $echo "$help" 1>&2
4972 exit 1
4974 esac
4976 echo
4977 $echo "Try \`$modename --help' for more information about other modes."
4979 exit 0
4981 # Local Variables:
4982 # mode:shell-script
4983 # sh-indentation:2
4984 # End: