*** empty log message ***
[bpt/guile.git] / ltmain.sh
CommitLineData
a7a8349d 1# ltmain.sh - Provide generalized library-building support services.
5798fd97
MD
2# NOTE: Changing this file will not affect anything until you rerun ltconfig.
3#
4# Copyright (C) 1996-1998 Free Software Foundation, Inc.
a7a8349d
MV
5# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20#
21# As a special exception to the GNU General Public License, if you
22# distribute this file as part of a program that contains a
23# configuration script generated by Autoconf, you may include it under
24# the same distribution terms that you use for the rest of that program.
25
26# The name of this program.
553f653a 27progname=`$echo "$0" | sed 's%^.*/%%'`
5798fd97 28modename="$progname"
a7a8349d
MV
29
30# Constants.
31PROGRAM=ltmain.sh
32PACKAGE=libtool
2c9a3a48 33VERSION=1.2
a7a8349d 34
553f653a 35default_mode=
a7a8349d 36help="Try \`$progname --help' for more information."
a7a8349d
MV
37magic="%%%MAGIC variable%%%"
38mkdir="mkdir"
39mv="mv -f"
a7a8349d
MV
40rm="rm -f"
41
553f653a
JB
42# Sed substitution that helps us do robust quoting. It backslashifies
43# metacharacters that are still active within double-quoted strings.
5798fd97
MD
44Xsed='sed -e s/^X//'
45sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
553f653a
JB
46
47# NLS nuisances.
48# Only set LANG and LC_ALL to C if already set.
49# These must not be set unconditionally because not all systems understand
50# e.g. LANG=C (notably SCO).
51if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
52if test "${LANG+set}" = set; then LANG=C; export LANG; fi
53
a7a8349d 54if test "$LTCONFIG_VERSION" != "$VERSION"; then
5798fd97
MD
55 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
56 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
a7a8349d
MV
57 exit 1
58fi
59
4cdcd100 60if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
5798fd97
MD
61 echo "$modename: not configured to build any kind of library" 1>&2
62 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
4cdcd100
JB
63 exit 1
64fi
65
a7a8349d
MV
66# Global variables.
67mode=$default_mode
68nonopt=
69prev=
70prevopt=
71run=
553f653a 72show="$echo"
a7a8349d 73show_help=
553f653a 74execute_dlfiles=
a7a8349d
MV
75
76# Parse our command line options once, thoroughly.
553f653a 77while test $# -gt 0
a7a8349d
MV
78do
79 arg="$1"
80 shift
81
82 case "$arg" in
5798fd97 83 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
a7a8349d
MV
84 *) optarg= ;;
85 esac
86
87 # If the previous option needs an argument, assign it.
88 if test -n "$prev"; then
553f653a
JB
89 case "$prev" in
90 execute_dlfiles)
91 eval "$prev=\"\$$prev \$arg\""
92 ;;
93 *)
94 eval "$prev=\$arg"
95 ;;
96 esac
97
a7a8349d
MV
98 prev=
99 prevopt=
100 continue
101 fi
102
103 # Have we seen a non-optional argument yet?
104 case "$arg" in
105 --help)
106 show_help=yes
107 ;;
108
109 --version)
5798fd97 110 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
a7a8349d
MV
111 exit 0
112 ;;
113
114 --dry-run | -n)
115 run=:
116 ;;
117
96abf47d 118 --features)
5798fd97 119 echo "host: $host"
96abf47d 120 if test "$build_libtool_libs" = yes; then
5798fd97 121 echo "enable shared libraries"
96abf47d 122 else
5798fd97 123 echo "disable shared libraries"
96abf47d
MD
124 fi
125 if test "$build_old_libs" = yes; then
5798fd97 126 echo "enable static libraries"
96abf47d 127 else
5798fd97 128 echo "disable static libraries"
96abf47d
MD
129 fi
130 exit 0
131 ;;
132
a7a8349d
MV
133 --finish) mode="finish" ;;
134
135 --mode) prevopt="--mode" prev=mode ;;
136 --mode=*) mode="$optarg" ;;
137
553f653a
JB
138 --quiet | --silent)
139 show=:
140 ;;
141
142 -dlopen)
143 prevopt="-dlopen"
144 prev=execute_dlfiles
145 ;;
146
a7a8349d 147 -*)
5798fd97 148 $echo "$modename: unrecognized option \`$arg'" 1>&2
553f653a 149 $echo "$help" 1>&2
a7a8349d
MV
150 exit 1
151 ;;
152
153 *)
154 nonopt="$arg"
155 break
156 ;;
157 esac
158done
159
a7a8349d 160if test -n "$prevopt"; then
5798fd97 161 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
553f653a 162 $echo "$help" 1>&2
a7a8349d
MV
163 exit 1
164fi
165
a7a8349d
MV
166if test -z "$show_help"; then
167
168 # Infer the operation mode.
553f653a 169 if test -z "$mode"; then
a7a8349d 170 case "$nonopt" in
5798fd97 171 *cc | *++ | gcc* | *-gcc*)
553f653a
JB
172 mode=link
173 for arg
174 do
175 case "$arg" in
176 -c)
177 mode=compile
178 break
179 ;;
180 esac
181 done
182 ;;
183 *db | *dbx)
184 mode=execute
a7a8349d 185 ;;
5798fd97 186 *install*|cp|mv)
a7a8349d
MV
187 mode=install
188 ;;
189 *rm)
190 mode=uninstall
191 ;;
192 *)
553f653a
JB
193 # If we have no mode, but dlfiles were specified, then do execute mode.
194 test -n "$execute_dlfiles" && mode=execute
195
a7a8349d 196 # Just use the default operation mode.
553f653a
JB
197 if test -z "$mode"; then
198 if test -n "$nonopt"; then
5798fd97 199 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
553f653a 200 else
5798fd97 201 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
553f653a 202 fi
a7a8349d
MV
203 fi
204 ;;
205 esac
206 fi
207
553f653a
JB
208 # Only execute mode is allowed to have -dlopen flags.
209 if test -n "$execute_dlfiles" && test "$mode" != execute; then
5798fd97 210 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
553f653a
JB
211 $echo "$help" 1>&2
212 exit 1
213 fi
214
a7a8349d
MV
215 # Change the help message to a mode-specific one.
216 generic_help="$help"
5798fd97 217 help="Try \`$modename --help --mode=$mode' for more information."
a7a8349d
MV
218
219 # These modes are in order of execution frequency so that they run quickly.
220 case "$mode" in
221 # libtool compile mode
222 compile)
5798fd97 223 modename="$modename: compile"
a7a8349d 224 # Get the compilation command and the source file.
553f653a 225 base_compile=
a7a8349d 226 lastarg=
553f653a
JB
227 srcfile="$nonopt"
228 suppress_output=
a7a8349d
MV
229
230 for arg
231 do
5798fd97
MD
232 # Accept any command-line options.
233 case "$arg" in
234 -o)
235 $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
553f653a
JB
236 $echo "$help" 1>&2
237 exit 1
5798fd97
MD
238 ;;
239
240 -static)
241 build_libtool_libs=no
242 build_old_libs=yes
243 continue
244 ;;
245 esac
553f653a
JB
246
247 # Accept the current argument as the source file.
248 lastarg="$srcfile"
249 srcfile="$arg"
250
251 # Aesthetically quote the previous argument.
252
253 # Backslashify any backslashes, double quotes, and dollar signs.
254 # These are the only characters that are still specially
255 # interpreted inside of double-quoted scrings.
5798fd97 256 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
553f653a
JB
257
258 # Double-quote args containing other shell metacharacters.
259 # Many Bourne shells cannot handle close brackets correctly in scan
260 # sets, so we specify it separately.
261 case "$lastarg" in
262 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
263 lastarg="\"$lastarg\""
264 ;;
a7a8349d
MV
265 esac
266
553f653a
JB
267 # Add the previous argument to base_compile.
268 if test -z "$base_compile"; then
269 base_compile="$lastarg"
270 else
271 base_compile="$base_compile $lastarg"
272 fi
a7a8349d
MV
273 done
274
275 # Get the name of the library object.
5798fd97 276 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
96abf47d
MD
277
278 # Recognize several different file suffixes.
5798fd97 279 xform='[cCFSfms]'
96abf47d 280 case "$libobj" in
5798fd97
MD
281 *.ada) xform=ada ;;
282 *.adb) xform=adb ;;
283 *.ads) xform=ads ;;
284 *.asm) xform=asm ;;
553f653a 285 *.c++) xform=c++ ;;
96abf47d
MD
286 *.cc) xform=cc ;;
287 *.cpp) xform=cpp ;;
288 *.cxx) xform=cxx ;;
289 *.f90) xform=f90 ;;
553f653a 290 *.for) xform=for ;;
96abf47d
MD
291 esac
292
5798fd97 293 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
96abf47d
MD
294
295 case "$libobj" in
2c9a3a48 296 *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
a7a8349d 297 *)
5798fd97 298 $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
a7a8349d
MV
299 exit 1
300 ;;
301 esac
302
303 if test -z "$base_compile"; then
5798fd97 304 $echo "$modename: you must specify a compilation command" 1>&2
553f653a 305 $echo "$help" 1>&2
a7a8349d
MV
306 exit 1
307 fi
308
393e4e4d
JB
309 # Delete any leftover library objects.
310 if test "$build_old_libs" = yes; then
311 $run $rm $obj $libobj
312 trap "$run $rm $obj $libobj; exit 1" 1 2 15
313 else
314 $run $rm $libobj
315 trap "$run $rm $libobj; exit 1" 1 2 15
316 fi
a7a8349d
MV
317
318 # Only build a PIC object if we are building libtool libraries.
319 if test "$build_libtool_libs" = yes; then
5798fd97
MD
320 # Without this assignment, base_compile gets emptied.
321 fbsd_hideous_sh_bug=$base_compile
322
a7a8349d
MV
323 # All platforms use -DPIC, to notify preprocessed assembler code.
324 $show "$base_compile$pic_flag -DPIC $srcfile"
553f653a 325 if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
a7a8349d 326 else
553f653a
JB
327 test -n "$obj" && $run $rm $obj
328 exit 1
a7a8349d
MV
329 fi
330
331 # If we have no pic_flag, then copy the object into place and finish.
332 if test -z "$pic_flag"; then
553f653a
JB
333 $show "$LN_S $obj $libobj"
334 $run $LN_S $obj $libobj
335 exit $?
a7a8349d
MV
336 fi
337
338 # Just move the object, then go on to compile the next one
339 $show "$mv $obj $libobj"
340 $run $mv $obj $libobj || exit 1
553f653a
JB
341
342 # Allow error messages only from the first compilation.
343 suppress_output=' >/dev/null 2>&1'
a7a8349d
MV
344 fi
345
393e4e4d
JB
346 # Only build a position-dependent object if we build old libraries.
347 if test "$build_old_libs" = yes; then
553f653a
JB
348 # Suppress compiler output if we already did a PIC compilation.
349 $show "$base_compile $srcfile$suppress_output"
350 if $run eval "$base_compile \$srcfile$suppress_output"; then :
393e4e4d
JB
351 else
352 $run $rm $obj $libobj
353 exit 1
354 fi
a7a8349d
MV
355 fi
356
5798fd97
MD
357 # Create an invalid libtool object if no PIC, so that we do not
358 # accidentally link it into a program.
a7a8349d 359 if test "$build_libtool_libs" != yes; then
5798fd97
MD
360 $show "echo timestamp > $libobj"
361 $run eval "echo timestamp > \$libobj" || exit $?
a7a8349d
MV
362 fi
363
364 exit 0
365 ;;
366
367 # libtool link mode
368 link)
5798fd97 369 modename="$modename: link"
553f653a 370 CC="$nonopt"
5798fd97 371 allow_undefined=yes
553f653a
JB
372 compile_command="$CC"
373 finalize_command="$CC"
374
96abf47d
MD
375 compile_shlibpath=
376 finalize_shlibpath=
a7a8349d 377 deplibs=
553f653a
JB
378 dlfiles=
379 dlprefiles=
4cdcd100
JB
380 export_dynamic=no
381 hardcode_libdirs=
a7a8349d
MV
382 libobjs=
383 link_against_libtool_libs=
a7a8349d
MV
384 ltlibs=
385 objs=
a7a8349d
MV
386 prev=
387 prevarg=
5798fd97 388 release=
476f3c84 389 rpath=
393e4e4d 390 perm_rpath=
a7a8349d
MV
391 temp_rpath=
392 vinfo=
a7a8349d 393
96abf47d 394 # We need to know -static, to get the right output filenames.
553f653a
JB
395 for arg
396 do
397 case "$arg" in
476f3c84
MD
398 -all-static | -static)
399 if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5798fd97 400 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
553f653a 401 fi
476f3c84 402 build_libtool_libs=no
553f653a
JB
403 build_old_libs=yes
404 break
405 ;;
406 esac
407 done
96abf47d 408
5798fd97
MD
409 # See if our shared archives depend on static archives.
410 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
411
553f653a 412 # Go through the arguments, transforming them on the way.
a7a8349d
MV
413 for arg
414 do
415 # If the previous option needs an argument, assign it.
416 if test -n "$prev"; then
553f653a
JB
417 case "$prev" in
418 output)
419 compile_command="$compile_command @OUTPUT@"
420 finalize_command="$finalize_command @OUTPUT@"
421 ;;
422 esac
423
424 case "$prev" in
425 dlfiles|dlprefiles)
426 case "$arg" in
427 *.la | *.lo) ;; # We handle these cases below.
428 *)
429 dlprefiles="$dlprefiles $arg"
430 test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
431 prev=
432 ;;
433 esac
434 ;;
5798fd97
MD
435 release)
436 release="-$arg"
437 prev=
438 continue
439 ;;
476f3c84 440 rpath)
93ad5c88 441 rpath="$rpath $arg"
476f3c84
MD
442 prev=
443 continue
444 ;;
553f653a
JB
445 *)
446 eval "$prev=\"\$arg\""
447 prev=
448 continue
449 ;;
450 esac
a7a8349d
MV
451 fi
452
96abf47d 453 prevarg="$arg"
a7a8349d
MV
454
455 case "$arg" in
476f3c84
MD
456 -all-static)
457 if test -n "$link_static_flag"; then
458 compile_command="$compile_command $link_static_flag"
459 finalize_command="$finalize_command $link_static_flag"
460 fi
461 continue
462 ;;
463
553f653a 464 -allow-undefined)
5798fd97
MD
465 # FIXME: remove this flag sometime in the future.
466 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
4cdcd100
JB
467 continue
468 ;;
469
553f653a
JB
470 -dlopen)
471 prev=dlfiles
472 continue
473 ;;
474
475 -dlpreopen)
476 prev=dlprefiles
477 continue
478 ;;
479
480 -export-dynamic)
481 if test "$export_dynamic" != yes; then
482 export_dynamic=yes
93ad5c88 483 if test -n "$export_dynamic_flag_spec"; then
5798fd97 484 eval arg=\"$export_dynamic_flag_spec\"
93ad5c88
JB
485 else
486 arg=
487 fi
553f653a
JB
488
489 # Add the symbol object into the linking commands.
490 compile_command="$compile_command @SYMFILE@"
491 finalize_command="$finalize_command @SYMFILE@"
492 fi
493 ;;
494
a7a8349d 495 -L*)
5798fd97 496 dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
553f653a 497 case "$dir" in
5798fd97 498 /* | [A-Za-z]:\\*)
93ad5c88 499 # Add the corresponding hardcode_libdir_flag, if it is not identical.
553f653a
JB
500 ;;
501 *)
5798fd97 502 $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
553f653a
JB
503 exit 1
504 ;;
505 esac
506 deplibs="$deplibs $arg"
507 ;;
a7a8349d
MV
508
509 -l*) deplibs="$deplibs $arg" ;;
510
5798fd97
MD
511 -no-undefined)
512 allow_undefined=no
513 continue
514 ;;
515
a7a8349d
MV
516 -o) prev=output ;;
517
5798fd97
MD
518 -release)
519 prev=release
520 continue
521 ;;
522
96abf47d 523 -rpath)
476f3c84 524 prev=rpath
553f653a
JB
525 continue
526 ;;
a7a8349d
MV
527
528 -static)
93ad5c88
JB
529 # If we have no pic_flag, then this is the same as -all-static.
530 if test -z "$pic_flag" && test -n "$link_static_flag"; then
531 compile_command="$compile_command $link_static_flag"
532 finalize_command="$finalize_command $link_static_flag"
533 fi
96abf47d 534 continue
476f3c84 535 ;;
a7a8349d 536
96abf47d 537 -version-info)
553f653a
JB
538 prev=vinfo
539 continue
540 ;;
a7a8349d 541
553f653a 542 # Some other compiler flag.
5798fd97 543 -* | +*)
553f653a
JB
544 # Unknown arguments in both finalize_command and compile_command need
545 # to be aesthetically quoted because they are evaled later.
5798fd97 546 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
553f653a
JB
547 case "$arg" in
548 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
549 arg="\"$arg\""
550 ;;
551 esac
552 ;;
4cdcd100 553
2c9a3a48 554 *.o | *.a)
553f653a
JB
555 # A standard object.
556 objs="$objs $arg"
557 ;;
4cdcd100 558
96abf47d 559 *.lo)
553f653a
JB
560 # A library object.
561 if test "$prev" = dlfiles; then
562 dlfiles="$dlfiles $arg"
563 if test "$build_libtool_libs" = yes; then
564 prev=
565 continue
566 else
567 # If libtool objects are unsupported, then we need to preload.
568 prev=dlprefiles
569 fi
570 fi
571
572 if test "$prev" = dlprefiles; then
573 # Preload the old-style object.
2c9a3a48 574 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
553f653a
JB
575 prev=
576 fi
a7a8349d 577 libobjs="$libobjs $arg"
553f653a 578 ;;
a7a8349d
MV
579
580 *.la)
553f653a 581 # A libtool-controlled library.
96abf47d 582
553f653a
JB
583 dlname=
584 libdir=
585 library_names=
586 old_library=
96abf47d 587
553f653a 588 # Check to see that this really is a libtool archive.
2c9a3a48 589 if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
553f653a 590 else
5798fd97 591 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
553f653a
JB
592 exit 1
593 fi
96abf47d 594
553f653a
JB
595 # If there is no directory component, then add one.
596 case "$arg" in
5798fd97 597 */* | *\\*) . $arg ;;
553f653a
JB
598 *) . ./$arg ;;
599 esac
96abf47d 600
553f653a 601 if test -z "$libdir"; then
5798fd97 602 $echo "$modename: \`$arg' contains no -rpath information" 1>&2
553f653a
JB
603 exit 1
604 fi
4cdcd100 605
553f653a
JB
606 # Get the name of the library we link against.
607 linklib=
608 for l in $old_library $library_names; do
609 linklib="$l"
610 done
a7a8349d 611
553f653a 612 if test -z "$linklib"; then
5798fd97 613 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
553f653a
JB
614 exit 1
615 fi
a7a8349d 616
553f653a 617 # Find the relevant object directory and library name.
5798fd97
MD
618 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
619 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
553f653a
JB
620 if test "X$dir" = "X$arg"; then
621 dir="$objdir"
622 else
623 dir="$dir/$objdir"
624 fi
a7a8349d 625
553f653a
JB
626 # This library was specified with -dlopen.
627 if test "$prev" = dlfiles; then
628 dlfiles="$dlfiles $arg"
629 if test -z "$dlname"; then
630 # If there is no dlname, we need to preload.
631 prev=dlprefiles
632 else
5798fd97
MD
633 # We should not create a dependency on this library, but we
634 # may need any libraries it requires.
635 compile_command="$compile_command$dependency_libs"
636 finalize_command="$finalize_command$dependency_libs"
553f653a
JB
637 prev=
638 continue
639 fi
640 fi
393e4e4d 641
553f653a
JB
642 # The library was specified with -dlpreopen.
643 if test "$prev" = dlprefiles; then
644 # Prefer using a static library (so that no silly _DYNAMIC symbols
645 # are required to link).
646 if test -n "$old_library"; then
647 dlprefiles="$dlprefiles $dir/$old_library"
648 else
649 dlprefiles="$dlprefiles $dir/$linklib"
650 fi
651 prev=
652 fi
96abf47d 653
553f653a
JB
654 if test "$build_libtool_libs" = yes && test -n "$library_names"; then
655 link_against_libtool_libs="$link_against_libtool_libs $arg"
656 if test -n "$shlibpath_var"; then
657 # Make sure the rpath contains only unique directories.
658 case "$temp_rpath " in
93ad5c88 659 *" $dir "*) ;;
553f653a
JB
660 *) temp_rpath="$temp_rpath $dir" ;;
661 esac
662 fi
663
93ad5c88 664 # This is the magic to use -rpath.
553f653a
JB
665 if test -n "$hardcode_libdir_flag_spec"; then
666 if test -n "$hardcode_libdir_separator"; then
667 if test -z "$hardcode_libdirs"; then
668 # Put the magic libdir with the hardcode flag.
669 hardcode_libdirs="$libdir"
670 libdir="@HARDCODE_LIBDIRS@"
671 else
93ad5c88
JB
672 # Just accumulate the unique libdirs.
673 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
674 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
675 ;;
676 *)
677 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
678 ;;
679 esac
553f653a
JB
680 libdir=
681 fi
682 fi
683
684 if test -n "$libdir"; then
5798fd97 685 eval flag=\"$hardcode_libdir_flag_spec\"
553f653a
JB
686
687 compile_command="$compile_command $flag"
688 finalize_command="$finalize_command $flag"
689 fi
5798fd97 690 elif test -n "$runpath_var"; then
553f653a
JB
691 # Do the same for the permanent run path.
692 case "$perm_rpath " in
93ad5c88 693 *" $libdir "*) ;;
553f653a
JB
694 *) perm_rpath="$perm_rpath $libdir" ;;
695 esac
696 fi
697
698
699 case "$hardcode_action" in
700 immediate)
701 if test "$hardcode_direct" = no; then
702 compile_command="$compile_command $dir/$linklib"
703 elif test "$hardcode_minus_L" = no; then
704 compile_command="$compile_command -L$dir -l$name"
705 elif test "$hardcode_shlibpath_var" = no; then
706 compile_shlibpath="$compile_shlibpath$dir:"
707 compile_command="$compile_command -l$name"
708 fi
709 ;;
710
711 relink)
712 # We need an absolute path.
713 case "$dir" in
5798fd97 714 /* | [A-Za-z]:\\*) ;;
553f653a
JB
715 *)
716 absdir=`cd "$dir" && pwd`
717 if test -z "$absdir"; then
5798fd97 718 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
553f653a
JB
719 exit 1
720 fi
721 dir="$absdir"
722 ;;
723 esac
724
725 if test "$hardcode_direct" = yes; then
726 compile_command="$compile_command $dir/$linklib"
727 elif test "$hardcode_minus_L" = yes; then
728 compile_command="$compile_command -L$dir -l$name"
729 elif test "$hardcode_shlibpath_var" = yes; then
730 compile_shlibpath="$compile_shlibpath$dir:"
731 compile_command="$compile_command -l$name"
732 fi
733 ;;
2c9a3a48
JB
734
735 *)
736 $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2
737 exit 1
738 ;;
553f653a
JB
739 esac
740
741 # Finalize command for both is simple: just hardcode it.
742 if test "$hardcode_direct" = yes; then
743 finalize_command="$finalize_command $libdir/$linklib"
744 elif test "$hardcode_minus_L" = yes; then
745 finalize_command="$finalize_command -L$libdir -l$name"
746 elif test "$hardcode_shlibpath_var" = yes; then
747 finalize_shlibpath="$finalize_shlibpath$libdir:"
748 finalize_command="$finalize_command -l$name"
4cdcd100 749 else
5798fd97 750 # We cannot seem to hardcode it, guess we'll fake it.
553f653a
JB
751 finalize_command="$finalize_command -L$libdir -l$name"
752 fi
a7a8349d
MV
753 else
754 # Transform directly to old archives if we don't build new libraries.
393e4e4d 755 if test -n "$pic_flag" && test -z "$old_library"; then
5798fd97 756 $echo "$modename: cannot find static library for \`$arg'" 1>&2
553f653a
JB
757 exit 1
758 fi
759
5798fd97
MD
760 # Here we assume that one of hardcode_direct or hardcode_minus_L
761 # is not unsupported. This is valid on all known static and
762 # shared platforms.
553f653a
JB
763 if test "$hardcode_direct" != unsupported; then
764 test -n "$old_library" && linklib="$old_library"
765 compile_command="$compile_command $dir/$linklib"
766 finalize_command="$finalize_command $dir/$linklib"
767 else
553f653a
JB
768 compile_command="$compile_command -L$dir -l$name"
769 finalize_command="$finalize_command -L$dir -l$name"
393e4e4d 770 fi
a7a8349d 771 fi
5798fd97
MD
772
773 # Add in any libraries that this one depends upon.
774 compile_command="$compile_command$dependency_libs"
775 finalize_command="$finalize_command$dependency_libs"
96abf47d 776 continue
553f653a 777 ;;
a7a8349d 778
93ad5c88 779 # Some other compiler argument.
a7a8349d 780 *)
93ad5c88
JB
781 # Unknown arguments in both finalize_command and compile_command need
782 # to be aesthetically quoted because they are evaled later.
5798fd97 783 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
93ad5c88
JB
784 case "$arg" in
785 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
786 arg="\"$arg\""
787 ;;
788 esac
553f653a 789 ;;
a7a8349d
MV
790 esac
791
553f653a 792 # Now actually substitute the argument into the commands.
5798fd97
MD
793 if test -n "$arg"; then
794 compile_command="$compile_command $arg"
795 finalize_command="$finalize_command $arg"
796 fi
a7a8349d
MV
797 done
798
799 if test -n "$prev"; then
5798fd97
MD
800 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
801 $echo "$help" 1>&2
802 exit 1
803 fi
804
805 if test -n "$vinfo" && test -n "$release"; then
806 $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2
553f653a 807 $echo "$help" 1>&2
a7a8349d
MV
808 exit 1
809 fi
810
811 oldlib=
812 oldobjs=
813 case "$output" in
814 "")
5798fd97 815 $echo "$modename: you must specify an output file" 1>&2
553f653a 816 $echo "$help" 1>&2
a7a8349d
MV
817 exit 1
818 ;;
819
5798fd97
MD
820 */* | *\\*)
821 $echo "$modename: output file \`$output' must have no directory components" 1>&2
a7a8349d
MV
822 exit 1
823 ;;
824
2c9a3a48 825 *.a)
5798fd97
MD
826 # Now set the variables for building old libraries.
827 build_libtool_libs=no
828 build_old_libs=yes
829 oldlib="$output"
830 $show "$rm $oldlib"
831 $run $rm $oldlib
832 ;;
833
a7a8349d 834 *.la)
5798fd97
MD
835 # Make sure we only generate libraries of the form `libNAME.la'.
836 case "$output" in
837 lib*) ;;
838 *)
839 $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
840 $echo "$help" 1>&2
841 exit 1
842 ;;
843 esac
844
845 name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
846 eval libname=\"$libname_spec\"
a7a8349d 847
4cdcd100
JB
848 # All the library-specific variables (install_libdir is set above).
849 library_names=
850 old_library=
851 dlname=
852 current=0
853 revision=0
854 age=0
855
a7a8349d 856 if test -n "$objs"; then
5798fd97 857 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
553f653a 858 exit 1
a7a8349d
MV
859 fi
860
861 # How the heck are we supposed to write a wrapper for a shared library?
862 if test -n "$link_against_libtool_libs"; then
5798fd97 863 $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
553f653a
JB
864 exit 1
865 fi
866
867 if test -n "$dlfiles$dlprefiles"; then
5798fd97 868 $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
553f653a 869 # Nullify the symbol file.
5798fd97
MD
870 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
871 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
a7a8349d
MV
872 fi
873
476f3c84 874 if test -z "$rpath"; then
5798fd97 875 $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
476f3c84 876 $echo "$help" 1>&2
553f653a 877 exit 1
a7a8349d
MV
878 fi
879
476f3c84
MD
880 set dummy $rpath
881 if test $# -gt 2; then
5798fd97 882 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
476f3c84
MD
883 fi
884 install_libdir="$2"
885
2c9a3a48
JB
886 # Parse the version information argument.
887 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
888 set dummy $vinfo
889 IFS="$save_ifs"
a7a8349d 890
2c9a3a48
JB
891 if test -n "$5"; then
892 $echo "$modename: too many parameters to \`-version-info'" 1>&2
893 $echo "$help" 1>&2
894 exit 1
895 fi
553f653a 896
2c9a3a48
JB
897 test -n "$2" && current="$2"
898 test -n "$3" && revision="$3"
899 test -n "$4" && age="$4"
a7a8349d 900
2c9a3a48
JB
901 # Check that each of the things are valid numbers.
902 case "$current" in
903 0 | [1-9] | [1-9][0-9]*) ;;
904 *)
905 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
906 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
907 exit 1
908 ;;
909 esac
a7a8349d 910
2c9a3a48
JB
911 case "$revision" in
912 0 | [1-9] | [1-9][0-9]*) ;;
913 *)
914 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
915 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
916 exit 1
917 ;;
918 esac
c789ad32 919
2c9a3a48
JB
920 case "$age" in
921 0 | [1-9] | [1-9][0-9]*) ;;
922 *)
923 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
924 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
925 exit 1
926 ;;
927 esac
c789ad32 928
2c9a3a48
JB
929 if test $age -gt $current; then
930 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
931 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
932 exit 1
933 fi
c789ad32 934
2c9a3a48
JB
935 # Calculate the version variables.
936 version_vars="version_type current age revision"
937 case "$version_type" in
938 none) ;;
c789ad32 939
2c9a3a48
JB
940 linux)
941 version_vars="$version_vars major versuffix"
942 major=`expr $current - $age`
943 versuffix="$major.$age.$revision"
944 ;;
c789ad32 945
2c9a3a48
JB
946 osf)
947 version_vars="$version_vars versuffix verstring"
948 major=`expr $current - $age`
949 versuffix="$current.$age.$revision"
950 verstring="$versuffix"
951
952 # Add in all the interfaces that we are compatible with.
953 loop=$age
954 while test $loop != 0; do
955 iface=`expr $current - $loop`
956 loop=`expr $loop - 1`
957 verstring="$verstring:${iface}.0"
958 done
c789ad32 959
2c9a3a48
JB
960 # Make executables depend on our current version.
961 verstring="$verstring:${current}.0"
962 ;;
c789ad32 963
2c9a3a48
JB
964 sunos)
965 version_vars="$version_vars major versuffix"
966 major="$current"
967 versuffix="$current.$revision"
968 ;;
c789ad32 969
2c9a3a48
JB
970 *)
971 $echo "$modename: unknown library version type \`$version_type'" 1>&2
972 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
973 exit 1
974 ;;
975 esac
a7a8349d 976
a7a8349d
MV
977 # Create the output directory, or remove our outputs if we need to.
978 if test -d $objdir; then
5798fd97
MD
979 $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
980 $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
a7a8349d
MV
981 else
982 $show "$mkdir $objdir"
5798fd97
MD
983 $run $mkdir $objdir
984 status=$?
985 if test $status -eq 0 || test -d $objdir; then :
986 else
987 exit $status
988 fi
a7a8349d
MV
989 fi
990
393e4e4d
JB
991 # Check to see if the archive will have undefined symbols.
992 if test "$allow_undefined" = yes; then
553f653a 993 if test "$allow_undefined_flag" = unsupported; then
5798fd97 994 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
553f653a
JB
995 build_libtool_libs=no
996 build_old_libs=yes
997 fi
393e4e4d 998 else
5798fd97
MD
999 # Don't allow undefined symbols.
1000 allow_undefined_flag="$no_undefined_flag"
393e4e4d
JB
1001 fi
1002
5798fd97
MD
1003 # Add libc to deplibs on all systems.
1004 dependency_libs="$deplibs"
1005 deplibs="$deplibs -lc"
1006
a7a8349d 1007 if test "$build_libtool_libs" = yes; then
553f653a 1008 # Get the real and link names of the library.
5798fd97 1009 eval library_names=\"$library_names_spec\"
553f653a
JB
1010 set dummy $library_names
1011 realname="$2"
1012 shift; shift
1013
1014 if test -n "$soname_spec"; then
5798fd97 1015 eval soname=\"$soname_spec\"
553f653a
JB
1016 else
1017 soname="$realname"
1018 fi
a7a8349d 1019
553f653a 1020 lib="$objdir/$realname"
5798fd97
MD
1021 for link
1022 do
1023 linknames="$linknames $link"
1024 done
553f653a
JB
1025
1026 # Use standard objects if they are PIC.
2c9a3a48 1027 test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
553f653a
JB
1028
1029 # Do each of the archive commands.
5798fd97 1030 eval cmds=\"$archive_cmds\"
553f653a
JB
1031 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1032 for cmd in $cmds; do
1033 IFS="$save_ifs"
1034 $show "$cmd"
1035 $run eval "$cmd" || exit $?
1036 done
1037 IFS="$save_ifs"
1038
1039 # Create links to the real library.
5798fd97 1040 for linkname in $linknames; do
2c9a3a48
JB
1041 $show "(cd $objdir && $LN_S $realname $linkname)"
1042 $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
553f653a
JB
1043 done
1044
1045 # If -export-dynamic was specified, set the dlname.
1046 if test "$export_dynamic" = yes; then
1047 # On all known operating systems, these are identical.
1048 dlname="$soname"
1049 fi
a7a8349d 1050 fi
5798fd97
MD
1051
1052 # Now set the variables for building old libraries.
2c9a3a48 1053 oldlib="$objdir/$libname.a"
a7a8349d
MV
1054 ;;
1055
2c9a3a48 1056 *.lo | *.o)
a7a8349d 1057 if test -n "$link_against_libtool_libs"; then
5798fd97 1058 $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
553f653a 1059 exit 1
a7a8349d
MV
1060 fi
1061
1062 if test -n "$deplibs"; then
5798fd97 1063 $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
553f653a
JB
1064 fi
1065
1066 if test -n "$dlfiles$dlprefiles"; then
5798fd97 1067 $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
553f653a 1068 # Nullify the symbol file.
5798fd97
MD
1069 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1070 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
a7a8349d
MV
1071 fi
1072
476f3c84 1073 if test -n "$rpath"; then
5798fd97 1074 $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
a7a8349d
MV
1075 fi
1076
1077 if test -n "$vinfo"; then
5798fd97
MD
1078 $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
1079 fi
1080
1081 if test -n "$release"; then
1082 $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
a7a8349d
MV
1083 fi
1084
1085 case "$output" in
1086 *.lo)
553f653a 1087 if test -n "$objs"; then
5798fd97 1088 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
553f653a
JB
1089 exit 1
1090 fi
1091 libobj="$output"
2c9a3a48 1092 obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
553f653a 1093 ;;
a7a8349d
MV
1094 *)
1095 libobj=
553f653a
JB
1096 obj="$output"
1097 ;;
a7a8349d
MV
1098 esac
1099
1100 # Delete the old objects.
1101 $run $rm $obj $libobj
1102
393e4e4d 1103 # Create the old-style object.
2c9a3a48 1104 reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
a7a8349d
MV
1105
1106 output="$obj"
5798fd97 1107 eval cmds=\"$reload_cmds\"
a7a8349d
MV
1108 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1109 for cmd in $cmds; do
1110 IFS="$save_ifs"
1111 $show "$cmd"
553f653a 1112 $run eval "$cmd" || exit $?
a7a8349d
MV
1113 done
1114 IFS="$save_ifs"
1115
1116 # Exit if we aren't doing a library object file.
1117 test -z "$libobj" && exit 0
1118
a6a5a664
JB
1119 if test "$build_libtool_libs" != yes; then
1120 # Create an invalid libtool object if no PIC, so that we don't
1121 # accidentally link it into a program.
5798fd97
MD
1122 $show "echo timestamp > $libobj"
1123 $run eval "echo timestamp > $libobj" || exit $?
553f653a 1124 exit 0
a6a5a664
JB
1125 fi
1126
1127 if test -n "$pic_flag"; then
553f653a
JB
1128 # Only do commands if we really have different PIC objects.
1129 reload_objs="$libobjs"
1130 output="$libobj"
5798fd97 1131 eval cmds=\"$reload_cmds\"
a7a8349d
MV
1132 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1133 for cmd in $cmds; do
1134 IFS="$save_ifs"
1135 $show "$cmd"
553f653a 1136 $run eval "$cmd" || exit $?
a7a8349d
MV
1137 done
1138 IFS="$save_ifs"
1139 else
1140 # Just create a symlink.
553f653a
JB
1141 $show "$LN_S $obj $libobj"
1142 $run $LN_S $obj $libobj || exit 1
a7a8349d
MV
1143 fi
1144
1145 exit 0
1146 ;;
1147
1148 *)
a7a8349d 1149 if test -n "$vinfo"; then
5798fd97
MD
1150 $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
1151 fi
1152
1153 if test -n "$release"; then
1154 $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
a7a8349d
MV
1155 fi
1156
476f3c84
MD
1157 if test -n "$rpath"; then
1158 # If the user specified any rpath flags, then add them.
1159 for libdir in $rpath; do
1160 if test -n "$hardcode_libdir_flag_spec"; then
1161 if test -n "$hardcode_libdir_separator"; then
1162 if test -z "$hardcode_libdirs"; then
1163 # Put the magic libdir with the hardcode flag.
1164 hardcode_libdirs="$libdir"
1165 libdir="@HARDCODE_LIBDIRS@"
1166 else
93ad5c88
JB
1167 # Just accumulate the unique libdirs.
1168 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
1169 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
1170 ;;
1171 *)
1172 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
1173 ;;
1174 esac
476f3c84
MD
1175 libdir=
1176 fi
1177 fi
1178
1179 if test -n "$libdir"; then
5798fd97 1180 eval flag=\"$hardcode_libdir_flag_spec\"
476f3c84
MD
1181
1182 compile_command="$compile_command $flag"
1183 finalize_command="$finalize_command $flag"
1184 fi
5798fd97 1185 elif test -n "$runpath_var"; then
476f3c84 1186 case "$perm_rpath " in
93ad5c88 1187 *" $libdir "*) ;;
476f3c84
MD
1188 *) perm_rpath="$perm_rpath $libdir" ;;
1189 esac
1190 fi
1191 done
1192 fi
1193
1194 # Substitute the hardcoded libdirs into the compile commands.
1195 if test -n "$hardcode_libdir_separator"; then
5798fd97
MD
1196 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
1197 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
476f3c84
MD
1198 fi
1199
1200 if test -n "$libobjs" && test "$build_old_libs" = yes; then
553f653a 1201 # Transform all the library objects into standard objects.
2c9a3a48
JB
1202 compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
1203 finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
553f653a
JB
1204 fi
1205
5798fd97
MD
1206 if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
1207 dlsyms="${output}S.c"
1208 else
1209 dlsyms=
1210 fi
553f653a 1211
5798fd97
MD
1212 if test -n "$dlsyms"; then
1213 # Add our own program objects to the preloaded list.
2c9a3a48 1214 dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
93ad5c88 1215
5798fd97 1216 # Discover the nlist of each of the dlfiles.
553f653a
JB
1217 nlist="$objdir/${output}.nm"
1218
93ad5c88 1219 if test -d $objdir; then
5798fd97
MD
1220 $show "$rm $nlist ${nlist}T"
1221 $run $rm "$nlist" "${nlist}T"
93ad5c88
JB
1222 else
1223 $show "$mkdir $objdir"
5798fd97
MD
1224 $run $mkdir $objdir
1225 status=$?
1226 if test $status -eq 0 || test -d $objdir; then :
1227 else
1228 exit $status
1229 fi
93ad5c88
JB
1230 fi
1231
553f653a 1232 for arg in $dlprefiles; do
5798fd97
MD
1233 $show "extracting global C symbols from \`$arg'"
1234 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
553f653a
JB
1235 done
1236
93ad5c88
JB
1237 # Parse the name list into a source file.
1238 $show "creating $objdir/$dlsyms"
553f653a 1239 if test -z "$run"; then
93ad5c88
JB
1240 # Make sure we at least have an empty file.
1241 test -f "$nlist" || : > "$nlist"
1242
553f653a
JB
1243 # Try sorting and uniquifying the output.
1244 if sort "$nlist" | uniq > "$nlist"T; then
1245 mv -f "$nlist"T "$nlist"
1246 wcout=`wc "$nlist" 2>/dev/null`
5798fd97 1247 count=`echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
93ad5c88 1248 (test "$count" -ge 0) 2>/dev/null || count=-1
553f653a 1249 else
5798fd97 1250 $rm "$nlist"T
553f653a
JB
1251 count=-1
1252 fi
1253
93ad5c88
JB
1254 case "$dlsyms" in
1255 "") ;;
1256 *.c)
5798fd97 1257 $echo > "$objdir/$dlsyms" "\
553f653a
JB
1258/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
1259/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
1260
93ad5c88 1261#ifdef __cplusplus
5798fd97 1262extern \"C\" {
93ad5c88
JB
1263#endif
1264
1265/* Prevent the only kind of declaration conflicts we can make. */
553f653a
JB
1266#define dld_preloaded_symbol_count some_other_symbol
1267#define dld_preloaded_symbols some_other_symbol
1268
5798fd97
MD
1269/* External symbol declarations for the compiler. */\
1270"
1271
93ad5c88
JB
1272 if test -f "$nlist"; then
1273 sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
1274 else
5798fd97 1275 echo '/* NONE */' >> "$objdir/$dlsyms"
93ad5c88 1276 fi
553f653a 1277
5798fd97 1278 $echo >> "$objdir/$dlsyms" "\
553f653a
JB
1279
1280#undef dld_preloaded_symbol_count
1281#undef dld_preloaded_symbols
1282
1283#if defined (__STDC__) && __STDC__
1284# define __ptr_t void *
1285#else
1286# define __ptr_t char *
1287#endif
1288
1289/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
1290int dld_preloaded_symbol_count = $count;
1291
1292/* The mapping between symbol names and symbols. */
1293struct {
1294 char *name;
1295 __ptr_t address;
1296}
1297dld_preloaded_symbols[] =
5798fd97
MD
1298{\
1299"
553f653a 1300
93ad5c88 1301 if test -f "$nlist"; then
5798fd97 1302 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
93ad5c88 1303 fi
553f653a 1304
5798fd97
MD
1305 $echo >> "$objdir/$dlsyms" "\
1306 {0, (__ptr_t) 0}
553f653a 1307};
93ad5c88
JB
1308
1309#ifdef __cplusplus
1310}
5798fd97
MD
1311#endif\
1312"
93ad5c88
JB
1313 ;;
1314
1315 *)
5798fd97 1316 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
93ad5c88
JB
1317 exit 1
1318 ;;
1319 esac
553f653a 1320 fi
553f653a
JB
1321
1322 # Now compile the dynamic symbol file.
93ad5c88
JB
1323 $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
1324 $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
553f653a
JB
1325
1326 # Transform the symbol file into the correct name.
2c9a3a48
JB
1327 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
1328 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
553f653a 1329 elif test "$export_dynamic" != yes; then
5798fd97 1330 test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
553f653a
JB
1331 else
1332 # We keep going just in case the user didn't refer to
1333 # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
1334 # really was required.
5798fd97 1335 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
553f653a
JB
1336
1337 # Nullify the symbol file.
5798fd97
MD
1338 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1339 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
a7a8349d
MV
1340 fi
1341
1342 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
553f653a 1343 # Replace the output file specification.
5798fd97
MD
1344 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1345 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
553f653a
JB
1346
1347 # We have no uninstalled library dependencies, so finalize right now.
1348 $show "$compile_command"
1349 $run eval "$compile_command"
476f3c84 1350 exit $?
a7a8349d
MV
1351 fi
1352
4cdcd100 1353 # Replace the output file specification.
5798fd97
MD
1354 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
1355 finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
4cdcd100 1356
a7a8349d
MV
1357 # Create the binary in the object directory, then wrap it.
1358 if test -d $objdir; then :
1359 else
1360 $show "$mkdir $objdir"
5798fd97
MD
1361 $run $mkdir $objdir
1362 status=$?
1363 if test $status -eq 0 || test -d $objdir; then :
1364 else
1365 exit $status
1366 fi
a7a8349d
MV
1367 fi
1368
1369 if test -n "$shlibpath_var"; then
1370 # We should set the shlibpath_var
553f653a
JB
1371 rpath=
1372 for dir in $temp_rpath; do
1373 case "$dir" in
5798fd97 1374 /* | [A-Za-z]:\\*)
553f653a
JB
1375 # Absolute path.
1376 rpath="$rpath$dir:"
1377 ;;
1378 *)
1379 # Relative path: add a thisdir entry.
1380 rpath="$rpath\$thisdir/$dir:"
1381 ;;
1382 esac
1383 done
1384 temp_rpath="$rpath"
a7a8349d
MV
1385 fi
1386
1387 # Delete the old output file.
1388 $run $rm $output
1389
96abf47d 1390 if test -n "$compile_shlibpath"; then
553f653a 1391 compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
96abf47d
MD
1392 fi
1393 if test -n "$finalize_shlibpath"; then
553f653a 1394 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
393e4e4d
JB
1395 fi
1396
5798fd97 1397 if test -n "$runpath_var" && test -n "$perm_rpath"; then
553f653a
JB
1398 # We should set the runpath_var.
1399 rpath=
1400 for dir in $perm_rpath; do
1401 rpath="$rpath$dir:"
1402 done
1403 compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
1404 finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
96abf47d 1405 fi
a7a8349d 1406
2c9a3a48
JB
1407 case "$hardcode_action" in
1408 relink)
553f653a 1409 # AGH! Flame the AIX and HP-UX people for me, will ya?
5798fd97
MD
1410 $echo "$modename: warning: using a buggy system linker" 1>&2
1411 $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
2c9a3a48
JB
1412 ;;
1413 esac
a7a8349d 1414
96abf47d 1415 $show "$compile_command"
553f653a 1416 $run eval "$compile_command" || exit $?
a7a8349d
MV
1417
1418 # Now create the wrapper script.
93ad5c88 1419 $show "creating $output"
553f653a
JB
1420
1421 # Quote the finalize command for shipping.
5798fd97
MD
1422 finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
1423
1424 # Quote $echo for shipping.
1425 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
a7a8349d
MV
1426
1427 # Only actually do things if our run command is non-null.
1428 if test -z "$run"; then
553f653a
JB
1429 $rm $output
1430 trap "$rm $output; exit 1" 1 2 15
a7a8349d 1431
5798fd97 1432 $echo > $output "\
2c9a3a48 1433#! /bin/sh
a7a8349d
MV
1434
1435# $output - temporary wrapper script for $objdir/$output
2c9a3a48 1436# Generated by ltmain.sh - GNU $PACKAGE $VERSION
a7a8349d
MV
1437#
1438# The $output program cannot be directly executed until all the libtool
1439# libraries that it depends on are installed.
1440#
1441# This wrapper script should never be moved out of \``pwd`'.
1442# If it is, it will not operate correctly.
1443
5798fd97
MD
1444# Sed substitution that helps us do robust quoting. It backslashifies
1445# metacharacters that are still active within double-quoted strings.
1446Xsed='sed -e s/^X//'
1447sed_quote_subst='$sed_quote_subst'
1448
1449# The HP-UX ksh and POSIX shell print the target directory to stdout
1450# if CDPATH is set.
1451if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
1452
a7a8349d 1453# This environment variable determines our operation mode.
5798fd97 1454if test \"\$libtool_install_magic\" = \"$magic\"; then
a7a8349d 1455 # install mode needs the following variables:
393e4e4d 1456 link_against_libtool_libs='$link_against_libtool_libs'
5798fd97 1457 finalize_command=\"$finalize_command\"
a7a8349d 1458else
476f3c84 1459 # When we are sourced in execute mode, \$file and \$echo are already set.
5798fd97 1460 if test \"\$libtool_execute_magic\" = \"$magic\"; then :
476f3c84 1461 else
5798fd97
MD
1462 echo=\"$qecho\"
1463 file=\"\$0\"
1464 fi\
1465"
1466 $echo >> $output "\
553f653a 1467
a7a8349d 1468 # Find the directory that this script lives in.
5798fd97
MD
1469 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
1470 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
a7a8349d 1471
93ad5c88 1472 # Follow symbolic links until we get to the real thisdir.
5798fd97
MD
1473 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
1474 while test -n \"\$file\"; do
1475 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
93ad5c88
JB
1476
1477 # If there was a directory component, then change thisdir.
5798fd97
MD
1478 if test \"x\$destdir\" != \"x\$file\"; then
1479 case \"\$destdir\" in
1480 /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;;
1481 *) thisdir=\"\$thisdir/\$destdir\" ;;
93ad5c88
JB
1482 esac
1483 fi
1484
5798fd97
MD
1485 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
1486 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
93ad5c88
JB
1487 done
1488
a7a8349d 1489 # Try to get the absolute directory name.
5798fd97
MD
1490 absdir=\`cd \"\$thisdir\" && pwd\`
1491 test -n \"\$absdir\" && thisdir=\"\$absdir\"
a7a8349d 1492
5798fd97 1493 progdir=\"\$thisdir/$objdir\"
553f653a 1494 program='$output'
96abf47d 1495
5798fd97 1496 if test -f \"\$progdir/\$program\"; then"
a7a8349d 1497
553f653a
JB
1498 # Export our shlibpath_var if we have one.
1499 if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5798fd97 1500 $echo >> $output "\
96abf47d 1501 # Add our own library path to $shlibpath_var
5798fd97 1502 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
553f653a 1503
ec918b9b 1504 # Some systems cannot cope with colon-terminated $shlibpath_var
5798fd97 1505 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
ec918b9b 1506
96abf47d 1507 export $shlibpath_var
5798fd97 1508"
553f653a 1509 fi
a7a8349d 1510
5798fd97
MD
1511 $echo >> $output "\
1512 if test \"\$libtool_execute_magic\" != \"$magic\"; then
553f653a 1513 # Run the actual program with our arguments.
a7a8349d 1514
553f653a 1515 # Export the path to the program.
5798fd97 1516 PATH=\"\$progdir:\$PATH\"
553f653a 1517 export PATH
a7a8349d 1518
5798fd97 1519 exec \$program \${1+\"\$@\"}
553f653a 1520
5798fd97 1521 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
553f653a
JB
1522 exit 1
1523 fi
a7a8349d
MV
1524 else
1525 # The program doesn't exist.
5798fd97
MD
1526 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
1527 \$echo \"This script is just a wrapper for \$program.\" 1>&2
1528 echo \"See the $PACKAGE documentation for more information.\" 1>&2
a7a8349d
MV
1529 exit 1
1530 fi
5798fd97
MD
1531fi\
1532"
553f653a 1533 chmod +x $output
a7a8349d
MV
1534 fi
1535 exit 0
1536 ;;
1537 esac
1538
a7a8349d
MV
1539 # See if we need to build an old-fashioned archive.
1540 if test "$build_old_libs" = "yes"; then
393e4e4d 1541 # Transform .lo files to .o files.
2c9a3a48 1542 oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
a7a8349d
MV
1543
1544 # Do each command in the archive commands.
93ad5c88 1545 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5798fd97 1546 eval cmds=\"$old_archive_from_new_cmds\"
93ad5c88 1547 else
5798fd97 1548 eval cmds=\"$old_archive_cmds\"
93ad5c88 1549 fi
a7a8349d
MV
1550 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1551 for cmd in $cmds; do
1552 IFS="$save_ifs"
1553 $show "$cmd"
553f653a 1554 $run eval "$cmd" || exit $?
a7a8349d
MV
1555 done
1556 IFS="$save_ifs"
1557 fi
1558
1559 # Now create the libtool archive.
1560 case "$output" in
1561 *.la)
1562 old_library=
2c9a3a48 1563 test "$build_old_libs" = yes && old_library="$libname.a"
a7a8349d 1564
93ad5c88 1565 $show "creating $output"
a7a8349d
MV
1566
1567 # Only create the output if not a dry run.
1568 if test -z "$run"; then
5798fd97 1569 $echo > $output "\
a7a8349d 1570# $output - a libtool library file
2c9a3a48 1571# Generated by ltmain.sh - GNU $PACKAGE $VERSION
a7a8349d 1572
393e4e4d
JB
1573# The name that we can dlopen(3).
1574dlname='$dlname'
1575
a7a8349d
MV
1576# Names of this library.
1577library_names='$library_names'
1578
1579# The name of the static archive.
1580old_library='$old_library'
1581
5798fd97
MD
1582# Libraries that this one depends upon.
1583dependency_libs='$dependency_libs'
1584
a7a8349d
MV
1585# Version information for $libname.
1586current=$current
1587age=$age
1588revision=$revision
1589
1590# Directory that this library needs to be installed in:
5798fd97
MD
1591libdir='$install_libdir'\
1592"
a7a8349d 1593 fi
393e4e4d
JB
1594
1595 # Do a symbolic link so that the libtool archive can be found in
1596 # LD_LIBRARY_PATH before the program is installed.
553f653a
JB
1597 $show "(cd $objdir && $LN_S ../$output $output)"
1598 $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
a7a8349d
MV
1599 ;;
1600 esac
1601 exit 0
1602 ;;
1603
1604 # libtool install mode
1605 install)
5798fd97 1606 modename="$modename: install"
a7a8349d 1607
2c9a3a48 1608 # There may be an optional /bin/sh argument at the beginning of
93ad5c88
JB
1609 # install_prog (especially on Windows NT).
1610 if test "$nonopt" = "$SHELL"; then
1611 # Aesthetically quote it.
5798fd97 1612 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
93ad5c88
JB
1613 case "$arg" in
1614 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1615 arg="\"$arg\""
1616 ;;
1617 esac
1618 install_prog="$arg "
1619 arg="$1"
1620 shift
1621 else
1622 install_prog=
1623 arg="$nonopt"
1624 fi
1625
1626 # The real first argument should be the name of the installation program.
553f653a 1627 # Aesthetically quote it.
5798fd97 1628 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
553f653a
JB
1629 case "$arg" in
1630 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1631 arg="\"$arg\""
1632 ;;
1633 esac
93ad5c88 1634 install_prog="$install_prog$arg"
a7a8349d
MV
1635
1636 # We need to accept at least all the BSD install flags.
1637 dest=
1638 files=
1639 opts=
1640 prev=
1641 install_type=
2c9a3a48 1642 isdir=
a7a8349d
MV
1643 stripme=
1644 for arg
1645 do
1646 if test -n "$dest"; then
1647 files="$files $dest"
553f653a
JB
1648 dest="$arg"
1649 continue
a7a8349d
MV
1650 fi
1651
1652 case "$arg" in
1653 -d) isdir=yes ;;
1654 -f) prev="-f" ;;
1655 -g) prev="-g" ;;
1656 -m) prev="-m" ;;
1657 -o) prev="-o" ;;
1658 -s)
553f653a
JB
1659 stripme=" -s"
1660 continue
1661 ;;
a7a8349d
MV
1662 -*) ;;
1663
1664 *)
553f653a
JB
1665 # If the previous option needed an argument, then skip it.
1666 if test -n "$prev"; then
1667 prev=
1668 else
1669 dest="$arg"
1670 continue
1671 fi
a7a8349d
MV
1672 ;;
1673 esac
553f653a
JB
1674
1675 # Aesthetically quote the argument.
5798fd97 1676 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
553f653a
JB
1677 case "$arg" in
1678 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1679 arg="\"$arg\""
1680 ;;
1681 esac
a7a8349d
MV
1682 install_prog="$install_prog $arg"
1683 done
1684
1685 if test -z "$install_prog"; then
5798fd97 1686 $echo "$modename: you must specify an install program" 1>&2
553f653a 1687 $echo "$help" 1>&2
a7a8349d
MV
1688 exit 1
1689 fi
1690
1691 if test -n "$prev"; then
5798fd97 1692 $echo "$modename: the \`$prev' option requires an argument" 1>&2
553f653a 1693 $echo "$help" 1>&2
a7a8349d
MV
1694 exit 1
1695 fi
1696
1697 if test -z "$files"; then
1698 if test -z "$dest"; then
5798fd97 1699 $echo "$modename: no file or destination specified" 1>&2
a7a8349d 1700 else
5798fd97 1701 $echo "$modename: you must specify a destination" 1>&2
a7a8349d 1702 fi
553f653a 1703 $echo "$help" 1>&2
a7a8349d
MV
1704 exit 1
1705 fi
1706
1707 # Strip any trailing slash from the destination.
5798fd97 1708 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
a7a8349d
MV
1709
1710 # Check to see that the destination is a directory.
1711 test -d "$dest" && isdir=yes
2c9a3a48 1712 if test -n "$isdir"; then
a7a8349d 1713 destdir="$dest"
a6a5a664 1714 destname=
a7a8349d 1715 else
5798fd97 1716 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
553f653a 1717 test "X$destdir" = "X$dest" && destdir=.
5798fd97 1718 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
a6a5a664
JB
1719
1720 # Not a directory, so check to see that there is only one file specified.
1721 set dummy $files
780b12da 1722 if test $# -gt 2; then
5798fd97 1723 $echo "$modename: \`$dest' is not a directory" 1>&2
553f653a
JB
1724 $echo "$help" 1>&2
1725 exit 1
a6a5a664 1726 fi
a7a8349d
MV
1727 fi
1728 case "$destdir" in
5798fd97 1729 /* | [A-Za-z]:\\*) ;;
a7a8349d 1730 *)
a6a5a664 1731 for file in $files; do
553f653a
JB
1732 case "$file" in
1733 *.lo) ;;
1734 *)
5798fd97 1735 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
553f653a
JB
1736 $echo "$help" 1>&2
1737 exit 1
1738 ;;
1739 esac
a6a5a664
JB
1740 done
1741 ;;
a7a8349d
MV
1742 esac
1743
553f653a
JB
1744 # This variable tells wrapper scripts just to set variables rather
1745 # than running their programs.
1746 libtool_install_magic="$magic"
1747
a7a8349d
MV
1748 staticlibs=
1749 future_libdirs=
1750 current_libdirs=
1751 for file in $files; do
1752
1753 # Do each installation.
1754 case "$file" in
2c9a3a48 1755 *.a)
553f653a
JB
1756 # Do the static libraries later.
1757 staticlibs="$staticlibs $file"
1758 ;;
a7a8349d
MV
1759
1760 *.la)
553f653a 1761 # Check to see that this really is a libtool archive.
2c9a3a48 1762 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
553f653a 1763 else
5798fd97 1764 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
553f653a
JB
1765 $echo "$help" 1>&2
1766 exit 1
1767 fi
a7a8349d 1768
553f653a
JB
1769 library_names=
1770 old_library=
1771 # If there is no directory component, then add one.
1772 case "$file" in
5798fd97 1773 */* | *\\*) . $file ;;
553f653a
JB
1774 *) . ./$file ;;
1775 esac
1776
1777 # Add the libdir to current_libdirs if it is the destination.
1778 if test "X$destdir" = "X$libdir"; then
1779 case "$current_libdirs " in
93ad5c88 1780 *" $libdir "*) ;;
553f653a
JB
1781 *) current_libdirs="$current_libdirs $libdir" ;;
1782 esac
1783 else
1784 # Note the libdir as a future libdir.
1785 case "$future_libdirs " in
93ad5c88 1786 *" $libdir "*) ;;
553f653a
JB
1787 *) future_libdirs="$future_libdirs $libdir" ;;
1788 esac
1789 fi
a7a8349d 1790
5798fd97 1791 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
553f653a
JB
1792 test "X$dir" = "X$file/" && dir=
1793 dir="$dir$objdir"
1794
1795 # See the names of the shared library.
1796 set dummy $library_names
1797 if test -n "$2"; then
1798 realname="$2"
1799 shift
1800 shift
1801
1802 # Install the shared library and build the symlinks.
1803 $show "$install_prog $dir/$realname $destdir/$realname"
1804 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
1805 test "X$dlname" = "X$realname" && dlname=
1806
553f653a
JB
1807 if test $# -gt 0; then
1808 # Delete the old symlinks.
a7a8349d
MV
1809 rmcmd="$rm"
1810 for linkname
1811 do
1812 rmcmd="$rmcmd $destdir/$linkname"
1813 done
1814 $show "$rmcmd"
1815 $run $rmcmd
1816
553f653a
JB
1817 # ... and create new ones.
1818 for linkname
1819 do
1820 test "X$dlname" = "X$linkname" && dlname=
1821 $show "(cd $destdir && $LN_S $realname $linkname)"
1822 $run eval "(cd $destdir && $LN_S $realname $linkname)"
1823 done
1824 fi
1825
1826 if test -n "$dlname"; then
1827 # Install the dynamically-loadable library.
1828 $show "$install_prog $dir/$dlname $destdir/$dlname"
1829 $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
1830 fi
1831
1832 # Do each command in the postinstall commands.
1833 lib="$destdir/$realname"
5798fd97 1834 eval cmds=\"$postinstall_cmds\"
553f653a
JB
1835 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1836 for cmd in $cmds; do
1837 IFS="$save_ifs"
1838 $show "$cmd"
1839 $run eval "$cmd" || exit $?
1840 done
1841 IFS="$save_ifs"
1842 fi
a7a8349d 1843
553f653a 1844 # Install the pseudo-library for information purposes.
5798fd97 1845 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
553f653a
JB
1846 $show "$install_prog $file $destdir/$name"
1847 $run eval "$install_prog $file $destdir/$name" || exit $?
a7a8349d 1848
553f653a
JB
1849 # Maybe install the static library, too.
1850 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1851 ;;
a7a8349d 1852
a6a5a664
JB
1853 *.lo)
1854 # Install (i.e. copy) a libtool object.
1855
1856 # Figure out destination file name, if it wasn't already specified.
1857 if test -n "$destname"; then
553f653a
JB
1858 destfile="$destdir/$destname"
1859 else
5798fd97 1860 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
553f653a 1861 destfile="$destdir/$destfile"
a6a5a664
JB
1862 fi
1863
553f653a
JB
1864 # Deduce the name of the destination old-style object file.
1865 case "$destfile" in
1866 *.lo)
2c9a3a48 1867 staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'`
a6a5a664 1868 ;;
2c9a3a48 1869 *.o)
553f653a
JB
1870 staticdest="$destfile"
1871 destfile=
1872 ;;
1873 *)
5798fd97 1874 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
553f653a
JB
1875 $echo "$help" 1>&2
1876 exit 1
1877 ;;
1878 esac
a6a5a664 1879
553f653a
JB
1880 # Install the libtool object if requested.
1881 if test -n "$destfile"; then
1882 $show "$install_prog $file $destfile"
1883 $run eval "$install_prog $file $destfile" || exit $?
1884 fi
a6a5a664 1885
553f653a
JB
1886 # Install the old object if enabled.
1887 if test "$build_old_libs" = yes; then
1888 # Deduce the name of the old-style object file.
2c9a3a48 1889 staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'`
a6a5a664 1890
553f653a
JB
1891 $show "$install_prog $staticobj $staticdest"
1892 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
1893 fi
1894 exit 0
1895 ;;
a6a5a664 1896
a7a8349d 1897 *)
553f653a 1898 # Do a test to see if this is really a libtool program.
2c9a3a48 1899 if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
553f653a
JB
1900 link_against_libtool_libs=
1901 finalize_command=
1902
1903 # If there is no directory component, then add one.
1904 case "$file" in
5798fd97 1905 */* | *\\*) . $file ;;
553f653a
JB
1906 *) . ./$file ;;
1907 esac
1908
1909 # Check the variables that should have been set.
1910 if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
5798fd97 1911 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
553f653a
JB
1912 exit 1
1913 fi
1914
1915 finalize=yes
1916 for lib in $link_against_libtool_libs; do
1917 # Check to see that each library is installed.
1918 libdir=
1919 if test -f "$lib"; then
1920 # If there is no directory component, then add one.
1921 case "$lib" in
5798fd97 1922 */* | *\\*) . $lib ;;
553f653a
JB
1923 *) . ./$lib ;;
1924 esac
1925 fi
5798fd97 1926 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
553f653a 1927 if test -z "$libdir"; then
5798fd97 1928 $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2
553f653a
JB
1929 elif test -f "$libfile"; then :
1930 else
5798fd97 1931 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
553f653a
JB
1932 finalize=no
1933 fi
1934 done
1935
1936 if test "$hardcode_action" = relink; then
1937 if test "$finalize" = yes; then
5798fd97 1938 $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
553f653a
JB
1939 $show "$finalize_command"
1940 if $run eval "$finalize_command"; then :
1941 else
5798fd97 1942 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
553f653a
JB
1943 continue
1944 fi
1945 file="$objdir/$file"T
1946 else
5798fd97 1947 $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
553f653a
JB
1948 fi
1949 else
1950 # Install the binary that we compiled earlier.
5798fd97 1951 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
553f653a
JB
1952 fi
1953 fi
a7a8349d 1954
2c9a3a48
JB
1955 $show "$install_prog$stripme $file $dest"
1956 $run eval "$install_prog\$stripme \$file \$dest" || exit $?
553f653a 1957 ;;
a7a8349d
MV
1958 esac
1959 done
96abf47d 1960
a7a8349d 1961 for file in $staticlibs; do
5798fd97 1962 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
a7a8349d
MV
1963
1964 # Set up the ranlib parameters.
1965 oldlib="$destdir/$name"
1966
1967 $show "$install_prog $file $oldlib"
553f653a 1968 $run eval "$install_prog \$file \$oldlib" || exit $?
a7a8349d 1969
a7a8349d 1970 # Do each command in the postinstall commands.
5798fd97 1971 eval cmds=\"$old_postinstall_cmds\"
a7a8349d
MV
1972 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
1973 for cmd in $cmds; do
1974 IFS="$save_ifs"
1975 $show "$cmd"
553f653a 1976 $run eval "$cmd" || exit $?
a7a8349d
MV
1977 done
1978 IFS="$save_ifs"
1979 done
1980
1981 if test -n "$future_libdirs"; then
5798fd97 1982 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
a7a8349d
MV
1983 fi
1984
1985 if test -n "$current_libdirs"; then
1986 # Maybe just do a dry run.
1987 test -n "$run" && current_libdirs=" -n$current_libdirs"
93ad5c88 1988 exec $SHELL $0 --finish$current_libdirs
a7a8349d
MV
1989 exit 1
1990 fi
1991
1992 exit 0
1993 ;;
1994
1995 # libtool finish mode
1996 finish)
5798fd97 1997 modename="$modename: finish"
a7a8349d
MV
1998 libdirs="$nonopt"
1999
5798fd97 2000 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
a7a8349d
MV
2001 for dir
2002 do
553f653a 2003 libdirs="$libdirs $dir"
a7a8349d
MV
2004 done
2005
2006 for libdir in $libdirs; do
5798fd97
MD
2007 if test -n "$finish_cmds"; then
2008 # Do each command in the finish commands.
2009 eval cmds=\"$finish_cmds\"
2010 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2011 for cmd in $cmds; do
2012 IFS="$save_ifs"
2013 $show "$cmd"
2c9a3a48 2014 $run eval "$cmd"
5798fd97 2015 done
553f653a 2016 IFS="$save_ifs"
5798fd97
MD
2017 fi
2018 if test -n "$finish_eval"; then
2019 # Do the single finish_eval.
2020 eval cmds=\"$finish_eval\"
2c9a3a48 2021 $run eval "$cmds"
5798fd97 2022 fi
a7a8349d
MV
2023 done
2024 fi
2025
2c9a3a48 2026 echo "------------------------------------------------------------------------------"
5798fd97
MD
2027 echo "Libraries have been installed in:"
2028 for libdir in $libdirs; do
2029 echo " $libdir"
2030 done
2031 echo
2032 echo "To link against installed libraries in a given directory, LIBDIR,"
2033 echo "you must use the \`-LLIBDIR' flag during linking."
2034 echo
2c9a3a48 2035 echo " You will also need to do one of the following:"
a7a8349d 2036 if test -n "$shlibpath_var"; then
5798fd97
MD
2037 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
2038 echo " during execution"
2039 fi
2040 if test -n "$runpath_var"; then
2041 echo " - add LIBDIR to the \`$runpath_var' environment variable"
2042 echo " during linking"
2043 fi
2044 if test -n "$hardcode_libdir_flag_spec"; then
2045 libdir=LIBDIR
2046 eval flag=\"$hardcode_libdir_flag_spec\"
2047
2048 echo " - use the \`$flag' linker flag"
2049 fi
2050 if test -f /etc/ld.so.conf; then
2051 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
a7a8349d 2052 fi
5798fd97
MD
2053 echo
2054 echo "See any operating system documentation about shared libraries for"
2055 echo "more information, such as the ld(1) and ld.so(8) manual pages."
2c9a3a48 2056 echo "------------------------------------------------------------------------------"
a7a8349d
MV
2057 exit 0
2058 ;;
2059
553f653a
JB
2060 # libtool execute mode
2061 execute)
5798fd97 2062 modename="$modename: execute"
553f653a
JB
2063
2064 # The first argument is the command name.
2065 cmd="$nonopt"
2066 if test -z "$cmd"; then
5798fd97 2067 $echo "$modename: you must specify a COMMAND" 1>&2
553f653a
JB
2068 $echo "$help"
2069 exit 1
2070 fi
2071
2072 # Handle -dlopen flags immediately.
2073 for file in $execute_dlfiles; do
2074 if test -f "$file"; then :
2075 else
5798fd97 2076 $echo "$modename: \`$file' is not a file" 1>&2
553f653a
JB
2077 $echo "$help" 1>&2
2078 exit 1
2079 fi
2080
2081 dir=
2082 case "$file" in
2083 *.la)
2084 # Check to see that this really is a libtool archive.
2c9a3a48 2085 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
553f653a 2086 else
5798fd97 2087 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
553f653a
JB
2088 $echo "$help" 1>&2
2089 exit 1
2090 fi
2091
2092 # Read the libtool library.
2093 dlname=
2094 library_names=
2095
2096 # If there is no directory component, then add one.
2097 case "$file" in
5798fd97 2098 */* | *\\*) . $file ;;
553f653a
JB
2099 *) . ./$file ;;
2100 esac
2101
2102 # Skip this library if it cannot be dlopened.
2103 if test -z "$dlname"; then
2104 # Warn if it was a shared library.
5798fd97 2105 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
553f653a
JB
2106 continue
2107 fi
2108
5798fd97 2109 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
553f653a
JB
2110 test "X$dir" = "X$file" && dir=.
2111
2112 if test -f "$dir/$objdir/$dlname"; then
2113 dir="$dir/$objdir"
2114 else
5798fd97 2115 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
553f653a
JB
2116 exit 1
2117 fi
2118 ;;
2119
2120 *.lo)
2121 # Just add the directory containing the .lo file.
5798fd97 2122 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
553f653a
JB
2123 test "X$dir" = "X$file" && dir=.
2124 ;;
2125
2126 *)
5798fd97 2127 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
553f653a
JB
2128 continue
2129 ;;
2130 esac
2131
2132 # Get the absolute pathname.
2133 absdir=`cd "$dir" && pwd`
2134 test -n "$absdir" && dir="$absdir"
2135
2136 # Now add the directory to shlibpath_var.
2137 if eval "test -z \"\$$shlibpath_var\""; then
2138 eval "$shlibpath_var=\"\$dir\""
2139 else
2140 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2141 fi
2142 done
2143
2144 # This variable tells wrapper scripts just to set shlibpath_var
2145 # rather than running their programs.
2146 libtool_execute_magic="$magic"
2147
2148 # Check if any of the arguments is a wrapper script.
2149 args=
2150 for file
2151 do
2152 case "$file" in
2153 -*) ;;
2154 *)
5798fd97 2155 # Do a test to see if this is really a libtool program.
2c9a3a48 2156 if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
553f653a
JB
2157 # If there is no directory component, then add one.
2158 case "$file" in
5798fd97 2159 */* | *\\*) . $file ;;
553f653a
JB
2160 *) . ./$file ;;
2161 esac
2162
2163 # Transform arg to wrapped name.
2164 file="$progdir/$program"
2165 fi
2166 ;;
2167 esac
2168 # Quote arguments (to preserve shell metacharacters).
5798fd97 2169 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
553f653a
JB
2170 args="$args \"$file\""
2171 done
2172
2173 if test -z "$run"; then
2174 # Export the shlibpath_var.
2175 eval "export $shlibpath_var"
2176
2177 # Now actually exec the command.
2178 eval "exec \$cmd$args"
2179
5798fd97 2180 $echo "$modename: cannot exec \$cmd$args"
553f653a
JB
2181 exit 1
2182 else
2183 # Display what would be done.
476f3c84 2184 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
553f653a
JB
2185 $echo "export $shlibpath_var"
2186 $echo "$cmd$args"
2187 exit 0
2188 fi
2189 ;;
2190
a7a8349d
MV
2191 # libtool uninstall mode
2192 uninstall)
5798fd97 2193 modename="$modename: uninstall"
a7a8349d
MV
2194 rm="$nonopt"
2195 files=
2196
2197 for arg
2198 do
2199 case "$arg" in
2200 -*) rm="$rm $arg" ;;
2201 *) files="$files $arg" ;;
2202 esac
2203 done
2204
2205 if test -z "$rm"; then
5798fd97 2206 $echo "$modename: you must specify an RM program" 1>&2
553f653a 2207 $echo "$help" 1>&2
a7a8349d
MV
2208 exit 1
2209 fi
2210
2211 for file in $files; do
5798fd97 2212 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
553f653a 2213 test "X$dir" = "X$file" && dir=.
5798fd97 2214 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
a7a8349d 2215
4cdcd100
JB
2216 rmfiles="$file"
2217
a7a8349d
MV
2218 case "$name" in
2219 *.la)
553f653a 2220 # Possibly a libtool archive, so verify it.
2c9a3a48 2221 if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
553f653a
JB
2222 . $dir/$name
2223
2224 # Delete the libtool libraries and symlinks.
2225 for n in $library_names; do
2226 rmfiles="$rmfiles $dir/$n"
2227 test "X$n" = "X$dlname" && dlname=
2228 done
2229 test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
2230 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
2231
5798fd97
MD
2232 $show "$rm $rmfiles"
2233 $run $rm $rmfiles
2234
2235 if test -n "$library_names"; then
2236 # Do each command in the postuninstall commands.
2237 eval cmds=\"$postuninstall_cmds\"
2238 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2239 for cmd in $cmds; do
2240 IFS="$save_ifs"
2241 $show "$cmd"
2242 $run eval "$cmd"
2243 done
2244 IFS="$save_ifs"
2245 fi
2246
2247 if test -n "$old_library"; then
2248 # Do each command in the old_postuninstall commands.
2249 eval cmds=\"$old_postuninstall_cmds\"
2250 IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
2251 for cmd in $cmds; do
2252 IFS="$save_ifs"
2253 $show "$cmd"
2254 $run eval "$cmd"
2255 done
2256 IFS="$save_ifs"
2257 fi
2258
553f653a
JB
2259 # FIXME: should reinstall the best remaining shared library.
2260 fi
2261 ;;
a6a5a664
JB
2262
2263 *.lo)
553f653a 2264 if test "$build_old_libs" = yes; then
2c9a3a48 2265 oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'`
553f653a
JB
2266 rmfiles="$rmfiles $dir/$oldobj"
2267 fi
5798fd97
MD
2268 $show "$rm $rmfiles"
2269 $run $rm $rmfiles
553f653a 2270 ;;
a7a8349d 2271
5798fd97
MD
2272 *)
2273 $show "$rm $rmfiles"
2274 $run $rm $rmfiles
2275 ;;
2276 esac
a7a8349d 2277 done
96abf47d 2278 exit 0
a7a8349d
MV
2279 ;;
2280
553f653a 2281 "")
5798fd97 2282 $echo "$modename: you must specify a MODE" 1>&2
553f653a 2283 $echo "$generic_help" 1>&2
a7a8349d
MV
2284 exit 1
2285 ;;
2286 esac
2287
5798fd97 2288 $echo "$modename: invalid operation mode \`$mode'" 1>&2
553f653a 2289 $echo "$generic_help" 1>&2
a7a8349d
MV
2290 exit 1
2291fi # test -z "$show_help"
2292
2293# We need to display help for each of the modes.
2294case "$mode" in
5798fd97
MD
2295"") $echo \
2296"Usage: $modename [OPTION]... [MODE-ARG]...
a7a8349d
MV
2297
2298Provide generalized library-building support services.
2299
2300-n, --dry-run display commands without modifying any files
2c9a3a48 2301 --features display configuration information and exit
a7a8349d
MV
2302 --finish same as \`--mode=finish'
2303 --help display this help message and exit
2304 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
553f653a
JB
2305 --quiet same as \`--silent'
2306 --silent don't print informational messages
a7a8349d
MV
2307 --version print version information
2308
2309MODE must be one of the following:
2310
2311 compile compile a source file into a libtool object
553f653a 2312 execute automatically set library path, then run a program
a7a8349d
MV
2313 finish complete the installation of libtool libraries
2314 install install libraries or executables
2315 link create a library or an executable
2316 uninstall remove libraries from an installed directory
2317
5798fd97
MD
2318MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
2319a more detailed description of MODE."
2320 exit 0
a7a8349d
MV
2321 ;;
2322
2323compile)
5798fd97
MD
2324 $echo \
2325"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
a7a8349d
MV
2326
2327Compile a source file into a libtool library object.
2328
2329COMPILE-COMMAND is a command to be used in creating a \`standard' object file
2330from the given SOURCEFILE.
2331
2332The output file name is determined by removing the directory component from
2333SOURCEFILE, then substituting the C source code suffix \`.c' with the
5798fd97 2334library object suffix, \`.lo'."
a7a8349d
MV
2335 ;;
2336
553f653a 2337execute)
5798fd97
MD
2338 $echo \
2339"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
553f653a
JB
2340
2341Automatically set library path, then run a program.
2342
2343This mode accepts the following additional options:
2344
2345 -dlopen FILE add the directory containing FILE to the library path
4cdcd100 2346
553f653a
JB
2347This mode sets the library path environment variable according to \`-dlopen'
2348flags.
4cdcd100 2349
553f653a
JB
2350If any of the ARGS are libtool executable wrappers, then they are translated
2351into their corresponding uninstalled binary, and any of their required library
2352directories are added to the library path.
4cdcd100 2353
5798fd97 2354Then, COMMAND is executed, with ARGS as arguments."
4cdcd100
JB
2355 ;;
2356
a7a8349d 2357finish)
5798fd97
MD
2358 $echo \
2359"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
a7a8349d
MV
2360
2361Complete the installation of libtool libraries.
2362
2363Each LIBDIR is a directory that contains libtool libraries.
2364
2365The commands that this mode executes may require superuser privileges. Use
5798fd97 2366the \`--dry-run' option if you just want to see what would be executed."
a7a8349d
MV
2367 ;;
2368
2369install)
5798fd97
MD
2370 $echo \
2371"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
a7a8349d
MV
2372
2373Install executables or libraries.
2374
2375INSTALL-COMMAND is the installation command. The first component should be
2376either the \`install' or \`cp' program.
2377
2378The rest of the components are interpreted as arguments to that command (only
5798fd97 2379BSD-compatible install options are recognized)."
a7a8349d
MV
2380 ;;
2381
2382link)
5798fd97
MD
2383 $echo \
2384"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
a7a8349d
MV
2385
2386Link object files or libraries together to form another library, or to
2387create an executable program.
2388
2389LINK-COMMAND is a command using the C compiler that you would use to create
2390a program from several object files.
2391
2392The following components of LINK-COMMAND are treated specially:
2393
476f3c84 2394 -all-static do not do any dynamic linking at all
553f653a
JB
2395 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
2396 -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
393e4e4d 2397 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4cdcd100
JB
2398 -LLIBDIR search LIBDIR for required installed libraries
2399 -lNAME OUTPUT-FILE requires the installed library libNAME
5798fd97 2400 -no-undefined declare that a library does not refer to external symbols
4cdcd100 2401 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5798fd97 2402 -release RELEASE specify package release information
4cdcd100 2403 -rpath LIBDIR the created library will eventually be installed in LIBDIR
476f3c84 2404 -static do not do any dynamic linking of libtool libraries
a7a8349d 2405 -version-info CURRENT[:REVISION[:AGE]]
553f653a 2406 specify library version info [each variable defaults to 0]
a7a8349d
MV
2407
2408All other options (arguments beginning with \`-') are ignored.
2409
2410Every other argument is treated as a filename. Files ending in \`.la' are
2411treated as uninstalled libtool libraries, other files are standard or library
2412object files.
2413
2414If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
96abf47d 2415library objects (\`.lo' files) may be specified, and \`-rpath' is required.
a7a8349d 2416
2c9a3a48
JB
2417If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
2418and \`ranlib'.
a7a8349d 2419
2c9a3a48
JB
2420If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
2421created, otherwise an executable program is created."
a7a8349d
MV
2422 ;;
2423
2424uninstall)
5798fd97
MD
2425 $echo
2426"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
a7a8349d
MV
2427
2428Remove libraries from an installation directory.
2429
2430RM is the name of the program to use to delete files associated with each FILE
2431(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
2432to RM.
2433
2434If FILE is a libtool library, all the files associated with it are deleted.
5798fd97 2435Otherwise, only FILE itself is deleted using RM."
a7a8349d
MV
2436 ;;
2437
2438*)
5798fd97 2439 $echo "$modename: invalid operation mode \`$mode'" 1>&2
553f653a 2440 $echo "$help" 1>&2
a7a8349d
MV
2441 exit 1
2442 ;;
2443esac
2444
5798fd97
MD
2445echo
2446$echo "Try \`$modename --help' for more information about other modes."
a7a8349d
MV
2447
2448exit 0
2449
2450# Local Variables:
2451# mode:shell-script
2452# sh-indentation:2
2453# End: