Import upstream sources.
[cparse] / ltmain.sh
CommitLineData
3cd4b0f8
MW
1# ltmain.sh - Provide generalized library-building support services.
2# NOTE: Changing this file will not affect anything until you rerun configure.
3#
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
7#
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.
12#
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.
17#
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.
21#
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.
26
27# Check that we have a working $echo.
28if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
30 shift
31elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
33 :
34elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
36 :
37else
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
40fi
41
42if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
44 shift
45 cat <<EOF
46$*
47EOF
48 exit 0
49fi
50
51# The name of this program.
52progname=`$echo "$0" | sed 's%^.*/%%'`
53modename="$progname"
54
55# Constants.
56PROGRAM=ltmain.sh
57PACKAGE=libtool
58VERSION=1.4.2a
59TIMESTAMP=" (1.922.2.79 2001/11/28 21:50:31)"
60
61default_mode=
62help="Try \`$progname --help' for more information."
63magic="%%%MAGIC variable%%%"
64mkdir="mkdir"
65mv="mv -f"
66rm="rm -f"
67
68# Sed substitution that helps us do robust quoting. It backslashifies
69# metacharacters that are still active within double-quoted strings.
70Xsed='sed -e 1s/^X//'
71sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72SP2NL='tr \040 \012'
73NL2SP='tr \015\012 \040\040'
74
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.
80if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
82fi
83if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
85fi
86
87# Make sure IFS has a sensible default
88: ${IFS=" "}
89
90if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91 echo "$modename: not configured to build any kind of library" 1>&2
92 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
93 exit 1
94fi
95
96# Global variables.
97mode=$default_mode
98nonopt=
99prev=
100prevopt=
101run=
102show="$echo"
103show_help=
104execute_dlfiles=
105lo2o="s/\\.lo\$/.${objext}/"
106o2lo="s/\\.${objext}\$/.lo/"
107
108# Parse our command line options once, thoroughly.
109while test $# -gt 0
110do
111 arg="$1"
112 shift
113
114 case $arg in
115 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
116 *) optarg= ;;
117 esac
118
119 # If the previous option needs an argument, assign it.
120 if test -n "$prev"; then
121 case $prev in
122 execute_dlfiles)
123 execute_dlfiles="$execute_dlfiles $arg"
124 ;;
125 *)
126 eval "$prev=\$arg"
127 ;;
128 esac
129
130 prev=
131 prevopt=
132 continue
133 fi
134
135 # Have we seen a non-optional argument yet?
136 case $arg in
137 --help)
138 show_help=yes
139 ;;
140
141 --version)
142 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
143 exit 0
144 ;;
145
146 --config)
147 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
148 exit 0
149 ;;
150
151 --debug)
152 echo "$progname: enabling shell trace mode"
153 set -x
154 ;;
155
156 --dry-run | -n)
157 run=:
158 ;;
159
160 --features)
161 echo "host: $host"
162 if test "$build_libtool_libs" = yes; then
163 echo "enable shared libraries"
164 else
165 echo "disable shared libraries"
166 fi
167 if test "$build_old_libs" = yes; then
168 echo "enable static libraries"
169 else
170 echo "disable static libraries"
171 fi
172 exit 0
173 ;;
174
175 --finish) mode="finish" ;;
176
177 --mode) prevopt="--mode" prev=mode ;;
178 --mode=*) mode="$optarg" ;;
179
180 --preserve-dup-deps) duplicate_deps="yes" ;;
181
182 --quiet | --silent)
183 show=:
184 ;;
185
186 -dlopen)
187 prevopt="-dlopen"
188 prev=execute_dlfiles
189 ;;
190
191 -*)
192 $echo "$modename: unrecognized option \`$arg'" 1>&2
193 $echo "$help" 1>&2
194 exit 1
195 ;;
196
197 *)
198 nonopt="$arg"
199 break
200 ;;
201 esac
202done
203
204if test -n "$prevopt"; then
205 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
206 $echo "$help" 1>&2
207 exit 1
208fi
209
210# If this variable is set in any of the actions, the command in it
211# will be execed at the end. This prevents here-documents from being
212# left over by shells.
213exec_cmd=
214
215if test -z "$show_help"; then
216
217 # Infer the operation mode.
218 if test -z "$mode"; then
219 case $nonopt in
220 *cc | *++ | gcc* | *-gcc*)
221 mode=link
222 for arg
223 do
224 case $arg in
225 -c)
226 mode=compile
227 break
228 ;;
229 esac
230 done
231 ;;
232 *db | *dbx | *strace | *truss)
233 mode=execute
234 ;;
235 *install*|cp|mv)
236 mode=install
237 ;;
238 *rm)
239 mode=uninstall
240 ;;
241 *)
242 # If we have no mode, but dlfiles were specified, then do execute mode.
243 test -n "$execute_dlfiles" && mode=execute
244
245 # Just use the default operation mode.
246 if test -z "$mode"; then
247 if test -n "$nonopt"; then
248 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
249 else
250 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
251 fi
252 fi
253 ;;
254 esac
255 fi
256
257 # Only execute mode is allowed to have -dlopen flags.
258 if test -n "$execute_dlfiles" && test "$mode" != execute; then
259 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
260 $echo "$help" 1>&2
261 exit 1
262 fi
263
264 # Change the help message to a mode-specific one.
265 generic_help="$help"
266 help="Try \`$modename --help --mode=$mode' for more information."
267
268 # These modes are in order of execution frequency so that they run quickly.
269 case $mode in
270 # libtool compile mode
271 compile)
272 modename="$modename: compile"
273 # Get the compilation command and the source file.
274 base_compile=
275 prev=
276 lastarg=
277 srcfile="$nonopt"
278 suppress_output=
279
280 user_target=no
281 for arg
282 do
283 case $prev in
284 "") ;;
285 xcompiler)
286 # Aesthetically quote the previous argument.
287 prev=
288 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
289
290 case $arg in
291 # Double-quote args containing other shell metacharacters.
292 # Many Bourne shells cannot handle close brackets correctly
293 # in scan sets, so we specify it separately.
294 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
295 arg="\"$arg\""
296 ;;
297 esac
298
299 # Add the previous argument to base_compile.
300 if test -z "$base_compile"; then
301 base_compile="$lastarg"
302 else
303 base_compile="$base_compile $lastarg"
304 fi
305 continue
306 ;;
307 esac
308
309 # Accept any command-line options.
310 case $arg in
311 -o)
312 if test "$user_target" != "no"; then
313 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
314 exit 1
315 fi
316 user_target=next
317 ;;
318
319 -static)
320 build_old_libs=yes
321 continue
322 ;;
323
324 -prefer-pic)
325 pic_mode=yes
326 continue
327 ;;
328
329 -prefer-non-pic)
330 pic_mode=no
331 continue
332 ;;
333
334 -Xcompiler)
335 prev=xcompiler
336 continue
337 ;;
338
339 -Wc,*)
340 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
341 lastarg=
342 save_ifs="$IFS"; IFS=','
343 for arg in $args; do
344 IFS="$save_ifs"
345
346 # Double-quote args containing other shell metacharacters.
347 # Many Bourne shells cannot handle close brackets correctly
348 # in scan sets, so we specify it separately.
349 case $arg in
350 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
351 arg="\"$arg\""
352 ;;
353 esac
354 lastarg="$lastarg $arg"
355 done
356 IFS="$save_ifs"
357 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
358
359 # Add the arguments to base_compile.
360 if test -z "$base_compile"; then
361 base_compile="$lastarg"
362 else
363 base_compile="$base_compile $lastarg"
364 fi
365 continue
366 ;;
367 esac
368
369 case $user_target in
370 next)
371 # The next one is the -o target name
372 user_target=yes
373 continue
374 ;;
375 yes)
376 # We got the output file
377 user_target=set
378 libobj="$arg"
379 continue
380 ;;
381 esac
382
383 # Accept the current argument as the source file.
384 lastarg="$srcfile"
385 srcfile="$arg"
386
387 # Aesthetically quote the previous argument.
388
389 # Backslashify any backslashes, double quotes, and dollar signs.
390 # These are the only characters that are still specially
391 # interpreted inside of double-quoted scrings.
392 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
393
394 # Double-quote args containing other shell metacharacters.
395 # Many Bourne shells cannot handle close brackets correctly
396 # in scan sets, so we specify it separately.
397 case $lastarg in
398 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
399 lastarg="\"$lastarg\""
400 ;;
401 esac
402
403 # Add the previous argument to base_compile.
404 if test -z "$base_compile"; then
405 base_compile="$lastarg"
406 else
407 base_compile="$base_compile $lastarg"
408 fi
409 done
410
411 case $user_target in
412 set)
413 ;;
414 no)
415 # Get the name of the library object.
416 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
417 ;;
418 *)
419 $echo "$modename: you must specify a target with \`-o'" 1>&2
420 exit 1
421 ;;
422 esac
423
424 # Recognize several different file suffixes.
425 # If the user specifies -o file.o, it is replaced with file.lo
426 xform='[cCFSfmso]'
427 case $libobj in
428 *.ada) xform=ada ;;
429 *.adb) xform=adb ;;
430 *.ads) xform=ads ;;
431 *.asm) xform=asm ;;
432 *.c++) xform=c++ ;;
433 *.cc) xform=cc ;;
434 *.cpp) xform=cpp ;;
435 *.cxx) xform=cxx ;;
436 *.f90) xform=f90 ;;
437 *.for) xform=for ;;
438 esac
439
440 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
441
442 case $libobj in
443 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
444 *)
445 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
446 exit 1
447 ;;
448 esac
449
450 if test -z "$base_compile"; then
451 $echo "$modename: you must specify a compilation command" 1>&2
452 $echo "$help" 1>&2
453 exit 1
454 fi
455
456 # Delete any leftover library objects.
457 if test "$build_old_libs" = yes; then
458 removelist="$obj $libobj"
459 else
460 removelist="$libobj"
461 fi
462
463 $run $rm $removelist
464 trap "$run $rm $removelist; exit 1" 1 2 15
465
466 # On Cygwin there's no "real" PIC flag so we must build both object types
467 case $host_os in
468 cygwin* | mingw* | pw32* | os2*)
469 pic_mode=default
470 ;;
471 esac
472 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
473 # non-PIC code in shared libraries is not supported
474 pic_mode=default
475 fi
476
477 # Calculate the filename of the output object if compiler does
478 # not support -o with -c
479 if test "$compiler_c_o" = no; then
480 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
481 lockfile="$output_obj.lock"
482 removelist="$removelist $output_obj $lockfile"
483 trap "$run $rm $removelist; exit 1" 1 2 15
484 else
485 need_locks=no
486 lockfile=
487 fi
488
489 # Lock this critical section if it is needed
490 # We use this script file to make the link, it avoids creating a new file
491 if test "$need_locks" = yes; then
492 until $run ln "$0" "$lockfile" 2>/dev/null; do
493 $show "Waiting for $lockfile to be removed"
494 sleep 2
495 done
496 elif test "$need_locks" = warn; then
497 if test -f "$lockfile"; then
498 echo "\
499*** ERROR, $lockfile exists and contains:
500`cat $lockfile 2>/dev/null`
501
502This indicates that another process is trying to use the same
503temporary object file, and libtool could not work around it because
504your compiler does not support \`-c' and \`-o' together. If you
505repeat this compilation, it may succeed, by chance, but you had better
506avoid parallel builds (make -j) in this platform, or get a better
507compiler."
508
509 $run $rm $removelist
510 exit 1
511 fi
512 echo $srcfile > "$lockfile"
513 fi
514
515 if test -n "$fix_srcfile_path"; then
516 eval srcfile=\"$fix_srcfile_path\"
517 fi
518
519 # Only build a PIC object if we are building libtool libraries.
520 if test "$build_libtool_libs" = yes; then
521 # Without this assignment, base_compile gets emptied.
522 fbsd_hideous_sh_bug=$base_compile
523
524 if test "$pic_mode" != no; then
525 # All platforms use -DPIC, to notify preprocessed assembler code.
526 command="$base_compile $srcfile $pic_flag -DPIC"
527 else
528 # Don't build PIC code
529 command="$base_compile $srcfile"
530 fi
531 if test "$build_old_libs" = yes; then
532 lo_libobj="$libobj"
533 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
534 if test "X$dir" = "X$libobj"; then
535 dir="$objdir"
536 else
537 dir="$dir/$objdir"
538 fi
539 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
540
541 if test -d "$dir"; then
542 $show "$rm $libobj"
543 $run $rm $libobj
544 else
545 $show "$mkdir $dir"
546 $run $mkdir $dir
547 status=$?
548 if test $status -ne 0 && test ! -d $dir; then
549 exit $status
550 fi
551 fi
552 fi
553 if test "$compiler_o_lo" = yes; then
554 output_obj="$libobj"
555 command="$command -o $output_obj"
556 elif test "$compiler_c_o" = yes; then
557 output_obj="$obj"
558 command="$command -o $output_obj"
559 fi
560
561 $run $rm "$output_obj"
562 $show "$command"
563 if $run eval "$command"; then :
564 else
565 test -n "$output_obj" && $run $rm $removelist
566 exit 1
567 fi
568
569 if test "$need_locks" = warn &&
570 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
571 echo "\
572*** ERROR, $lockfile contains:
573`cat $lockfile 2>/dev/null`
574
575but it should contain:
576$srcfile
577
578This indicates that another process is trying to use the same
579temporary object file, and libtool could not work around it because
580your compiler does not support \`-c' and \`-o' together. If you
581repeat this compilation, it may succeed, by chance, but you had better
582avoid parallel builds (make -j) in this platform, or get a better
583compiler."
584
585 $run $rm $removelist
586 exit 1
587 fi
588
589 # Just move the object if needed, then go on to compile the next one
590 if test x"$output_obj" != x"$libobj"; then
591 $show "$mv $output_obj $libobj"
592 if $run $mv $output_obj $libobj; then :
593 else
594 error=$?
595 $run $rm $removelist
596 exit $error
597 fi
598 fi
599
600 # If we have no pic_flag, then copy the object into place and finish.
601 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
602 test "$build_old_libs" = yes; then
603 # Rename the .lo from within objdir to obj
604 if test -f $obj; then
605 $show $rm $obj
606 $run $rm $obj
607 fi
608
609 $show "$mv $libobj $obj"
610 if $run $mv $libobj $obj; then :
611 else
612 error=$?
613 $run $rm $removelist
614 exit $error
615 fi
616
617 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
618 if test "X$xdir" = "X$obj"; then
619 xdir="."
620 else
621 xdir="$xdir"
622 fi
623 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
624 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
625 # Now arrange that obj and lo_libobj become the same file
626 $show "(cd $xdir && $LN_S $baseobj $libobj)"
627 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
628 # Unlock the critical section if it was locked
629 if test "$need_locks" != no; then
630 $run $rm "$lockfile"
631 fi
632 exit 0
633 else
634 error=$?
635 $run $rm $removelist
636 exit $error
637 fi
638 fi
639
640 # Allow error messages only from the first compilation.
641 suppress_output=' >/dev/null 2>&1'
642 fi
643
644 # Only build a position-dependent object if we build old libraries.
645 if test "$build_old_libs" = yes; then
646 if test "$pic_mode" != yes; then
647 # Don't build PIC code
648 command="$base_compile $srcfile"
649 else
650 # All platforms use -DPIC, to notify preprocessed assembler code.
651 command="$base_compile $srcfile $pic_flag -DPIC"
652 fi
653 if test "$compiler_c_o" = yes; then
654 command="$command -o $obj"
655 output_obj="$obj"
656 fi
657
658 # Suppress compiler output if we already did a PIC compilation.
659 command="$command$suppress_output"
660 $run $rm "$output_obj"
661 $show "$command"
662 if $run eval "$command"; then :
663 else
664 $run $rm $removelist
665 exit 1
666 fi
667
668 if test "$need_locks" = warn &&
669 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
670 echo "\
671*** ERROR, $lockfile contains:
672`cat $lockfile 2>/dev/null`
673
674but it should contain:
675$srcfile
676
677This indicates that another process is trying to use the same
678temporary object file, and libtool could not work around it because
679your compiler does not support \`-c' and \`-o' together. If you
680repeat this compilation, it may succeed, by chance, but you had better
681avoid parallel builds (make -j) in this platform, or get a better
682compiler."
683
684 $run $rm $removelist
685 exit 1
686 fi
687
688 # Just move the object if needed
689 if test x"$output_obj" != x"$obj"; then
690 $show "$mv $output_obj $obj"
691 if $run $mv $output_obj $obj; then :
692 else
693 error=$?
694 $run $rm $removelist
695 exit $error
696 fi
697 fi
698
699 # Create an invalid libtool object if no PIC, so that we do not
700 # accidentally link it into a program.
701 if test "$build_libtool_libs" != yes; then
702 $show "echo timestamp > $libobj"
703 $run eval "echo timestamp > \$libobj" || exit $?
704 else
705 # Move the .lo from within objdir
706 $show "$mv $libobj $lo_libobj"
707 if $run $mv $libobj $lo_libobj; then :
708 else
709 error=$?
710 $run $rm $removelist
711 exit $error
712 fi
713 fi
714 fi
715
716 # Unlock the critical section if it was locked
717 if test "$need_locks" != no; then
718 $run $rm "$lockfile"
719 fi
720
721 exit 0
722 ;;
723
724 # libtool link mode
725 link | relink)
726 modename="$modename: link"
727 case $host in
728 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
729 # It is impossible to link a dll without this setting, and
730 # we shouldn't force the makefile maintainer to figure out
731 # which system we are compiling for in order to pass an extra
732 # flag for every libtool invokation.
733 # allow_undefined=no
734
735 # FIXME: Unfortunately, there are problems with the above when trying
736 # to make a dll which has undefined symbols, in which case not
737 # even a static library is built. For now, we need to specify
738 # -no-undefined on the libtool link line when we can be certain
739 # that all symbols are satisfied, otherwise we get a static library.
740 allow_undefined=yes
741 ;;
742 *)
743 allow_undefined=yes
744 ;;
745 esac
746 libtool_args="$nonopt"
747 compile_command="$nonopt"
748 finalize_command="$nonopt"
749
750 compile_rpath=
751 finalize_rpath=
752 compile_shlibpath=
753 finalize_shlibpath=
754 convenience=
755 old_convenience=
756 deplibs=
757 old_deplibs=
758 compiler_flags=
759 linker_flags=
760 dllsearchpath=
761 lib_search_path=`pwd`
762
763 avoid_version=no
764 dlfiles=
765 dlprefiles=
766 dlself=no
767 export_dynamic=no
768 export_symbols=
769 export_symbols_regex=
770 generated=
771 libobjs=
772 ltlibs=
773 module=no
774 no_install=no
775 objs=
776 prefer_static_libs=no
777 preload=no
778 prev=
779 prevarg=
780 release=
781 rpath=
782 xrpath=
783 perm_rpath=
784 temp_rpath=
785 thread_safe=no
786 vinfo=
787
788 # We need to know -static, to get the right output filenames.
789 for arg
790 do
791 case $arg in
792 -all-static | -static)
793 if test "X$arg" = "X-all-static"; then
794 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
795 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
796 fi
797 if test -n "$link_static_flag"; then
798 dlopen_self=$dlopen_self_static
799 fi
800 else
801 if test -z "$pic_flag" && test -n "$link_static_flag"; then
802 dlopen_self=$dlopen_self_static
803 fi
804 fi
805 build_libtool_libs=no
806 build_old_libs=yes
807 prefer_static_libs=yes
808 break
809 ;;
810 esac
811 done
812
813 # See if our shared archives depend on static archives.
814 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
815
816 # Go through the arguments, transforming them on the way.
817 while test $# -gt 0; do
818 arg="$1"
819 shift
820 case $arg in
821 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
822 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
823 ;;
824 *) qarg=$arg ;;
825 esac
826 libtool_args="$libtool_args $qarg"
827
828 # If the previous option needs an argument, assign it.
829 if test -n "$prev"; then
830 case $prev in
831 output)
832 compile_command="$compile_command @OUTPUT@"
833 finalize_command="$finalize_command @OUTPUT@"
834 ;;
835 esac
836
837 case $prev in
838 dlfiles|dlprefiles)
839 if test "$preload" = no; then
840 # Add the symbol object into the linking commands.
841 compile_command="$compile_command @SYMFILE@"
842 finalize_command="$finalize_command @SYMFILE@"
843 preload=yes
844 fi
845 case $arg in
846 *.la | *.lo) ;; # We handle these cases below.
847 force)
848 if test "$dlself" = no; then
849 dlself=needless
850 export_dynamic=yes
851 fi
852 prev=
853 continue
854 ;;
855 self)
856 if test "$prev" = dlprefiles; then
857 dlself=yes
858 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
859 dlself=yes
860 else
861 dlself=needless
862 export_dynamic=yes
863 fi
864 prev=
865 continue
866 ;;
867 *)
868 if test "$prev" = dlfiles; then
869 dlfiles="$dlfiles $arg"
870 else
871 dlprefiles="$dlprefiles $arg"
872 fi
873 prev=
874 continue
875 ;;
876 esac
877 ;;
878 expsyms)
879 export_symbols="$arg"
880 if test ! -f "$arg"; then
881 $echo "$modename: symbol file \`$arg' does not exist"
882 exit 1
883 fi
884 prev=
885 continue
886 ;;
887 expsyms_regex)
888 export_symbols_regex="$arg"
889 prev=
890 continue
891 ;;
892 release)
893 release="-$arg"
894 prev=
895 continue
896 ;;
897 rpath | xrpath)
898 # We need an absolute path.
899 case $arg in
900 [\\/]* | [A-Za-z]:[\\/]*) ;;
901 *)
902 $echo "$modename: only absolute run-paths are allowed" 1>&2
903 exit 1
904 ;;
905 esac
906 if test "$prev" = rpath; then
907 case "$rpath " in
908 *" $arg "*) ;;
909 *) rpath="$rpath $arg" ;;
910 esac
911 else
912 case "$xrpath " in
913 *" $arg "*) ;;
914 *) xrpath="$xrpath $arg" ;;
915 esac
916 fi
917 prev=
918 continue
919 ;;
920 xcompiler)
921 compiler_flags="$compiler_flags $qarg"
922 prev=
923 compile_command="$compile_command $qarg"
924 finalize_command="$finalize_command $qarg"
925 continue
926 ;;
927 xlinker)
928 linker_flags="$linker_flags $qarg"
929 compiler_flags="$compiler_flags $wl$qarg"
930 prev=
931 compile_command="$compile_command $wl$qarg"
932 finalize_command="$finalize_command $wl$qarg"
933 continue
934 ;;
935 *)
936 eval "$prev=\"\$arg\""
937 prev=
938 continue
939 ;;
940 esac
941 fi # test -n $prev
942
943 prevarg="$arg"
944
945 case $arg in
946 -all-static)
947 if test -n "$link_static_flag"; then
948 compile_command="$compile_command $link_static_flag"
949 finalize_command="$finalize_command $link_static_flag"
950 fi
951 continue
952 ;;
953
954 -allow-undefined)
955 # FIXME: remove this flag sometime in the future.
956 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
957 continue
958 ;;
959
960 -avoid-version)
961 avoid_version=yes
962 continue
963 ;;
964
965 -dlopen)
966 prev=dlfiles
967 continue
968 ;;
969
970 -dlpreopen)
971 prev=dlprefiles
972 continue
973 ;;
974
975 -export-dynamic)
976 export_dynamic=yes
977 continue
978 ;;
979
980 -export-symbols | -export-symbols-regex)
981 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
982 $echo "$modename: more than one -exported-symbols argument is not allowed"
983 exit 1
984 fi
985 if test "X$arg" = "X-export-symbols"; then
986 prev=expsyms
987 else
988 prev=expsyms_regex
989 fi
990 continue
991 ;;
992
993 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
994 # so, if we see these flags be careful not to treat them like -L
995 -L[A-Z][A-Z]*:*)
996 case $with_gcc/$host in
997 no/*-*-irix* | no/*-*-nonstopux*)
998 compile_command="$compile_command $arg"
999 finalize_command="$finalize_command $arg"
1000 ;;
1001 esac
1002 continue
1003 ;;
1004
1005 -L*)
1006 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1007 # We need an absolute path.
1008 case $dir in
1009 [\\/]* | [A-Za-z]:[\\/]*) ;;
1010 *)
1011 absdir=`cd "$dir" && pwd`
1012 if test -z "$absdir"; then
1013 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1014 exit 1
1015 fi
1016 dir="$absdir"
1017 ;;
1018 esac
1019 case "$deplibs " in
1020 *" -L$dir "*) ;;
1021 *)
1022 deplibs="$deplibs -L$dir"
1023 lib_search_path="$lib_search_path $dir"
1024 ;;
1025 esac
1026 case $host in
1027 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1028 case :$dllsearchpath: in
1029 *":$dir:"*) ;;
1030 *) dllsearchpath="$dllsearchpath:$dir";;
1031 esac
1032 ;;
1033 esac
1034 continue
1035 ;;
1036
1037 -l*)
1038 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1039 case $host in
1040 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1041 # These systems don't actually have a C or math library (as such)
1042 continue
1043 ;;
1044 *-*-mingw* | *-*-os2*)
1045 # These systems don't actually have a C library (as such)
1046 test "X$arg" = "X-lc" && continue
1047 ;;
1048 *-*-openbsd* | *-*-freebsd*)
1049 # Do not include libc due to us having libc/libc_r.
1050 test "X$arg" = "X-lc" && continue
1051 ;;
1052 esac
1053 elif test "X$arg" = "X-lc_r"; then
1054 case $host in
1055 *-*-openbsd* | *-*-freebsd*)
1056 # Do not include libc_r directly, use -pthread flag.
1057 continue
1058 ;;
1059 esac
1060 fi
1061 deplibs="$deplibs $arg"
1062 continue
1063 ;;
1064
1065 -module)
1066 module=yes
1067 continue
1068 ;;
1069
1070 -no-fast-install)
1071 fast_install=no
1072 continue
1073 ;;
1074
1075 -no-install)
1076 case $host in
1077 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1078 # The PATH hackery in wrapper scripts is required on Windows
1079 # in order for the loader to find any dlls it needs.
1080 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1081 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1082 fast_install=no
1083 ;;
1084 *) no_install=yes ;;
1085 esac
1086 continue
1087 ;;
1088
1089 -no-undefined)
1090 allow_undefined=no
1091 continue
1092 ;;
1093
1094 -o) prev=output ;;
1095
1096 -release)
1097 prev=release
1098 continue
1099 ;;
1100
1101 -rpath)
1102 prev=rpath
1103 continue
1104 ;;
1105
1106 -R)
1107 prev=xrpath
1108 continue
1109 ;;
1110
1111 -R*)
1112 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1113 # We need an absolute path.
1114 case $dir in
1115 [\\/]* | [A-Za-z]:[\\/]*) ;;
1116 *)
1117 $echo "$modename: only absolute run-paths are allowed" 1>&2
1118 exit 1
1119 ;;
1120 esac
1121 case "$xrpath " in
1122 *" $dir "*) ;;
1123 *) xrpath="$xrpath $dir" ;;
1124 esac
1125 continue
1126 ;;
1127
1128 -static)
1129 # The effects of -static are defined in a previous loop.
1130 # We used to do the same as -all-static on platforms that
1131 # didn't have a PIC flag, but the assumption that the effects
1132 # would be equivalent was wrong. It would break on at least
1133 # Digital Unix and AIX.
1134 continue
1135 ;;
1136
1137 -thread-safe)
1138 thread_safe=yes
1139 continue
1140 ;;
1141
1142 -version-info)
1143 prev=vinfo
1144 continue
1145 ;;
1146
1147 -Wc,*)
1148 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1149 arg=
1150 save_ifs="$IFS"; IFS=','
1151 for flag in $args; do
1152 IFS="$save_ifs"
1153 case $flag in
1154 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1155 flag="\"$flag\""
1156 ;;
1157 esac
1158 arg="$arg $wl$flag"
1159 compiler_flags="$compiler_flags $flag"
1160 done
1161 IFS="$save_ifs"
1162 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1163 ;;
1164
1165 -Wl,*)
1166 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1167 arg=
1168 save_ifs="$IFS"; IFS=','
1169 for flag in $args; do
1170 IFS="$save_ifs"
1171 case $flag in
1172 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1173 flag="\"$flag\""
1174 ;;
1175 esac
1176 arg="$arg $wl$flag"
1177 compiler_flags="$compiler_flags $wl$flag"
1178 linker_flags="$linker_flags $flag"
1179 done
1180 IFS="$save_ifs"
1181 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1182 ;;
1183
1184 -Xcompiler)
1185 prev=xcompiler
1186 continue
1187 ;;
1188
1189 -Xlinker)
1190 prev=xlinker
1191 continue
1192 ;;
1193
1194 # Some other compiler flag.
1195 -* | +*)
1196 # Unknown arguments in both finalize_command and compile_command need
1197 # to be aesthetically quoted because they are evaled later.
1198 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1199 case $arg in
1200 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1201 arg="\"$arg\""
1202 ;;
1203 esac
1204 ;;
1205
1206 *.lo | *.$objext)
1207 # A library or standard object.
1208 if test "$prev" = dlfiles; then
1209 # This file was specified with -dlopen.
1210 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1211 dlfiles="$dlfiles $arg"
1212 prev=
1213 continue
1214 else
1215 # If libtool objects are unsupported, then we need to preload.
1216 prev=dlprefiles
1217 fi
1218 fi
1219
1220 if test "$prev" = dlprefiles; then
1221 # Preload the old-style object.
1222 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1223 prev=
1224 else
1225 case $arg in
1226 *.lo) libobjs="$libobjs $arg" ;;
1227 *) objs="$objs $arg" ;;
1228 esac
1229 fi
1230 ;;
1231
1232 *.$libext)
1233 # An archive.
1234 deplibs="$deplibs $arg"
1235 old_deplibs="$old_deplibs $arg"
1236 continue
1237 ;;
1238
1239 *.la)
1240 # A libtool-controlled library.
1241
1242 if test "$prev" = dlfiles; then
1243 # This library was specified with -dlopen.
1244 dlfiles="$dlfiles $arg"
1245 prev=
1246 elif test "$prev" = dlprefiles; then
1247 # The library was specified with -dlpreopen.
1248 dlprefiles="$dlprefiles $arg"
1249 prev=
1250 else
1251 deplibs="$deplibs $arg"
1252 fi
1253 continue
1254 ;;
1255
1256 # Some other compiler argument.
1257 *)
1258 # Unknown arguments in both finalize_command and compile_command need
1259 # to be aesthetically quoted because they are evaled later.
1260 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1261 case $arg in
1262 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1263 arg="\"$arg\""
1264 ;;
1265 esac
1266 ;;
1267 esac # arg
1268
1269 # Now actually substitute the argument into the commands.
1270 if test -n "$arg"; then
1271 compile_command="$compile_command $arg"
1272 finalize_command="$finalize_command $arg"
1273 fi
1274 done # argument parsing loop
1275
1276 if test -n "$prev"; then
1277 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1278 $echo "$help" 1>&2
1279 exit 1
1280 fi
1281
1282 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1283 eval arg=\"$export_dynamic_flag_spec\"
1284 compile_command="$compile_command $arg"
1285 finalize_command="$finalize_command $arg"
1286 fi
1287
1288 # calculate the name of the file, without its directory
1289 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1290 libobjs_save="$libobjs"
1291
1292 if test -n "$shlibpath_var"; then
1293 # get the directories listed in $shlibpath_var
1294 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1295 else
1296 shlib_search_path=
1297 fi
1298 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1299 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1300
1301 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1302 if test "X$output_objdir" = "X$output"; then
1303 output_objdir="$objdir"
1304 else
1305 output_objdir="$output_objdir/$objdir"
1306 fi
1307 # Create the object directory.
1308 if test ! -d $output_objdir; then
1309 $show "$mkdir $output_objdir"
1310 $run $mkdir $output_objdir
1311 status=$?
1312 if test $status -ne 0 && test ! -d $output_objdir; then
1313 exit $status
1314 fi
1315 fi
1316
1317 # Determine the type of output
1318 case $output in
1319 "")
1320 $echo "$modename: you must specify an output file" 1>&2
1321 $echo "$help" 1>&2
1322 exit 1
1323 ;;
1324 *.$libext) linkmode=oldlib ;;
1325 *.lo | *.$objext) linkmode=obj ;;
1326 *.la) linkmode=lib ;;
1327 *) linkmode=prog ;; # Anything else should be a program.
1328 esac
1329
1330 specialdeplibs=
1331 libs=
1332 # Find all interdependent deplibs by searching for libraries
1333 # that are linked more than once (e.g. -la -lb -la)
1334 for deplib in $deplibs; do
1335 if test "X$duplicate_deps" = "Xyes" ; then
1336 case "$libs " in
1337 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1338 esac
1339 fi
1340 libs="$libs $deplib"
1341 done
1342 deplibs=
1343 newdependency_libs=
1344 newlib_search_path=
1345 need_relink=no # whether we're linking any uninstalled libtool libraries
1346 notinst_deplibs= # not-installed libtool libraries
1347 notinst_path= # paths that contain not-installed libtool libraries
1348 case $linkmode in
1349 lib)
1350 passes="conv link"
1351 for file in $dlfiles $dlprefiles; do
1352 case $file in
1353 *.la) ;;
1354 *)
1355 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1356 exit 1
1357 ;;
1358 esac
1359 done
1360 ;;
1361 prog)
1362 compile_deplibs=
1363 finalize_deplibs=
1364 alldeplibs=no
1365 newdlfiles=
1366 newdlprefiles=
1367 passes="conv scan dlopen dlpreopen link"
1368 ;;
1369 *) passes="conv"
1370 ;;
1371 esac
1372 for pass in $passes; do
1373 if test $linkmode = prog; then
1374 # Determine which files to process
1375 case $pass in
1376 dlopen)
1377 libs="$dlfiles"
1378 save_deplibs="$deplibs" # Collect dlpreopened libraries
1379 deplibs=
1380 ;;
1381 dlpreopen) libs="$dlprefiles" ;;
1382 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1383 esac
1384 fi
1385 for deplib in $libs; do
1386 lib=
1387 found=no
1388 case $deplib in
1389 -l*)
1390 if test $linkmode = oldlib && test $linkmode = obj; then
1391 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1392 continue
1393 fi
1394 if test $pass = conv; then
1395 deplibs="$deplib $deplibs"
1396 continue
1397 fi
1398 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1399 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1400 # Search the libtool library
1401 lib="$searchdir/lib${name}.la"
1402 if test -f "$lib"; then
1403 found=yes
1404 break
1405 fi
1406 done
1407 if test "$found" != yes; then
1408 # deplib doesn't seem to be a libtool library
1409 if test "$linkmode,$pass" = "prog,link"; then
1410 compile_deplibs="$deplib $compile_deplibs"
1411 finalize_deplibs="$deplib $finalize_deplibs"
1412 else
1413 deplibs="$deplib $deplibs"
1414 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1415 fi
1416 continue
1417 fi
1418 ;; # -l
1419 -L*)
1420 case $linkmode in
1421 lib)
1422 deplibs="$deplib $deplibs"
1423 test $pass = conv && continue
1424 newdependency_libs="$deplib $newdependency_libs"
1425 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1426 ;;
1427 prog)
1428 if test $pass = conv; then
1429 deplibs="$deplib $deplibs"
1430 continue
1431 fi
1432 if test $pass = scan; then
1433 deplibs="$deplib $deplibs"
1434 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1435 else
1436 compile_deplibs="$deplib $compile_deplibs"
1437 finalize_deplibs="$deplib $finalize_deplibs"
1438 fi
1439 ;;
1440 *)
1441 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1442 ;;
1443 esac # linkmode
1444 continue
1445 ;; # -L
1446 -R*)
1447 if test $pass = link; then
1448 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1449 # Make sure the xrpath contains only unique directories.
1450 case "$xrpath " in
1451 *" $dir "*) ;;
1452 *) xrpath="$xrpath $dir" ;;
1453 esac
1454 fi
1455 deplibs="$deplib $deplibs"
1456 continue
1457 ;;
1458 *.la) lib="$deplib" ;;
1459 *.$libext)
1460 if test $pass = conv; then
1461 deplibs="$deplib $deplibs"
1462 continue
1463 fi
1464 case $linkmode in
1465 lib)
1466 if test "$deplibs_check_method" != pass_all; then
1467 echo
1468 echo "*** Warning: Trying to link with static lib archive $deplib."
1469 echo "*** I have the capability to make that library automatically link in when"
1470 echo "*** you link to this library. But I can only do this if you have a"
1471 echo "*** shared version of the library, which you do not appear to have"
1472 echo "*** because the file extensions .$libext of this argument makes me believe"
1473 echo "*** that it is just a static archive that I should not used here."
1474 else
1475 echo
1476 echo "*** Warning: Linking the shared library $output against the"
1477 echo "*** static library $deplib is not portable!"
1478 deplibs="$deplib $deplibs"
1479 fi
1480 continue
1481 ;;
1482 prog)
1483 if test $pass != link; then
1484 deplibs="$deplib $deplibs"
1485 else
1486 compile_deplibs="$deplib $compile_deplibs"
1487 finalize_deplibs="$deplib $finalize_deplibs"
1488 fi
1489 continue
1490 ;;
1491 esac # linkmode
1492 ;; # *.$libext
1493 *.lo | *.$objext)
1494 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1495 # If there is no dlopen support or we're linking statically,
1496 # we need to preload.
1497 newdlprefiles="$newdlprefiles $deplib"
1498 compile_deplibs="$deplib $compile_deplibs"
1499 finalize_deplibs="$deplib $finalize_deplibs"
1500 else
1501 newdlfiles="$newdlfiles $deplib"
1502 fi
1503 continue
1504 ;;
1505 %DEPLIBS%)
1506 alldeplibs=yes
1507 continue
1508 ;;
1509 esac # case $deplib
1510 if test $found = yes || test -f "$lib"; then :
1511 else
1512 $echo "$modename: cannot find the library \`$lib'" 1>&2
1513 exit 1
1514 fi
1515
1516 # Check to see that this really is a libtool archive.
1517 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1518 else
1519 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1520 exit 1
1521 fi
1522
1523 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1524 test "X$ladir" = "X$lib" && ladir="."
1525
1526 dlname=
1527 dlopen=
1528 dlpreopen=
1529 libdir=
1530 library_names=
1531 old_library=
1532 # If the library was installed with an old release of libtool,
1533 # it will not redefine variable installed.
1534 installed=yes
1535
1536 # Read the .la file
1537 case $lib in
1538 */* | *\\*) . $lib ;;
1539 *) . ./$lib ;;
1540 esac
1541
1542 if test "$linkmode,$pass" = "lib,link" ||
1543 test "$linkmode,$pass" = "prog,scan" ||
1544 { test $linkmode = oldlib && test $linkmode = obj; }; then
1545 # Add dl[pre]opened files of deplib
1546 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1547 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1548 fi
1549
1550 if test $pass = conv; then
1551 # Only check for convenience libraries
1552 deplibs="$lib $deplibs"
1553 if test -z "$libdir"; then
1554 if test -z "$old_library"; then
1555 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1556 exit 1
1557 fi
1558 # It is a libtool convenience library, so add in its objects.
1559 convenience="$convenience $ladir/$objdir/$old_library"
1560 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1561 tmp_libs=
1562 for deplib in $dependency_libs; do
1563 deplibs="$deplib $deplibs"
1564 if test "X$duplicate_deps" = "Xyes" ; then
1565 case "$tmp_libs " in
1566 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1567 esac
1568 fi
1569 tmp_libs="$tmp_libs $deplib"
1570 done
1571 elif test $linkmode != prog && test $linkmode != lib; then
1572 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1573 exit 1
1574 fi
1575 continue
1576 fi # $pass = conv
1577
1578 # Get the name of the library we link against.
1579 linklib=
1580 for l in $old_library $library_names; do
1581 linklib="$l"
1582 done
1583 if test -z "$linklib"; then
1584 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1585 exit 1
1586 fi
1587
1588 # This library was specified with -dlopen.
1589 if test $pass = dlopen; then
1590 if test -z "$libdir"; then
1591 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1592 exit 1
1593 fi
1594 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1595 # If there is no dlname, no dlopen support or we're linking
1596 # statically, we need to preload.
1597 dlprefiles="$dlprefiles $lib"
1598 else
1599 newdlfiles="$newdlfiles $lib"
1600 fi
1601 continue
1602 fi # $pass = dlopen
1603
1604 # We need an absolute path.
1605 case $ladir in
1606 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1607 *)
1608 abs_ladir=`cd "$ladir" && pwd`
1609 if test -z "$abs_ladir"; then
1610 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1611 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1612 abs_ladir="$ladir"
1613 fi
1614 ;;
1615 esac
1616 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1617
1618 # Find the relevant object directory and library name.
1619 if test "X$installed" = Xyes; then
1620 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1621 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1622 dir="$ladir"
1623 absdir="$abs_ladir"
1624 libdir="$abs_ladir"
1625 else
1626 dir="$libdir"
1627 absdir="$libdir"
1628 fi
1629 else
1630 dir="$ladir/$objdir"
1631 absdir="$abs_ladir/$objdir"
1632 # Remove this search path later
1633 notinst_path="$notinst_path $abs_ladir"
1634 fi # $installed = yes
1635 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1636
1637 # This library was specified with -dlpreopen.
1638 if test $pass = dlpreopen; then
1639 if test -z "$libdir"; then
1640 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1641 exit 1
1642 fi
1643 # Prefer using a static library (so that no silly _DYNAMIC symbols
1644 # are required to link).
1645 if test -n "$old_library"; then
1646 newdlprefiles="$newdlprefiles $dir/$old_library"
1647 # Otherwise, use the dlname, so that lt_dlopen finds it.
1648 elif test -n "$dlname"; then
1649 newdlprefiles="$newdlprefiles $dir/$dlname"
1650 else
1651 newdlprefiles="$newdlprefiles $dir/$linklib"
1652 fi
1653 fi # $pass = dlpreopen
1654
1655 if test -z "$libdir"; then
1656 # Link the convenience library
1657 if test $linkmode = lib; then
1658 deplibs="$dir/$old_library $deplibs"
1659 elif test "$linkmode,$pass" = "prog,link"; then
1660 compile_deplibs="$dir/$old_library $compile_deplibs"
1661 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1662 else
1663 deplibs="$lib $deplibs"
1664 fi
1665 continue
1666 fi
1667
1668 if test $linkmode = prog && test $pass != link; then
1669 newlib_search_path="$newlib_search_path $ladir"
1670 deplibs="$lib $deplibs"
1671
1672 linkalldeplibs=no
1673 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1674 test "$build_libtool_libs" = no; then
1675 linkalldeplibs=yes
1676 fi
1677
1678 tmp_libs=
1679 for deplib in $dependency_libs; do
1680 case $deplib in
1681 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1682 esac
1683 # Need to link against all dependency_libs?
1684 if test $linkalldeplibs = yes; then
1685 deplibs="$deplib $deplibs"
1686 else
1687 # Need to hardcode shared library paths
1688 # or/and link against static libraries
1689 newdependency_libs="$deplib $newdependency_libs"
1690 fi
1691 if test "X$duplicate_deps" = "Xyes" ; then
1692 case "$tmp_libs " in
1693 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1694 esac
1695 fi
1696 tmp_libs="$tmp_libs $deplib"
1697 done # for deplib
1698 continue
1699 fi # $linkmode = prog...
1700
1701 link_static=no # Whether the deplib will be linked statically
1702 if test -n "$library_names" &&
1703 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1704 # Link against this shared library
1705
1706 if test "$linkmode,$pass" = "prog,link" ||
1707 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1708 # Hardcode the library path.
1709 # Skip directories that are in the system default run-time
1710 # search path.
1711 case " $sys_lib_dlsearch_path " in
1712 *" $absdir "*) ;;
1713 *)
1714 case "$compile_rpath " in
1715 *" $absdir "*) ;;
1716 *) compile_rpath="$compile_rpath $absdir"
1717 esac
1718 ;;
1719 esac
1720 case " $sys_lib_dlsearch_path " in
1721 *" $libdir "*) ;;
1722 *)
1723 case "$finalize_rpath " in
1724 *" $libdir "*) ;;
1725 *) finalize_rpath="$finalize_rpath $libdir"
1726 esac
1727 ;;
1728 esac
1729 if test $linkmode = prog; then
1730 # We need to hardcode the library path
1731 if test -n "$shlibpath_var"; then
1732 # Make sure the rpath contains only unique directories.
1733 case "$temp_rpath " in
1734 *" $dir "*) ;;
1735 *" $absdir "*) ;;
1736 *) temp_rpath="$temp_rpath $dir" ;;
1737 esac
1738 fi
1739 fi
1740 fi # $linkmode,$pass = prog,link...
1741
1742 if test "$alldeplibs" = yes &&
1743 { test "$deplibs_check_method" = pass_all ||
1744 { test "$build_libtool_libs" = yes &&
1745 test -n "$library_names"; }; }; then
1746 # We only need to search for static libraries
1747 continue
1748 fi
1749
1750 if test "$installed" = no; then
1751 notinst_deplibs="$notinst_deplibs $lib"
1752 need_relink=yes
1753 fi
1754
1755 if test -n "$old_archive_from_expsyms_cmds"; then
1756 # figure out the soname
1757 set dummy $library_names
1758 realname="$2"
1759 shift; shift
1760 libname=`eval \\$echo \"$libname_spec\"`
1761 # use dlname if we got it. it's perfectly good, no?
1762 if test -n "$dlname"; then
1763 soname="$dlname"
1764 elif test -n "$soname_spec"; then
1765 # bleh windows
1766 case $host in
1767 *cygwin*)
1768 major=`expr $current - $age`
1769 versuffix="-$major"
1770 ;;
1771 esac
1772 eval soname=\"$soname_spec\"
1773 else
1774 soname="$realname"
1775 fi
1776
1777 # Make a new name for the extract_expsyms_cmds to use
1778 soroot="$soname"
1779 soname=`echo $soroot | sed -e 's/^.*\///'`
1780 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1781
1782 # If the library has no export list, then create one now
1783 if test -f "$output_objdir/$soname-def"; then :
1784 else
1785 $show "extracting exported symbol list from \`$soname'"
1786 save_ifs="$IFS"; IFS='~'
1787 eval cmds=\"$extract_expsyms_cmds\"
1788 for cmd in $cmds; do
1789 IFS="$save_ifs"
1790 $show "$cmd"
1791 $run eval "$cmd" || exit $?
1792 done
1793 IFS="$save_ifs"
1794 fi
1795
1796 # Create $newlib
1797 if test -f "$output_objdir/$newlib"; then :; else
1798 $show "generating import library for \`$soname'"
1799 save_ifs="$IFS"; IFS='~'
1800 eval cmds=\"$old_archive_from_expsyms_cmds\"
1801 for cmd in $cmds; do
1802 IFS="$save_ifs"
1803 $show "$cmd"
1804 $run eval "$cmd" || exit $?
1805 done
1806 IFS="$save_ifs"
1807 fi
1808 # make sure the library variables are pointing to the new library
1809 dir=$output_objdir
1810 linklib=$newlib
1811 fi # test -n $old_archive_from_expsyms_cmds
1812
1813 if test $linkmode = prog || test "$mode" != relink; then
1814 add_shlibpath=
1815 add_dir=
1816 add=
1817 lib_linked=yes
1818 case $hardcode_action in
1819 immediate | unsupported)
1820 if test "$hardcode_direct" = no; then
1821 add="$dir/$linklib"
1822 elif test "$hardcode_minus_L" = no; then
1823 case $host in
1824 *-*-sunos*) add_shlibpath="$dir" ;;
1825 esac
1826 add_dir="-L$dir"
1827 add="-l$name"
1828 elif test "$hardcode_shlibpath_var" = no; then
1829 add_shlibpath="$dir"
1830 add="-l$name"
1831 else
1832 lib_linked=no
1833 fi
1834 ;;
1835 relink)
1836 if test "$hardcode_direct" = yes; then
1837 add="$dir/$linklib"
1838 elif test "$hardcode_minus_L" = yes; then
1839 add_dir="-L$dir"
1840 add="-l$name"
1841 elif test "$hardcode_shlibpath_var" = yes; then
1842 add_shlibpath="$dir"
1843 add="-l$name"
1844 else
1845 lib_linked=no
1846 fi
1847 ;;
1848 *) lib_linked=no ;;
1849 esac
1850
1851 if test "$lib_linked" != yes; then
1852 $echo "$modename: configuration error: unsupported hardcode properties"
1853 exit 1
1854 fi
1855
1856 if test -n "$add_shlibpath"; then
1857 case :$compile_shlibpath: in
1858 *":$add_shlibpath:"*) ;;
1859 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1860 esac
1861 fi
1862 if test $linkmode = prog; then
1863 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1864 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1865 else
1866 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1867 test -n "$add" && deplibs="$add $deplibs"
1868 if test "$hardcode_direct" != yes && \
1869 test "$hardcode_minus_L" != yes && \
1870 test "$hardcode_shlibpath_var" = yes; then
1871 case :$finalize_shlibpath: in
1872 *":$libdir:"*) ;;
1873 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1874 esac
1875 fi
1876 fi
1877 fi
1878
1879 if test $linkmode = prog || test "$mode" = relink; then
1880 add_shlibpath=
1881 add_dir=
1882 add=
1883 # Finalize command for both is simple: just hardcode it.
1884 if test "$hardcode_direct" = yes; then
1885 add="$libdir/$linklib"
1886 elif test "$hardcode_minus_L" = yes; then
1887 add_dir="-L$libdir"
1888 add="-l$name"
1889 elif test "$hardcode_shlibpath_var" = yes; then
1890 case :$finalize_shlibpath: in
1891 *":$libdir:"*) ;;
1892 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1893 esac
1894 add="-l$name"
1895 else
1896 # We cannot seem to hardcode it, guess we'll fake it.
1897 add_dir="-L$libdir"
1898 add="-l$name"
1899 fi
1900
1901 if test $linkmode = prog; then
1902 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1903 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1904 else
1905 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1906 test -n "$add" && deplibs="$add $deplibs"
1907 fi
1908 fi
1909 elif test $linkmode = prog; then
1910 if test "$alldeplibs" = yes &&
1911 { test "$deplibs_check_method" = pass_all ||
1912 { test "$build_libtool_libs" = yes &&
1913 test -n "$library_names"; }; }; then
1914 # We only need to search for static libraries
1915 continue
1916 fi
1917
1918 # Try to link the static library
1919 # Here we assume that one of hardcode_direct or hardcode_minus_L
1920 # is not unsupported. This is valid on all known static and
1921 # shared platforms.
1922 if test "$hardcode_direct" != unsupported; then
1923 test -n "$old_library" && linklib="$old_library"
1924 compile_deplibs="$dir/$linklib $compile_deplibs"
1925 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1926 else
1927 compile_deplibs="-l$name -L$dir $compile_deplibs"
1928 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1929 fi
1930 elif test "$build_libtool_libs" = yes; then
1931 # Not a shared library
1932 if test "$deplibs_check_method" != pass_all; then
1933 # We're trying link a shared library against a static one
1934 # but the system doesn't support it.
1935
1936 # Just print a warning and add the library to dependency_libs so
1937 # that the program can be linked against the static library.
1938 echo
1939 echo "*** Warning: This system can not link to static lib archive $lib."
1940 echo "*** I have the capability to make that library automatically link in when"
1941 echo "*** you link to this library. But I can only do this if you have a"
1942 echo "*** shared version of the library, which you do not appear to have."
1943 if test "$module" = yes; then
1944 echo "*** But as you try to build a module library, libtool will still create "
1945 echo "*** a static module, that should work as long as the dlopening application"
1946 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1947 if test -z "$global_symbol_pipe"; then
1948 echo
1949 echo "*** However, this would only work if libtool was able to extract symbol"
1950 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1951 echo "*** not find such a program. So, this module is probably useless."
1952 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1953 fi
1954 if test "$build_old_libs" = no; then
1955 build_libtool_libs=module
1956 build_old_libs=yes
1957 else
1958 build_libtool_libs=no
1959 fi
1960 fi
1961 else
1962 convenience="$convenience $dir/$old_library"
1963 old_convenience="$old_convenience $dir/$old_library"
1964 deplibs="$dir/$old_library $deplibs"
1965 link_static=yes
1966 fi
1967 fi # link shared/static library?
1968
1969 if test $linkmode = lib; then
1970 if test -n "$dependency_libs" &&
1971 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1972 test $link_static = yes; }; then
1973 # Extract -R from dependency_libs
1974 temp_deplibs=
1975 for libdir in $dependency_libs; do
1976 case $libdir in
1977 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1978 case " $xrpath " in
1979 *" $temp_xrpath "*) ;;
1980 *) xrpath="$xrpath $temp_xrpath";;
1981 esac;;
1982 *) temp_deplibs="$temp_deplibs $libdir";;
1983 esac
1984 done
1985 dependency_libs="$temp_deplibs"
1986 fi
1987
1988 newlib_search_path="$newlib_search_path $absdir"
1989 # Link against this library
1990 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1991 # ... and its dependency_libs
1992 tmp_libs=
1993 for deplib in $dependency_libs; do
1994 newdependency_libs="$deplib $newdependency_libs"
1995 if test "X$duplicate_deps" = "Xyes" ; then
1996 case "$tmp_libs " in
1997 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1998 esac
1999 fi
2000 tmp_libs="$tmp_libs $deplib"
2001 done
2002
2003 if test $link_all_deplibs != no; then
2004 # Add the search paths of all dependency libraries
2005 for deplib in $dependency_libs; do
2006 case $deplib in
2007 -L*) path="$deplib" ;;
2008 *.la)
2009 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2010 test "X$dir" = "X$deplib" && dir="."
2011 # We need an absolute path.
2012 case $dir in
2013 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2014 *)
2015 absdir=`cd "$dir" && pwd`
2016 if test -z "$absdir"; then
2017 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2018 absdir="$dir"
2019 fi
2020 ;;
2021 esac
2022 if grep "^installed=no" $deplib > /dev/null; then
2023 path="-L$absdir/$objdir"
2024 else
2025 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2026 if test -z "$libdir"; then
2027 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2028 exit 1
2029 fi
2030 if test "$absdir" != "$libdir"; then
2031 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2032 fi
2033 path="-L$absdir"
2034 fi
2035 ;;
2036 *) continue ;;
2037 esac
2038 case " $deplibs " in
2039 *" $path "*) ;;
2040 *) deplibs="$deplibs $path" ;;
2041 esac
2042 done
2043 fi # link_all_deplibs != no
2044 fi # linkmode = lib
2045 done # for deplib in $libs
2046 if test $pass = dlpreopen; then
2047 # Link the dlpreopened libraries before other libraries
2048 for deplib in $save_deplibs; do
2049 deplibs="$deplib $deplibs"
2050 done
2051 fi
2052 if test $pass != dlopen; then
2053 test $pass != scan && dependency_libs="$newdependency_libs"
2054 if test $pass != conv; then
2055 # Make sure lib_search_path contains only unique directories.
2056 lib_search_path=
2057 for dir in $newlib_search_path; do
2058 case "$lib_search_path " in
2059 *" $dir "*) ;;
2060 *) lib_search_path="$lib_search_path $dir" ;;
2061 esac
2062 done
2063 newlib_search_path=
2064 fi
2065
2066 if test "$linkmode,$pass" != "prog,link"; then
2067 vars="deplibs"
2068 else
2069 vars="compile_deplibs finalize_deplibs"
2070 fi
2071 for var in $vars dependency_libs; do
2072 # Add libraries to $var in reverse order
2073 eval tmp_libs=\"\$$var\"
2074 new_libs=
2075 for deplib in $tmp_libs; do
2076 case $deplib in
2077 -L*) new_libs="$deplib $new_libs" ;;
2078 *)
2079 case " $specialdeplibs " in
2080 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2081 *)
2082 case " $new_libs " in
2083 *" $deplib "*) ;;
2084 *) new_libs="$deplib $new_libs" ;;
2085 esac
2086 ;;
2087 esac
2088 ;;
2089 esac
2090 done
2091 tmp_libs=
2092 for deplib in $new_libs; do
2093 case $deplib in
2094 -L*)
2095 case " $tmp_libs " in
2096 *" $deplib "*) ;;
2097 *) tmp_libs="$tmp_libs $deplib" ;;
2098 esac
2099 ;;
2100 *) tmp_libs="$tmp_libs $deplib" ;;
2101 esac
2102 done
2103 eval $var=\"$tmp_libs\"
2104 done # for var
2105 fi
2106 if test "$pass" = "conv" &&
2107 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2108 libs="$deplibs" # reset libs
2109 deplibs=
2110 fi
2111 done # for pass
2112 if test $linkmode = prog; then
2113 dlfiles="$newdlfiles"
2114 dlprefiles="$newdlprefiles"
2115 fi
2116
2117 case $linkmode in
2118 oldlib)
2119 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2120 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2121 fi
2122
2123 if test -n "$rpath"; then
2124 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2125 fi
2126
2127 if test -n "$xrpath"; then
2128 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2129 fi
2130
2131 if test -n "$vinfo"; then
2132 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2133 fi
2134
2135 if test -n "$release"; then
2136 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2137 fi
2138
2139 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2140 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2141 fi
2142
2143 # Now set the variables for building old libraries.
2144 build_libtool_libs=no
2145 oldlibs="$output"
2146 objs="$objs$old_deplibs"
2147 ;;
2148
2149 lib)
2150 # Make sure we only generate libraries of the form `libNAME.la'.
2151 case $outputname in
2152 lib*)
2153 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2154 eval libname=\"$libname_spec\"
2155 ;;
2156 *)
2157 if test "$module" = no; then
2158 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2159 $echo "$help" 1>&2
2160 exit 1
2161 fi
2162 if test "$need_lib_prefix" != no; then
2163 # Add the "lib" prefix for modules if required
2164 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2165 eval libname=\"$libname_spec\"
2166 else
2167 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2168 fi
2169 ;;
2170 esac
2171
2172 if test -n "$objs"; then
2173 if test "$deplibs_check_method" != pass_all; then
2174 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2175 exit 1
2176 else
2177 echo
2178 echo "*** Warning: Linking the shared library $output against the non-libtool"
2179 echo "*** objects $objs is not portable!"
2180 libobjs="$libobjs $objs"
2181 fi
2182 fi
2183
2184 if test "$dlself" != no; then
2185 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2186 fi
2187
2188 set dummy $rpath
2189 if test $# -gt 2; then
2190 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2191 fi
2192 install_libdir="$2"
2193
2194 oldlibs=
2195 if test -z "$rpath"; then
2196 if test "$build_libtool_libs" = yes; then
2197 # Building a libtool convenience library.
2198 libext=al
2199 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2200 build_libtool_libs=convenience
2201 build_old_libs=yes
2202 fi
2203
2204 if test -n "$vinfo"; then
2205 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2206 fi
2207
2208 if test -n "$release"; then
2209 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2210 fi
2211 else
2212
2213 # Parse the version information argument.
2214 save_ifs="$IFS"; IFS=':'
2215 set dummy $vinfo 0 0 0
2216 IFS="$save_ifs"
2217
2218 if test -n "$8"; then
2219 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2220 $echo "$help" 1>&2
2221 exit 1
2222 fi
2223
2224 current="$2"
2225 revision="$3"
2226 age="$4"
2227
2228 # Check that each of the things are valid numbers.
2229 case $current in
2230 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2231 *)
2232 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2233 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2234 exit 1
2235 ;;
2236 esac
2237
2238 case $revision in
2239 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2240 *)
2241 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2242 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2243 exit 1
2244 ;;
2245 esac
2246
2247 case $age in
2248 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2249 *)
2250 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2251 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2252 exit 1
2253 ;;
2254 esac
2255
2256 if test $age -gt $current; then
2257 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2258 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2259 exit 1
2260 fi
2261
2262 # Calculate the version variables.
2263 major=
2264 versuffix=
2265 verstring=
2266 case $version_type in
2267 none) ;;
2268
2269 darwin)
2270 # Like Linux, but with the current version available in
2271 # verstring for coding it into the library header
2272 major=.`expr $current - $age`
2273 versuffix="$major.$age.$revision"
2274 # Darwin ld doesn't like 0 for these options...
2275 minor_current=`expr $current + 1`
2276 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2277 ;;
2278
2279 freebsd-aout)
2280 major=".$current"
2281 versuffix=".$current.$revision";
2282 ;;
2283
2284 freebsd-elf)
2285 major=".$current"
2286 versuffix=".$current";
2287 ;;
2288
2289 irix | nonstopux)
2290 case $version_type in
2291 nonstopux) verstring_prefix=nonstopux ;;
2292 *) verstring_prefix=sgi ;;
2293 esac
2294 verstring="$verstring_prefix$major.$revision"
2295
2296 major=`expr $current - $age + 1`
2297
2298 # Add in all the interfaces that we are compatible with.
2299 loop=$revision
2300 while test $loop != 0; do
2301 iface=`expr $revision - $loop`
2302 loop=`expr $loop - 1`
2303 verstring="$verstring_prefix$major.$iface:$verstring"
2304 done
2305
2306 # Before this point, $major must not contain `.'.
2307 major=.$major
2308 versuffix="$major.$revision"
2309 ;;
2310
2311 linux)
2312 major=.`expr $current - $age`
2313 versuffix="$major.$age.$revision"
2314 ;;
2315
2316 osf)
2317 major=`expr $current - $age`
2318 versuffix=".$current.$age.$revision"
2319 verstring="$current.$age.$revision"
2320
2321 # Add in all the interfaces that we are compatible with.
2322 loop=$age
2323 while test $loop != 0; do
2324 iface=`expr $current - $loop`
2325 loop=`expr $loop - 1`
2326 verstring="$verstring:${iface}.0"
2327 done
2328
2329 # Make executables depend on our current version.
2330 verstring="$verstring:${current}.0"
2331 ;;
2332
2333 sunos)
2334 major=".$current"
2335 versuffix=".$current.$revision"
2336 ;;
2337
2338 windows)
2339 # Use '-' rather than '.', since we only want one
2340 # extension on DOS 8.3 filesystems.
2341 major=`expr $current - $age`
2342 versuffix="-$major"
2343 ;;
2344
2345 *)
2346 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2347 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2348 exit 1
2349 ;;
2350 esac
2351
2352 # Clear the version info if we defaulted, and they specified a release.
2353 if test -z "$vinfo" && test -n "$release"; then
2354 major=
2355 verstring="0.0"
2356 case $version_type in
2357 darwin)
2358 # we can't check for "0.0" in archive_cmds due to quoting
2359 # problems, so we reset it completely
2360 verstring=""
2361 ;;
2362 *)
2363 verstring="0.0"
2364 ;;
2365 esac
2366 if test "$need_version" = no; then
2367 versuffix=
2368 else
2369 versuffix=".0.0"
2370 fi
2371 fi
2372
2373 # Remove version info from name if versioning should be avoided
2374 if test "$avoid_version" = yes && test "$need_version" = no; then
2375 major=
2376 versuffix=
2377 verstring=""
2378 fi
2379
2380 # Check to see if the archive will have undefined symbols.
2381 if test "$allow_undefined" = yes; then
2382 if test "$allow_undefined_flag" = unsupported; then
2383 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2384 build_libtool_libs=no
2385 build_old_libs=yes
2386 fi
2387 else
2388 # Don't allow undefined symbols.
2389 allow_undefined_flag="$no_undefined_flag"
2390 fi
2391 fi
2392
2393 if test "$mode" != relink; then
2394 # Remove our outputs.
2395 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2396 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2397 fi
2398
2399 # Now set the variables for building old libraries.
2400 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2401 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2402
2403 # Transform .lo files to .o files.
2404 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2405 fi
2406
2407 # Eliminate all temporary directories.
2408 for path in $notinst_path; do
2409 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2410 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2411 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2412 done
2413
2414 if test -n "$xrpath"; then
2415 # If the user specified any rpath flags, then add them.
2416 temp_xrpath=
2417 for libdir in $xrpath; do
2418 temp_xrpath="$temp_xrpath -R$libdir"
2419 case "$finalize_rpath " in
2420 *" $libdir "*) ;;
2421 *) finalize_rpath="$finalize_rpath $libdir" ;;
2422 esac
2423 done
2424 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2425 dependency_libs="$temp_xrpath $dependency_libs"
2426 fi
2427 fi
2428
2429 # Make sure dlfiles contains only unique files that won't be dlpreopened
2430 old_dlfiles="$dlfiles"
2431 dlfiles=
2432 for lib in $old_dlfiles; do
2433 case " $dlprefiles $dlfiles " in
2434 *" $lib "*) ;;
2435 *) dlfiles="$dlfiles $lib" ;;
2436 esac
2437 done
2438
2439 # Make sure dlprefiles contains only unique files
2440 old_dlprefiles="$dlprefiles"
2441 dlprefiles=
2442 for lib in $old_dlprefiles; do
2443 case "$dlprefiles " in
2444 *" $lib "*) ;;
2445 *) dlprefiles="$dlprefiles $lib" ;;
2446 esac
2447 done
2448
2449 if test "$build_libtool_libs" = yes; then
2450 if test -n "$rpath"; then
2451 case $host in
2452 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2453 # these systems don't actually have a c library (as such)!
2454 ;;
2455 *-*-rhapsody* | *-*-darwin1.[012])
2456 # Rhapsody C library is in the System framework
2457 deplibs="$deplibs -framework System"
2458 ;;
2459 *-*-netbsd*)
2460 # Don't link with libc until the a.out ld.so is fixed.
2461 ;;
2462 *-*-openbsd* | *-*-freebsd*)
2463 # Do not include libc due to us having libc/libc_r.
2464 ;;
2465 *)
2466 # Add libc to deplibs on all other systems if necessary.
2467 if test $build_libtool_need_lc = "yes"; then
2468 deplibs="$deplibs -lc"
2469 fi
2470 ;;
2471 esac
2472 fi
2473
2474 # Transform deplibs into only deplibs that can be linked in shared.
2475 name_save=$name
2476 libname_save=$libname
2477 release_save=$release
2478 versuffix_save=$versuffix
2479 major_save=$major
2480 # I'm not sure if I'm treating the release correctly. I think
2481 # release should show up in the -l (ie -lgmp5) so we don't want to
2482 # add it in twice. Is that correct?
2483 release=""
2484 versuffix=""
2485 major=""
2486 newdeplibs=
2487 droppeddeps=no
2488 case $deplibs_check_method in
2489 pass_all)
2490 # Don't check for shared/static. Everything works.
2491 # This might be a little naive. We might want to check
2492 # whether the library exists or not. But this is on
2493 # osf3 & osf4 and I'm not really sure... Just
2494 # implementing what was already the behaviour.
2495 newdeplibs=$deplibs
2496 ;;
2497 test_compile)
2498 # This code stresses the "libraries are programs" paradigm to its
2499 # limits. Maybe even breaks it. We compile a program, linking it
2500 # against the deplibs as a proxy for the library. Then we can check
2501 # whether they linked in statically or dynamically with ldd.
2502 $rm conftest.c
2503 cat > conftest.c <<EOF
2504 int main() { return 0; }
2505EOF
2506 $rm conftest
2507 $CC -o conftest conftest.c $deplibs
2508 if test $? -eq 0 ; then
2509 ldd_output=`ldd conftest`
2510 for i in $deplibs; do
2511 name="`expr $i : '-l\(.*\)'`"
2512 # If $name is empty we are operating on a -L argument.
2513 if test -n "$name" && test "$name" != "0"; then
2514 libname=`eval \\$echo \"$libname_spec\"`
2515 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2516 set dummy $deplib_matches
2517 deplib_match=$2
2518 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2519 newdeplibs="$newdeplibs $i"
2520 else
2521 droppeddeps=yes
2522 echo
2523 echo "*** Warning: dynamic linker does not accept needed library $i."
2524 echo "*** I have the capability to make that library automatically link in when"
2525 echo "*** you link to this library. But I can only do this if you have a"
2526 echo "*** shared version of the library, which I believe you do not have"
2527 echo "*** because a test_compile did reveal that the linker did not use it for"
2528 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2529 fi
2530 else
2531 newdeplibs="$newdeplibs $i"
2532 fi
2533 done
2534 else
2535 # Error occured in the first compile. Let's try to salvage
2536 # the situation: Compile a separate program for each library.
2537 for i in $deplibs; do
2538 name="`expr $i : '-l\(.*\)'`"
2539 # If $name is empty we are operating on a -L argument.
2540 if test -n "$name" && test "$name" != "0"; then
2541 $rm conftest
2542 $CC -o conftest conftest.c $i
2543 # Did it work?
2544 if test $? -eq 0 ; then
2545 ldd_output=`ldd conftest`
2546 libname=`eval \\$echo \"$libname_spec\"`
2547 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2548 set dummy $deplib_matches
2549 deplib_match=$2
2550 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2551 newdeplibs="$newdeplibs $i"
2552 else
2553 droppeddeps=yes
2554 echo
2555 echo "*** Warning: dynamic linker does not accept needed library $i."
2556 echo "*** I have the capability to make that library automatically link in when"
2557 echo "*** you link to this library. But I can only do this if you have a"
2558 echo "*** shared version of the library, which you do not appear to have"
2559 echo "*** because a test_compile did reveal that the linker did not use this one"
2560 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2561 fi
2562 else
2563 droppeddeps=yes
2564 echo
2565 echo "*** Warning! Library $i is needed by this library but I was not able to"
2566 echo "*** make it link in! You will probably need to install it or some"
2567 echo "*** library that it depends on before this library will be fully"
2568 echo "*** functional. Installing it before continuing would be even better."
2569 fi
2570 else
2571 newdeplibs="$newdeplibs $i"
2572 fi
2573 done
2574 fi
2575 ;;
2576 file_magic*)
2577 set dummy $deplibs_check_method
2578 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2579 for a_deplib in $deplibs; do
2580 name="`expr $a_deplib : '-l\(.*\)'`"
2581 # If $name is empty we are operating on a -L argument.
2582 if test -n "$name" && test "$name" != "0"; then
2583 libname=`eval \\$echo \"$libname_spec\"`
2584 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2585 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2586 for potent_lib in $potential_libs; do
2587 # Follow soft links.
2588 if ls -lLd "$potent_lib" 2>/dev/null \
2589 | grep " -> " >/dev/null; then
2590 continue
2591 fi
2592 # The statement above tries to avoid entering an
2593 # endless loop below, in case of cyclic links.
2594 # We might still enter an endless loop, since a link
2595 # loop can be closed while we follow links,
2596 # but so what?
2597 potlib="$potent_lib"
2598 while test -h "$potlib" 2>/dev/null; do
2599 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2600 case $potliblink in
2601 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2602 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2603 esac
2604 done
2605 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2606 | sed 10q \
2607 | egrep "$file_magic_regex" > /dev/null; then
2608 newdeplibs="$newdeplibs $a_deplib"
2609 a_deplib=""
2610 break 2
2611 fi
2612 done
2613 done
2614 if test -n "$a_deplib" ; then
2615 droppeddeps=yes
2616 echo
2617 echo "*** Warning: linker path does not have real file for library $a_deplib."
2618 echo "*** I have the capability to make that library automatically link in when"
2619 echo "*** you link to this library. But I can only do this if you have a"
2620 echo "*** shared version of the library, which you do not appear to have"
2621 echo "*** because I did check the linker path looking for a file starting"
2622 if test -z "$potlib" ; then
2623 echo "*** with $libname but no candidates were found. (...for file magic test)"
2624 else
2625 echo "*** with $libname and none of the candidates passed a file format test"
2626 echo "*** using a file magic. Last file checked: $potlib"
2627 fi
2628 fi
2629 else
2630 # Add a -L argument.
2631 newdeplibs="$newdeplibs $a_deplib"
2632 fi
2633 done # Gone through all deplibs.
2634 ;;
2635 match_pattern*)
2636 set dummy $deplibs_check_method
2637 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2638 for a_deplib in $deplibs; do
2639 name="`expr $a_deplib : '-l\(.*\)'`"
2640 # If $name is empty we are operating on a -L argument.
2641 if test -n "$name" && test "$name" != "0"; then
2642 libname=`eval \\$echo \"$libname_spec\"`
2643 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2644 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2645 for potent_lib in $potential_libs; do
2646 potlib="$potent_lib" # see symlink-check below in file_magic test
2647 if eval echo \"$potent_lib\" 2>/dev/null \
2648 | sed 10q \
2649 | egrep "$match_pattern_regex" > /dev/null; then
2650 newdeplibs="$newdeplibs $a_deplib"
2651 a_deplib=""
2652 break 2
2653 fi
2654 done
2655 done
2656 if test -n "$a_deplib" ; then
2657 droppeddeps=yes
2658 echo
2659 echo "*** Warning: linker path does not have real file for library $a_deplib."
2660 echo "*** I have the capability to make that library automatically link in when"
2661 echo "*** you link to this library. But I can only do this if you have a"
2662 echo "*** shared version of the library, which you do not appear to have"
2663 echo "*** because I did check the linker path looking for a file starting"
2664 if test -z "$potlib" ; then
2665 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2666 else
2667 echo "*** with $libname and none of the candidates passed a file format test"
2668 echo "*** using a regex pattern. Last file checked: $potlib"
2669 fi
2670 fi
2671 else
2672 # Add a -L argument.
2673 newdeplibs="$newdeplibs $a_deplib"
2674 fi
2675 done # Gone through all deplibs.
2676 ;;
2677 none | unknown | *)
2678 newdeplibs=""
2679 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2680 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2681 grep . >/dev/null; then
2682 echo
2683 if test "X$deplibs_check_method" = "Xnone"; then
2684 echo "*** Warning: inter-library dependencies are not supported in this platform."
2685 else
2686 echo "*** Warning: inter-library dependencies are not known to be supported."
2687 fi
2688 echo "*** All declared inter-library dependencies are being dropped."
2689 droppeddeps=yes
2690 fi
2691 ;;
2692 esac
2693 versuffix=$versuffix_save
2694 major=$major_save
2695 release=$release_save
2696 libname=$libname_save
2697 name=$name_save
2698
2699 case $host in
2700 *-*-rhapsody* | *-*-darwin1.[012])
2701 # On Rhapsody replace the C library is the System framework
2702 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2703 ;;
2704 esac
2705
2706 if test "$droppeddeps" = yes; then
2707 if test "$module" = yes; then
2708 echo
2709 echo "*** Warning: libtool could not satisfy all declared inter-library"
2710 echo "*** dependencies of module $libname. Therefore, libtool will create"
2711 echo "*** a static module, that should work as long as the dlopening"
2712 echo "*** application is linked with the -dlopen flag."
2713 if test -z "$global_symbol_pipe"; then
2714 echo
2715 echo "*** However, this would only work if libtool was able to extract symbol"
2716 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2717 echo "*** not find such a program. So, this module is probably useless."
2718 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2719 fi
2720 if test "$build_old_libs" = no; then
2721 oldlibs="$output_objdir/$libname.$libext"
2722 build_libtool_libs=module
2723 build_old_libs=yes
2724 else
2725 build_libtool_libs=no
2726 fi
2727 else
2728 echo "*** The inter-library dependencies that have been dropped here will be"
2729 echo "*** automatically added whenever a program is linked with this library"
2730 echo "*** or is declared to -dlopen it."
2731
2732 if test $allow_undefined = no; then
2733 echo
2734 echo "*** Since this library must not contain undefined symbols,"
2735 echo "*** because either the platform does not support them or"
2736 echo "*** it was explicitly requested with -no-undefined,"
2737 echo "*** libtool will only create a static version of it."
2738 if test "$build_old_libs" = no; then
2739 oldlibs="$output_objdir/$libname.$libext"
2740 build_libtool_libs=module
2741 build_old_libs=yes
2742 else
2743 build_libtool_libs=no
2744 fi
2745 fi
2746 fi
2747 fi
2748 # Done checking deplibs!
2749 deplibs=$newdeplibs
2750 fi
2751
2752 # All the library-specific variables (install_libdir is set above).
2753 library_names=
2754 old_library=
2755 dlname=
2756
2757 # Test again, we may have decided not to build it any more
2758 if test "$build_libtool_libs" = yes; then
2759 if test $hardcode_into_libs = yes; then
2760 # Hardcode the library paths
2761 hardcode_libdirs=
2762 dep_rpath=
2763 rpath="$finalize_rpath"
2764 test "$mode" != relink && rpath="$compile_rpath$rpath"
2765 for libdir in $rpath; do
2766 if test -n "$hardcode_libdir_flag_spec"; then
2767 if test -n "$hardcode_libdir_separator"; then
2768 if test -z "$hardcode_libdirs"; then
2769 hardcode_libdirs="$libdir"
2770 else
2771 # Just accumulate the unique libdirs.
2772 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2773 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2774 ;;
2775 *)
2776 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2777 ;;
2778 esac
2779 fi
2780 else
2781 eval flag=\"$hardcode_libdir_flag_spec\"
2782 dep_rpath="$dep_rpath $flag"
2783 fi
2784 elif test -n "$runpath_var"; then
2785 case "$perm_rpath " in
2786 *" $libdir "*) ;;
2787 *) perm_rpath="$perm_rpath $libdir" ;;
2788 esac
2789 fi
2790 done
2791 # Substitute the hardcoded libdirs into the rpath.
2792 if test -n "$hardcode_libdir_separator" &&
2793 test -n "$hardcode_libdirs"; then
2794 libdir="$hardcode_libdirs"
2795 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2796 fi
2797 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2798 # We should set the runpath_var.
2799 rpath=
2800 for dir in $perm_rpath; do
2801 rpath="$rpath$dir:"
2802 done
2803 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2804 fi
2805 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2806 fi
2807
2808 shlibpath="$finalize_shlibpath"
2809 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2810 if test -n "$shlibpath"; then
2811 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2812 fi
2813
2814 # Get the real and link names of the library.
2815 eval library_names=\"$library_names_spec\"
2816 set dummy $library_names
2817 realname="$2"
2818 shift; shift
2819
2820 if test -n "$soname_spec"; then
2821 eval soname=\"$soname_spec\"
2822 else
2823 soname="$realname"
2824 fi
2825 test -z "$dlname" && dlname=$soname
2826
2827 lib="$output_objdir/$realname"
2828 for link
2829 do
2830 linknames="$linknames $link"
2831 done
2832
2833 # Ensure that we have .o objects for linkers which dislike .lo
2834 # (e.g. aix) in case we are running --disable-static
2835 for obj in $libobjs; do
2836 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2837 if test "X$xdir" = "X$obj"; then
2838 xdir="."
2839 else
2840 xdir="$xdir"
2841 fi
2842 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2843 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2844 if test ! -f $xdir/$oldobj; then
2845 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2846 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2847 fi
2848 done
2849
2850 # Use standard objects if they are pic
2851 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2852
2853 # Prepare the list of exported symbols
2854 if test -z "$export_symbols"; then
2855 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2856 $show "generating symbol list for \`$libname.la'"
2857 export_symbols="$output_objdir/$libname.exp"
2858 $run $rm $export_symbols
2859 eval cmds=\"$export_symbols_cmds\"
2860 save_ifs="$IFS"; IFS='~'
2861 for cmd in $cmds; do
2862 IFS="$save_ifs"
2863 $show "$cmd"
2864 $run eval "$cmd" || exit $?
2865 done
2866 IFS="$save_ifs"
2867 if test -n "$export_symbols_regex"; then
2868 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2869 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2870 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2871 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2872 fi
2873 fi
2874 fi
2875
2876 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2877 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2878 fi
2879
2880 if test -n "$convenience"; then
2881 if test -n "$whole_archive_flag_spec"; then
2882 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2883 else
2884 gentop="$output_objdir/${outputname}x"
2885 $show "${rm}r $gentop"
2886 $run ${rm}r "$gentop"
2887 $show "mkdir $gentop"
2888 $run mkdir "$gentop"
2889 status=$?
2890 if test $status -ne 0 && test ! -d "$gentop"; then
2891 exit $status
2892 fi
2893 generated="$generated $gentop"
2894
2895 for xlib in $convenience; do
2896 # Extract the objects.
2897 case $xlib in
2898 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2899 *) xabs=`pwd`"/$xlib" ;;
2900 esac
2901 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2902 xdir="$gentop/$xlib"
2903
2904 $show "${rm}r $xdir"
2905 $run ${rm}r "$xdir"
2906 $show "mkdir $xdir"
2907 $run mkdir "$xdir"
2908 status=$?
2909 if test $status -ne 0 && test ! -d "$xdir"; then
2910 exit $status
2911 fi
2912 $show "(cd $xdir && $AR x $xabs)"
2913 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2914
2915 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2916 done
2917 fi
2918 fi
2919
2920 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2921 eval flag=\"$thread_safe_flag_spec\"
2922 linker_flags="$linker_flags $flag"
2923 fi
2924
2925 # Make a backup of the uninstalled library when relinking
2926 if test "$mode" = relink; then
2927 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2928 fi
2929
2930 # Do each of the archive commands.
2931 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2932 eval cmds=\"$archive_expsym_cmds\"
2933 else
2934 eval cmds=\"$archive_cmds\"
2935 fi
2936 save_ifs="$IFS"; IFS='~'
2937 for cmd in $cmds; do
2938 IFS="$save_ifs"
2939 $show "$cmd"
2940 $run eval "$cmd" || exit $?
2941 done
2942 IFS="$save_ifs"
2943
2944 # Restore the uninstalled library and exit
2945 if test "$mode" = relink; then
2946 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2947 exit 0
2948 fi
2949
2950 # Create links to the real library.
2951 for linkname in $linknames; do
2952 if test "$realname" != "$linkname"; then
2953 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2954 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2955 fi
2956 done
2957
2958 # If -module or -export-dynamic was specified, set the dlname.
2959 if test "$module" = yes || test "$export_dynamic" = yes; then
2960 # On all known operating systems, these are identical.
2961 dlname="$soname"
2962 fi
2963 fi
2964 ;;
2965
2966 obj)
2967 if test -n "$deplibs"; then
2968 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2969 fi
2970
2971 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2972 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2973 fi
2974
2975 if test -n "$rpath"; then
2976 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2977 fi
2978
2979 if test -n "$xrpath"; then
2980 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2981 fi
2982
2983 if test -n "$vinfo"; then
2984 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2985 fi
2986
2987 if test -n "$release"; then
2988 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2989 fi
2990
2991 case $output in
2992 *.lo)
2993 if test -n "$objs$old_deplibs"; then
2994 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2995 exit 1
2996 fi
2997 libobj="$output"
2998 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2999 ;;
3000 *)
3001 libobj=
3002 obj="$output"
3003 ;;
3004 esac
3005
3006 # Delete the old objects.
3007 $run $rm $obj $libobj
3008
3009 # Objects from convenience libraries. This assumes
3010 # single-version convenience libraries. Whenever we create
3011 # different ones for PIC/non-PIC, this we'll have to duplicate
3012 # the extraction.
3013 reload_conv_objs=
3014 gentop=
3015 # reload_cmds runs $LD directly, so let us get rid of
3016 # -Wl from whole_archive_flag_spec
3017 wl=
3018
3019 if test -n "$convenience"; then
3020 if test -n "$whole_archive_flag_spec"; then
3021 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3022 else
3023 gentop="$output_objdir/${obj}x"
3024 $show "${rm}r $gentop"
3025 $run ${rm}r "$gentop"
3026 $show "mkdir $gentop"
3027 $run mkdir "$gentop"
3028 status=$?
3029 if test $status -ne 0 && test ! -d "$gentop"; then
3030 exit $status
3031 fi
3032 generated="$generated $gentop"
3033
3034 for xlib in $convenience; do
3035 # Extract the objects.
3036 case $xlib in
3037 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3038 *) xabs=`pwd`"/$xlib" ;;
3039 esac
3040 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3041 xdir="$gentop/$xlib"
3042
3043 $show "${rm}r $xdir"
3044 $run ${rm}r "$xdir"
3045 $show "mkdir $xdir"
3046 $run mkdir "$xdir"
3047 status=$?
3048 if test $status -ne 0 && test ! -d "$xdir"; then
3049 exit $status
3050 fi
3051 $show "(cd $xdir && $AR x $xabs)"
3052 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3053
3054 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3055 done
3056 fi
3057 fi
3058
3059 # Create the old-style object.
3060 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
3061
3062 output="$obj"
3063 eval cmds=\"$reload_cmds\"
3064 save_ifs="$IFS"; IFS='~'
3065 for cmd in $cmds; do
3066 IFS="$save_ifs"
3067 $show "$cmd"
3068 $run eval "$cmd" || exit $?
3069 done
3070 IFS="$save_ifs"
3071
3072 # Exit if we aren't doing a library object file.
3073 if test -z "$libobj"; then
3074 if test -n "$gentop"; then
3075 $show "${rm}r $gentop"
3076 $run ${rm}r $gentop
3077 fi
3078
3079 exit 0
3080 fi
3081
3082 if test "$build_libtool_libs" != yes; then
3083 if test -n "$gentop"; then
3084 $show "${rm}r $gentop"
3085 $run ${rm}r $gentop
3086 fi
3087
3088 # Create an invalid libtool object if no PIC, so that we don't
3089 # accidentally link it into a program.
3090 $show "echo timestamp > $libobj"
3091 $run eval "echo timestamp > $libobj" || exit $?
3092 exit 0
3093 fi
3094
3095 if test -n "$pic_flag" || test "$pic_mode" != default; then
3096 # Only do commands if we really have different PIC objects.
3097 reload_objs="$libobjs $reload_conv_objs"
3098 output="$libobj"
3099 eval cmds=\"$reload_cmds\"
3100 save_ifs="$IFS"; IFS='~'
3101 for cmd in $cmds; do
3102 IFS="$save_ifs"
3103 $show "$cmd"
3104 $run eval "$cmd" || exit $?
3105 done
3106 IFS="$save_ifs"
3107 else
3108 # Just create a symlink.
3109 $show $rm $libobj
3110 $run $rm $libobj
3111 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3112 if test "X$xdir" = "X$libobj"; then
3113 xdir="."
3114 else
3115 xdir="$xdir"
3116 fi
3117 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3118 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3119 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3120 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3121 fi
3122
3123 if test -n "$gentop"; then
3124 $show "${rm}r $gentop"
3125 $run ${rm}r $gentop
3126 fi
3127
3128 exit 0
3129 ;;
3130
3131 prog)
3132 case $host in
3133 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3134 esac
3135 if test -n "$vinfo"; then
3136 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3137 fi
3138
3139 if test -n "$release"; then
3140 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3141 fi
3142
3143 if test "$preload" = yes; then
3144 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3145 test "$dlopen_self_static" = unknown; then
3146 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3147 fi
3148 fi
3149
3150 case $host in
3151 *-*-rhapsody* | *-*-darwin1.[012])
3152 # On Rhapsody replace the C library is the System framework
3153 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3154 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3155 ;;
3156 esac
3157
3158 compile_command="$compile_command $compile_deplibs"
3159 finalize_command="$finalize_command $finalize_deplibs"
3160
3161 if test -n "$rpath$xrpath"; then
3162 # If the user specified any rpath flags, then add them.
3163 for libdir in $rpath $xrpath; do
3164 # This is the magic to use -rpath.
3165 case "$finalize_rpath " in
3166 *" $libdir "*) ;;
3167 *) finalize_rpath="$finalize_rpath $libdir" ;;
3168 esac
3169 done
3170 fi
3171
3172 # Now hardcode the library paths
3173 rpath=
3174 hardcode_libdirs=
3175 for libdir in $compile_rpath $finalize_rpath; do
3176 if test -n "$hardcode_libdir_flag_spec"; then
3177 if test -n "$hardcode_libdir_separator"; then
3178 if test -z "$hardcode_libdirs"; then
3179 hardcode_libdirs="$libdir"
3180 else
3181 # Just accumulate the unique libdirs.
3182 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3183 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3184 ;;
3185 *)
3186 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3187 ;;
3188 esac
3189 fi
3190 else
3191 eval flag=\"$hardcode_libdir_flag_spec\"
3192 rpath="$rpath $flag"
3193 fi
3194 elif test -n "$runpath_var"; then
3195 case "$perm_rpath " in
3196 *" $libdir "*) ;;
3197 *) perm_rpath="$perm_rpath $libdir" ;;
3198 esac
3199 fi
3200 case $host in
3201 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3202 case :$dllsearchpath: in
3203 *":$libdir:"*) ;;
3204 *) dllsearchpath="$dllsearchpath:$libdir";;
3205 esac
3206 ;;
3207 esac
3208 done
3209 # Substitute the hardcoded libdirs into the rpath.
3210 if test -n "$hardcode_libdir_separator" &&
3211 test -n "$hardcode_libdirs"; then
3212 libdir="$hardcode_libdirs"
3213 eval rpath=\" $hardcode_libdir_flag_spec\"
3214 fi
3215 compile_rpath="$rpath"
3216
3217 rpath=
3218 hardcode_libdirs=
3219 for libdir in $finalize_rpath; do
3220 if test -n "$hardcode_libdir_flag_spec"; then
3221 if test -n "$hardcode_libdir_separator"; then
3222 if test -z "$hardcode_libdirs"; then
3223 hardcode_libdirs="$libdir"
3224 else
3225 # Just accumulate the unique libdirs.
3226 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3227 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3228 ;;
3229 *)
3230 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3231 ;;
3232 esac
3233 fi
3234 else
3235 eval flag=\"$hardcode_libdir_flag_spec\"
3236 rpath="$rpath $flag"
3237 fi
3238 elif test -n "$runpath_var"; then
3239 case "$finalize_perm_rpath " in
3240 *" $libdir "*) ;;
3241 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3242 esac
3243 fi
3244 done
3245 # Substitute the hardcoded libdirs into the rpath.
3246 if test -n "$hardcode_libdir_separator" &&
3247 test -n "$hardcode_libdirs"; then
3248 libdir="$hardcode_libdirs"
3249 eval rpath=\" $hardcode_libdir_flag_spec\"
3250 fi
3251 finalize_rpath="$rpath"
3252
3253 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3254 # Transform all the library objects into standard objects.
3255 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3256 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3257 fi
3258
3259 dlsyms=
3260 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3261 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3262 dlsyms="${outputname}S.c"
3263 else
3264 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3265 fi
3266 fi
3267
3268 if test -n "$dlsyms"; then
3269 case $dlsyms in
3270 "") ;;
3271 *.c)
3272 # Discover the nlist of each of the dlfiles.
3273 nlist="$output_objdir/${outputname}.nm"
3274
3275 $show "$rm $nlist ${nlist}S ${nlist}T"
3276 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3277
3278 # Parse the name list into a source file.
3279 $show "creating $output_objdir/$dlsyms"
3280
3281 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3282/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3283/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3284
3285#ifdef __cplusplus
3286extern \"C\" {
3287#endif
3288
3289/* Prevent the only kind of declaration conflicts we can make. */
3290#define lt_preloaded_symbols some_other_symbol
3291
3292/* External symbol declarations for the compiler. */\
3293"
3294
3295 if test "$dlself" = yes; then
3296 $show "generating symbol list for \`$output'"
3297
3298 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3299
3300 # Add our own program objects to the symbol list.
3301 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3302 for arg in $progfiles; do
3303 $show "extracting global C symbols from \`$arg'"
3304 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3305 done
3306
3307 if test -n "$exclude_expsyms"; then
3308 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3309 $run eval '$mv "$nlist"T "$nlist"'
3310 fi
3311
3312 if test -n "$export_symbols_regex"; then
3313 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3314 $run eval '$mv "$nlist"T "$nlist"'
3315 fi
3316
3317 # Prepare the list of exported symbols
3318 if test -z "$export_symbols"; then
3319 export_symbols="$output_objdir/$output.exp"
3320 $run $rm $export_symbols
3321 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3322 else
3323 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3324 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3325 $run eval 'mv "$nlist"T "$nlist"'
3326 fi
3327 fi
3328
3329 for arg in $dlprefiles; do
3330 $show "extracting global C symbols from \`$arg'"
3331 name=`echo "$arg" | sed -e 's%^.*/%%'`
3332 $run eval 'echo ": $name " >> "$nlist"'
3333 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3334 done
3335
3336 if test -z "$run"; then
3337 # Make sure we have at least an empty file.
3338 test -f "$nlist" || : > "$nlist"
3339
3340 if test -n "$exclude_expsyms"; then
3341 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3342 $mv "$nlist"T "$nlist"
3343 fi
3344
3345 # Try sorting and uniquifying the output.
3346 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3347 :
3348 else
3349 grep -v "^: " < "$nlist" > "$nlist"S
3350 fi
3351
3352 if test -f "$nlist"S; then
3353 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3354 else
3355 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3356 fi
3357
3358 $echo >> "$output_objdir/$dlsyms" "\
3359
3360#undef lt_preloaded_symbols
3361
3362#if defined (__STDC__) && __STDC__
3363# define lt_ptr void *
3364#else
3365# define lt_ptr char *
3366# define const
3367#endif
3368
3369/* The mapping between symbol names and symbols. */
3370const struct {
3371 const char *name;
3372 lt_ptr address;
3373}
3374lt_preloaded_symbols[] =
3375{\
3376"
3377
3378 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3379
3380 $echo >> "$output_objdir/$dlsyms" "\
3381 {0, (lt_ptr) 0}
3382};
3383
3384/* This works around a problem in FreeBSD linker */
3385#ifdef FREEBSD_WORKAROUND
3386static const void *lt_preloaded_setup() {
3387 return lt_preloaded_symbols;
3388}
3389#endif
3390
3391#ifdef __cplusplus
3392}
3393#endif\
3394"
3395 fi
3396
3397 pic_flag_for_symtable=
3398 case $host in
3399 # compiling the symbol table file with pic_flag works around
3400 # a FreeBSD bug that causes programs to crash when -lm is
3401 # linked before any other PIC object. But we must not use
3402 # pic_flag when linking with -static. The problem exists in
3403 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3404 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3405 case "$compile_command " in
3406 *" -static "*) ;;
3407 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3408 esac;;
3409 *-*-hpux*)
3410 case "$compile_command " in
3411 *" -static "*) ;;
3412 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3413 esac
3414 esac
3415
3416 # Now compile the dynamic symbol file.
3417 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3418 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3419
3420 # Clean up the generated files.
3421 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3422 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3423
3424 # Transform the symbol file into the correct name.
3425 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3426 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3427 ;;
3428 *)
3429 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3430 exit 1
3431 ;;
3432 esac
3433 else
3434 # We keep going just in case the user didn't refer to
3435 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3436 # really was required.
3437
3438 # Nullify the symbol file.
3439 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3440 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3441 fi
3442
3443 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3444 # Replace the output file specification.
3445 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3446 link_command="$compile_command$compile_rpath"
3447
3448 # We have no uninstalled library dependencies, so finalize right now.
3449 $show "$link_command"
3450 $run eval "$link_command"
3451 status=$?
3452
3453 # Delete the generated files.
3454 if test -n "$dlsyms"; then
3455 $show "$rm $output_objdir/${outputname}S.${objext}"
3456 $run $rm "$output_objdir/${outputname}S.${objext}"
3457 fi
3458
3459 exit $status
3460 fi
3461
3462 if test -n "$shlibpath_var"; then
3463 # We should set the shlibpath_var
3464 rpath=
3465 for dir in $temp_rpath; do
3466 case $dir in
3467 [\\/]* | [A-Za-z]:[\\/]*)
3468 # Absolute path.
3469 rpath="$rpath$dir:"
3470 ;;
3471 *)
3472 # Relative path: add a thisdir entry.
3473 rpath="$rpath\$thisdir/$dir:"
3474 ;;
3475 esac
3476 done
3477 temp_rpath="$rpath"
3478 fi
3479
3480 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3481 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3482 fi
3483 if test -n "$finalize_shlibpath"; then
3484 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3485 fi
3486
3487 compile_var=
3488 finalize_var=
3489 if test -n "$runpath_var"; then
3490 if test -n "$perm_rpath"; then
3491 # We should set the runpath_var.
3492 rpath=
3493 for dir in $perm_rpath; do
3494 rpath="$rpath$dir:"
3495 done
3496 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3497 fi
3498 if test -n "$finalize_perm_rpath"; then
3499 # We should set the runpath_var.
3500 rpath=
3501 for dir in $finalize_perm_rpath; do
3502 rpath="$rpath$dir:"
3503 done
3504 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3505 fi
3506 fi
3507
3508 if test "$no_install" = yes; then
3509 # We don't need to create a wrapper script.
3510 link_command="$compile_var$compile_command$compile_rpath"
3511 # Replace the output file specification.
3512 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3513 # Delete the old output file.
3514 $run $rm $output
3515 # Link the executable and exit
3516 $show "$link_command"
3517 $run eval "$link_command" || exit $?
3518 exit 0
3519 fi
3520
3521 if test "$hardcode_action" = relink; then
3522 # Fast installation is not supported
3523 link_command="$compile_var$compile_command$compile_rpath"
3524 relink_command="$finalize_var$finalize_command$finalize_rpath"
3525
3526 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3527 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3528 else
3529 if test "$fast_install" != no; then
3530 link_command="$finalize_var$compile_command$finalize_rpath"
3531 if test "$fast_install" = yes; then
3532 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3533 else
3534 # fast_install is set to needless
3535 relink_command=
3536 fi
3537 else
3538 link_command="$compile_var$compile_command$compile_rpath"
3539 relink_command="$finalize_var$finalize_command$finalize_rpath"
3540 fi
3541 fi
3542
3543 # Replace the output file specification.
3544 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3545
3546 # Delete the old output files.
3547 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3548
3549 $show "$link_command"
3550 $run eval "$link_command" || exit $?
3551
3552 # Now create the wrapper script.
3553 $show "creating $output"
3554
3555 # Quote the relink command for shipping.
3556 if test -n "$relink_command"; then
3557 # Preserve any variables that may affect compiler behavior
3558 for var in $variables_saved_for_relink; do
3559 if eval test -z \"\${$var+set}\"; then
3560 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3561 elif eval var_value=\$$var; test -z "$var_value"; then
3562 relink_command="$var=; export $var; $relink_command"
3563 else
3564 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3565 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3566 fi
3567 done
3568 relink_command="(cd `pwd`; $relink_command)"
3569 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3570 fi
3571
3572 # Quote $echo for shipping.
3573 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3574 case $0 in
3575 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3576 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3577 esac
3578 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3579 else
3580 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3581 fi
3582
3583 # Only actually do things if our run command is non-null.
3584 if test -z "$run"; then
3585 # win32 will think the script is a binary if it has
3586 # a .exe suffix, so we strip it off here.
3587 case $output in
3588 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3589 esac
3590 # test for cygwin because mv fails w/o .exe extensions
3591 case $host in
3592 *cygwin*) exeext=.exe ;;
3593 *) exeext= ;;
3594 esac
3595 $rm $output
3596 trap "$rm $output; exit 1" 1 2 15
3597
3598 $echo > $output "\
3599#! $SHELL
3600
3601# $output - temporary wrapper script for $objdir/$outputname
3602# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3603#
3604# The $output program cannot be directly executed until all the libtool
3605# libraries that it depends on are installed.
3606#
3607# This wrapper script should never be moved out of the build directory.
3608# If it is, it will not operate correctly.
3609
3610# Sed substitution that helps us do robust quoting. It backslashifies
3611# metacharacters that are still active within double-quoted strings.
3612Xsed='sed -e 1s/^X//'
3613sed_quote_subst='$sed_quote_subst'
3614
3615# The HP-UX ksh and POSIX shell print the target directory to stdout
3616# if CDPATH is set.
3617if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3618
3619relink_command=\"$relink_command\"
3620
3621# This environment variable determines our operation mode.
3622if test \"\$libtool_install_magic\" = \"$magic\"; then
3623 # install mode needs the following variable:
3624 notinst_deplibs='$notinst_deplibs'
3625else
3626 # When we are sourced in execute mode, \$file and \$echo are already set.
3627 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3628 echo=\"$qecho\"
3629 file=\"\$0\"
3630 # Make sure echo works.
3631 if test \"X\$1\" = X--no-reexec; then
3632 # Discard the --no-reexec flag, and continue.
3633 shift
3634 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3635 # Yippee, \$echo works!
3636 :
3637 else
3638 # Restart under the correct shell, and then maybe \$echo will work.
3639 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3640 fi
3641 fi\
3642"
3643 $echo >> $output "\
3644
3645 # Find the directory that this script lives in.
3646 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3647 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3648
3649 # Follow symbolic links until we get to the real thisdir.
3650 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3651 while test -n \"\$file\"; do
3652 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3653
3654 # If there was a directory component, then change thisdir.
3655 if test \"x\$destdir\" != \"x\$file\"; then
3656 case \"\$destdir\" in
3657 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3658 *) thisdir=\"\$thisdir/\$destdir\" ;;
3659 esac
3660 fi
3661
3662 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3663 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3664 done
3665
3666 # Try to get the absolute directory name.
3667 absdir=\`cd \"\$thisdir\" && pwd\`
3668 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3669"
3670
3671 if test "$fast_install" = yes; then
3672 echo >> $output "\
3673 program=lt-'$outputname'$exeext
3674 progdir=\"\$thisdir/$objdir\"
3675
3676 if test ! -f \"\$progdir/\$program\" || \\
3677 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3678 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3679
3680 file=\"\$\$-\$program\"
3681
3682 if test ! -d \"\$progdir\"; then
3683 $mkdir \"\$progdir\"
3684 else
3685 $rm \"\$progdir/\$file\"
3686 fi"
3687
3688 echo >> $output "\
3689
3690 # relink executable if necessary
3691 if test -n \"\$relink_command\"; then
3692 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3693 else
3694 $echo \"\$relink_command_output\" >&2
3695 $rm \"\$progdir/\$file\"
3696 exit 1
3697 fi
3698 fi
3699
3700 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3701 { $rm \"\$progdir/\$program\";
3702 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3703 $rm \"\$progdir/\$file\"
3704 fi"
3705 else
3706 echo >> $output "\
3707 program='$outputname'
3708 progdir=\"\$thisdir/$objdir\"
3709"
3710 fi
3711
3712 echo >> $output "\
3713
3714 if test -f \"\$progdir/\$program\"; then"
3715
3716 # Export our shlibpath_var if we have one.
3717 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3718 $echo >> $output "\
3719 # Add our own library path to $shlibpath_var
3720 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3721
3722 # Some systems cannot cope with colon-terminated $shlibpath_var
3723 # The second colon is a workaround for a bug in BeOS R4 sed
3724 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3725
3726 export $shlibpath_var
3727"
3728 fi
3729
3730 # fixup the dll searchpath if we need to.
3731 if test -n "$dllsearchpath"; then
3732 $echo >> $output "\
3733 # Add the dll search path components to the executable PATH
3734 PATH=$dllsearchpath:\$PATH
3735"
3736 fi
3737
3738 $echo >> $output "\
3739 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3740 # Run the actual program with our arguments.
3741"
3742 case $host in
3743 # win32 systems need to use the prog path for dll
3744 # lookup to work
3745 *-*-cygwin* | *-*-pw32*)
3746 $echo >> $output "\
3747 exec \$progdir/\$program \${1+\"\$@\"}
3748"
3749 ;;
3750
3751 # Backslashes separate directories on plain windows
3752 *-*-mingw | *-*-os2*)
3753 $echo >> $output "\
3754 exec \$progdir\\\\\$program \${1+\"\$@\"}
3755"
3756 ;;
3757
3758 *)
3759 $echo >> $output "\
3760 # Export the path to the program.
3761 PATH=\"\$progdir:\$PATH\"
3762 export PATH
3763
3764 exec \$program \${1+\"\$@\"}
3765"
3766 ;;
3767 esac
3768 $echo >> $output "\
3769 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3770 exit 1
3771 fi
3772 else
3773 # The program doesn't exist.
3774 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3775 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3776 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3777 exit 1
3778 fi
3779fi\
3780"
3781 chmod +x $output
3782 fi
3783 exit 0
3784 ;;
3785 esac
3786
3787 # See if we need to build an old-fashioned archive.
3788 for oldlib in $oldlibs; do
3789
3790 if test "$build_libtool_libs" = convenience; then
3791 oldobjs="$libobjs_save"
3792 addlibs="$convenience"
3793 build_libtool_libs=no
3794 else
3795 if test "$build_libtool_libs" = module; then
3796 oldobjs="$libobjs_save"
3797 build_libtool_libs=no
3798 else
3799 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3800 fi
3801 addlibs="$old_convenience"
3802 fi
3803
3804 if test -n "$addlibs"; then
3805 gentop="$output_objdir/${outputname}x"
3806 $show "${rm}r $gentop"
3807 $run ${rm}r "$gentop"
3808 $show "mkdir $gentop"
3809 $run mkdir "$gentop"
3810 status=$?
3811 if test $status -ne 0 && test ! -d "$gentop"; then
3812 exit $status
3813 fi
3814 generated="$generated $gentop"
3815
3816 # Add in members from convenience archives.
3817 for xlib in $addlibs; do
3818 # Extract the objects.
3819 case $xlib in
3820 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3821 *) xabs=`pwd`"/$xlib" ;;
3822 esac
3823 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3824 xdir="$gentop/$xlib"
3825
3826 $show "${rm}r $xdir"
3827 $run ${rm}r "$xdir"
3828 $show "mkdir $xdir"
3829 $run mkdir "$xdir"
3830 status=$?
3831 if test $status -ne 0 && test ! -d "$xdir"; then
3832 exit $status
3833 fi
3834 $show "(cd $xdir && $AR x $xabs)"
3835 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3836
3837 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3838 done
3839 fi
3840
3841 # Do each command in the archive commands.
3842 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3843 eval cmds=\"$old_archive_from_new_cmds\"
3844 else
3845 # Ensure that we have .o objects in place in case we decided
3846 # not to build a shared library, and have fallen back to building
3847 # static libs even though --disable-static was passed!
3848 for oldobj in $oldobjs; do
3849 if test ! -f $oldobj; then
3850 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3851 if test "X$xdir" = "X$oldobj"; then
3852 xdir="."
3853 else
3854 xdir="$xdir"
3855 fi
3856 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3857 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3858 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3859 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3860 fi
3861 done
3862
3863 eval cmds=\"$old_archive_cmds\"
3864 fi
3865 save_ifs="$IFS"; IFS='~'
3866 for cmd in $cmds; do
3867 IFS="$save_ifs"
3868 $show "$cmd"
3869 $run eval "$cmd" || exit $?
3870 done
3871 IFS="$save_ifs"
3872 done
3873
3874 if test -n "$generated"; then
3875 $show "${rm}r$generated"
3876 $run ${rm}r$generated
3877 fi
3878
3879 # Now create the libtool archive.
3880 case $output in
3881 *.la)
3882 old_library=
3883 test "$build_old_libs" = yes && old_library="$libname.$libext"
3884 $show "creating $output"
3885
3886 # Preserve any variables that may affect compiler behavior
3887 for var in $variables_saved_for_relink; do
3888 if eval test -z \"\${$var+set}\"; then
3889 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3890 elif eval var_value=\$$var; test -z "$var_value"; then
3891 relink_command="$var=; export $var; $relink_command"
3892 else
3893 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3894 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3895 fi
3896 done
3897 # Quote the link command for shipping.
3898 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
3899 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3900
3901 # Only create the output if not a dry run.
3902 if test -z "$run"; then
3903 for installed in no yes; do
3904 if test "$installed" = yes; then
3905 if test -z "$install_libdir"; then
3906 break
3907 fi
3908 output="$output_objdir/$outputname"i
3909 # Replace all uninstalled libtool libraries with the installed ones
3910 newdependency_libs=
3911 for deplib in $dependency_libs; do
3912 case $deplib in
3913 *.la)
3914 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3915 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3916 if test -z "$libdir"; then
3917 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3918 exit 1
3919 fi
3920 newdependency_libs="$newdependency_libs $libdir/$name"
3921 ;;
3922 *) newdependency_libs="$newdependency_libs $deplib" ;;
3923 esac
3924 done
3925 dependency_libs="$newdependency_libs"
3926 newdlfiles=
3927 for lib in $dlfiles; do
3928 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3929 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3930 if test -z "$libdir"; then
3931 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3932 exit 1
3933 fi
3934 newdlfiles="$newdlfiles $libdir/$name"
3935 done
3936 dlfiles="$newdlfiles"
3937 newdlprefiles=
3938 for lib in $dlprefiles; do
3939 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3940 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3941 if test -z "$libdir"; then
3942 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3943 exit 1
3944 fi
3945 newdlprefiles="$newdlprefiles $libdir/$name"
3946 done
3947 dlprefiles="$newdlprefiles"
3948 fi
3949 $rm $output
3950 # place dlname in correct position for cygwin
3951 tdlname=$dlname
3952 case $host,$output,$installed,$module,$dlname in
3953 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3954 esac
3955 $echo > $output "\
3956# $outputname - a libtool library file
3957# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3958#
3959# Please DO NOT delete this file!
3960# It is necessary for linking the library.
3961
3962# The name that we can dlopen(3).
3963dlname='$tdlname'
3964
3965# Names of this library.
3966library_names='$library_names'
3967
3968# The name of the static archive.
3969old_library='$old_library'
3970
3971# Libraries that this one depends upon.
3972dependency_libs='$dependency_libs'
3973
3974# Version information for $libname.
3975current=$current
3976age=$age
3977revision=$revision
3978
3979# Is this an already installed library?
3980installed=$installed
3981
3982# Files to dlopen/dlpreopen
3983dlopen='$dlfiles'
3984dlpreopen='$dlprefiles'
3985
3986# Directory that this library needs to be installed in:
3987libdir='$install_libdir'"
3988 if test "$installed" = no && test $need_relink = yes; then
3989 $echo >> $output "\
3990relink_command=\"$relink_command\""
3991 fi
3992 done
3993 fi
3994
3995 # Do a symbolic link so that the libtool archive can be found in
3996 # LD_LIBRARY_PATH before the program is installed.
3997 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3998 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3999 ;;
4000 esac
4001 exit 0
4002 ;;
4003
4004 # libtool install mode
4005 install)
4006 modename="$modename: install"
4007
4008 # There may be an optional sh(1) argument at the beginning of
4009 # install_prog (especially on Windows NT).
4010 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4011 # Allow the use of GNU shtool's install command.
4012 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4013 # Aesthetically quote it.
4014 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4015 case $arg in
4016 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4017 arg="\"$arg\""
4018 ;;
4019 esac
4020 install_prog="$arg "
4021 arg="$1"
4022 shift
4023 else
4024 install_prog=
4025 arg="$nonopt"
4026 fi
4027
4028 # The real first argument should be the name of the installation program.
4029 # Aesthetically quote it.
4030 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4031 case $arg in
4032 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4033 arg="\"$arg\""
4034 ;;
4035 esac
4036 install_prog="$install_prog$arg"
4037
4038 # We need to accept at least all the BSD install flags.
4039 dest=
4040 files=
4041 opts=
4042 prev=
4043 install_type=
4044 isdir=no
4045 stripme=
4046 for arg
4047 do
4048 if test -n "$dest"; then
4049 files="$files $dest"
4050 dest="$arg"
4051 continue
4052 fi
4053
4054 case $arg in
4055 -d) isdir=yes ;;
4056 -f) prev="-f" ;;
4057 -g) prev="-g" ;;
4058 -m) prev="-m" ;;
4059 -o) prev="-o" ;;
4060 -s)
4061 stripme=" -s"
4062 continue
4063 ;;
4064 -*) ;;
4065
4066 *)
4067 # If the previous option needed an argument, then skip it.
4068 if test -n "$prev"; then
4069 prev=
4070 else
4071 dest="$arg"
4072 continue
4073 fi
4074 ;;
4075 esac
4076
4077 # Aesthetically quote the argument.
4078 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4079 case $arg in
4080 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4081 arg="\"$arg\""
4082 ;;
4083 esac
4084 install_prog="$install_prog $arg"
4085 done
4086
4087 if test -z "$install_prog"; then
4088 $echo "$modename: you must specify an install program" 1>&2
4089 $echo "$help" 1>&2
4090 exit 1
4091 fi
4092
4093 if test -n "$prev"; then
4094 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4095 $echo "$help" 1>&2
4096 exit 1
4097 fi
4098
4099 if test -z "$files"; then
4100 if test -z "$dest"; then
4101 $echo "$modename: no file or destination specified" 1>&2
4102 else
4103 $echo "$modename: you must specify a destination" 1>&2
4104 fi
4105 $echo "$help" 1>&2
4106 exit 1
4107 fi
4108
4109 # Strip any trailing slash from the destination.
4110 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4111
4112 # Check to see that the destination is a directory.
4113 test -d "$dest" && isdir=yes
4114 if test "$isdir" = yes; then
4115 destdir="$dest"
4116 destname=
4117 else
4118 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4119 test "X$destdir" = "X$dest" && destdir=.
4120 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4121
4122 # Not a directory, so check to see that there is only one file specified.
4123 set dummy $files
4124 if test $# -gt 2; then
4125 $echo "$modename: \`$dest' is not a directory" 1>&2
4126 $echo "$help" 1>&2
4127 exit 1
4128 fi
4129 fi
4130 case $destdir in
4131 [\\/]* | [A-Za-z]:[\\/]*) ;;
4132 *)
4133 for file in $files; do
4134 case $file in
4135 *.lo) ;;
4136 *)
4137 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4138 $echo "$help" 1>&2
4139 exit 1
4140 ;;
4141 esac
4142 done
4143 ;;
4144 esac
4145
4146 # This variable tells wrapper scripts just to set variables rather
4147 # than running their programs.
4148 libtool_install_magic="$magic"
4149
4150 staticlibs=
4151 future_libdirs=
4152 current_libdirs=
4153 for file in $files; do
4154
4155 # Do each installation.
4156 case $file in
4157 *.$libext)
4158 # Do the static libraries later.
4159 staticlibs="$staticlibs $file"
4160 ;;
4161
4162 *.la)
4163 # Check to see that this really is a libtool archive.
4164 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4165 else
4166 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4167 $echo "$help" 1>&2
4168 exit 1
4169 fi
4170
4171 library_names=
4172 old_library=
4173 relink_command=
4174 # If there is no directory component, then add one.
4175 case $file in
4176 */* | *\\*) . $file ;;
4177 *) . ./$file ;;
4178 esac
4179
4180 # Add the libdir to current_libdirs if it is the destination.
4181 if test "X$destdir" = "X$libdir"; then
4182 case "$current_libdirs " in
4183 *" $libdir "*) ;;
4184 *) current_libdirs="$current_libdirs $libdir" ;;
4185 esac
4186 else
4187 # Note the libdir as a future libdir.
4188 case "$future_libdirs " in
4189 *" $libdir "*) ;;
4190 *) future_libdirs="$future_libdirs $libdir" ;;
4191 esac
4192 fi
4193
4194 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4195 test "X$dir" = "X$file/" && dir=
4196 dir="$dir$objdir"
4197
4198 if test -n "$relink_command"; then
4199 $echo "$modename: warning: relinking \`$file'" 1>&2
4200 $show "$relink_command"
4201 if $run eval "$relink_command"; then :
4202 else
4203 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4204 continue
4205 fi
4206 fi
4207
4208 # See the names of the shared library.
4209 set dummy $library_names
4210 if test -n "$2"; then
4211 realname="$2"
4212 shift
4213 shift
4214
4215 srcname="$realname"
4216 test -n "$relink_command" && srcname="$realname"T
4217
4218 # Install the shared library and build the symlinks.
4219 $show "$install_prog $dir/$srcname $destdir/$realname"
4220 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4221 if test -n "$stripme" && test -n "$striplib"; then
4222 $show "$striplib $destdir/$realname"
4223 $run eval "$striplib $destdir/$realname" || exit $?
4224 fi
4225
4226 if test $# -gt 0; then
4227 # Delete the old symlinks, and create new ones.
4228 for linkname
4229 do
4230 if test "$linkname" != "$realname"; then
4231 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4232 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4233 fi
4234 done
4235 fi
4236
4237 # Do each command in the postinstall commands.
4238 lib="$destdir/$realname"
4239 eval cmds=\"$postinstall_cmds\"
4240 save_ifs="$IFS"; IFS='~'
4241 for cmd in $cmds; do
4242 IFS="$save_ifs"
4243 $show "$cmd"
4244 $run eval "$cmd" || exit $?
4245 done
4246 IFS="$save_ifs"
4247 fi
4248
4249 # Install the pseudo-library for information purposes.
4250 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4251 instname="$dir/$name"i
4252 $show "$install_prog $instname $destdir/$name"
4253 $run eval "$install_prog $instname $destdir/$name" || exit $?
4254
4255 # Maybe install the static library, too.
4256 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4257 ;;
4258
4259 *.lo)
4260 # Install (i.e. copy) a libtool object.
4261
4262 # Figure out destination file name, if it wasn't already specified.
4263 if test -n "$destname"; then
4264 destfile="$destdir/$destname"
4265 else
4266 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4267 destfile="$destdir/$destfile"
4268 fi
4269
4270 # Deduce the name of the destination old-style object file.
4271 case $destfile in
4272 *.lo)
4273 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4274 ;;
4275 *.$objext)
4276 staticdest="$destfile"
4277 destfile=
4278 ;;
4279 *)
4280 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4281 $echo "$help" 1>&2
4282 exit 1
4283 ;;
4284 esac
4285
4286 # Install the libtool object if requested.
4287 if test -n "$destfile"; then
4288 $show "$install_prog $file $destfile"
4289 $run eval "$install_prog $file $destfile" || exit $?
4290 fi
4291
4292 # Install the old object if enabled.
4293 if test "$build_old_libs" = yes; then
4294 # Deduce the name of the old-style object file.
4295 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4296
4297 $show "$install_prog $staticobj $staticdest"
4298 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4299 fi
4300 exit 0
4301 ;;
4302
4303 *)
4304 # Figure out destination file name, if it wasn't already specified.
4305 if test -n "$destname"; then
4306 destfile="$destdir/$destname"
4307 else
4308 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4309 destfile="$destdir/$destfile"
4310 fi
4311
4312 # Do a test to see if this is really a libtool program.
4313 case $host in
4314 *cygwin*|*mingw*)
4315 wrapper=`echo $file | sed -e 's,.exe$,,'`
4316 ;;
4317 *)
4318 wrapper=$file
4319 ;;
4320 esac
4321 if (sed -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4322 notinst_deplibs=
4323 relink_command=
4324
4325 # If there is no directory component, then add one.
4326 case $file in
4327 */* | *\\*) . $wrapper ;;
4328 *) . ./$wrapper ;;
4329 esac
4330
4331 # Check the variables that should have been set.
4332 if test -z "$notinst_deplibs"; then
4333 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4334 exit 1
4335 fi
4336
4337 finalize=yes
4338 for lib in $notinst_deplibs; do
4339 # Check to see that each library is installed.
4340 libdir=
4341 if test -f "$lib"; then
4342 # If there is no directory component, then add one.
4343 case $lib in
4344 */* | *\\*) . $lib ;;
4345 *) . ./$lib ;;
4346 esac
4347 fi
4348 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4349 if test -n "$libdir" && test ! -f "$libfile"; then
4350 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4351 finalize=no
4352 fi
4353 done
4354
4355 relink_command=
4356 # If there is no directory component, then add one.
4357 case $file in
4358 */* | *\\*) . $wrapper ;;
4359 *) . ./$wrapper ;;
4360 esac
4361
4362 outputname=
4363 if test "$fast_install" = no && test -n "$relink_command"; then
4364 if test "$finalize" = yes && test -z "$run"; then
4365 tmpdir="/tmp"
4366 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4367 tmpdir="$tmpdir/libtool-$$"
4368 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4369 else
4370 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4371 continue
4372 fi
4373 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4374 outputname="$tmpdir/$file"
4375 # Replace the output file specification.
4376 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4377
4378 $show "$relink_command"
4379 if $run eval "$relink_command"; then :
4380 else
4381 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4382 ${rm}r "$tmpdir"
4383 continue
4384 fi
4385 file="$outputname"
4386 else
4387 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4388 fi
4389 else
4390 # Install the binary that we compiled earlier.
4391 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4392 fi
4393 fi
4394
4395 # remove .exe since cygwin /usr/bin/install will append another
4396 # one anyways
4397 case $install_prog,$host in
4398 /usr/bin/install*,*cygwin*)
4399 case $file:$destfile in
4400 *.exe:*.exe)
4401 # this is ok
4402 ;;
4403 *.exe:*)
4404 destfile=$destfile.exe
4405 ;;
4406 *:*.exe)
4407 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4408 ;;
4409 esac
4410 ;;
4411 esac
4412 $show "$install_prog$stripme $file $destfile"
4413 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4414 test -n "$outputname" && ${rm}r "$tmpdir"
4415 ;;
4416 esac
4417 done
4418
4419 for file in $staticlibs; do
4420 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4421
4422 # Set up the ranlib parameters.
4423 oldlib="$destdir/$name"
4424
4425 $show "$install_prog $file $oldlib"
4426 $run eval "$install_prog \$file \$oldlib" || exit $?
4427
4428 if test -n "$stripme" && test -n "$striplib"; then
4429 $show "$old_striplib $oldlib"
4430 $run eval "$old_striplib $oldlib" || exit $?
4431 fi
4432
4433 # Do each command in the postinstall commands.
4434 eval cmds=\"$old_postinstall_cmds\"
4435 save_ifs="$IFS"; IFS='~'
4436 for cmd in $cmds; do
4437 IFS="$save_ifs"
4438 $show "$cmd"
4439 $run eval "$cmd" || exit $?
4440 done
4441 IFS="$save_ifs"
4442 done
4443
4444 if test -n "$future_libdirs"; then
4445 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4446 fi
4447
4448 if test -n "$current_libdirs"; then
4449 # Maybe just do a dry run.
4450 test -n "$run" && current_libdirs=" -n$current_libdirs"
4451 exec_cmd='$SHELL $0 --finish$current_libdirs'
4452 else
4453 exit 0
4454 fi
4455 ;;
4456
4457 # libtool finish mode
4458 finish)
4459 modename="$modename: finish"
4460 libdirs="$nonopt"
4461 admincmds=
4462
4463 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4464 for dir
4465 do
4466 libdirs="$libdirs $dir"
4467 done
4468
4469 for libdir in $libdirs; do
4470 if test -n "$finish_cmds"; then
4471 # Do each command in the finish commands.
4472 eval cmds=\"$finish_cmds\"
4473 save_ifs="$IFS"; IFS='~'
4474 for cmd in $cmds; do
4475 IFS="$save_ifs"
4476 $show "$cmd"
4477 $run eval "$cmd" || admincmds="$admincmds
4478 $cmd"
4479 done
4480 IFS="$save_ifs"
4481 fi
4482 if test -n "$finish_eval"; then
4483 # Do the single finish_eval.
4484 eval cmds=\"$finish_eval\"
4485 $run eval "$cmds" || admincmds="$admincmds
4486 $cmds"
4487 fi
4488 done
4489 fi
4490
4491 # Exit here if they wanted silent mode.
4492 test "$show" = ":" && exit 0
4493
4494 echo "----------------------------------------------------------------------"
4495 echo "Libraries have been installed in:"
4496 for libdir in $libdirs; do
4497 echo " $libdir"
4498 done
4499 echo
4500 echo "If you ever happen to want to link against installed libraries"
4501 echo "in a given directory, LIBDIR, you must either use libtool, and"
4502 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4503 echo "flag during linking and do at least one of the following:"
4504 if test -n "$shlibpath_var"; then
4505 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4506 echo " during execution"
4507 fi
4508 if test -n "$runpath_var"; then
4509 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4510 echo " during linking"
4511 fi
4512 if test -n "$hardcode_libdir_flag_spec"; then
4513 libdir=LIBDIR
4514 eval flag=\"$hardcode_libdir_flag_spec\"
4515
4516 echo " - use the \`$flag' linker flag"
4517 fi
4518 if test -n "$admincmds"; then
4519 echo " - have your system administrator run these commands:$admincmds"
4520 fi
4521 if test -f /etc/ld.so.conf; then
4522 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4523 fi
4524 echo
4525 echo "See any operating system documentation about shared libraries for"
4526 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4527 echo "----------------------------------------------------------------------"
4528 exit 0
4529 ;;
4530
4531 # libtool execute mode
4532 execute)
4533 modename="$modename: execute"
4534
4535 # The first argument is the command name.
4536 cmd="$nonopt"
4537 if test -z "$cmd"; then
4538 $echo "$modename: you must specify a COMMAND" 1>&2
4539 $echo "$help"
4540 exit 1
4541 fi
4542
4543 # Handle -dlopen flags immediately.
4544 for file in $execute_dlfiles; do
4545 if test ! -f "$file"; then
4546 $echo "$modename: \`$file' is not a file" 1>&2
4547 $echo "$help" 1>&2
4548 exit 1
4549 fi
4550
4551 dir=
4552 case $file in
4553 *.la)
4554 # Check to see that this really is a libtool archive.
4555 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4556 else
4557 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4558 $echo "$help" 1>&2
4559 exit 1
4560 fi
4561
4562 # Read the libtool library.
4563 dlname=
4564 library_names=
4565
4566 # If there is no directory component, then add one.
4567 case $file in
4568 */* | *\\*) . $file ;;
4569 *) . ./$file ;;
4570 esac
4571
4572 # Skip this library if it cannot be dlopened.
4573 if test -z "$dlname"; then
4574 # Warn if it was a shared library.
4575 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4576 continue
4577 fi
4578
4579 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4580 test "X$dir" = "X$file" && dir=.
4581
4582 if test -f "$dir/$objdir/$dlname"; then
4583 dir="$dir/$objdir"
4584 else
4585 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4586 exit 1
4587 fi
4588 ;;
4589
4590 *.lo)
4591 # Just add the directory containing the .lo file.
4592 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4593 test "X$dir" = "X$file" && dir=.
4594 ;;
4595
4596 *)
4597 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4598 continue
4599 ;;
4600 esac
4601
4602 # Get the absolute pathname.
4603 absdir=`cd "$dir" && pwd`
4604 test -n "$absdir" && dir="$absdir"
4605
4606 # Now add the directory to shlibpath_var.
4607 if eval "test -z \"\$$shlibpath_var\""; then
4608 eval "$shlibpath_var=\"\$dir\""
4609 else
4610 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4611 fi
4612 done
4613
4614 # This variable tells wrapper scripts just to set shlibpath_var
4615 # rather than running their programs.
4616 libtool_execute_magic="$magic"
4617
4618 # Check if any of the arguments is a wrapper script.
4619 args=
4620 for file
4621 do
4622 case $file in
4623 -*) ;;
4624 *)
4625 # Do a test to see if this is really a libtool program.
4626 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4627 # If there is no directory component, then add one.
4628 case $file in
4629 */* | *\\*) . $file ;;
4630 *) . ./$file ;;
4631 esac
4632
4633 # Transform arg to wrapped name.
4634 file="$progdir/$program"
4635 fi
4636 ;;
4637 esac
4638 # Quote arguments (to preserve shell metacharacters).
4639 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4640 args="$args \"$file\""
4641 done
4642
4643 if test -z "$run"; then
4644 if test -n "$shlibpath_var"; then
4645 # Export the shlibpath_var.
4646 eval "export $shlibpath_var"
4647 fi
4648
4649 # Restore saved enviroment variables
4650 if test "${save_LC_ALL+set}" = set; then
4651 LC_ALL="$save_LC_ALL"; export LC_ALL
4652 fi
4653 if test "${save_LANG+set}" = set; then
4654 LANG="$save_LANG"; export LANG
4655 fi
4656
4657 # Now prepare to actually exec the command.
4658 exec_cmd="\$cmd$args"
4659 else
4660 # Display what would be done.
4661 if test -n "$shlibpath_var"; then
4662 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4663 $echo "export $shlibpath_var"
4664 fi
4665 $echo "$cmd$args"
4666 exit 0
4667 fi
4668 ;;
4669
4670 # libtool clean and uninstall mode
4671 clean | uninstall)
4672 modename="$modename: $mode"
4673 rm="$nonopt"
4674 files=
4675 rmforce=
4676 exit_status=0
4677
4678 # This variable tells wrapper scripts just to set variables rather
4679 # than running their programs.
4680 libtool_install_magic="$magic"
4681
4682 for arg
4683 do
4684 case $arg in
4685 -f) rm="$rm $arg"; rmforce=yes ;;
4686 -*) rm="$rm $arg" ;;
4687 *) files="$files $arg" ;;
4688 esac
4689 done
4690
4691 if test -z "$rm"; then
4692 $echo "$modename: you must specify an RM program" 1>&2
4693 $echo "$help" 1>&2
4694 exit 1
4695 fi
4696
4697 rmdirs=
4698
4699 for file in $files; do
4700 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4701 if test "X$dir" = "X$file"; then
4702 dir=.
4703 objdir="$objdir"
4704 else
4705 objdir="$dir/$objdir"
4706 fi
4707 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4708 test $mode = uninstall && objdir="$dir"
4709
4710 # Remember objdir for removal later, being careful to avoid duplicates
4711 if test $mode = clean; then
4712 case " $rmdirs " in
4713 *" $objdir "*) ;;
4714 *) rmdirs="$rmdirs $objdir" ;;
4715 esac
4716 fi
4717
4718 # Don't error if the file doesn't exist and rm -f was used.
4719 if (test -L "$file") >/dev/null 2>&1 \
4720 || (test -h "$file") >/dev/null 2>&1 \
4721 || test -f "$file"; then
4722 :
4723 elif test -d "$file"; then
4724 exit_status=1
4725 continue
4726 elif test "$rmforce" = yes; then
4727 continue
4728 fi
4729
4730 rmfiles="$file"
4731
4732 case $name in
4733 *.la)
4734 # Possibly a libtool archive, so verify it.
4735 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4736 . $dir/$name
4737
4738 # Delete the libtool libraries and symlinks.
4739 for n in $library_names; do
4740 rmfiles="$rmfiles $objdir/$n"
4741 done
4742 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4743 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4744
4745 if test $mode = uninstall; then
4746 if test -n "$library_names"; then
4747 # Do each command in the postuninstall commands.
4748 eval cmds=\"$postuninstall_cmds\"
4749 save_ifs="$IFS"; IFS='~'
4750 for cmd in $cmds; do
4751 IFS="$save_ifs"
4752 $show "$cmd"
4753 $run eval "$cmd"
4754 if test $? != 0 && test "$rmforce" != yes; then
4755 exit_status=1
4756 fi
4757 done
4758 IFS="$save_ifs"
4759 fi
4760
4761 if test -n "$old_library"; then
4762 # Do each command in the old_postuninstall commands.
4763 eval cmds=\"$old_postuninstall_cmds\"
4764 save_ifs="$IFS"; IFS='~'
4765 for cmd in $cmds; do
4766 IFS="$save_ifs"
4767 $show "$cmd"
4768 $run eval "$cmd"
4769 if test $? != 0 && test "$rmforce" != yes; then
4770 exit_status=1
4771 fi
4772 done
4773 IFS="$save_ifs"
4774 fi
4775 # FIXME: should reinstall the best remaining shared library.
4776 fi
4777 fi
4778 ;;
4779
4780 *.lo)
4781 if test "$build_old_libs" = yes; then
4782 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4783 rmfiles="$rmfiles $dir/$oldobj"
4784 fi
4785 ;;
4786
4787 *)
4788 # Do a test to see if this is a libtool program.
4789 if test $mode = clean &&
4790 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4791 relink_command=
4792 . $dir/$file
4793
4794 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4795 if test "$fast_install" = yes && test -n "$relink_command"; then
4796 rmfiles="$rmfiles $objdir/lt-$name"
4797 fi
4798 fi
4799 ;;
4800 esac
4801 $show "$rm $rmfiles"
4802 $run $rm $rmfiles || exit_status=1
4803 done
4804
4805 # Try to remove the ${objdir}s in the directories where we deleted files
4806 for dir in $rmdirs; do
4807 if test -d "$dir"; then
4808 $show "rmdir $dir"
4809 $run rmdir $dir >/dev/null 2>&1
4810 fi
4811 done
4812
4813 exit $exit_status
4814 ;;
4815
4816 "")
4817 $echo "$modename: you must specify a MODE" 1>&2
4818 $echo "$generic_help" 1>&2
4819 exit 1
4820 ;;
4821 esac
4822
4823 if test -z "$exec_cmd"; then
4824 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4825 $echo "$generic_help" 1>&2
4826 exit 1
4827 fi
4828fi # test -z "$show_help"
4829
4830if test -n "$exec_cmd"; then
4831 eval exec $exec_cmd
4832 exit 1
4833fi
4834
4835# We need to display help for each of the modes.
4836case $mode in
4837"") $echo \
4838"Usage: $modename [OPTION]... [MODE-ARG]...
4839
4840Provide generalized library-building support services.
4841
4842 --config show all configuration variables
4843 --debug enable verbose shell tracing
4844-n, --dry-run display commands without modifying any files
4845 --features display basic configuration information and exit
4846 --finish same as \`--mode=finish'
4847 --help display this help message and exit
4848 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4849 --quiet same as \`--silent'
4850 --silent don't print informational messages
4851 --version print version information
4852
4853MODE must be one of the following:
4854
4855 clean remove files from the build directory
4856 compile compile a source file into a libtool object
4857 execute automatically set library path, then run a program
4858 finish complete the installation of libtool libraries
4859 install install libraries or executables
4860 link create a library or an executable
4861 uninstall remove libraries from an installed directory
4862
4863MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4864a more detailed description of MODE."
4865 exit 0
4866 ;;
4867
4868clean)
4869 $echo \
4870"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4871
4872Remove files from the build directory.
4873
4874RM is the name of the program to use to delete files associated with each FILE
4875(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4876to RM.
4877
4878If FILE is a libtool library, object or program, all the files associated
4879with it are deleted. Otherwise, only FILE itself is deleted using RM."
4880 ;;
4881
4882compile)
4883 $echo \
4884"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4885
4886Compile a source file into a libtool library object.
4887
4888This mode accepts the following additional options:
4889
4890 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4891 -prefer-pic try to building PIC objects only
4892 -prefer-non-pic try to building non-PIC objects only
4893 -static always build a \`.o' file suitable for static linking
4894
4895COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4896from the given SOURCEFILE.
4897
4898The output file name is determined by removing the directory component from
4899SOURCEFILE, then substituting the C source code suffix \`.c' with the
4900library object suffix, \`.lo'."
4901 ;;
4902
4903execute)
4904 $echo \
4905"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4906
4907Automatically set library path, then run a program.
4908
4909This mode accepts the following additional options:
4910
4911 -dlopen FILE add the directory containing FILE to the library path
4912
4913This mode sets the library path environment variable according to \`-dlopen'
4914flags.
4915
4916If any of the ARGS are libtool executable wrappers, then they are translated
4917into their corresponding uninstalled binary, and any of their required library
4918directories are added to the library path.
4919
4920Then, COMMAND is executed, with ARGS as arguments."
4921 ;;
4922
4923finish)
4924 $echo \
4925"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4926
4927Complete the installation of libtool libraries.
4928
4929Each LIBDIR is a directory that contains libtool libraries.
4930
4931The commands that this mode executes may require superuser privileges. Use
4932the \`--dry-run' option if you just want to see what would be executed."
4933 ;;
4934
4935install)
4936 $echo \
4937"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4938
4939Install executables or libraries.
4940
4941INSTALL-COMMAND is the installation command. The first component should be
4942either the \`install' or \`cp' program.
4943
4944The rest of the components are interpreted as arguments to that command (only
4945BSD-compatible install options are recognized)."
4946 ;;
4947
4948link)
4949 $echo \
4950"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4951
4952Link object files or libraries together to form another library, or to
4953create an executable program.
4954
4955LINK-COMMAND is a command using the C compiler that you would use to create
4956a program from several object files.
4957
4958The following components of LINK-COMMAND are treated specially:
4959
4960 -all-static do not do any dynamic linking at all
4961 -avoid-version do not add a version suffix if possible
4962 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4963 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4964 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4965 -export-symbols SYMFILE
4966 try to export only the symbols listed in SYMFILE
4967 -export-symbols-regex REGEX
4968 try to export only the symbols matching REGEX
4969 -LLIBDIR search LIBDIR for required installed libraries
4970 -lNAME OUTPUT-FILE requires the installed library libNAME
4971 -module build a library that can dlopened
4972 -no-fast-install disable the fast-install mode
4973 -no-install link a not-installable executable
4974 -no-undefined declare that a library does not refer to external symbols
4975 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4976 -release RELEASE specify package release information
4977 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4978 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4979 -static do not do any dynamic linking of libtool libraries
4980 -version-info CURRENT[:REVISION[:AGE]]
4981 specify library version info [each variable defaults to 0]
4982
4983All other options (arguments beginning with \`-') are ignored.
4984
4985Every other argument is treated as a filename. Files ending in \`.la' are
4986treated as uninstalled libtool libraries, other files are standard or library
4987object files.
4988
4989If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4990only library objects (\`.lo' files) may be specified, and \`-rpath' is
4991required, except when creating a convenience library.
4992
4993If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4994using \`ar' and \`ranlib', or on Windows using \`lib'.
4995
4996If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4997is created, otherwise an executable program is created."
4998 ;;
4999
5000uninstall)
5001 $echo \
5002"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5003
5004Remove libraries from an installation directory.
5005
5006RM is the name of the program to use to delete files associated with each FILE
5007(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5008to RM.
5009
5010If FILE is a libtool library, all the files associated with it are deleted.
5011Otherwise, only FILE itself is deleted using RM."
5012 ;;
5013
5014*)
5015 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5016 $echo "$help" 1>&2
5017 exit 1
5018 ;;
5019esac
5020
5021echo
5022$echo "Try \`$modename --help' for more information about other modes."
5023
5024exit 0
5025
5026# Local Variables:
5027# mode:shell-script
5028# sh-indentation:2
5029# End: