Commit | Line | Data |
---|---|---|
a7a8349d MV |
1 | # ltmain.sh - Provide generalized library-building support services. |
2 | # Generated automatically from ltmain.sh.in by configure. | |
96abf47d | 3 | # Copyright (C) 1996, 1997 Free Software Foundation, Inc. |
a7a8349d MV |
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 | |
a6a5a664 | 31 | VERSION=0.9h |
a7a8349d MV |
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 | ||
4cdcd100 JB |
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 | ||
a7a8349d MV |
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 | ||
96abf47d MD |
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 | ||
a7a8349d MV |
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 | |
96abf47d | 135 | echo "$help" 1>&2 |
a7a8349d MV |
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) | |
393e4e4d | 146 | if echo " $@ " | egrep -e "[ ]-c[ ]" > /dev/null 2>&1; then |
a7a8349d MV |
147 | mode=compile |
148 | else | |
149 | mode=link | |
150 | fi | |
151 | ;; | |
152 | *install*|cp) | |
153 | mode=install | |
154 | ;; | |
155 | *rm) | |
156 | mode=uninstall | |
157 | ;; | |
4cdcd100 JB |
158 | *.la) |
159 | mode=dlname | |
160 | ;; | |
a7a8349d MV |
161 | *) |
162 | # Just use the default operation mode. | |
163 | if test "$mode" = NONE; then | |
164 | if test -n "$nonopt"; then | |
4cdcd100 | 165 | echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
a7a8349d | 166 | else |
4cdcd100 | 167 | echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
a7a8349d MV |
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) | |
4cdcd100 | 182 | progname="$progname: compile" |
a7a8349d MV |
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. | |
96abf47d MD |
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 | |
a7a8349d MV |
219 | *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;; |
220 | *) | |
96abf47d | 221 | echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2 |
a7a8349d MV |
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 | ||
393e4e4d JB |
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 | |
a7a8349d MV |
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 | |
393e4e4d | 247 | test -n "$obj" && $run $rm $obj |
a7a8349d MV |
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 | ||
393e4e4d JB |
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 | |
a7a8349d MV |
271 | fi |
272 | ||
393e4e4d JB |
273 | # Create an invalid libtool object if no PIC, so that we don't accidentally |
274 | # link it into a program. | |
a7a8349d | 275 | if test "$build_libtool_libs" != yes; then |
79131585 JB |
276 | $show "echo timestamp > $libobj" |
277 | eval "$run echo timestamp > $libobj" || exit $? | |
a7a8349d MV |
278 | fi |
279 | ||
280 | exit 0 | |
281 | ;; | |
282 | ||
283 | # libtool link mode | |
284 | link) | |
4cdcd100 | 285 | progname="$progname: link" |
a7a8349d MV |
286 | # Go through the arguments, transforming them on the way. |
287 | cc="$nonopt" | |
288 | args="$cc" | |
393e4e4d | 289 | allow_undefined=no |
a7a8349d MV |
290 | compile_command="$cc" |
291 | finalize_command="$cc" | |
96abf47d MD |
292 | compile_shlibpath= |
293 | finalize_shlibpath= | |
a7a8349d | 294 | deplibs= |
4cdcd100 JB |
295 | export_dynamic=no |
296 | hardcode_libdirs= | |
a7a8349d MV |
297 | install_libdir= |
298 | libobjs= | |
299 | link_against_libtool_libs= | |
300 | link_static= | |
301 | ltlibs= | |
302 | objs= | |
a7a8349d MV |
303 | prev= |
304 | prevarg= | |
393e4e4d | 305 | perm_rpath= |
a7a8349d MV |
306 | temp_rpath= |
307 | vinfo= | |
a7a8349d | 308 | |
96abf47d MD |
309 | # We need to know -static, to get the right output filenames. |
310 | case " $@ " in | |
4cdcd100 | 311 | *" -static "*) build_libtool_libs=no build_old_libs=yes ;; |
96abf47d MD |
312 | esac |
313 | ||
a7a8349d MV |
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) | |
4cdcd100 JB |
320 | compile_command="$compile_command @OUTPUT@" |
321 | finalize_command="$finalize_command @OUTPUT@" | |
a7a8349d MV |
322 | args="$args $arg" |
323 | ;; | |
324 | esac | |
325 | ||
326 | eval "$prev=\$arg" | |
327 | prev= | |
328 | ||
329 | continue | |
330 | fi | |
331 | ||
96abf47d MD |
332 | args="$args $arg" |
333 | prevarg="$arg" | |
a7a8349d MV |
334 | |
335 | case "$arg" in | |
393e4e4d JB |
336 | -allow-undefined) allow_undefined=yes ;; |
337 | ||
4cdcd100 JB |
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 | ||
a7a8349d | 345 | -L*) |
a7a8349d MV |
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 | |
96abf47d | 355 | deplibs="$deplibs $arg" |
a7a8349d MV |
356 | ;; |
357 | ||
358 | -l*) deplibs="$deplibs $arg" ;; | |
359 | ||
360 | -o) prev=output ;; | |
361 | ||
96abf47d MD |
362 | -rpath) |
363 | prev=install_libdir | |
364 | continue | |
365 | ;; | |
a7a8349d MV |
366 | |
367 | -static) | |
96abf47d MD |
368 | link_static="`eval echo \"$link_static_flag\"`" |
369 | compile_command="$compile_command $link_static" | |
370 | continue | |
a7a8349d MV |
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 | ||
96abf47d MD |
379 | -version-info) |
380 | prev=vinfo | |
381 | continue | |
382 | ;; | |
a7a8349d MV |
383 | |
384 | -*) cc="$cc $arg" ;; # Some other compiler flag. | |
385 | ||
4cdcd100 | 386 | *.o) |
a7a8349d MV |
387 | # A standard object. |
388 | objs="$objs $arg" | |
389 | ;; | |
390 | ||
4cdcd100 JB |
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 | ||
393e4e4d JB |
397 | # Standard archive. |
398 | objs="$objs $arg" | |
4cdcd100 JB |
399 | ;; |
400 | ||
96abf47d | 401 | *.lo) |
a7a8349d MV |
402 | # A library object. |
403 | libobjs="$libobjs $arg" | |
404 | ;; | |
405 | ||
406 | *.la) | |
407 | # A libtool-controlled library. | |
96abf47d MD |
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 | ||
4cdcd100 | 431 | # Get the name of the library we link against. |
96abf47d | 432 | linklib= |
4cdcd100 JB |
433 | for l in $old_library $library_names; do |
434 | linklib="$l" | |
96abf47d MD |
435 | done |
436 | ||
4cdcd100 JB |
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 | ||
96abf47d MD |
442 | # Find the relevant object directory and library name. |
443 | name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'` | |
a7a8349d | 444 | dir=`echo "$arg" | sed 's%/[^/]*$%%'` |
96abf47d MD |
445 | if test "$dir" = "$arg"; then |
446 | dir="$objdir" | |
447 | else | |
448 | dir="$dir/$objdir" | |
449 | fi | |
a7a8349d | 450 | |
79131585 JB |
451 | if test "$build_libtool_libs" = yes && test -n "$library_names"; then |
452 | link_against_libtool_libs="$link_against_libtool_libs $arg" | |
a7a8349d MV |
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 | ||
4cdcd100 JB |
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 | |
a7a8349d | 473 | |
4cdcd100 JB |
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 | |
393e4e4d JB |
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 | |
a7a8349d MV |
485 | fi |
486 | ||
393e4e4d | 487 | |
96abf47d | 488 | case "$hardcode_action" in |
4cdcd100 | 489 | immediate) |
96abf47d MD |
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 | ;; | |
a7a8349d | 499 | |
96abf47d MD |
500 | relink) |
501 | # We need an absolute path. | |
a7a8349d | 502 | case "$dir" in |
96abf47d | 503 | /*) ;; |
a7a8349d | 504 | *) |
96abf47d | 505 | absdir=`cd "$dir" && pwd` |
a7a8349d | 506 | if test -z "$absdir"; then |
96abf47d | 507 | echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2 |
a7a8349d MV |
508 | exit 1 |
509 | fi | |
96abf47d MD |
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 | ;; | |
4cdcd100 JB |
523 | |
524 | *) | |
525 | echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2 | |
526 | exit 1 | |
527 | ;; | |
96abf47d MD |
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" | |
4cdcd100 | 533 | elif test "$hardcode_minus_L" = yes; then |
96abf47d | 534 | finalize_command="$finalize_command -L$libdir -l$name" |
4cdcd100 | 535 | elif test "$hardcode_shlibpath_var" = yes; then |
96abf47d MD |
536 | finalize_shlibpath="$finalize_shlibpath$libdir:" |
537 | finalize_command="$finalize_command -l$name" | |
4cdcd100 JB |
538 | else |
539 | # We can't seem to hardcode it, guess we'll fake it. | |
540 | finalize_command="$finalize_command -L$libdir -l$name" | |
96abf47d | 541 | fi |
a7a8349d MV |
542 | else |
543 | # Transform directly to old archives if we don't build new libraries. | |
393e4e4d JB |
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" | |
4cdcd100 JB |
549 | compile_command="$compile_command $dir/$linklib" |
550 | finalize_command="$finalize_command $dir/$linklib" | |
a7a8349d | 551 | fi |
96abf47d | 552 | continue |
a7a8349d MV |
553 | ;; |
554 | ||
555 | *) | |
556 | echo "$progname: unknown file suffix for \`$arg'" 1>&2 | |
96abf47d | 557 | echo "$help" 1>&2 |
a7a8349d MV |
558 | exit 1 |
559 | ;; | |
560 | esac | |
561 | ||
96abf47d MD |
562 | compile_command="$compile_command $arg" |
563 | finalize_command="$finalize_command $arg" | |
a7a8349d MV |
564 | done |
565 | ||
566 | if test -n "$prev"; then | |
96abf47d | 567 | echo "$progname: the \`$prevarg' option requires an argument" 1>&2 |
a7a8349d MV |
568 | echo "$help" 1>&2 |
569 | exit 1 | |
570 | fi | |
571 | ||
4cdcd100 JB |
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 | ||
a7a8349d MV |
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 | ||
a7a8349d MV |
592 | *.la) |
593 | libname=`echo "$output" | sed 's/\.la$//'` | |
594 | ||
4cdcd100 JB |
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 | ||
a7a8349d | 603 | if test -n "$objs"; then |
4cdcd100 | 604 | echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 |
a7a8349d MV |
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 | |
4cdcd100 | 610 | echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2 |
a7a8349d MV |
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 | ||
a7a8349d MV |
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 | ||
a7a8349d MV |
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" | |
96abf47d | 681 | major=`expr $current - $age` |
a7a8349d MV |
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 | ||
a7a8349d MV |
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 | ||
393e4e4d JB |
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 | ||
a7a8349d MV |
730 | if test "$build_libtool_libs" = yes; then |
731 | # Get the real and link names of the library. | |
4cdcd100 | 732 | library_names=`eval echo \"$library_names_spec\"` |
a7a8349d MV |
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. | |
96abf47d | 751 | test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` |
a7a8349d MV |
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 | |
4cdcd100 JB |
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 | |
a7a8349d MV |
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 | ||
393e4e4d | 813 | # Create the old-style object. |
4cdcd100 | 814 | reload_objs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'` |
a7a8349d MV |
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 | ||
a6a5a664 JB |
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 | |
a7a8349d MV |
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. | |
96abf47d | 869 | compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'` |
393e4e4d | 870 | finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'` |
a7a8349d MV |
871 | fi |
872 | ||
873 | if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then | |
4cdcd100 JB |
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 | ||
a7a8349d | 878 | # We have no uninstalled library dependencies, so finalize right now. |
a7a8349d MV |
879 | $show "$compile_command" |
880 | $run $compile_command | |
96abf47d MD |
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 | |
a7a8349d MV |
892 | fi |
893 | ||
4cdcd100 JB |
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 | ||
a7a8349d MV |
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. | |
96abf47d | 912 | rpath="$rpath$dir:" |
a7a8349d MV |
913 | ;; |
914 | *) | |
915 | # Relative path: add a thisdir entry. | |
96abf47d | 916 | rpath="$rpath\$thisdir/$dir:" |
a7a8349d MV |
917 | ;; |
918 | esac | |
919 | done | |
393e4e4d | 920 | temp_rpath="$rpath" |
a7a8349d MV |
921 | fi |
922 | ||
923 | # Delete the old output file. | |
924 | $run $rm $output | |
925 | ||
96abf47d | 926 | if test -n "$compile_shlibpath"; then |
393e4e4d | 927 | compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command" |
96abf47d MD |
928 | fi |
929 | if test -n "$finalize_shlibpath"; then | |
393e4e4d JB |
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" | |
96abf47d | 941 | fi |
a7a8349d | 942 | |
96abf47d MD |
943 | case "$hardcode_action" in |
944 | relink) | |
a7a8349d | 945 | # AGH! Flame the AIX and HP-UX people for me, will ya? |
96abf47d | 946 | echo "$progname: warning: using a buggy system linker" 1>&2 |
a7a8349d | 947 | echo "$progname: relinking will be required before \`$output' can be installed" 1>&2 |
96abf47d MD |
948 | ;; |
949 | esac | |
a7a8349d | 950 | |
96abf47d MD |
951 | $show "$compile_command" |
952 | eval "$run $compile_command" || exit $? | |
a7a8349d MV |
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: | |
393e4e4d JB |
977 | link_against_libtool_libs='$link_against_libtool_libs' |
978 | finalize_command='$finalize_command' | |
a7a8349d MV |
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 | ||
96abf47d MD |
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 | |
a7a8349d MV |
1003 | EOF |
1004 | ||
1005 | # Export our shlibpath_var if we have one. | |
393e4e4d | 1006 | if test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
a7a8349d MV |
1007 | cat >> $output <<EOF |
1008 | ||
96abf47d | 1009 | # Add our own library path to $shlibpath_var |
393e4e4d | 1010 | $shlibpath_var="$temp_rpath\$$shlibpath_var" |
96abf47d | 1011 | export $shlibpath_var |
a7a8349d MV |
1012 | EOF |
1013 | fi | |
1014 | ||
96abf47d | 1015 | cat >> $output <<EOF |
a7a8349d | 1016 | |
a7a8349d MV |
1017 | eval "exec \$program \$args" |
1018 | ||
1019 | echo "\$0: cannot exec \$program \$args" | |
1020 | exit 1 | |
1021 | else | |
1022 | # The program doesn't exist. | |
96abf47d | 1023 | echo "\$0: error: \$progdir/\$program does not exist" 1>&2 |
a7a8349d MV |
1024 | echo "This script is just a wrapper for \$program." 1>&2 |
1025 | echo "See the $PACKAGE documentation for more information." 1>&2 | |
1026 | exit 1 | |
1027 | fi | |
1028 | fi | |
1029 | EOF | |
1030 | chmod +x $output | |
1031 | fi | |
1032 | exit 0 | |
1033 | ;; | |
1034 | esac | |
1035 | ||
1036 | ||
1037 | # See if we need to build an old-fashioned archive. | |
1038 | if test "$build_old_libs" = "yes"; then | |
4cdcd100 JB |
1039 | # Now set the variables for building old libraries. |
1040 | oldlib="$objdir/$libname.a" | |
1041 | ||
393e4e4d | 1042 | # Transform .lo files to .o files. |
4cdcd100 JB |
1043 | oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'` |
1044 | ||
1045 | if test -d "$objdir"; then | |
a7a8349d MV |
1046 | $show "$rm $oldlib" |
1047 | $run $rm $oldlib | |
4cdcd100 JB |
1048 | else |
1049 | $show "$mkdir $objdir" | |
1050 | $run $mkdir $objdir | |
1051 | fi | |
a7a8349d MV |
1052 | |
1053 | # Do each command in the archive commands. | |
1054 | cmds=`eval echo \"$old_archive_cmds\"` | |
1055 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
1056 | for cmd in $cmds; do | |
1057 | IFS="$save_ifs" | |
1058 | $show "$cmd" | |
1059 | eval "$run $cmd" || exit $? | |
1060 | done | |
1061 | IFS="$save_ifs" | |
1062 | fi | |
1063 | ||
1064 | # Now create the libtool archive. | |
1065 | case "$output" in | |
1066 | *.la) | |
1067 | old_library= | |
1068 | test "$build_old_libs" = yes && old_library="$libname.a" | |
1069 | ||
1070 | echo "creating $output" | |
1071 | ||
1072 | # Only create the output if not a dry run. | |
1073 | if test -z "$run"; then | |
1074 | cat > $output <<EOF | |
1075 | # $output - a libtool library file | |
1076 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION | |
1077 | ||
393e4e4d JB |
1078 | # The name that we can dlopen(3). |
1079 | dlname='$dlname' | |
1080 | ||
a7a8349d MV |
1081 | # Names of this library. |
1082 | library_names='$library_names' | |
1083 | ||
1084 | # The name of the static archive. | |
1085 | old_library='$old_library' | |
1086 | ||
1087 | # Version information for $libname. | |
1088 | current=$current | |
1089 | age=$age | |
1090 | revision=$revision | |
1091 | ||
1092 | # Directory that this library needs to be installed in: | |
1093 | libdir='$install_libdir' | |
1094 | EOF | |
1095 | fi | |
393e4e4d JB |
1096 | |
1097 | # Do a symbolic link so that the libtool archive can be found in | |
1098 | # LD_LIBRARY_PATH before the program is installed. | |
1099 | $show "$ln_s ../$output $objdir/$output" | |
1100 | $run $ln_s ../$output $objdir/$output || $run $cp_p ../$output $objdir/$output || exit 1 | |
a7a8349d MV |
1101 | ;; |
1102 | esac | |
1103 | exit 0 | |
1104 | ;; | |
1105 | ||
1106 | # libtool install mode | |
1107 | install) | |
4cdcd100 | 1108 | progname="$progname: install" |
a7a8349d MV |
1109 | |
1110 | # The first argument is the name of the installation program. | |
1111 | install_prog="$nonopt" | |
1112 | ||
1113 | # We need to accept at least all the BSD install flags. | |
1114 | dest= | |
1115 | files= | |
1116 | opts= | |
1117 | prev= | |
1118 | install_type= | |
1119 | isdir= | |
1120 | stripme= | |
1121 | for arg | |
1122 | do | |
1123 | if test -n "$dest"; then | |
1124 | files="$files $dest" | |
1125 | dest="$arg" | |
1126 | continue | |
1127 | fi | |
1128 | ||
1129 | case "$arg" in | |
1130 | -d) isdir=yes ;; | |
1131 | -f) prev="-f" ;; | |
1132 | -g) prev="-g" ;; | |
1133 | -m) prev="-m" ;; | |
1134 | -o) prev="-o" ;; | |
1135 | -s) | |
1136 | stripme=" -s" | |
1137 | continue | |
1138 | ;; | |
1139 | -*) ;; | |
1140 | ||
1141 | *) | |
1142 | # If the previous option needed an argument, then skip it. | |
1143 | if test -n "$prev"; then | |
1144 | prev= | |
1145 | else | |
1146 | dest="$arg" | |
1147 | continue | |
1148 | fi | |
1149 | ;; | |
1150 | esac | |
1151 | install_prog="$install_prog $arg" | |
1152 | done | |
1153 | ||
1154 | if test -z "$install_prog"; then | |
1155 | echo "$progname: you must specify an install program" 1>&2 | |
1156 | echo "$help" 1>&2 | |
1157 | exit 1 | |
1158 | fi | |
1159 | ||
1160 | if test -n "$prev"; then | |
1161 | echo "$progname: the \`$prev' option requires an argument" 1>&2 | |
1162 | echo "$help" 1>&2 | |
1163 | exit 1 | |
1164 | fi | |
1165 | ||
1166 | if test -z "$files"; then | |
1167 | if test -z "$dest"; then | |
1168 | echo "$progname: no file or destination specified" 1>&2 | |
1169 | else | |
1170 | echo "$progname: you must specify a destination" 1>&2 | |
1171 | fi | |
1172 | echo "$help" 1>&2 | |
1173 | exit 1 | |
1174 | fi | |
1175 | ||
1176 | # Strip any trailing slash from the destination. | |
1177 | dest=`echo "$dest" | sed 's%/$%%'` | |
1178 | ||
1179 | # Check to see that the destination is a directory. | |
1180 | test -d "$dest" && isdir=yes | |
1181 | if test -n "$isdir"; then | |
1182 | destdir="$dest" | |
a6a5a664 | 1183 | destname= |
a7a8349d MV |
1184 | else |
1185 | destdir=`echo "$dest" | sed 's%/[^/]*$%%'` | |
a6a5a664 JB |
1186 | test "$destdir" = "$dest" && destdir=. |
1187 | destname=`echo "$dest" | sed 's%^.*/%%'` | |
1188 | ||
1189 | # Not a directory, so check to see that there is only one file specified. | |
1190 | set dummy $files | |
1191 | if test $# -gt 2; then | |
1192 | echo "$progname: \`$dest' is not a directory" 1>&2 | |
1193 | echo "$help" 1>&2 | |
1194 | exit 1 | |
1195 | fi | |
a7a8349d MV |
1196 | fi |
1197 | case "$destdir" in | |
1198 | /*) ;; | |
1199 | *) | |
a6a5a664 JB |
1200 | for file in $files; do |
1201 | case "$file" in | |
1202 | *.lo) ;; | |
1203 | *) | |
1204 | echo "$progname: \`$destdir' must be an absolute directory name" 1>&2 | |
1205 | echo "$help" 1>&2 | |
1206 | exit 1 | |
1207 | ;; | |
1208 | esac | |
1209 | done | |
1210 | ;; | |
a7a8349d MV |
1211 | esac |
1212 | ||
1213 | staticlibs= | |
1214 | future_libdirs= | |
1215 | current_libdirs= | |
1216 | for file in $files; do | |
1217 | ||
1218 | # Do each installation. | |
1219 | case "$file" in | |
1220 | *.a) | |
1221 | # Do the static libraries later. | |
1222 | staticlibs="$staticlibs $file" | |
1223 | ;; | |
1224 | ||
1225 | *.la) | |
1226 | # Check to see that this really is a libtool archive. | |
1227 | if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then : | |
1228 | else | |
1229 | echo "$progname: \`$file' is not a valid libtool archive" 1>&2 | |
1230 | echo "$help" 1>&2 | |
1231 | exit 1 | |
1232 | fi | |
1233 | ||
1234 | library_names= | |
1235 | old_library= | |
1236 | # If there is no directory component, then add one. | |
1237 | case "$file" in | |
1238 | */*) . $file ;; | |
1239 | *) . ./$file ;; | |
1240 | esac | |
1241 | ||
1242 | # Add the libdir to current_libdirs if it is the destination. | |
1243 | if test "$destdir" = "$libdir"; then | |
1244 | case "$current_libdirs " in | |
1245 | "* $libdir *") ;; | |
1246 | *) current_libdirs="$current_libdirs $libdir" ;; | |
1247 | esac | |
1248 | else | |
1249 | # Note the libdir as a future libdir. | |
1250 | case "$future_libdirs " in | |
1251 | "* $libdir *") ;; | |
1252 | *) future_libdirs="$future_libdirs $libdir" ;; | |
1253 | esac | |
1254 | fi | |
1255 | ||
1256 | dir="`echo "$file" | sed 's%/[^/]*$%%'`/" | |
1257 | test "$dir" = "$file/" && dir= | |
1258 | dir="$dir$objdir" | |
1259 | ||
1260 | # See the names of the shared library. | |
1261 | set dummy $library_names | |
1262 | if test -n "$2"; then | |
1263 | realname="$2" | |
1264 | shift | |
1265 | shift | |
1266 | ||
1267 | # Install the shared library and build the symlinks. | |
1268 | $show "$install_prog $dir/$realname $destdir/$realname" | |
1269 | eval "$run $install_prog $dir/$realname $destdir/$realname" || exit $? | |
4cdcd100 | 1270 | test "X$dlname" = "X$realname" && dlname= |
a7a8349d MV |
1271 | |
1272 | # Support stripping libraries. | |
1273 | if test -n "$stripme"; then | |
1274 | if test -n "$striplib"; then | |
1275 | $show "$striplib $destdir/$realname" | |
1276 | $run $striplib $destdir/$realname || exit $? | |
1277 | else | |
1278 | echo "$progname: warning: no library stripping program" 1>&2 | |
1279 | fi | |
1280 | fi | |
1281 | ||
1282 | if test -n "$1"; then | |
1283 | # Delete the old symlinks. | |
1284 | rmcmd="$rm" | |
1285 | for linkname | |
1286 | do | |
1287 | rmcmd="$rmcmd $destdir/$linkname" | |
1288 | done | |
1289 | $show "$rmcmd" | |
1290 | $run $rmcmd | |
1291 | ||
1292 | # ... and create new ones. | |
1293 | for linkname | |
1294 | do | |
4cdcd100 | 1295 | test "X$dlname" = "X$linkname" && dlname= |
a7a8349d MV |
1296 | $show "$ln_s $realname $destdir/$linkname" |
1297 | $run $ln_s $realname $destdir/$linkname | |
1298 | done | |
1299 | fi | |
1300 | ||
4cdcd100 JB |
1301 | if test -n "$dlname"; then |
1302 | # Install the dynamically-loadable library. | |
1303 | $show "$install_prog $dir/$dlname $destdir/$dlname" | |
1304 | eval "$run $install_prog $dir/$dlname $destdir/$dlname" || exit $? | |
1305 | fi | |
1306 | ||
a7a8349d MV |
1307 | # Do each command in the postinstall commands. |
1308 | lib="$destdir/$realname" | |
1309 | cmds=`eval echo \"$postinstall_cmds\"` | |
1310 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
1311 | for cmd in $cmds; do | |
1312 | IFS="$save_ifs" | |
1313 | $show "$cmd" | |
1314 | eval "$run $cmd" || exit $? | |
1315 | done | |
1316 | IFS="$save_ifs" | |
1317 | fi | |
1318 | ||
1319 | # Install the pseudo-library for information purposes. | |
1320 | name=`echo "$file" | sed 's%^.*/%%'` | |
1321 | $show "$install_prog $file $destdir/$name" | |
1322 | $run $install_prog $file $destdir/$name || exit $? | |
1323 | ||
1324 | # Maybe install the static library, too. | |
1325 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" | |
1326 | ;; | |
1327 | ||
a6a5a664 JB |
1328 | *.lo) |
1329 | # Install (i.e. copy) a libtool object. | |
1330 | ||
1331 | # Figure out destination file name, if it wasn't already specified. | |
1332 | if test -n "$destname"; then | |
1333 | destfile="$destdir/$destname" | |
1334 | else | |
1335 | destfile=`echo "$file" | sed 's%^.*/%%;'` | |
1336 | destfile="$destdir/$destfile" | |
1337 | fi | |
1338 | ||
1339 | # Deduce the name of the destination old-style object file. | |
1340 | case "$destfile" in | |
1341 | *.lo) | |
1342 | staticdest=`echo "$destfile" | sed 's/\.lo$/\.o/;'` | |
1343 | ;; | |
1344 | *.o) | |
1345 | staticdest="$destfile" | |
1346 | destfile= | |
1347 | ;; | |
1348 | *) | |
1349 | echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2 | |
1350 | echo "$help" 1>&2 | |
1351 | exit 1 | |
1352 | ;; | |
1353 | esac | |
1354 | ||
1355 | # Install the libtool object if requested. | |
1356 | if test -n "$destfile"; then | |
1357 | $show "$install_prog $file $destfile" | |
1358 | $run $install_prog $file $destfile || exit $? | |
1359 | fi | |
1360 | ||
1361 | # Install the old object if enabled. | |
1362 | if test "$build_old_libs" = yes; then | |
1363 | # Deduce the name of the old-style object file. | |
1364 | staticobj=`echo "$file" | sed 's/\.lo$/\.o/;'` | |
1365 | ||
1366 | $show "$install_prog $staticobj $staticdest" | |
1367 | $run $install_prog $staticobj $staticdest || exit $? | |
1368 | fi | |
1369 | exit 0 | |
1370 | ;; | |
1371 | ||
a7a8349d MV |
1372 | *) |
1373 | # Do a test to see if this is really a libtool program. | |
1374 | if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then | |
1375 | # This variable tells wrapper scripts just to set variables rather | |
1376 | # than running their programs. | |
1377 | libtool_install_magic="$magic" | |
1378 | link_against_libtool_libs= | |
1379 | finalize_command= | |
1380 | ||
1381 | # If there is no directory component, then add one. | |
1382 | case "$file" in | |
1383 | */*) . $file ;; | |
1384 | *) . ./$file ;; | |
1385 | esac | |
1386 | ||
1387 | # Check the variables that should have been set. | |
1388 | if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then | |
96abf47d | 1389 | echo "$progname: invalid libtool wrapper script \`$file'" 1>&2 |
a7a8349d MV |
1390 | exit 1 |
1391 | fi | |
1392 | ||
1393 | finalize=yes | |
1394 | for lib in $link_against_libtool_libs; do | |
1395 | # Check to see that each library is installed. | |
1396 | libdir= | |
1397 | if test -f "$lib"; then | |
1398 | # If there is no directory component, then add one. | |
1399 | case "$lib" in | |
1400 | */*) . $lib ;; | |
1401 | *) . ./$lib ;; | |
1402 | esac | |
1403 | fi | |
1404 | libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`" | |
1405 | if test -z "$libdir"; then | |
96abf47d MD |
1406 | echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2 |
1407 | elif test -f "$libfile"; then : | |
a7a8349d MV |
1408 | else |
1409 | echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 | |
1410 | finalize=no | |
1411 | fi | |
1412 | done | |
1413 | ||
79131585 | 1414 | if test "$hardcode_action" = relink; then |
a7a8349d | 1415 | if test "$finalize" = no; then |
96abf47d | 1416 | echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 |
a7a8349d | 1417 | else |
96abf47d | 1418 | echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 |
a7a8349d MV |
1419 | $show "$finalize_command" |
1420 | if $run $finalize_command; then : | |
1421 | else | |
1422 | echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2 | |
1423 | continue | |
1424 | fi | |
1425 | file="$objdir/$file"T | |
1426 | fi | |
1427 | else | |
1428 | # Install the binary that we compiled earlier. | |
1429 | dir=`echo "$file" | sed 's%/[^/]*$%%'` | |
1430 | if test "$file" = "$dir"; then | |
1431 | file="$objdir/$file" | |
1432 | else | |
1433 | file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`" | |
1434 | fi | |
1435 | fi | |
1436 | fi | |
1437 | ||
1438 | $show "$install_prog$stripme $file $dest" | |
1439 | $run $install_prog$stripme $file $dest || exit $? | |
1440 | ;; | |
1441 | esac | |
1442 | done | |
96abf47d | 1443 | |
a7a8349d MV |
1444 | for file in $staticlibs; do |
1445 | name=`echo "$file" | sed 's%^.*/%%'` | |
1446 | ||
1447 | # Set up the ranlib parameters. | |
1448 | oldlib="$destdir/$name" | |
1449 | ||
1450 | $show "$install_prog $file $oldlib" | |
1451 | $run $install_prog $file $oldlib || exit $? | |
1452 | ||
1453 | # Support stripping libraries. | |
1454 | if test -n "$stripme"; then | |
1455 | if test -n "$old_striplib"; then | |
1456 | $show "$old_striplib $oldlib" | |
1457 | $run $old_striplib $oldlib || exit $? | |
1458 | else | |
1459 | echo "$progname: warning: no static library stripping program" 1>&2 | |
1460 | fi | |
1461 | fi | |
1462 | ||
1463 | # Do each command in the postinstall commands. | |
1464 | cmds=`eval echo \"$old_postinstall_cmds\"` | |
1465 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
1466 | for cmd in $cmds; do | |
1467 | IFS="$save_ifs" | |
1468 | $show "$cmd" | |
1469 | eval "$run $cmd" || exit $? | |
1470 | done | |
1471 | IFS="$save_ifs" | |
1472 | done | |
1473 | ||
1474 | if test -n "$future_libdirs"; then | |
96abf47d | 1475 | echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 |
a7a8349d MV |
1476 | fi |
1477 | ||
1478 | if test -n "$current_libdirs"; then | |
1479 | # Maybe just do a dry run. | |
1480 | test -n "$run" && current_libdirs=" -n$current_libdirs" | |
1481 | exec $0 --finish$current_libdirs | |
1482 | exit 1 | |
1483 | fi | |
1484 | ||
1485 | exit 0 | |
1486 | ;; | |
1487 | ||
4cdcd100 JB |
1488 | # libtool dlname mode |
1489 | dlname) | |
1490 | progname="$progname: dlname" | |
1491 | ltlibs="$nonopt" | |
1492 | for lib | |
1493 | do | |
1494 | ltlibs="$ltlibs $lib" | |
1495 | done | |
1496 | ||
393e4e4d JB |
1497 | if test -z "$ltlibs"; then |
1498 | echo "$progname: you must specify at least one LTLIBRARY" 1>&2 | |
1499 | echo "$help" 1>&2 | |
1500 | exit 1 | |
1501 | fi | |
1502 | ||
4cdcd100 JB |
1503 | # Now check to make sure each one is a valid libtool library. |
1504 | status=0 | |
1505 | for lib in $ltlibs; do | |
1506 | dlname= | |
1507 | libdir= | |
393e4e4d | 1508 | library_names= |
4cdcd100 JB |
1509 | |
1510 | # Check to see that this really is a libtool archive. | |
1511 | if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then : | |
1512 | else | |
1513 | echo "$progname: \`$arg' is not a valid libtool archive" 1>&2 | |
1514 | status=1 | |
1515 | continue | |
1516 | fi | |
1517 | ||
1518 | # If there is no directory component, then add one. | |
1519 | case "$arg" in | |
1520 | */*) . $arg ;; | |
1521 | *) . ./$arg ;; | |
1522 | esac | |
1523 | ||
1524 | if test -z "$libdir"; then | |
1525 | echo "$progname: \`$arg' contains no -rpath information" 1>&2 | |
1526 | status=1 | |
1527 | elif test -n "$dlname"; then | |
1528 | echo "$libdir/$dlname" | |
393e4e4d JB |
1529 | elif test -z "$library_names"; then |
1530 | echo "$progname: \`$arg' is not a shared library" 1>&2 | |
1531 | status=1 | |
4cdcd100 JB |
1532 | else |
1533 | echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2 | |
1534 | status=1 | |
1535 | fi | |
1536 | done | |
1537 | exit $status | |
1538 | ;; | |
1539 | ||
a7a8349d MV |
1540 | # libtool finish mode |
1541 | finish) | |
4cdcd100 | 1542 | progname="$progname: finish" |
a7a8349d MV |
1543 | libdirs="$nonopt" |
1544 | ||
1545 | if test -n "$finish_cmds" && test -n "$libdirs"; then | |
1546 | for dir | |
1547 | do | |
1548 | libdirs="$libdirs $dir" | |
1549 | done | |
1550 | ||
1551 | for libdir in $libdirs; do | |
1552 | # Do each command in the postinstall commands. | |
1553 | cmds=`eval echo \"$finish_cmds\"` | |
1554 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' | |
1555 | for cmd in $cmds; do | |
1556 | IFS="$save_ifs" | |
1557 | $show "$cmd" | |
1558 | eval "$run $cmd" | |
1559 | done | |
1560 | IFS="$save_ifs" | |
1561 | done | |
1562 | fi | |
1563 | ||
1564 | echo "To link against installed libraries in LIBDIR, users may have to:" | |
1565 | if test -n "$shlibpath_var"; then | |
1566 | echo " - add LIBDIR to their \`$shlibpath_var' environment variable" | |
1567 | fi | |
1568 | echo " - use the \`-LLIBDIR' linker flag" | |
1569 | exit 0 | |
1570 | ;; | |
1571 | ||
1572 | # libtool uninstall mode | |
1573 | uninstall) | |
4cdcd100 | 1574 | progname="$progname: uninstall" |
a7a8349d MV |
1575 | rm="$nonopt" |
1576 | files= | |
1577 | ||
1578 | for arg | |
1579 | do | |
1580 | case "$arg" in | |
1581 | -*) rm="$rm $arg" ;; | |
1582 | *) files="$files $arg" ;; | |
1583 | esac | |
1584 | done | |
1585 | ||
1586 | if test -z "$rm"; then | |
1587 | echo "$progname: you must specify an RM program" 1>&2 | |
1588 | echo "$help" 1>&2 | |
1589 | exit 1 | |
1590 | fi | |
1591 | ||
1592 | for file in $files; do | |
1593 | dir=`echo "$file" | sed -e 's%/[^/]*$%%'` | |
1594 | test "$dir" = "$file" && dir=. | |
1595 | name=`echo "$file" | sed -e 's%^.*/%%'` | |
1596 | ||
4cdcd100 JB |
1597 | rmfiles="$file" |
1598 | ||
a7a8349d MV |
1599 | case "$name" in |
1600 | *.la) | |
1601 | # Possibly a libtool archive, so verify it. | |
1602 | if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then | |
1603 | . $dir/$name | |
1604 | ||
1605 | # Delete the libtool libraries and symlinks. | |
1606 | for n in $library_names; do | |
4cdcd100 JB |
1607 | rmfiles="$rmfiles $dir/$n" |
1608 | test "X$n" = "X$dlname" && dlname= | |
a7a8349d | 1609 | done |
4cdcd100 JB |
1610 | test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" |
1611 | test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" | |
a7a8349d | 1612 | |
4cdcd100 | 1613 | # FIXME: should reinstall the best remaining shared library. |
a7a8349d MV |
1614 | fi |
1615 | ;; | |
a6a5a664 JB |
1616 | |
1617 | *.lo) | |
1618 | if test "$build_old_libs" = yes; then | |
1619 | oldobj=`echo "$name" | sed 's/\.lo$/\.o/'` | |
1620 | rmfiles="$rmfiles $dir/$oldobj" | |
1621 | fi | |
1622 | ;; | |
a7a8349d MV |
1623 | esac |
1624 | ||
4cdcd100 JB |
1625 | $show "$rm $rmfiles" |
1626 | $run $rm $rmfiles | |
a7a8349d | 1627 | done |
96abf47d | 1628 | exit 0 |
a7a8349d MV |
1629 | ;; |
1630 | ||
1631 | NONE) | |
1632 | echo "$progname: you must specify a MODE" 1>&2 | |
1633 | echo "$generic_help" 1>&2 | |
1634 | exit 1 | |
1635 | ;; | |
1636 | esac | |
1637 | ||
1638 | echo "$progname: invalid operation mode \`$mode'" 1>&2 | |
1639 | echo "$generic_help" 1>&2 | |
1640 | exit 1 | |
1641 | fi # test -z "$show_help" | |
1642 | ||
1643 | # We need to display help for each of the modes. | |
1644 | case "$mode" in | |
1645 | NONE) cat <<EOF | |
1646 | Usage: $progname [OPTION]... [MODE-ARG]... | |
1647 | ||
1648 | Provide generalized library-building support services. | |
1649 | ||
1650 | -n, --dry-run display commands without modifying any files | |
96abf47d | 1651 | --features display configuration information and exit |
a7a8349d MV |
1652 | --finish same as \`--mode=finish' |
1653 | --help display this help message and exit | |
1654 | --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] | |
1655 | --version print version information | |
1656 | ||
1657 | MODE must be one of the following: | |
1658 | ||
1659 | compile compile a source file into a libtool object | |
4cdcd100 | 1660 | dlname print filenames to use to \`dlopen' libtool libraries |
a7a8349d MV |
1661 | finish complete the installation of libtool libraries |
1662 | install install libraries or executables | |
1663 | link create a library or an executable | |
1664 | uninstall remove libraries from an installed directory | |
1665 | ||
1666 | MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for | |
1667 | a more detailed description of MODE. | |
1668 | EOF | |
1669 | ;; | |
1670 | ||
1671 | compile) | |
1672 | cat <<EOF | |
1673 | Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE | |
1674 | ||
1675 | Compile a source file into a libtool library object. | |
1676 | ||
1677 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file | |
1678 | from the given SOURCEFILE. | |
1679 | ||
1680 | The output file name is determined by removing the directory component from | |
1681 | SOURCEFILE, then substituting the C source code suffix \`.c' with the | |
1682 | library object suffix, \`.lo'. | |
1683 | EOF | |
1684 | ;; | |
1685 | ||
4cdcd100 JB |
1686 | dlname) |
1687 | cat <<EOF | |
393e4e4d | 1688 | Usage: $progname [OPTION]... --mode=dlname LTLIBRARY... |
4cdcd100 JB |
1689 | |
1690 | Print filenames to use to \`dlopen' libtool libraries. | |
1691 | ||
1692 | Each LTLIBRARY is the name of a dynamically loadable libtool library (one that | |
1693 | was linked using the \`-export-dynamic' option). | |
1694 | ||
1695 | The names to use are printed to standard output, one per line. | |
1696 | EOF | |
1697 | ;; | |
1698 | ||
a7a8349d MV |
1699 | finish) |
1700 | cat <<EOF | |
1701 | Usage: $progname [OPTION]... --mode=finish [LIBDIR]... | |
1702 | ||
1703 | Complete the installation of libtool libraries. | |
1704 | ||
1705 | Each LIBDIR is a directory that contains libtool libraries. | |
1706 | ||
1707 | The commands that this mode executes may require superuser privileges. Use | |
1708 | the \`--dry-run' option if you just want to see what would be executed. | |
1709 | EOF | |
1710 | ;; | |
1711 | ||
1712 | install) | |
1713 | cat <<EOF | |
1714 | Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... | |
1715 | ||
1716 | Install executables or libraries. | |
1717 | ||
1718 | INSTALL-COMMAND is the installation command. The first component should be | |
1719 | either the \`install' or \`cp' program. | |
1720 | ||
1721 | The rest of the components are interpreted as arguments to that command (only | |
1722 | BSD-compatible install options are recognized). | |
1723 | EOF | |
1724 | ;; | |
1725 | ||
1726 | link) | |
1727 | cat <<EOF | |
1728 | Usage: $progname [OPTION]... --mode=link LINK-COMMAND... | |
1729 | ||
1730 | Link object files or libraries together to form another library, or to | |
1731 | create an executable program. | |
1732 | ||
1733 | LINK-COMMAND is a command using the C compiler that you would use to create | |
1734 | a program from several object files. | |
1735 | ||
1736 | The following components of LINK-COMMAND are treated specially: | |
1737 | ||
393e4e4d JB |
1738 | -allow-undefined allow a libtool library to reference undefined symbols |
1739 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) | |
4cdcd100 JB |
1740 | -LLIBDIR search LIBDIR for required installed libraries |
1741 | -lNAME OUTPUT-FILE requires the installed library libNAME | |
4cdcd100 JB |
1742 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
1743 | -rpath LIBDIR the created library will eventually be installed in LIBDIR | |
1744 | -static do not do any dynamic linking or shared library creation | |
a7a8349d | 1745 | -version-info CURRENT[:REVISION[:AGE]] |
4cdcd100 | 1746 | specify library version info [each variable defaults to 0] |
a7a8349d MV |
1747 | |
1748 | All other options (arguments beginning with \`-') are ignored. | |
1749 | ||
1750 | Every other argument is treated as a filename. Files ending in \`.la' are | |
1751 | treated as uninstalled libtool libraries, other files are standard or library | |
1752 | object files. | |
1753 | ||
1754 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only | |
96abf47d | 1755 | library objects (\`.lo' files) may be specified, and \`-rpath' is required. |
a7a8349d MV |
1756 | |
1757 | If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar' | |
393e4e4d | 1758 | and \`ranlib'. |
a7a8349d MV |
1759 | |
1760 | If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is | |
1761 | created, otherwise an executable program is created. | |
1762 | EOF | |
1763 | ;; | |
1764 | ||
1765 | uninstall) | |
1766 | cat <<EOF | |
1767 | Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... | |
1768 | ||
1769 | Remove libraries from an installation directory. | |
1770 | ||
1771 | RM is the name of the program to use to delete files associated with each FILE | |
1772 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | |
1773 | to RM. | |
1774 | ||
1775 | If FILE is a libtool library, all the files associated with it are deleted. | |
1776 | Otherwise, only FILE itself is deleted using RM. | |
1777 | EOF | |
1778 | ;; | |
1779 | ||
1780 | *) | |
1781 | echo "$progname: invalid operation mode \`$mode'" 1>&2 | |
1782 | echo "$help" 1>&2 | |
1783 | exit 1 | |
1784 | ;; | |
1785 | esac | |
1786 | ||
1787 | case "$mode" in | |
1788 | archive|compile) | |
1789 | echo | |
1790 | echo "Try \`$progname --help' for more information about other modes." | |
1791 | ;; | |
1792 | esac | |
1793 | ||
1794 | exit 0 | |
1795 | ||
1796 | # Local Variables: | |
1797 | # mode:shell-script | |
1798 | # sh-indentation:2 | |
1799 | # End: |