Commit | Line | Data |
---|---|---|
a7a8349d MV |
1 | # ltmain.sh - Provide generalized library-building support services. |
2 | # Generated automatically from ltmain.sh.in by configure. | |
3 | # Copyright (C) 1996 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.7 | |
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 | # Global variables. | |
50 | mode=$default_mode | |
51 | nonopt= | |
52 | prev= | |
53 | prevopt= | |
54 | run= | |
55 | show=echo | |
56 | show_help= | |
57 | ||
58 | # Parse our command line options once, thoroughly. | |
59 | while test -n "$1" | |
60 | do | |
61 | arg="$1" | |
62 | shift | |
63 | ||
64 | case "$arg" in | |
65 | -*=*) optarg=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;; | |
66 | *) optarg= ;; | |
67 | esac | |
68 | ||
69 | # If the previous option needs an argument, assign it. | |
70 | if test -n "$prev"; then | |
71 | eval "$prev=\$arg" | |
72 | prev= | |
73 | prevopt= | |
74 | continue | |
75 | fi | |
76 | ||
77 | # Have we seen a non-optional argument yet? | |
78 | case "$arg" in | |
79 | --help) | |
80 | show_help=yes | |
81 | ;; | |
82 | ||
83 | --version) | |
84 | echo "$PROGRAM (GNU $PACKAGE) $VERSION" | |
85 | exit 0 | |
86 | ;; | |
87 | ||
88 | --dry-run | -n) | |
89 | run=: | |
90 | ;; | |
91 | ||
92 | --finish) mode="finish" ;; | |
93 | ||
94 | --mode) prevopt="--mode" prev=mode ;; | |
95 | --mode=*) mode="$optarg" ;; | |
96 | ||
97 | -*) | |
98 | echo "$progname: unrecognized option \`$arg'" 1>&2 | |
99 | echo "$help" 1>&2 | |
100 | exit 1 | |
101 | ;; | |
102 | ||
103 | *) | |
104 | nonopt="$arg" | |
105 | break | |
106 | ;; | |
107 | esac | |
108 | done | |
109 | ||
110 | ||
111 | if test -n "$prevopt"; then | |
112 | echo "$progname: option \`$prevopt' requires an argument" 1>&2 | |
113 | echo "$help" | |
114 | exit 1 | |
115 | fi | |
116 | ||
117 | ||
118 | if test -z "$show_help"; then | |
119 | ||
120 | # Infer the operation mode. | |
121 | if test "$mode" = NONE; then | |
122 | case "$nonopt" in | |
123 | *cc) | |
124 | if echo " $@ " | egrep "[ ]-c[ ]" > /dev/null 2>&1; then | |
125 | mode=compile | |
126 | else | |
127 | mode=link | |
128 | fi | |
129 | ;; | |
130 | *install*|cp) | |
131 | mode=install | |
132 | ;; | |
133 | *rm) | |
134 | mode=uninstall | |
135 | ;; | |
136 | *) | |
137 | # Just use the default operation mode. | |
138 | if test "$mode" = NONE; then | |
139 | if test -n "$nonopt"; then | |
140 | echo "$progname: warning: cannot infer operation mode from \`$nonopt $@'" 1>&2 | |
141 | else | |
142 | echo "$progname: warning: cannot infer operation mode from no MODE-ARGS" 1>&2 | |
143 | fi | |
144 | fi | |
145 | ;; | |
146 | esac | |
147 | fi | |
148 | ||
149 | # Change the help message to a mode-specific one. | |
150 | generic_help="$help" | |
151 | help="Try \`$progname --help --mode=$mode' for more information." | |
152 | ||
153 | # These modes are in order of execution frequency so that they run quickly. | |
154 | case "$mode" in | |
155 | # libtool compile mode | |
156 | compile) | |
157 | # Get the compilation command and the source file. | |
158 | base_compile="$nonopt" | |
159 | lastarg= | |
160 | srcfile= | |
161 | ||
162 | for arg | |
163 | do | |
164 | # Quote any args containing shell metacharacters. | |
165 | case "$arg" in | |
166 | *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*|*\"*) | |
167 | quote_arg="'$arg'" ;; | |
168 | *) quote_arg="$arg" ;; | |
169 | esac | |
170 | ||
171 | base_compile="$base_compile$lastarg" | |
172 | srcfile="$quote_arg" | |
173 | lastarg=" $srcfile" | |
174 | done | |
175 | ||
176 | # Get the name of the library object. | |
177 | libobj=`echo "$srcfile" | sed -e 's%^.*/%%; s/\.[Sc]$/.lo/'` | |
178 | case $libobj in | |
179 | *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;; | |
180 | *) | |
181 | echo "$progname: cannot determine name of library object from \`$srcfile'" | |
182 | exit 1 | |
183 | ;; | |
184 | esac | |
185 | ||
186 | if test -z "$base_compile"; then | |
187 | echo "$progname: you must specify a compilation command" 1>&2 | |
188 | echo "$help" 1>&2 | |
189 | exit 1 | |
190 | fi | |
191 | ||
192 | # Delete any old library objects. | |
193 | $run $rm $obj $libobj | |
194 | trap "$run $rm $obj $libobj; exit 1" 1 2 15 | |
195 | ||
196 | # Only build a PIC object if we are building libtool libraries. | |
197 | if test "$build_libtool_libs" = yes; then | |
198 | # All platforms use -DPIC, to notify preprocessed assembler code. | |
199 | $show "$base_compile$pic_flag -DPIC $srcfile" | |
200 | if eval "$run $base_compile$pic_flag -DPIC $srcfile"; then : | |
201 | else | |
202 | $run $rm $obj | |
203 | exit 1 | |
204 | fi | |
205 | ||
206 | # If we have no pic_flag, then copy the object into place and finish. | |
207 | if test -z "$pic_flag"; then | |
208 | $show "$ln_s $obj $libobj" | |
209 | $run $ln_s $obj $libobj || $run $cp_p $obj $libobj | |
210 | exit $? | |
211 | fi | |
212 | ||
213 | # Just move the object, then go on to compile the next one | |
214 | $show "$mv $obj $libobj" | |
215 | $run $mv $obj $libobj || exit 1 | |
216 | fi | |
217 | ||
218 | # Compile the position-dependent object. | |
219 | $show "$base_compile $srcfile" | |
220 | if eval "$run $base_compile $srcfile"; then : | |
221 | else | |
222 | $run $rm $obj $libobj | |
223 | exit 1 | |
224 | fi | |
225 | ||
226 | # Symlink or copy the object file into library object, if no PIC. | |
227 | if test "$build_libtool_libs" != yes; then | |
228 | $show "$ln_s $obj $libobj" | |
229 | $run $ln_s $obj $libobj || $run $cp_p $obj $libobj | |
230 | exit $? | |
231 | fi | |
232 | ||
233 | exit 0 | |
234 | ;; | |
235 | ||
236 | # libtool link mode | |
237 | link) | |
238 | # Go through the arguments, transforming them on the way. | |
239 | cc="$nonopt" | |
240 | args="$cc" | |
241 | compile_command="$cc" | |
242 | finalize_command="$cc" | |
243 | deplibs= | |
244 | install_libdir= | |
245 | libobjs= | |
246 | link_against_libtool_libs= | |
247 | link_static= | |
248 | ltlibs= | |
249 | objs= | |
250 | output= | |
251 | prev= | |
252 | prevarg= | |
253 | temp_rpath= | |
254 | vinfo= | |
255 | ||
256 | ||
257 | # FIXME Maybe set the library names to libNAME_p.a if we are doing profiling. | |
258 | # if echo " $@ " | egrep "[ ]$profile_flag_pattern[ ]" > /dev/null 2>&1; then | |
259 | # suffix=p | |
260 | # else | |
261 | # suffix= | |
262 | # fi | |
263 | ||
264 | for arg | |
265 | do | |
266 | # If the previous option needs an argument, assign it. | |
267 | if test -n "$prev"; then | |
268 | case "$prev" in | |
269 | output) | |
270 | compile_command="$compile_command $objdir/$arg" | |
271 | finalize_command="$finalize_command $objdir/$arg"T | |
272 | args="$args $arg" | |
273 | ;; | |
274 | esac | |
275 | ||
276 | eval "$prev=\$arg" | |
277 | prev= | |
278 | ||
279 | continue | |
280 | fi | |
281 | ||
282 | # The finalize and compile arguments. | |
283 | farg="$arg" | |
284 | carg="$arg" | |
285 | ||
286 | case "$arg" in | |
287 | -L*) | |
288 | deplibs="$deplibs $arg" | |
289 | dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'` | |
290 | case "$dir" in | |
291 | /*) | |
292 | ;; | |
293 | *) | |
294 | echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2 | |
295 | exit 1 | |
296 | ;; | |
297 | esac | |
298 | ;; | |
299 | ||
300 | -l*) deplibs="$deplibs $arg" ;; | |
301 | ||
302 | -o) prev=output ;; | |
303 | ||
304 | -rpath) prev=install_libdir carg= farg= ;; | |
305 | ||
306 | -static) | |
307 | build_libtool_libs=no | |
308 | farg="$link_static_flag" | |
309 | carg="$farg" | |
310 | ;; | |
311 | ||
312 | -version-file) | |
313 | echo "$progname: \`-version-file' has been replaced by \`-version-info'" 1>&2 | |
314 | echo "$help" 1>&2 | |
315 | exit 1 | |
316 | ;; | |
317 | ||
318 | -version-info) prev=vinfo carg= farg= ;; | |
319 | ||
320 | -*) cc="$cc $arg" ;; # Some other compiler flag. | |
321 | ||
322 | # Automake's ansi2knr support code uses the "._o" and ".l_o" object | |
323 | # suffixes. | |
324 | *.o | *._o | *.a) | |
325 | # A standard object. | |
326 | objs="$objs $arg" | |
327 | ;; | |
328 | ||
329 | *.lo | *.l_o) | |
330 | # A library object. | |
331 | libobjs="$libobjs $arg" | |
332 | ;; | |
333 | ||
334 | *.la) | |
335 | # A libtool-controlled library. | |
336 | dir=`echo "$arg" | sed 's%/[^/]*$%%'` | |
337 | test "$dir" = "$arg" && dir=. | |
338 | file=`echo "$arg" | sed 's%^.*/%%'` | |
339 | ||
340 | link_against_libtool_libs="$link_against_libtool_libs $arg" | |
341 | if test "$build_libtool_libs" = yes; then | |
342 | # Specify the library as -lNAME. | |
343 | carg="-l`echo "$file" | sed 's/lib\(..*\)\.la$/\1/'`" | |
344 | farg="$carg" | |
345 | ||
346 | if test -n "$shlibpath_var"; then | |
347 | # Make sure the rpath contains only unique directories. | |
348 | case "$temp_rpath " in | |
349 | "* $dir *") ;; | |
350 | *) temp_rpath="$temp_rpath $dir" ;; | |
351 | esac | |
352 | fi | |
353 | ||
354 | # Check to see that this really is a libtool archive. | |
355 | if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then : | |
356 | else | |
357 | echo "$progname: \`$arg' is not a valid libtool archive" 1>&2 | |
358 | exit 1 | |
359 | fi | |
360 | ||
361 | libdir= | |
362 | . $dir/$file | |
363 | ||
364 | if test -z "$libdir"; then | |
365 | echo "$progname: \`$arg' contains no -rpath information" 1>&2 | |
366 | exit 1 | |
367 | fi | |
368 | ||
369 | if test -n "$link_rpath_flag"; then | |
370 | carg="`eval echo \"$link_rpath_flag\"` $carg" | |
371 | farg="$carg" | |
372 | fi | |
373 | ||
374 | if test "$hardcode_minus_L" != yes; then | |
375 | # Just give the right -L directory flag. | |
376 | carg="-L$dir/$objdir $carg" | |
377 | ||
378 | elif test "$hardcode_shlibpath_var" = yes; then | |
379 | # Give an absolute path to the library. | |
380 | case "$dir" in | |
381 | /*) absdir="$dir" ;; | |
382 | *) | |
383 | absdir=`cd $dir && pwd` | |
384 | if test -z "$absdir"; then | |
385 | echo "$progname: cannot determine absolute pathname of \`$dir'" 1>&2 | |
386 | exit 1 | |
387 | fi | |
388 | ;; | |
389 | esac | |
390 | carg="-L$absdir/$objdir $carg" | |
391 | farg="-L$libdir $farg" | |
392 | fi | |
393 | else | |
394 | # Transform directly to old archives if we don't build new libraries. | |
395 | carg="$dir/$objdir/`echo "$file" | sed 's/\.la$/.a/'`" | |
396 | farg="$carg" | |
397 | fi | |
398 | ;; | |
399 | ||
400 | *) | |
401 | echo "$progname: unknown file suffix for \`$arg'" 1>&2 | |
402 | echo "$help" | |
403 | exit 1 | |
404 | ;; | |
405 | esac | |
406 | ||
407 | args="$args $arg" | |
408 | ||
409 | compile_command="$compile_command $carg" | |
410 | finalize_command="$finalize_command $farg" | |
411 | prevarg="$arg" | |
412 | done | |
413 | ||
414 | if test -n "$prev"; then | |
415 | echo "$progname: the \`$prevarg' option requires an argument" | |
416 | echo "$help" 1>&2 | |
417 | exit 1 | |
418 | fi | |
419 | ||
420 | oldlib= | |
421 | oldobjs= | |
422 | case "$output" in | |
423 | "") | |
424 | echo "$progname: you must specify an output file" 1>&2 | |
425 | echo "$help" 1>&2 | |
426 | exit 1 | |
427 | ;; | |
428 | ||
429 | */*) | |
430 | echo "$progname: output file \`$output' must have no directory components" 1>&2 | |
431 | exit 1 | |
432 | ;; | |
433 | ||
434 | *.a) | |
435 | # Old archive. | |
436 | build_old_libs=yes | |
437 | ||
438 | if test -n "$install_libdir"; then | |
439 | echo "$progname: warning: \`-rpath' is ignored while linking old-style libraries" 1>&2 | |
440 | fi | |
441 | ||
442 | if test -n "$vinfo"; then | |
443 | echo "$progname: warning: \`-version-info' is ignored while linking old-style libraries" 1>&2 | |
444 | fi | |
445 | ;; | |
446 | ||
447 | *.la) | |
448 | libname=`echo "$output" | sed 's/\.la$//'` | |
449 | ||
450 | if test -n "$objs"; then | |
451 | echo "$progname: cannot build libtool library \`$output' from non-libtool objects" | |
452 | exit 1 | |
453 | fi | |
454 | ||
455 | # How the heck are we supposed to write a wrapper for a shared library? | |
456 | if test -n "$link_against_libtool_libs"; then | |
457 | echo "$progname: libtool libraries may not depend on uninstalled libraries" 1>&2 | |
458 | exit 1 | |
459 | fi | |
460 | ||
461 | if test -z "$install_libdir"; then | |
462 | echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2 | |
463 | exit 1 | |
464 | fi | |
465 | ||
466 | current=0 | |
467 | revision=0 | |
468 | age=0 | |
469 | ||
470 | # Parse the version information argument. | |
471 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' | |
472 | set dummy $vinfo | |
473 | IFS="$save_ifs" | |
474 | ||
475 | if test -n "$5"; then | |
476 | echo "$progname: too many parameters to \`-version-info'" 1>&2 | |
477 | echo "$help" 1>&2 | |
478 | exit 1 | |
479 | fi | |
480 | ||
481 | test -n "$2" && current="$2" | |
482 | test -n "$3" && revision="$3" | |
483 | test -n "$4" && age="$4" | |
484 | ||
485 | # Check that each of the things are valid numbers. | |
486 | case "$current" in | |
487 | 0 | [1-9] | [1-9][0-9]*) ;; | |
488 | *) | |
489 | echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2 | |
490 | echo "$progname: \`$vinfo' is not valid version information" 1>&2 | |
491 | exit 1 | |
492 | ;; | |
493 | esac | |
494 | ||
495 | case "$revision" in | |
496 | 0 | [1-9] | [1-9][0-9]*) ;; | |
497 | *) | |
498 | echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2 | |
499 | echo "$progname: \`$vinfo' is not valid version information" 1>&2 | |
500 | exit 1 | |
501 | ;; | |
502 | esac | |
503 | ||
504 | case "$age" in | |
505 | 0 | [1-9] | [1-9][0-9]*) ;; | |
506 | *) | |
507 | echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2 | |
508 | echo "$progname: \`$vinfo' is not valid version information" 1>&2 | |
509 | exit 1 | |
510 | ;; | |
511 | esac | |
512 | ||
513 | if test $age -gt $current; then | |
514 | echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 | |
515 | echo "$progname: \`$vinfo' is not valid version information" 1>&2 | |
516 | exit 1 | |
517 | fi | |
518 | ||
519 | # Calculate the version variables. | |
520 | version_vars="version_type current age revision" | |
521 | case "$version_type" in | |
522 | none) ;; | |
523 | ||
524 | libtool) | |
525 | version_vars="$version_vars versuffix" | |
526 | versuffix="$current.$age.$revision" | |
527 | ;; | |
528 | ||
529 | linux) | |
530 | version_vars="$version_vars major versuffix" | |
531 | major=`expr $current - $age` | |
532 | versuffix="$major.$age.$revision" | |
533 | ;; | |
534 | ||
535 | osf) | |
536 | version_vars="$version_vars versuffix verstring" | |
537 | versuffix="$current.$age.$revision" | |
538 | verstring="$versuffix" | |
539 | ||
540 | # Add in all the interfaces that we are compatible with. | |
541 | loop=$age | |
542 | while test $loop != 0; do | |
543 | iface=`expr $current - $loop` | |
544 | loop=`expr $loop - 1` | |
545 | verstring="$verstring:${iface}.0" | |
546 | done | |
547 | ||
548 | # Make executables depend on our current version. | |
549 | verstring="$verstring:${current}.0" | |
550 | ;; | |
551 | ||
552 | sunos) | |
553 | version_vars="$version_vars major versuffix" | |
554 | major="$current" | |
555 | versuffix="$current.$revision" | |
556 | ;; | |
557 | ||
558 | *) | |
559 | echo "$progname: unknown library version type \`$version_type'" 1>&2 | |
560 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 | |
561 | exit 1 | |
562 | ;; | |
563 | esac | |
564 | ||
565 | # Maybe add a suffix. | |
566 | test -n "$suffix" && libname=$libname"_$suffix" | |
567 | ||
568 | # Create the output directory, or remove our outputs if we need to. | |
569 | if test -d $objdir; then | |
570 | $show "$rm $objdir/$libname.*" | |
571 | $run $rm $objdir/$libname.* | |
572 | else | |
573 | $show "$mkdir $objdir" | |
574 | $run $mkdir $objdir || exit $? | |
575 | fi | |
576 | ||
577 | if test "$build_libtool_libs" = yes; then | |
578 | # Get the real and link names of the library. | |
579 | library_names=`eval echo \"$lib_names\"` | |
580 | set dummy $library_names | |
581 | realname="$2" | |
582 | shift; shift | |
583 | ||
584 | if test -n "$soname_spec"; then | |
585 | soname=`eval echo \"$soname_spec\"` | |
586 | else | |
587 | soname="$realname" | |
588 | fi | |
589 | ||
590 | lib="$objdir/$realname" | |
591 | linknames= | |
592 | for link | |
593 | do | |
594 | linknames="$linknames $objdir/$link" | |
595 | done | |
596 | ||
597 | # Use standard objects if they are PIC. | |
598 | test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed 's/\.lo /.o /g; s/\.l_o /._o /g; s/ $//g'` | |
599 | ||
600 | # Do each of the archive commands. | |
601 | cmds=`eval echo \"$archive_cmds\"` | |
602 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
603 | for cmd in $cmds; do | |
604 | IFS="$save_ifs" | |
605 | $show "$cmd" | |
606 | eval "$run $cmd" || exit $? | |
607 | done | |
608 | IFS="$save_ifs" | |
609 | ||
610 | # Create links to the real library. | |
611 | for link in $linknames; do | |
612 | $show "$ln_s $realname $link" | |
613 | $run $ln_s $realname $link || exit $? | |
614 | done | |
615 | fi | |
616 | ;; | |
617 | ||
618 | *.lo | *.o) | |
619 | if test -n "$link_against_libtool_libs"; then | |
620 | echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2 | |
621 | exit 1 | |
622 | fi | |
623 | ||
624 | if test -n "$deplibs"; then | |
625 | echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2 | |
626 | fi | |
627 | ||
628 | if test -n "$install_libdir"; then | |
629 | echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2 | |
630 | fi | |
631 | ||
632 | if test -n "$vinfo"; then | |
633 | echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2 | |
634 | fi | |
635 | ||
636 | case "$output" in | |
637 | *.lo) | |
638 | if test -n "$objs"; then | |
639 | echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2 | |
640 | exit 1 | |
641 | fi | |
642 | libobj="$output" | |
643 | obj=`echo "$output" | sed 's/\.lo$/.o/'` | |
644 | ;; | |
645 | *) | |
646 | libobj= | |
647 | obj="$output" | |
648 | ;; | |
649 | esac | |
650 | ||
651 | # Delete the old objects. | |
652 | $run $rm $obj $libobj | |
653 | ||
654 | # Create the old-style object. | |
655 | reload_objs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/\.l_o /._o /g; s/ $//g'` | |
656 | ||
657 | output="$obj" | |
658 | cmds=`eval echo \"$reload_cmds\"` | |
659 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
660 | for cmd in $cmds; do | |
661 | IFS="$save_ifs" | |
662 | $show "$cmd" | |
663 | eval "$run $cmd" || exit $? | |
664 | done | |
665 | IFS="$save_ifs" | |
666 | ||
667 | # Exit if we aren't doing a library object file. | |
668 | test -z "$libobj" && exit 0 | |
669 | ||
670 | if test "$build_libtool_libs" = yes && test -n "$pic_flag"; then | |
671 | # Only do commands if we really have different PIC objects. | |
672 | reload_objs="$libobjs" | |
673 | output="$libobj" | |
674 | cmds=`eval echo \"$reload_cmds\"` | |
675 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
676 | for cmd in $cmds; do | |
677 | IFS="$save_ifs" | |
678 | $show "$cmd" | |
679 | eval "$run $cmd" || exit $? | |
680 | done | |
681 | IFS="$save_ifs" | |
682 | else | |
683 | # Just create a symlink. | |
684 | $show "$ln_s $obj $libobj" | |
685 | $run $ln_s $obj $libobj || $run $cp_p $obj $libobj || exit 1 | |
686 | fi | |
687 | ||
688 | exit 0 | |
689 | ;; | |
690 | ||
691 | *) | |
692 | if test -n "$install_libdir"; then | |
693 | echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2 | |
694 | fi | |
695 | ||
696 | if test -n "$vinfo"; then | |
697 | echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2 | |
698 | fi | |
699 | ||
700 | if test -n "$libobjs"; then | |
701 | # Transform all the library objects into standard objects. | |
702 | compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/\.l_o /._o /g; s/ $//g'` | |
703 | ||
704 | fi | |
705 | ||
706 | if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then | |
707 | # We have no uninstalled library dependencies, so finalize right now. | |
708 | compile_command=`echo "$compile_command" | sed "s%-o $objdir/%-o %"` | |
709 | $show "$compile_command" | |
710 | $run $compile_command | |
711 | exit $? | |
712 | fi | |
713 | ||
714 | # Create the binary in the object directory, then wrap it. | |
715 | if test -d $objdir; then : | |
716 | else | |
717 | $show "$mkdir $objdir" | |
718 | $run $mkdir $objdir || exit $? | |
719 | fi | |
720 | ||
721 | if test -n "$shlibpath_var"; then | |
722 | # We should set the shlibpath_var | |
723 | rpath= | |
724 | for dir in $temp_rpath; do | |
725 | case "$dir" in | |
726 | /*) | |
727 | # Absolute path. | |
728 | rpath="$rpath:$dir/$objdir" | |
729 | ;; | |
730 | *) | |
731 | # Relative path: add a thisdir entry. | |
732 | rpath="$rpath:\$thisdir/$dir/$objdir" | |
733 | ;; | |
734 | esac | |
735 | done | |
736 | ||
737 | # Strip the ugly leading colon. | |
738 | rpath=`echo "$rpath" | sed 's/^://'` | |
739 | ||
740 | # Prettify the rpath for the link command. | |
741 | linkrpath=`echo "$rpath" | sed 's%\$thisdir/%%g'` | |
742 | fi | |
743 | ||
744 | # Delete the old output file. | |
745 | $run $rm $output | |
746 | ||
747 | if test "$hardcode_minus_L" != yes; then | |
748 | # Things are fine, the world is a beautiful place. | |
749 | $show "$compile_command" | |
750 | ||
751 | elif test "$hardcode_shlibpath_var" != yes; then | |
752 | # We just need to export the shlibpath for the link command. | |
753 | $show "$shlibpath_var=$linkrpath $compile_command" | |
754 | eval "export $shlibpath_var=$linkrpath" | |
755 | ||
756 | else | |
757 | # AGH! Flame the AIX and HP-UX people for me, will ya? | |
758 | echo "$progname: warning: using a buggy hardcoding system linker" 1>&2 | |
759 | echo "$progname: relinking will be required before \`$output' can be installed" 1>&2 | |
760 | ||
761 | $show "$compile_command" | |
762 | fi | |
763 | ||
764 | $run $compile_command || exit $? | |
765 | ||
766 | # Now create the wrapper script. | |
767 | echo "creating $output" | |
768 | ||
769 | # Only actually do things if our run command is non-null. | |
770 | if test -z "$run"; then | |
771 | $rm $output | |
772 | trap "$rm $output; exit 1" 1 2 15 | |
773 | ||
774 | cat > $output <<EOF | |
775 | #! /bin/sh | |
776 | ||
777 | # $output - temporary wrapper script for $objdir/$output | |
778 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION | |
779 | # | |
780 | # The $output program cannot be directly executed until all the libtool | |
781 | # libraries that it depends on are installed. | |
782 | # | |
783 | # This wrapper script should never be moved out of \``pwd`'. | |
784 | # If it is, it will not operate correctly. | |
785 | ||
786 | # This environment variable determines our operation mode. | |
787 | if test "\$libtool_install_magic" = "$magic"; then | |
788 | # install mode needs the following variables: | |
789 | link_against_libtool_libs="$link_against_libtool_libs" | |
790 | finalize_command="$finalize_command" | |
791 | else | |
792 | # Find the directory that this script lives in. | |
793 | thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\` | |
794 | test "x\$thisdir" = "x\$0" && thisdir=. | |
795 | ||
796 | # Try to get the absolute directory name. | |
797 | absdir=\`cd "\$thisdir" && pwd\` | |
798 | test -n "\$absdir" && thisdir="\$absdir" | |
799 | ||
800 | program="\$thisdir/$objdir/$output" | |
801 | EOF | |
802 | ||
803 | # Export our shlibpath_var if we have one. | |
804 | if test -n "$shlibpath_var" && test -n "$rpath"; then | |
805 | cat >> $output <<EOF | |
806 | ||
807 | # Add our own library path to $shlibpath_var | |
808 | $shlibpath_var="$rpath:\$$shlibpath_var" | |
809 | export $shlibpath_var | |
810 | EOF | |
811 | fi | |
812 | ||
813 | cat >>$output <<EOF | |
814 | ||
815 | if test -f "\$program"; then | |
816 | # Run the actual program with our arguments. | |
817 | args= | |
818 | for arg | |
819 | do | |
820 | # Quote arguments (to preserve shell metacharacters). | |
821 | args="\$args '\$arg'" | |
822 | done | |
823 | eval "exec \$program \$args" | |
824 | ||
825 | echo "\$0: cannot exec \$program \$args" | |
826 | exit 1 | |
827 | else | |
828 | # The program doesn't exist. | |
829 | echo "\$0: error: \$program does not exist" 1>&2 | |
830 | echo "This script is just a wrapper for \$program." 1>&2 | |
831 | echo "See the $PACKAGE documentation for more information." 1>&2 | |
832 | exit 1 | |
833 | fi | |
834 | fi | |
835 | EOF | |
836 | chmod +x $output | |
837 | fi | |
838 | exit 0 | |
839 | ;; | |
840 | esac | |
841 | ||
842 | ||
843 | # See if we need to build an old-fashioned archive. | |
844 | if test "$build_old_libs" = "yes"; then | |
845 | # Transform .lo files to .o (and don't forget ansi2knr .l_o to ._o). | |
846 | oldobjs="$objs"`echo "$libobjs " | sed 's/\.lo /.o /g; s/\.l_o /._o /g; s/ $//g'` | |
847 | case "$output" in | |
848 | *.la) | |
849 | # Now set the variables for building old libraries. | |
850 | oldlib="$objdir/$libname.a" | |
851 | ;; | |
852 | *) | |
853 | oldlib="$output" | |
854 | $show "$rm $oldlib" | |
855 | $run $rm $oldlib | |
856 | ;; | |
857 | esac | |
858 | ||
859 | # Do each command in the archive commands. | |
860 | cmds=`eval echo \"$old_archive_cmds\"` | |
861 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
862 | for cmd in $cmds; do | |
863 | IFS="$save_ifs" | |
864 | $show "$cmd" | |
865 | eval "$run $cmd" || exit $? | |
866 | done | |
867 | IFS="$save_ifs" | |
868 | fi | |
869 | ||
870 | # Now create the libtool archive. | |
871 | case "$output" in | |
872 | *.la) | |
873 | old_library= | |
874 | test "$build_old_libs" = yes && old_library="$libname.a" | |
875 | ||
876 | echo "creating $output" | |
877 | ||
878 | # Only create the output if not a dry run. | |
879 | if test -z "$run"; then | |
880 | cat > $output <<EOF | |
881 | # $output - a libtool library file | |
882 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION | |
883 | ||
884 | # Names of this library. | |
885 | library_names='$library_names' | |
886 | ||
887 | # The name of the static archive. | |
888 | old_library='$old_library' | |
889 | ||
890 | # Version information for $libname. | |
891 | current=$current | |
892 | age=$age | |
893 | revision=$revision | |
894 | ||
895 | # Directory that this library needs to be installed in: | |
896 | libdir='$install_libdir' | |
897 | EOF | |
898 | fi | |
899 | ;; | |
900 | esac | |
901 | exit 0 | |
902 | ;; | |
903 | ||
904 | # libtool install mode | |
905 | install) | |
906 | ||
907 | # The first argument is the name of the installation program. | |
908 | install_prog="$nonopt" | |
909 | ||
910 | # We need to accept at least all the BSD install flags. | |
911 | dest= | |
912 | files= | |
913 | opts= | |
914 | prev= | |
915 | install_type= | |
916 | isdir= | |
917 | stripme= | |
918 | for arg | |
919 | do | |
920 | if test -n "$dest"; then | |
921 | files="$files $dest" | |
922 | dest="$arg" | |
923 | continue | |
924 | fi | |
925 | ||
926 | case "$arg" in | |
927 | -d) isdir=yes ;; | |
928 | -f) prev="-f" ;; | |
929 | -g) prev="-g" ;; | |
930 | -m) prev="-m" ;; | |
931 | -o) prev="-o" ;; | |
932 | -s) | |
933 | stripme=" -s" | |
934 | continue | |
935 | ;; | |
936 | -*) ;; | |
937 | ||
938 | *) | |
939 | # If the previous option needed an argument, then skip it. | |
940 | if test -n "$prev"; then | |
941 | prev= | |
942 | else | |
943 | dest="$arg" | |
944 | continue | |
945 | fi | |
946 | ;; | |
947 | esac | |
948 | install_prog="$install_prog $arg" | |
949 | done | |
950 | ||
951 | if test -z "$install_prog"; then | |
952 | echo "$progname: you must specify an install program" 1>&2 | |
953 | echo "$help" 1>&2 | |
954 | exit 1 | |
955 | fi | |
956 | ||
957 | if test -n "$prev"; then | |
958 | echo "$progname: the \`$prev' option requires an argument" 1>&2 | |
959 | echo "$help" 1>&2 | |
960 | exit 1 | |
961 | fi | |
962 | ||
963 | if test -z "$files"; then | |
964 | if test -z "$dest"; then | |
965 | echo "$progname: no file or destination specified" 1>&2 | |
966 | else | |
967 | echo "$progname: you must specify a destination" 1>&2 | |
968 | fi | |
969 | echo "$help" 1>&2 | |
970 | exit 1 | |
971 | fi | |
972 | ||
973 | # Strip any trailing slash from the destination. | |
974 | dest=`echo "$dest" | sed 's%/$%%'` | |
975 | ||
976 | # Check to see that the destination is a directory. | |
977 | test -d "$dest" && isdir=yes | |
978 | if test -n "$isdir"; then | |
979 | destdir="$dest" | |
980 | else | |
981 | destdir=`echo "$dest" | sed 's%/[^/]*$%%'` | |
982 | fi | |
983 | case "$destdir" in | |
984 | /*) ;; | |
985 | *) | |
986 | echo "$progname: $destdir must be an absolute directory name" 1>&2 | |
987 | echo "$help" 1>&2 | |
988 | exit 1 | |
989 | esac | |
990 | ||
991 | staticlibs= | |
992 | future_libdirs= | |
993 | current_libdirs= | |
994 | for file in $files; do | |
995 | ||
996 | # Do each installation. | |
997 | case "$file" in | |
998 | *.a) | |
999 | # Do the static libraries later. | |
1000 | staticlibs="$staticlibs $file" | |
1001 | ;; | |
1002 | ||
1003 | *.la) | |
1004 | # Check to see that this really is a libtool archive. | |
1005 | if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then : | |
1006 | else | |
1007 | echo "$progname: \`$file' is not a valid libtool archive" 1>&2 | |
1008 | echo "$help" 1>&2 | |
1009 | exit 1 | |
1010 | fi | |
1011 | ||
1012 | library_names= | |
1013 | old_library= | |
1014 | # If there is no directory component, then add one. | |
1015 | case "$file" in | |
1016 | */*) . $file ;; | |
1017 | *) . ./$file ;; | |
1018 | esac | |
1019 | ||
1020 | # Add the libdir to current_libdirs if it is the destination. | |
1021 | if test "$destdir" = "$libdir"; then | |
1022 | case "$current_libdirs " in | |
1023 | "* $libdir *") ;; | |
1024 | *) current_libdirs="$current_libdirs $libdir" ;; | |
1025 | esac | |
1026 | else | |
1027 | # Note the libdir as a future libdir. | |
1028 | case "$future_libdirs " in | |
1029 | "* $libdir *") ;; | |
1030 | *) future_libdirs="$future_libdirs $libdir" ;; | |
1031 | esac | |
1032 | fi | |
1033 | ||
1034 | dir="`echo "$file" | sed 's%/[^/]*$%%'`/" | |
1035 | test "$dir" = "$file/" && dir= | |
1036 | dir="$dir$objdir" | |
1037 | ||
1038 | # See the names of the shared library. | |
1039 | set dummy $library_names | |
1040 | if test -n "$2"; then | |
1041 | realname="$2" | |
1042 | shift | |
1043 | shift | |
1044 | ||
1045 | # Install the shared library and build the symlinks. | |
1046 | $show "$install_prog $dir/$realname $destdir/$realname" | |
1047 | eval "$run $install_prog $dir/$realname $destdir/$realname" || exit $? | |
1048 | ||
1049 | # Support stripping libraries. | |
1050 | if test -n "$stripme"; then | |
1051 | if test -n "$striplib"; then | |
1052 | $show "$striplib $destdir/$realname" | |
1053 | $run $striplib $destdir/$realname || exit $? | |
1054 | else | |
1055 | echo "$progname: warning: no library stripping program" 1>&2 | |
1056 | fi | |
1057 | fi | |
1058 | ||
1059 | if test -n "$1"; then | |
1060 | # Delete the old symlinks. | |
1061 | rmcmd="$rm" | |
1062 | for linkname | |
1063 | do | |
1064 | rmcmd="$rmcmd $destdir/$linkname" | |
1065 | done | |
1066 | $show "$rmcmd" | |
1067 | $run $rmcmd | |
1068 | ||
1069 | # ... and create new ones. | |
1070 | for linkname | |
1071 | do | |
1072 | $show "$ln_s $realname $destdir/$linkname" | |
1073 | $run $ln_s $realname $destdir/$linkname | |
1074 | done | |
1075 | fi | |
1076 | ||
1077 | # Do each command in the postinstall commands. | |
1078 | lib="$destdir/$realname" | |
1079 | cmds=`eval echo \"$postinstall_cmds\"` | |
1080 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
1081 | for cmd in $cmds; do | |
1082 | IFS="$save_ifs" | |
1083 | $show "$cmd" | |
1084 | eval "$run $cmd" || exit $? | |
1085 | done | |
1086 | IFS="$save_ifs" | |
1087 | fi | |
1088 | ||
1089 | # Install the pseudo-library for information purposes. | |
1090 | name=`echo "$file" | sed 's%^.*/%%'` | |
1091 | $show "$install_prog $file $destdir/$name" | |
1092 | $run $install_prog $file $destdir/$name || exit $? | |
1093 | ||
1094 | # Maybe install the static library, too. | |
1095 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" | |
1096 | ;; | |
1097 | ||
1098 | *) | |
1099 | # Do a test to see if this is really a libtool program. | |
1100 | if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then | |
1101 | # This variable tells wrapper scripts just to set variables rather | |
1102 | # than running their programs. | |
1103 | libtool_install_magic="$magic" | |
1104 | link_against_libtool_libs= | |
1105 | finalize_command= | |
1106 | ||
1107 | # If there is no directory component, then add one. | |
1108 | case "$file" in | |
1109 | */*) . $file ;; | |
1110 | *) . ./$file ;; | |
1111 | esac | |
1112 | ||
1113 | # Check the variables that should have been set. | |
1114 | if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then | |
1115 | echo "$progname: invalid libtool wrapper script \`$file'" | |
1116 | exit 1 | |
1117 | fi | |
1118 | ||
1119 | finalize=yes | |
1120 | for lib in $link_against_libtool_libs; do | |
1121 | # Check to see that each library is installed. | |
1122 | libdir= | |
1123 | if test -f "$lib"; then | |
1124 | # If there is no directory component, then add one. | |
1125 | case "$lib" in | |
1126 | */*) . $lib ;; | |
1127 | *) . ./$lib ;; | |
1128 | esac | |
1129 | fi | |
1130 | libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`" | |
1131 | if test -z "$libdir"; then | |
1132 | echo "$progname: warning: \`$lib' contains no -rpath information" | |
1133 | elif test -f "$libfile"; then : | |
1134 | else | |
1135 | echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 | |
1136 | finalize=no | |
1137 | fi | |
1138 | done | |
1139 | ||
1140 | if test "$hardcode_minus_L" = yes && test "$hardcode_shlibpath_var" = yes; then | |
1141 | if test "$finalize" = no; then | |
1142 | echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" | |
1143 | else | |
1144 | echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" | |
1145 | $show "$finalize_command" | |
1146 | if $run $finalize_command; then : | |
1147 | else | |
1148 | echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2 | |
1149 | continue | |
1150 | fi | |
1151 | file="$objdir/$file"T | |
1152 | fi | |
1153 | else | |
1154 | # Install the binary that we compiled earlier. | |
1155 | dir=`echo "$file" | sed 's%/[^/]*$%%'` | |
1156 | if test "$file" = "$dir"; then | |
1157 | file="$objdir/$file" | |
1158 | else | |
1159 | file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`" | |
1160 | fi | |
1161 | fi | |
1162 | fi | |
1163 | ||
1164 | $show "$install_prog$stripme $file $dest" | |
1165 | $run $install_prog$stripme $file $dest || exit $? | |
1166 | ;; | |
1167 | esac | |
1168 | done | |
1169 | ||
1170 | # FIXME Install any profiled libraries, too. | |
1171 | # newfiles= | |
1172 | # for file in $staticlibs; do | |
1173 | # newfiles="$newfiles $file" | |
1174 | # pfile=`echo "$file" | sed 's/\.a$/_p.a/'` | |
1175 | # test -f "$pfile" && newfiles="$newfiles $pfile" | |
1176 | # done | |
1177 | # staticlibs="$newfiles" | |
1178 | ||
1179 | for file in $staticlibs; do | |
1180 | name=`echo "$file" | sed 's%^.*/%%'` | |
1181 | ||
1182 | # Set up the ranlib parameters. | |
1183 | oldlib="$destdir/$name" | |
1184 | ||
1185 | $show "$install_prog $file $oldlib" | |
1186 | $run $install_prog $file $oldlib || exit $? | |
1187 | ||
1188 | # Support stripping libraries. | |
1189 | if test -n "$stripme"; then | |
1190 | if test -n "$old_striplib"; then | |
1191 | $show "$old_striplib $oldlib" | |
1192 | $run $old_striplib $oldlib || exit $? | |
1193 | else | |
1194 | echo "$progname: warning: no static library stripping program" 1>&2 | |
1195 | fi | |
1196 | fi | |
1197 | ||
1198 | # Do each command in the postinstall commands. | |
1199 | cmds=`eval echo \"$old_postinstall_cmds\"` | |
1200 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
1201 | for cmd in $cmds; do | |
1202 | IFS="$save_ifs" | |
1203 | $show "$cmd" | |
1204 | eval "$run $cmd" || exit $? | |
1205 | done | |
1206 | IFS="$save_ifs" | |
1207 | done | |
1208 | ||
1209 | if test -n "$future_libdirs"; then | |
1210 | echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" | |
1211 | fi | |
1212 | ||
1213 | if test -n "$current_libdirs"; then | |
1214 | # Maybe just do a dry run. | |
1215 | test -n "$run" && current_libdirs=" -n$current_libdirs" | |
1216 | exec $0 --finish$current_libdirs | |
1217 | exit 1 | |
1218 | fi | |
1219 | ||
1220 | exit 0 | |
1221 | ;; | |
1222 | ||
1223 | # libtool finish mode | |
1224 | finish) | |
1225 | libdirs="$nonopt" | |
1226 | ||
1227 | if test -n "$finish_cmds" && test -n "$libdirs"; then | |
1228 | for dir | |
1229 | do | |
1230 | libdirs="$libdirs $dir" | |
1231 | done | |
1232 | ||
1233 | for libdir in $libdirs; do | |
1234 | # Do each command in the postinstall commands. | |
1235 | cmds=`eval echo \"$finish_cmds\"` | |
1236 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
1237 | for cmd in $cmds; do | |
1238 | IFS="$save_ifs" | |
1239 | $show "$cmd" | |
1240 | eval "$run $cmd" | |
1241 | done | |
1242 | IFS="$save_ifs" | |
1243 | done | |
1244 | fi | |
1245 | ||
1246 | echo "To link against installed libraries in LIBDIR, users may have to:" | |
1247 | if test -n "$shlibpath_var"; then | |
1248 | echo " - add LIBDIR to their \`$shlibpath_var' environment variable" | |
1249 | fi | |
1250 | echo " - use the \`-LLIBDIR' linker flag" | |
1251 | exit 0 | |
1252 | ;; | |
1253 | ||
1254 | # libtool uninstall mode | |
1255 | uninstall) | |
1256 | rm="$nonopt" | |
1257 | files= | |
1258 | ||
1259 | for arg | |
1260 | do | |
1261 | case "$arg" in | |
1262 | -*) rm="$rm $arg" ;; | |
1263 | *) files="$files $arg" ;; | |
1264 | esac | |
1265 | done | |
1266 | ||
1267 | if test -z "$rm"; then | |
1268 | echo "$progname: you must specify an RM program" 1>&2 | |
1269 | echo "$help" 1>&2 | |
1270 | exit 1 | |
1271 | fi | |
1272 | ||
1273 | for file in $files; do | |
1274 | dir=`echo "$file" | sed -e 's%/[^/]*$%%'` | |
1275 | test "$dir" = "$file" && dir=. | |
1276 | name=`echo "$file" | sed -e 's%^.*/%%'` | |
1277 | ||
1278 | case "$name" in | |
1279 | *.la) | |
1280 | # Possibly a libtool archive, so verify it. | |
1281 | if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then | |
1282 | . $dir/$name | |
1283 | ||
1284 | # Delete the libtool libraries and symlinks. | |
1285 | for n in $library_names; do | |
1286 | $show "$rm $dir/$n" | |
1287 | $run $rm $dir/$n | |
1288 | done | |
1289 | ||
1290 | # Delete the old-fashioned archive. | |
1291 | if test -n "$old_library"; then | |
1292 | $show "$rm $dir/$old_library" | |
1293 | $run $rm $dir/$old_library | |
1294 | fi | |
1295 | fi | |
1296 | ;; | |
1297 | esac | |
1298 | ||
1299 | $show "$rm $file" | |
1300 | $run $rm $file | |
1301 | done | |
1302 | exit 0 | |
1303 | ;; | |
1304 | ||
1305 | NONE) | |
1306 | echo "$progname: you must specify a MODE" 1>&2 | |
1307 | echo "$generic_help" 1>&2 | |
1308 | exit 1 | |
1309 | ;; | |
1310 | esac | |
1311 | ||
1312 | echo "$progname: invalid operation mode \`$mode'" 1>&2 | |
1313 | echo "$generic_help" 1>&2 | |
1314 | exit 1 | |
1315 | fi # test -z "$show_help" | |
1316 | ||
1317 | # We need to display help for each of the modes. | |
1318 | case "$mode" in | |
1319 | NONE) cat <<EOF | |
1320 | Usage: $progname [OPTION]... [MODE-ARG]... | |
1321 | ||
1322 | Provide generalized library-building support services. | |
1323 | ||
1324 | -n, --dry-run display commands without modifying any files | |
1325 | --finish same as \`--mode=finish' | |
1326 | --help display this help message and exit | |
1327 | --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] | |
1328 | --version print version information | |
1329 | ||
1330 | MODE must be one of the following: | |
1331 | ||
1332 | compile compile a source file into a libtool object | |
1333 | finish complete the installation of libtool libraries | |
1334 | install install libraries or executables | |
1335 | link create a library or an executable | |
1336 | uninstall remove libraries from an installed directory | |
1337 | ||
1338 | MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for | |
1339 | a more detailed description of MODE. | |
1340 | EOF | |
1341 | ;; | |
1342 | ||
1343 | compile) | |
1344 | cat <<EOF | |
1345 | Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE | |
1346 | ||
1347 | Compile a source file into a libtool library object. | |
1348 | ||
1349 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file | |
1350 | from the given SOURCEFILE. | |
1351 | ||
1352 | The output file name is determined by removing the directory component from | |
1353 | SOURCEFILE, then substituting the C source code suffix \`.c' with the | |
1354 | library object suffix, \`.lo'. | |
1355 | EOF | |
1356 | ;; | |
1357 | ||
1358 | finish) | |
1359 | cat <<EOF | |
1360 | Usage: $progname [OPTION]... --mode=finish [LIBDIR]... | |
1361 | ||
1362 | Complete the installation of libtool libraries. | |
1363 | ||
1364 | Each LIBDIR is a directory that contains libtool libraries. | |
1365 | ||
1366 | The commands that this mode executes may require superuser privileges. Use | |
1367 | the \`--dry-run' option if you just want to see what would be executed. | |
1368 | EOF | |
1369 | ;; | |
1370 | ||
1371 | install) | |
1372 | cat <<EOF | |
1373 | Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... | |
1374 | ||
1375 | Install executables or libraries. | |
1376 | ||
1377 | INSTALL-COMMAND is the installation command. The first component should be | |
1378 | either the \`install' or \`cp' program. | |
1379 | ||
1380 | The rest of the components are interpreted as arguments to that command (only | |
1381 | BSD-compatible install options are recognized). | |
1382 | EOF | |
1383 | ;; | |
1384 | ||
1385 | link) | |
1386 | cat <<EOF | |
1387 | Usage: $progname [OPTION]... --mode=link LINK-COMMAND... | |
1388 | ||
1389 | Link object files or libraries together to form another library, or to | |
1390 | create an executable program. | |
1391 | ||
1392 | LINK-COMMAND is a command using the C compiler that you would use to create | |
1393 | a program from several object files. | |
1394 | ||
1395 | The following components of LINK-COMMAND are treated specially: | |
1396 | ||
1397 | -LLIBDIR search LIBDIR for required installed libraries | |
1398 | -lNAME OUTPUT-FILE requires the installed library libNAME | |
1399 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects | |
1400 | -rpath LIBDIR the created library will eventually be installed in LIBDIR | |
1401 | -static do not do any dynamic linking or shared library creation | |
1402 | -version-info CURRENT[:REVISION[:AGE]] | |
1403 | specify library version info [each variable defaults to 0] | |
1404 | ||
1405 | All other options (arguments beginning with \`-') are ignored. | |
1406 | ||
1407 | Every other argument is treated as a filename. Files ending in \`.la' are | |
1408 | treated as uninstalled libtool libraries, other files are standard or library | |
1409 | object files. | |
1410 | ||
1411 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only | |
1412 | library objects (\`.lo' or \`.l_o' files) may be specified, and the \`-rpath' | |
1413 | option is required. | |
1414 | ||
1415 | If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar' | |
1416 | and \`ranlib'. | |
1417 | ||
1418 | If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is | |
1419 | created, otherwise an executable program is created. | |
1420 | EOF | |
1421 | ;; | |
1422 | ||
1423 | uninstall) | |
1424 | cat <<EOF | |
1425 | Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... | |
1426 | ||
1427 | Remove libraries from an installation directory. | |
1428 | ||
1429 | RM is the name of the program to use to delete files associated with each FILE | |
1430 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | |
1431 | to RM. | |
1432 | ||
1433 | If FILE is a libtool library, all the files associated with it are deleted. | |
1434 | Otherwise, only FILE itself is deleted using RM. | |
1435 | EOF | |
1436 | ;; | |
1437 | ||
1438 | *) | |
1439 | echo "$progname: invalid operation mode \`$mode'" 1>&2 | |
1440 | echo "$help" 1>&2 | |
1441 | exit 1 | |
1442 | ;; | |
1443 | esac | |
1444 | ||
1445 | case "$mode" in | |
1446 | archive|compile) | |
1447 | echo | |
1448 | echo "Try \`$progname --help' for more information about other modes." | |
1449 | ;; | |
1450 | esac | |
1451 | ||
1452 | exit 0 | |
1453 | ||
1454 | # Local Variables: | |
1455 | # mode:shell-script | |
1456 | # sh-indentation:2 | |
1457 | # End: |