1. configure caches the command line options
[wxWidgets.git] / ltmain.sh
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
3 #
4 # Copyright (C) 1996-1998 Free Software Foundation, Inc.
5 # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
25
26 # Check that we have a working $echo.
27 if test "X$1" = X--no-reexec; then
28 # Discard the --no-reexec flag, and continue.
29 shift
30 elif test "X$1" = X--fallback-echo; then
31 # used as fallback echo
32 shift
33 cat <<EOF
34 $*
35 EOF
36 exit 0
37 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
38 # Yippee, $echo works!
39 :
40 else
41 # Restart under the correct shell, and then maybe $echo will work.
42 exec $SHELL "$0" --no-reexec ${1+"$@"}
43 fi
44
45 # The name of this program.
46 progname=`$echo "$0" | sed 's%^.*/%%'`
47 modename="$progname"
48
49 # Constants.
50 PROGRAM=ltmain.sh
51 PACKAGE=libtool
52 VERSION=1.2d
53
54 default_mode=
55 help="Try \`$progname --help' for more information."
56 magic="%%%MAGIC variable%%%"
57 mkdir="mkdir"
58 mv="mv -f"
59 rm="rm -f"
60
61 # Sed substitution that helps us do robust quoting. It backslashifies
62 # metacharacters that are still active within double-quoted strings.
63 Xsed='sed -e s/^X//'
64 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
65
66 # NLS nuisances.
67 # Only set LANG and LC_ALL to C if already set.
68 # These must not be set unconditionally because not all systems understand
69 # e.g. LANG=C (notably SCO).
70 # We save the old values to restore during execute mode.
71 if test "${LC_ALL+set}" = set; then
72 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
73 fi
74 if test "${LANG+set}" = set; then
75 save_LANG="$LANG"; LANG=C; export LANG
76 fi
77
78 if test "$LTCONFIG_VERSION" != "$VERSION"; then
79 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
80 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
81 exit 1
82 fi
83
84 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
85 echo "$modename: not configured to build any kind of library" 1>&2
86 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
87 exit 1
88 fi
89
90 # Global variables.
91 mode=$default_mode
92 nonopt=
93 prev=
94 prevopt=
95 run=
96 show="$echo"
97 show_help=
98 execute_dlfiles=
99 lo2o="s/\\.lo\$/.${objext}/"
100 los2o="s/\\.lo /.${objext} /g"
101
102 # Parse our command line options once, thoroughly.
103 while test $# -gt 0
104 do
105 arg="$1"
106 shift
107
108 case "$arg" in
109 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
110 *) optarg= ;;
111 esac
112
113 # If the previous option needs an argument, assign it.
114 if test -n "$prev"; then
115 case "$prev" in
116 execute_dlfiles)
117 eval "$prev=\"\$$prev \$arg\""
118 ;;
119 *)
120 eval "$prev=\$arg"
121 ;;
122 esac
123
124 prev=
125 prevopt=
126 continue
127 fi
128
129 # Have we seen a non-optional argument yet?
130 case "$arg" in
131 --help)
132 show_help=yes
133 ;;
134
135 --version)
136 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
137 exit 0
138 ;;
139
140 --config)
141 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
142 exit 0
143 ;;
144
145 --debug)
146 echo "$progname: enabling shell trace mode"
147 set -x
148 ;;
149
150 --dry-run | -n)
151 run=:
152 ;;
153
154 --features)
155 echo "host: $host"
156 if test "$build_libtool_libs" = yes; then
157 echo "enable shared libraries"
158 else
159 echo "disable shared libraries"
160 fi
161 if test "$build_old_libs" = yes; then
162 echo "enable static libraries"
163 else
164 echo "disable static libraries"
165 fi
166 exit 0
167 ;;
168
169 --finish) mode="finish" ;;
170
171 --mode) prevopt="--mode" prev=mode ;;
172 --mode=*) mode="$optarg" ;;
173
174 --quiet | --silent)
175 show=:
176 ;;
177
178 -dlopen)
179 prevopt="-dlopen"
180 prev=execute_dlfiles
181 ;;
182
183 -*)
184 $echo "$modename: unrecognized option \`$arg'" 1>&2
185 $echo "$help" 1>&2
186 exit 1
187 ;;
188
189 *)
190 nonopt="$arg"
191 break
192 ;;
193 esac
194 done
195
196 if test -n "$prevopt"; then
197 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
198 $echo "$help" 1>&2
199 exit 1
200 fi
201
202 if test -z "$show_help"; then
203
204 # Infer the operation mode.
205 if test -z "$mode"; then
206 case "$nonopt" in
207 *cc | *++ | gcc* | *-gcc*)
208 mode=link
209 for arg
210 do
211 case "$arg" in
212 -c)
213 mode=compile
214 break
215 ;;
216 esac
217 done
218 ;;
219 *db | *dbx | *strace | *truss)
220 mode=execute
221 ;;
222 *install*|cp|mv)
223 mode=install
224 ;;
225 *rm)
226 mode=uninstall
227 ;;
228 *)
229 # If we have no mode, but dlfiles were specified, then do execute mode.
230 test -n "$execute_dlfiles" && mode=execute
231
232 # Just use the default operation mode.
233 if test -z "$mode"; then
234 if test -n "$nonopt"; then
235 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
236 else
237 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
238 fi
239 fi
240 ;;
241 esac
242 fi
243
244 # Only execute mode is allowed to have -dlopen flags.
245 if test -n "$execute_dlfiles" && test "$mode" != execute; then
246 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
247 $echo "$help" 1>&2
248 exit 1
249 fi
250
251 # Change the help message to a mode-specific one.
252 generic_help="$help"
253 help="Try \`$modename --help --mode=$mode' for more information."
254
255 # These modes are in order of execution frequency so that they run quickly.
256 case "$mode" in
257 # libtool compile mode
258 compile)
259 modename="$modename: compile"
260 # Get the compilation command and the source file.
261 base_compile=
262 lastarg=
263 srcfile="$nonopt"
264 suppress_output=
265 force_static=no
266
267 user_target=no
268 for arg
269 do
270 # Accept any command-line options.
271 case "$arg" in
272 -o)
273 if test "$user_target" != "no"; then
274 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
275 exit 1
276 fi
277 user_target=next
278 ;;
279
280 -force-static)
281 force_static=yes
282 continue
283 ;;
284
285 -static)
286 build_old_libs=yes
287 continue
288 ;;
289 esac
290
291 case "$user_target" in
292 next)
293 # The next one is the -o target name
294 user_target=yes
295 continue
296 ;;
297 yes)
298 # We got the output file
299 user_target=set
300 libobj="$arg"
301 continue
302 ;;
303 esac
304
305 # Accept the current argument as the source file.
306 lastarg="$srcfile"
307 srcfile="$arg"
308
309 # Aesthetically quote the previous argument.
310
311 # Backslashify any backslashes, double quotes, and dollar signs.
312 # These are the only characters that are still specially
313 # interpreted inside of double-quoted scrings.
314 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
315
316 # Double-quote args containing other shell metacharacters.
317 # Many Bourne shells cannot handle close brackets correctly in scan
318 # sets, so we specify it separately.
319 case "$lastarg" in
320 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
321 lastarg="\"$lastarg\""
322 ;;
323 esac
324
325 # Add the previous argument to base_compile.
326 if test -z "$base_compile"; then
327 base_compile="$lastarg"
328 else
329 base_compile="$base_compile $lastarg"
330 fi
331 done
332
333 case "$user_target" in
334 set)
335 ;;
336 no)
337 # Get the name of the library object.
338 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
339 ;;
340 *)
341 $echo "$modename: you must specify a target with \`-o'" 1>&2
342 exit 1
343 ;;
344 esac
345
346 # Recognize several different file suffixes.
347 # If the user specifies -o file.o, it is replaced with file.lo
348 xform='[cCFSfmso]'
349 case "$libobj" in
350 *.ada) xform=ada ;;
351 *.adb) xform=adb ;;
352 *.ads) xform=ads ;;
353 *.asm) xform=asm ;;
354 *.c++) xform=c++ ;;
355 *.cc) xform=cc ;;
356 *.cpp) xform=cpp ;;
357 *.cxx) xform=cxx ;;
358 *.f90) xform=f90 ;;
359 *.for) xform=for ;;
360 esac
361
362 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
363
364 case "$libobj" in
365 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
366 *)
367 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
368 exit 1
369 ;;
370 esac
371
372 if test -z "$base_compile"; then
373 $echo "$modename: you must specify a compilation command" 1>&2
374 $echo "$help" 1>&2
375 exit 1
376 fi
377
378 # Delete any leftover library objects.
379 if test "$build_old_libs" = yes; then
380 removelist="$obj $libobj $lockfile"
381 else
382 removelist="$libobj $lockfile"
383 fi
384
385 $run $rm $removelist
386 trap "$run $rm $removelist; exit 1" 1 2 15
387
388 # Calculate the filename of the output object if compiler does
389 # not support -o with -c
390 if test "$compiler_c_o" = no; then
391 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
392 lockfile="$output_obj.lock"
393 removelist="$removelist $output_obj $lockfile"
394 trap "$run $rm $removelist; exit 1" 1 2 15
395 else
396 need_locks=no
397 lockfile=
398 fi
399
400 # Lock this critical section if it is needed
401 # We use this script file to make the link, it avoids creating a new file
402 if test "$need_locks" = yes; then
403 until ln "$0" "$lockfile" 2>/dev/null; do
404 $show "Waiting for $lockfile to be removed"
405 sleep 2
406 done
407 elif test "$need_locks" = warn; then
408 if test -f "$lockfile"; then
409 echo "\
410 *** ERROR, $lockfile exists and contains:
411 `cat $lockfile 2>/dev/null`
412
413 This indicates that another process is trying to use the same
414 temporary object file, and libtool could not work around it because
415 your compiler does not support \`-c' and \`-o' together. If you
416 repeat this compilation, it may succeed, by chance, but you had better
417 avoid parallel builds (make -j) in this platform, or get a better
418 compiler."
419
420 $run $rm $removelist
421 exit 1
422 fi
423 echo $srcfile > "$lockfile"
424 fi
425
426 if test -n "$fix_srcfile_path"; then
427 eval srcfile=\"$fix_srcfile_path\"
428 fi
429
430 # Only build a PIC object if we are building libtool libraries.
431 if test "$build_libtool_libs" = yes; then
432 # Without this assignment, base_compile gets emptied.
433 fbsd_hideous_sh_bug=$base_compile
434
435 # All platforms use -DPIC, to notify preprocessed assembler code.
436 command="$base_compile$pic_flag -DPIC $srcfile"
437 if test "$compiler_o_lo" = yes; then
438 command="$command -o $libobj"
439 output_obj="$libobj"
440 elif test "$compiler_c_o" = yes; then
441 command="$command -o $obj"
442 output_obj="$obj"
443 fi
444
445 $show "$command"
446 if $run eval "$command"; then :
447 else
448 test -n "$output_obj" && $run $rm $removelist
449 exit 1
450 fi
451
452 if test "$need_locks" = warn &&
453 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
454 echo "\
455 *** ERROR, $lockfile contains:
456 `cat $lockfile 2>/dev/null`
457
458 but it should contain:
459 $srcfile
460
461 This indicates that another process is trying to use the same
462 temporary object file, and libtool could not work around it because
463 your compiler does not support \`-c' and \`-o' together. If you
464 repeat this compilation, it may succeed, by chance, but you had better
465 avoid parallel builds (make -j) in this platform, or get a better
466 compiler."
467
468 $run $rm $removelist
469 exit 1
470 fi
471
472 # Just move the object if needed, then go on to compile the next one
473 if test "$compiler_o_lo" = no && test x"$output_obj" != x"$libobj"; then
474 $show "$mv $output_obj $libobj"
475 if $run $mv $output_obj $libobj; then :
476 else
477 error=$?
478 $run $rm $removelist
479 exit $error
480 fi
481 fi
482
483 # If we have no pic_flag and do not have -force-static,
484 # then copy the object into place and finish.
485 if test -z "$pic_flag" && test "$force_static" = no; then
486 $show "$LN_S $libobj $obj"
487 if $run $LN_S $libobj $obj; then
488 exit 0
489 else
490 error=$?
491 $run $rm $removelist
492 exit $error
493 fi
494 fi
495
496 # Allow error messages only from the first compilation.
497 suppress_output=' >/dev/null 2>&1'
498 fi
499
500 # Only build a position-dependent object if we build old libraries.
501 if test "$build_old_libs" = yes; then
502 command="$base_compile $srcfile"
503 if test "$force_static" = yes; then
504 command="$command -DLIBTOOL_STATIC"
505 fi
506 if test "$compiler_c_o" = yes; then
507 command="$command -o $obj"
508 output_obj="$obj"
509 fi
510
511 # Suppress compiler output if we already did a PIC compilation.
512 command="$command$suppress_output"
513 $show "$command"
514 if $run eval "$command"; then :
515 else
516 $run $rm $removelist
517 exit 1
518 fi
519
520 if test "$need_locks" = warn &&
521 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
522 echo "\
523 *** ERROR, $lockfile contains:
524 `cat $lockfile 2>/dev/null`
525
526 but it should contain:
527 $srcfile
528
529 This indicates that another process is trying to use the same
530 temporary object file, and libtool could not work around it because
531 your compiler does not support \`-c' and \`-o' together. If you
532 repeat this compilation, it may succeed, by chance, but you had better
533 avoid parallel builds (make -j) in this platform, or get a better
534 compiler."
535
536 $run $rm $removelist
537 exit 1
538 fi
539
540 # Just move the object if needed
541 if test "$compiler_c_o" = no && test x"$output_obj" != x"$obj"; then
542 $show "$mv $output_obj $obj"
543 if $run $mv $output_obj $obj; then :
544 else
545 error=$?
546 $run $rm $removelist
547 exit $error
548 fi
549 fi
550 fi
551
552 # Unlock the critical section if it was locked
553 if test "$need_locks" != no; then
554 $rm "$lockfile"
555 fi
556
557 # Create an invalid libtool object if no PIC, so that we do not
558 # accidentally link it into a program.
559 if test "$build_libtool_libs" != yes; then
560 $show "echo timestamp > $libobj"
561 $run eval "echo timestamp > \$libobj" || exit $?
562 fi
563
564 exit 0
565 ;;
566
567 # libtool link mode
568 link)
569 modename="$modename: link"
570 C_compiler="$CC" # save it, to compile generated C sources
571 CC="$nonopt"
572 allow_undefined=yes
573 compile_command="$CC"
574 finalize_command="$CC"
575
576 compile_shlibpath=
577 finalize_shlibpath=
578 convenience=
579 old_convenience=
580 deplibs=
581 eval lib_search_path=\"$sys_lib_search_path\"
582
583 dlfiles=
584 dlprefiles=
585 export_dynamic=no
586 export_symbols=
587 generated=
588 hardcode_libdirs=
589 libobjs=
590 link_against_libtool_libs=
591 ltlibs=
592 module=no
593 objs=
594 prev=
595 prevarg=
596 release=
597 rpath=
598 perm_rpath=
599 temp_rpath=
600 vinfo=
601
602 # We need to know -static, to get the right output filenames.
603 for arg
604 do
605 case "$arg" in
606 -all-static | -static)
607 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
608 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
609 fi
610 build_libtool_libs=no
611 build_old_libs=yes
612 break
613 ;;
614 esac
615 done
616
617 # See if our shared archives depend on static archives.
618 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
619
620 # Go through the arguments, transforming them on the way.
621 while test $# -gt 0; do
622 arg="$1"
623 shift
624
625 # If the previous option needs an argument, assign it.
626 if test -n "$prev"; then
627 case "$prev" in
628 output)
629 compile_command="$compile_command @OUTPUT@"
630 finalize_command="$finalize_command @OUTPUT@"
631 ;;
632 esac
633
634 case "$prev" in
635 dlfiles|dlprefiles)
636 case "$arg" in
637 *.la | *.lo) ;; # We handle these cases below.
638 *)
639 dlprefiles="$dlprefiles $arg"
640 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
641 prev=
642 ;;
643 esac
644 ;;
645 exportsyms)
646 export_symbols="$arg"
647 if test ! -f "$arg"; then
648 $echo "$modename: symbol file \`$arg' does not exist"
649 exit 1
650 fi
651 prev=
652 ;;
653 release)
654 release="-$arg"
655 prev=
656 continue
657 ;;
658 rpath)
659 rpath="$rpath $arg"
660 prev=
661 continue
662 ;;
663 *)
664 eval "$prev=\"\$arg\""
665 prev=
666 continue
667 ;;
668 esac
669 fi
670
671 prevarg="$arg"
672
673 case "$arg" in
674 -all-static)
675 if test -n "$link_static_flag"; then
676 compile_command="$compile_command $link_static_flag"
677 finalize_command="$finalize_command $link_static_flag"
678 fi
679 continue
680 ;;
681
682 -allow-undefined)
683 # FIXME: remove this flag sometime in the future.
684 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
685 continue
686 ;;
687
688 -dlopen)
689 prev=dlfiles
690 continue
691 ;;
692
693 -dlpreopen)
694 prev=dlprefiles
695 continue
696 ;;
697
698 -export-dynamic)
699 if test "$export_dynamic" != yes; then
700 export_dynamic=yes
701 if test -n "$export_dynamic_flag_spec"; then
702 eval arg=\"$export_dynamic_flag_spec\"
703 else
704 arg=
705 fi
706
707 # Add the symbol object into the linking commands.
708 compile_command="$compile_command @SYMFILE@"
709 finalize_command="$finalize_command @SYMFILE@"
710 fi
711 ;;
712
713 -export-symbols)
714 if test -n "$export_symbols"; then
715 $echo "$modename: cannot have more than one -exported-symbols"
716 exit 1
717 fi
718 prev=exportsyms
719 continue
720 ;;
721
722 -L*)
723 # dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
724 # case "$dir" in
725 # /* | [A-Za-z]:[/\\]*)
726 # # Add the corresponding hardcode_libdir_flag, if it is not identical.
727 # ;;
728 # *)
729 # $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
730 # exit 1
731 # ;;
732 # esac
733 deplibs="$deplibs $arg"
734 lib_search_path="$lib_search_path `expr $arg : '-L\(.*\)'`"
735 ;;
736
737 -l*) deplibs="$deplibs $arg" ;;
738
739 -module)
740 if test "$module" != yes; then
741 module=yes
742 if test -n "$export_dynamic_flag_spec"; then
743 eval arg=\"$export_dynamic_flag_spec\"
744 else
745 arg=
746 fi
747 fi
748 ;;
749
750 -no-undefined)
751 allow_undefined=no
752 continue
753 ;;
754
755 -o) prev=output ;;
756
757 -release)
758 prev=release
759 continue
760 ;;
761
762 -rpath)
763 prev=rpath
764 continue
765 ;;
766
767 -static)
768 # If we have no pic_flag, then this is the same as -all-static.
769 if test -z "$pic_flag" && test -n "$link_static_flag"; then
770 compile_command="$compile_command $link_static_flag"
771 finalize_command="$finalize_command $link_static_flag"
772 fi
773 continue
774 ;;
775
776 -version-info)
777 prev=vinfo
778 continue
779 ;;
780
781 # Some other compiler flag.
782 -* | +*)
783 # Unknown arguments in both finalize_command and compile_command need
784 # to be aesthetically quoted because they are evaled later.
785 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
786 case "$arg" in
787 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
788 arg="\"$arg\""
789 ;;
790 esac
791 ;;
792
793 *.o | *.obj | *.a | *.lib)
794 # A standard object.
795 objs="$objs $arg"
796 ;;
797
798 *.lo)
799 # A library object.
800 if test "$prev" = dlfiles; then
801 dlfiles="$dlfiles $arg"
802 if test "$build_libtool_libs" = yes; then
803 prev=
804 continue
805 else
806 # If libtool objects are unsupported, then we need to preload.
807 prev=dlprefiles
808 fi
809 fi
810
811 if test "$prev" = dlprefiles; then
812 # Preload the old-style object.
813 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
814 prev=
815 fi
816 libobjs="$libobjs $arg"
817 ;;
818
819 *.la)
820 # A libtool-controlled library.
821
822 dlname=
823 libdir=
824 library_names=
825 old_library=
826
827 # Check to see that this really is a libtool archive.
828 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
829 else
830 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
831 exit 1
832 fi
833
834 # If the library was installed with an old release of libtool,
835 # it will not redefine variable installed.
836 installed=yes
837
838 # If there is no directory component, then add one.
839 case "$arg" in
840 */* | *\\*) . $arg ;;
841 *) . ./$arg ;;
842 esac
843
844 # Get the name of the library we link against.
845 linklib=
846 for l in $old_library $library_names; do
847 linklib="$l"
848 done
849
850 if test -z "$linklib"; then
851 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
852 exit 1
853 fi
854
855 # Find the relevant object directory and library name.
856 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
857
858 if test "X$installed" = Xyes; then
859 dir="$libdir"
860 else
861 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
862 if test "X$dir" = "X$arg"; then
863 dir="$objdir"
864 else
865 dir="$dir/$objdir"
866 fi
867 fi
868
869 if test -z "$libdir"; then
870 # It is a libtool convenience library, so add in its objects.
871 convenience="$convenience $dir/$old_library"
872 old_convenience="$old_convenience $dir/$old_library"
873 deplibs="$deplibs$dependency_libs"
874 compile_command="$compile_command $dir/$old_library$dependency_libs"
875 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
876 continue
877 fi
878
879 # This library was specified with -dlopen.
880 if test "$prev" = dlfiles; then
881 dlfiles="$dlfiles $arg"
882 if test -z "$dlname" || test "$build_libtool_libs" = no; then
883 # If there is no dlname or we're linking statically,
884 # we need to preload.
885 prev=dlprefiles
886 else
887 # We should not create a dependency on this library, but we
888 # may need any libraries it requires.
889 compile_command="$compile_command$dependency_libs"
890 finalize_command="$finalize_command$dependency_libs"
891 prev=
892 continue
893 fi
894 fi
895
896 # The library was specified with -dlpreopen.
897 if test "$prev" = dlprefiles; then
898 # Prefer using a static library (so that no silly _DYNAMIC symbols
899 # are required to link).
900 if test -n "$old_library"; then
901 dlprefiles="$dlprefiles $dir/$old_library"
902 else
903 dlprefiles="$dlprefiles $dir/$linklib"
904 fi
905 prev=
906 fi
907
908 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
909 link_against_libtool_libs="$link_against_libtool_libs $arg"
910 if test -n "$shlibpath_var"; then
911 # Make sure the rpath contains only unique directories.
912 case "$temp_rpath " in
913 *" $dir "*) ;;
914 *) temp_rpath="$temp_rpath $dir" ;;
915 esac
916 fi
917
918 # This is the magic to use -rpath.
919 if test -n "$hardcode_libdir_flag_spec"; then
920 if test -n "$hardcode_libdir_separator"; then
921 if test -z "$hardcode_libdirs"; then
922 # Put the magic libdir with the hardcode flag.
923 hardcode_libdirs="$libdir"
924 libdir="@HARDCODE_LIBDIRS@"
925 else
926 # Just accumulate the unique libdirs.
927 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
928 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
929 ;;
930 *)
931 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
932 ;;
933 esac
934 libdir=
935 fi
936 fi
937
938 if test -n "$libdir"; then
939 eval flag=\"$hardcode_libdir_flag_spec\"
940
941 compile_command="$compile_command $flag"
942 finalize_command="$finalize_command $flag"
943 fi
944 elif test -n "$runpath_var"; then
945 # Do the same for the permanent run path.
946 case "$perm_rpath " in
947 *" $libdir "*) ;;
948 *) perm_rpath="$perm_rpath $libdir" ;;
949 esac
950 fi
951
952
953 lib_linked=yes
954 case "$hardcode_action" in
955 immediate | unsupported)
956 if test "$hardcode_direct" = no; then
957 compile_command="$compile_command $dir/$linklib"
958 elif test "$hardcode_minus_L" = no; then
959 case "$host" in
960 *-*-sunos*)
961 compile_shlibpath="$compile_shlibpath$dir:"
962 ;;
963 esac
964 compile_command="$compile_command -L$dir -l$name"
965 elif test "$hardcode_shlibpath_var" = no; then
966 compile_shlibpath="$compile_shlibpath$dir:"
967 compile_command="$compile_command -l$name"
968 else
969 lib_linked=no
970 fi
971 ;;
972
973 relink)
974 # We need an absolute path.
975 case "$dir" in
976 /* | [A-Za-z]:[/\\]*) ;;
977 *)
978 absdir=`cd "$dir" && pwd`
979 if test -z "$absdir"; then
980 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
981 exit 1
982 fi
983 dir="$absdir"
984 ;;
985 esac
986
987 if test "$hardcode_direct" = yes; then
988 compile_command="$compile_command $dir/$linklib"
989 elif test "$hardcode_minus_L" = yes; then
990 compile_command="$compile_command -L$dir -l$name"
991 elif test "$hardcode_shlibpath_var" = yes; then
992 compile_shlibpath="$compile_shlibpath$dir:"
993 compile_command="$compile_command -l$name"
994 else
995 lib_linked=no
996 fi
997 ;;
998
999 *)
1000 lib_linked=no
1001 ;;
1002 esac
1003
1004 if test "$lib_linked" != yes; then
1005 $echo "$modename: configuration error: unsupported hardcode properties"
1006 exit 1
1007 fi
1008
1009 # Finalize command for both is simple: just hardcode it.
1010 if test "$hardcode_direct" = yes; then
1011 finalize_command="$finalize_command $libdir/$linklib"
1012 elif test "$hardcode_minus_L" = yes; then
1013 finalize_command="$finalize_command -L$libdir -l$name"
1014 elif test "$hardcode_shlibpath_var" = yes; then
1015 finalize_shlibpath="$finalize_shlibpath$libdir:"
1016 finalize_command="$finalize_command -l$name"
1017 else
1018 # We cannot seem to hardcode it, guess we'll fake it.
1019 finalize_command="$finalize_command -L$libdir -l$name"
1020 fi
1021 else
1022 # Transform directly to old archives if we don't build new libraries.
1023 if test -n "$pic_flag" && test -z "$old_library"; then
1024 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1025 exit 1
1026 fi
1027
1028 # Here we assume that one of hardcode_direct or hardcode_minus_L
1029 # is not unsupported. This is valid on all known static and
1030 # shared platforms.
1031 if test "$hardcode_direct" != unsupported; then
1032 test -n "$old_library" && linklib="$old_library"
1033 compile_command="$compile_command $dir/$linklib"
1034 finalize_command="$finalize_command $dir/$linklib"
1035 else
1036 compile_command="$compile_command -L$dir -l$name"
1037 finalize_command="$finalize_command -L$dir -l$name"
1038 fi
1039 fi
1040
1041 # Add in any libraries that this one depends upon.
1042 compile_command="$compile_command$dependency_libs"
1043 finalize_command="$finalize_command$dependency_libs"
1044 continue
1045 ;;
1046
1047 # Some other compiler argument.
1048 *)
1049 # Unknown arguments in both finalize_command and compile_command need
1050 # to be aesthetically quoted because they are evaled later.
1051 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1052 case "$arg" in
1053 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1054 arg="\"$arg\""
1055 ;;
1056 esac
1057 ;;
1058 esac
1059
1060 # Now actually substitute the argument into the commands.
1061 if test -n "$arg"; then
1062 compile_command="$compile_command $arg"
1063 finalize_command="$finalize_command $arg"
1064 fi
1065 done
1066
1067 if test -n "$prev"; then
1068 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1069 $echo "$help" 1>&2
1070 exit 1
1071 fi
1072
1073 if test -n "$export_symbols" && test "$module" = yes; then
1074 $echo "$modename: \`-export-symbols' is not supported for modules"
1075 exit 1
1076 fi
1077
1078 oldlibs=
1079 # calculate the name of the file, without its directory
1080 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1081
1082 case "$output" in
1083 "")
1084 $echo "$modename: you must specify an output file" 1>&2
1085 $echo "$help" 1>&2
1086 exit 1
1087 ;;
1088
1089 *.a | *.lib)
1090 if test -n "$link_against_libtool_libs"; then
1091 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1092 exit 1
1093 fi
1094
1095 if test -n "$deplibs"; then
1096 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1097 fi
1098
1099 if test -n "$dlfiles$dlprefiles"; then
1100 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1101 fi
1102
1103 if test -n "$rpath"; then
1104 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
1105 fi
1106
1107 if test -n "$vinfo"; then
1108 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1109 fi
1110
1111 if test -n "$release"; then
1112 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
1113 fi
1114
1115 if test -n "$export_symbols"; then
1116 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1117 fi
1118
1119 # Now set the variables for building old libraries.
1120 build_libtool_libs=no
1121 oldlibs="$output"
1122 ;;
1123
1124 *.la)
1125 # Make sure we only generate libraries of the form `libNAME.la'.
1126 case "$outputname" in
1127 lib*) ;;
1128 *)
1129 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
1130 $echo "$help" 1>&2
1131 exit 1
1132 ;;
1133 esac
1134
1135 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1136 eval libname=\"$libname_spec\"
1137
1138 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1139 if test "X$output_objdir" = "X$output"; then
1140 output_objdir="$objdir"
1141 else
1142 output_objdir="$output_objdir/$objdir"
1143 fi
1144
1145 # All the library-specific variables (install_libdir is set above).
1146 library_names=
1147 old_library=
1148 dlname=
1149
1150 if test -n "$objs"; then
1151 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
1152 exit 1
1153 fi
1154
1155 # How the heck are we supposed to write a wrapper for a shared library?
1156 if test -n "$link_against_libtool_libs"; then
1157 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1158 exit 1
1159 fi
1160
1161 if test -n "$dlfiles$dlprefiles"; then
1162 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1163 fi
1164
1165 set dummy $rpath
1166 if test $# -gt 2; then
1167 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1168 fi
1169 install_libdir="$2"
1170
1171 oldlibs=
1172 if test -z "$rpath"; then
1173 # Building a libtool convenience library.
1174 libext=al
1175 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1176 build_libtool_libs=convenience
1177 dependency_libs="$deplibs"
1178
1179 if test -n "$vinfo"; then
1180 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1181 fi
1182
1183 if test -n "$release"; then
1184 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
1185 fi
1186 else
1187
1188 # Parse the version information argument.
1189 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
1190 set dummy $vinfo 0 0 0
1191 IFS="$save_ifs"
1192
1193 if test -n "$8"; then
1194 $echo "$modename: too many parameters to \`-version-info'" 1>&2
1195 $echo "$help" 1>&2
1196 exit 1
1197 fi
1198
1199 current="$2"
1200 revision="$3"
1201 age="$4"
1202
1203 # Check that each of the things are valid numbers.
1204 case "$current" in
1205 0 | [1-9] | [1-9][0-9]*) ;;
1206 *)
1207 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1208 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1209 exit 1
1210 ;;
1211 esac
1212
1213 case "$revision" in
1214 0 | [1-9] | [1-9][0-9]*) ;;
1215 *)
1216 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1217 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1218 exit 1
1219 ;;
1220 esac
1221
1222 case "$age" in
1223 0 | [1-9] | [1-9][0-9]*) ;;
1224 *)
1225 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1226 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1227 exit 1
1228 ;;
1229 esac
1230
1231 if test $age -gt $current; then
1232 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
1233 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1234 exit 1
1235 fi
1236
1237 # Calculate the version variables.
1238 major=
1239 versuffix=
1240 verstring=
1241 case "$version_type" in
1242 none) ;;
1243
1244 linux)
1245 major=.`expr $current - $age`
1246 versuffix="$major.$age.$revision"
1247 ;;
1248
1249 osf)
1250 major=`expr $current - $age`
1251 versuffix=".$current.$age.$revision"
1252 verstring="$current.$age.$revision"
1253
1254 # Add in all the interfaces that we are compatible with.
1255 loop=$age
1256 while test $loop != 0; do
1257 iface=`expr $current - $loop`
1258 loop=`expr $loop - 1`
1259 verstring="$verstring:${iface}.0"
1260 done
1261
1262 # Make executables depend on our current version.
1263 verstring="$verstring:${current}.0"
1264 ;;
1265
1266 sunos)
1267 major=".$current"
1268 versuffix=".$current.$revision"
1269 ;;
1270
1271 freebsd-aout)
1272 major=".$current"
1273 versuffix=".$current.$revision";
1274 ;;
1275
1276 freebsd-elf)
1277 major=".$current"
1278 versuffix=".$current";
1279 ;;
1280
1281 windows)
1282 # Like Linux, but with '-' rather than '.', since we only
1283 # want one extension on Windows 95.
1284 major=`expr $current - $age`
1285 versuffix="-$major-$age-$revision"
1286 ;;
1287
1288 *)
1289 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1290 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1291 exit 1
1292 ;;
1293 esac
1294
1295 # Clear the version info if we defaulted, and they specified a release.
1296 if test -z "$vinfo" && test -n "$release"; then
1297 major=
1298 versuffix=
1299 verstring="0.0"
1300 case "$host" in
1301 *-*-sunos*)
1302 versuffix=".0.0"
1303 ;;
1304 esac
1305 fi
1306
1307 # Check to see if the archive will have undefined symbols.
1308 if test "$allow_undefined" = yes; then
1309 if test "$allow_undefined_flag" = unsupported; then
1310 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1311 build_libtool_libs=no
1312 build_old_libs=yes
1313 fi
1314 else
1315 # Don't allow undefined symbols.
1316 allow_undefined_flag="$no_undefined_flag"
1317 fi
1318
1319 # Add libc to deplibs on all systems.
1320 dependency_libs="$deplibs"
1321 deplibs="$deplibs -lc"
1322 fi
1323
1324 # Create the output directory, or remove our outputs if we need to.
1325 if test -d $output_objdir; then
1326 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1327 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1328 else
1329 $show "$mkdir $output_objdir"
1330 $run $mkdir $output_objdir
1331 status=$?
1332 if test $status -ne 0 && test ! -d $output_objdir; then
1333 exit $status
1334 fi
1335 fi
1336
1337 # Now set the variables for building old libraries.
1338 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1339 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1340
1341 # Transform .lo files to .o files.
1342 oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.'${libext}' //g' -e "$los2o" -e 's/ $//g'`
1343 fi
1344
1345 if test "$build_libtool_libs" = yes; then
1346 # Transform deplibs into only deplibs that can be linked in shared.
1347 ## Gordon: Do you check for the existence of the libraries in deplibs
1348 ## on the system? That should maybe be merged in here someplace....
1349 ## Actually: I think test_compile and file_magic do this... file_regex
1350 ## sorta does this. Only pas_all needs to be changed. -Toshio
1351 name_save=$name
1352 libname_save=$libname
1353 release_save=$release
1354 versuffix_save=$versuffix
1355 major_save=$major
1356 # I'm not sure if I'm treating the release correctly. I think
1357 # release should show up in the -l (ie -lgmp5) so we don't want to
1358 # add it in twice. Is that correct?
1359 release=""
1360 versuffix=""
1361 major=""
1362 newdeplibs=
1363 case "$check_shared_deplibs_method" in
1364 pass_all)
1365 newdeplibs=$deplibs
1366 ;; # Don't check for shared/static. Everything works.
1367 # This might be a little naive. We might want to check
1368 # whether the library exists or not. But this is on
1369 # osf3 & osf4 and I'm not really sure... Just
1370 # implementing what was already the behaviour.
1371 test_compile)
1372 # This code stresses the "libraries are programs" paradigm to its
1373 # limits. Maybe even breaks it. We compile a program, linking it
1374 # against the deplibs as a proxy for the library. Then we can check
1375 # whether they linked in statically or dynamically with ldd.
1376 $rm conftest.c
1377 cat > conftest.c <<EOF
1378 int main() { return 0; }
1379 EOF
1380 $rm a.out
1381 $C_compiler conftest.c $deplibs
1382 if test $? -eq 0 ; then
1383 ldd_output=`ldd a.out`
1384 for i in $deplibs; do
1385 name="`expr $i : '-l\(.*\)'`"
1386 # If $name is empty we are operating on a -L argument.
1387 if test "$name" != "" ; then
1388 libname=`eval \\$echo \"$libname_spec\"`
1389 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1390 set dummy $deplib_matches
1391 deplib_match=$2
1392 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1393 newdeplibs="$newdeplibs $i"
1394 else
1395 echo
1396 echo "*** Warning: This library needs some functionality provided by $i."
1397 echo "*** I have the capability to make that library automatically link in when"
1398 echo "*** you link to this library. But I can only do this if you have a"
1399 echo "*** shared version of the library, which you do not appear to have."
1400 fi
1401 else
1402 newdeplibs="$newdeplibs $i"
1403 fi
1404 done
1405 else
1406 # Error occured in the first compile. Let's try to salvage the situation:
1407 # Compile a seperate program for each library.
1408 for i in $deplibs; do
1409 name="`expr $i : '-l\(.*\)'`"
1410 # If $name is empty we are operating on a -L argument.
1411 if test "$name" != "" ; then
1412 $rm a.out
1413 $C_compiler conftest.c $i
1414 # Did it work?
1415 if test $? -eq 0 ; then
1416 ldd_output=`ldd a.out`
1417 libname=`eval \\$echo \"$libname_spec\"`
1418 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1419 set dummy $deplib_matches
1420 deplib_match=$2
1421 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1422 newdeplibs="$newdeplibs $i"
1423 else
1424 echo
1425 echo "*** Warning: This library needs some functionality provided by $i."
1426 echo "*** I have the capability to make that library automatically link in when"
1427 echo "*** you link to this library. But I can only do this if you have a"
1428 echo "*** shared version of the library, which you do not appear to have."
1429 fi
1430 else
1431 echo
1432 echo "*** Warning! Library $i is needed by this library but I was not able to"
1433 echo "*** make it link in! You will probably need to install it or some"
1434 echo "*** library that it depends on before this library will be fully"
1435 echo "*** functional. Installing it before continuing would be even better."
1436 fi
1437 else
1438 newdeplibs="$newdeplibs $i"
1439 fi
1440 done
1441 fi
1442 deplibs=$newdeplibs
1443 ;;
1444 file_magic* | file_regex)
1445 set dummy $check_shared_deplibs_method
1446 file_magic_regex="`expr \"$check_shared_deplibs_method\" : \"$2\(.*\)\"`"
1447 for a_deplib in $deplibs; do
1448 name="`expr $a_deplib : '-l\(.*\)'`"
1449 # If $name is empty we are operating on a -L argument.
1450 if test "$name" != "" ; then
1451 libname=`eval \\$echo \"$libname_spec\"`
1452 case "$check_shared_deplibs_method" in
1453 file_magic*)
1454 for i in $lib_search_path; do
1455 # This needs to be more general than file_regex in order to
1456 # catch things like glibc on linux. Maybe file_regex
1457 # should be more general as well, but maybe not. Since
1458 # library names are supposed to conform to
1459 # library_name_spec, I think file_regex should remain
1460 # strict. What do you think Gordon?
1461 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1462 for potent_lib in $potential_libs; do
1463 file_output=`file $potent_lib`
1464 if test `expr "$file_output" : ".*$file_magic_regex"` -ne 0 ; then
1465 newdeplibs="$newdeplibs $a_deplib"
1466 a_deplib=""
1467 break 2
1468 fi
1469 done
1470 done
1471 ;;
1472 file_regex)
1473 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1474 set dummy $deplib_matches
1475 deplib_match=$2
1476 for i in $lib_search_path; do
1477 potential_libs=`ls $i/$deplib_match* 2>/dev/null`
1478 if test "$potential_libs" != "" ; then
1479 newdeplibs="$newdeplibs $a_deplib"
1480 a_deplib=""
1481 break
1482 fi
1483 done
1484 ;;
1485 esac
1486 if test "$a_deplib" != "" ; then
1487 echo
1488 echo "*** Warning: This library needs some functionality provided by $a_deplib."
1489 echo "*** I have the capability to make that library automatically link in when"
1490 echo "*** you link to this library. But I can only do this if you have a"
1491 echo "*** shared version of the library, which you do not appear to have."
1492 fi
1493 else
1494 # Add a -L argument.
1495 newdeplibs="$newdeplibs $a_deplib"
1496 fi
1497 done # Gone through all deplibs.
1498 ;;
1499 none | *) deplibs="" ;;
1500 esac
1501 versuffix=$versuffix_save
1502 major=$major_save
1503 release=$release_save
1504 libname=$libname_save
1505 name=$name_save
1506 deplibs=$newdeplibs
1507 # Done checking deplibs!
1508
1509 # Get the real and link names of the library.
1510 eval library_names=\"$library_names_spec\"
1511 set dummy $library_names
1512 realname="$2"
1513 shift; shift
1514
1515 if test -n "$soname_spec"; then
1516 eval soname=\"$soname_spec\"
1517 else
1518 soname="$realname"
1519 fi
1520
1521 lib="$output_objdir/$realname"
1522 for link
1523 do
1524 linknames="$linknames $link"
1525 done
1526
1527 # Use standard objects if they are PIC.
1528 test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e "$los2o" -e 's/ $//g'`
1529
1530 if test -n "$whole_archive_flag_spec"; then
1531 if test -n "$convenience"; then
1532 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
1533 fi
1534 else
1535 for xlib in $convenience; do
1536 # Extract the objects.
1537 xdir="$xlib"x
1538 generated="$generated $xdir"
1539 xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
1540
1541 $show "${rm}r $xdir"
1542 $run ${rm}r "$xdir"
1543 $show "mkdir $xdir"
1544 $run mkdir "$xdir"
1545 status=$?
1546 if test $status -ne 0 && test ! -d "$xdir"; then
1547 exit $status
1548 fi
1549 $show "(cd $xdir && $AR x ../$xlib)"
1550 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
1551
1552 libobjs="$libobjs `echo $xdir/*`"
1553 done
1554 fi
1555
1556 # Do each of the archive commands.
1557 if test -n "$export_symbols" && test -n "$archive_sym_cmds"; then
1558 eval cmds=\"$archive_sym_cmds\"
1559 else
1560 eval cmds=\"$archive_cmds\"
1561 fi
1562 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1563 for cmd in $cmds; do
1564 IFS="$save_ifs"
1565 $show "$cmd"
1566 $run eval "$cmd" || exit $?
1567 done
1568 IFS="$save_ifs"
1569
1570 # Create links to the real library.
1571 for linkname in $linknames; do
1572 if test "$realname" != "$linkname"; then
1573 $show "(cd $output_objdir && $LN_S $realname $linkname)"
1574 $run eval '(cd $output_objdir && $LN_S $realname $linkname)' || exit $?
1575 fi
1576 done
1577
1578 # If -module or -export-dynamic was specified, set the dlname.
1579 if test "$module" = yes || test "$export_dynamic" = yes; then
1580 # On all known operating systems, these are identical.
1581 dlname="$soname"
1582 fi
1583 fi
1584 ;;
1585
1586 *.lo | *.o | *.obj)
1587 if test -n "$link_against_libtool_libs"; then
1588 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
1589 exit 1
1590 fi
1591
1592 if test -n "$deplibs"; then
1593 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
1594 fi
1595
1596 if test -n "$dlfiles$dlprefiles"; then
1597 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
1598 fi
1599
1600 if test -n "$rpath"; then
1601 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
1602 fi
1603
1604 if test -n "$vinfo"; then
1605 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
1606 fi
1607
1608 if test -n "$release"; then
1609 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
1610 fi
1611
1612 case "$output" in
1613 *.lo)
1614 if test -n "$objs"; then
1615 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
1616 exit 1
1617 fi
1618 libobj="$output"
1619 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
1620 ;;
1621 *)
1622 libobj=
1623 obj="$output"
1624 ;;
1625 esac
1626
1627 # Delete the old objects.
1628 $run $rm $obj $libobj
1629
1630 # Create the old-style object.
1631 reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.'${libext}' //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
1632
1633 output="$obj"
1634 eval cmds=\"$reload_cmds\"
1635 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1636 for cmd in $cmds; do
1637 IFS="$save_ifs"
1638 $show "$cmd"
1639 $run eval "$cmd" || exit $?
1640 done
1641 IFS="$save_ifs"
1642
1643 # Exit if we aren't doing a library object file.
1644 test -z "$libobj" && exit 0
1645
1646 if test "$build_libtool_libs" != yes; then
1647 # Create an invalid libtool object if no PIC, so that we don't
1648 # accidentally link it into a program.
1649 $show "echo timestamp > $libobj"
1650 $run eval "echo timestamp > $libobj" || exit $?
1651 exit 0
1652 fi
1653
1654 if test -n "$pic_flag"; then
1655 # Only do commands if we really have different PIC objects.
1656 reload_objs="$libobjs"
1657 output="$libobj"
1658 eval cmds=\"$reload_cmds\"
1659 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1660 for cmd in $cmds; do
1661 IFS="$save_ifs"
1662 $show "$cmd"
1663 $run eval "$cmd" || exit $?
1664 done
1665 IFS="$save_ifs"
1666 else
1667 # Just create a symlink.
1668 $show "$LN_S $obj $libobj"
1669 $run $LN_S $obj $libobj || exit $?
1670 fi
1671
1672 exit 0
1673 ;;
1674
1675 # Anything else should be a program.
1676 *)
1677 if test -n "$vinfo"; then
1678 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
1679 fi
1680
1681 if test -n "$release"; then
1682 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
1683 fi
1684
1685 if test -n "$rpath"; then
1686 # If the user specified any rpath flags, then add them.
1687 for libdir in $rpath; do
1688 if test -n "$hardcode_libdir_flag_spec"; then
1689 if test -n "$hardcode_libdir_separator"; then
1690 if test -z "$hardcode_libdirs"; then
1691 # Put the magic libdir with the hardcode flag.
1692 hardcode_libdirs="$libdir"
1693 libdir="@HARDCODE_LIBDIRS@"
1694 else
1695 # Just accumulate the unique libdirs.
1696 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1697 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1698 ;;
1699 *)
1700 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1701 ;;
1702 esac
1703 libdir=
1704 fi
1705 fi
1706
1707 if test -n "$libdir"; then
1708 eval flag=\"$hardcode_libdir_flag_spec\"
1709
1710 compile_command="$compile_command $flag"
1711 finalize_command="$finalize_command $flag"
1712 fi
1713 elif test -n "$runpath_var"; then
1714 case "$perm_rpath " in
1715 *" $libdir "*) ;;
1716 *) perm_rpath="$perm_rpath $libdir" ;;
1717 esac
1718 fi
1719 done
1720 fi
1721
1722 # Substitute the hardcoded libdirs into the compile commands.
1723 if test -n "$hardcode_libdir_separator"; then
1724 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1725 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1726 fi
1727
1728 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1729 if test "X$output_objdir" = "X$output"; then
1730 output_objdir="$objdir"
1731 else
1732 output_objdir="$output_objdir/$objdir"
1733 fi
1734
1735 if test -n "$libobjs" && test "$build_old_libs" = yes; then
1736 # Transform all the library objects into standard objects.
1737 compile_command=`$echo "X$compile_command " | $Xsed -e "$los2o" -e 's/ $//'`
1738 finalize_command=`$echo "X$finalize_command " | $Xsed -e "$los2o" -e 's/ $//'`
1739 fi
1740
1741 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1742 dlsyms="${outputname}S.c"
1743 else
1744 dlsyms=
1745 fi
1746
1747 if test -n "$dlsyms"; then
1748 case "$dlsyms" in
1749 "") ;;
1750 *.c)
1751 if test -z "$export_symbols"; then
1752 # Add our own program objects to the preloaded list.
1753 dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e "$los2o" -e 's/ $//'`
1754 fi
1755
1756 # Discover the nlist of each of the dlfiles.
1757 nlist="$objdir/${output}.nm"
1758
1759 if test -d $objdir; then
1760 $show "$rm $nlist ${nlist}T"
1761 $run $rm "$nlist" "${nlist}T"
1762 else
1763 $show "$mkdir $objdir"
1764 $run $mkdir $objdir
1765 status=$?
1766 if test $status -ne 0 && test ! -d $objdir; then
1767 exit $status
1768 fi
1769 fi
1770
1771 # Parse the name list into a source file.
1772 $show "creating $objdir/$dlsyms"
1773
1774 $echo > "$objdir/$dlsyms" "\
1775 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
1776 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1777
1778 #ifdef __cplusplus
1779 extern \"C\" {
1780 #endif
1781
1782 /* Prevent the only kind of declaration conflicts we can make. */
1783 #define dld_preloaded_symbols some_other_symbol
1784
1785 /* External symbol declarations for the compiler. */\
1786 "
1787
1788 if test -n "$export_symbols"; then
1789 sed -e 's/^\(.*\)/\1 \1/' < "$export_symbols" > "$nlist"
1790 fi
1791
1792 for arg in $dlprefiles; do
1793 $show "extracting global C symbols from \`$arg'"
1794 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
1795 done
1796
1797 if test -z "$run"; then
1798 # Make sure we at least have an empty file.
1799 test -f "$nlist" || : > "$nlist"
1800
1801 # Try sorting and uniquifying the output.
1802 if sort "$nlist" | uniq > "$nlist"T; then
1803 mv -f "$nlist"T "$nlist"
1804 else
1805 $rm "$nlist"T
1806 fi
1807
1808 if test -f "$nlist"; then
1809 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$output_objdir/$dlsyms"
1810 else
1811 echo '/* NONE */' >> "$output_objdir/$dlsyms"
1812 fi
1813
1814 $echo >> "$output_objdir/$dlsyms" "\
1815
1816 #undef dld_preloaded_symbols
1817
1818 #if defined (__STDC__) && __STDC__
1819 # define __ptr_t void *
1820 #else
1821 # define __ptr_t char *
1822 #endif
1823
1824 /* The mapping between symbol names and symbols. */
1825 struct {
1826 char *name;
1827 __ptr_t address;
1828 }
1829 dld_preloaded_symbols[] =
1830 {\
1831 "
1832
1833 if test -n "$export_symbols"; then
1834 echo >> "$objdir/$dlsyms" "\
1835 {\"${output}\", (__ptr_t) 0},"
1836 sed 's/^\(.*\)/ {"\1", (__ptr_t) \&\1},/' < "$export_symbols" >> "$objdir/$dlsyms"
1837 fi
1838
1839 for arg in $dlprefiles; do
1840 name=`echo "$arg" | sed -e 's%^.*/%%'`
1841 echo >> "$objdir/$dlsyms" "\
1842 {\"$name\", (__ptr_t) 0},"
1843 eval "$NM $arg | $global_symbol_pipe > '$nlist'"
1844
1845 if test -f "$nlist"; then
1846 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
1847 else
1848 echo '/* NONE */' >> "$output_objdir/$dlsyms"
1849 fi
1850
1851 done
1852
1853 if test -f "$nlist"; then
1854 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
1855 fi
1856
1857 $echo >> "$output_objdir/$dlsyms" "\
1858 {0, (__ptr_t) 0}
1859 };
1860
1861 #ifdef __cplusplus
1862 }
1863 #endif\
1864 "
1865 fi
1866
1867 # Now compile the dynamic symbol file.
1868 $show "(cd $objdir && $C_compiler -c$no_builtin_flag \"$dlsyms\")"
1869 $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag "$dlsyms")' || exit $?
1870
1871 # Transform the symbol file into the correct name.
1872 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
1873 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
1874 ;;
1875 *)
1876 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
1877 exit 1
1878 ;;
1879 esac
1880 elif test "$export_dynamic" != yes; then
1881 test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
1882 else
1883 # We keep going just in case the user didn't refer to
1884 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1885 # really was required.
1886 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
1887
1888 # Nullify the symbol file.
1889 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1890 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1891 fi
1892
1893 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1894 # Replace the output file specification.
1895 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1896 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1897
1898 # We have no uninstalled library dependencies, so finalize right now.
1899 $show "$compile_command"
1900 $run eval "$compile_command"
1901 exit $?
1902 fi
1903
1904 # Replace the output file specification.
1905 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
1906 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'T%g'`
1907
1908 # Create the binary in the object directory, then wrap it.
1909 if test ! -d $output_objdir; then
1910 $show "$mkdir $output_objdir"
1911 $run $mkdir $output_objdir
1912 status=$?
1913 if test $status -ne 0 && test ! -d $objdir; then
1914 exit $status
1915 fi
1916 fi
1917
1918 if test -n "$shlibpath_var"; then
1919 # We should set the shlibpath_var
1920 rpath=
1921 for dir in $temp_rpath; do
1922 case "$dir" in
1923 /* | [A-Za-z]:[/\\]*)
1924 # Absolute path.
1925 rpath="$rpath$dir:"
1926 ;;
1927 *)
1928 # Relative path: add a thisdir entry.
1929 rpath="$rpath\$thisdir/$dir:"
1930 ;;
1931 esac
1932 done
1933 temp_rpath="$rpath"
1934 fi
1935
1936 # Delete the old output file.
1937 $run $rm $output
1938
1939 if test -n "$compile_shlibpath"; then
1940 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
1941 fi
1942 if test -n "$finalize_shlibpath"; then
1943 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1944 fi
1945
1946 if test -n "$runpath_var" && test -n "$perm_rpath"; then
1947 # We should set the runpath_var.
1948 rpath=
1949 for dir in $perm_rpath; do
1950 rpath="$rpath$dir:"
1951 done
1952 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1953 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
1954 fi
1955
1956 if test "$hardcode_action" = relink; then
1957 # AGH! Flame the AIX and HP-UX people for me, will ya?
1958 $echo "$modename: warning: this platform doesn\'t like uninstalled shared libraries" 1>&2
1959 $echo "$modename: \`$output' will be relinked during installation" 1>&2
1960 fi
1961
1962 $show "$compile_command"
1963 $run eval "$compile_command" || exit $?
1964
1965 # Now create the wrapper script.
1966 $show "creating $output"
1967
1968 # Quote the finalize command for shipping.
1969 finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1970
1971 # Quote $echo for shipping.
1972 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
1973 case "$0" in
1974 /* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";;
1975 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
1976 esac
1977 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
1978 else
1979 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
1980 fi
1981
1982 # Only actually do things if our run command is non-null.
1983 if test -z "$run"; then
1984 $rm $output
1985 trap "$rm $output; exit 1" 1 2 15
1986
1987 $echo > $output "\
1988 #! $SHELL
1989
1990 # $output - temporary wrapper script for $objdir/$outputname
1991 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1992 #
1993 # The $output program cannot be directly executed until all the libtool
1994 # libraries that it depends on are installed.
1995 #
1996 # This wrapper script should never be moved out of the build directory.
1997 # If it is, it will not operate correctly.
1998
1999 # Sed substitution that helps us do robust quoting. It backslashifies
2000 # metacharacters that are still active within double-quoted strings.
2001 Xsed='sed -e s/^X//'
2002 sed_quote_subst='$sed_quote_subst'
2003
2004 # The HP-UX ksh and POSIX shell print the target directory to stdout
2005 # if CDPATH is set.
2006 if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
2007
2008 # This environment variable determines our operation mode.
2009 if test \"\$libtool_install_magic\" = \"$magic\"; then
2010 # install mode needs the following variables:
2011 link_against_libtool_libs='$link_against_libtool_libs'
2012 finalize_command=\"cd `pwd | sed -e $sed_quote_subst`; $finalize_command\"
2013 else
2014 # When we are sourced in execute mode, \$file and \$echo are already set.
2015 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2016 echo=\"$qecho\"
2017 file=\"\$0\"
2018 # Make sure echo works.
2019 if test \"X\$1\" = X--no-reexec; then
2020 # Discard the --no-reexec flag, and continue.
2021 shift
2022 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
2023 # Yippee, \$echo works!
2024 :
2025 else
2026 # Restart under the correct shell, and then maybe \$echo will work.
2027 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2028 fi
2029 fi\
2030 "
2031 $echo >> $output "\
2032
2033 # Find the directory that this script lives in.
2034 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2035 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2036
2037 # Follow symbolic links until we get to the real thisdir.
2038 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
2039 while test -n \"\$file\"; do
2040 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2041
2042 # If there was a directory component, then change thisdir.
2043 if test \"x\$destdir\" != \"x\$file\"; then
2044 case \"\$destdir\" in
2045 /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
2046 *) thisdir=\"\$thisdir/\$destdir\" ;;
2047 esac
2048 fi
2049
2050 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2051 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
2052 done
2053
2054 # Try to get the absolute directory name.
2055 absdir=\`cd \"\$thisdir\" && pwd\`
2056 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2057
2058 progdir=\"\$thisdir/$objdir\"
2059 program='$outputname'
2060
2061 if test -f \"\$progdir/\$program\"; then"
2062
2063 # Export our shlibpath_var if we have one.
2064 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2065 $echo >> $output "\
2066 # Add our own library path to $shlibpath_var
2067 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2068
2069 # Some systems cannot cope with colon-terminated $shlibpath_var
2070 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
2071
2072 export $shlibpath_var
2073 "
2074 fi
2075
2076 $echo >> $output "\
2077 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2078 # Run the actual program with our arguments.
2079
2080 # Export the path to the program.
2081 PATH=\"\$progdir:\$PATH\"
2082 export PATH
2083
2084 exec \$program \${1+\"\$@\"}
2085
2086 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
2087 exit 1
2088 fi
2089 else
2090 # The program doesn't exist.
2091 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
2092 \$echo \"This script is just a wrapper for \$program.\" 1>&2
2093 echo \"See the $PACKAGE documentation for more information.\" 1>&2
2094 exit 1
2095 fi
2096 fi\
2097 "
2098 chmod +x $output
2099 fi
2100 exit 0
2101 ;;
2102 esac
2103
2104 # See if we need to build an old-fashioned archive.
2105 for oldlib in $oldlibs; do
2106
2107 if test "$build_libtool_libs" = convenience; then
2108 oldobjs="$libobjs"
2109 addlibs="$convenience"
2110 build_libtool_libs=no
2111 else
2112 oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.'${libext}' //g' -e 's/[^ ]*\.lib //g' -e "$los2o" -e 's/ $//g'`
2113 addlibs="$old_convenience"
2114 fi
2115
2116 # Add in members from convenience archives.
2117 for xlib in $addlibs; do
2118 # Extract the objects.
2119 xdir="$xlib"x
2120 generated="$generated $xdir"
2121 xlib=`echo "$xlib" | $Xsed -e 's%^.*/%%'`
2122
2123 $show "${rm}r $xdir"
2124 $run ${rm}r "$xdir"
2125 $show "mkdir $xdir"
2126 $run mkdir "$xdir"
2127 status=$?
2128 if test $status -ne 0 && test ! -d "$xdir"; then
2129 exit $status
2130 fi
2131 $show "(cd $xdir && $AR x ../$xlib)"
2132 $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
2133
2134 oldobjs="$oldobjs `echo $xdir/*`"
2135 done
2136
2137 # Do each command in the archive commands.
2138 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
2139 eval cmds=\"$old_archive_from_new_cmds\"
2140 else
2141 eval cmds=\"$old_archive_cmds\"
2142 fi
2143 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2144 for cmd in $cmds; do
2145 IFS="$save_ifs"
2146 $show "$cmd"
2147 $run eval "$cmd" || exit $?
2148 done
2149 IFS="$save_ifs"
2150 done
2151
2152 if test -n "$generated"; then
2153 $show "${rm}r$generated"
2154 $run ${rm}r$generated
2155 fi
2156
2157 # Now create the libtool archive.
2158 case "$output" in
2159 *.la)
2160 old_library=
2161 test "$build_old_libs" = yes && old_library="$libname.$libext"
2162 $show "creating $output"
2163
2164 # Only create the output if not a dry run.
2165 if test -z "$run"; then
2166 $echo > $output "\
2167 # $output - a libtool library file
2168 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
2169
2170 # The name that we can dlopen(3).
2171 dlname='$dlname'
2172
2173 # Names of this library.
2174 library_names='$library_names'
2175
2176 # The name of the static archive.
2177 old_library='$old_library'
2178
2179 # Libraries that this one depends upon.
2180 dependency_libs='$dependency_libs'
2181
2182 # Version information for $libname.
2183 current=$current
2184 age=$age
2185 revision=$revision
2186
2187 # Is this an already installed library?
2188 installed=no
2189
2190 # Directory that this library needs to be installed in:
2191 libdir='$install_libdir'\
2192 "
2193 fi
2194
2195 # Do a symbolic link so that the libtool archive can be found in
2196 # LD_LIBRARY_PATH before the program is installed.
2197 $show "(cd $output_objdir && $LN_S ../$outputname $outputname)"
2198 $run eval "(cd $output_objdir && $LN_S ../$outputname $outputname)" || exit $?
2199 ;;
2200 esac
2201 exit 0
2202 ;;
2203
2204 # libtool install mode
2205 install)
2206 modename="$modename: install"
2207
2208 # There may be an optional sh(1) argument at the beginning of
2209 # install_prog (especially on Windows NT).
2210 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
2211 # Aesthetically quote it.
2212 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
2213 case "$arg" in
2214 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2215 arg="\"$arg\""
2216 ;;
2217 esac
2218 install_prog="$arg "
2219 arg="$1"
2220 shift
2221 else
2222 install_prog=
2223 arg="$nonopt"
2224 fi
2225
2226 # The real first argument should be the name of the installation program.
2227 # Aesthetically quote it.
2228 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2229 case "$arg" in
2230 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2231 arg="\"$arg\""
2232 ;;
2233 esac
2234 install_prog="$install_prog$arg"
2235
2236 # We need to accept at least all the BSD install flags.
2237 dest=
2238 files=
2239 opts=
2240 prev=
2241 install_type=
2242 isdir=no
2243 stripme=
2244 for arg
2245 do
2246 if test -n "$dest"; then
2247 files="$files $dest"
2248 dest="$arg"
2249 continue
2250 fi
2251
2252 case "$arg" in
2253 -d) isdir=yes ;;
2254 -f) prev="-f" ;;
2255 -g) prev="-g" ;;
2256 -m) prev="-m" ;;
2257 -o) prev="-o" ;;
2258 -s)
2259 stripme=" -s"
2260 continue
2261 ;;
2262 -*) ;;
2263
2264 *)
2265 # If the previous option needed an argument, then skip it.
2266 if test -n "$prev"; then
2267 prev=
2268 else
2269 dest="$arg"
2270 continue
2271 fi
2272 ;;
2273 esac
2274
2275 # Aesthetically quote the argument.
2276 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2277 case "$arg" in
2278 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
2279 arg="\"$arg\""
2280 ;;
2281 esac
2282 install_prog="$install_prog $arg"
2283 done
2284
2285 if test -z "$install_prog"; then
2286 $echo "$modename: you must specify an install program" 1>&2
2287 $echo "$help" 1>&2
2288 exit 1
2289 fi
2290
2291 if test -n "$prev"; then
2292 $echo "$modename: the \`$prev' option requires an argument" 1>&2
2293 $echo "$help" 1>&2
2294 exit 1
2295 fi
2296
2297 if test -z "$files"; then
2298 if test -z "$dest"; then
2299 $echo "$modename: no file or destination specified" 1>&2
2300 else
2301 $echo "$modename: you must specify a destination" 1>&2
2302 fi
2303 $echo "$help" 1>&2
2304 exit 1
2305 fi
2306
2307 # Strip any trailing slash from the destination.
2308 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
2309
2310 # Check to see that the destination is a directory.
2311 test -d "$dest" && isdir=yes
2312 if test "$isdir" = yes; then
2313 destdir="$dest"
2314 destname=
2315 else
2316 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
2317 test "X$destdir" = "X$dest" && destdir=.
2318 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
2319
2320 # Not a directory, so check to see that there is only one file specified.
2321 set dummy $files
2322 if test $# -gt 2; then
2323 $echo "$modename: \`$dest' is not a directory" 1>&2
2324 $echo "$help" 1>&2
2325 exit 1
2326 fi
2327 fi
2328 case "$destdir" in
2329 /* | [A-Za-z]:[/\\]*) ;;
2330 *)
2331 for file in $files; do
2332 case "$file" in
2333 *.lo) ;;
2334 *)
2335 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
2336 $echo "$help" 1>&2
2337 exit 1
2338 ;;
2339 esac
2340 done
2341 ;;
2342 esac
2343
2344 # This variable tells wrapper scripts just to set variables rather
2345 # than running their programs.
2346 libtool_install_magic="$magic"
2347
2348 staticlibs=
2349 future_libdirs=
2350 current_libdirs=
2351 for file in $files; do
2352
2353 # Do each installation.
2354 case "$file" in
2355 *.a | *.lib)
2356 # Do the static libraries later.
2357 staticlibs="$staticlibs $file"
2358 ;;
2359
2360 *.la)
2361 # Check to see that this really is a libtool archive.
2362 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2363 else
2364 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
2365 $echo "$help" 1>&2
2366 exit 1
2367 fi
2368
2369 library_names=
2370 old_library=
2371 # If there is no directory component, then add one.
2372 case "$file" in
2373 */* | *\\*) . $file ;;
2374 *) . ./$file ;;
2375 esac
2376
2377 # Add the libdir to current_libdirs if it is the destination.
2378 if test "X$destdir" = "X$libdir"; then
2379 case "$current_libdirs " in
2380 *" $libdir "*) ;;
2381 *) current_libdirs="$current_libdirs $libdir" ;;
2382 esac
2383 else
2384 # Note the libdir as a future libdir.
2385 case "$future_libdirs " in
2386 *" $libdir "*) ;;
2387 *) future_libdirs="$future_libdirs $libdir" ;;
2388 esac
2389 fi
2390
2391 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
2392 test "X$dir" = "X$file/" && dir=
2393 dir="$dir$objdir"
2394
2395 # See the names of the shared library.
2396 set dummy $library_names
2397 if test -n "$2"; then
2398 realname="$2"
2399 shift
2400 shift
2401
2402 # Install the shared library and build the symlinks.
2403 $show "$install_prog $dir/$realname $destdir/$realname"
2404 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
2405 test "X$dlname" = "X$realname" && dlname=
2406
2407 if test $# -gt 0; then
2408 # Delete the old symlinks, and create new ones.
2409 for linkname
2410 do
2411 test "X$dlname" = "X$linkname" && dlname=
2412 if test "$linkname" != "$realname"; then
2413 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
2414 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
2415 fi
2416 done
2417 fi
2418
2419 if test -n "$dlname"; then
2420 # Install the dynamically-loadable library.
2421 $show "$install_prog $dir/$dlname $destdir/$dlname"
2422 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
2423 fi
2424
2425 # Do each command in the postinstall commands.
2426 lib="$destdir/$realname"
2427 eval cmds=\"$postinstall_cmds\"
2428 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2429 for cmd in $cmds; do
2430 IFS="$save_ifs"
2431 $show "$cmd"
2432 $run eval "$cmd" || exit $?
2433 done
2434 IFS="$save_ifs"
2435 fi
2436
2437 # Install the pseudo-library for information purposes.
2438 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2439 instname="$dir/$name"i
2440 $show "Creating $instname"
2441 $rm "$instname"
2442 sed 's/^installed=no$/installed=yes/' "$file" > "$instname"
2443 $show "$install_prog $instname $destdir/$name"
2444 $run eval "$install_prog $instname $destdir/$name" || exit $?
2445 $show "$rm $instname"
2446 $rm "$instname"
2447
2448 # Maybe install the static library, too.
2449 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2450 ;;
2451
2452 *.lo)
2453 # Install (i.e. copy) a libtool object.
2454
2455 # Figure out destination file name, if it wasn't already specified.
2456 if test -n "$destname"; then
2457 destfile="$destdir/$destname"
2458 else
2459 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2460 destfile="$destdir/$destfile"
2461 fi
2462
2463 # Deduce the name of the destination old-style object file.
2464 case "$destfile" in
2465 *.lo)
2466 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
2467 ;;
2468 *.o | *.obj)
2469 staticdest="$destfile"
2470 destfile=
2471 ;;
2472 *)
2473 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
2474 $echo "$help" 1>&2
2475 exit 1
2476 ;;
2477 esac
2478
2479 # Install the libtool object if requested.
2480 if test -n "$destfile"; then
2481 $show "$install_prog $file $destfile"
2482 $run eval "$install_prog $file $destfile" || exit $?
2483 fi
2484
2485 # Install the old object if enabled.
2486 if test "$build_old_libs" = yes; then
2487 # Deduce the name of the old-style object file.
2488 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
2489
2490 $show "$install_prog $staticobj $staticdest"
2491 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
2492 fi
2493 exit 0
2494 ;;
2495
2496 *)
2497 # Figure out destination file name, if it wasn't already specified.
2498 if test -n "$destname"; then
2499 destfile="$destdir/$destname"
2500 else
2501 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2502 destfile="$destdir/$destfile"
2503 fi
2504
2505 # Do a test to see if this is really a libtool program.
2506 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2507 link_against_libtool_libs=
2508 finalize_command=
2509
2510 # If there is no directory component, then add one.
2511 case "$file" in
2512 */* | *\\*) . $file ;;
2513 *) . ./$file ;;
2514 esac
2515
2516 # Check the variables that should have been set.
2517 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
2518 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
2519 exit 1
2520 fi
2521
2522 finalize=yes
2523 for lib in $link_against_libtool_libs; do
2524 # Check to see that each library is installed.
2525 libdir=
2526 if test -f "$lib"; then
2527 # If there is no directory component, then add one.
2528 case "$lib" in
2529 */* | *\\*) . $lib ;;
2530 *) . ./$lib ;;
2531 esac
2532 fi
2533 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
2534 if test -n "$libdir" && test ! -f "$libfile"; then
2535 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
2536 finalize=no
2537 fi
2538 done
2539
2540 if test "$hardcode_action" = relink; then
2541 if test "$finalize" = yes; then
2542 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
2543 $show "$finalize_command"
2544 if $run eval "$finalize_command"; then :
2545 else
2546 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
2547 continue
2548 fi
2549 file="$objdir/$file"T
2550 else
2551 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
2552 fi
2553 else
2554 # Install the binary that we compiled earlier.
2555 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2556 fi
2557 fi
2558
2559 $show "$install_prog$stripme $file $destfile"
2560 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
2561 ;;
2562 esac
2563 done
2564
2565 for file in $staticlibs; do
2566 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2567
2568 # Set up the ranlib parameters.
2569 oldlib="$destdir/$name"
2570
2571 $show "$install_prog $file $oldlib"
2572 $run eval "$install_prog \$file \$oldlib" || exit $?
2573
2574 # Do each command in the postinstall commands.
2575 eval cmds=\"$old_postinstall_cmds\"
2576 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2577 for cmd in $cmds; do
2578 IFS="$save_ifs"
2579 $show "$cmd"
2580 $run eval "$cmd" || exit $?
2581 done
2582 IFS="$save_ifs"
2583 done
2584
2585 if test -n "$future_libdirs"; then
2586 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
2587 fi
2588
2589 if test -n "$current_libdirs"; then
2590 # Maybe just do a dry run.
2591 test -n "$run" && current_libdirs=" -n$current_libdirs"
2592 exec $SHELL $0 --finish$current_libdirs
2593 exit 1
2594 fi
2595
2596 exit 0
2597 ;;
2598
2599 # libtool finish mode
2600 finish)
2601 modename="$modename: finish"
2602 libdirs="$nonopt"
2603 admincmds=
2604
2605 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2606 for dir
2607 do
2608 libdirs="$libdirs $dir"
2609 done
2610
2611 for libdir in $libdirs; do
2612 if test -n "$finish_cmds"; then
2613 # Do each command in the finish commands.
2614 eval cmds=\"$finish_cmds\"
2615 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2616 for cmd in $cmds; do
2617 IFS="$save_ifs"
2618 $show "$cmd"
2619 $run eval "$cmd" || admincmds="$admincmds
2620 $cmd"
2621 done
2622 IFS="$save_ifs"
2623 fi
2624 if test -n "$finish_eval"; then
2625 # Do the single finish_eval.
2626 eval cmds=\"$finish_eval\"
2627 $run eval "$cmds" || admincmds="$admincmds
2628 $cmds"
2629 fi
2630 done
2631 fi
2632
2633 # Exit here if they wanted silent mode.
2634 test "$show" = : && exit 0
2635
2636 echo "----------------------------------------------------------------------"
2637 echo "Libraries have been installed in:"
2638 for libdir in $libdirs; do
2639 echo " $libdir"
2640 done
2641 echo
2642 echo "To link against installed libraries in a given directory, LIBDIR,"
2643 echo "you must use the \`-LLIBDIR' flag during linking."
2644 echo
2645 echo " You will also need to do at least one of the following:"
2646 if test -n "$shlibpath_var"; then
2647 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2648 echo " during execution"
2649 fi
2650 if test -n "$runpath_var"; then
2651 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2652 echo " during linking"
2653 fi
2654 if test -n "$hardcode_libdir_flag_spec"; then
2655 libdir=LIBDIR
2656 eval flag=\"$hardcode_libdir_flag_spec\"
2657
2658 echo " - use the \`$flag' linker flag"
2659 fi
2660 if test -n "$admincmds"; then
2661 echo " - have your system administrator run these commands:$admincmds"
2662 fi
2663 if test -f /etc/ld.so.conf; then
2664 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2665 fi
2666 echo
2667 echo "See any operating system documentation about shared libraries for"
2668 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2669 echo "----------------------------------------------------------------------"
2670 exit 0
2671 ;;
2672
2673 # libtool execute mode
2674 execute)
2675 modename="$modename: execute"
2676
2677 # The first argument is the command name.
2678 cmd="$nonopt"
2679 if test -z "$cmd"; then
2680 $echo "$modename: you must specify a COMMAND" 1>&2
2681 $echo "$help"
2682 exit 1
2683 fi
2684
2685 # Handle -dlopen flags immediately.
2686 for file in $execute_dlfiles; do
2687 if test ! -f "$file"; then
2688 $echo "$modename: \`$file' is not a file" 1>&2
2689 $echo "$help" 1>&2
2690 exit 1
2691 fi
2692
2693 dir=
2694 case "$file" in
2695 *.la)
2696 # Check to see that this really is a libtool archive.
2697 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2698 else
2699 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2700 $echo "$help" 1>&2
2701 exit 1
2702 fi
2703
2704 # Read the libtool library.
2705 dlname=
2706 library_names=
2707
2708 # If there is no directory component, then add one.
2709 case "$file" in
2710 */* | *\\*) . $file ;;
2711 *) . ./$file ;;
2712 esac
2713
2714 # Skip this library if it cannot be dlopened.
2715 if test -z "$dlname"; then
2716 # Warn if it was a shared library.
2717 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
2718 continue
2719 fi
2720
2721 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2722 test "X$dir" = "X$file" && dir=.
2723
2724 if test -f "$dir/$objdir/$dlname"; then
2725 dir="$dir/$objdir"
2726 else
2727 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
2728 exit 1
2729 fi
2730 ;;
2731
2732 *.lo)
2733 # Just add the directory containing the .lo file.
2734 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2735 test "X$dir" = "X$file" && dir=.
2736 ;;
2737
2738 *)
2739 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
2740 continue
2741 ;;
2742 esac
2743
2744 # Get the absolute pathname.
2745 absdir=`cd "$dir" && pwd`
2746 test -n "$absdir" && dir="$absdir"
2747
2748 # Now add the directory to shlibpath_var.
2749 if eval "test -z \"\$$shlibpath_var\""; then
2750 eval "$shlibpath_var=\"\$dir\""
2751 else
2752 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2753 fi
2754 done
2755
2756 # This variable tells wrapper scripts just to set shlibpath_var
2757 # rather than running their programs.
2758 libtool_execute_magic="$magic"
2759
2760 # Check if any of the arguments is a wrapper script.
2761 args=
2762 for file
2763 do
2764 case "$file" in
2765 -*) ;;
2766 *)
2767 # Do a test to see if this is really a libtool program.
2768 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2769 # If there is no directory component, then add one.
2770 case "$file" in
2771 */* | *\\*) . $file ;;
2772 *) . ./$file ;;
2773 esac
2774
2775 # Transform arg to wrapped name.
2776 file="$progdir/$program"
2777 fi
2778 ;;
2779 esac
2780 # Quote arguments (to preserve shell metacharacters).
2781 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
2782 args="$args \"$file\""
2783 done
2784
2785 if test -z "$run"; then
2786 # Export the shlibpath_var.
2787 eval "export $shlibpath_var"
2788
2789 # Restore saved enviroment variables
2790 if test "${save_LC_ALL+set}" = set; then
2791 LC_ALL="$save_LC_ALL"; export LC_ALL
2792 fi
2793 if test "${save_LANG+set}" = set; then
2794 LANG="$save_LANG"; export LANG
2795 fi
2796
2797 # Now actually exec the command.
2798 eval "exec \$cmd$args"
2799
2800 $echo "$modename: cannot exec \$cmd$args"
2801 exit 1
2802 else
2803 # Display what would be done.
2804 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
2805 $echo "export $shlibpath_var"
2806 $echo "$cmd$args"
2807 exit 0
2808 fi
2809 ;;
2810
2811 # libtool uninstall mode
2812 uninstall)
2813 modename="$modename: uninstall"
2814 rm="$nonopt"
2815 files=
2816
2817 for arg
2818 do
2819 case "$arg" in
2820 -*) rm="$rm $arg" ;;
2821 *) files="$files $arg" ;;
2822 esac
2823 done
2824
2825 if test -z "$rm"; then
2826 $echo "$modename: you must specify an RM program" 1>&2
2827 $echo "$help" 1>&2
2828 exit 1
2829 fi
2830
2831 for file in $files; do
2832 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
2833 test "X$dir" = "X$file" && dir=.
2834 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
2835
2836 rmfiles="$file"
2837
2838 case "$name" in
2839 *.la)
2840 # Possibly a libtool archive, so verify it.
2841 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2842 . $dir/$name
2843
2844 # Delete the libtool libraries and symlinks.
2845 for n in $library_names; do
2846 rmfiles="$rmfiles $dir/$n"
2847 test "X$n" = "X$dlname" && dlname=
2848 done
2849 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2850 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2851
2852 $show "$rm $rmfiles"
2853 $run $rm $rmfiles
2854
2855 if test -n "$library_names"; then
2856 # Do each command in the postuninstall commands.
2857 eval cmds=\"$postuninstall_cmds\"
2858 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2859 for cmd in $cmds; do
2860 IFS="$save_ifs"
2861 $show "$cmd"
2862 $run eval "$cmd"
2863 done
2864 IFS="$save_ifs"
2865 fi
2866
2867 if test -n "$old_library"; then
2868 # Do each command in the old_postuninstall commands.
2869 eval cmds=\"$old_postuninstall_cmds\"
2870 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2871 for cmd in $cmds; do
2872 IFS="$save_ifs"
2873 $show "$cmd"
2874 $run eval "$cmd"
2875 done
2876 IFS="$save_ifs"
2877 fi
2878
2879 # FIXME: should reinstall the best remaining shared library.
2880 fi
2881 ;;
2882
2883 *.lo)
2884 if test "$build_old_libs" = yes; then
2885 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
2886 rmfiles="$rmfiles $dir/$oldobj"
2887 fi
2888 $show "$rm $rmfiles"
2889 $run $rm $rmfiles
2890 ;;
2891
2892 *)
2893 $show "$rm $rmfiles"
2894 $run $rm $rmfiles
2895 ;;
2896 esac
2897 done
2898 exit 0
2899 ;;
2900
2901 "")
2902 $echo "$modename: you must specify a MODE" 1>&2
2903 $echo "$generic_help" 1>&2
2904 exit 1
2905 ;;
2906 esac
2907
2908 $echo "$modename: invalid operation mode \`$mode'" 1>&2
2909 $echo "$generic_help" 1>&2
2910 exit 1
2911 fi # test -z "$show_help"
2912
2913 # We need to display help for each of the modes.
2914 case "$mode" in
2915 "") $echo \
2916 "Usage: $modename [OPTION]... [MODE-ARG]...
2917
2918 Provide generalized library-building support services.
2919
2920 --config show all configuration variables
2921 --debug enable verbose shell tracing
2922 -n, --dry-run display commands without modifying any files
2923 --features display basic configuration information and exit
2924 --finish same as \`--mode=finish'
2925 --help display this help message and exit
2926 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
2927 --quiet same as \`--silent'
2928 --silent don't print informational messages
2929 --version print version information
2930
2931 MODE must be one of the following:
2932
2933 compile compile a source file into a libtool object
2934 execute automatically set library path, then run a program
2935 finish complete the installation of libtool libraries
2936 install install libraries or executables
2937 link create a library or an executable
2938 uninstall remove libraries from an installed directory
2939
2940 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
2941 a more detailed description of MODE."
2942 exit 0
2943 ;;
2944
2945 compile)
2946 $echo \
2947 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
2948
2949 Compile a source file into a libtool library object.
2950
2951 This mode accepts the following additional options:
2952
2953 -static always build a \`.o' file suitable for static linking
2954
2955 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2956 from the given SOURCEFILE.
2957
2958 The output file name is determined by removing the directory component from
2959 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2960 library object suffix, \`.lo'."
2961 ;;
2962
2963 execute)
2964 $echo \
2965 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
2966
2967 Automatically set library path, then run a program.
2968
2969 This mode accepts the following additional options:
2970
2971 -dlopen FILE add the directory containing FILE to the library path
2972
2973 This mode sets the library path environment variable according to \`-dlopen'
2974 flags.
2975
2976 If any of the ARGS are libtool executable wrappers, then they are translated
2977 into their corresponding uninstalled binary, and any of their required library
2978 directories are added to the library path.
2979
2980 Then, COMMAND is executed, with ARGS as arguments."
2981 ;;
2982
2983 finish)
2984 $echo \
2985 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
2986
2987 Complete the installation of libtool libraries.
2988
2989 Each LIBDIR is a directory that contains libtool libraries.
2990
2991 The commands that this mode executes may require superuser privileges. Use
2992 the \`--dry-run' option if you just want to see what would be executed."
2993 ;;
2994
2995 install)
2996 $echo \
2997 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
2998
2999 Install executables or libraries.
3000
3001 INSTALL-COMMAND is the installation command. The first component should be
3002 either the \`install' or \`cp' program.
3003
3004 The rest of the components are interpreted as arguments to that command (only
3005 BSD-compatible install options are recognized)."
3006 ;;
3007
3008 link)
3009 $echo \
3010 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
3011
3012 Link object files or libraries together to form another library, or to
3013 create an executable program.
3014
3015 LINK-COMMAND is a command using the C compiler that you would use to create
3016 a program from several object files.
3017
3018 The following components of LINK-COMMAND are treated specially:
3019
3020 -all-static do not do any dynamic linking at all
3021 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
3022 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
3023 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3024 -LLIBDIR search LIBDIR for required installed libraries
3025 -lNAME OUTPUT-FILE requires the installed library libNAME
3026 -no-undefined declare that a library does not refer to external symbols
3027 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3028 -release RELEASE specify package release information
3029 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3030 -static do not do any dynamic linking of libtool libraries
3031 -version-info CURRENT[:REVISION[:AGE]]
3032 specify library version info [each variable defaults to 0]
3033
3034 All other options (arguments beginning with \`-') are ignored.
3035
3036 Every other argument is treated as a filename. Files ending in \`.la' are
3037 treated as uninstalled libtool libraries, other files are standard or library
3038 object files.
3039
3040 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
3041 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
3042
3043 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
3044 using \`ar' and \`ranlib', or on Windows using \`lib'.
3045
3046 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
3047 is created, otherwise an executable program is created."
3048 ;;
3049
3050 uninstall)
3051 $echo
3052 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3053
3054 Remove libraries from an installation directory.
3055
3056 RM is the name of the program to use to delete files associated with each FILE
3057 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
3058 to RM.
3059
3060 If FILE is a libtool library, all the files associated with it are deleted.
3061 Otherwise, only FILE itself is deleted using RM."
3062 ;;
3063
3064 *)
3065 $echo "$modename: invalid operation mode \`$mode'" 1>&2
3066 $echo "$help" 1>&2
3067 exit 1
3068 ;;
3069 esac
3070
3071 echo
3072 $echo "Try \`$modename --help' for more information about other modes."
3073
3074 exit 0
3075
3076 # Local Variables:
3077 # mode:shell-script
3078 # sh-indentation:2
3079 # End: