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