*** empty log message ***
[bpt/guile.git] / ltmain.sh
1 # ltmain.sh - Provide generalized library-building support services.
2 # Generated automatically from ltmain.sh.in by configure.
3 # Copyright (C) 1996, 1997 Free Software Foundation, Inc.
4 # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #
20 # As a special exception to the GNU General Public License, if you
21 # distribute this file as part of a program that contains a
22 # configuration script generated by Autoconf, you may include it under
23 # the same distribution terms that you use for the rest of that program.
24
25 # The name of this program.
26 progname=`echo "$0" | sed 's%^.*/%%'`
27
28 # Constants.
29 PROGRAM=ltmain.sh
30 PACKAGE=libtool
31 VERSION=0.9h
32
33 default_mode=NONE
34 help="Try \`$progname --help' for more information."
35 ln_s="ln -s"
36 cp_p="cp -p"
37 magic="%%%MAGIC variable%%%"
38 mkdir="mkdir"
39 mv="mv -f"
40 objdir=.libs
41 rm="rm -f"
42
43 if test "$LTCONFIG_VERSION" != "$VERSION"; then
44 echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
45 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
46 exit 1
47 fi
48
49 #
50 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
51 echo "$progname: not configured to build any kind of library" 1>&2
52 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
53 exit 1
54 fi
55
56 # Global variables.
57 mode=$default_mode
58 nonopt=
59 prev=
60 prevopt=
61 run=
62 show=echo
63 show_help=
64
65 # Parse our command line options once, thoroughly.
66 while test -n "$1"
67 do
68 arg="$1"
69 shift
70
71 case "$arg" in
72 -*=*) optarg=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
73 *) optarg= ;;
74 esac
75
76 # If the previous option needs an argument, assign it.
77 if test -n "$prev"; then
78 eval "$prev=\$arg"
79 prev=
80 prevopt=
81 continue
82 fi
83
84 # Have we seen a non-optional argument yet?
85 case "$arg" in
86 --help)
87 show_help=yes
88 ;;
89
90 --version)
91 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
92 exit 0
93 ;;
94
95 --dry-run | -n)
96 run=:
97 ;;
98
99 --features)
100 echo "host: $host"
101 if test "$build_libtool_libs" = yes; then
102 echo "enable shared libraries"
103 else
104 echo "disable shared libraries"
105 fi
106 if test "$build_old_libs" = yes; then
107 echo "enable static libraries"
108 else
109 echo "disable static libraries"
110 fi
111 exit 0
112 ;;
113
114 --finish) mode="finish" ;;
115
116 --mode) prevopt="--mode" prev=mode ;;
117 --mode=*) mode="$optarg" ;;
118
119 -*)
120 echo "$progname: unrecognized option \`$arg'" 1>&2
121 echo "$help" 1>&2
122 exit 1
123 ;;
124
125 *)
126 nonopt="$arg"
127 break
128 ;;
129 esac
130 done
131
132
133 if test -n "$prevopt"; then
134 echo "$progname: option \`$prevopt' requires an argument" 1>&2
135 echo "$help" 1>&2
136 exit 1
137 fi
138
139
140 if test -z "$show_help"; then
141
142 # Infer the operation mode.
143 if test "$mode" = NONE; then
144 case "$nonopt" in
145 *cc)
146 if echo " $@ " | egrep -e "[ ]-c[ ]" > /dev/null 2>&1; then
147 mode=compile
148 else
149 mode=link
150 fi
151 ;;
152 *install*|cp)
153 mode=install
154 ;;
155 *rm)
156 mode=uninstall
157 ;;
158 *.la)
159 mode=dlname
160 ;;
161 *)
162 # Just use the default operation mode.
163 if test "$mode" = NONE; then
164 if test -n "$nonopt"; then
165 echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
166 else
167 echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
168 fi
169 fi
170 ;;
171 esac
172 fi
173
174 # Change the help message to a mode-specific one.
175 generic_help="$help"
176 help="Try \`$progname --help --mode=$mode' for more information."
177
178 # These modes are in order of execution frequency so that they run quickly.
179 case "$mode" in
180 # libtool compile mode
181 compile)
182 progname="$progname: compile"
183 # Get the compilation command and the source file.
184 base_compile="$nonopt"
185 lastarg=
186 srcfile=
187
188 for arg
189 do
190 # Quote any args containing shell metacharacters.
191 case "$arg" in
192 *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*|*\"*)
193 quote_arg="'$arg'" ;;
194 *) quote_arg="$arg" ;;
195 esac
196
197 base_compile="$base_compile$lastarg"
198 srcfile="$quote_arg"
199 lastarg=" $srcfile"
200 done
201
202 # Get the name of the library object.
203 libobj=`echo "$srcfile" | sed -e 's%^.*/%%'`
204
205 # Recognize several different file suffixes.
206 xform='[cCFSf]'
207 case "$libobj" in
208 *.c++) xform='c++' ;;
209 *.cc) xform=cc ;;
210 *.cpp) xform=cpp ;;
211 *.cxx) xform=cxx ;;
212 *.f90) xform=f90 ;;
213 *.for) xform='for' ;;
214 esac
215
216 libobj=`echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
217
218 case "$libobj" in
219 *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
220 *)
221 echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2
222 exit 1
223 ;;
224 esac
225
226 if test -z "$base_compile"; then
227 echo "$progname: you must specify a compilation command" 1>&2
228 echo "$help" 1>&2
229 exit 1
230 fi
231
232 # Delete any leftover library objects.
233 if test "$build_old_libs" = yes; then
234 $run $rm $obj $libobj
235 trap "$run $rm $obj $libobj; exit 1" 1 2 15
236 else
237 $run $rm $libobj
238 trap "$run $rm $libobj; exit 1" 1 2 15
239 fi
240
241 # Only build a PIC object if we are building libtool libraries.
242 if test "$build_libtool_libs" = yes; then
243 # All platforms use -DPIC, to notify preprocessed assembler code.
244 $show "$base_compile$pic_flag -DPIC $srcfile"
245 if eval "$run $base_compile$pic_flag -DPIC $srcfile"; then :
246 else
247 test -n "$obj" && $run $rm $obj
248 exit 1
249 fi
250
251 # If we have no pic_flag, then copy the object into place and finish.
252 if test -z "$pic_flag"; then
253 $show "$ln_s $obj $libobj"
254 $run $ln_s $obj $libobj || $run $cp_p $obj $libobj
255 exit $?
256 fi
257
258 # Just move the object, then go on to compile the next one
259 $show "$mv $obj $libobj"
260 $run $mv $obj $libobj || exit 1
261 fi
262
263 # Only build a position-dependent object if we build old libraries.
264 if test "$build_old_libs" = yes; then
265 $show "$base_compile $srcfile"
266 if eval "$run $base_compile $srcfile"; then :
267 else
268 $run $rm $obj $libobj
269 exit 1
270 fi
271 fi
272
273 # Create an invalid libtool object if no PIC, so that we don't accidentally
274 # link it into a program.
275 if test "$build_libtool_libs" != yes; then
276 $show "echo timestamp > $libobj"
277 eval "$run echo timestamp > $libobj" || exit $?
278 fi
279
280 exit 0
281 ;;
282
283 # libtool link mode
284 link)
285 progname="$progname: link"
286 # Go through the arguments, transforming them on the way.
287 cc="$nonopt"
288 args="$cc"
289 allow_undefined=no
290 compile_command="$cc"
291 finalize_command="$cc"
292 compile_shlibpath=
293 finalize_shlibpath=
294 deplibs=
295 export_dynamic=no
296 hardcode_libdirs=
297 install_libdir=
298 libobjs=
299 link_against_libtool_libs=
300 link_static=
301 ltlibs=
302 objs=
303 prev=
304 prevarg=
305 perm_rpath=
306 temp_rpath=
307 vinfo=
308
309 # We need to know -static, to get the right output filenames.
310 case " $@ " in
311 *" -static "*) build_libtool_libs=no build_old_libs=yes ;;
312 esac
313
314 for arg
315 do
316 # If the previous option needs an argument, assign it.
317 if test -n "$prev"; then
318 case "$prev" in
319 output)
320 compile_command="$compile_command @OUTPUT@"
321 finalize_command="$finalize_command @OUTPUT@"
322 args="$args $arg"
323 ;;
324 esac
325
326 eval "$prev=\$arg"
327 prev=
328
329 continue
330 fi
331
332 args="$args $arg"
333 prevarg="$arg"
334
335 case "$arg" in
336 -allow-undefined) allow_undefined=yes ;;
337
338 -export-dynamic)
339 export_dynamic=yes
340 compile_command="$compile_command $export_dynamic_flag"
341 finalize_command="$finalize_command $export_dynamic_flag"
342 continue
343 ;;
344
345 -L*)
346 dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
347 case "$dir" in
348 /*)
349 ;;
350 *)
351 echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
352 exit 1
353 ;;
354 esac
355 deplibs="$deplibs $arg"
356 ;;
357
358 -l*) deplibs="$deplibs $arg" ;;
359
360 -o) prev=output ;;
361
362 -rpath)
363 prev=install_libdir
364 continue
365 ;;
366
367 -static)
368 link_static="`eval echo \"$link_static_flag\"`"
369 compile_command="$compile_command $link_static"
370 continue
371 ;;
372
373 -version-file)
374 echo "$progname: \`-version-file' has been replaced by \`-version-info'" 1>&2
375 echo "$help" 1>&2
376 exit 1
377 ;;
378
379 -version-info)
380 prev=vinfo
381 continue
382 ;;
383
384 -*) cc="$cc $arg" ;; # Some other compiler flag.
385
386 *.o)
387 # A standard object.
388 objs="$objs $arg"
389 ;;
390
391 *.a)
392 # Find the relevant object directory and library name.
393 file=`echo "$arg" | sed 's%^.*/%%'`
394 dir=`echo "$arg" | sed 's%/[^/]*$%/%'`
395 test "$dir" = "$arg" && dir=
396
397 # Standard archive.
398 objs="$objs $arg"
399 ;;
400
401 *.lo)
402 # A library object.
403 libobjs="$libobjs $arg"
404 ;;
405
406 *.la)
407 # A libtool-controlled library.
408
409 libdir=
410 library_names=
411 old_library=
412
413 # Check to see that this really is a libtool archive.
414 if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
415 else
416 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
417 exit 1
418 fi
419
420 # If there is no directory component, then add one.
421 case "$arg" in
422 */*) . $arg ;;
423 *) . ./$arg ;;
424 esac
425
426 if test -z "$libdir"; then
427 echo "$progname: \`$arg' contains no -rpath information" 1>&2
428 exit 1
429 fi
430
431 # Get the name of the library we link against.
432 linklib=
433 for l in $old_library $library_names; do
434 linklib="$l"
435 done
436
437 if test -z "$linklib"; then
438 echo "$progname: cannot find name of link library for \`$arg'" 1>&2
439 exit 1
440 fi
441
442 # Find the relevant object directory and library name.
443 name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'`
444 dir=`echo "$arg" | sed 's%/[^/]*$%%'`
445 if test "$dir" = "$arg"; then
446 dir="$objdir"
447 else
448 dir="$dir/$objdir"
449 fi
450
451 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
452 link_against_libtool_libs="$link_against_libtool_libs $arg"
453 if test -n "$shlibpath_var"; then
454 # Make sure the rpath contains only unique directories.
455 case "$temp_rpath " in
456 "* $dir *") ;;
457 *) temp_rpath="$temp_rpath $dir" ;;
458 esac
459 fi
460
461 if test -n "$hardcode_libdir_flag_spec"; then
462 if test -n "$hardcode_libdir_separator"; then
463 if test -z "$hardcode_libdirs"; then
464 # Put the magic libdir with the hardcode flag.
465 hardcode_libdirs="$libdir"
466 libdir="@HARDCODE_LIBDIRS@"
467 else
468 # Just accumulate the libdirs.
469 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
470 libdir=
471 fi
472 fi
473
474 if test -n "$libdir"; then
475 hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"`
476 compile_command="$compile_command $hardcode_libdir_flag"
477 finalize_command="$finalize_command $hardcode_libdir_flag"
478 fi
479 elif test "$hardcode_runpath_var" = yes; then
480 # Do the same for the permanent run path.
481 case "$perm_rpath " in
482 "* $libdir *") ;;
483 *) perm_rpath="$perm_rpath $libdir" ;;
484 esac
485 fi
486
487
488 case "$hardcode_action" in
489 immediate)
490 if test "$hardcode_direct" = no; then
491 compile_command="$compile_command $dir/$linklib"
492 elif test "$hardcode_minus_L" = no; then
493 compile_command="$compile_command -L$dir -l$name"
494 elif test "$hardcode_shlibpath_var" = no; then
495 compile_shlibpath="$compile_shlibpath$dir:"
496 compile_command="$compile_command -l$name"
497 fi
498 ;;
499
500 relink)
501 # We need an absolute path.
502 case "$dir" in
503 /*) ;;
504 *)
505 absdir=`cd "$dir" && pwd`
506 if test -z "$absdir"; then
507 echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
508 exit 1
509 fi
510 dir="$absdir"
511 ;;
512 esac
513
514 if test "$hardcode_direct" = yes; then
515 compile_command="$compile_command $dir/$linklib"
516 elif test "$hardcode_minus_L" = yes; then
517 compile_command="$compile_command -L$dir -l$name"
518 elif test "$hardcode_shlibpath_var" = yes; then
519 compile_shlibpath="$compile_shlibpath$dir:"
520 compile_command="$compile_command -l$name"
521 fi
522 ;;
523
524 *)
525 echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
526 exit 1
527 ;;
528 esac
529
530 # Finalize command for both is simple: just hardcode it.
531 if test "$hardcode_direct" = yes; then
532 finalize_command="$finalize_command $libdir/$linklib"
533 elif test "$hardcode_minus_L" = yes; then
534 finalize_command="$finalize_command -L$libdir -l$name"
535 elif test "$hardcode_shlibpath_var" = yes; then
536 finalize_shlibpath="$finalize_shlibpath$libdir:"
537 finalize_command="$finalize_command -l$name"
538 else
539 # We can't seem to hardcode it, guess we'll fake it.
540 finalize_command="$finalize_command -L$libdir -l$name"
541 fi
542 else
543 # Transform directly to old archives if we don't build new libraries.
544 if test -n "$pic_flag" && test -z "$old_library"; then
545 echo "$progname: cannot find static library for \`$arg'" 1>&2
546 exit 1
547 fi
548 test -n "$old_library" && linklib="$old_library"
549 compile_command="$compile_command $dir/$linklib"
550 finalize_command="$finalize_command $dir/$linklib"
551 fi
552 continue
553 ;;
554
555 *)
556 echo "$progname: unknown file suffix for \`$arg'" 1>&2
557 echo "$help" 1>&2
558 exit 1
559 ;;
560 esac
561
562 compile_command="$compile_command $arg"
563 finalize_command="$finalize_command $arg"
564 done
565
566 if test -n "$prev"; then
567 echo "$progname: the \`$prevarg' option requires an argument" 1>&2
568 echo "$help" 1>&2
569 exit 1
570 fi
571
572 # Substitute the hardcoded libdirs into the compile commands.
573 if test "$hardcode_libdir_colon_separated" = yes; then
574 compile_command=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
575 finalize_command=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
576 fi
577
578 oldlib=
579 oldobjs=
580 case "$output" in
581 "")
582 echo "$progname: you must specify an output file" 1>&2
583 echo "$help" 1>&2
584 exit 1
585 ;;
586
587 */*)
588 echo "$progname: output file \`$output' must have no directory components" 1>&2
589 exit 1
590 ;;
591
592 *.la)
593 libname=`echo "$output" | sed 's/\.la$//'`
594
595 # All the library-specific variables (install_libdir is set above).
596 library_names=
597 old_library=
598 dlname=
599 current=0
600 revision=0
601 age=0
602
603 if test -n "$objs"; then
604 echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
605 exit 1
606 fi
607
608 # How the heck are we supposed to write a wrapper for a shared library?
609 if test -n "$link_against_libtool_libs"; then
610 echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
611 exit 1
612 fi
613
614 if test -z "$install_libdir"; then
615 echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
616 exit 1
617 fi
618
619 # Parse the version information argument.
620 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
621 set dummy $vinfo
622 IFS="$save_ifs"
623
624 if test -n "$5"; then
625 echo "$progname: too many parameters to \`-version-info'" 1>&2
626 echo "$help" 1>&2
627 exit 1
628 fi
629
630 test -n "$2" && current="$2"
631 test -n "$3" && revision="$3"
632 test -n "$4" && age="$4"
633
634 # Check that each of the things are valid numbers.
635 case "$current" in
636 0 | [1-9] | [1-9][0-9]*) ;;
637 *)
638 echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
639 echo "$progname: \`$vinfo' is not valid version information" 1>&2
640 exit 1
641 ;;
642 esac
643
644 case "$revision" in
645 0 | [1-9] | [1-9][0-9]*) ;;
646 *)
647 echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
648 echo "$progname: \`$vinfo' is not valid version information" 1>&2
649 exit 1
650 ;;
651 esac
652
653 case "$age" in
654 0 | [1-9] | [1-9][0-9]*) ;;
655 *)
656 echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
657 echo "$progname: \`$vinfo' is not valid version information" 1>&2
658 exit 1
659 ;;
660 esac
661
662 if test $age -gt $current; then
663 echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
664 echo "$progname: \`$vinfo' is not valid version information" 1>&2
665 exit 1
666 fi
667
668 # Calculate the version variables.
669 version_vars="version_type current age revision"
670 case "$version_type" in
671 none) ;;
672
673 linux)
674 version_vars="$version_vars major versuffix"
675 major=`expr $current - $age`
676 versuffix="$major.$age.$revision"
677 ;;
678
679 osf)
680 version_vars="$version_vars versuffix verstring"
681 major=`expr $current - $age`
682 versuffix="$current.$age.$revision"
683 verstring="$versuffix"
684
685 # Add in all the interfaces that we are compatible with.
686 loop=$age
687 while test $loop != 0; do
688 iface=`expr $current - $loop`
689 loop=`expr $loop - 1`
690 verstring="$verstring:${iface}.0"
691 done
692
693 # Make executables depend on our current version.
694 verstring="$verstring:${current}.0"
695 ;;
696
697 sunos)
698 version_vars="$version_vars major versuffix"
699 major="$current"
700 versuffix="$current.$revision"
701 ;;
702
703 *)
704 echo "$progname: unknown library version type \`$version_type'" 1>&2
705 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
706 exit 1
707 ;;
708 esac
709
710 # Create the output directory, or remove our outputs if we need to.
711 if test -d $objdir; then
712 $show "$rm $objdir/$libname.*"
713 $run $rm $objdir/$libname.*
714 else
715 $show "$mkdir $objdir"
716 $run $mkdir $objdir || exit $?
717 fi
718
719 # Check to see if the archive will have undefined symbols.
720 if test "$allow_undefined" = yes; then
721 if "$allow_undefined_flag" = unsupported; then
722 echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
723 build_libtool_libs=no
724 fi
725 else
726 # Clear the flag.
727 allow_undefined_flag=
728 fi
729
730 if test "$build_libtool_libs" = yes; then
731 # Get the real and link names of the library.
732 library_names=`eval echo \"$library_names_spec\"`
733 set dummy $library_names
734 realname="$2"
735 shift; shift
736
737 if test -n "$soname_spec"; then
738 soname=`eval echo \"$soname_spec\"`
739 else
740 soname="$realname"
741 fi
742
743 lib="$objdir/$realname"
744 linknames=
745 for link
746 do
747 linknames="$linknames $objdir/$link"
748 done
749
750 # Use standard objects if they are PIC.
751 test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'`
752
753 # Do each of the archive commands.
754 cmds=`eval echo \"$archive_cmds\"`
755 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
756 for cmd in $cmds; do
757 IFS="$save_ifs"
758 $show "$cmd"
759 eval "$run $cmd" || exit $?
760 done
761 IFS="$save_ifs"
762
763 # Create links to the real library.
764 for link in $linknames; do
765 $show "$ln_s $realname $link"
766 $run $ln_s $realname $link || exit $?
767 done
768
769 # If -export-dynamic was specified, set the dlname.
770 if test "$export_dynamic" = yes; then
771 # On all known operating systems, these are identical.
772 dlname="$soname"
773 fi
774 fi
775 ;;
776
777 *.lo | *.o)
778 if test -n "$link_against_libtool_libs"; then
779 echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
780 exit 1
781 fi
782
783 if test -n "$deplibs"; then
784 echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
785 fi
786
787 if test -n "$install_libdir"; then
788 echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
789 fi
790
791 if test -n "$vinfo"; then
792 echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
793 fi
794
795 case "$output" in
796 *.lo)
797 if test -n "$objs"; then
798 echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
799 exit 1
800 fi
801 libobj="$output"
802 obj=`echo "$output" | sed 's/\.lo$/.o/'`
803 ;;
804 *)
805 libobj=
806 obj="$output"
807 ;;
808 esac
809
810 # Delete the old objects.
811 $run $rm $obj $libobj
812
813 # Create the old-style object.
814 reload_objs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
815
816 output="$obj"
817 cmds=`eval echo \"$reload_cmds\"`
818 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
819 for cmd in $cmds; do
820 IFS="$save_ifs"
821 $show "$cmd"
822 eval "$run $cmd" || exit $?
823 done
824 IFS="$save_ifs"
825
826 # Exit if we aren't doing a library object file.
827 test -z "$libobj" && exit 0
828
829 if test "$build_libtool_libs" != yes; then
830 # Create an invalid libtool object if no PIC, so that we don't
831 # accidentally link it into a program.
832 $show "echo timestamp > $libobj"
833 eval "$run echo timestamp > $libobj" || exit $?
834 exit 0
835 fi
836
837 if test -n "$pic_flag"; then
838 # Only do commands if we really have different PIC objects.
839 reload_objs="$libobjs"
840 output="$libobj"
841 cmds=`eval echo \"$reload_cmds\"`
842 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
843 for cmd in $cmds; do
844 IFS="$save_ifs"
845 $show "$cmd"
846 eval "$run $cmd" || exit $?
847 done
848 IFS="$save_ifs"
849 else
850 # Just create a symlink.
851 $show "$ln_s $obj $libobj"
852 $run $ln_s $obj $libobj || $run $cp_p $obj $libobj || exit 1
853 fi
854
855 exit 0
856 ;;
857
858 *)
859 if test -n "$install_libdir"; then
860 echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2
861 fi
862
863 if test -n "$vinfo"; then
864 echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2
865 fi
866
867 if test -n "$libobjs"; then
868 # Transform all the library objects into standard objects.
869 compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
870 finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'`
871 fi
872
873 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
874 # Replace the output file specification.
875 compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
876 finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
877
878 # We have no uninstalled library dependencies, so finalize right now.
879 $show "$compile_command"
880 $run $compile_command
881 status=$?
882
883 # If we failed to link statically, then try again.
884 if test $status -ne 0 && test -n "$link_static"; then
885 echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2
886 compile_command=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"`
887 $show "$finalize_command"
888 $run $finalize_command
889 status=$?
890 fi
891 exit $status
892 fi
893
894 # Replace the output file specification.
895 compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
896 finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
897
898 # Create the binary in the object directory, then wrap it.
899 if test -d $objdir; then :
900 else
901 $show "$mkdir $objdir"
902 $run $mkdir $objdir || exit $?
903 fi
904
905 if test -n "$shlibpath_var"; then
906 # We should set the shlibpath_var
907 rpath=
908 for dir in $temp_rpath; do
909 case "$dir" in
910 /*)
911 # Absolute path.
912 rpath="$rpath$dir:"
913 ;;
914 *)
915 # Relative path: add a thisdir entry.
916 rpath="$rpath\$thisdir/$dir:"
917 ;;
918 esac
919 done
920 temp_rpath="$rpath"
921 fi
922
923 # Delete the old output file.
924 $run $rm $output
925
926 if test -n "$compile_shlibpath"; then
927 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
928 fi
929 if test -n "$finalize_shlibpath"; then
930 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
931 fi
932
933 if test -n "$perm_rpath"; then
934 # We should set the runpath_var.
935 rpath=
936 for dir in $perm_rpath; do
937 rpath="$rpath$dir:"
938 done
939 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
940 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
941 fi
942
943 case "$hardcode_action" in
944 relink)
945 # AGH! Flame the AIX and HP-UX people for me, will ya?
946 echo "$progname: warning: using a buggy system linker" 1>&2
947 echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
948 ;;
949 esac
950
951 $show "$compile_command"
952 eval "$run $compile_command" || exit $?
953
954 # Now create the wrapper script.
955 echo "creating $output"
956
957 # Only actually do things if our run command is non-null.
958 if test -z "$run"; then
959 $rm $output
960 trap "$rm $output; exit 1" 1 2 15
961
962 cat > $output <<EOF
963 #! /bin/sh
964
965 # $output - temporary wrapper script for $objdir/$output
966 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
967 #
968 # The $output program cannot be directly executed until all the libtool
969 # libraries that it depends on are installed.
970 #
971 # This wrapper script should never be moved out of \``pwd`'.
972 # If it is, it will not operate correctly.
973
974 # This environment variable determines our operation mode.
975 if test "\$libtool_install_magic" = "$magic"; then
976 # install mode needs the following variables:
977 link_against_libtool_libs='$link_against_libtool_libs'
978 finalize_command='$finalize_command'
979 else
980 # Find the directory that this script lives in.
981 thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\`
982 test "x\$thisdir" = "x\$0" && thisdir=.
983
984 # Try to get the absolute directory name.
985 absdir=\`cd "\$thisdir" && pwd\`
986 test -n "\$absdir" && thisdir="\$absdir"
987
988 progdir="\$thisdir/$objdir"
989 program="$output"
990
991 if test -f "\$progdir/\$program"; then
992 # Run the actual program with our arguments.
993 args=
994 for arg
995 do
996 # Quote arguments (to preserve shell metacharacters).
997 args="\$args '\$arg'"
998 done
999
1000 # Export the path to the program.
1001 PATH="\$progdir:\$PATH"
1002 export PATH
1003 EOF
1004
1005 # Export our shlibpath_var if we have one.
1006 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1007 cat >> $output <<EOF
1008
1009 # Add our own library path to $shlibpath_var
1010 $shlibpath_var="$temp_rpath\$$shlibpath_var"
1011 # Some systems cannot cope with colon-terminated $shlibpath_var
1012 $shlibpath_var=\`echo \$$shlibpath_var | sed -e 's/:\$//'\`
1013
1014 export $shlibpath_var
1015 EOF
1016 fi
1017
1018 cat >> $output <<EOF
1019
1020 eval "exec \$program \$args"
1021
1022 echo "\$0: cannot exec \$program \$args"
1023 exit 1
1024 else
1025 # The program doesn't exist.
1026 echo "\$0: error: \$progdir/\$program does not exist" 1>&2
1027 echo "This script is just a wrapper for \$program." 1>&2
1028 echo "See the $PACKAGE documentation for more information." 1>&2
1029 exit 1
1030 fi
1031 fi
1032 EOF
1033 chmod +x $output
1034 fi
1035 exit 0
1036 ;;
1037 esac
1038
1039
1040 # See if we need to build an old-fashioned archive.
1041 if test "$build_old_libs" = "yes"; then
1042 # Now set the variables for building old libraries.
1043 oldlib="$objdir/$libname.a"
1044
1045 # Transform .lo files to .o files.
1046 oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
1047
1048 if test -d "$objdir"; then
1049 $show "$rm $oldlib"
1050 $run $rm $oldlib
1051 else
1052 $show "$mkdir $objdir"
1053 $run $mkdir $objdir
1054 fi
1055
1056 # Do each command in the archive commands.
1057 cmds=`eval echo \"$old_archive_cmds\"`
1058 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1059 for cmd in $cmds; do
1060 IFS="$save_ifs"
1061 $show "$cmd"
1062 eval "$run $cmd" || exit $?
1063 done
1064 IFS="$save_ifs"
1065 fi
1066
1067 # Now create the libtool archive.
1068 case "$output" in
1069 *.la)
1070 old_library=
1071 test "$build_old_libs" = yes && old_library="$libname.a"
1072
1073 echo "creating $output"
1074
1075 # Only create the output if not a dry run.
1076 if test -z "$run"; then
1077 cat > $output <<EOF
1078 # $output - a libtool library file
1079 # Generated by $PROGRAM - GNU $PACKAGE $VERSION
1080
1081 # The name that we can dlopen(3).
1082 dlname='$dlname'
1083
1084 # Names of this library.
1085 library_names='$library_names'
1086
1087 # The name of the static archive.
1088 old_library='$old_library'
1089
1090 # Version information for $libname.
1091 current=$current
1092 age=$age
1093 revision=$revision
1094
1095 # Directory that this library needs to be installed in:
1096 libdir='$install_libdir'
1097 EOF
1098 fi
1099
1100 # Do a symbolic link so that the libtool archive can be found in
1101 # LD_LIBRARY_PATH before the program is installed.
1102 $show "$ln_s ../$output $objdir/$output"
1103 $run $ln_s ../$output $objdir/$output || $run $cp_p ../$output $objdir/$output || exit 1
1104 ;;
1105 esac
1106 exit 0
1107 ;;
1108
1109 # libtool install mode
1110 install)
1111 progname="$progname: install"
1112
1113 # The first argument is the name of the installation program.
1114 install_prog="$nonopt"
1115
1116 # We need to accept at least all the BSD install flags.
1117 dest=
1118 files=
1119 opts=
1120 prev=
1121 install_type=
1122 isdir=
1123 stripme=
1124 for arg
1125 do
1126 if test -n "$dest"; then
1127 files="$files $dest"
1128 dest="$arg"
1129 continue
1130 fi
1131
1132 case "$arg" in
1133 -d) isdir=yes ;;
1134 -f) prev="-f" ;;
1135 -g) prev="-g" ;;
1136 -m) prev="-m" ;;
1137 -o) prev="-o" ;;
1138 -s)
1139 stripme=" -s"
1140 continue
1141 ;;
1142 -*) ;;
1143
1144 *)
1145 # If the previous option needed an argument, then skip it.
1146 if test -n "$prev"; then
1147 prev=
1148 else
1149 dest="$arg"
1150 continue
1151 fi
1152 ;;
1153 esac
1154 install_prog="$install_prog $arg"
1155 done
1156
1157 if test -z "$install_prog"; then
1158 echo "$progname: you must specify an install program" 1>&2
1159 echo "$help" 1>&2
1160 exit 1
1161 fi
1162
1163 if test -n "$prev"; then
1164 echo "$progname: the \`$prev' option requires an argument" 1>&2
1165 echo "$help" 1>&2
1166 exit 1
1167 fi
1168
1169 if test -z "$files"; then
1170 if test -z "$dest"; then
1171 echo "$progname: no file or destination specified" 1>&2
1172 else
1173 echo "$progname: you must specify a destination" 1>&2
1174 fi
1175 echo "$help" 1>&2
1176 exit 1
1177 fi
1178
1179 # Strip any trailing slash from the destination.
1180 dest=`echo "$dest" | sed 's%/$%%'`
1181
1182 # Check to see that the destination is a directory.
1183 test -d "$dest" && isdir=yes
1184 if test -n "$isdir"; then
1185 destdir="$dest"
1186 destname=
1187 else
1188 destdir=`echo "$dest" | sed 's%/[^/]*$%%'`
1189 test "$destdir" = "$dest" && destdir=.
1190 destname=`echo "$dest" | sed 's%^.*/%%'`
1191
1192 # Not a directory, so check to see that there is only one file specified.
1193 set dummy $files
1194 if test $# -gt 2; then
1195 echo "$progname: \`$dest' is not a directory" 1>&2
1196 echo "$help" 1>&2
1197 exit 1
1198 fi
1199 fi
1200 case "$destdir" in
1201 /*) ;;
1202 *)
1203 for file in $files; do
1204 case "$file" in
1205 *.lo) ;;
1206 *)
1207 echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
1208 echo "$help" 1>&2
1209 exit 1
1210 ;;
1211 esac
1212 done
1213 ;;
1214 esac
1215
1216 staticlibs=
1217 future_libdirs=
1218 current_libdirs=
1219 for file in $files; do
1220
1221 # Do each installation.
1222 case "$file" in
1223 *.a)
1224 # Do the static libraries later.
1225 staticlibs="$staticlibs $file"
1226 ;;
1227
1228 *.la)
1229 # Check to see that this really is a libtool archive.
1230 if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then :
1231 else
1232 echo "$progname: \`$file' is not a valid libtool archive" 1>&2
1233 echo "$help" 1>&2
1234 exit 1
1235 fi
1236
1237 library_names=
1238 old_library=
1239 # If there is no directory component, then add one.
1240 case "$file" in
1241 */*) . $file ;;
1242 *) . ./$file ;;
1243 esac
1244
1245 # Add the libdir to current_libdirs if it is the destination.
1246 if test "$destdir" = "$libdir"; then
1247 case "$current_libdirs " in
1248 "* $libdir *") ;;
1249 *) current_libdirs="$current_libdirs $libdir" ;;
1250 esac
1251 else
1252 # Note the libdir as a future libdir.
1253 case "$future_libdirs " in
1254 "* $libdir *") ;;
1255 *) future_libdirs="$future_libdirs $libdir" ;;
1256 esac
1257 fi
1258
1259 dir="`echo "$file" | sed 's%/[^/]*$%%'`/"
1260 test "$dir" = "$file/" && dir=
1261 dir="$dir$objdir"
1262
1263 # See the names of the shared library.
1264 set dummy $library_names
1265 if test -n "$2"; then
1266 realname="$2"
1267 shift
1268 shift
1269
1270 # Install the shared library and build the symlinks.
1271 $show "$install_prog $dir/$realname $destdir/$realname"
1272 eval "$run $install_prog $dir/$realname $destdir/$realname" || exit $?
1273 test "X$dlname" = "X$realname" && dlname=
1274
1275 # Support stripping libraries.
1276 if test -n "$stripme"; then
1277 if test -n "$striplib"; then
1278 $show "$striplib $destdir/$realname"
1279 $run $striplib $destdir/$realname || exit $?
1280 else
1281 echo "$progname: warning: no library stripping program" 1>&2
1282 fi
1283 fi
1284
1285 if test -n "$1"; then
1286 # Delete the old symlinks.
1287 rmcmd="$rm"
1288 for linkname
1289 do
1290 rmcmd="$rmcmd $destdir/$linkname"
1291 done
1292 $show "$rmcmd"
1293 $run $rmcmd
1294
1295 # ... and create new ones.
1296 for linkname
1297 do
1298 test "X$dlname" = "X$linkname" && dlname=
1299 $show "$ln_s $realname $destdir/$linkname"
1300 $run $ln_s $realname $destdir/$linkname
1301 done
1302 fi
1303
1304 if test -n "$dlname"; then
1305 # Install the dynamically-loadable library.
1306 $show "$install_prog $dir/$dlname $destdir/$dlname"
1307 eval "$run $install_prog $dir/$dlname $destdir/$dlname" || exit $?
1308 fi
1309
1310 # Do each command in the postinstall commands.
1311 lib="$destdir/$realname"
1312 cmds=`eval echo \"$postinstall_cmds\"`
1313 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1314 for cmd in $cmds; do
1315 IFS="$save_ifs"
1316 $show "$cmd"
1317 eval "$run $cmd" || exit $?
1318 done
1319 IFS="$save_ifs"
1320 fi
1321
1322 # Install the pseudo-library for information purposes.
1323 name=`echo "$file" | sed 's%^.*/%%'`
1324 $show "$install_prog $file $destdir/$name"
1325 $run $install_prog $file $destdir/$name || exit $?
1326
1327 # Maybe install the static library, too.
1328 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1329 ;;
1330
1331 *.lo)
1332 # Install (i.e. copy) a libtool object.
1333
1334 # Figure out destination file name, if it wasn't already specified.
1335 if test -n "$destname"; then
1336 destfile="$destdir/$destname"
1337 else
1338 destfile=`echo "$file" | sed 's%^.*/%%;'`
1339 destfile="$destdir/$destfile"
1340 fi
1341
1342 # Deduce the name of the destination old-style object file.
1343 case "$destfile" in
1344 *.lo)
1345 staticdest=`echo "$destfile" | sed 's/\.lo$/\.o/;'`
1346 ;;
1347 *.o)
1348 staticdest="$destfile"
1349 destfile=
1350 ;;
1351 *)
1352 echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
1353 echo "$help" 1>&2
1354 exit 1
1355 ;;
1356 esac
1357
1358 # Install the libtool object if requested.
1359 if test -n "$destfile"; then
1360 $show "$install_prog $file $destfile"
1361 $run $install_prog $file $destfile || exit $?
1362 fi
1363
1364 # Install the old object if enabled.
1365 if test "$build_old_libs" = yes; then
1366 # Deduce the name of the old-style object file.
1367 staticobj=`echo "$file" | sed 's/\.lo$/\.o/;'`
1368
1369 $show "$install_prog $staticobj $staticdest"
1370 $run $install_prog $staticobj $staticdest || exit $?
1371 fi
1372 exit 0
1373 ;;
1374
1375 *)
1376 # Do a test to see if this is really a libtool program.
1377 if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
1378 # This variable tells wrapper scripts just to set variables rather
1379 # than running their programs.
1380 libtool_install_magic="$magic"
1381 link_against_libtool_libs=
1382 finalize_command=
1383
1384 # If there is no directory component, then add one.
1385 case "$file" in
1386 */*) . $file ;;
1387 *) . ./$file ;;
1388 esac
1389
1390 # Check the variables that should have been set.
1391 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
1392 echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
1393 exit 1
1394 fi
1395
1396 finalize=yes
1397 for lib in $link_against_libtool_libs; do
1398 # Check to see that each library is installed.
1399 libdir=
1400 if test -f "$lib"; then
1401 # If there is no directory component, then add one.
1402 case "$lib" in
1403 */*) . $lib ;;
1404 *) . ./$lib ;;
1405 esac
1406 fi
1407 libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`"
1408 if test -z "$libdir"; then
1409 echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
1410 elif test -f "$libfile"; then :
1411 else
1412 echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
1413 finalize=no
1414 fi
1415 done
1416
1417 if test "$hardcode_action" = relink; then
1418 if test "$finalize" = no; then
1419 echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
1420 else
1421 echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
1422 $show "$finalize_command"
1423 if $run $finalize_command; then :
1424 else
1425 echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
1426 continue
1427 fi
1428 file="$objdir/$file"T
1429 fi
1430 else
1431 # Install the binary that we compiled earlier.
1432 dir=`echo "$file" | sed 's%/[^/]*$%%'`
1433 if test "$file" = "$dir"; then
1434 file="$objdir/$file"
1435 else
1436 file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`"
1437 fi
1438 fi
1439 fi
1440
1441 $show "$install_prog$stripme $file $dest"
1442 $run $install_prog$stripme $file $dest || exit $?
1443 ;;
1444 esac
1445 done
1446
1447 for file in $staticlibs; do
1448 name=`echo "$file" | sed 's%^.*/%%'`
1449
1450 # Set up the ranlib parameters.
1451 oldlib="$destdir/$name"
1452
1453 $show "$install_prog $file $oldlib"
1454 $run $install_prog $file $oldlib || exit $?
1455
1456 # Support stripping libraries.
1457 if test -n "$stripme"; then
1458 if test -n "$old_striplib"; then
1459 $show "$old_striplib $oldlib"
1460 $run $old_striplib $oldlib || exit $?
1461 else
1462 echo "$progname: warning: no static library stripping program" 1>&2
1463 fi
1464 fi
1465
1466 # Do each command in the postinstall commands.
1467 cmds=`eval echo \"$old_postinstall_cmds\"`
1468 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1469 for cmd in $cmds; do
1470 IFS="$save_ifs"
1471 $show "$cmd"
1472 eval "$run $cmd" || exit $?
1473 done
1474 IFS="$save_ifs"
1475 done
1476
1477 if test -n "$future_libdirs"; then
1478 echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1479 fi
1480
1481 if test -n "$current_libdirs"; then
1482 # Maybe just do a dry run.
1483 test -n "$run" && current_libdirs=" -n$current_libdirs"
1484 exec $0 --finish$current_libdirs
1485 exit 1
1486 fi
1487
1488 exit 0
1489 ;;
1490
1491 # libtool dlname mode
1492 dlname)
1493 progname="$progname: dlname"
1494 ltlibs="$nonopt"
1495 for lib
1496 do
1497 ltlibs="$ltlibs $lib"
1498 done
1499
1500 if test -z "$ltlibs"; then
1501 echo "$progname: you must specify at least one LTLIBRARY" 1>&2
1502 echo "$help" 1>&2
1503 exit 1
1504 fi
1505
1506 # Now check to make sure each one is a valid libtool library.
1507 status=0
1508 for lib in $ltlibs; do
1509 dlname=
1510 libdir=
1511 library_names=
1512
1513 # Check to see that this really is a libtool archive.
1514 if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
1515 else
1516 echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
1517 status=1
1518 continue
1519 fi
1520
1521 # If there is no directory component, then add one.
1522 case "$arg" in
1523 */*) . $arg ;;
1524 *) . ./$arg ;;
1525 esac
1526
1527 if test -z "$libdir"; then
1528 echo "$progname: \`$arg' contains no -rpath information" 1>&2
1529 status=1
1530 elif test -n "$dlname"; then
1531 echo "$libdir/$dlname"
1532 elif test -z "$library_names"; then
1533 echo "$progname: \`$arg' is not a shared library" 1>&2
1534 status=1
1535 else
1536 echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
1537 status=1
1538 fi
1539 done
1540 exit $status
1541 ;;
1542
1543 # libtool finish mode
1544 finish)
1545 progname="$progname: finish"
1546 libdirs="$nonopt"
1547
1548 if test -n "$finish_cmds" && test -n "$libdirs"; then
1549 for dir
1550 do
1551 libdirs="$libdirs $dir"
1552 done
1553
1554 for libdir in $libdirs; do
1555 # Do each command in the postinstall commands.
1556 cmds=`eval echo \"$finish_cmds\"`
1557 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1558 for cmd in $cmds; do
1559 IFS="$save_ifs"
1560 $show "$cmd"
1561 eval "$run $cmd"
1562 done
1563 IFS="$save_ifs"
1564 done
1565 fi
1566
1567 echo "To link against installed libraries in LIBDIR, users may have to:"
1568 if test -n "$shlibpath_var"; then
1569 echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
1570 fi
1571 echo " - use the \`-LLIBDIR' linker flag"
1572 exit 0
1573 ;;
1574
1575 # libtool uninstall mode
1576 uninstall)
1577 progname="$progname: uninstall"
1578 rm="$nonopt"
1579 files=
1580
1581 for arg
1582 do
1583 case "$arg" in
1584 -*) rm="$rm $arg" ;;
1585 *) files="$files $arg" ;;
1586 esac
1587 done
1588
1589 if test -z "$rm"; then
1590 echo "$progname: you must specify an RM program" 1>&2
1591 echo "$help" 1>&2
1592 exit 1
1593 fi
1594
1595 for file in $files; do
1596 dir=`echo "$file" | sed -e 's%/[^/]*$%%'`
1597 test "$dir" = "$file" && dir=.
1598 name=`echo "$file" | sed -e 's%^.*/%%'`
1599
1600 rmfiles="$file"
1601
1602 case "$name" in
1603 *.la)
1604 # Possibly a libtool archive, so verify it.
1605 if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
1606 . $dir/$name
1607
1608 # Delete the libtool libraries and symlinks.
1609 for n in $library_names; do
1610 rmfiles="$rmfiles $dir/$n"
1611 test "X$n" = "X$dlname" && dlname=
1612 done
1613 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
1614 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
1615
1616 # FIXME: should reinstall the best remaining shared library.
1617 fi
1618 ;;
1619
1620 *.lo)
1621 if test "$build_old_libs" = yes; then
1622 oldobj=`echo "$name" | sed 's/\.lo$/\.o/'`
1623 rmfiles="$rmfiles $dir/$oldobj"
1624 fi
1625 ;;
1626 esac
1627
1628 $show "$rm $rmfiles"
1629 $run $rm $rmfiles
1630 done
1631 exit 0
1632 ;;
1633
1634 NONE)
1635 echo "$progname: you must specify a MODE" 1>&2
1636 echo "$generic_help" 1>&2
1637 exit 1
1638 ;;
1639 esac
1640
1641 echo "$progname: invalid operation mode \`$mode'" 1>&2
1642 echo "$generic_help" 1>&2
1643 exit 1
1644 fi # test -z "$show_help"
1645
1646 # We need to display help for each of the modes.
1647 case "$mode" in
1648 NONE) cat <<EOF
1649 Usage: $progname [OPTION]... [MODE-ARG]...
1650
1651 Provide generalized library-building support services.
1652
1653 -n, --dry-run display commands without modifying any files
1654 --features display configuration information and exit
1655 --finish same as \`--mode=finish'
1656 --help display this help message and exit
1657 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
1658 --version print version information
1659
1660 MODE must be one of the following:
1661
1662 compile compile a source file into a libtool object
1663 dlname print filenames to use to \`dlopen' libtool libraries
1664 finish complete the installation of libtool libraries
1665 install install libraries or executables
1666 link create a library or an executable
1667 uninstall remove libraries from an installed directory
1668
1669 MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
1670 a more detailed description of MODE.
1671 EOF
1672 ;;
1673
1674 compile)
1675 cat <<EOF
1676 Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1677
1678 Compile a source file into a libtool library object.
1679
1680 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1681 from the given SOURCEFILE.
1682
1683 The output file name is determined by removing the directory component from
1684 SOURCEFILE, then substituting the C source code suffix \`.c' with the
1685 library object suffix, \`.lo'.
1686 EOF
1687 ;;
1688
1689 dlname)
1690 cat <<EOF
1691 Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
1692
1693 Print filenames to use to \`dlopen' libtool libraries.
1694
1695 Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
1696 was linked using the \`-export-dynamic' option).
1697
1698 The names to use are printed to standard output, one per line.
1699 EOF
1700 ;;
1701
1702 finish)
1703 cat <<EOF
1704 Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1705
1706 Complete the installation of libtool libraries.
1707
1708 Each LIBDIR is a directory that contains libtool libraries.
1709
1710 The commands that this mode executes may require superuser privileges. Use
1711 the \`--dry-run' option if you just want to see what would be executed.
1712 EOF
1713 ;;
1714
1715 install)
1716 cat <<EOF
1717 Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1718
1719 Install executables or libraries.
1720
1721 INSTALL-COMMAND is the installation command. The first component should be
1722 either the \`install' or \`cp' program.
1723
1724 The rest of the components are interpreted as arguments to that command (only
1725 BSD-compatible install options are recognized).
1726 EOF
1727 ;;
1728
1729 link)
1730 cat <<EOF
1731 Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1732
1733 Link object files or libraries together to form another library, or to
1734 create an executable program.
1735
1736 LINK-COMMAND is a command using the C compiler that you would use to create
1737 a program from several object files.
1738
1739 The following components of LINK-COMMAND are treated specially:
1740
1741 -allow-undefined allow a libtool library to reference undefined symbols
1742 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1743 -LLIBDIR search LIBDIR for required installed libraries
1744 -lNAME OUTPUT-FILE requires the installed library libNAME
1745 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1746 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1747 -static do not do any dynamic linking or shared library creation
1748 -version-info CURRENT[:REVISION[:AGE]]
1749 specify library version info [each variable defaults to 0]
1750
1751 All other options (arguments beginning with \`-') are ignored.
1752
1753 Every other argument is treated as a filename. Files ending in \`.la' are
1754 treated as uninstalled libtool libraries, other files are standard or library
1755 object files.
1756
1757 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
1758 library objects (\`.lo' files) may be specified, and \`-rpath' is required.
1759
1760 If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
1761 and \`ranlib'.
1762
1763 If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
1764 created, otherwise an executable program is created.
1765 EOF
1766 ;;
1767
1768 uninstall)
1769 cat <<EOF
1770 Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1771
1772 Remove libraries from an installation directory.
1773
1774 RM is the name of the program to use to delete files associated with each FILE
1775 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1776 to RM.
1777
1778 If FILE is a libtool library, all the files associated with it are deleted.
1779 Otherwise, only FILE itself is deleted using RM.
1780 EOF
1781 ;;
1782
1783 *)
1784 echo "$progname: invalid operation mode \`$mode'" 1>&2
1785 echo "$help" 1>&2
1786 exit 1
1787 ;;
1788 esac
1789
1790 case "$mode" in
1791 archive|compile)
1792 echo
1793 echo "Try \`$progname --help' for more information about other modes."
1794 ;;
1795 esac
1796
1797 exit 0
1798
1799 # Local Variables:
1800 # mode:shell-script
1801 # sh-indentation:2
1802 # End: