Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / bind / ltmain.sh
blob96c583593508b6524432db8be84d6721517b00b8
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
59 TIMESTAMP=" (1.920 2001/04/24 23:26:18)"
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed='sed -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 SP2NL='tr \040 \012'
73 NL2SP='tr \015\012 \040\040'
75 # NLS nuisances.
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
83 if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
87 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
88 echo "$modename: not configured to build any kind of library" 1>&2
89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
90 exit 1
93 # Global variables.
94 mode=$default_mode
95 nonopt=
96 prev=
97 prevopt=
98 run=
99 show="$echo"
100 show_help=
101 execute_dlfiles=
102 lo2o="s/\\.lo\$/.${objext}/"
103 o2lo="s/\\.${objext}\$/.lo/"
105 # Parse our command line options once, thoroughly.
106 while test $# -gt 0
108 arg="$1"
109 shift
111 case $arg in
112 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
113 *) optarg= ;;
114 esac
116 # If the previous option needs an argument, assign it.
117 if test -n "$prev"; then
118 case $prev in
119 execute_dlfiles)
120 execute_dlfiles="$execute_dlfiles $arg"
123 eval "$prev=\$arg"
125 esac
127 prev=
128 prevopt=
129 continue
132 # Have we seen a non-optional argument yet?
133 case $arg in
134 --help)
135 show_help=yes
138 --version)
139 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
140 exit 0
143 --config)
144 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
145 exit 0
148 --debug)
149 echo "$progname: enabling shell trace mode"
150 set -x
153 --dry-run | -n)
154 run=:
157 --features)
158 echo "host: $host"
159 if test "$build_libtool_libs" = yes; then
160 echo "enable shared libraries"
161 else
162 echo "disable shared libraries"
164 if test "$build_old_libs" = yes; then
165 echo "enable static libraries"
166 else
167 echo "disable static libraries"
169 exit 0
172 --finish) mode="finish" ;;
174 --mode) prevopt="--mode" prev=mode ;;
175 --mode=*) mode="$optarg" ;;
177 --quiet | --silent)
178 show=:
181 -dlopen)
182 prevopt="-dlopen"
183 prev=execute_dlfiles
187 $echo "$modename: unrecognized option \`$arg'" 1>&2
188 $echo "$help" 1>&2
189 exit 1
193 nonopt="$arg"
194 break
196 esac
197 done
199 if test -n "$prevopt"; then
200 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
201 $echo "$help" 1>&2
202 exit 1
205 if test -z "$show_help"; then
207 # Infer the operation mode.
208 if test -z "$mode"; then
209 case $nonopt in
210 *cc | *++ | gcc* | *-gcc*)
211 mode=link
212 for arg
214 case $arg in
216 mode=compile
217 break
219 esac
220 done
222 *db | *dbx | *strace | *truss)
223 mode=execute
225 *install*|cp|mv)
226 mode=install
228 *rm)
229 mode=uninstall
232 # If we have no mode, but dlfiles were specified, then do execute mode.
233 test -n "$execute_dlfiles" && mode=execute
235 # Just use the default operation mode.
236 if test -z "$mode"; then
237 if test -n "$nonopt"; then
238 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
239 else
240 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
244 esac
247 # Only execute mode is allowed to have -dlopen flags.
248 if test -n "$execute_dlfiles" && test "$mode" != execute; then
249 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
250 $echo "$help" 1>&2
251 exit 1
254 # Change the help message to a mode-specific one.
255 generic_help="$help"
256 help="Try \`$modename --help --mode=$mode' for more information."
258 # These modes are in order of execution frequency so that they run quickly.
259 case $mode in
260 # libtool compile mode
261 compile)
262 modename="$modename: compile"
263 # Get the compilation command and the source file.
264 base_compile=
265 prev=
266 lastarg=
267 srcfile="$nonopt"
268 suppress_output=
270 user_target=no
271 for arg
273 case $prev in
274 "") ;;
275 xcompiler)
276 # Aesthetically quote the previous argument.
277 prev=
278 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
280 case $arg in
281 # Double-quote args containing other shell metacharacters.
282 # Many Bourne shells cannot handle close brackets correctly
283 # in scan sets, so we specify it separately.
284 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
285 arg="\"$arg\""
287 esac
289 # Add the previous argument to base_compile.
290 if test -z "$base_compile"; then
291 base_compile="$lastarg"
292 else
293 base_compile="$base_compile $lastarg"
295 continue
297 esac
299 # Accept any command-line options.
300 case $arg in
302 if test "$user_target" != "no"; then
303 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
304 exit 1
306 user_target=next
309 -static)
310 build_old_libs=yes
311 continue
314 -prefer-pic)
315 pic_mode=yes
316 continue
319 -prefer-non-pic)
320 pic_mode=no
321 continue
324 -Xcompiler)
325 prev=xcompiler
326 continue
329 -Wc,*)
330 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
331 lastarg=
332 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
333 for arg in $args; do
334 IFS="$save_ifs"
336 # Double-quote args containing other shell metacharacters.
337 # Many Bourne shells cannot handle close brackets correctly
338 # in scan sets, so we specify it separately.
339 case $arg in
340 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
341 arg="\"$arg\""
343 esac
344 lastarg="$lastarg $arg"
345 done
346 IFS="$save_ifs"
347 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
349 # Add the arguments to base_compile.
350 if test -z "$base_compile"; then
351 base_compile="$lastarg"
352 else
353 base_compile="$base_compile $lastarg"
355 continue
357 esac
359 case $user_target in
360 next)
361 # The next one is the -o target name
362 user_target=yes
363 continue
365 yes)
366 # We got the output file
367 user_target=set
368 libobj="$arg"
369 continue
371 esac
373 # Accept the current argument as the source file.
374 lastarg="$srcfile"
375 srcfile="$arg"
377 # Aesthetically quote the previous argument.
379 # Backslashify any backslashes, double quotes, and dollar signs.
380 # These are the only characters that are still specially
381 # interpreted inside of double-quoted scrings.
382 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
384 # Double-quote args containing other shell metacharacters.
385 # Many Bourne shells cannot handle close brackets correctly
386 # in scan sets, so we specify it separately.
387 case $lastarg in
388 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
389 lastarg="\"$lastarg\""
391 esac
393 # Add the previous argument to base_compile.
394 if test -z "$base_compile"; then
395 base_compile="$lastarg"
396 else
397 base_compile="$base_compile $lastarg"
399 done
401 case $user_target in
402 set)
405 # Get the name of the library object.
406 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
409 $echo "$modename: you must specify a target with \`-o'" 1>&2
410 exit 1
412 esac
414 # Recognize several different file suffixes.
415 # If the user specifies -o file.o, it is replaced with file.lo
416 xform='[cCFSfmso]'
417 case $libobj in
418 *.ada) xform=ada ;;
419 *.adb) xform=adb ;;
420 *.ads) xform=ads ;;
421 *.asm) xform=asm ;;
422 *.c++) xform=c++ ;;
423 *.cc) xform=cc ;;
424 *.cpp) xform=cpp ;;
425 *.cxx) xform=cxx ;;
426 *.f90) xform=f90 ;;
427 *.for) xform=for ;;
428 esac
430 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
432 case $libobj in
433 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
435 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
436 exit 1
438 esac
440 if test -z "$base_compile"; then
441 $echo "$modename: you must specify a compilation command" 1>&2
442 $echo "$help" 1>&2
443 exit 1
446 # Delete any leftover library objects.
447 if test "$build_old_libs" = yes; then
448 removelist="$obj $libobj"
449 else
450 removelist="$libobj"
453 $run $rm $removelist
454 trap "$run $rm $removelist; exit 1" 1 2 15
456 # On Cygwin there's no "real" PIC flag so we must build both object types
457 case $host_os in
458 cygwin* | mingw* | pw32* | os2*)
459 pic_mode=default
461 esac
462 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
463 # non-PIC code in shared libraries is not supported
464 pic_mode=default
467 # Calculate the filename of the output object if compiler does
468 # not support -o with -c
469 if test "$compiler_c_o" = no; then
470 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
471 lockfile="$output_obj.lock"
472 removelist="$removelist $output_obj $lockfile"
473 trap "$run $rm $removelist; exit 1" 1 2 15
474 else
475 need_locks=no
476 lockfile=
479 # Lock this critical section if it is needed
480 # We use this script file to make the link, it avoids creating a new file
481 if test "$need_locks" = yes; then
482 until $run ln "$0" "$lockfile" 2>/dev/null; do
483 $show "Waiting for $lockfile to be removed"
484 sleep 2
485 done
486 elif test "$need_locks" = warn; then
487 if test -f "$lockfile"; then
488 echo "\
489 *** ERROR, $lockfile exists and contains:
490 `cat $lockfile 2>/dev/null`
492 This indicates that another process is trying to use the same
493 temporary object file, and libtool could not work around it because
494 your compiler does not support \`-c' and \`-o' together. If you
495 repeat this compilation, it may succeed, by chance, but you had better
496 avoid parallel builds (make -j) in this platform, or get a better
497 compiler."
499 $run $rm $removelist
500 exit 1
502 echo $srcfile > "$lockfile"
505 if test -n "$fix_srcfile_path"; then
506 eval srcfile=\"$fix_srcfile_path\"
509 # Only build a PIC object if we are building libtool libraries.
510 if test "$build_libtool_libs" = yes; then
511 # Without this assignment, base_compile gets emptied.
512 fbsd_hideous_sh_bug=$base_compile
514 if test "$pic_mode" != no; then
515 # All platforms use -DPIC, to notify preprocessed assembler code.
516 command="$base_compile $srcfile $pic_flag -DPIC"
517 else
518 # Don't build PIC code
519 command="$base_compile $srcfile"
521 if test "$build_old_libs" = yes; then
522 lo_libobj="$libobj"
523 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
524 if test "X$dir" = "X$libobj"; then
525 dir="$objdir"
526 else
527 dir="$dir/$objdir"
529 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
531 if test -d "$dir"; then
532 $show "$rm $libobj"
533 $run $rm $libobj
534 else
535 $show "$mkdir $dir"
536 $run $mkdir $dir
537 status=$?
538 if test $status -ne 0 && test ! -d $dir; then
539 exit $status
543 if test "$compiler_o_lo" = yes; then
544 output_obj="$libobj"
545 command="$command -o $output_obj"
546 elif test "$compiler_c_o" = yes; then
547 output_obj="$obj"
548 command="$command -o $output_obj"
551 $run $rm "$output_obj"
552 $show "$command"
553 if $run eval "$command"; then :
554 else
555 test -n "$output_obj" && $run $rm $removelist
556 exit 1
559 if test "$need_locks" = warn &&
560 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
561 echo "\
562 *** ERROR, $lockfile contains:
563 `cat $lockfile 2>/dev/null`
565 but it should contain:
566 $srcfile
568 This indicates that another process is trying to use the same
569 temporary object file, and libtool could not work around it because
570 your compiler does not support \`-c' and \`-o' together. If you
571 repeat this compilation, it may succeed, by chance, but you had better
572 avoid parallel builds (make -j) in this platform, or get a better
573 compiler."
575 $run $rm $removelist
576 exit 1
579 # Just move the object if needed, then go on to compile the next one
580 if test x"$output_obj" != x"$libobj"; then
581 $show "$mv $output_obj $libobj"
582 if $run $mv $output_obj $libobj; then :
583 else
584 error=$?
585 $run $rm $removelist
586 exit $error
590 # If we have no pic_flag, then copy the object into place and finish.
591 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
592 test "$build_old_libs" = yes; then
593 # Rename the .lo from within objdir to obj
594 if test -f $obj; then
595 $show $rm $obj
596 $run $rm $obj
599 $show "$mv $libobj $obj"
600 if $run $mv $libobj $obj; then :
601 else
602 error=$?
603 $run $rm $removelist
604 exit $error
607 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
608 if test "X$xdir" = "X$obj"; then
609 xdir="."
610 else
611 xdir="$xdir"
613 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
614 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
615 # Now arrange that obj and lo_libobj become the same file
616 $show "(cd $xdir && $LN_S $baseobj $libobj)"
617 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
618 exit 0
619 else
620 error=$?
621 $run $rm $removelist
622 exit $error
626 # Allow error messages only from the first compilation.
627 suppress_output=' >/dev/null 2>&1'
630 # Only build a position-dependent object if we build old libraries.
631 if test "$build_old_libs" = yes; then
632 if test "$pic_mode" != yes; then
633 # Don't build PIC code
634 command="$base_compile $srcfile"
635 else
636 # All platforms use -DPIC, to notify preprocessed assembler code.
637 command="$base_compile $srcfile $pic_flag -DPIC"
639 if test "$compiler_c_o" = yes; then
640 command="$command -o $obj"
641 output_obj="$obj"
644 # Suppress compiler output if we already did a PIC compilation.
645 command="$command$suppress_output"
646 $run $rm "$output_obj"
647 $show "$command"
648 if $run eval "$command"; then :
649 else
650 $run $rm $removelist
651 exit 1
654 if test "$need_locks" = warn &&
655 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
656 echo "\
657 *** ERROR, $lockfile contains:
658 `cat $lockfile 2>/dev/null`
660 but it should contain:
661 $srcfile
663 This indicates that another process is trying to use the same
664 temporary object file, and libtool could not work around it because
665 your compiler does not support \`-c' and \`-o' together. If you
666 repeat this compilation, it may succeed, by chance, but you had better
667 avoid parallel builds (make -j) in this platform, or get a better
668 compiler."
670 $run $rm $removelist
671 exit 1
674 # Just move the object if needed
675 if test x"$output_obj" != x"$obj"; then
676 $show "$mv $output_obj $obj"
677 if $run $mv $output_obj $obj; then :
678 else
679 error=$?
680 $run $rm $removelist
681 exit $error
685 # Create an invalid libtool object if no PIC, so that we do not
686 # accidentally link it into a program.
687 if test "$build_libtool_libs" != yes; then
688 $show "echo timestamp > $libobj"
689 $run eval "echo timestamp > \$libobj" || exit $?
690 else
691 # Move the .lo from within objdir
692 $show "$mv $libobj $lo_libobj"
693 if $run $mv $libobj $lo_libobj; then :
694 else
695 error=$?
696 $run $rm $removelist
697 exit $error
702 # Unlock the critical section if it was locked
703 if test "$need_locks" != no; then
704 $run $rm "$lockfile"
707 exit 0
710 # libtool link mode
711 link | relink)
712 modename="$modename: link"
713 case $host in
714 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
715 # It is impossible to link a dll without this setting, and
716 # we shouldn't force the makefile maintainer to figure out
717 # which system we are compiling for in order to pass an extra
718 # flag for every libtool invokation.
719 # allow_undefined=no
721 # FIXME: Unfortunately, there are problems with the above when trying
722 # to make a dll which has undefined symbols, in which case not
723 # even a static library is built. For now, we need to specify
724 # -no-undefined on the libtool link line when we can be certain
725 # that all symbols are satisfied, otherwise we get a static library.
726 allow_undefined=yes
728 *-*-aix*)
729 allow_undefined=no
732 allow_undefined=yes
734 esac
735 libtool_args="$nonopt"
736 compile_command="$nonopt"
737 finalize_command="$nonopt"
739 compile_rpath=
740 finalize_rpath=
741 compile_shlibpath=
742 finalize_shlibpath=
743 convenience=
744 old_convenience=
745 deplibs=
746 old_deplibs=
747 compiler_flags=
748 linker_flags=
749 dllsearchpath=
750 lib_search_path=`pwd`
752 avoid_version=no
753 dlfiles=
754 dlprefiles=
755 dlself=no
756 export_dynamic=no
757 export_symbols=
758 export_symbols_regex=
759 generated=
760 libobjs=
761 ltlibs=
762 module=no
763 no_install=no
764 objs=
765 prefer_static_libs=no
766 preload=no
767 prev=
768 prevarg=
769 release=
770 rpath=
771 xrpath=
772 perm_rpath=
773 temp_rpath=
774 thread_safe=no
775 vinfo=
777 # We need to know -static, to get the right output filenames.
778 for arg
780 case $arg in
781 -all-static | -static)
782 if test "X$arg" = "X-all-static"; then
783 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
784 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
786 if test -n "$link_static_flag"; then
787 dlopen_self=$dlopen_self_static
789 else
790 if test -z "$pic_flag" && test -n "$link_static_flag"; then
791 dlopen_self=$dlopen_self_static
794 build_libtool_libs=no
795 build_old_libs=yes
796 prefer_static_libs=yes
797 break
799 esac
800 done
802 # See if our shared archives depend on static archives.
803 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
805 # Go through the arguments, transforming them on the way.
806 while test $# -gt 0; do
807 arg="$1"
808 shift
809 case $arg in
810 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
811 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
813 *) qarg=$arg ;;
814 esac
815 libtool_args="$libtool_args $qarg"
817 # If the previous option needs an argument, assign it.
818 if test -n "$prev"; then
819 case $prev in
820 output)
821 compile_command="$compile_command @OUTPUT@"
822 finalize_command="$finalize_command @OUTPUT@"
824 esac
826 case $prev in
827 dlfiles|dlprefiles)
828 if test "$preload" = no; then
829 # Add the symbol object into the linking commands.
830 compile_command="$compile_command @SYMFILE@"
831 finalize_command="$finalize_command @SYMFILE@"
832 preload=yes
834 case $arg in
835 *.la | *.lo) ;; # We handle these cases below.
836 force)
837 if test "$dlself" = no; then
838 dlself=needless
839 export_dynamic=yes
841 prev=
842 continue
844 self)
845 if test "$prev" = dlprefiles; then
846 dlself=yes
847 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
848 dlself=yes
849 else
850 dlself=needless
851 export_dynamic=yes
853 prev=
854 continue
857 if test "$prev" = dlfiles; then
858 dlfiles="$dlfiles $arg"
859 else
860 dlprefiles="$dlprefiles $arg"
862 prev=
863 continue
865 esac
867 expsyms)
868 export_symbols="$arg"
869 if test ! -f "$arg"; then
870 $echo "$modename: symbol file \`$arg' does not exist"
871 exit 1
873 prev=
874 continue
876 expsyms_regex)
877 export_symbols_regex="$arg"
878 prev=
879 continue
881 release)
882 release="-$arg"
883 prev=
884 continue
886 rpath | xrpath)
887 # We need an absolute path.
888 case $arg in
889 [\\/]* | [A-Za-z]:[\\/]*) ;;
891 $echo "$modename: only absolute run-paths are allowed" 1>&2
892 exit 1
894 esac
895 if test "$prev" = rpath; then
896 case "$rpath " in
897 *" $arg "*) ;;
898 *) rpath="$rpath $arg" ;;
899 esac
900 else
901 case "$xrpath " in
902 *" $arg "*) ;;
903 *) xrpath="$xrpath $arg" ;;
904 esac
906 prev=
907 continue
909 xcompiler)
910 compiler_flags="$compiler_flags $qarg"
911 prev=
912 compile_command="$compile_command $qarg"
913 finalize_command="$finalize_command $qarg"
914 continue
916 xlinker)
917 linker_flags="$linker_flags $qarg"
918 compiler_flags="$compiler_flags $wl$qarg"
919 prev=
920 compile_command="$compile_command $wl$qarg"
921 finalize_command="$finalize_command $wl$qarg"
922 continue
925 eval "$prev=\"\$arg\""
926 prev=
927 continue
929 esac
930 fi # test -n $prev
932 prevarg="$arg"
934 case $arg in
935 -all-static)
936 if test -n "$link_static_flag"; then
937 compile_command="$compile_command $link_static_flag"
938 finalize_command="$finalize_command $link_static_flag"
940 continue
943 -allow-undefined)
944 # FIXME: remove this flag sometime in the future.
945 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
946 allow_undefined=yes
947 continue
950 -avoid-version)
951 avoid_version=yes
952 continue
955 -dlopen)
956 prev=dlfiles
957 continue
960 -dlpreopen)
961 prev=dlprefiles
962 continue
965 -export-dynamic)
966 export_dynamic=yes
967 continue
970 -export-symbols | -export-symbols-regex)
971 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
972 $echo "$modename: more than one -exported-symbols argument is not allowed"
973 exit 1
975 if test "X$arg" = "X-export-symbols"; then
976 prev=expsyms
977 else
978 prev=expsyms_regex
980 continue
983 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
984 # so, if we see these flags be careful not to treat them like -L
985 -L[A-Z][A-Z]*:*)
986 case $with_gcc/$host in
987 no/*-*-irix*)
988 compile_command="$compile_command $arg"
989 finalize_command="$finalize_command $arg"
991 esac
992 continue
995 -L*)
996 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
997 # We need an absolute path.
998 case $dir in
999 [\\/]* | [A-Za-z]:[\\/]*) ;;
1001 absdir=`cd "$dir" && pwd`
1002 if test -z "$absdir"; then
1003 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1004 exit 1
1006 dir="$absdir"
1008 esac
1009 case "$deplibs " in
1010 *" -L$dir "*) ;;
1012 deplibs="$deplibs -L$dir"
1013 lib_search_path="$lib_search_path $dir"
1015 esac
1016 case $host in
1017 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1018 case :$dllsearchpath: in
1019 *":$dir:"*) ;;
1020 *) dllsearchpath="$dllsearchpath:$dir";;
1021 esac
1023 esac
1024 continue
1027 -l*)
1028 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1029 case $host in
1030 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1031 # These systems don't actually have a C or math library (as such)
1032 continue
1034 *-*-mingw* | *-*-os2*)
1035 # These systems don't actually have a C library (as such)
1036 test "X$arg" = "X-lc" && continue
1038 esac
1040 deplibs="$deplibs $arg"
1041 continue
1044 -module)
1045 module=yes
1046 continue
1049 -no-fast-install)
1050 fast_install=no
1051 continue
1054 -no-install)
1055 case $host in
1056 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1057 # The PATH hackery in wrapper scripts is required on Windows
1058 # in order for the loader to find any dlls it needs.
1059 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1060 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1061 fast_install=no
1063 *) no_install=yes ;;
1064 esac
1065 continue
1068 -no-undefined)
1069 allow_undefined=no
1070 continue
1073 -o) prev=output ;;
1075 -release)
1076 prev=release
1077 continue
1080 -rpath)
1081 prev=rpath
1082 continue
1086 prev=xrpath
1087 continue
1090 -R*)
1091 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1092 # We need an absolute path.
1093 case $dir in
1094 [\\/]* | [A-Za-z]:[\\/]*) ;;
1096 $echo "$modename: only absolute run-paths are allowed" 1>&2
1097 exit 1
1099 esac
1100 case "$xrpath " in
1101 *" $dir "*) ;;
1102 *) xrpath="$xrpath $dir" ;;
1103 esac
1104 continue
1107 -static)
1108 # The effects of -static are defined in a previous loop.
1109 # We used to do the same as -all-static on platforms that
1110 # didn't have a PIC flag, but the assumption that the effects
1111 # would be equivalent was wrong. It would break on at least
1112 # Digital Unix and AIX.
1113 continue
1116 -thread-safe)
1117 thread_safe=yes
1118 continue
1121 -version-info)
1122 prev=vinfo
1123 continue
1126 -Wc,*)
1127 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1128 arg=
1129 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1130 for flag in $args; do
1131 IFS="$save_ifs"
1132 case $flag in
1133 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1134 flag="\"$flag\""
1136 esac
1137 arg="$arg $wl$flag"
1138 compiler_flags="$compiler_flags $flag"
1139 done
1140 IFS="$save_ifs"
1141 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1144 -Wl,*)
1145 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1146 arg=
1147 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1148 for flag in $args; do
1149 IFS="$save_ifs"
1150 case $flag in
1151 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1152 flag="\"$flag\""
1154 esac
1155 arg="$arg $wl$flag"
1156 compiler_flags="$compiler_flags $wl$flag"
1157 linker_flags="$linker_flags $flag"
1158 done
1159 IFS="$save_ifs"
1160 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1163 -Xcompiler)
1164 prev=xcompiler
1165 continue
1168 -Xlinker)
1169 prev=xlinker
1170 continue
1173 # Some other compiler flag.
1174 -* | +*)
1175 # Unknown arguments in both finalize_command and compile_command need
1176 # to be aesthetically quoted because they are evaled later.
1177 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1178 case $arg in
1179 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1180 arg="\"$arg\""
1182 esac
1185 *.lo | *.$objext)
1186 # A library or standard object.
1187 if test "$prev" = dlfiles; then
1188 # This file was specified with -dlopen.
1189 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1190 dlfiles="$dlfiles $arg"
1191 prev=
1192 continue
1193 else
1194 # If libtool objects are unsupported, then we need to preload.
1195 prev=dlprefiles
1199 if test "$prev" = dlprefiles; then
1200 # Preload the old-style object.
1201 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1202 prev=
1203 else
1204 case $arg in
1205 *.lo) libobjs="$libobjs $arg" ;;
1206 *) objs="$objs $arg" ;;
1207 esac
1211 *.$libext)
1212 # An archive.
1213 deplibs="$deplibs $arg"
1214 old_deplibs="$old_deplibs $arg"
1215 continue
1218 *.la)
1219 # A libtool-controlled library.
1221 if test "$prev" = dlfiles; then
1222 # This library was specified with -dlopen.
1223 dlfiles="$dlfiles $arg"
1224 prev=
1225 elif test "$prev" = dlprefiles; then
1226 # The library was specified with -dlpreopen.
1227 dlprefiles="$dlprefiles $arg"
1228 prev=
1229 else
1230 deplibs="$deplibs $arg"
1232 continue
1235 # Some other compiler argument.
1237 # Unknown arguments in both finalize_command and compile_command need
1238 # to be aesthetically quoted because they are evaled later.
1239 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1240 case $arg in
1241 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1242 arg="\"$arg\""
1244 esac
1246 esac # arg
1248 # Now actually substitute the argument into the commands.
1249 if test -n "$arg"; then
1250 compile_command="$compile_command $arg"
1251 finalize_command="$finalize_command $arg"
1253 done # argument parsing loop
1255 if test -n "$prev"; then
1256 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1257 $echo "$help" 1>&2
1258 exit 1
1261 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1262 eval arg=\"$export_dynamic_flag_spec\"
1263 compile_command="$compile_command $arg"
1264 finalize_command="$finalize_command $arg"
1267 # calculate the name of the file, without its directory
1268 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1269 libobjs_save="$libobjs"
1271 if test -n "$shlibpath_var"; then
1272 # get the directories listed in $shlibpath_var
1273 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1274 else
1275 shlib_search_path=
1277 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1278 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1280 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1281 if test "X$output_objdir" = "X$output"; then
1282 output_objdir="$objdir"
1283 else
1284 output_objdir="$output_objdir/$objdir"
1286 # Create the object directory.
1287 if test ! -d $output_objdir; then
1288 $show "$mkdir $output_objdir"
1289 $run $mkdir $output_objdir
1290 status=$?
1291 if test $status -ne 0 && test ! -d $output_objdir; then
1292 exit $status
1296 # Determine the type of output
1297 case $output in
1299 $echo "$modename: you must specify an output file" 1>&2
1300 $echo "$help" 1>&2
1301 exit 1
1303 *.$libext) linkmode=oldlib ;;
1304 *.lo | *.$objext) linkmode=obj ;;
1305 *.la) linkmode=lib ;;
1306 *) linkmode=prog ;; # Anything else should be a program.
1307 esac
1309 specialdeplibs=
1310 libs=
1311 # Find all interdependent deplibs by searching for libraries
1312 # that are linked more than once (e.g. -la -lb -la)
1313 for deplib in $deplibs; do
1314 case "$libs " in
1315 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1316 esac
1317 libs="$libs $deplib"
1318 done
1319 deplibs=
1320 newdependency_libs=
1321 newlib_search_path=
1322 need_relink=no # whether we're linking any uninstalled libtool libraries
1323 notinst_deplibs= # not-installed libtool libraries
1324 notinst_path= # paths that contain not-installed libtool libraries
1325 case $linkmode in
1326 lib)
1327 passes="conv link"
1328 for file in $dlfiles $dlprefiles; do
1329 case $file in
1330 *.la) ;;
1332 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1333 exit 1
1335 esac
1336 done
1338 prog)
1339 compile_deplibs=
1340 finalize_deplibs=
1341 alldeplibs=no
1342 newdlfiles=
1343 newdlprefiles=
1344 passes="conv scan dlopen dlpreopen link"
1346 *) passes="conv"
1348 esac
1349 for pass in $passes; do
1350 if test $linkmode = prog; then
1351 # Determine which files to process
1352 case $pass in
1353 dlopen)
1354 libs="$dlfiles"
1355 save_deplibs="$deplibs" # Collect dlpreopened libraries
1356 deplibs=
1358 dlpreopen) libs="$dlprefiles" ;;
1359 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1360 esac
1362 for deplib in $libs; do
1363 lib=
1364 found=no
1365 case $deplib in
1366 -l*)
1367 if test $linkmode = oldlib && test $linkmode = obj; then
1368 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1369 continue
1371 if test $pass = conv; then
1372 deplibs="$deplib $deplibs"
1373 continue
1375 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1376 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1377 # Search the libtool library
1378 lib="$searchdir/lib${name}.la"
1379 if test -f "$lib"; then
1380 found=yes
1381 break
1383 done
1384 if test "$found" != yes; then
1385 # deplib doesn't seem to be a libtool library
1386 if test "$linkmode,$pass" = "prog,link"; then
1387 compile_deplibs="$deplib $compile_deplibs"
1388 finalize_deplibs="$deplib $finalize_deplibs"
1389 else
1390 deplibs="$deplib $deplibs"
1391 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1393 continue
1395 ;; # -l
1396 -L*)
1397 case $linkmode in
1398 lib)
1399 deplibs="$deplib $deplibs"
1400 test $pass = conv && continue
1401 newdependency_libs="$deplib $newdependency_libs"
1402 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1404 prog)
1405 if test $pass = conv; then
1406 deplibs="$deplib $deplibs"
1407 continue
1409 if test $pass = scan; then
1410 deplibs="$deplib $deplibs"
1411 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1412 else
1413 compile_deplibs="$deplib $compile_deplibs"
1414 finalize_deplibs="$deplib $finalize_deplibs"
1418 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1420 esac # linkmode
1421 continue
1422 ;; # -L
1423 -R*)
1424 if test $pass = link; then
1425 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1426 # Make sure the xrpath contains only unique directories.
1427 case "$xrpath " in
1428 *" $dir "*) ;;
1429 *) xrpath="$xrpath $dir" ;;
1430 esac
1432 deplibs="$deplib $deplibs"
1433 continue
1435 *.la) lib="$deplib" ;;
1436 *.$libext)
1437 if test $pass = conv; then
1438 deplibs="$deplib $deplibs"
1439 continue
1441 case $linkmode in
1442 lib)
1443 if test "$deplibs_check_method" != pass_all; then
1444 echo
1445 echo "*** Warning: This library needs some functionality provided by $deplib."
1446 echo "*** I have the capability to make that library automatically link in when"
1447 echo "*** you link to this library. But I can only do this if you have a"
1448 echo "*** shared version of the library, which you do not appear to have."
1449 else
1450 echo
1451 echo "*** Warning: Linking the shared library $output against the"
1452 echo "*** static library $deplib is not portable!"
1453 deplibs="$deplib $deplibs"
1455 continue
1457 prog)
1458 if test $pass != link; then
1459 deplibs="$deplib $deplibs"
1460 else
1461 compile_deplibs="$deplib $compile_deplibs"
1462 finalize_deplibs="$deplib $finalize_deplibs"
1464 continue
1466 esac # linkmode
1467 ;; # *.$libext
1468 *.lo | *.$objext)
1469 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1470 # If there is no dlopen support or we're linking statically,
1471 # we need to preload.
1472 newdlprefiles="$newdlprefiles $deplib"
1473 compile_deplibs="$deplib $compile_deplibs"
1474 finalize_deplibs="$deplib $finalize_deplibs"
1475 else
1476 newdlfiles="$newdlfiles $deplib"
1478 continue
1480 %DEPLIBS%)
1481 alldeplibs=yes
1482 continue
1484 esac # case $deplib
1485 if test $found = yes || test -f "$lib"; then :
1486 else
1487 $echo "$modename: cannot find the library \`$lib'" 1>&2
1488 exit 1
1491 # Check to see that this really is a libtool archive.
1492 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1493 else
1494 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1495 exit 1
1498 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1499 test "X$ladir" = "X$lib" && ladir="."
1501 dlname=
1502 dlopen=
1503 dlpreopen=
1504 libdir=
1505 library_names=
1506 old_library=
1507 # If the library was installed with an old release of libtool,
1508 # it will not redefine variable installed.
1509 installed=yes
1511 # Read the .la file
1512 case $lib in
1513 */* | *\\*) . $lib ;;
1514 *) . ./$lib ;;
1515 esac
1517 if test "$linkmode,$pass" = "lib,link" ||
1518 test "$linkmode,$pass" = "prog,scan" ||
1519 { test $linkmode = oldlib && test $linkmode = obj; }; then
1520 # Add dl[pre]opened files of deplib
1521 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1522 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1525 if test $pass = conv; then
1526 # Only check for convenience libraries
1527 deplibs="$lib $deplibs"
1528 if test -z "$libdir"; then
1529 if test -z "$old_library"; then
1530 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1531 exit 1
1533 # It is a libtool convenience library, so add in its objects.
1534 convenience="$convenience $ladir/$objdir/$old_library"
1535 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1536 tmp_libs=
1537 for deplib in $dependency_libs; do
1538 deplibs="$deplib $deplibs"
1539 case "$tmp_libs " in
1540 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1541 esac
1542 tmp_libs="$tmp_libs $deplib"
1543 done
1544 elif test $linkmode != prog && test $linkmode != lib; then
1545 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1546 exit 1
1548 continue
1549 fi # $pass = conv
1551 # Get the name of the library we link against.
1552 linklib=
1553 for l in $old_library $library_names; do
1554 linklib="$l"
1555 done
1556 if test -z "$linklib"; then
1557 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1558 exit 1
1561 # This library was specified with -dlopen.
1562 if test $pass = dlopen; then
1563 if test -z "$libdir"; then
1564 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1565 exit 1
1567 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1568 # If there is no dlname, no dlopen support or we're linking
1569 # statically, we need to preload.
1570 dlprefiles="$dlprefiles $lib"
1571 else
1572 newdlfiles="$newdlfiles $lib"
1574 continue
1575 fi # $pass = dlopen
1577 # We need an absolute path.
1578 case $ladir in
1579 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1581 abs_ladir=`cd "$ladir" && pwd`
1582 if test -z "$abs_ladir"; then
1583 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1584 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1585 abs_ladir="$ladir"
1588 esac
1589 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1591 # Find the relevant object directory and library name.
1592 if test "X$installed" = Xyes; then
1593 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1594 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1595 dir="$ladir"
1596 absdir="$abs_ladir"
1597 libdir="$abs_ladir"
1598 else
1599 dir="$libdir"
1600 absdir="$libdir"
1602 else
1603 dir="$ladir/$objdir"
1604 absdir="$abs_ladir/$objdir"
1605 # Remove this search path later
1606 notinst_path="$notinst_path $abs_ladir"
1607 fi # $installed = yes
1608 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1610 # This library was specified with -dlpreopen.
1611 if test $pass = dlpreopen; then
1612 if test -z "$libdir"; then
1613 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1614 exit 1
1616 # Prefer using a static library (so that no silly _DYNAMIC symbols
1617 # are required to link).
1618 if test -n "$old_library"; then
1619 newdlprefiles="$newdlprefiles $dir/$old_library"
1620 # Otherwise, use the dlname, so that lt_dlopen finds it.
1621 elif test -n "$dlname"; then
1622 newdlprefiles="$newdlprefiles $dir/$dlname"
1623 else
1624 newdlprefiles="$newdlprefiles $dir/$linklib"
1626 fi # $pass = dlpreopen
1628 if test -z "$libdir"; then
1629 # Link the convenience library
1630 if test $linkmode = lib; then
1631 deplibs="$dir/$old_library $deplibs"
1632 elif test "$linkmode,$pass" = "prog,link"; then
1633 compile_deplibs="$dir/$old_library $compile_deplibs"
1634 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1635 else
1636 deplibs="$lib $deplibs"
1638 continue
1641 if test $linkmode = prog && test $pass != link; then
1642 newlib_search_path="$newlib_search_path $ladir"
1643 deplibs="$lib $deplibs"
1645 linkalldeplibs=no
1646 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1647 test "$build_libtool_libs" = no; then
1648 linkalldeplibs=yes
1651 tmp_libs=
1652 for deplib in $dependency_libs; do
1653 case $deplib in
1654 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1655 esac
1656 # Need to link against all dependency_libs?
1657 if test $linkalldeplibs = yes; then
1658 deplibs="$deplib $deplibs"
1659 else
1660 # Need to hardcode shared library paths
1661 # or/and link against static libraries
1662 newdependency_libs="$deplib $newdependency_libs"
1664 case "$tmp_libs " in
1665 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1666 esac
1667 tmp_libs="$tmp_libs $deplib"
1668 done # for deplib
1669 continue
1670 fi # $linkmode = prog...
1672 link_static=no # Whether the deplib will be linked statically
1673 if test -n "$library_names" &&
1674 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1675 # Link against this shared library
1677 if test "$linkmode,$pass" = "prog,link" ||
1678 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1679 # Hardcode the library path.
1680 # Skip directories that are in the system default run-time
1681 # search path.
1682 case " $sys_lib_dlsearch_path " in
1683 *" $absdir "*) ;;
1685 case "$compile_rpath " in
1686 *" $absdir "*) ;;
1687 *) compile_rpath="$compile_rpath $absdir"
1688 esac
1690 esac
1691 case " $sys_lib_dlsearch_path " in
1692 *" $libdir "*) ;;
1694 case "$finalize_rpath " in
1695 *" $libdir "*) ;;
1696 *) finalize_rpath="$finalize_rpath $libdir"
1697 esac
1699 esac
1700 if test $linkmode = prog; then
1701 # We need to hardcode the library path
1702 if test -n "$shlibpath_var"; then
1703 # Make sure the rpath contains only unique directories.
1704 case "$temp_rpath " in
1705 *" $dir "*) ;;
1706 *" $absdir "*) ;;
1707 *) temp_rpath="$temp_rpath $dir" ;;
1708 esac
1711 fi # $linkmode,$pass = prog,link...
1713 if test "$alldeplibs" = yes &&
1714 { test "$deplibs_check_method" = pass_all ||
1715 { test "$build_libtool_libs" = yes &&
1716 test -n "$library_names"; }; }; then
1717 # We only need to search for static libraries
1718 continue
1721 if test "$installed" = no; then
1722 notinst_deplibs="$notinst_deplibs $lib"
1723 need_relink=yes
1726 if test -n "$old_archive_from_expsyms_cmds"; then
1727 # figure out the soname
1728 set dummy $library_names
1729 realname="$2"
1730 shift; shift
1731 libname=`eval \\$echo \"$libname_spec\"`
1732 # use dlname if we got it. it's perfectly good, no?
1733 if test -n "$dlname"; then
1734 soname="$dlname"
1735 elif test -n "$soname_spec"; then
1736 # bleh windows
1737 case $host in
1738 *cygwin*)
1739 major=`expr $current - $age`
1740 versuffix="-$major"
1742 esac
1743 eval soname=\"$soname_spec\"
1744 else
1745 soname="$realname"
1748 # Make a new name for the extract_expsyms_cmds to use
1749 soroot="$soname"
1750 soname=`echo $soroot | sed -e 's/^.*\///'`
1751 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1753 # If the library has no export list, then create one now
1754 if test -f "$output_objdir/$soname-def"; then :
1755 else
1756 $show "extracting exported symbol list from \`$soname'"
1757 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1758 eval cmds=\"$extract_expsyms_cmds\"
1759 for cmd in $cmds; do
1760 IFS="$save_ifs"
1761 $show "$cmd"
1762 $run eval "$cmd" || exit $?
1763 done
1764 IFS="$save_ifs"
1767 # Create $newlib
1768 if test -f "$output_objdir/$newlib"; then :; else
1769 $show "generating import library for \`$soname'"
1770 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1771 eval cmds=\"$old_archive_from_expsyms_cmds\"
1772 for cmd in $cmds; do
1773 IFS="$save_ifs"
1774 $show "$cmd"
1775 $run eval "$cmd" || exit $?
1776 done
1777 IFS="$save_ifs"
1779 # make sure the library variables are pointing to the new library
1780 dir=$output_objdir
1781 linklib=$newlib
1782 fi # test -n $old_archive_from_expsyms_cmds
1784 if test $linkmode = prog || test "$mode" != relink; then
1785 add_shlibpath=
1786 add_dir=
1787 add=
1788 lib_linked=yes
1789 case $hardcode_action in
1790 immediate | unsupported)
1791 if test "$hardcode_direct" = no; then
1792 add="$dir/$linklib"
1793 elif test "$hardcode_minus_L" = no; then
1794 case $host in
1795 *-*-sunos*) add_shlibpath="$dir" ;;
1796 esac
1797 add_dir="-L$dir"
1798 add="-l$name"
1799 elif test "$hardcode_shlibpath_var" = no; then
1800 add_shlibpath="$dir"
1801 add="-l$name"
1802 else
1803 lib_linked=no
1806 relink)
1807 if test "$hardcode_direct" = yes; then
1808 add="$dir/$linklib"
1809 elif test "$hardcode_minus_L" = yes; then
1810 add_dir="-L$dir"
1811 add="-l$name"
1812 elif test "$hardcode_shlibpath_var" = yes; then
1813 add_shlibpath="$dir"
1814 add="-l$name"
1815 else
1816 lib_linked=no
1819 *) lib_linked=no ;;
1820 esac
1822 if test "$lib_linked" != yes; then
1823 $echo "$modename: configuration error: unsupported hardcode properties"
1824 exit 1
1827 if test -n "$add_shlibpath"; then
1828 case :$compile_shlibpath: in
1829 *":$add_shlibpath:"*) ;;
1830 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1831 esac
1833 if test $linkmode = prog; then
1834 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1835 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1836 else
1837 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1838 test -n "$add" && deplibs="$add $deplibs"
1839 if test "$hardcode_direct" != yes && \
1840 test "$hardcode_minus_L" != yes && \
1841 test "$hardcode_shlibpath_var" = yes; then
1842 case :$finalize_shlibpath: in
1843 *":$libdir:"*) ;;
1844 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1845 esac
1850 if test $linkmode = prog || test "$mode" = relink; then
1851 add_shlibpath=
1852 add_dir=
1853 add=
1854 # Finalize command for both is simple: just hardcode it.
1855 if test "$hardcode_direct" = yes; then
1856 add="$libdir/$linklib"
1857 elif test "$hardcode_minus_L" = yes; then
1858 add_dir="-L$libdir"
1859 add="-l$name"
1860 elif test "$hardcode_shlibpath_var" = yes; then
1861 case :$finalize_shlibpath: in
1862 *":$libdir:"*) ;;
1863 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1864 esac
1865 add="-l$name"
1866 else
1867 # We cannot seem to hardcode it, guess we'll fake it.
1868 add_dir="-L$libdir"
1869 add="-l$name"
1872 if test $linkmode = prog; then
1873 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1874 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1875 else
1876 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1877 test -n "$add" && deplibs="$add $deplibs"
1880 elif test $linkmode = prog; then
1881 if test "$alldeplibs" = yes &&
1882 { test "$deplibs_check_method" = pass_all ||
1883 { test "$build_libtool_libs" = yes &&
1884 test -n "$library_names"; }; }; then
1885 # We only need to search for static libraries
1886 continue
1889 # Try to link the static library
1890 # Here we assume that one of hardcode_direct or hardcode_minus_L
1891 # is not unsupported. This is valid on all known static and
1892 # shared platforms.
1893 if test "$hardcode_direct" != unsupported; then
1894 test -n "$old_library" && linklib="$old_library"
1895 compile_deplibs="$dir/$linklib $compile_deplibs"
1896 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1897 else
1898 compile_deplibs="-l$name -L$dir $compile_deplibs"
1899 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1901 elif test "$build_libtool_libs" = yes; then
1902 # Not a shared library
1903 if test "$deplibs_check_method" != pass_all; then
1904 # We're trying link a shared library against a static one
1905 # but the system doesn't support it.
1907 # Just print a warning and add the library to dependency_libs so
1908 # that the program can be linked against the static library.
1909 echo
1910 echo "*** Warning: This library needs some functionality provided by $lib."
1911 echo "*** I have the capability to make that library automatically link in when"
1912 echo "*** you link to this library. But I can only do this if you have a"
1913 echo "*** shared version of the library, which you do not appear to have."
1914 if test "$module" = yes; then
1915 echo "*** Therefore, libtool will create a static module, that should work "
1916 echo "*** as long as the dlopening application is linked with the -dlopen flag."
1917 if test -z "$global_symbol_pipe"; then
1918 echo
1919 echo "*** However, this would only work if libtool was able to extract symbol"
1920 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1921 echo "*** not find such a program. So, this module is probably useless."
1922 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1924 if test "$build_old_libs" = no; then
1925 build_libtool_libs=module
1926 build_old_libs=yes
1927 else
1928 build_libtool_libs=no
1931 else
1932 convenience="$convenience $dir/$old_library"
1933 old_convenience="$old_convenience $dir/$old_library"
1934 deplibs="$dir/$old_library $deplibs"
1935 link_static=yes
1937 fi # link shared/static library?
1939 if test $linkmode = lib; then
1940 if test -n "$dependency_libs" &&
1941 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1942 test $link_static = yes; }; then
1943 # Extract -R from dependency_libs
1944 temp_deplibs=
1945 for libdir in $dependency_libs; do
1946 case $libdir in
1947 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1948 case " $xrpath " in
1949 *" $temp_xrpath "*) ;;
1950 *) xrpath="$xrpath $temp_xrpath";;
1951 esac;;
1952 *) temp_deplibs="$temp_deplibs $libdir";;
1953 esac
1954 done
1955 dependency_libs="$temp_deplibs"
1958 newlib_search_path="$newlib_search_path $absdir"
1959 # Link against this library
1960 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1961 # ... and its dependency_libs
1962 tmp_libs=
1963 for deplib in $dependency_libs; do
1964 newdependency_libs="$deplib $newdependency_libs"
1965 case "$tmp_libs " in
1966 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1967 esac
1968 tmp_libs="$tmp_libs $deplib"
1969 done
1971 if test $link_all_deplibs != no; then
1972 # Add the search paths of all dependency libraries
1973 for deplib in $dependency_libs; do
1974 case $deplib in
1975 -L*) path="$deplib" ;;
1976 *.la)
1977 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
1978 test "X$dir" = "X$deplib" && dir="."
1979 # We need an absolute path.
1980 case $dir in
1981 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1983 absdir=`cd "$dir" && pwd`
1984 if test -z "$absdir"; then
1985 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1986 absdir="$dir"
1989 esac
1990 if grep "^installed=no" $deplib > /dev/null; then
1991 path="-L$absdir/$objdir"
1992 else
1993 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
1994 if test -z "$libdir"; then
1995 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
1996 exit 1
1998 if test "$absdir" != "$libdir"; then
1999 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2001 path="-L$absdir"
2004 *) continue ;;
2005 esac
2006 case " $deplibs " in
2007 *" $path "*) ;;
2008 *) deplibs="$deplibs $path" ;;
2009 esac
2010 done
2011 fi # link_all_deplibs != no
2012 fi # linkmode = lib
2013 done # for deplib in $libs
2014 if test $pass = dlpreopen; then
2015 # Link the dlpreopened libraries before other libraries
2016 for deplib in $save_deplibs; do
2017 deplibs="$deplib $deplibs"
2018 done
2020 if test $pass != dlopen; then
2021 test $pass != scan && dependency_libs="$newdependency_libs"
2022 if test $pass != conv; then
2023 # Make sure lib_search_path contains only unique directories.
2024 lib_search_path=
2025 for dir in $newlib_search_path; do
2026 case "$lib_search_path " in
2027 *" $dir "*) ;;
2028 *) lib_search_path="$lib_search_path $dir" ;;
2029 esac
2030 done
2031 newlib_search_path=
2034 if test "$linkmode,$pass" != "prog,link"; then
2035 vars="deplibs"
2036 else
2037 vars="compile_deplibs finalize_deplibs"
2039 for var in $vars dependency_libs; do
2040 # Add libraries to $var in reverse order
2041 eval tmp_libs=\"\$$var\"
2042 new_libs=
2043 for deplib in $tmp_libs; do
2044 case $deplib in
2045 -L*) new_libs="$deplib $new_libs" ;;
2047 case " $specialdeplibs " in
2048 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2050 case " $new_libs " in
2051 *" $deplib "*) ;;
2052 *) new_libs="$deplib $new_libs" ;;
2053 esac
2055 esac
2057 esac
2058 done
2059 tmp_libs=
2060 for deplib in $new_libs; do
2061 case $deplib in
2062 -L*)
2063 case " $tmp_libs " in
2064 *" $deplib "*) ;;
2065 *) tmp_libs="$tmp_libs $deplib" ;;
2066 esac
2068 *) tmp_libs="$tmp_libs $deplib" ;;
2069 esac
2070 done
2071 eval $var=\"$tmp_libs\"
2072 done # for var
2074 if test "$pass" = "conv" &&
2075 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2076 libs="$deplibs" # reset libs
2077 deplibs=
2079 done # for pass
2080 if test $linkmode = prog; then
2081 dlfiles="$newdlfiles"
2082 dlprefiles="$newdlprefiles"
2085 case $linkmode in
2086 oldlib)
2087 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2088 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2091 if test -n "$rpath"; then
2092 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2095 if test -n "$xrpath"; then
2096 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2099 if test -n "$vinfo"; then
2100 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2103 if test -n "$release"; then
2104 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2107 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2108 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2111 # Now set the variables for building old libraries.
2112 build_libtool_libs=no
2113 oldlibs="$output"
2114 objs="$objs$old_deplibs"
2117 lib)
2118 # Make sure we only generate libraries of the form `libNAME.la'.
2119 case $outputname in
2120 lib*)
2121 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2122 eval libname=\"$libname_spec\"
2125 if test "$module" = no; then
2126 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2127 $echo "$help" 1>&2
2128 exit 1
2130 if test "$need_lib_prefix" != no; then
2131 # Add the "lib" prefix for modules if required
2132 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2133 eval libname=\"$libname_spec\"
2134 else
2135 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2138 esac
2140 if test -n "$objs"; then
2141 if test "$deplibs_check_method" != pass_all; then
2142 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2143 exit 1
2144 else
2145 echo
2146 echo "*** Warning: Linking the shared library $output against the non-libtool"
2147 echo "*** objects $objs is not portable!"
2148 libobjs="$libobjs $objs"
2152 if test "$dlself" != no; then
2153 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2156 set dummy $rpath
2157 if test $# -gt 2; then
2158 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2160 install_libdir="$2"
2162 oldlibs=
2163 if test -z "$rpath"; then
2164 if test "$build_libtool_libs" = yes; then
2165 # Building a libtool convenience library.
2166 libext=al
2167 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2168 build_libtool_libs=convenience
2169 build_old_libs=yes
2172 if test -n "$vinfo"; then
2173 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2176 if test -n "$release"; then
2177 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2179 else
2181 # Parse the version information argument.
2182 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2183 set dummy $vinfo 0 0 0
2184 IFS="$save_ifs"
2186 if test -n "$8"; then
2187 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2188 $echo "$help" 1>&2
2189 exit 1
2192 current="$2"
2193 revision="$3"
2194 age="$4"
2196 # Check that each of the things are valid numbers.
2197 case $current in
2198 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2200 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2201 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2202 exit 1
2204 esac
2206 case $revision in
2207 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2209 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2210 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2211 exit 1
2213 esac
2215 case $age in
2216 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2218 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2219 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2220 exit 1
2222 esac
2224 if test $age -gt $current; then
2225 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2226 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2227 exit 1
2230 # Calculate the version variables.
2231 major=
2232 versuffix=
2233 verstring=
2234 case $version_type in
2235 none) ;;
2237 darwin)
2238 # Like Linux, but with the current version available in
2239 # verstring for coding it into the library header
2240 major=.`expr $current - $age`
2241 versuffix="$major.$age.$revision"
2242 # Darwin ld doesn't like 0 for these options...
2243 minor_current=`expr $current + 1`
2244 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2247 freebsd-aout)
2248 major=".$current"
2249 versuffix=".$current.$revision";
2252 freebsd-elf)
2253 major=".$current"
2254 versuffix=".$current";
2257 irix)
2258 major=`expr $current - $age + 1`
2259 verstring="sgi$major.$revision"
2261 # Add in all the interfaces that we are compatible with.
2262 loop=$revision
2263 while test $loop != 0; do
2264 iface=`expr $revision - $loop`
2265 loop=`expr $loop - 1`
2266 verstring="sgi$major.$iface:$verstring"
2267 done
2269 # Before this point, $major must not contain `.'.
2270 major=.$major
2271 versuffix="$major.$revision"
2274 linux)
2275 major=.`expr $current - $age`
2276 versuffix="$major.$age.$revision"
2279 osf)
2280 major=`expr $current - $age`
2281 versuffix=".$current.$age.$revision"
2282 verstring="$current.$age.$revision"
2284 # Add in all the interfaces that we are compatible with.
2285 loop=$age
2286 while test $loop != 0; do
2287 iface=`expr $current - $loop`
2288 loop=`expr $loop - 1`
2289 verstring="$verstring:${iface}.0"
2290 done
2292 # Make executables depend on our current version.
2293 verstring="$verstring:${current}.0"
2296 sunos)
2297 major=".$current"
2298 versuffix=".$current.$revision"
2301 windows)
2302 # Use '-' rather than '.', since we only want one
2303 # extension on DOS 8.3 filesystems.
2304 major=`expr $current - $age`
2305 versuffix="-$major"
2309 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2310 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2311 exit 1
2313 esac
2315 # Clear the version info if we defaulted, and they specified a release.
2316 if test -z "$vinfo" && test -n "$release"; then
2317 major=
2318 verstring="0.0"
2319 if test "$need_version" = no; then
2320 versuffix=
2321 else
2322 versuffix=".0.0"
2326 # Remove version info from name if versioning should be avoided
2327 if test "$avoid_version" = yes && test "$need_version" = no; then
2328 major=
2329 versuffix=
2330 verstring=""
2333 # Check to see if the archive will have undefined symbols.
2334 if test "$allow_undefined" = yes; then
2335 if test "$allow_undefined_flag" = unsupported; then
2336 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2337 build_libtool_libs=no
2338 build_old_libs=yes
2340 else
2341 # Don't allow undefined symbols.
2342 allow_undefined_flag="$no_undefined_flag"
2346 if test "$mode" != relink; then
2347 # Remove our outputs.
2348 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2349 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2352 # Now set the variables for building old libraries.
2353 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2354 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2356 # Transform .lo files to .o files.
2357 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2360 # Eliminate all temporary directories.
2361 for path in $notinst_path; do
2362 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2363 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2364 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2365 done
2367 if test -n "$xrpath"; then
2368 # If the user specified any rpath flags, then add them.
2369 temp_xrpath=
2370 for libdir in $xrpath; do
2371 temp_xrpath="$temp_xrpath -R$libdir"
2372 case "$finalize_rpath " in
2373 *" $libdir "*) ;;
2374 *) finalize_rpath="$finalize_rpath $libdir" ;;
2375 esac
2376 done
2377 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2378 dependency_libs="$temp_xrpath $dependency_libs"
2382 # Make sure dlfiles contains only unique files that won't be dlpreopened
2383 old_dlfiles="$dlfiles"
2384 dlfiles=
2385 for lib in $old_dlfiles; do
2386 case " $dlprefiles $dlfiles " in
2387 *" $lib "*) ;;
2388 *) dlfiles="$dlfiles $lib" ;;
2389 esac
2390 done
2392 # Make sure dlprefiles contains only unique files
2393 old_dlprefiles="$dlprefiles"
2394 dlprefiles=
2395 for lib in $old_dlprefiles; do
2396 case "$dlprefiles " in
2397 *" $lib "*) ;;
2398 *) dlprefiles="$dlprefiles $lib" ;;
2399 esac
2400 done
2402 if test "$build_libtool_libs" = yes; then
2403 if test -n "$rpath"; then
2404 case $host in
2405 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2406 # these systems don't actually have a c library (as such)!
2408 *-*-rhapsody* | *-*-darwin1.[012])
2409 # Rhapsody C library is in the System framework
2410 deplibs="$deplibs -framework System"
2412 *-*-netbsd*)
2413 # Don't link with libc until the a.out ld.so is fixed.
2416 # Add libc to deplibs on all other systems if necessary.
2417 if test $build_libtool_need_lc = "yes"; then
2418 deplibs="$deplibs -lc"
2421 esac
2424 # Transform deplibs into only deplibs that can be linked in shared.
2425 name_save=$name
2426 libname_save=$libname
2427 release_save=$release
2428 versuffix_save=$versuffix
2429 major_save=$major
2430 # I'm not sure if I'm treating the release correctly. I think
2431 # release should show up in the -l (ie -lgmp5) so we don't want to
2432 # add it in twice. Is that correct?
2433 release=""
2434 versuffix=""
2435 major=""
2436 newdeplibs=
2437 droppeddeps=no
2438 case $deplibs_check_method in
2439 pass_all)
2440 # Don't check for shared/static. Everything works.
2441 # This might be a little naive. We might want to check
2442 # whether the library exists or not. But this is on
2443 # osf3 & osf4 and I'm not really sure... Just
2444 # implementing what was already the behaviour.
2445 newdeplibs=$deplibs
2447 test_compile)
2448 # This code stresses the "libraries are programs" paradigm to its
2449 # limits. Maybe even breaks it. We compile a program, linking it
2450 # against the deplibs as a proxy for the library. Then we can check
2451 # whether they linked in statically or dynamically with ldd.
2452 $rm conftest.c
2453 cat > conftest.c <<EOF
2454 int main() { return 0; }
2456 $rm conftest
2457 $CC -o conftest conftest.c $deplibs
2458 if test $? -eq 0 ; then
2459 ldd_output=`ldd conftest`
2460 for i in $deplibs; do
2461 name="`expr $i : '-l\(.*\)'`"
2462 # If $name is empty we are operating on a -L argument.
2463 if test -n "$name" && test "$name" != "0"; then
2464 libname=`eval \\$echo \"$libname_spec\"`
2465 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2466 set dummy $deplib_matches
2467 deplib_match=$2
2468 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2469 newdeplibs="$newdeplibs $i"
2470 else
2471 droppeddeps=yes
2472 echo
2473 echo "*** Warning: This library needs some functionality provided by $i."
2474 echo "*** I have the capability to make that library automatically link in when"
2475 echo "*** you link to this library. But I can only do this if you have a"
2476 echo "*** shared version of the library, which you do not appear to have."
2478 else
2479 newdeplibs="$newdeplibs $i"
2481 done
2482 else
2483 # Error occured in the first compile. Let's try to salvage the situation:
2484 # Compile a seperate program for each library.
2485 for i in $deplibs; do
2486 name="`expr $i : '-l\(.*\)'`"
2487 # If $name is empty we are operating on a -L argument.
2488 if test -n "$name" && test "$name" != "0"; then
2489 $rm conftest
2490 $CC -o conftest conftest.c $i
2491 # Did it work?
2492 if test $? -eq 0 ; then
2493 ldd_output=`ldd conftest`
2494 libname=`eval \\$echo \"$libname_spec\"`
2495 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2496 set dummy $deplib_matches
2497 deplib_match=$2
2498 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2499 newdeplibs="$newdeplibs $i"
2500 else
2501 droppeddeps=yes
2502 echo
2503 echo "*** Warning: This library needs some functionality provided by $i."
2504 echo "*** I have the capability to make that library automatically link in when"
2505 echo "*** you link to this library. But I can only do this if you have a"
2506 echo "*** shared version of the library, which you do not appear to have."
2508 else
2509 droppeddeps=yes
2510 echo
2511 echo "*** Warning! Library $i is needed by this library but I was not able to"
2512 echo "*** make it link in! You will probably need to install it or some"
2513 echo "*** library that it depends on before this library will be fully"
2514 echo "*** functional. Installing it before continuing would be even better."
2516 else
2517 newdeplibs="$newdeplibs $i"
2519 done
2522 file_magic*)
2523 set dummy $deplibs_check_method
2524 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2525 for a_deplib in $deplibs; do
2526 name="`expr $a_deplib : '-l\(.*\)'`"
2527 # If $name is empty we are operating on a -L argument.
2528 if test -n "$name" && test "$name" != "0"; then
2529 libname=`eval \\$echo \"$libname_spec\"`
2530 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2531 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2532 for potent_lib in $potential_libs; do
2533 # Follow soft links.
2534 if ls -lLd "$potent_lib" 2>/dev/null \
2535 | grep " -> " >/dev/null; then
2536 continue
2538 # The statement above tries to avoid entering an
2539 # endless loop below, in case of cyclic links.
2540 # We might still enter an endless loop, since a link
2541 # loop can be closed while we follow links,
2542 # but so what?
2543 potlib="$potent_lib"
2544 while test -h "$potlib" 2>/dev/null; do
2545 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2546 case $potliblink in
2547 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2548 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2549 esac
2550 done
2551 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2552 | sed 10q \
2553 | egrep "$file_magic_regex" > /dev/null; then
2554 newdeplibs="$newdeplibs $a_deplib"
2555 a_deplib=""
2556 break 2
2558 done
2559 done
2560 if test -n "$a_deplib" ; then
2561 droppeddeps=yes
2562 echo
2563 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2564 echo "*** I have the capability to make that library automatically link in when"
2565 echo "*** you link to this library. But I can only do this if you have a"
2566 echo "*** shared version of the library, which you do not appear to have."
2568 else
2569 # Add a -L argument.
2570 newdeplibs="$newdeplibs $a_deplib"
2572 done # Gone through all deplibs.
2574 match_pattern*)
2575 set dummy $deplibs_check_method
2576 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2577 for a_deplib in $deplibs; do
2578 name="`expr $a_deplib : '-l\(.*\)'`"
2579 # If $name is empty we are operating on a -L argument.
2580 if test -n "$name" && test "$name" != "0"; then
2581 libname=`eval \\$echo \"$libname_spec\"`
2582 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2583 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2584 for potent_lib in $potential_libs; do
2585 if eval echo \"$potent_lib\" 2>/dev/null \
2586 | sed 10q \
2587 | egrep "$match_pattern_regex" > /dev/null; then
2588 newdeplibs="$newdeplibs $a_deplib"
2589 a_deplib=""
2590 break 2
2592 done
2593 done
2594 if test -n "$a_deplib" ; then
2595 droppeddeps=yes
2596 echo
2597 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2598 echo "*** I have the capability to make that library automatically link in when"
2599 echo "*** you link to this library. But I can only do this if you have a"
2600 echo "*** shared version of the library, which you do not appear to have."
2602 else
2603 # Add a -L argument.
2604 newdeplibs="$newdeplibs $a_deplib"
2606 done # Gone through all deplibs.
2608 none | unknown | *)
2609 newdeplibs=""
2610 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2611 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2612 grep . >/dev/null; then
2613 echo
2614 if test "X$deplibs_check_method" = "Xnone"; then
2615 echo "*** Warning: inter-library dependencies are not supported in this platform."
2616 else
2617 echo "*** Warning: inter-library dependencies are not known to be supported."
2619 echo "*** All declared inter-library dependencies are being dropped."
2620 droppeddeps=yes
2623 esac
2624 versuffix=$versuffix_save
2625 major=$major_save
2626 release=$release_save
2627 libname=$libname_save
2628 name=$name_save
2630 case $host in
2631 *-*-rhapsody* | *-*-darwin1.[012])
2632 # On Rhapsody replace the C library is the System framework
2633 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2635 esac
2637 if test "$droppeddeps" = yes; then
2638 if test "$module" = yes; then
2639 echo
2640 echo "*** Warning: libtool could not satisfy all declared inter-library"
2641 echo "*** dependencies of module $libname. Therefore, libtool will create"
2642 echo "*** a static module, that should work as long as the dlopening"
2643 echo "*** application is linked with the -dlopen flag."
2644 if test -z "$global_symbol_pipe"; then
2645 echo
2646 echo "*** However, this would only work if libtool was able to extract symbol"
2647 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2648 echo "*** not find such a program. So, this module is probably useless."
2649 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2651 if test "$build_old_libs" = no; then
2652 oldlibs="$output_objdir/$libname.$libext"
2653 build_libtool_libs=module
2654 build_old_libs=yes
2655 else
2656 build_libtool_libs=no
2658 else
2659 echo "*** The inter-library dependencies that have been dropped here will be"
2660 echo "*** automatically added whenever a program is linked with this library"
2661 echo "*** or is declared to -dlopen it."
2663 if test $allow_undefined = no; then
2664 echo
2665 echo "*** Since this library must not contain undefined symbols,"
2666 echo "*** because either the platform does not support them or"
2667 echo "*** it was explicitly requested with -no-undefined,"
2668 echo "*** libtool will only create a static version of it."
2669 if test "$build_old_libs" = no; then
2670 oldlibs="$output_objdir/$libname.$libext"
2671 build_libtool_libs=module
2672 build_old_libs=yes
2673 else
2674 build_libtool_libs=no
2679 # Done checking deplibs!
2680 deplibs=$newdeplibs
2683 # All the library-specific variables (install_libdir is set above).
2684 library_names=
2685 old_library=
2686 dlname=
2688 # Test again, we may have decided not to build it any more
2689 if test "$build_libtool_libs" = yes; then
2690 if test $hardcode_into_libs = yes; then
2691 # Hardcode the library paths
2692 hardcode_libdirs=
2693 dep_rpath=
2694 rpath="$finalize_rpath"
2695 test "$mode" != relink && rpath="$compile_rpath$rpath"
2696 for libdir in $rpath; do
2697 if test -n "$hardcode_libdir_flag_spec"; then
2698 if test -n "$hardcode_libdir_separator"; then
2699 if test -z "$hardcode_libdirs"; then
2700 hardcode_libdirs="$libdir"
2701 else
2702 # Just accumulate the unique libdirs.
2703 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2704 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2707 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2709 esac
2711 else
2712 eval flag=\"$hardcode_libdir_flag_spec\"
2713 dep_rpath="$dep_rpath $flag"
2715 elif test -n "$runpath_var"; then
2716 case "$perm_rpath " in
2717 *" $libdir "*) ;;
2718 *) perm_rpath="$perm_rpath $libdir" ;;
2719 esac
2721 done
2722 # Substitute the hardcoded libdirs into the rpath.
2723 if test -n "$hardcode_libdir_separator" &&
2724 test -n "$hardcode_libdirs"; then
2725 libdir="$hardcode_libdirs"
2726 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2728 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2729 # We should set the runpath_var.
2730 rpath=
2731 for dir in $perm_rpath; do
2732 rpath="$rpath$dir:"
2733 done
2734 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2736 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2739 shlibpath="$finalize_shlibpath"
2740 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2741 if test -n "$shlibpath"; then
2742 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2745 # Get the real and link names of the library.
2746 eval library_names=\"$library_names_spec\"
2747 set dummy $library_names
2748 realname="$2"
2749 shift; shift
2751 if test -n "$soname_spec"; then
2752 eval soname=\"$soname_spec\"
2753 else
2754 soname="$realname"
2756 test -z "$dlname" && dlname=$soname
2758 lib="$output_objdir/$realname"
2759 for link
2761 linknames="$linknames $link"
2762 done
2764 # Ensure that we have .o objects for linkers which dislike .lo
2765 # (e.g. aix) in case we are running --disable-static
2766 for obj in $libobjs; do
2767 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2768 if test "X$xdir" = "X$obj"; then
2769 xdir="."
2770 else
2771 xdir="$xdir"
2773 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2774 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2775 if test ! -f $xdir/$oldobj; then
2776 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2777 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2779 done
2781 # Use standard objects if they are pic
2782 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2784 # Prepare the list of exported symbols
2785 if test -z "$export_symbols"; then
2786 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2787 $show "generating symbol list for \`$libname.la'"
2788 export_symbols="$output_objdir/$libname.exp"
2789 $run $rm $export_symbols
2790 eval cmds=\"$export_symbols_cmds\"
2791 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2792 for cmd in $cmds; do
2793 IFS="$save_ifs"
2794 $show "$cmd"
2795 $run eval "$cmd" || exit $?
2796 done
2797 IFS="$save_ifs"
2798 if test -n "$export_symbols_regex"; then
2799 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2800 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2801 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2802 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2807 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2808 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2811 if test -n "$convenience"; then
2812 if test -n "$whole_archive_flag_spec"; then
2813 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2814 else
2815 gentop="$output_objdir/${outputname}x"
2816 $show "${rm}r $gentop"
2817 $run ${rm}r "$gentop"
2818 $show "mkdir $gentop"
2819 $run mkdir "$gentop"
2820 status=$?
2821 if test $status -ne 0 && test ! -d "$gentop"; then
2822 exit $status
2824 generated="$generated $gentop"
2826 for xlib in $convenience; do
2827 # Extract the objects.
2828 case $xlib in
2829 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2830 *) xabs=`pwd`"/$xlib" ;;
2831 esac
2832 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2833 xdir="$gentop/$xlib"
2835 $show "${rm}r $xdir"
2836 $run ${rm}r "$xdir"
2837 $show "mkdir $xdir"
2838 $run mkdir "$xdir"
2839 status=$?
2840 if test $status -ne 0 && test ! -d "$xdir"; then
2841 exit $status
2843 $show "(cd $xdir && $AR x $xabs)"
2844 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2846 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2847 done
2851 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2852 eval flag=\"$thread_safe_flag_spec\"
2853 linker_flags="$linker_flags $flag"
2856 # Make a backup of the uninstalled library when relinking
2857 if test "$mode" = relink; then
2858 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2861 # Do each of the archive commands.
2862 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2863 eval cmds=\"$archive_expsym_cmds\"
2864 else
2865 eval cmds=\"$archive_cmds\"
2867 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2868 for cmd in $cmds; do
2869 IFS="$save_ifs"
2870 $show "$cmd"
2871 $run eval "$cmd" || exit $?
2872 done
2873 IFS="$save_ifs"
2875 # Restore the uninstalled library and exit
2876 if test "$mode" = relink; then
2877 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2878 exit 0
2881 # Create links to the real library.
2882 for linkname in $linknames; do
2883 if test "$realname" != "$linkname"; then
2884 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2885 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2887 done
2889 # If -module or -export-dynamic was specified, set the dlname.
2890 if test "$module" = yes || test "$export_dynamic" = yes; then
2891 # On all known operating systems, these are identical.
2892 dlname="$soname"
2897 obj)
2898 if test -n "$deplibs"; then
2899 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2902 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2903 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2906 if test -n "$rpath"; then
2907 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2910 if test -n "$xrpath"; then
2911 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2914 if test -n "$vinfo"; then
2915 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2918 if test -n "$release"; then
2919 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2922 case $output in
2923 *.lo)
2924 if test -n "$objs$old_deplibs"; then
2925 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2926 exit 1
2928 libobj="$output"
2929 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2932 libobj=
2933 obj="$output"
2935 esac
2937 # Delete the old objects.
2938 $run $rm $obj $libobj
2940 # Objects from convenience libraries. This assumes
2941 # single-version convenience libraries. Whenever we create
2942 # different ones for PIC/non-PIC, this we'll have to duplicate
2943 # the extraction.
2944 reload_conv_objs=
2945 gentop=
2946 # reload_cmds runs $LD directly, so let us get rid of
2947 # -Wl from whole_archive_flag_spec
2950 if test -n "$convenience"; then
2951 if test -n "$whole_archive_flag_spec"; then
2952 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2953 else
2954 gentop="$output_objdir/${obj}x"
2955 $show "${rm}r $gentop"
2956 $run ${rm}r "$gentop"
2957 $show "mkdir $gentop"
2958 $run mkdir "$gentop"
2959 status=$?
2960 if test $status -ne 0 && test ! -d "$gentop"; then
2961 exit $status
2963 generated="$generated $gentop"
2965 for xlib in $convenience; do
2966 # Extract the objects.
2967 case $xlib in
2968 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2969 *) xabs=`pwd`"/$xlib" ;;
2970 esac
2971 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2972 xdir="$gentop/$xlib"
2974 $show "${rm}r $xdir"
2975 $run ${rm}r "$xdir"
2976 $show "mkdir $xdir"
2977 $run mkdir "$xdir"
2978 status=$?
2979 if test $status -ne 0 && test ! -d "$xdir"; then
2980 exit $status
2982 $show "(cd $xdir && $AR x $xabs)"
2983 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2985 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2986 done
2990 # Create the old-style object.
2991 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
2993 output="$obj"
2994 eval cmds=\"$reload_cmds\"
2995 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2996 for cmd in $cmds; do
2997 IFS="$save_ifs"
2998 $show "$cmd"
2999 $run eval "$cmd" || exit $?
3000 done
3001 IFS="$save_ifs"
3003 # Exit if we aren't doing a library object file.
3004 if test -z "$libobj"; then
3005 if test -n "$gentop"; then
3006 $show "${rm}r $gentop"
3007 $run ${rm}r $gentop
3010 exit 0
3013 if test "$build_libtool_libs" != yes; then
3014 if test -n "$gentop"; then
3015 $show "${rm}r $gentop"
3016 $run ${rm}r $gentop
3019 # Create an invalid libtool object if no PIC, so that we don't
3020 # accidentally link it into a program.
3021 $show "echo timestamp > $libobj"
3022 $run eval "echo timestamp > $libobj" || exit $?
3023 exit 0
3026 if test -n "$pic_flag" || test "$pic_mode" != default; then
3027 # Only do commands if we really have different PIC objects.
3028 reload_objs="$libobjs $reload_conv_objs"
3029 output="$libobj"
3030 eval cmds=\"$reload_cmds\"
3031 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3032 for cmd in $cmds; do
3033 IFS="$save_ifs"
3034 $show "$cmd"
3035 $run eval "$cmd" || exit $?
3036 done
3037 IFS="$save_ifs"
3038 else
3039 # Just create a symlink.
3040 $show $rm $libobj
3041 $run $rm $libobj
3042 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3043 if test "X$xdir" = "X$libobj"; then
3044 xdir="."
3045 else
3046 xdir="$xdir"
3048 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3049 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3050 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3051 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3054 if test -n "$gentop"; then
3055 $show "${rm}r $gentop"
3056 $run ${rm}r $gentop
3059 exit 0
3062 prog)
3063 case $host in
3064 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3065 esac
3066 if test -n "$vinfo"; then
3067 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3070 if test -n "$release"; then
3071 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3074 if test "$preload" = yes; then
3075 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3076 test "$dlopen_self_static" = unknown; then
3077 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3081 case $host in
3082 *-*-rhapsody* | *-*-darwin1.[012])
3083 # On Rhapsody replace the C library is the System framework
3084 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3085 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3087 esac
3089 compile_command="$compile_command $compile_deplibs"
3090 finalize_command="$finalize_command $finalize_deplibs"
3092 if test -n "$rpath$xrpath"; then
3093 # If the user specified any rpath flags, then add them.
3094 for libdir in $rpath $xrpath; do
3095 # This is the magic to use -rpath.
3096 case "$finalize_rpath " in
3097 *" $libdir "*) ;;
3098 *) finalize_rpath="$finalize_rpath $libdir" ;;
3099 esac
3100 done
3103 # Now hardcode the library paths
3104 rpath=
3105 hardcode_libdirs=
3106 for libdir in $compile_rpath $finalize_rpath; do
3107 if test -n "$hardcode_libdir_flag_spec"; then
3108 if test -n "$hardcode_libdir_separator"; then
3109 if test -z "$hardcode_libdirs"; then
3110 hardcode_libdirs="$libdir"
3111 else
3112 # Just accumulate the unique libdirs.
3113 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3114 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3117 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3119 esac
3121 else
3122 eval flag=\"$hardcode_libdir_flag_spec\"
3123 rpath="$rpath $flag"
3125 elif test -n "$runpath_var"; then
3126 case "$perm_rpath " in
3127 *" $libdir "*) ;;
3128 *) perm_rpath="$perm_rpath $libdir" ;;
3129 esac
3131 case $host in
3132 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3133 case :$dllsearchpath: in
3134 *":$libdir:"*) ;;
3135 *) dllsearchpath="$dllsearchpath:$libdir";;
3136 esac
3138 esac
3139 done
3140 # Substitute the hardcoded libdirs into the rpath.
3141 if test -n "$hardcode_libdir_separator" &&
3142 test -n "$hardcode_libdirs"; then
3143 libdir="$hardcode_libdirs"
3144 eval rpath=\" $hardcode_libdir_flag_spec\"
3146 compile_rpath="$rpath"
3148 rpath=
3149 hardcode_libdirs=
3150 for libdir in $finalize_rpath; do
3151 if test -n "$hardcode_libdir_flag_spec"; then
3152 if test -n "$hardcode_libdir_separator"; then
3153 if test -z "$hardcode_libdirs"; then
3154 hardcode_libdirs="$libdir"
3155 else
3156 # Just accumulate the unique libdirs.
3157 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3158 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3161 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3163 esac
3165 else
3166 eval flag=\"$hardcode_libdir_flag_spec\"
3167 rpath="$rpath $flag"
3169 elif test -n "$runpath_var"; then
3170 case "$finalize_perm_rpath " in
3171 *" $libdir "*) ;;
3172 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3173 esac
3175 done
3176 # Substitute the hardcoded libdirs into the rpath.
3177 if test -n "$hardcode_libdir_separator" &&
3178 test -n "$hardcode_libdirs"; then
3179 libdir="$hardcode_libdirs"
3180 eval rpath=\" $hardcode_libdir_flag_spec\"
3182 finalize_rpath="$rpath"
3184 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3185 # Transform all the library objects into standard objects.
3186 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3187 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3190 dlsyms=
3191 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3192 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3193 dlsyms="${outputname}S.c"
3194 else
3195 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3199 if test -n "$dlsyms"; then
3200 case $dlsyms in
3201 "") ;;
3202 *.c)
3203 # Discover the nlist of each of the dlfiles.
3204 nlist="$output_objdir/${outputname}.nm"
3206 $show "$rm $nlist ${nlist}S ${nlist}T"
3207 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3209 # Parse the name list into a source file.
3210 $show "creating $output_objdir/$dlsyms"
3212 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3213 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3214 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3216 #ifdef __cplusplus
3217 extern \"C\" {
3218 #endif
3220 /* Prevent the only kind of declaration conflicts we can make. */
3221 #define lt_preloaded_symbols some_other_symbol
3223 /* External symbol declarations for the compiler. */\
3226 if test "$dlself" = yes; then
3227 $show "generating symbol list for \`$output'"
3229 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3231 # Add our own program objects to the symbol list.
3232 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3233 for arg in $progfiles; do
3234 $show "extracting global C symbols from \`$arg'"
3235 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3236 done
3238 if test -n "$exclude_expsyms"; then
3239 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3240 $run eval '$mv "$nlist"T "$nlist"'
3243 if test -n "$export_symbols_regex"; then
3244 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3245 $run eval '$mv "$nlist"T "$nlist"'
3248 # Prepare the list of exported symbols
3249 if test -z "$export_symbols"; then
3250 export_symbols="$output_objdir/$output.exp"
3251 $run $rm $export_symbols
3252 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3253 else
3254 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3255 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3256 $run eval 'mv "$nlist"T "$nlist"'
3260 for arg in $dlprefiles; do
3261 $show "extracting global C symbols from \`$arg'"
3262 name=`echo "$arg" | sed -e 's%^.*/%%'`
3263 $run eval 'echo ": $name " >> "$nlist"'
3264 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3265 done
3267 if test -z "$run"; then
3268 # Make sure we have at least an empty file.
3269 test -f "$nlist" || : > "$nlist"
3271 if test -n "$exclude_expsyms"; then
3272 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3273 $mv "$nlist"T "$nlist"
3276 # Try sorting and uniquifying the output.
3277 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3279 else
3280 grep -v "^: " < "$nlist" > "$nlist"S
3283 if test -f "$nlist"S; then
3284 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3285 else
3286 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3289 $echo >> "$output_objdir/$dlsyms" "\
3291 #undef lt_preloaded_symbols
3293 #if defined (__STDC__) && __STDC__
3294 # define lt_ptr_t void *
3295 #else
3296 # define lt_ptr_t char *
3297 # define const
3298 #endif
3300 /* The mapping between symbol names and symbols. */
3301 const struct {
3302 const char *name;
3303 lt_ptr_t address;
3305 lt_preloaded_symbols[] =
3309 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3310 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3311 < "$nlist" >> "$output_objdir/$dlsyms"
3313 $echo >> "$output_objdir/$dlsyms" "\
3314 {0, (lt_ptr_t) 0}
3317 /* This works around a problem in FreeBSD linker */
3318 #ifdef FREEBSD_WORKAROUND
3319 static const void *lt_preloaded_setup() {
3320 return lt_preloaded_symbols;
3322 #endif
3324 #ifdef __cplusplus
3326 #endif\
3330 pic_flag_for_symtable=
3331 case $host in
3332 # compiling the symbol table file with pic_flag works around
3333 # a FreeBSD bug that causes programs to crash when -lm is
3334 # linked before any other PIC object. But we must not use
3335 # pic_flag when linking with -static. The problem exists in
3336 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3337 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3338 case "$compile_command " in
3339 *" -static "*) ;;
3340 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3341 esac;;
3342 *-*-hpux*)
3343 case "$compile_command " in
3344 *" -static "*) ;;
3345 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3346 esac
3347 esac
3349 # Now compile the dynamic symbol file.
3350 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3351 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3353 # Clean up the generated files.
3354 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3355 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3357 # Transform the symbol file into the correct name.
3358 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3359 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3362 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3363 exit 1
3365 esac
3366 else
3367 # We keep going just in case the user didn't refer to
3368 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3369 # really was required.
3371 # Nullify the symbol file.
3372 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3373 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3376 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3377 # Replace the output file specification.
3378 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3379 link_command="$compile_command$compile_rpath"
3381 # We have no uninstalled library dependencies, so finalize right now.
3382 $show "$link_command"
3383 $run eval "$link_command"
3384 status=$?
3386 # Delete the generated files.
3387 if test -n "$dlsyms"; then
3388 $show "$rm $output_objdir/${outputname}S.${objext}"
3389 $run $rm "$output_objdir/${outputname}S.${objext}"
3392 exit $status
3395 if test -n "$shlibpath_var"; then
3396 # We should set the shlibpath_var
3397 rpath=
3398 for dir in $temp_rpath; do
3399 case $dir in
3400 [\\/]* | [A-Za-z]:[\\/]*)
3401 # Absolute path.
3402 rpath="$rpath$dir:"
3405 # Relative path: add a thisdir entry.
3406 rpath="$rpath\$thisdir/$dir:"
3408 esac
3409 done
3410 temp_rpath="$rpath"
3413 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3414 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3416 if test -n "$finalize_shlibpath"; then
3417 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3420 compile_var=
3421 finalize_var=
3422 if test -n "$runpath_var"; then
3423 if test -n "$perm_rpath"; then
3424 # We should set the runpath_var.
3425 rpath=
3426 for dir in $perm_rpath; do
3427 rpath="$rpath$dir:"
3428 done
3429 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3431 if test -n "$finalize_perm_rpath"; then
3432 # We should set the runpath_var.
3433 rpath=
3434 for dir in $finalize_perm_rpath; do
3435 rpath="$rpath$dir:"
3436 done
3437 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3441 if test "$no_install" = yes; then
3442 # We don't need to create a wrapper script.
3443 link_command="$compile_var$compile_command$compile_rpath"
3444 # Replace the output file specification.
3445 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3446 # Delete the old output file.
3447 $run $rm $output
3448 # Link the executable and exit
3449 $show "$link_command"
3450 $run eval "$link_command" || exit $?
3451 exit 0
3454 if test "$hardcode_action" = relink; then
3455 # Fast installation is not supported
3456 link_command="$compile_var$compile_command$compile_rpath"
3457 relink_command="$finalize_var$finalize_command$finalize_rpath"
3459 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3460 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3461 else
3462 if test "$fast_install" != no; then
3463 link_command="$finalize_var$compile_command$finalize_rpath"
3464 if test "$fast_install" = yes; then
3465 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3466 else
3467 # fast_install is set to needless
3468 relink_command=
3470 else
3471 link_command="$compile_var$compile_command$compile_rpath"
3472 relink_command="$finalize_var$finalize_command$finalize_rpath"
3476 # Replace the output file specification.
3477 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3479 # Delete the old output files.
3480 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3482 $show "$link_command"
3483 $run eval "$link_command" || exit $?
3485 # Now create the wrapper script.
3486 $show "creating $output"
3488 # Quote the relink command for shipping.
3489 if test -n "$relink_command"; then
3490 # Preserve any variables that may affect compiler behavior
3491 for var in $variables_saved_for_relink; do
3492 if eval test -z \"\${$var+set}\"; then
3493 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3494 elif eval var_value=\$$var; test -z "$var_value"; then
3495 relink_command="$var=; export $var; $relink_command"
3496 else
3497 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3498 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3500 done
3501 relink_command="cd `pwd`; $relink_command"
3502 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3505 # Quote $echo for shipping.
3506 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3507 case $0 in
3508 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3509 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3510 esac
3511 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3512 else
3513 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3516 # Only actually do things if our run command is non-null.
3517 if test -z "$run"; then
3518 # win32 will think the script is a binary if it has
3519 # a .exe suffix, so we strip it off here.
3520 case $output in
3521 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3522 esac
3523 # test for cygwin because mv fails w/o .exe extensions
3524 case $host in
3525 *cygwin*) exeext=.exe ;;
3526 *) exeext= ;;
3527 esac
3528 $rm $output
3529 trap "$rm $output; exit 1" 1 2 15
3531 $echo > $output "\
3532 #! $SHELL
3534 # $output - temporary wrapper script for $objdir/$outputname
3535 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3537 # The $output program cannot be directly executed until all the libtool
3538 # libraries that it depends on are installed.
3540 # This wrapper script should never be moved out of the build directory.
3541 # If it is, it will not operate correctly.
3543 # Sed substitution that helps us do robust quoting. It backslashifies
3544 # metacharacters that are still active within double-quoted strings.
3545 Xsed='sed -e 1s/^X//'
3546 sed_quote_subst='$sed_quote_subst'
3548 # The HP-UX ksh and POSIX shell print the target directory to stdout
3549 # if CDPATH is set.
3550 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3552 relink_command=\"$relink_command\"
3554 # This environment variable determines our operation mode.
3555 if test \"\$libtool_install_magic\" = \"$magic\"; then
3556 # install mode needs the following variable:
3557 notinst_deplibs='$notinst_deplibs'
3558 else
3559 # When we are sourced in execute mode, \$file and \$echo are already set.
3560 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3561 echo=\"$qecho\"
3562 file=\"\$0\"
3563 # Make sure echo works.
3564 if test \"X\$1\" = X--no-reexec; then
3565 # Discard the --no-reexec flag, and continue.
3566 shift
3567 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3568 # Yippee, \$echo works!
3570 else
3571 # Restart under the correct shell, and then maybe \$echo will work.
3572 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3576 $echo >> $output "\
3578 # Find the directory that this script lives in.
3579 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3580 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3582 # Follow symbolic links until we get to the real thisdir.
3583 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3584 while test -n \"\$file\"; do
3585 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3587 # If there was a directory component, then change thisdir.
3588 if test \"x\$destdir\" != \"x\$file\"; then
3589 case \"\$destdir\" in
3590 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3591 *) thisdir=\"\$thisdir/\$destdir\" ;;
3592 esac
3595 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3596 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3597 done
3599 # Try to get the absolute directory name.
3600 absdir=\`cd \"\$thisdir\" && pwd\`
3601 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3604 if test "$fast_install" = yes; then
3605 echo >> $output "\
3606 program=lt-'$outputname'$exeext
3607 progdir=\"\$thisdir/$objdir\"
3609 if test ! -f \"\$progdir/\$program\" || \\
3610 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3611 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3613 file=\"\$\$-\$program\"
3615 if test ! -d \"\$progdir\"; then
3616 $mkdir \"\$progdir\"
3617 else
3618 $rm \"\$progdir/\$file\"
3621 echo >> $output "\
3623 # relink executable if necessary
3624 if test -n \"\$relink_command\"; then
3625 if (eval \$relink_command); then :
3626 else
3627 $rm \"\$progdir/\$file\"
3628 exit 1
3632 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3633 { $rm \"\$progdir/\$program\";
3634 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3635 $rm \"\$progdir/\$file\"
3637 else
3638 echo >> $output "\
3639 program='$outputname'
3640 progdir=\"\$thisdir/$objdir\"
3644 echo >> $output "\
3646 if test -f \"\$progdir/\$program\"; then"
3648 # Export our shlibpath_var if we have one.
3649 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3650 $echo >> $output "\
3651 # Add our own library path to $shlibpath_var
3652 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3654 # Some systems cannot cope with colon-terminated $shlibpath_var
3655 # The second colon is a workaround for a bug in BeOS R4 sed
3656 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3658 export $shlibpath_var
3662 # fixup the dll searchpath if we need to.
3663 if test -n "$dllsearchpath"; then
3664 $echo >> $output "\
3665 # Add the dll search path components to the executable PATH
3666 PATH=$dllsearchpath:\$PATH
3670 $echo >> $output "\
3671 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3672 # Run the actual program with our arguments.
3674 case $host in
3675 # win32 systems need to use the prog path for dll
3676 # lookup to work
3677 *-*-cygwin* | *-*-pw32*)
3678 $echo >> $output "\
3679 exec \$progdir/\$program \${1+\"\$@\"}
3683 # Backslashes separate directories on plain windows
3684 *-*-mingw | *-*-os2*)
3685 $echo >> $output "\
3686 exec \$progdir\\\\\$program \${1+\"\$@\"}
3691 $echo >> $output "\
3692 # Export the path to the program.
3693 PATH=\"\$progdir:\$PATH\"
3694 export PATH
3696 exec \$program \${1+\"\$@\"}
3699 esac
3700 $echo >> $output "\
3701 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3702 exit 1
3704 else
3705 # The program doesn't exist.
3706 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3707 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3708 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3709 exit 1
3713 chmod +x $output
3715 exit 0
3717 esac
3719 # See if we need to build an old-fashioned archive.
3720 for oldlib in $oldlibs; do
3722 if test "$build_libtool_libs" = convenience; then
3723 oldobjs="$libobjs_save"
3724 addlibs="$convenience"
3725 build_libtool_libs=no
3726 else
3727 if test "$build_libtool_libs" = module; then
3728 oldobjs="$libobjs_save"
3729 build_libtool_libs=no
3730 else
3731 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3733 addlibs="$old_convenience"
3736 if test -n "$addlibs"; then
3737 gentop="$output_objdir/${outputname}x"
3738 $show "${rm}r $gentop"
3739 $run ${rm}r "$gentop"
3740 $show "mkdir $gentop"
3741 $run mkdir "$gentop"
3742 status=$?
3743 if test $status -ne 0 && test ! -d "$gentop"; then
3744 exit $status
3746 generated="$generated $gentop"
3748 # Add in members from convenience archives.
3749 for xlib in $addlibs; do
3750 # Extract the objects.
3751 case $xlib in
3752 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3753 *) xabs=`pwd`"/$xlib" ;;
3754 esac
3755 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3756 xdir="$gentop/$xlib"
3758 $show "${rm}r $xdir"
3759 $run ${rm}r "$xdir"
3760 $show "mkdir $xdir"
3761 $run mkdir "$xdir"
3762 status=$?
3763 if test $status -ne 0 && test ! -d "$xdir"; then
3764 exit $status
3766 $show "(cd $xdir && $AR x $xabs)"
3767 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3769 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3770 done
3773 # Do each command in the archive commands.
3774 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3775 eval cmds=\"$old_archive_from_new_cmds\"
3776 else
3777 # Ensure that we have .o objects in place in case we decided
3778 # not to build a shared library, and have fallen back to building
3779 # static libs even though --disable-static was passed!
3780 for oldobj in $oldobjs; do
3781 if test ! -f $oldobj; then
3782 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3783 if test "X$xdir" = "X$oldobj"; then
3784 xdir="."
3785 else
3786 xdir="$xdir"
3788 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3789 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3790 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3791 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3793 done
3795 eval cmds=\"$old_archive_cmds\"
3797 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3798 for cmd in $cmds; do
3799 IFS="$save_ifs"
3800 $show "$cmd"
3801 $run eval "$cmd" || exit $?
3802 done
3803 IFS="$save_ifs"
3804 done
3806 if test -n "$generated"; then
3807 $show "${rm}r$generated"
3808 $run ${rm}r$generated
3811 # Now create the libtool archive.
3812 case $output in
3813 *.la)
3814 old_library=
3815 test "$build_old_libs" = yes && old_library="$libname.$libext"
3816 $show "creating $output"
3818 # Preserve any variables that may affect compiler behavior
3819 for var in $variables_saved_for_relink; do
3820 if eval test -z \"\${$var+set}\"; then
3821 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3822 elif eval var_value=\$$var; test -z "$var_value"; then
3823 relink_command="$var=; export $var; $relink_command"
3824 else
3825 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3826 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3828 done
3829 # Quote the link command for shipping.
3830 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3831 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3833 # Only create the output if not a dry run.
3834 if test -z "$run"; then
3835 for installed in no yes; do
3836 if test "$installed" = yes; then
3837 if test -z "$install_libdir"; then
3838 break
3840 output="$output_objdir/$outputname"i
3841 # Replace all uninstalled libtool libraries with the installed ones
3842 newdependency_libs=
3843 for deplib in $dependency_libs; do
3844 case $deplib in
3845 *.la)
3846 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3847 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3848 if test -z "$libdir"; then
3849 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3850 exit 1
3852 newdependency_libs="$newdependency_libs $libdir/$name"
3854 *) newdependency_libs="$newdependency_libs $deplib" ;;
3855 esac
3856 done
3857 dependency_libs="$newdependency_libs"
3858 newdlfiles=
3859 for lib in $dlfiles; do
3860 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3861 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3862 if test -z "$libdir"; then
3863 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3864 exit 1
3866 newdlfiles="$newdlfiles $libdir/$name"
3867 done
3868 dlfiles="$newdlfiles"
3869 newdlprefiles=
3870 for lib in $dlprefiles; do
3871 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3872 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3873 if test -z "$libdir"; then
3874 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3875 exit 1
3877 newdlprefiles="$newdlprefiles $libdir/$name"
3878 done
3879 dlprefiles="$newdlprefiles"
3881 $rm $output
3882 # place dlname in correct position for cygwin
3883 tdlname=$dlname
3884 case $host,$output,$installed,$module,$dlname in
3885 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3886 esac
3887 $echo > $output "\
3888 # $outputname - a libtool library file
3889 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3891 # Please DO NOT delete this file!
3892 # It is necessary for linking the library.
3894 # The name that we can dlopen(3).
3895 dlname='$tdlname'
3897 # Names of this library.
3898 library_names='$library_names'
3900 # The name of the static archive.
3901 old_library='$old_library'
3903 # Libraries that this one depends upon.
3904 dependency_libs='$dependency_libs'
3906 # Version information for $libname.
3907 current=$current
3908 age=$age
3909 revision=$revision
3911 # Is this an already installed library?
3912 installed=$installed
3914 # Files to dlopen/dlpreopen
3915 dlopen='$dlfiles'
3916 dlpreopen='$dlprefiles'
3918 # Directory that this library needs to be installed in:
3919 libdir='$install_libdir'"
3920 if test "$installed" = no && test $need_relink = yes; then
3921 $echo >> $output "\
3922 relink_command=\"$relink_command\""
3924 done
3927 # Do a symbolic link so that the libtool archive can be found in
3928 # LD_LIBRARY_PATH before the program is installed.
3929 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3930 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3932 esac
3933 exit 0
3936 # libtool install mode
3937 install)
3938 modename="$modename: install"
3940 # There may be an optional sh(1) argument at the beginning of
3941 # install_prog (especially on Windows NT).
3942 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3943 # Allow the use of GNU shtool's install command.
3944 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3945 # Aesthetically quote it.
3946 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3947 case $arg in
3948 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3949 arg="\"$arg\""
3951 esac
3952 install_prog="$arg "
3953 arg="$1"
3954 shift
3955 else
3956 install_prog=
3957 arg="$nonopt"
3960 # The real first argument should be the name of the installation program.
3961 # Aesthetically quote it.
3962 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3963 case $arg in
3964 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3965 arg="\"$arg\""
3967 esac
3968 install_prog="$install_prog$arg"
3970 # We need to accept at least all the BSD install flags.
3971 dest=
3972 files=
3973 opts=
3974 prev=
3975 install_type=
3976 isdir=no
3977 stripme=
3978 for arg
3980 if test -n "$dest"; then
3981 files="$files $dest"
3982 dest="$arg"
3983 continue
3986 case $arg in
3987 -d) isdir=yes ;;
3988 -f) prev="-f" ;;
3989 -g) prev="-g" ;;
3990 -m) prev="-m" ;;
3991 -o) prev="-o" ;;
3993 stripme=" -s"
3994 continue
3996 -*) ;;
3999 # If the previous option needed an argument, then skip it.
4000 if test -n "$prev"; then
4001 prev=
4002 else
4003 dest="$arg"
4004 continue
4007 esac
4009 # Aesthetically quote the argument.
4010 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4011 case $arg in
4012 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4013 arg="\"$arg\""
4015 esac
4016 install_prog="$install_prog $arg"
4017 done
4019 if test -z "$install_prog"; then
4020 $echo "$modename: you must specify an install program" 1>&2
4021 $echo "$help" 1>&2
4022 exit 1
4025 if test -n "$prev"; then
4026 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4027 $echo "$help" 1>&2
4028 exit 1
4031 if test -z "$files"; then
4032 if test -z "$dest"; then
4033 $echo "$modename: no file or destination specified" 1>&2
4034 else
4035 $echo "$modename: you must specify a destination" 1>&2
4037 $echo "$help" 1>&2
4038 exit 1
4041 # Strip any trailing slash from the destination.
4042 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4044 # Check to see that the destination is a directory.
4045 test -d "$dest" && isdir=yes
4046 if test "$isdir" = yes; then
4047 destdir="$dest"
4048 destname=
4049 else
4050 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4051 test "X$destdir" = "X$dest" && destdir=.
4052 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4054 # Not a directory, so check to see that there is only one file specified.
4055 set dummy $files
4056 if test $# -gt 2; then
4057 $echo "$modename: \`$dest' is not a directory" 1>&2
4058 $echo "$help" 1>&2
4059 exit 1
4062 case $destdir in
4063 [\\/]* | [A-Za-z]:[\\/]*) ;;
4065 for file in $files; do
4066 case $file in
4067 *.lo) ;;
4069 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4070 $echo "$help" 1>&2
4071 exit 1
4073 esac
4074 done
4076 esac
4078 # This variable tells wrapper scripts just to set variables rather
4079 # than running their programs.
4080 libtool_install_magic="$magic"
4082 staticlibs=
4083 future_libdirs=
4084 current_libdirs=
4085 for file in $files; do
4087 # Do each installation.
4088 case $file in
4089 *.$libext)
4090 # Do the static libraries later.
4091 staticlibs="$staticlibs $file"
4094 *.la)
4095 # Check to see that this really is a libtool archive.
4096 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4097 else
4098 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4099 $echo "$help" 1>&2
4100 exit 1
4103 library_names=
4104 old_library=
4105 relink_command=
4106 # If there is no directory component, then add one.
4107 case $file in
4108 */* | *\\*) . $file ;;
4109 *) . ./$file ;;
4110 esac
4112 # Add the libdir to current_libdirs if it is the destination.
4113 if test "X$destdir" = "X$libdir"; then
4114 case "$current_libdirs " in
4115 *" $libdir "*) ;;
4116 *) current_libdirs="$current_libdirs $libdir" ;;
4117 esac
4118 else
4119 # Note the libdir as a future libdir.
4120 case "$future_libdirs " in
4121 *" $libdir "*) ;;
4122 *) future_libdirs="$future_libdirs $libdir" ;;
4123 esac
4126 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4127 test "X$dir" = "X$file/" && dir=
4128 dir="$dir$objdir"
4130 if test -n "$relink_command"; then
4131 $echo "$modename: warning: relinking \`$file'" 1>&2
4132 $show "$relink_command"
4133 if $run eval "$relink_command"; then :
4134 else
4135 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4136 continue
4140 # See the names of the shared library.
4141 set dummy $library_names
4142 if test -n "$2"; then
4143 realname="$2"
4144 shift
4145 shift
4147 srcname="$realname"
4148 test -n "$relink_command" && srcname="$realname"T
4150 # Install the shared library and build the symlinks.
4151 $show "$install_prog $dir/$srcname $destdir/$realname"
4152 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4153 if test -n "$stripme" && test -n "$striplib"; then
4154 $show "$striplib $destdir/$realname"
4155 $run eval "$striplib $destdir/$realname" || exit $?
4158 if test $# -gt 0; then
4159 # Delete the old symlinks, and create new ones.
4160 for linkname
4162 if test "$linkname" != "$realname"; then
4163 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4164 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4166 done
4169 # Do each command in the postinstall commands.
4170 lib="$destdir/$realname"
4171 eval cmds=\"$postinstall_cmds\"
4172 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4173 for cmd in $cmds; do
4174 IFS="$save_ifs"
4175 $show "$cmd"
4176 $run eval "$cmd" || exit $?
4177 done
4178 IFS="$save_ifs"
4181 # Install the pseudo-library for information purposes.
4182 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4183 instname="$dir/$name"i
4184 $show "$install_prog $instname $destdir/$name"
4185 $run eval "$install_prog $instname $destdir/$name" || exit $?
4187 # Maybe install the static library, too.
4188 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4191 *.lo)
4192 # Install (i.e. copy) a libtool object.
4194 # Figure out destination file name, if it wasn't already specified.
4195 if test -n "$destname"; then
4196 destfile="$destdir/$destname"
4197 else
4198 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4199 destfile="$destdir/$destfile"
4202 # Deduce the name of the destination old-style object file.
4203 case $destfile in
4204 *.lo)
4205 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4207 *.$objext)
4208 staticdest="$destfile"
4209 destfile=
4212 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4213 $echo "$help" 1>&2
4214 exit 1
4216 esac
4218 # Install the libtool object if requested.
4219 if test -n "$destfile"; then
4220 $show "$install_prog $file $destfile"
4221 $run eval "$install_prog $file $destfile" || exit $?
4224 # Install the old object if enabled.
4225 if test "$build_old_libs" = yes; then
4226 # Deduce the name of the old-style object file.
4227 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4229 $show "$install_prog $staticobj $staticdest"
4230 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4232 exit 0
4236 # Figure out destination file name, if it wasn't already specified.
4237 if test -n "$destname"; then
4238 destfile="$destdir/$destname"
4239 else
4240 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4241 destfile="$destdir/$destfile"
4244 # Do a test to see if this is really a libtool program.
4245 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4246 notinst_deplibs=
4247 relink_command=
4249 # If there is no directory component, then add one.
4250 case $file in
4251 */* | *\\*) . $file ;;
4252 *) . ./$file ;;
4253 esac
4255 # Check the variables that should have been set.
4256 if test -z "$notinst_deplibs"; then
4257 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4258 exit 1
4261 finalize=yes
4262 for lib in $notinst_deplibs; do
4263 # Check to see that each library is installed.
4264 libdir=
4265 if test -f "$lib"; then
4266 # If there is no directory component, then add one.
4267 case $lib in
4268 */* | *\\*) . $lib ;;
4269 *) . ./$lib ;;
4270 esac
4272 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4273 if test -n "$libdir" && test ! -f "$libfile"; then
4274 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4275 finalize=no
4277 done
4279 relink_command=
4280 # If there is no directory component, then add one.
4281 case $file in
4282 */* | *\\*) . $file ;;
4283 *) . ./$file ;;
4284 esac
4286 outputname=
4287 if test "$fast_install" = no && test -n "$relink_command"; then
4288 if test "$finalize" = yes && test -z "$run"; then
4289 tmpdir="/tmp"
4290 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4291 tmpdir="$tmpdir/libtool-$$"
4292 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4293 else
4294 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4295 continue
4297 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4298 outputname="$tmpdir/$file"
4299 # Replace the output file specification.
4300 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4302 $show "$relink_command"
4303 if $run eval "$relink_command"; then :
4304 else
4305 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4306 ${rm}r "$tmpdir"
4307 continue
4309 file="$outputname"
4310 else
4311 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4313 else
4314 # Install the binary that we compiled earlier.
4315 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4319 # remove .exe since cygwin /usr/bin/install will append another
4320 # one anyways
4321 case $install_prog,$host in
4322 /usr/bin/install*,*cygwin*)
4323 case $file:$destfile in
4324 *.exe:*.exe)
4325 # this is ok
4327 *.exe:*)
4328 destfile=$destfile.exe
4330 *:*.exe)
4331 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4333 esac
4335 esac
4336 $show "$install_prog$stripme $file $destfile"
4337 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4338 test -n "$outputname" && ${rm}r "$tmpdir"
4340 esac
4341 done
4343 for file in $staticlibs; do
4344 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4346 # Set up the ranlib parameters.
4347 oldlib="$destdir/$name"
4349 $show "$install_prog $file $oldlib"
4350 $run eval "$install_prog \$file \$oldlib" || exit $?
4352 if test -n "$stripme" && test -n "$striplib"; then
4353 $show "$old_striplib $oldlib"
4354 $run eval "$old_striplib $oldlib" || exit $?
4357 # Do each command in the postinstall commands.
4358 eval cmds=\"$old_postinstall_cmds\"
4359 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4360 for cmd in $cmds; do
4361 IFS="$save_ifs"
4362 $show "$cmd"
4363 $run eval "$cmd" || exit $?
4364 done
4365 IFS="$save_ifs"
4366 done
4368 if test -n "$future_libdirs"; then
4369 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4372 if test -n "$current_libdirs"; then
4373 # Maybe just do a dry run.
4374 test -n "$run" && current_libdirs=" -n$current_libdirs"
4375 exec $SHELL $0 --finish$current_libdirs
4376 exit 1
4379 exit 0
4382 # libtool finish mode
4383 finish)
4384 modename="$modename: finish"
4385 libdirs="$nonopt"
4386 admincmds=
4388 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4389 for dir
4391 libdirs="$libdirs $dir"
4392 done
4394 for libdir in $libdirs; do
4395 if test -n "$finish_cmds"; then
4396 # Do each command in the finish commands.
4397 eval cmds=\"$finish_cmds\"
4398 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4399 for cmd in $cmds; do
4400 IFS="$save_ifs"
4401 $show "$cmd"
4402 $run eval "$cmd" || admincmds="$admincmds
4403 $cmd"
4404 done
4405 IFS="$save_ifs"
4407 if test -n "$finish_eval"; then
4408 # Do the single finish_eval.
4409 eval cmds=\"$finish_eval\"
4410 $run eval "$cmds" || admincmds="$admincmds
4411 $cmds"
4413 done
4416 # Exit here if they wanted silent mode.
4417 test "$show" = ":" && exit 0
4419 echo "----------------------------------------------------------------------"
4420 echo "Libraries have been installed in:"
4421 for libdir in $libdirs; do
4422 echo " $libdir"
4423 done
4424 echo
4425 echo "If you ever happen to want to link against installed libraries"
4426 echo "in a given directory, LIBDIR, you must either use libtool, and"
4427 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4428 echo "flag during linking and do at least one of the following:"
4429 if test -n "$shlibpath_var"; then
4430 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4431 echo " during execution"
4433 if test -n "$runpath_var"; then
4434 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4435 echo " during linking"
4437 if test -n "$hardcode_libdir_flag_spec"; then
4438 libdir=LIBDIR
4439 eval flag=\"$hardcode_libdir_flag_spec\"
4441 echo " - use the \`$flag' linker flag"
4443 if test -n "$admincmds"; then
4444 echo " - have your system administrator run these commands:$admincmds"
4446 if test -f /etc/ld.so.conf; then
4447 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4449 echo
4450 echo "See any operating system documentation about shared libraries for"
4451 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4452 echo "----------------------------------------------------------------------"
4453 exit 0
4456 # libtool execute mode
4457 execute)
4458 modename="$modename: execute"
4460 # The first argument is the command name.
4461 cmd="$nonopt"
4462 if test -z "$cmd"; then
4463 $echo "$modename: you must specify a COMMAND" 1>&2
4464 $echo "$help"
4465 exit 1
4468 # Handle -dlopen flags immediately.
4469 for file in $execute_dlfiles; do
4470 if test ! -f "$file"; then
4471 $echo "$modename: \`$file' is not a file" 1>&2
4472 $echo "$help" 1>&2
4473 exit 1
4476 dir=
4477 case $file in
4478 *.la)
4479 # Check to see that this really is a libtool archive.
4480 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4481 else
4482 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4483 $echo "$help" 1>&2
4484 exit 1
4487 # Read the libtool library.
4488 dlname=
4489 library_names=
4491 # If there is no directory component, then add one.
4492 case $file in
4493 */* | *\\*) . $file ;;
4494 *) . ./$file ;;
4495 esac
4497 # Skip this library if it cannot be dlopened.
4498 if test -z "$dlname"; then
4499 # Warn if it was a shared library.
4500 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4501 continue
4504 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4505 test "X$dir" = "X$file" && dir=.
4507 if test -f "$dir/$objdir/$dlname"; then
4508 dir="$dir/$objdir"
4509 else
4510 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4511 exit 1
4515 *.lo)
4516 # Just add the directory containing the .lo file.
4517 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4518 test "X$dir" = "X$file" && dir=.
4522 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4523 continue
4525 esac
4527 # Get the absolute pathname.
4528 absdir=`cd "$dir" && pwd`
4529 test -n "$absdir" && dir="$absdir"
4531 # Now add the directory to shlibpath_var.
4532 if eval "test -z \"\$$shlibpath_var\""; then
4533 eval "$shlibpath_var=\"\$dir\""
4534 else
4535 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4537 done
4539 # This variable tells wrapper scripts just to set shlibpath_var
4540 # rather than running their programs.
4541 libtool_execute_magic="$magic"
4543 # Check if any of the arguments is a wrapper script.
4544 args=
4545 for file
4547 case $file in
4548 -*) ;;
4550 # Do a test to see if this is really a libtool program.
4551 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4552 # If there is no directory component, then add one.
4553 case $file in
4554 */* | *\\*) . $file ;;
4555 *) . ./$file ;;
4556 esac
4558 # Transform arg to wrapped name.
4559 file="$progdir/$program"
4562 esac
4563 # Quote arguments (to preserve shell metacharacters).
4564 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4565 args="$args \"$file\""
4566 done
4568 if test -z "$run"; then
4569 if test -n "$shlibpath_var"; then
4570 # Export the shlibpath_var.
4571 eval "export $shlibpath_var"
4574 # Restore saved enviroment variables
4575 if test "${save_LC_ALL+set}" = set; then
4576 LC_ALL="$save_LC_ALL"; export LC_ALL
4578 if test "${save_LANG+set}" = set; then
4579 LANG="$save_LANG"; export LANG
4582 # Now actually exec the command.
4583 eval "exec \$cmd$args"
4585 $echo "$modename: cannot exec \$cmd$args"
4586 exit 1
4587 else
4588 # Display what would be done.
4589 if test -n "$shlibpath_var"; then
4590 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4591 $echo "export $shlibpath_var"
4593 $echo "$cmd$args"
4594 exit 0
4598 # libtool clean and uninstall mode
4599 clean | uninstall)
4600 modename="$modename: $mode"
4601 rm="$nonopt"
4602 files=
4603 rmforce=
4604 exit_status=0
4606 # This variable tells wrapper scripts just to set variables rather
4607 # than running their programs.
4608 libtool_install_magic="$magic"
4610 for arg
4612 case $arg in
4613 -f) rm="$rm $arg"; rmforce=yes ;;
4614 -*) rm="$rm $arg" ;;
4615 *) files="$files $arg" ;;
4616 esac
4617 done
4619 if test -z "$rm"; then
4620 $echo "$modename: you must specify an RM program" 1>&2
4621 $echo "$help" 1>&2
4622 exit 1
4625 rmdirs=
4627 for file in $files; do
4628 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4629 if test "X$dir" = "X$file"; then
4630 dir=.
4631 objdir="$objdir"
4632 else
4633 objdir="$dir/$objdir"
4635 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4636 test $mode = uninstall && objdir="$dir"
4638 # Remember objdir for removal later, being careful to avoid duplicates
4639 if test $mode = clean; then
4640 case " $rmdirs " in
4641 *" $objdir "*) ;;
4642 *) rmdirs="$rmdirs $objdir" ;;
4643 esac
4646 # Don't error if the file doesn't exist and rm -f was used.
4647 if (test -L "$file") >/dev/null 2>&1 \
4648 || (test -h "$file") >/dev/null 2>&1 \
4649 || test -f "$file"; then
4651 elif test -d "$file"; then
4652 exit_status=1
4653 continue
4654 elif test "$rmforce" = yes; then
4655 continue
4658 rmfiles="$file"
4660 case $name in
4661 *.la)
4662 # Possibly a libtool archive, so verify it.
4663 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4664 . $dir/$name
4666 # Delete the libtool libraries and symlinks.
4667 for n in $library_names; do
4668 rmfiles="$rmfiles $objdir/$n"
4669 done
4670 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4671 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4673 if test $mode = uninstall; then
4674 if test -n "$library_names"; then
4675 # Do each command in the postuninstall commands.
4676 eval cmds=\"$postuninstall_cmds\"
4677 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4678 for cmd in $cmds; do
4679 IFS="$save_ifs"
4680 $show "$cmd"
4681 $run eval "$cmd"
4682 if test $? != 0 && test "$rmforce" != yes; then
4683 exit_status=1
4685 done
4686 IFS="$save_ifs"
4689 if test -n "$old_library"; then
4690 # Do each command in the old_postuninstall commands.
4691 eval cmds=\"$old_postuninstall_cmds\"
4692 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4693 for cmd in $cmds; do
4694 IFS="$save_ifs"
4695 $show "$cmd"
4696 $run eval "$cmd"
4697 if test $? != 0 && test "$rmforce" != yes; then
4698 exit_status=1
4700 done
4701 IFS="$save_ifs"
4703 # FIXME: should reinstall the best remaining shared library.
4708 *.lo)
4709 if test "$build_old_libs" = yes; then
4710 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4711 rmfiles="$rmfiles $dir/$oldobj"
4716 # Do a test to see if this is a libtool program.
4717 if test $mode = clean &&
4718 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4719 relink_command=
4720 . $dir/$file
4722 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4723 if test "$fast_install" = yes && test -n "$relink_command"; then
4724 rmfiles="$rmfiles $objdir/lt-$name"
4728 esac
4729 $show "$rm $rmfiles"
4730 $run $rm $rmfiles || exit_status=1
4731 done
4733 # Try to remove the ${objdir}s in the directories where we deleted files
4734 for dir in $rmdirs; do
4735 if test -d "$dir"; then
4736 $show "rmdir $dir"
4737 $run rmdir $dir >/dev/null 2>&1
4739 done
4741 exit $exit_status
4745 $echo "$modename: you must specify a MODE" 1>&2
4746 $echo "$generic_help" 1>&2
4747 exit 1
4749 esac
4751 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4752 $echo "$generic_help" 1>&2
4753 exit 1
4754 fi # test -z "$show_help"
4756 # We need to display help for each of the modes.
4757 case $mode in
4758 "") $echo \
4759 "Usage: $modename [OPTION]... [MODE-ARG]...
4761 Provide generalized library-building support services.
4763 --config show all configuration variables
4764 --debug enable verbose shell tracing
4765 -n, --dry-run display commands without modifying any files
4766 --features display basic configuration information and exit
4767 --finish same as \`--mode=finish'
4768 --help display this help message and exit
4769 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4770 --quiet same as \`--silent'
4771 --silent don't print informational messages
4772 --version print version information
4774 MODE must be one of the following:
4776 clean remove files from the build directory
4777 compile compile a source file into a libtool object
4778 execute automatically set library path, then run a program
4779 finish complete the installation of libtool libraries
4780 install install libraries or executables
4781 link create a library or an executable
4782 uninstall remove libraries from an installed directory
4784 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4785 a more detailed description of MODE."
4786 exit 0
4789 clean)
4790 $echo \
4791 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4793 Remove files from the build directory.
4795 RM is the name of the program to use to delete files associated with each FILE
4796 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4797 to RM.
4799 If FILE is a libtool library, object or program, all the files associated
4800 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4803 compile)
4804 $echo \
4805 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4807 Compile a source file into a libtool library object.
4809 This mode accepts the following additional options:
4811 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4812 -prefer-pic try to building PIC objects only
4813 -prefer-non-pic try to building non-PIC objects only
4814 -static always build a \`.o' file suitable for static linking
4816 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4817 from the given SOURCEFILE.
4819 The output file name is determined by removing the directory component from
4820 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4821 library object suffix, \`.lo'."
4824 execute)
4825 $echo \
4826 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4828 Automatically set library path, then run a program.
4830 This mode accepts the following additional options:
4832 -dlopen FILE add the directory containing FILE to the library path
4834 This mode sets the library path environment variable according to \`-dlopen'
4835 flags.
4837 If any of the ARGS are libtool executable wrappers, then they are translated
4838 into their corresponding uninstalled binary, and any of their required library
4839 directories are added to the library path.
4841 Then, COMMAND is executed, with ARGS as arguments."
4844 finish)
4845 $echo \
4846 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4848 Complete the installation of libtool libraries.
4850 Each LIBDIR is a directory that contains libtool libraries.
4852 The commands that this mode executes may require superuser privileges. Use
4853 the \`--dry-run' option if you just want to see what would be executed."
4856 install)
4857 $echo \
4858 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4860 Install executables or libraries.
4862 INSTALL-COMMAND is the installation command. The first component should be
4863 either the \`install' or \`cp' program.
4865 The rest of the components are interpreted as arguments to that command (only
4866 BSD-compatible install options are recognized)."
4869 link)
4870 $echo \
4871 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4873 Link object files or libraries together to form another library, or to
4874 create an executable program.
4876 LINK-COMMAND is a command using the C compiler that you would use to create
4877 a program from several object files.
4879 The following components of LINK-COMMAND are treated specially:
4881 -all-static do not do any dynamic linking at all
4882 -avoid-version do not add a version suffix if possible
4883 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4884 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4885 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4886 -export-symbols SYMFILE
4887 try to export only the symbols listed in SYMFILE
4888 -export-symbols-regex REGEX
4889 try to export only the symbols matching REGEX
4890 -LLIBDIR search LIBDIR for required installed libraries
4891 -lNAME OUTPUT-FILE requires the installed library libNAME
4892 -module build a library that can dlopened
4893 -no-fast-install disable the fast-install mode
4894 -no-install link a not-installable executable
4895 -no-undefined declare that a library does not refer to external symbols
4896 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4897 -release RELEASE specify package release information
4898 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4899 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4900 -static do not do any dynamic linking of libtool libraries
4901 -version-info CURRENT[:REVISION[:AGE]]
4902 specify library version info [each variable defaults to 0]
4904 All other options (arguments beginning with \`-') are ignored.
4906 Every other argument is treated as a filename. Files ending in \`.la' are
4907 treated as uninstalled libtool libraries, other files are standard or library
4908 object files.
4910 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4911 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4912 required, except when creating a convenience library.
4914 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4915 using \`ar' and \`ranlib', or on Windows using \`lib'.
4917 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4918 is created, otherwise an executable program is created."
4921 uninstall)
4922 $echo \
4923 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4925 Remove libraries from an installation directory.
4927 RM is the name of the program to use to delete files associated with each FILE
4928 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4929 to RM.
4931 If FILE is a libtool library, all the files associated with it are deleted.
4932 Otherwise, only FILE itself is deleted using RM."
4936 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4937 $echo "$help" 1>&2
4938 exit 1
4940 esac
4942 echo
4943 $echo "Try \`$modename --help' for more information about other modes."
4945 exit 0
4947 # Local Variables:
4948 # mode:shell-script
4949 # sh-indentation:2
4950 # End: