]>
Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | # ltmain.sh - Provide generalized library-building support services. |
2 | # NOTE: Changing this file will not affect anything until you rerun ltconfig. | |
3 | # | |
6cf86f7f | 4 | # Copyright (C) 1996-2000 Free Software Foundation, Inc. |
2031769e | 5 | # Originally by Gordon Matzigkeit <[email protected]>, 1996 |
252b5132 RH |
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 | # Check that we have a working $echo. | |
27 | if test "X$1" = X--no-reexec; then | |
28 | # Discard the --no-reexec flag, and continue. | |
29 | shift | |
30 | elif test "X$1" = X--fallback-echo; then | |
2031769e ILT |
31 | # Avoid inline document here, it may be left over |
32 | : | |
252b5132 RH |
33 | elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then |
34 | # Yippee, $echo works! | |
35 | : | |
36 | else | |
37 | # Restart under the correct shell, and then maybe $echo will work. | |
38 | exec $SHELL "$0" --no-reexec ${1+"$@"} | |
39 | fi | |
40 | ||
2031769e ILT |
41 | if test "X$1" = X--fallback-echo; then |
42 | # used as fallback echo | |
43 | shift | |
44 | cat <<EOF | |
45 | $* | |
46 | EOF | |
47 | exit 0 | |
48 | fi | |
49 | ||
252b5132 RH |
50 | # The name of this program. |
51 | progname=`$echo "$0" | sed 's%^.*/%%'` | |
52 | modename="$progname" | |
53 | ||
54 | # Constants. | |
55 | PROGRAM=ltmain.sh | |
56 | PACKAGE=libtool | |
6cf86f7f AO |
57 | VERSION=1.4a |
58 | TIMESTAMP=" (1.641.2.77 2000/08/01 04:25:15)" | |
252b5132 RH |
59 | |
60 | default_mode= | |
61 | help="Try \`$progname --help' for more information." | |
62 | magic="%%%MAGIC variable%%%" | |
63 | mkdir="mkdir" | |
64 | mv="mv -f" | |
65 | rm="rm -f" | |
66 | ||
67 | # Sed substitution that helps us do robust quoting. It backslashifies | |
68 | # metacharacters that are still active within double-quoted strings. | |
69 | Xsed='sed -e 1s/^X//' | |
70 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' | |
71 | SP2NL='tr \040 \012' | |
2031769e | 72 | NL2SP='tr \015\012 \040\040' |
252b5132 RH |
73 | |
74 | # NLS nuisances. | |
75 | # Only set LANG and LC_ALL to C if already set. | |
76 | # These must not be set unconditionally because not all systems understand | |
77 | # e.g. LANG=C (notably SCO). | |
78 | # We save the old values to restore during execute mode. | |
79 | if test "${LC_ALL+set}" = set; then | |
80 | save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL | |
81 | fi | |
82 | if test "${LANG+set}" = set; then | |
83 | save_LANG="$LANG"; LANG=C; export LANG | |
84 | fi | |
85 | ||
86 | if test "$LTCONFIG_VERSION" != "$VERSION"; then | |
87 | echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 | |
88 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 | |
89 | exit 1 | |
90 | fi | |
91 | ||
92 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then | |
93 | echo "$modename: not configured to build any kind of library" 1>&2 | |
94 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 | |
95 | exit 1 | |
96 | fi | |
97 | ||
98 | # Global variables. | |
99 | mode=$default_mode | |
100 | nonopt= | |
101 | prev= | |
102 | prevopt= | |
103 | run= | |
104 | show="$echo" | |
105 | show_help= | |
106 | execute_dlfiles= | |
107 | lo2o="s/\\.lo\$/.${objext}/" | |
2031769e | 108 | o2lo="s/\\.${objext}\$/.lo/" |
252b5132 RH |
109 | |
110 | # Parse our command line options once, thoroughly. | |
111 | while test $# -gt 0 | |
112 | do | |
113 | arg="$1" | |
114 | shift | |
115 | ||
116 | case "$arg" in | |
117 | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; | |
118 | *) optarg= ;; | |
119 | esac | |
120 | ||
121 | # If the previous option needs an argument, assign it. | |
122 | if test -n "$prev"; then | |
123 | case "$prev" in | |
124 | execute_dlfiles) | |
125 | eval "$prev=\"\$$prev \$arg\"" | |
126 | ;; | |
6cf86f7f AO |
127 | tag) |
128 | tagname="$arg" | |
129 | ||
130 | # Check whether tagname contains only valid characters | |
131 | case "$tagname" in | |
132 | *[!-_A-Za-z0-9,/]*) | |
133 | echo "$progname: invalid tag name: $tagname" 1>&2 | |
134 | exit 1 | |
135 | ;; | |
136 | esac | |
137 | ||
138 | if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then | |
139 | taglist="$taglist $tagname" | |
140 | # Evaluate the configuration. | |
141 | eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" | |
142 | else | |
143 | echo "$progname: ignoring unknown tag $tagname" 1>&2 | |
144 | fi | |
145 | ;; | |
252b5132 RH |
146 | *) |
147 | eval "$prev=\$arg" | |
148 | ;; | |
149 | esac | |
150 | ||
151 | prev= | |
152 | prevopt= | |
153 | continue | |
154 | fi | |
155 | ||
156 | # Have we seen a non-optional argument yet? | |
157 | case "$arg" in | |
158 | --help) | |
159 | show_help=yes | |
160 | ;; | |
161 | ||
162 | --version) | |
163 | echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" | |
164 | exit 0 | |
165 | ;; | |
166 | ||
167 | --config) | |
6cf86f7f AO |
168 | sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0" |
169 | # Now print the configurations for the tags. | |
170 | for tagname in $taglist; do | |
171 | sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" | |
172 | done | |
252b5132 RH |
173 | exit 0 |
174 | ;; | |
175 | ||
176 | --debug) | |
177 | echo "$progname: enabling shell trace mode" | |
178 | set -x | |
179 | ;; | |
180 | ||
181 | --dry-run | -n) | |
182 | run=: | |
183 | ;; | |
184 | ||
185 | --features) | |
186 | echo "host: $host" | |
187 | if test "$build_libtool_libs" = yes; then | |
188 | echo "enable shared libraries" | |
189 | else | |
190 | echo "disable shared libraries" | |
191 | fi | |
192 | if test "$build_old_libs" = yes; then | |
193 | echo "enable static libraries" | |
194 | else | |
195 | echo "disable static libraries" | |
196 | fi | |
197 | exit 0 | |
198 | ;; | |
199 | ||
200 | --finish) mode="finish" ;; | |
201 | ||
202 | --mode) prevopt="--mode" prev=mode ;; | |
203 | --mode=*) mode="$optarg" ;; | |
204 | ||
205 | --quiet | --silent) | |
206 | show=: | |
207 | ;; | |
208 | ||
6cf86f7f AO |
209 | --tag) prevopt="--tag" prev=tag ;; |
210 | --tag=*) | |
211 | set tag "$optarg" ${1+"$@"} | |
212 | shift | |
213 | prev=tag | |
214 | ;; | |
215 | ||
252b5132 RH |
216 | -dlopen) |
217 | prevopt="-dlopen" | |
218 | prev=execute_dlfiles | |
219 | ;; | |
220 | ||
221 | -*) | |
222 | $echo "$modename: unrecognized option \`$arg'" 1>&2 | |
223 | $echo "$help" 1>&2 | |
224 | exit 1 | |
225 | ;; | |
226 | ||
227 | *) | |
228 | nonopt="$arg" | |
229 | break | |
230 | ;; | |
231 | esac | |
232 | done | |
233 | ||
234 | if test -n "$prevopt"; then | |
235 | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 | |
236 | $echo "$help" 1>&2 | |
237 | exit 1 | |
238 | fi | |
239 | ||
240 | if test -z "$show_help"; then | |
241 | ||
242 | # Infer the operation mode. | |
243 | if test -z "$mode"; then | |
244 | case "$nonopt" in | |
245 | *cc | *++ | gcc* | *-gcc*) | |
246 | mode=link | |
247 | for arg | |
248 | do | |
249 | case "$arg" in | |
250 | -c) | |
251 | mode=compile | |
252 | break | |
253 | ;; | |
254 | esac | |
255 | done | |
256 | ;; | |
257 | *db | *dbx | *strace | *truss) | |
258 | mode=execute | |
259 | ;; | |
260 | *install*|cp|mv) | |
261 | mode=install | |
262 | ;; | |
263 | *rm) | |
264 | mode=uninstall | |
265 | ;; | |
266 | *) | |
267 | # If we have no mode, but dlfiles were specified, then do execute mode. | |
268 | test -n "$execute_dlfiles" && mode=execute | |
269 | ||
270 | # Just use the default operation mode. | |
271 | if test -z "$mode"; then | |
272 | if test -n "$nonopt"; then | |
273 | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 | |
274 | else | |
275 | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 | |
276 | fi | |
277 | fi | |
278 | ;; | |
279 | esac | |
280 | fi | |
281 | ||
282 | # Only execute mode is allowed to have -dlopen flags. | |
283 | if test -n "$execute_dlfiles" && test "$mode" != execute; then | |
284 | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 | |
285 | $echo "$help" 1>&2 | |
286 | exit 1 | |
287 | fi | |
288 | ||
289 | # Change the help message to a mode-specific one. | |
290 | generic_help="$help" | |
291 | help="Try \`$modename --help --mode=$mode' for more information." | |
292 | ||
293 | # These modes are in order of execution frequency so that they run quickly. | |
294 | case "$mode" in | |
295 | # libtool compile mode | |
296 | compile) | |
297 | modename="$modename: compile" | |
298 | # Get the compilation command and the source file. | |
299 | base_compile= | |
6cf86f7f | 300 | prev= |
252b5132 RH |
301 | lastarg= |
302 | srcfile="$nonopt" | |
303 | suppress_output= | |
304 | ||
305 | user_target=no | |
306 | for arg | |
307 | do | |
6cf86f7f AO |
308 | case "$prev" in |
309 | "") ;; | |
310 | xcompiler) | |
311 | # Aesthetically quote the previous argument. | |
312 | prev= | |
313 | lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
314 | ||
315 | case "$arg" in | |
316 | # Double-quote args containing other shell metacharacters. | |
317 | # Many Bourne shells cannot handle close brackets correctly | |
318 | # in scan sets, so we specify it separately. | |
319 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | |
320 | arg="\"$arg\"" | |
321 | ;; | |
322 | esac | |
323 | ||
324 | # Add the previous argument to base_compile. | |
325 | if test -z "$base_compile"; then | |
326 | base_compile="$lastarg" | |
327 | else | |
328 | base_compile="$base_compile $lastarg" | |
329 | fi | |
330 | continue | |
331 | ;; | |
332 | esac | |
333 | ||
252b5132 RH |
334 | # Accept any command-line options. |
335 | case "$arg" in | |
336 | -o) | |
337 | if test "$user_target" != "no"; then | |
338 | $echo "$modename: you cannot specify \`-o' more than once" 1>&2 | |
339 | exit 1 | |
340 | fi | |
341 | user_target=next | |
342 | ;; | |
343 | ||
344 | -static) | |
345 | build_old_libs=yes | |
346 | continue | |
347 | ;; | |
6cf86f7f AO |
348 | |
349 | -prefer-pic) | |
350 | pic_mode=yes | |
351 | continue | |
352 | ;; | |
353 | ||
354 | -prefer-non-pic) | |
355 | pic_mode=no | |
356 | continue | |
357 | ;; | |
358 | ||
359 | -Xcompiler) | |
360 | prev=xcompiler | |
361 | continue | |
362 | ;; | |
363 | ||
364 | -Wc,*) | |
365 | args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` | |
366 | lastarg= | |
367 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' | |
368 | for arg in $args; do | |
369 | IFS="$save_ifs" | |
370 | ||
371 | # Double-quote args containing other shell metacharacters. | |
372 | # Many Bourne shells cannot handle close brackets correctly | |
373 | # in scan sets, so we specify it separately. | |
374 | case "$arg" in | |
375 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | |
376 | arg="\"$arg\"" | |
377 | ;; | |
378 | esac | |
379 | lastarg="$lastarg $arg" | |
380 | done | |
381 | IFS="$save_ifs" | |
382 | lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` | |
383 | ||
384 | # Add the arguments to base_compile. | |
385 | if test -z "$base_compile"; then | |
386 | base_compile="$lastarg" | |
387 | else | |
388 | base_compile="$base_compile $lastarg" | |
389 | fi | |
390 | continue | |
391 | ;; | |
252b5132 RH |
392 | esac |
393 | ||
394 | case "$user_target" in | |
395 | next) | |
396 | # The next one is the -o target name | |
397 | user_target=yes | |
398 | continue | |
399 | ;; | |
400 | yes) | |
401 | # We got the output file | |
402 | user_target=set | |
403 | libobj="$arg" | |
404 | continue | |
405 | ;; | |
406 | esac | |
407 | ||
408 | # Accept the current argument as the source file. | |
409 | lastarg="$srcfile" | |
410 | srcfile="$arg" | |
411 | ||
412 | # Aesthetically quote the previous argument. | |
413 | ||
414 | # Backslashify any backslashes, double quotes, and dollar signs. | |
415 | # These are the only characters that are still specially | |
416 | # interpreted inside of double-quoted scrings. | |
417 | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` | |
418 | ||
419 | # Double-quote args containing other shell metacharacters. | |
6cf86f7f AO |
420 | # Many Bourne shells cannot handle close brackets correctly |
421 | # in scan sets, so we specify it separately. | |
252b5132 | 422 | case "$lastarg" in |
6cf86f7f | 423 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
252b5132 RH |
424 | lastarg="\"$lastarg\"" |
425 | ;; | |
426 | esac | |
427 | ||
428 | # Add the previous argument to base_compile. | |
429 | if test -z "$base_compile"; then | |
430 | base_compile="$lastarg" | |
431 | else | |
432 | base_compile="$base_compile $lastarg" | |
433 | fi | |
434 | done | |
435 | ||
436 | case "$user_target" in | |
437 | set) | |
438 | ;; | |
439 | no) | |
440 | # Get the name of the library object. | |
441 | libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` | |
442 | ;; | |
443 | *) | |
444 | $echo "$modename: you must specify a target with \`-o'" 1>&2 | |
445 | exit 1 | |
446 | ;; | |
447 | esac | |
448 | ||
449 | # Recognize several different file suffixes. | |
450 | # If the user specifies -o file.o, it is replaced with file.lo | |
451 | xform='[cCFSfmso]' | |
452 | case "$libobj" in | |
453 | *.ada) xform=ada ;; | |
454 | *.adb) xform=adb ;; | |
455 | *.ads) xform=ads ;; | |
456 | *.asm) xform=asm ;; | |
457 | *.c++) xform=c++ ;; | |
458 | *.cc) xform=cc ;; | |
6cf86f7f | 459 | *.class) xform=class ;; |
252b5132 RH |
460 | *.cpp) xform=cpp ;; |
461 | *.cxx) xform=cxx ;; | |
462 | *.f90) xform=f90 ;; | |
463 | *.for) xform=for ;; | |
6cf86f7f | 464 | *.java) xform=java ;; |
252b5132 RH |
465 | esac |
466 | ||
467 | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` | |
468 | ||
469 | case "$libobj" in | |
470 | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; | |
471 | *) | |
472 | $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 | |
473 | exit 1 | |
474 | ;; | |
475 | esac | |
476 | ||
6cf86f7f AO |
477 | # Infer tagged configuration to use if any are available and |
478 | # if one wasn't chosen via the "--tag" command line option. | |
479 | # Only attempt this if the compiler in the base compile | |
480 | # command doesn't match the default compiler. | |
481 | if test -n "$available_tags" && test -z "$tagname"; then | |
482 | case $base_compile in | |
483 | "$CC "*) ;; | |
484 | # Blanks in the command may have been stripped by the calling shell, | |
485 | # but not from the CC environment variable when ltconfig was run. | |
486 | "`$echo X$CC | $Xsed` "*) ;; | |
487 | *) | |
488 | for z in $available_tags; do | |
489 | if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then | |
490 | # Evaluate the configuration. | |
491 | eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" | |
492 | case $base_compile in | |
493 | "$CC "*) | |
494 | # The compiler in the base compile command matches | |
495 | # the one in the tagged configuration. | |
496 | # Assume this is the tagged configuration we want. | |
497 | tagname=$z | |
498 | break | |
499 | ;; | |
500 | "`$echo X$CC | $Xsed` "*) | |
501 | tagname=$z | |
502 | break | |
503 | ;; | |
504 | esac | |
505 | fi | |
506 | done | |
507 | # If $tagname still isn't set, then no tagged configuration | |
508 | # was found and let the user know that the "--tag" command | |
509 | # line option must be used. | |
510 | if test -z "$tagname"; then | |
511 | echo "$modename: unable to infer tagged configuration" | |
512 | echo "$modename: specify a tag with \`--tag'" 1>&2 | |
513 | exit 1 | |
514 | # else | |
515 | # echo "$modename: using $tagname tagged configuration" | |
516 | fi | |
517 | ;; | |
518 | esac | |
519 | fi | |
520 | ||
521 | objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` | |
522 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` | |
523 | if test "X$xdir" = "X$obj"; then | |
524 | xdir= | |
525 | else | |
526 | xdir=$xdir/ | |
527 | fi | |
528 | lobj=${xdir}$objdir/$objname | |
529 | ||
252b5132 RH |
530 | if test -z "$base_compile"; then |
531 | $echo "$modename: you must specify a compilation command" 1>&2 | |
532 | $echo "$help" 1>&2 | |
533 | exit 1 | |
534 | fi | |
535 | ||
536 | # Delete any leftover library objects. | |
537 | if test "$build_old_libs" = yes; then | |
6cf86f7f | 538 | removelist="$obj $lobj $libobj ${libobj}T" |
252b5132 | 539 | else |
6cf86f7f | 540 | removelist="$lobj $libobj ${libobj}T" |
252b5132 RH |
541 | fi |
542 | ||
543 | $run $rm $removelist | |
544 | trap "$run $rm $removelist; exit 1" 1 2 15 | |
545 | ||
6cf86f7f AO |
546 | # On Cygwin there's no "real" PIC flag so we must build both object types |
547 | case "$host_os" in | |
548 | cygwin* | mingw* | os2*) | |
549 | pic_mode=default | |
550 | ;; | |
551 | esac | |
552 | if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then | |
553 | # non-PIC code in shared libraries is not supported | |
554 | pic_mode=default | |
555 | fi | |
556 | ||
252b5132 RH |
557 | # Calculate the filename of the output object if compiler does |
558 | # not support -o with -c | |
559 | if test "$compiler_c_o" = no; then | |
560 | output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} | |
561 | lockfile="$output_obj.lock" | |
562 | removelist="$removelist $output_obj $lockfile" | |
563 | trap "$run $rm $removelist; exit 1" 1 2 15 | |
564 | else | |
6cf86f7f | 565 | output_obj= |
252b5132 RH |
566 | need_locks=no |
567 | lockfile= | |
568 | fi | |
569 | ||
570 | # Lock this critical section if it is needed | |
571 | # We use this script file to make the link, it avoids creating a new file | |
572 | if test "$need_locks" = yes; then | |
573 | until ln "$0" "$lockfile" 2>/dev/null; do | |
574 | $show "Waiting for $lockfile to be removed" | |
575 | sleep 2 | |
576 | done | |
577 | elif test "$need_locks" = warn; then | |
578 | if test -f "$lockfile"; then | |
579 | echo "\ | |
580 | *** ERROR, $lockfile exists and contains: | |
581 | `cat $lockfile 2>/dev/null` | |
582 | ||
583 | This indicates that another process is trying to use the same | |
584 | temporary object file, and libtool could not work around it because | |
585 | your compiler does not support \`-c' and \`-o' together. If you | |
586 | repeat this compilation, it may succeed, by chance, but you had better | |
587 | avoid parallel builds (make -j) in this platform, or get a better | |
588 | compiler." | |
589 | ||
590 | $run $rm $removelist | |
591 | exit 1 | |
592 | fi | |
593 | echo $srcfile > "$lockfile" | |
594 | fi | |
595 | ||
596 | if test -n "$fix_srcfile_path"; then | |
597 | eval srcfile=\"$fix_srcfile_path\" | |
598 | fi | |
599 | ||
6cf86f7f AO |
600 | $run $rm "$libobj" "${libobj}T" |
601 | ||
602 | # Create a libtool object file (analogous to a ".la" file), | |
603 | # but don't create it if we're doing a dry run. | |
604 | test -z "$run" && cat > ${libobj}T <<EOF | |
605 | # $libobj - a libtool object file | |
606 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP | |
607 | # | |
608 | # Please DO NOT delete this file! | |
609 | # It is necessary for linking the library. | |
610 | ||
611 | # Name of the PIC object. | |
612 | EOF | |
613 | ||
252b5132 RH |
614 | # Only build a PIC object if we are building libtool libraries. |
615 | if test "$build_libtool_libs" = yes; then | |
616 | # Without this assignment, base_compile gets emptied. | |
617 | fbsd_hideous_sh_bug=$base_compile | |
618 | ||
6cf86f7f AO |
619 | if test "$pic_mode" != no; then |
620 | command="$base_compile $srcfile $pic_flag" | |
621 | else | |
622 | # Don't build PIC code | |
623 | command="$base_compile $srcfile" | |
252b5132 | 624 | fi |
6cf86f7f AO |
625 | |
626 | if test ! -d ${xdir}$objdir; then | |
627 | $show "$mkdir ${xdir}$objdir" | |
628 | $run $mkdir ${xdir}$objdir | |
629 | status=$? | |
630 | if test $status -ne 0 && test ! -d ${xdir}$objdir; then | |
631 | exit $status | |
632 | fi | |
633 | fi | |
634 | ||
635 | if test -z "$output_obj"; then | |
636 | # Place PIC objects in $objdir | |
637 | command="$command -o $lobj" | |
252b5132 RH |
638 | fi |
639 | ||
6cf86f7f AO |
640 | $run $rm "$lobj" "$output_obj" |
641 | ||
252b5132 RH |
642 | $show "$command" |
643 | if $run eval "$command"; then : | |
644 | else | |
645 | test -n "$output_obj" && $run $rm $removelist | |
646 | exit 1 | |
647 | fi | |
648 | ||
649 | if test "$need_locks" = warn && | |
650 | test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then | |
651 | echo "\ | |
652 | *** ERROR, $lockfile contains: | |
653 | `cat $lockfile 2>/dev/null` | |
654 | ||
655 | but it should contain: | |
656 | $srcfile | |
657 | ||
658 | This indicates that another process is trying to use the same | |
659 | temporary object file, and libtool could not work around it because | |
660 | your compiler does not support \`-c' and \`-o' together. If you | |
661 | repeat this compilation, it may succeed, by chance, but you had better | |
662 | avoid parallel builds (make -j) in this platform, or get a better | |
663 | compiler." | |
664 | ||
665 | $run $rm $removelist | |
666 | exit 1 | |
667 | fi | |
668 | ||
669 | # Just move the object if needed, then go on to compile the next one | |
6cf86f7f AO |
670 | if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then |
671 | $show "$mv $output_obj $lobj" | |
672 | if $run $mv $output_obj $lobj; then : | |
252b5132 RH |
673 | else |
674 | error=$? | |
675 | $run $rm $removelist | |
676 | exit $error | |
677 | fi | |
678 | fi | |
679 | ||
6cf86f7f AO |
680 | # Append the name of the PIC object to the libtool object file. |
681 | test -z "$run" && cat >> ${libobj}T <<EOF | |
682 | pic_object='$objdir/$objname' | |
252b5132 | 683 | |
6cf86f7f | 684 | EOF |
252b5132 RH |
685 | |
686 | # Allow error messages only from the first compilation. | |
687 | suppress_output=' >/dev/null 2>&1' | |
6cf86f7f AO |
688 | else |
689 | # No PIC object so indicate it doesn't exist in the libtool | |
690 | # object file. | |
691 | test -z "$run" && cat >> ${libobj}T <<EOF | |
692 | pic_object=none | |
693 | ||
694 | EOF | |
252b5132 RH |
695 | fi |
696 | ||
697 | # Only build a position-dependent object if we build old libraries. | |
698 | if test "$build_old_libs" = yes; then | |
6cf86f7f AO |
699 | if test "$pic_mode" != yes; then |
700 | # Don't build PIC code | |
701 | command="$base_compile $srcfile" | |
702 | else | |
703 | command="$base_compile $srcfile $pic_flag" | |
704 | fi | |
252b5132 RH |
705 | if test "$compiler_c_o" = yes; then |
706 | command="$command -o $obj" | |
252b5132 RH |
707 | fi |
708 | ||
709 | # Suppress compiler output if we already did a PIC compilation. | |
710 | command="$command$suppress_output" | |
6cf86f7f | 711 | $run $rm "$obj" "$output_obj" |
252b5132 RH |
712 | $show "$command" |
713 | if $run eval "$command"; then : | |
714 | else | |
715 | $run $rm $removelist | |
716 | exit 1 | |
717 | fi | |
718 | ||
719 | if test "$need_locks" = warn && | |
720 | test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then | |
721 | echo "\ | |
722 | *** ERROR, $lockfile contains: | |
723 | `cat $lockfile 2>/dev/null` | |
724 | ||
725 | but it should contain: | |
726 | $srcfile | |
727 | ||
728 | This indicates that another process is trying to use the same | |
729 | temporary object file, and libtool could not work around it because | |
730 | your compiler does not support \`-c' and \`-o' together. If you | |
731 | repeat this compilation, it may succeed, by chance, but you had better | |
732 | avoid parallel builds (make -j) in this platform, or get a better | |
733 | compiler." | |
734 | ||
735 | $run $rm $removelist | |
736 | exit 1 | |
737 | fi | |
738 | ||
739 | # Just move the object if needed | |
6cf86f7f | 740 | if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then |
252b5132 RH |
741 | $show "$mv $output_obj $obj" |
742 | if $run $mv $output_obj $obj; then : | |
743 | else | |
744 | error=$? | |
745 | $run $rm $removelist | |
746 | exit $error | |
747 | fi | |
748 | fi | |
749 | ||
6cf86f7f AO |
750 | # Append the name of the non-PIC object the libtool object file. |
751 | # Only append if the libtool object file exists. | |
752 | test -z "$run" && cat >> ${libobj}T <<EOF | |
753 | # Name of the non-PIC object. | |
754 | non_pic_object='$objname' | |
755 | ||
756 | EOF | |
757 | else | |
758 | # Append the name of the non-PIC object the libtool object file. | |
759 | # Only append if the libtool object file exists. | |
760 | test -z "$run" && cat >> ${libobj}T <<EOF | |
761 | # Name of the non-PIC object. | |
762 | non_pic_object=none | |
763 | ||
764 | EOF | |
252b5132 RH |
765 | fi |
766 | ||
6cf86f7f AO |
767 | $run $mv "${libobj}T" "${libobj}" |
768 | ||
252b5132 RH |
769 | # Unlock the critical section if it was locked |
770 | if test "$need_locks" != no; then | |
771 | $rm "$lockfile" | |
772 | fi | |
773 | ||
774 | exit 0 | |
775 | ;; | |
776 | ||
777 | # libtool link mode | |
6cf86f7f | 778 | link | relink) |
252b5132 | 779 | modename="$modename: link" |
252b5132 RH |
780 | case "$host" in |
781 | *-*-cygwin* | *-*-mingw* | *-*-os2*) | |
782 | # It is impossible to link a dll without this setting, and | |
783 | # we shouldn't force the makefile maintainer to figure out | |
784 | # which system we are compiling for in order to pass an extra | |
785 | # flag for every libtool invokation. | |
786 | # allow_undefined=no | |
787 | ||
788 | # FIXME: Unfortunately, there are problems with the above when trying | |
789 | # to make a dll which has undefined symbols, in which case not | |
790 | # even a static library is built. For now, we need to specify | |
791 | # -no-undefined on the libtool link line when we can be certain | |
792 | # that all symbols are satisfied, otherwise we get a static library. | |
793 | allow_undefined=yes | |
252b5132 RH |
794 | ;; |
795 | *) | |
796 | allow_undefined=yes | |
797 | ;; | |
798 | esac | |
6cf86f7f AO |
799 | libtool_args="$nonopt" |
800 | base_compile="$nonopt" | |
2031769e ILT |
801 | compile_command="$nonopt" |
802 | finalize_command="$nonopt" | |
252b5132 RH |
803 | |
804 | compile_rpath= | |
805 | finalize_rpath= | |
806 | compile_shlibpath= | |
807 | finalize_shlibpath= | |
808 | convenience= | |
809 | old_convenience= | |
810 | deplibs= | |
6cf86f7f AO |
811 | old_deplibs= |
812 | compiler_flags= | |
813 | linker_flags= | |
814 | dllsearchpath= | |
815 | lib_search_path=`pwd` | |
252b5132 | 816 | |
252b5132 RH |
817 | avoid_version=no |
818 | dlfiles= | |
819 | dlprefiles= | |
820 | dlself=no | |
821 | export_dynamic=no | |
822 | export_symbols= | |
823 | export_symbols_regex= | |
824 | generated= | |
825 | libobjs= | |
252b5132 RH |
826 | ltlibs= |
827 | module=no | |
6cf86f7f | 828 | no_install=no |
252b5132 | 829 | objs= |
6cf86f7f | 830 | non_pic_objects= |
2031769e | 831 | prefer_static_libs=no |
252b5132 RH |
832 | preload=no |
833 | prev= | |
834 | prevarg= | |
835 | release= | |
836 | rpath= | |
837 | xrpath= | |
838 | perm_rpath= | |
839 | temp_rpath= | |
840 | thread_safe=no | |
841 | vinfo= | |
842 | ||
843 | # We need to know -static, to get the right output filenames. | |
844 | for arg | |
845 | do | |
846 | case "$arg" in | |
847 | -all-static | -static) | |
2031769e ILT |
848 | if test "X$arg" = "X-all-static"; then |
849 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then | |
252b5132 | 850 | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
2031769e ILT |
851 | fi |
852 | if test -n "$link_static_flag"; then | |
853 | dlopen_self=$dlopen_self_static | |
854 | fi | |
855 | else | |
856 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | |
857 | dlopen_self=$dlopen_self_static | |
858 | fi | |
252b5132 RH |
859 | fi |
860 | build_libtool_libs=no | |
861 | build_old_libs=yes | |
2031769e | 862 | prefer_static_libs=yes |
252b5132 RH |
863 | break |
864 | ;; | |
865 | esac | |
866 | done | |
867 | ||
868 | # See if our shared archives depend on static archives. | |
869 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes | |
870 | ||
871 | # Go through the arguments, transforming them on the way. | |
872 | while test $# -gt 0; do | |
873 | arg="$1" | |
6cf86f7f | 874 | base_compile="$base_compile $arg" |
252b5132 | 875 | shift |
6cf86f7f AO |
876 | case "$arg" in |
877 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | |
878 | qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test | |
879 | ;; | |
880 | *) qarg=$arg ;; | |
881 | esac | |
882 | libtool_args="$libtool_args $qarg" | |
252b5132 RH |
883 | |
884 | # If the previous option needs an argument, assign it. | |
885 | if test -n "$prev"; then | |
886 | case "$prev" in | |
887 | output) | |
888 | compile_command="$compile_command @OUTPUT@" | |
889 | finalize_command="$finalize_command @OUTPUT@" | |
890 | ;; | |
891 | esac | |
892 | ||
893 | case "$prev" in | |
894 | dlfiles|dlprefiles) | |
895 | if test "$preload" = no; then | |
896 | # Add the symbol object into the linking commands. | |
897 | compile_command="$compile_command @SYMFILE@" | |
898 | finalize_command="$finalize_command @SYMFILE@" | |
899 | preload=yes | |
900 | fi | |
901 | case "$arg" in | |
902 | *.la | *.lo) ;; # We handle these cases below. | |
2031769e ILT |
903 | force) |
904 | if test "$dlself" = no; then | |
905 | dlself=needless | |
906 | export_dynamic=yes | |
907 | fi | |
908 | prev= | |
909 | continue | |
910 | ;; | |
252b5132 RH |
911 | self) |
912 | if test "$prev" = dlprefiles; then | |
913 | dlself=yes | |
914 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then | |
915 | dlself=yes | |
2031769e ILT |
916 | else |
917 | dlself=needless | |
918 | export_dynamic=yes | |
252b5132 RH |
919 | fi |
920 | prev= | |
921 | continue | |
922 | ;; | |
923 | *) | |
2031769e ILT |
924 | if test "$prev" = dlfiles; then |
925 | dlfiles="$dlfiles $arg" | |
926 | else | |
927 | dlprefiles="$dlprefiles $arg" | |
928 | fi | |
252b5132 | 929 | prev= |
6cf86f7f | 930 | continue |
252b5132 RH |
931 | ;; |
932 | esac | |
933 | ;; | |
934 | expsyms) | |
935 | export_symbols="$arg" | |
936 | if test ! -f "$arg"; then | |
937 | $echo "$modename: symbol file \`$arg' does not exist" | |
938 | exit 1 | |
939 | fi | |
940 | prev= | |
941 | continue | |
942 | ;; | |
943 | expsyms_regex) | |
944 | export_symbols_regex="$arg" | |
945 | prev= | |
946 | continue | |
947 | ;; | |
948 | release) | |
949 | release="-$arg" | |
950 | prev= | |
951 | continue | |
952 | ;; | |
2031769e ILT |
953 | rpath | xrpath) |
954 | # We need an absolute path. | |
955 | case "$arg" in | |
956 | [\\/]* | [A-Za-z]:[\\/]*) ;; | |
957 | *) | |
958 | $echo "$modename: only absolute run-paths are allowed" 1>&2 | |
959 | exit 1 | |
960 | ;; | |
961 | esac | |
962 | if test "$prev" = rpath; then | |
963 | case "$rpath " in | |
964 | *" $arg "*) ;; | |
965 | *) rpath="$rpath $arg" ;; | |
966 | esac | |
967 | else | |
968 | case "$xrpath " in | |
969 | *" $arg "*) ;; | |
970 | *) xrpath="$xrpath $arg" ;; | |
971 | esac | |
972 | fi | |
252b5132 RH |
973 | prev= |
974 | continue | |
975 | ;; | |
6cf86f7f AO |
976 | xcompiler) |
977 | compiler_flags="$compiler_flags $qarg" | |
978 | prev= | |
979 | compile_command="$compile_command $qarg" | |
980 | finalize_command="$finalize_command $qarg" | |
981 | continue | |
982 | ;; | |
983 | xlinker) | |
984 | linker_flags="$linker_flags $qarg" | |
985 | compiler_flags="$compiler_flags $wl$qarg" | |
986 | prev= | |
987 | compile_command="$compile_command $wl$qarg" | |
988 | finalize_command="$finalize_command $wl$qarg" | |
989 | continue | |
990 | ;; | |
252b5132 RH |
991 | *) |
992 | eval "$prev=\"\$arg\"" | |
993 | prev= | |
994 | continue | |
995 | ;; | |
996 | esac | |
997 | fi | |
998 | ||
999 | prevarg="$arg" | |
1000 | ||
1001 | case "$arg" in | |
1002 | -all-static) | |
1003 | if test -n "$link_static_flag"; then | |
1004 | compile_command="$compile_command $link_static_flag" | |
1005 | finalize_command="$finalize_command $link_static_flag" | |
252b5132 RH |
1006 | fi |
1007 | continue | |
1008 | ;; | |
1009 | ||
1010 | -allow-undefined) | |
1011 | # FIXME: remove this flag sometime in the future. | |
1012 | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 | |
1013 | continue | |
1014 | ;; | |
1015 | ||
1016 | -avoid-version) | |
1017 | avoid_version=yes | |
1018 | continue | |
1019 | ;; | |
1020 | ||
1021 | -dlopen) | |
1022 | prev=dlfiles | |
1023 | continue | |
1024 | ;; | |
1025 | ||
1026 | -dlpreopen) | |
1027 | prev=dlprefiles | |
1028 | continue | |
1029 | ;; | |
1030 | ||
1031 | -export-dynamic) | |
2031769e ILT |
1032 | export_dynamic=yes |
1033 | continue | |
252b5132 RH |
1034 | ;; |
1035 | ||
1036 | -export-symbols | -export-symbols-regex) | |
1037 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | |
2031769e | 1038 | $echo "$modename: not more than one -exported-symbols argument allowed" |
252b5132 RH |
1039 | exit 1 |
1040 | fi | |
2031769e | 1041 | if test "X$arg" = "X-export-symbols"; then |
252b5132 RH |
1042 | prev=expsyms |
1043 | else | |
1044 | prev=expsyms_regex | |
1045 | fi | |
1046 | continue | |
1047 | ;; | |
1048 | ||
1049 | -L*) | |
2031769e ILT |
1050 | dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` |
1051 | # We need an absolute path. | |
252b5132 | 1052 | case "$dir" in |
2031769e | 1053 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
252b5132 | 1054 | *) |
2031769e ILT |
1055 | absdir=`cd "$dir" && pwd` |
1056 | if test -z "$absdir"; then | |
6cf86f7f AO |
1057 | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
1058 | exit 1 | |
2031769e ILT |
1059 | fi |
1060 | dir="$absdir" | |
252b5132 RH |
1061 | ;; |
1062 | esac | |
6cf86f7f AO |
1063 | case "$deplibs " in |
1064 | *" -L$dir "*) ;; | |
1065 | *) | |
1066 | deplibs="$deplibs -L$dir" | |
1067 | lib_search_path="$lib_search_path $dir" | |
1068 | ;; | |
252b5132 RH |
1069 | esac |
1070 | case "$host" in | |
1071 | *-*-cygwin* | *-*-mingw* | *-*-os2*) | |
252b5132 | 1072 | case ":$dllsearchpath:" in |
6cf86f7f AO |
1073 | *":$dir:"*) ;; |
1074 | *) dllsearchpath="$dllsearchpath:$dir";; | |
252b5132 RH |
1075 | esac |
1076 | ;; | |
1077 | esac | |
6cf86f7f | 1078 | continue |
252b5132 RH |
1079 | ;; |
1080 | ||
1081 | -l*) | |
2031769e ILT |
1082 | if test "$arg" = "-lc"; then |
1083 | case "$host" in | |
1084 | *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) | |
1085 | # These systems don't actually have c library (as such) | |
1086 | continue | |
1087 | ;; | |
1088 | esac | |
1089 | elif test "$arg" = "-lm"; then | |
1090 | case "$host" in | |
1091 | *-*-cygwin* | *-*-beos*) | |
1092 | # These systems don't actually have math library (as such) | |
1093 | continue | |
1094 | ;; | |
1095 | esac | |
1096 | fi | |
252b5132 | 1097 | deplibs="$deplibs $arg" |
6cf86f7f | 1098 | continue |
252b5132 RH |
1099 | ;; |
1100 | ||
1101 | -module) | |
2031769e ILT |
1102 | module=yes |
1103 | continue | |
252b5132 | 1104 | ;; |
2031769e | 1105 | |
6cf86f7f AO |
1106 | -no-fast-install) |
1107 | fast_install=no | |
1108 | continue | |
1109 | ;; | |
1110 | ||
1111 | -no-install) | |
1112 | case "$host" in | |
1113 | *-*-cygwin* | *-*-mingw* | *-*-os2*) | |
1114 | # The PATH hackery in wrapper scripts is required on Windows | |
1115 | # in order for the loader to find any dlls it needs. | |
1116 | $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 | |
1117 | $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 | |
1118 | fast_install=no | |
1119 | ;; | |
1120 | *-*-rhapsody*) | |
1121 | # rhapsody is a little odd... | |
1122 | deplibs="$deplibs -framework System" | |
1123 | ;; | |
1124 | *) | |
1125 | no_install=yes | |
1126 | ;; | |
1127 | esac | |
1128 | continue | |
1129 | ;; | |
1130 | ||
252b5132 RH |
1131 | -no-undefined) |
1132 | allow_undefined=no | |
1133 | continue | |
1134 | ;; | |
1135 | ||
1136 | -o) prev=output ;; | |
1137 | ||
1138 | -release) | |
1139 | prev=release | |
1140 | continue | |
1141 | ;; | |
1142 | ||
1143 | -rpath) | |
1144 | prev=rpath | |
1145 | continue | |
1146 | ;; | |
1147 | ||
1148 | -R) | |
1149 | prev=xrpath | |
1150 | continue | |
1151 | ;; | |
1152 | ||
1153 | -R*) | |
2031769e ILT |
1154 | dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` |
1155 | # We need an absolute path. | |
1156 | case "$dir" in | |
1157 | [\\/]* | [A-Za-z]:[\\/]*) ;; | |
1158 | *) | |
1159 | $echo "$modename: only absolute run-paths are allowed" 1>&2 | |
1160 | exit 1 | |
1161 | ;; | |
1162 | esac | |
1163 | case "$xrpath " in | |
1164 | *" $dir "*) ;; | |
1165 | *) xrpath="$xrpath $dir" ;; | |
1166 | esac | |
252b5132 RH |
1167 | continue |
1168 | ;; | |
1169 | ||
1170 | -static) | |
1171 | # If we have no pic_flag, then this is the same as -all-static. | |
1172 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | |
1173 | compile_command="$compile_command $link_static_flag" | |
1174 | finalize_command="$finalize_command $link_static_flag" | |
252b5132 RH |
1175 | fi |
1176 | continue | |
1177 | ;; | |
1178 | ||
1179 | -thread-safe) | |
1180 | thread_safe=yes | |
1181 | continue | |
1182 | ;; | |
1183 | ||
1184 | -version-info) | |
1185 | prev=vinfo | |
1186 | continue | |
1187 | ;; | |
1188 | ||
6cf86f7f AO |
1189 | -Wc,*) |
1190 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` | |
1191 | arg= | |
1192 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' | |
1193 | for flag in $args; do | |
1194 | IFS="$save_ifs" | |
1195 | case "$flag" in | |
1196 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | |
1197 | flag="\"$flag\"" | |
1198 | ;; | |
1199 | esac | |
1200 | arg="$arg $wl$flag" | |
1201 | compiler_flags="$compiler_flags $flag" | |
1202 | done | |
1203 | IFS="$save_ifs" | |
1204 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` | |
1205 | ;; | |
1206 | ||
1207 | -Wl,*) | |
1208 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` | |
1209 | arg= | |
1210 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' | |
1211 | for flag in $args; do | |
1212 | IFS="$save_ifs" | |
1213 | case "$flag" in | |
1214 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | |
1215 | flag="\"$flag\"" | |
1216 | ;; | |
1217 | esac | |
1218 | arg="$arg $wl$flag" | |
1219 | compiler_flags="$compiler_flags $wl$flag" | |
1220 | linker_flags="$linker_flags $flag" | |
1221 | done | |
1222 | IFS="$save_ifs" | |
1223 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` | |
1224 | ;; | |
1225 | ||
1226 | -Xcompiler) | |
1227 | prev=xcompiler | |
1228 | continue | |
1229 | ;; | |
1230 | ||
1231 | -Xlinker) | |
1232 | prev=xlinker | |
1233 | continue | |
1234 | ;; | |
1235 | ||
252b5132 RH |
1236 | # Some other compiler flag. |
1237 | -* | +*) | |
1238 | # Unknown arguments in both finalize_command and compile_command need | |
1239 | # to be aesthetically quoted because they are evaled later. | |
1240 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
1241 | case "$arg" in | |
6cf86f7f | 1242 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
252b5132 RH |
1243 | arg="\"$arg\"" |
1244 | ;; | |
1245 | esac | |
1246 | ;; | |
1247 | ||
6cf86f7f | 1248 | *.$objext) |
252b5132 RH |
1249 | # A standard object. |
1250 | objs="$objs $arg" | |
1251 | ;; | |
1252 | ||
1253 | *.lo) | |
6cf86f7f AO |
1254 | # A libtool-controlled object. |
1255 | ||
1256 | # Check to see that this really is a libtool object. | |
1257 | if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
1258 | pic_object= | |
1259 | non_pic_object= | |
1260 | ||
1261 | # Read the .lo file | |
1262 | # If there is no directory component, then add one. | |
1263 | case "$arg" in | |
1264 | */* | *\\*) . $arg ;; | |
1265 | *) . ./$arg ;; | |
1266 | esac | |
1267 | ||
1268 | if test -z "$pic_object" || \ | |
1269 | test -z "$non_pic_object" || | |
1270 | test "$pic_object" = none && \ | |
1271 | test "$non_pic_object" = none; then | |
1272 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 | |
1273 | exit 1 | |
1274 | fi | |
1275 | ||
1276 | # Extract subdirectory from the argument. | |
1277 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | |
1278 | if test "X$xdir" = "X$arg"; then | |
1279 | xdir= | |
252b5132 | 1280 | else |
6cf86f7f | 1281 | xdir="$xdir/" |
252b5132 | 1282 | fi |
252b5132 | 1283 | |
6cf86f7f AO |
1284 | if test "$pic_object" != none; then |
1285 | # Prepend the subdirectory the object is found in. | |
1286 | pic_object="$xdir$pic_object" | |
1287 | ||
1288 | if test "$prev" = dlfiles; then | |
1289 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | |
1290 | dlfiles="$dlfiles $pic_object" | |
1291 | prev= | |
1292 | continue | |
1293 | else | |
1294 | # If libtool objects are unsupported, then we need to preload. | |
1295 | prev=dlprefiles | |
1296 | fi | |
1297 | fi | |
1298 | ||
1299 | # CHECK ME: I think I busted this. -Ossama | |
1300 | if test "$prev" = dlprefiles; then | |
1301 | # Preload the old-style object. | |
1302 | dlprefiles="$dlprefiles $pic_object" | |
1303 | prev= | |
1304 | fi | |
1305 | ||
1306 | # A PIC object. | |
1307 | libobjs="$libobjs $pic_object" | |
1308 | arg="$pic_object" | |
1309 | fi | |
1310 | ||
1311 | # Non-PIC object. | |
1312 | if test "$non_pic_object" != none; then | |
1313 | # Prepend the subdirectory the object is found in. | |
1314 | non_pic_object="$xdir$non_pic_object" | |
1315 | ||
1316 | # A standard non-PIC object | |
1317 | non_pic_objects="$non_pic_objects $non_pic_object" | |
1318 | if test -z "$pic_object" || test "$pic_object" = none ; then | |
1319 | arg="$non_pic_object" | |
1320 | fi | |
1321 | fi | |
1322 | else | |
1323 | # Only an error if not doing a dry-run. | |
1324 | if test -z "$run"; then | |
1325 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 | |
1326 | exit 1 | |
1327 | else | |
1328 | # Dry-run case. | |
1329 | ||
1330 | # Extract subdirectory from the argument. | |
1331 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | |
1332 | if test "X$xdir" = "X$arg"; then | |
1333 | xdir= | |
1334 | else | |
1335 | xdir="$xdir/" | |
1336 | fi | |
1337 | ||
1338 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` | |
1339 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` | |
1340 | libobjs="$libobjs $pic_object" | |
1341 | non_pic_objects="$non_pic_objects $non_pic_object" | |
1342 | fi | |
252b5132 | 1343 | fi |
6cf86f7f AO |
1344 | ;; |
1345 | ||
1346 | *.$libext) | |
1347 | # An archive. | |
1348 | deplibs="$deplibs $arg" | |
1349 | old_deplibs="$old_deplibs $arg" | |
1350 | continue | |
252b5132 RH |
1351 | ;; |
1352 | ||
1353 | *.la) | |
1354 | # A libtool-controlled library. | |
1355 | ||
6cf86f7f AO |
1356 | if test "$prev" = dlfiles; then |
1357 | # This library was specified with -dlopen. | |
1358 | dlfiles="$dlfiles $arg" | |
1359 | prev= | |
1360 | elif test "$prev" = dlprefiles; then | |
1361 | # The library was specified with -dlpreopen. | |
1362 | dlprefiles="$dlprefiles $arg" | |
1363 | prev= | |
252b5132 | 1364 | else |
6cf86f7f | 1365 | deplibs="$deplibs $arg" |
252b5132 | 1366 | fi |
6cf86f7f AO |
1367 | continue |
1368 | ;; | |
252b5132 | 1369 | |
6cf86f7f AO |
1370 | # Some other compiler argument. |
1371 | *) | |
1372 | # Unknown arguments in both finalize_command and compile_command need | |
1373 | # to be aesthetically quoted because they are evaled later. | |
1374 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
252b5132 | 1375 | case "$arg" in |
6cf86f7f AO |
1376 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
1377 | arg="\"$arg\"" | |
1378 | ;; | |
252b5132 | 1379 | esac |
6cf86f7f AO |
1380 | ;; |
1381 | esac | |
252b5132 | 1382 | |
6cf86f7f AO |
1383 | # Now actually substitute the argument into the commands. |
1384 | if test -n "$arg"; then | |
1385 | compile_command="$compile_command $arg" | |
1386 | finalize_command="$finalize_command $arg" | |
1387 | fi | |
1388 | done | |
252b5132 | 1389 | |
6cf86f7f AO |
1390 | if test -n "$prev"; then |
1391 | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 | |
1392 | $echo "$help" 1>&2 | |
1393 | exit 1 | |
1394 | fi | |
252b5132 | 1395 | |
6cf86f7f AO |
1396 | # Infer tagged configuration to use if any are available and |
1397 | # if one wasn't chosen via the "--tag" command line option. | |
1398 | # Only attempt this if the compiler in the base link | |
1399 | # command doesn't match the default compiler. | |
1400 | if test -n "$available_tags" && test -z "$tagname"; then | |
1401 | case $base_compile in | |
1402 | "$CC "*) ;; | |
1403 | # Blanks in the command may have been stripped by the calling shell, | |
1404 | # but not from the CC environment variable when ltconfig was run. | |
1405 | "`$echo X$CC | $Xsed` "*) ;; | |
1406 | *) | |
1407 | for z in $available_tags; do | |
1408 | if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then | |
1409 | # Evaluate the configuration. | |
1410 | eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" | |
1411 | case $base_compile in | |
1412 | "$CC "*) | |
1413 | # The compiler in $compile_command matches | |
1414 | # the one in the tagged configuration. | |
1415 | # Assume this is the tagged configuration we want. | |
1416 | tagname=$z | |
1417 | break | |
1418 | ;; | |
1419 | "`$echo X$CC | $Xsed` "*) | |
1420 | tagname=$z | |
1421 | break | |
1422 | ;; | |
1423 | esac | |
1424 | fi | |
1425 | done | |
1426 | # If $tagname still isn't set, then no tagged configuration | |
1427 | # was found and let the user know that the "--tag" command | |
1428 | # line option must be used. | |
1429 | if test -z "$tagname"; then | |
1430 | echo "$modename: unable to infer tagged configuration" | |
1431 | echo "$modename: specify a tag with \`--tag'" 1>&2 | |
1432 | exit 1 | |
1433 | # else | |
1434 | # echo "$modename: using $tagname tagged configuration" | |
1435 | fi | |
1436 | ;; | |
1437 | esac | |
1438 | fi | |
1439 | ||
1440 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then | |
1441 | eval arg=\"$export_dynamic_flag_spec\" | |
1442 | compile_command="$compile_command $arg" | |
1443 | finalize_command="$finalize_command $arg" | |
1444 | fi | |
1445 | ||
1446 | oldlibs= | |
1447 | # calculate the name of the file, without its directory | |
1448 | outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` | |
1449 | libobjs_save="$libobjs" | |
1450 | ||
1451 | if test -n "$shlibpath_var"; then | |
1452 | # get the directories listed in $shlibpath_var | |
1453 | eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` | |
1454 | else | |
1455 | shlib_search_path= | |
1456 | fi | |
1457 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" | |
1458 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" | |
1459 | ||
1460 | output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` | |
1461 | if test "X$output_objdir" = "X$output"; then | |
1462 | output_objdir="$objdir" | |
1463 | else | |
1464 | output_objdir="$output_objdir/$objdir" | |
1465 | fi | |
1466 | # Create the object directory. | |
1467 | if test ! -d $output_objdir; then | |
1468 | $show "$mkdir $output_objdir" | |
1469 | $run $mkdir $output_objdir | |
1470 | status=$? | |
1471 | if test $status -ne 0 && test ! -d $output_objdir; then | |
1472 | exit $status | |
1473 | fi | |
1474 | fi | |
1475 | ||
1476 | # Determine the type of output | |
1477 | case "$output" in | |
1478 | "") | |
1479 | $echo "$modename: you must specify an output file" 1>&2 | |
1480 | $echo "$help" 1>&2 | |
1481 | exit 1 | |
1482 | ;; | |
1483 | *.$libext) linkmode=oldlib ;; | |
1484 | *.lo | *.$objext) linkmode=obj ;; | |
1485 | *.la) linkmode=lib ;; | |
1486 | *) linkmode=prog ;; # Anything else should be a program. | |
1487 | esac | |
1488 | ||
1489 | specialdeplibs= | |
1490 | libs= | |
1491 | # Find all interdependent deplibs by searching for libraries | |
1492 | # that are linked more than once (e.g. -la -lb -la) | |
1493 | for deplib in $deplibs; do | |
1494 | case "$libs " in | |
1495 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | |
1496 | esac | |
1497 | libs="$libs $deplib" | |
1498 | done | |
1499 | ||
1500 | if test $linkmode = lib; then | |
1501 | libs="$predeps $libs $compiler_lib_search_path $postdeps" | |
1502 | fi | |
1503 | ||
1504 | deplibs= | |
1505 | newdependency_libs= | |
1506 | newlib_search_path= | |
1507 | need_relink=no # whether we're linking any uninstalled libtool libraries | |
1508 | uninst_deplibs= # uninstalled libtool libraries | |
1509 | uninst_path= # paths that contain uninstalled libtool libraries | |
1510 | case $linkmode in | |
1511 | lib) | |
1512 | passes="conv link" | |
1513 | for file in $dlfiles $dlprefiles; do | |
1514 | case "$file" in | |
1515 | *.la) ;; | |
1516 | *) | |
1517 | $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 | |
1518 | exit 1 | |
1519 | ;; | |
1520 | esac | |
1521 | done | |
1522 | ;; | |
1523 | prog) | |
1524 | compile_deplibs= | |
1525 | finalize_deplibs= | |
1526 | alldeplibs=no | |
1527 | newdlfiles= | |
1528 | newdlprefiles= | |
1529 | passes="conv scan dlopen dlpreopen link" | |
1530 | ;; | |
1531 | *) passes="conv" | |
1532 | ;; | |
1533 | esac | |
1534 | for pass in $passes; do | |
1535 | if test "$linkmode,$pass" = "lib,link" || | |
1536 | test "$linkmode,$pass" = "prog,scan"; then | |
1537 | libs="$deplibs" | |
1538 | deplibs= | |
1539 | fi | |
1540 | if test $linkmode = prog; then | |
1541 | case $pass in | |
1542 | dlopen) libs="$dlfiles" ;; | |
1543 | dlpreopen) libs="$dlprefiles" ;; | |
1544 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; | |
1545 | esac | |
1546 | fi | |
1547 | if test $pass = dlopen; then | |
1548 | # Collect dlpreopened libraries | |
1549 | save_deplibs="$deplibs" | |
1550 | deplibs= | |
1551 | fi | |
1552 | for deplib in $libs; do | |
1553 | lib= | |
1554 | found=no | |
1555 | case "$deplib" in | |
1556 | -l*) | |
1557 | if test $linkmode != lib && test $linkmode != prog; then | |
1558 | $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 | |
1559 | continue | |
1560 | fi | |
1561 | if test $pass = conv; then | |
1562 | deplibs="$deplib $deplibs" | |
1563 | continue | |
1564 | fi | |
1565 | name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` | |
1566 | for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do | |
1567 | # Search the libtool library | |
1568 | lib="$searchdir/lib${name}.la" | |
1569 | if test -f "$lib"; then | |
1570 | found=yes | |
1571 | break | |
1572 | fi | |
1573 | done | |
1574 | if test "$found" != yes; then | |
1575 | if test "$linkmode,$pass" = "prog,link"; then | |
1576 | compile_deplibs="$deplib $compile_deplibs" | |
1577 | finalize_deplibs="$deplib $finalize_deplibs" | |
1578 | else | |
1579 | deplibs="$deplib $deplibs" | |
1580 | test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" | |
1581 | fi | |
1582 | continue | |
1583 | fi | |
1584 | ;; | |
1585 | -L*) | |
1586 | case $linkmode in | |
1587 | lib) | |
1588 | deplibs="$deplib $deplibs" | |
1589 | test $pass = conv && continue | |
1590 | newdependency_libs="$deplib $newdependency_libs" | |
1591 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` | |
1592 | ;; | |
1593 | prog) | |
1594 | if test $pass = conv; then | |
1595 | deplibs="$deplib $deplibs" | |
1596 | continue | |
1597 | fi | |
1598 | if test $pass = scan; then | |
1599 | deplibs="$deplib $deplibs" | |
1600 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` | |
1601 | else | |
1602 | compile_deplibs="$deplib $compile_deplibs" | |
1603 | finalize_deplibs="$deplib $finalize_deplibs" | |
1604 | fi | |
1605 | ;; | |
1606 | *) | |
1607 | $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 | |
1608 | ;; | |
1609 | esac | |
1610 | continue | |
1611 | ;; | |
1612 | -R*) | |
1613 | if test $pass = link; then | |
1614 | dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` | |
1615 | # Make sure the xrpath contains only unique directories. | |
1616 | case "$xrpath " in | |
1617 | *" $dir "*) ;; | |
1618 | *) xrpath="$xrpath $dir" ;; | |
1619 | esac | |
1620 | fi | |
1621 | deplibs="$deplib $deplibs" | |
1622 | continue | |
1623 | ;; | |
1624 | *.la) lib="$deplib" ;; | |
1625 | *.$libext) | |
1626 | if test $pass = conv; then | |
1627 | deplibs="$deplib $deplibs" | |
1628 | continue | |
1629 | fi | |
1630 | case $linkmode in | |
1631 | lib) | |
1632 | if test "$deplibs_check_method" != pass_all; then | |
1633 | echo | |
1634 | echo "*** Warning: This library needs some functionality provided by $deplib." | |
1635 | echo "*** I have the capability to make that library automatically link in when" | |
1636 | echo "*** you link to this library. But I can only do this if you have a" | |
1637 | echo "*** shared version of the library, which you do not appear to have." | |
1638 | else | |
1639 | echo | |
1640 | echo "*** Warning: Linking the shared library $output against the" | |
1641 | echo "*** static library $deplib is not portable!" | |
1642 | deplibs="$deplib $deplibs" | |
1643 | fi | |
1644 | continue | |
1645 | ;; | |
1646 | prog) | |
1647 | if test $pass != link; then | |
1648 | deplibs="$deplib $deplibs" | |
1649 | else | |
1650 | compile_deplibs="$deplib $compile_deplibs" | |
1651 | finalize_deplibs="$deplib $finalize_deplibs" | |
1652 | fi | |
1653 | continue | |
1654 | ;; | |
1655 | esac | |
1656 | ;; | |
1657 | *.lo | *.$objext) | |
1658 | if test $pass = conv; then | |
1659 | deplibs="$deplib $deplibs" | |
1660 | elif test $linkmode = prog; then | |
1661 | if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then | |
1662 | # If there is no dlopen support or we're linking statically, | |
1663 | # we need to preload. | |
1664 | newdlprefiles="$newdlprefiles $deplib" | |
1665 | compile_deplibs="$deplib $compile_deplibs" | |
1666 | finalize_deplibs="$deplib $finalize_deplibs" | |
1667 | else | |
1668 | newdlfiles="$newdlfiles $deplib" | |
1669 | fi | |
252b5132 | 1670 | fi |
6cf86f7f AO |
1671 | continue |
1672 | ;; | |
1673 | %DEPLIBS%) | |
1674 | alldeplibs=yes | |
1675 | continue | |
1676 | ;; | |
1677 | esac | |
1678 | if test $found = yes || test -f "$lib"; then : | |
1679 | else | |
1680 | $echo "$modename: cannot find the library \`$lib'" 1>&2 | |
1681 | exit 1 | |
252b5132 RH |
1682 | fi |
1683 | ||
6cf86f7f AO |
1684 | # Check to see that this really is a libtool archive. |
1685 | if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : | |
1686 | else | |
1687 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 | |
1688 | exit 1 | |
252b5132 RH |
1689 | fi |
1690 | ||
6cf86f7f AO |
1691 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
1692 | test "X$ladir" = "X$lib" && ladir="." | |
1693 | ||
1694 | dlname= | |
1695 | dlopen= | |
1696 | dlpreopen= | |
1697 | libdir= | |
1698 | library_names= | |
1699 | old_library= | |
1700 | # If the library was installed with an old release of libtool, | |
1701 | # it will not redefine variable installed. | |
1702 | installed=yes | |
1703 | ||
1704 | # Read the .la file | |
1705 | case "$lib" in | |
1706 | */* | *\\*) . $lib ;; | |
1707 | *) . ./$lib ;; | |
1708 | esac | |
1709 | ||
1710 | if test "$linkmode,$pass" = "lib,link" || | |
1711 | test "$linkmode,$pass" = "prog,scan" || | |
1712 | { test $linkmode != prog && test $linkmode != lib; }; then | |
1713 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" | |
1714 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" | |
1715 | fi | |
1716 | ||
1717 | if test $pass = conv; then | |
1718 | # only check for convenience libraries | |
1719 | deplibs="$lib $deplibs" | |
1720 | if test -z "$libdir"; then | |
1721 | if test -z "$old_library"; then | |
1722 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 | |
1723 | exit 1 | |
1724 | fi | |
1725 | # It is a libtool convenience library, so add in its objects. | |
1726 | convenience="$convenience $ladir/$objdir/$old_library" | |
1727 | old_convenience="$old_convenience $ladir/$objdir/$old_library" | |
1728 | tmp_libs= | |
1729 | for deplib in $dependency_libs; do | |
1730 | deplibs="$deplib $deplibs" | |
1731 | case "$tmp_libs " in | |
1732 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | |
1733 | esac | |
1734 | tmp_libs="$tmp_libs $deplib" | |
1735 | done | |
1736 | elif test $linkmode != prog && test $linkmode != lib; then | |
1737 | $echo "$modename: \`$lib' is not a convenience library" 1>&2 | |
1738 | exit 1 | |
1739 | fi | |
252b5132 RH |
1740 | continue |
1741 | fi | |
1742 | ||
6cf86f7f AO |
1743 | # Get the name of the library we link against. |
1744 | linklib= | |
1745 | for l in $old_library $library_names; do | |
1746 | linklib="$l" | |
1747 | done | |
1748 | if test -z "$linklib"; then | |
1749 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 | |
1750 | exit 1 | |
1751 | fi | |
1752 | ||
252b5132 | 1753 | # This library was specified with -dlopen. |
6cf86f7f AO |
1754 | if test $pass = dlopen; then |
1755 | if test -z "$libdir"; then | |
1756 | $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 | |
1757 | exit 1 | |
1758 | fi | |
1759 | if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then | |
252b5132 RH |
1760 | # If there is no dlname, no dlopen support or we're linking statically, |
1761 | # we need to preload. | |
6cf86f7f | 1762 | dlprefiles="$dlprefiles $lib" |
252b5132 | 1763 | else |
6cf86f7f AO |
1764 | newdlfiles="$newdlfiles $lib" |
1765 | fi | |
1766 | continue | |
1767 | fi | |
1768 | ||
1769 | # We need an absolute path. | |
1770 | case "$ladir" in | |
1771 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; | |
1772 | *) | |
1773 | abs_ladir=`cd "$ladir" && pwd` | |
1774 | if test -z "$abs_ladir"; then | |
1775 | $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 | |
1776 | $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 | |
1777 | abs_ladir="$ladir" | |
1778 | fi | |
1779 | ;; | |
1780 | esac | |
1781 | laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` | |
1782 | ||
1783 | # Find the relevant object directory and library name. | |
1784 | if test "X$installed" = Xyes; then | |
1785 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then | |
1786 | $echo "$modename: warning: library \`$lib' was moved." 1>&2 | |
1787 | dir="$ladir" | |
1788 | absdir="$abs_ladir" | |
1789 | libdir="$abs_ladir" | |
1790 | else | |
1791 | dir="$libdir" | |
1792 | absdir="$libdir" | |
252b5132 | 1793 | fi |
6cf86f7f AO |
1794 | else |
1795 | dir="$ladir/$objdir" | |
1796 | absdir="$abs_ladir/$objdir" | |
1797 | # Remove this search path later | |
1798 | uninst_path="$uninst_path $abs_ladir" | |
252b5132 | 1799 | fi |
6cf86f7f | 1800 | name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
252b5132 | 1801 | |
6cf86f7f AO |
1802 | # This library was specified with -dlpreopen. |
1803 | if test $pass = dlpreopen; then | |
1804 | if test -z "$libdir"; then | |
1805 | $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 | |
1806 | exit 1 | |
1807 | fi | |
252b5132 RH |
1808 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
1809 | # are required to link). | |
1810 | if test -n "$old_library"; then | |
6cf86f7f | 1811 | newdlprefiles="$newdlprefiles $dir/$old_library" |
252b5132 | 1812 | else |
6cf86f7f | 1813 | newdlprefiles="$newdlprefiles $dir/$linklib" |
252b5132 | 1814 | fi |
252b5132 RH |
1815 | fi |
1816 | ||
6cf86f7f AO |
1817 | if test -z "$libdir"; then |
1818 | # link the convenience library | |
1819 | if test $linkmode = lib; then | |
1820 | deplibs="$dir/$old_library $deplibs" | |
1821 | elif test "$linkmode,$pass" = "prog,link"; then | |
1822 | compile_deplibs="$dir/$old_library $compile_deplibs" | |
1823 | finalize_deplibs="$dir/$old_library $finalize_deplibs" | |
1824 | else | |
1825 | deplibs="$lib $deplibs" # used for prog,scan pass | |
252b5132 | 1826 | fi |
6cf86f7f AO |
1827 | continue |
1828 | fi | |
252b5132 | 1829 | |
6cf86f7f AO |
1830 | if test $linkmode = prog && test $pass != link; then |
1831 | newlib_search_path="$newlib_search_path $ladir" | |
1832 | deplibs="$lib $deplibs" | |
1833 | ||
1834 | linkalldeplibs=no | |
1835 | if test "$link_all_deplibs" != no || test -z "$library_names" || | |
1836 | test "$build_libtool_libs" = no; then | |
1837 | linkalldeplibs=yes | |
1838 | fi | |
1839 | ||
1840 | tmp_libs= | |
1841 | for deplib in $dependency_libs; do | |
1842 | case "$deplib" in | |
1843 | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test | |
1844 | esac | |
1845 | # Need to link against all dependency_libs? | |
1846 | if test $linkalldeplibs = yes; then | |
1847 | deplibs="$deplib $deplibs" | |
1848 | else | |
1849 | # Need to hardcode shared library paths | |
1850 | # or/and link against static libraries | |
1851 | newdependency_libs="$deplib $newdependency_libs" | |
252b5132 | 1852 | fi |
6cf86f7f AO |
1853 | case "$tmp_libs " in |
1854 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | |
1855 | esac | |
1856 | tmp_libs="$tmp_libs $deplib" | |
1857 | done | |
1858 | continue | |
1859 | fi | |
1860 | ||
1861 | if test "$linkmode,$pass" = "prog,link"; then | |
1862 | if test -n "$library_names" && | |
1863 | { test "$hardcode_into_libs" != all || test "$alldeplibs" != yes; } && | |
1864 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then | |
1865 | # We need to hardcode the library path | |
1866 | if test -n "$shlibpath_var"; then | |
1867 | # Make sure the rpath contains only unique directories. | |
1868 | case "$temp_rpath " in | |
1869 | *" $dir "*) ;; | |
1870 | *" $absdir "*) ;; | |
1871 | *) temp_rpath="$temp_rpath $dir" ;; | |
1872 | esac | |
1873 | fi | |
1874 | ||
1875 | # Hardcode the library path. | |
1876 | # Skip directories that are in the system default run-time | |
1877 | # search path. | |
1878 | case " $sys_lib_dlsearch_path " in | |
252b5132 | 1879 | *" $absdir "*) ;; |
6cf86f7f AO |
1880 | *) |
1881 | case "$compile_rpath " in | |
1882 | *" $absdir "*) ;; | |
1883 | *) compile_rpath="$compile_rpath $absdir" | |
1884 | esac | |
1885 | ;; | |
252b5132 | 1886 | esac |
252b5132 | 1887 | |
6cf86f7f | 1888 | case " $sys_lib_dlsearch_path " in |
252b5132 | 1889 | *" $libdir "*) ;; |
6cf86f7f AO |
1890 | *) |
1891 | case "$finalize_rpath " in | |
1892 | *" $libdir "*) ;; | |
1893 | *) finalize_rpath="$finalize_rpath $libdir" | |
1894 | esac | |
1895 | ;; | |
252b5132 | 1896 | esac |
6cf86f7f | 1897 | fi |
252b5132 | 1898 | |
6cf86f7f AO |
1899 | if test "$alldeplibs" = yes && |
1900 | { test "$deplibs_check_method" = pass_all || | |
1901 | { test "$build_libtool_libs" = yes && | |
1902 | test -n "$library_names"; }; }; then | |
1903 | # We only need to search for static libraries | |
1904 | continue | |
1905 | fi | |
1906 | fi | |
1907 | ||
1908 | link_static=no # Whether the deplib will be linked statically | |
1909 | if test -n "$library_names" && | |
1910 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then | |
1911 | if test "$installed" = no; then | |
1912 | uninst_deplibs="$uninst_deplibs $lib" | |
1913 | need_relink=yes | |
1914 | fi | |
1915 | # This is a shared library | |
1916 | if test $linkmode = lib && test "$hardcode_into_libs" = all; then | |
1917 | # Hardcode the library path. | |
1918 | # Skip directories that are in the system default run-time | |
1919 | # search path. | |
1920 | case " $sys_lib_dlsearch_path " in | |
1921 | *" $absdir "*) ;; | |
1922 | *) | |
1923 | case "$compile_rpath " in | |
1924 | *" $absdir "*) ;; | |
1925 | *) compile_rpath="$compile_rpath $absdir" | |
252b5132 | 1926 | esac |
6cf86f7f AO |
1927 | ;; |
1928 | esac | |
1929 | case " $sys_lib_dlsearch_path " in | |
1930 | *" $libdir "*) ;; | |
1931 | *) | |
1932 | case "$finalize_rpath " in | |
1933 | *" $libdir "*) ;; | |
1934 | *) finalize_rpath="$finalize_rpath $libdir" | |
252b5132 | 1935 | esac |
6cf86f7f AO |
1936 | ;; |
1937 | esac | |
1938 | fi | |
1939 | ||
1940 | if test -n "$old_archive_from_expsyms_cmds"; then | |
1941 | # figure out the soname | |
1942 | set dummy $library_names | |
1943 | realname="$2" | |
1944 | shift; shift | |
1945 | libname=`eval \\$echo \"$libname_spec\"` | |
1946 | if test -n "$soname_spec"; then | |
1947 | eval soname=\"$soname_spec\" | |
1948 | else | |
1949 | soname="$realname" | |
1950 | fi | |
1951 | ||
1952 | # Make a new name for the extract_expsyms_cmds to use | |
1953 | newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" | |
1954 | ||
1955 | # If the library has no export list, then create one now | |
1956 | if test -f "$output_objdir/$soname-def"; then : | |
1957 | else | |
1958 | $show "extracting exported symbol list from \`$soname'" | |
1959 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
1960 | eval cmds=\"$extract_expsyms_cmds\" | |
1961 | for cmd in $cmds; do | |
1962 | IFS="$save_ifs" | |
1963 | $show "$cmd" | |
1964 | $run eval "$cmd" || exit $? | |
1965 | done | |
1966 | IFS="$save_ifs" | |
1967 | fi | |
1968 | ||
1969 | # Create $newlib | |
1970 | if test -f "$output_objdir/$newlib"; then :; else | |
1971 | $show "generating import library for \`$soname'" | |
1972 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
1973 | eval cmds=\"$old_archive_from_expsyms_cmds\" | |
1974 | for cmd in $cmds; do | |
1975 | IFS="$save_ifs" | |
1976 | $show "$cmd" | |
1977 | $run eval "$cmd" || exit $? | |
1978 | done | |
1979 | IFS="$save_ifs" | |
1980 | fi | |
1981 | # make sure the library variables are pointing to the new library | |
1982 | dir=$output_objdir | |
1983 | linklib=$newlib | |
1984 | fi | |
1985 | ||
1986 | if test $linkmode = prog || test "$mode" != relink; then | |
1987 | add_shlibpath= | |
1988 | add_dir= | |
1989 | add= | |
1990 | lib_linked=yes | |
1991 | case "$hardcode_action" in | |
1992 | immediate | unsupported) | |
1993 | if test "$hardcode_direct" = no; then | |
1994 | add="$dir/$linklib" | |
1995 | elif test "$hardcode_minus_L" = no; then | |
1996 | case "$host" in | |
1997 | *-*-sunos*) add_shlibpath="$dir" ;; | |
1998 | esac | |
1999 | add_dir="-L$dir" | |
2000 | add="-l$name" | |
2001 | elif test "$hardcode_shlibpath_var" = no; then | |
2002 | add_shlibpath="$dir" | |
2003 | add="-l$name" | |
2004 | else | |
2005 | lib_linked=no | |
2006 | fi | |
2007 | ;; | |
2008 | relink) | |
2009 | if test "$hardcode_direct" = yes; then | |
2010 | add="$dir/$linklib" | |
2011 | elif test "$hardcode_minus_L" = yes; then | |
2012 | add_dir="-L$dir" | |
2013 | add="-l$name" | |
2014 | elif test "$hardcode_shlibpath_var" = yes; then | |
2015 | add_shlibpath="$dir" | |
2016 | add="-l$name" | |
2017 | else | |
2018 | lib_linked=no | |
2019 | fi | |
2020 | ;; | |
2021 | *) lib_linked=no ;; | |
2022 | esac | |
2023 | ||
2024 | if test "$lib_linked" != yes; then | |
2025 | $echo "$modename: configuration error: unsupported hardcode properties" | |
2026 | exit 1 | |
2027 | fi | |
2028 | ||
2029 | if test -n "$add_shlibpath"; then | |
252b5132 | 2030 | case ":$compile_shlibpath:" in |
6cf86f7f AO |
2031 | *":$add_shlibpath:"*) ;; |
2032 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; | |
252b5132 | 2033 | esac |
6cf86f7f AO |
2034 | fi |
2035 | if test $linkmode = prog; then | |
2036 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" | |
2037 | test -n "$add" && compile_deplibs="$add $compile_deplibs" | |
252b5132 | 2038 | else |
6cf86f7f AO |
2039 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
2040 | test -n "$add" && deplibs="$add $deplibs" | |
2041 | if test "$hardcode_direct" != yes && \ | |
2042 | test "$hardcode_minus_L" != yes && \ | |
2043 | test "$hardcode_shlibpath_var" = yes; then | |
2044 | case ":$finalize_shlibpath:" in | |
2045 | *":$libdir:"*) ;; | |
2046 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; | |
2047 | esac | |
2048 | fi | |
252b5132 | 2049 | fi |
6cf86f7f | 2050 | fi |
252b5132 | 2051 | |
6cf86f7f AO |
2052 | if test $linkmode = prog || test "$mode" = relink; then |
2053 | add_shlibpath= | |
2054 | add_dir= | |
2055 | add= | |
2056 | # Finalize command for both is simple: just hardcode it. | |
252b5132 | 2057 | if test "$hardcode_direct" = yes; then |
6cf86f7f | 2058 | add="$libdir/$linklib" |
252b5132 | 2059 | elif test "$hardcode_minus_L" = yes; then |
6cf86f7f AO |
2060 | add_dir="-L$libdir" |
2061 | add="-l$name" | |
252b5132 | 2062 | elif test "$hardcode_shlibpath_var" = yes; then |
6cf86f7f AO |
2063 | case ":$finalize_shlibpath:" in |
2064 | *":$libdir:"*) ;; | |
2065 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; | |
252b5132 | 2066 | esac |
6cf86f7f | 2067 | add="-l$name" |
252b5132 | 2068 | else |
6cf86f7f AO |
2069 | # We cannot seem to hardcode it, guess we'll fake it. |
2070 | add_dir="-L$libdir" | |
2071 | add="-l$name" | |
252b5132 | 2072 | fi |
252b5132 | 2073 | |
6cf86f7f AO |
2074 | if test $linkmode = prog; then |
2075 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" | |
2076 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" | |
2077 | else | |
2078 | test -n "$add_dir" && deplibs="$add_dir $deplibs" | |
2079 | test -n "$add" && deplibs="$add $deplibs" | |
2080 | fi | |
252b5132 | 2081 | fi |
6cf86f7f | 2082 | elif test $linkmode = prog; then |
252b5132 RH |
2083 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
2084 | # is not unsupported. This is valid on all known static and | |
2085 | # shared platforms. | |
2086 | if test "$hardcode_direct" != unsupported; then | |
2087 | test -n "$old_library" && linklib="$old_library" | |
6cf86f7f AO |
2088 | compile_deplibs="$dir/$linklib $compile_deplibs" |
2089 | finalize_deplibs="$dir/$linklib $finalize_deplibs" | |
252b5132 | 2090 | else |
6cf86f7f AO |
2091 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
2092 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" | |
2093 | fi | |
2094 | elif test "$build_libtool_libs" = yes; then | |
2095 | # Not a shared library | |
2096 | if test "$deplibs_check_method" != pass_all; then | |
2097 | # We're trying link a shared library against a static one | |
2098 | # but the system doesn't support it. | |
2099 | # Just print a warning and add the library to dependency_libs so | |
2100 | # that the program can be linked against the static library. | |
2101 | echo | |
2102 | echo "*** Warning: This library needs some functionality provided by $lib." | |
2103 | echo "*** I have the capability to make that library automatically link in when" | |
2104 | echo "*** you link to this library. But I can only do this if you have a" | |
2105 | echo "*** shared version of the library, which you do not appear to have." | |
2106 | else | |
2107 | convenience="$convenience $dir/$old_library" | |
2108 | old_convenience="$old_convenience $dir/$old_library" | |
2109 | deplibs="$dir/$old_library $deplibs" | |
2110 | link_static=yes | |
2111 | fi | |
2112 | fi | |
2113 | ||
2114 | if test $linkmode = lib; then | |
2115 | if test -n "$dependency_libs" && | |
2116 | { test "$hardcode_into_libs" = no || test $build_old_libs = yes || | |
2117 | test $link_static = yes; }; then | |
2118 | # Extract -R from dependency_libs | |
2119 | temp_deplibs= | |
2120 | for libdir in $dependency_libs; do | |
2121 | case "$libdir" in | |
2122 | -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` | |
2123 | case " $xrpath " in | |
2124 | *" $temp_xrpath "*) ;; | |
2125 | *) xrpath="$xrpath $temp_xrpath";; | |
2126 | esac;; | |
2127 | *) temp_deplibs="$temp_deplibs $libdir";; | |
2128 | esac | |
2129 | done | |
2130 | dependency_libs="$temp_deplibs" | |
2131 | fi | |
2132 | ||
2133 | newlib_search_path="$newlib_search_path $absdir" | |
2134 | # Link against this library | |
2135 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" | |
2136 | # ... and its dependency_libs | |
2137 | tmp_libs= | |
2138 | for deplib in $dependency_libs; do | |
2139 | newdependency_libs="$deplib $newdependency_libs" | |
2140 | case "$tmp_libs " in | |
2141 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | |
2142 | esac | |
2143 | tmp_libs="$tmp_libs $deplib" | |
2144 | done | |
2145 | ||
2146 | if test $link_all_deplibs != no; then | |
2147 | # Add the search paths of all dependency libraries | |
2148 | for deplib in $dependency_libs; do | |
2149 | case "$deplib" in | |
2150 | -L*) path="$deplib" ;; | |
2151 | *.la) | |
2152 | dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` | |
2153 | test "X$dir" = "X$deplib" && dir="." | |
2154 | # We need an absolute path. | |
2155 | case "$dir" in | |
2156 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; | |
2157 | *) | |
2158 | absdir=`cd "$dir" && pwd` | |
2159 | if test -z "$absdir"; then | |
2160 | $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 | |
2161 | absdir="$dir" | |
2162 | fi | |
2163 | ;; | |
2164 | esac | |
2165 | if grep "^installed=no" $deplib > /dev/null; then | |
2166 | path="-L$absdir/$objdir" | |
2167 | else | |
2168 | eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` | |
2169 | if test -z "$libdir"; then | |
2170 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 | |
2171 | exit 1 | |
2172 | fi | |
2173 | if test "$absdir" != "$libdir"; then | |
2174 | $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 | |
2175 | fi | |
2176 | path="-L$absdir" | |
2177 | fi | |
2178 | ;; | |
2179 | *) continue ;; | |
2180 | esac | |
2181 | case " $deplibs " in | |
2182 | *" $path "*) ;; | |
2183 | *) deplibs="$path $deplibs" ;; | |
2184 | esac | |
2185 | done | |
2186 | fi | |
2187 | fi | |
2188 | done | |
2189 | dependency_libs="$newdependency_libs" | |
2190 | if test $pass = dlpreopen; then | |
2191 | # Link the dlpreopened libraries before other libraries | |
2192 | for deplib in $save_deplibs; do | |
2193 | deplibs="$deplib $deplibs" | |
2194 | done | |
2195 | fi | |
2196 | if test $pass != dlopen; then | |
2197 | if test $pass != conv; then | |
2198 | # Make sure lib_search_path contains only unique directories. | |
2199 | lib_search_path= | |
2200 | for dir in $newlib_search_path; do | |
2201 | case "$lib_search_path " in | |
2202 | *" $dir "*) ;; | |
2203 | *) lib_search_path="$lib_search_path $dir" ;; | |
2204 | esac | |
2205 | done | |
2206 | newlib_search_path= | |
2207 | fi | |
2208 | ||
2209 | if test "$linkmode,$pass" != "prog,link"; then | |
2210 | vars="deplibs" | |
2211 | else | |
2212 | vars="compile_deplibs finalize_deplibs" | |
2213 | fi | |
2214 | for var in $vars dependency_libs; do | |
2215 | # Make sure that $var contains only unique libraries | |
2216 | # and add them in reverse order | |
2217 | eval tmp_libs=\"\$$var\" | |
2218 | new_libs= | |
2219 | for deplib in $tmp_libs; do | |
2220 | case "$deplib" in | |
2221 | -L*) new_libs="$deplib $new_libs" ;; | |
2222 | *) | |
2223 | case " $specialdeplibs " in | |
2224 | *" $deplib "*) new_libs="$deplib $new_libs" ;; | |
2225 | *) | |
2226 | case " $new_libs " in | |
2227 | *" $deplib "*) ;; | |
2228 | *) new_libs="$deplib $new_libs" ;; | |
2229 | esac | |
2230 | ;; | |
2231 | esac | |
2232 | ;; | |
252b5132 | 2233 | esac |
6cf86f7f AO |
2234 | done |
2235 | tmp_libs= | |
2236 | for deplib in $new_libs; do | |
2237 | case "$deplib" in | |
2238 | -L*) | |
2239 | case " $tmp_libs " in | |
2240 | *" $deplib "*) ;; | |
2241 | *) tmp_libs="$tmp_libs $deplib" ;; | |
2242 | esac | |
2243 | ;; | |
2244 | *) tmp_libs="$tmp_libs $deplib" ;; | |
252b5132 | 2245 | esac |
6cf86f7f AO |
2246 | done |
2247 | eval $var=\"$tmp_libs\" | |
2248 | done | |
252b5132 RH |
2249 | fi |
2250 | done | |
6cf86f7f AO |
2251 | if test $linkmode = prog; then |
2252 | dlfiles="$newdlfiles" | |
2253 | dlprefiles="$newdlprefiles" | |
2031769e ILT |
2254 | fi |
2255 | ||
6cf86f7f AO |
2256 | case $linkmode in |
2257 | oldlib) | |
252b5132 RH |
2258 | if test -n "$deplibs"; then |
2259 | $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 | |
2260 | fi | |
2261 | ||
2031769e | 2262 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
252b5132 RH |
2263 | $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 |
2264 | fi | |
2265 | ||
2266 | if test -n "$rpath"; then | |
2267 | $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 | |
2268 | fi | |
2269 | ||
2270 | if test -n "$xrpath"; then | |
2271 | $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 | |
2272 | fi | |
2273 | ||
2274 | if test -n "$vinfo"; then | |
2275 | $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 | |
2276 | fi | |
2277 | ||
2278 | if test -n "$release"; then | |
2279 | $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 | |
2280 | fi | |
2281 | ||
2031769e | 2282 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
252b5132 RH |
2283 | $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 |
2284 | fi | |
2285 | ||
2286 | # Now set the variables for building old libraries. | |
2287 | build_libtool_libs=no | |
2288 | oldlibs="$output" | |
6cf86f7f | 2289 | objs="$objs$old_deplibs" |
252b5132 RH |
2290 | ;; |
2291 | ||
6cf86f7f | 2292 | lib) |
252b5132 RH |
2293 | # Make sure we only generate libraries of the form `libNAME.la'. |
2294 | case "$outputname" in | |
2295 | lib*) | |
2296 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` | |
2297 | eval libname=\"$libname_spec\" | |
2298 | ;; | |
2299 | *) | |
2300 | if test "$module" = no; then | |
2301 | $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 | |
2302 | $echo "$help" 1>&2 | |
2303 | exit 1 | |
2304 | fi | |
2305 | if test "$need_lib_prefix" != no; then | |
2306 | # Add the "lib" prefix for modules if required | |
2307 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` | |
2308 | eval libname=\"$libname_spec\" | |
2309 | else | |
2310 | libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` | |
2311 | fi | |
2312 | ;; | |
2313 | esac | |
2314 | ||
252b5132 | 2315 | if test -n "$objs"; then |
6cf86f7f AO |
2316 | if test "$deplibs_check_method" != pass_all; then |
2317 | $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 | |
2318 | exit 1 | |
2319 | else | |
2320 | echo | |
2321 | echo "*** Warning: Linking the shared library $output against the non-libtool" | |
2322 | echo "*** objects $objs is not portable!" | |
2323 | libobjs="$libobjs $objs" | |
2324 | fi | |
252b5132 RH |
2325 | fi |
2326 | ||
6cf86f7f AO |
2327 | if test "$dlself" != no; then |
2328 | $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 | |
252b5132 RH |
2329 | fi |
2330 | ||
2331 | set dummy $rpath | |
2332 | if test $# -gt 2; then | |
2333 | $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 | |
2334 | fi | |
2335 | install_libdir="$2" | |
2336 | ||
2337 | oldlibs= | |
2338 | if test -z "$rpath"; then | |
2339 | if test "$build_libtool_libs" = yes; then | |
2340 | # Building a libtool convenience library. | |
6cf86f7f AO |
2341 | # Some compilers have problems with a `.al' extension so |
2342 | # convenience libraries should have the same extension an | |
2343 | # archive normally would. | |
252b5132 RH |
2344 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
2345 | build_libtool_libs=convenience | |
2346 | build_old_libs=yes | |
2347 | fi | |
252b5132 RH |
2348 | |
2349 | if test -n "$vinfo"; then | |
2350 | $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 | |
2351 | fi | |
2352 | ||
2353 | if test -n "$release"; then | |
2354 | $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 | |
2355 | fi | |
2356 | else | |
2357 | ||
2358 | # Parse the version information argument. | |
2359 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' | |
2360 | set dummy $vinfo 0 0 0 | |
2361 | IFS="$save_ifs" | |
2362 | ||
2363 | if test -n "$8"; then | |
2364 | $echo "$modename: too many parameters to \`-version-info'" 1>&2 | |
2365 | $echo "$help" 1>&2 | |
2366 | exit 1 | |
2367 | fi | |
2368 | ||
2369 | current="$2" | |
2370 | revision="$3" | |
2371 | age="$4" | |
2372 | ||
2373 | # Check that each of the things are valid numbers. | |
2374 | case "$current" in | |
2375 | 0 | [1-9] | [1-9][0-9]*) ;; | |
2376 | *) | |
2377 | $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 | |
2378 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | |
2379 | exit 1 | |
2380 | ;; | |
2381 | esac | |
2382 | ||
2383 | case "$revision" in | |
2384 | 0 | [1-9] | [1-9][0-9]*) ;; | |
2385 | *) | |
2386 | $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 | |
2387 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | |
2388 | exit 1 | |
2389 | ;; | |
2390 | esac | |
2391 | ||
2392 | case "$age" in | |
2393 | 0 | [1-9] | [1-9][0-9]*) ;; | |
2394 | *) | |
2395 | $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 | |
2396 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | |
2397 | exit 1 | |
2398 | ;; | |
2399 | esac | |
2400 | ||
2401 | if test $age -gt $current; then | |
2402 | $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 | |
2403 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | |
2404 | exit 1 | |
2405 | fi | |
2406 | ||
2407 | # Calculate the version variables. | |
2408 | major= | |
2409 | versuffix= | |
2410 | verstring= | |
2411 | case "$version_type" in | |
2412 | none) ;; | |
2413 | ||
2414 | irix) | |
2415 | major=`expr $current - $age + 1` | |
252b5132 RH |
2416 | verstring="sgi$major.$revision" |
2417 | ||
2418 | # Add in all the interfaces that we are compatible with. | |
2419 | loop=$revision | |
2420 | while test $loop != 0; do | |
2421 | iface=`expr $revision - $loop` | |
2422 | loop=`expr $loop - 1` | |
2423 | verstring="sgi$major.$iface:$verstring" | |
2424 | done | |
6cf86f7f AO |
2425 | |
2426 | # Before this point, $major must not contain `.'. | |
2427 | major=.$major | |
2428 | versuffix="$major.$revision" | |
252b5132 RH |
2429 | ;; |
2430 | ||
2431 | linux) | |
2432 | major=.`expr $current - $age` | |
2433 | versuffix="$major.$age.$revision" | |
2434 | ;; | |
2435 | ||
2436 | osf) | |
2437 | major=`expr $current - $age` | |
2438 | versuffix=".$current.$age.$revision" | |
2439 | verstring="$current.$age.$revision" | |
2440 | ||
2441 | # Add in all the interfaces that we are compatible with. | |
2442 | loop=$age | |
2443 | while test $loop != 0; do | |
2444 | iface=`expr $current - $loop` | |
2445 | loop=`expr $loop - 1` | |
2446 | verstring="$verstring:${iface}.0" | |
2447 | done | |
2448 | ||
2449 | # Make executables depend on our current version. | |
2450 | verstring="$verstring:${current}.0" | |
2451 | ;; | |
2452 | ||
2453 | sunos) | |
2454 | major=".$current" | |
2455 | versuffix=".$current.$revision" | |
2456 | ;; | |
2457 | ||
2458 | freebsd-aout) | |
2459 | major=".$current" | |
2460 | versuffix=".$current.$revision"; | |
2461 | ;; | |
2462 | ||
2463 | freebsd-elf) | |
2464 | major=".$current" | |
2465 | versuffix=".$current"; | |
2466 | ;; | |
2467 | ||
2468 | windows) | |
2469 | # Like Linux, but with '-' rather than '.', since we only | |
2470 | # want one extension on Windows 95. | |
2471 | major=`expr $current - $age` | |
2472 | versuffix="-$major-$age-$revision" | |
2473 | ;; | |
2474 | ||
2475 | *) | |
2476 | $echo "$modename: unknown library version type \`$version_type'" 1>&2 | |
2477 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 | |
2478 | exit 1 | |
2479 | ;; | |
2480 | esac | |
2481 | ||
2482 | # Clear the version info if we defaulted, and they specified a release. | |
2483 | if test -z "$vinfo" && test -n "$release"; then | |
2484 | major= | |
2485 | verstring="0.0" | |
2486 | if test "$need_version" = no; then | |
2487 | versuffix= | |
2488 | else | |
2489 | versuffix=".0.0" | |
2490 | fi | |
2491 | fi | |
2492 | ||
2493 | # Remove version info from name if versioning should be avoided | |
2494 | if test "$avoid_version" = yes && test "$need_version" = no; then | |
2495 | major= | |
2496 | versuffix= | |
2497 | verstring="" | |
2498 | fi | |
6cf86f7f | 2499 | |
252b5132 RH |
2500 | # Check to see if the archive will have undefined symbols. |
2501 | if test "$allow_undefined" = yes; then | |
2502 | if test "$allow_undefined_flag" = unsupported; then | |
2503 | $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 | |
2504 | build_libtool_libs=no | |
2505 | build_old_libs=yes | |
2506 | fi | |
2507 | else | |
2508 | # Don't allow undefined symbols. | |
2509 | allow_undefined_flag="$no_undefined_flag" | |
2510 | fi | |
252b5132 RH |
2511 | fi |
2512 | ||
6cf86f7f AO |
2513 | if test "$mode" != relink; then |
2514 | # Remove our outputs, but don't remove object files since they | |
2515 | # may have been created when compiling PIC objects. | |
2516 | removelist= | |
2517 | tempremovelist=`echo "$output_objdir/*"` | |
2518 | for p in $tempremovelist; do | |
2519 | case "$p" in | |
2520 | *.$objext) | |
2521 | ;; | |
2522 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) | |
2523 | removelist="$removelist $p" | |
2524 | ;; | |
2525 | *) ;; | |
2526 | esac | |
2527 | done | |
2528 | if test -n "$removelist"; then | |
2529 | $show "${rm}r $removelist" | |
2530 | $run ${rm}r $removelist | |
2531 | fi | |
252b5132 RH |
2532 | fi |
2533 | ||
2534 | # Now set the variables for building old libraries. | |
2535 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then | |
2536 | oldlibs="$oldlibs $output_objdir/$libname.$libext" | |
2537 | ||
2538 | # Transform .lo files to .o files. | |
2539 | oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` | |
2540 | fi | |
2541 | ||
6cf86f7f AO |
2542 | # Eliminate all temporary directories. |
2543 | for path in $uninst_path; do | |
2544 | lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` | |
2545 | deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` | |
2546 | dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` | |
2547 | done | |
2548 | ||
2549 | if test -n "$xrpath"; then | |
2550 | # If the user specified any rpath flags, then add them. | |
2551 | temp_xrpath= | |
2552 | for libdir in $xrpath; do | |
2553 | temp_xrpath="$temp_xrpath -R$libdir" | |
2554 | case "$finalize_rpath " in | |
2555 | *" $libdir "*) ;; | |
2556 | *) finalize_rpath="$finalize_rpath $libdir" ;; | |
2557 | esac | |
2558 | done | |
2559 | if test "$hardcode_into_libs" = no || test $build_old_libs = yes; then | |
2560 | dependency_libs="$temp_xrpath $dependency_libs" | |
2561 | fi | |
2562 | fi | |
2563 | ||
2564 | # Make sure dlfiles contains only unique files that won't be dlpreopened | |
2565 | old_dlfiles="$dlfiles" | |
2566 | dlfiles= | |
2567 | for lib in $old_dlfiles; do | |
2568 | case " $dlprefiles $dlfiles " in | |
2569 | *" $lib "*) ;; | |
2570 | *) dlfiles="$dlfiles $lib" ;; | |
2571 | esac | |
2572 | done | |
2573 | ||
2574 | # Make sure dlprefiles contains only unique files | |
2575 | old_dlprefiles="$dlprefiles" | |
2576 | dlprefiles= | |
2577 | for lib in $old_dlprefiles; do | |
2578 | case "$dlprefiles " in | |
2579 | *" $lib "*) ;; | |
2580 | *) dlprefiles="$dlprefiles $lib" ;; | |
2581 | esac | |
2582 | done | |
2583 | ||
252b5132 | 2584 | if test "$build_libtool_libs" = yes; then |
6cf86f7f AO |
2585 | if test -n "$rpath"; then |
2586 | case "$host" in | |
2587 | *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) | |
2588 | # these systems don't actually have a c library (as such)! | |
2589 | ;; | |
2590 | *) | |
2591 | # Add libc to deplibs on all other systems if necessary. | |
2592 | if test $build_libtool_need_lc = "yes"; then | |
2593 | deplibs="$deplibs -lc" | |
2594 | fi | |
2595 | ;; | |
2596 | esac | |
2597 | fi | |
2598 | ||
252b5132 RH |
2599 | # Transform deplibs into only deplibs that can be linked in shared. |
2600 | name_save=$name | |
2601 | libname_save=$libname | |
2602 | release_save=$release | |
2603 | versuffix_save=$versuffix | |
2604 | major_save=$major | |
2605 | # I'm not sure if I'm treating the release correctly. I think | |
2606 | # release should show up in the -l (ie -lgmp5) so we don't want to | |
2607 | # add it in twice. Is that correct? | |
2608 | release="" | |
2609 | versuffix="" | |
2610 | major="" | |
2611 | newdeplibs= | |
2612 | droppeddeps=no | |
2613 | case "$deplibs_check_method" in | |
2614 | pass_all) | |
2031769e ILT |
2615 | # Don't check for shared/static. Everything works. |
2616 | # This might be a little naive. We might want to check | |
2617 | # whether the library exists or not. But this is on | |
2618 | # osf3 & osf4 and I'm not really sure... Just | |
2619 | # implementing what was already the behaviour. | |
252b5132 | 2620 | newdeplibs=$deplibs |
2031769e | 2621 | ;; |
252b5132 RH |
2622 | test_compile) |
2623 | # This code stresses the "libraries are programs" paradigm to its | |
2624 | # limits. Maybe even breaks it. We compile a program, linking it | |
2625 | # against the deplibs as a proxy for the library. Then we can check | |
2626 | # whether they linked in statically or dynamically with ldd. | |
2627 | $rm conftest.c | |
2628 | cat > conftest.c <<EOF | |
2629 | int main() { return 0; } | |
2630 | EOF | |
2631 | $rm conftest | |
6cf86f7f | 2632 | $LTCC -o conftest conftest.c $deplibs |
252b5132 RH |
2633 | if test $? -eq 0 ; then |
2634 | ldd_output=`ldd conftest` | |
2635 | for i in $deplibs; do | |
2636 | name="`expr $i : '-l\(.*\)'`" | |
2637 | # If $name is empty we are operating on a -L argument. | |
2638 | if test "$name" != "" ; then | |
2639 | libname=`eval \\$echo \"$libname_spec\"` | |
2640 | deplib_matches=`eval \\$echo \"$library_names_spec\"` | |
2641 | set dummy $deplib_matches | |
2642 | deplib_match=$2 | |
2643 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | |
2644 | newdeplibs="$newdeplibs $i" | |
2645 | else | |
2646 | droppeddeps=yes | |
2647 | echo | |
2648 | echo "*** Warning: This library needs some functionality provided by $i." | |
2649 | echo "*** I have the capability to make that library automatically link in when" | |
2650 | echo "*** you link to this library. But I can only do this if you have a" | |
2651 | echo "*** shared version of the library, which you do not appear to have." | |
2652 | fi | |
2653 | else | |
2654 | newdeplibs="$newdeplibs $i" | |
2655 | fi | |
2656 | done | |
2657 | else | |
2658 | # Error occured in the first compile. Let's try to salvage the situation: | |
2659 | # Compile a seperate program for each library. | |
2660 | for i in $deplibs; do | |
2661 | name="`expr $i : '-l\(.*\)'`" | |
2662 | # If $name is empty we are operating on a -L argument. | |
2663 | if test "$name" != "" ; then | |
2664 | $rm conftest | |
6cf86f7f | 2665 | $LTCC -o conftest conftest.c $i |
252b5132 RH |
2666 | # Did it work? |
2667 | if test $? -eq 0 ; then | |
2668 | ldd_output=`ldd conftest` | |
2031769e ILT |
2669 | libname=`eval \\$echo \"$libname_spec\"` |
2670 | deplib_matches=`eval \\$echo \"$library_names_spec\"` | |
2671 | set dummy $deplib_matches | |
2672 | deplib_match=$2 | |
2673 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | |
2674 | newdeplibs="$newdeplibs $i" | |
2675 | else | |
2676 | droppeddeps=yes | |
2677 | echo | |
2678 | echo "*** Warning: This library needs some functionality provided by $i." | |
2679 | echo "*** I have the capability to make that library automatically link in when" | |
2680 | echo "*** you link to this library. But I can only do this if you have a" | |
2681 | echo "*** shared version of the library, which you do not appear to have." | |
2682 | fi | |
252b5132 RH |
2683 | else |
2684 | droppeddeps=yes | |
2685 | echo | |
2686 | echo "*** Warning! Library $i is needed by this library but I was not able to" | |
2687 | echo "*** make it link in! You will probably need to install it or some" | |
2688 | echo "*** library that it depends on before this library will be fully" | |
2689 | echo "*** functional. Installing it before continuing would be even better." | |
2690 | fi | |
2691 | else | |
2692 | newdeplibs="$newdeplibs $i" | |
2693 | fi | |
2694 | done | |
2695 | fi | |
252b5132 RH |
2696 | ;; |
2697 | file_magic*) | |
2698 | set dummy $deplibs_check_method | |
6cf86f7f | 2699 | file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
252b5132 RH |
2700 | for a_deplib in $deplibs; do |
2701 | name="`expr $a_deplib : '-l\(.*\)'`" | |
2702 | # If $name is empty we are operating on a -L argument. | |
2703 | if test "$name" != "" ; then | |
2704 | libname=`eval \\$echo \"$libname_spec\"` | |
6cf86f7f | 2705 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
252b5132 RH |
2706 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
2707 | for potent_lib in $potential_libs; do | |
2708 | # Follow soft links. | |
2031769e | 2709 | if ls -lLd "$potent_lib" 2>/dev/null \ |
252b5132 | 2710 | | grep " -> " >/dev/null; then |
6cf86f7f | 2711 | continue |
252b5132 RH |
2712 | fi |
2713 | # The statement above tries to avoid entering an | |
2714 | # endless loop below, in case of cyclic links. | |
2715 | # We might still enter an endless loop, since a link | |
2716 | # loop can be closed while we follow links, | |
2717 | # but so what? | |
2718 | potlib="$potent_lib" | |
2719 | while test -h "$potlib" 2>/dev/null; do | |
2720 | potliblink=`ls -ld $potlib | sed 's/.* -> //'` | |
2721 | case "$potliblink" in | |
2031769e | 2722 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
252b5132 RH |
2723 | *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; |
2724 | esac | |
2725 | done | |
2031769e | 2726 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ |
252b5132 RH |
2727 | | sed 10q \ |
2728 | | egrep "$file_magic_regex" > /dev/null; then | |
2729 | newdeplibs="$newdeplibs $a_deplib" | |
2730 | a_deplib="" | |
2731 | break 2 | |
2732 | fi | |
2733 | done | |
2734 | done | |
2735 | if test -n "$a_deplib" ; then | |
2736 | droppeddeps=yes | |
2737 | echo | |
2738 | echo "*** Warning: This library needs some functionality provided by $a_deplib." | |
2739 | echo "*** I have the capability to make that library automatically link in when" | |
2740 | echo "*** you link to this library. But I can only do this if you have a" | |
2741 | echo "*** shared version of the library, which you do not appear to have." | |
2742 | fi | |
2743 | else | |
2744 | # Add a -L argument. | |
2745 | newdeplibs="$newdeplibs $a_deplib" | |
2746 | fi | |
2747 | done # Gone through all deplibs. | |
2748 | ;; | |
2031769e ILT |
2749 | none | unknown | *) |
2750 | newdeplibs="" | |
252b5132 RH |
2751 | if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ |
2752 | -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | | |
2753 | grep . >/dev/null; then | |
2754 | echo | |
2755 | if test "X$deplibs_check_method" = "Xnone"; then | |
2756 | echo "*** Warning: inter-library dependencies are not supported in this platform." | |
2757 | else | |
2758 | echo "*** Warning: inter-library dependencies are not known to be supported." | |
2759 | fi | |
2760 | echo "*** All declared inter-library dependencies are being dropped." | |
2761 | droppeddeps=yes | |
2762 | fi | |
2763 | ;; | |
2764 | esac | |
2765 | versuffix=$versuffix_save | |
2766 | major=$major_save | |
2767 | release=$release_save | |
2768 | libname=$libname_save | |
2769 | name=$name_save | |
2770 | ||
2771 | if test "$droppeddeps" = yes; then | |
2772 | if test "$module" = yes; then | |
2773 | echo | |
2774 | echo "*** Warning: libtool could not satisfy all declared inter-library" | |
2775 | echo "*** dependencies of module $libname. Therefore, libtool will create" | |
2776 | echo "*** a static module, that should work as long as the dlopening" | |
2777 | echo "*** application is linked with the -dlopen flag." | |
2778 | if test -z "$global_symbol_pipe"; then | |
2779 | echo | |
2780 | echo "*** However, this would only work if libtool was able to extract symbol" | |
2781 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could" | |
2782 | echo "*** not find such a program. So, this module is probably useless." | |
2783 | echo "*** \`nm' from GNU binutils and a full rebuild may help." | |
2784 | fi | |
2785 | if test "$build_old_libs" = no; then | |
2786 | oldlibs="$output_objdir/$libname.$libext" | |
2787 | build_libtool_libs=module | |
2788 | build_old_libs=yes | |
2789 | else | |
2790 | build_libtool_libs=no | |
2791 | fi | |
252b5132 RH |
2792 | else |
2793 | echo "*** The inter-library dependencies that have been dropped here will be" | |
2794 | echo "*** automatically added whenever a program is linked with this library" | |
2795 | echo "*** or is declared to -dlopen it." | |
2796 | fi | |
2797 | fi | |
2031769e ILT |
2798 | # Done checking deplibs! |
2799 | deplibs=$newdeplibs | |
252b5132 RH |
2800 | fi |
2801 | ||
2031769e ILT |
2802 | # All the library-specific variables (install_libdir is set above). |
2803 | library_names= | |
2804 | old_library= | |
2805 | dlname= | |
6cf86f7f | 2806 | |
2031769e | 2807 | # Test again, we may have decided not to build it any more |
252b5132 | 2808 | if test "$build_libtool_libs" = yes; then |
6cf86f7f AO |
2809 | if test "$hardcode_into_libs" != no; then |
2810 | # Hardcode the library paths | |
2811 | hardcode_libdirs= | |
2812 | dep_rpath= | |
2813 | rpath="$finalize_rpath" | |
2814 | test "$mode" != relink && rpath="$compile_rpath$rpath" | |
2815 | for libdir in $rpath; do | |
2816 | if test -n "$hardcode_libdir_flag_spec"; then | |
2817 | if test -n "$hardcode_libdir_separator"; then | |
2818 | if test -z "$hardcode_libdirs"; then | |
2819 | hardcode_libdirs="$libdir" | |
2820 | else | |
2821 | # Just accumulate the unique libdirs. | |
2822 | case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in | |
2823 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | |
2824 | ;; | |
2825 | *) | |
2826 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | |
2827 | ;; | |
2828 | esac | |
2829 | fi | |
2830 | else | |
2831 | eval flag=\"$hardcode_libdir_flag_spec\" | |
2832 | dep_rpath="$dep_rpath $flag" | |
2833 | fi | |
2834 | elif test -n "$runpath_var"; then | |
2835 | case "$perm_rpath " in | |
2836 | *" $libdir "*) ;; | |
2837 | *) perm_rpath="$perm_rpath $libdir" ;; | |
2838 | esac | |
2839 | fi | |
2840 | done | |
2841 | # Substitute the hardcoded libdirs into the rpath. | |
2842 | if test -n "$hardcode_libdir_separator" && | |
2843 | test -n "$hardcode_libdirs"; then | |
2844 | libdir="$hardcode_libdirs" | |
2845 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" | |
2846 | fi | |
2847 | if test -n "$runpath_var" && test -n "$perm_rpath"; then | |
2848 | # We should set the runpath_var. | |
2849 | rpath= | |
2850 | for dir in $perm_rpath; do | |
2851 | rpath="$rpath$dir:" | |
2852 | done | |
2853 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" | |
2854 | fi | |
2855 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" | |
2856 | fi | |
2857 | ||
2858 | shlibpath="$finalize_shlibpath" | |
2859 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" | |
2860 | if test -n "$shlibpath"; then | |
2861 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" | |
2862 | fi | |
2863 | ||
252b5132 RH |
2864 | # Get the real and link names of the library. |
2865 | eval library_names=\"$library_names_spec\" | |
2866 | set dummy $library_names | |
2867 | realname="$2" | |
2868 | shift; shift | |
2869 | ||
2870 | if test -n "$soname_spec"; then | |
2871 | eval soname=\"$soname_spec\" | |
2872 | else | |
2873 | soname="$realname" | |
2874 | fi | |
2875 | ||
2876 | lib="$output_objdir/$realname" | |
2877 | for link | |
2878 | do | |
2879 | linknames="$linknames $link" | |
2880 | done | |
2881 | ||
6cf86f7f AO |
2882 | # # Ensure that we have .o objects for linkers which dislike .lo |
2883 | # # (e.g. aix) in case we are running --disable-static | |
2884 | # for obj in $libobjs; do | |
2885 | # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` | |
2886 | # if test "X$xdir" = "X$obj"; then | |
2887 | # xdir="." | |
2888 | # else | |
2889 | # xdir="$xdir" | |
2890 | # fi | |
2891 | # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` | |
2892 | # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` | |
2893 | # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then | |
2894 | # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" | |
2895 | # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? | |
2896 | # fi | |
2897 | # done | |
252b5132 RH |
2898 | |
2899 | # Use standard objects if they are pic | |
2900 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
2901 | ||
252b5132 RH |
2902 | # Prepare the list of exported symbols |
2903 | if test -z "$export_symbols"; then | |
2904 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then | |
2905 | $show "generating symbol list for \`$libname.la'" | |
2031769e | 2906 | export_symbols="$output_objdir/$libname.exp" |
252b5132 RH |
2907 | $run $rm $export_symbols |
2908 | eval cmds=\"$export_symbols_cmds\" | |
2909 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
2910 | for cmd in $cmds; do | |
2911 | IFS="$save_ifs" | |
2912 | $show "$cmd" | |
2913 | $run eval "$cmd" || exit $? | |
2914 | done | |
2915 | IFS="$save_ifs" | |
2916 | if test -n "$export_symbols_regex"; then | |
2917 | $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" | |
2918 | $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' | |
2919 | $show "$mv \"${export_symbols}T\" \"$export_symbols\"" | |
2920 | $run eval '$mv "${export_symbols}T" "$export_symbols"' | |
2921 | fi | |
2922 | fi | |
2923 | fi | |
2924 | ||
2925 | if test -n "$export_symbols" && test -n "$include_expsyms"; then | |
2926 | $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' | |
2927 | fi | |
2928 | ||
2031769e ILT |
2929 | if test -n "$convenience"; then |
2930 | if test -n "$whole_archive_flag_spec"; then | |
2931 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" | |
2932 | else | |
2933 | gentop="$output_objdir/${outputname}x" | |
2934 | $show "${rm}r $gentop" | |
2935 | $run ${rm}r "$gentop" | |
6cf86f7f AO |
2936 | $show "$mkdir $gentop" |
2937 | $run $mkdir "$gentop" | |
2031769e ILT |
2938 | status=$? |
2939 | if test $status -ne 0 && test ! -d "$gentop"; then | |
2940 | exit $status | |
2941 | fi | |
2942 | generated="$generated $gentop" | |
2943 | ||
2944 | for xlib in $convenience; do | |
2945 | # Extract the objects. | |
2946 | case "$xlib" in | |
2947 | [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; | |
2948 | *) xabs=`pwd`"/$xlib" ;; | |
2949 | esac | |
2950 | xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` | |
2951 | xdir="$gentop/$xlib" | |
2952 | ||
2953 | $show "${rm}r $xdir" | |
2954 | $run ${rm}r "$xdir" | |
6cf86f7f AO |
2955 | $show "$mkdir $xdir" |
2956 | $run $mkdir "$xdir" | |
2031769e ILT |
2957 | status=$? |
2958 | if test $status -ne 0 && test ! -d "$xdir"; then | |
2959 | exit $status | |
2960 | fi | |
2961 | $show "(cd $xdir && $AR x $xabs)" | |
2962 | $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? | |
2963 | ||
6cf86f7f | 2964 | libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
2031769e ILT |
2965 | done |
2966 | fi | |
2967 | fi | |
2968 | ||
2969 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then | |
2970 | eval flag=\"$thread_safe_flag_spec\" | |
6cf86f7f AO |
2971 | linker_flags="$linker_flags $flag" |
2972 | fi | |
2973 | ||
2974 | # Make a backup of the uninstalled library when relinking | |
2975 | if test "$mode" = relink && test "$hardcode_into_libs" = all; then | |
2976 | $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? | |
2031769e ILT |
2977 | fi |
2978 | ||
252b5132 RH |
2979 | # Do each of the archive commands. |
2980 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then | |
2981 | eval cmds=\"$archive_expsym_cmds\" | |
2982 | else | |
2983 | eval cmds=\"$archive_cmds\" | |
2984 | fi | |
2985 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
2986 | for cmd in $cmds; do | |
2987 | IFS="$save_ifs" | |
2988 | $show "$cmd" | |
2989 | $run eval "$cmd" || exit $? | |
2990 | done | |
2991 | IFS="$save_ifs" | |
2992 | ||
6cf86f7f AO |
2993 | # Restore the uninstalled library and exit |
2994 | if test "$mode" = relink && test "$hardcode_into_libs" = all; then | |
2995 | $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? | |
2996 | exit 0 | |
2997 | fi | |
2998 | ||
252b5132 RH |
2999 | # Create links to the real library. |
3000 | for linkname in $linknames; do | |
3001 | if test "$realname" != "$linkname"; then | |
3002 | $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" | |
3003 | $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? | |
3004 | fi | |
3005 | done | |
3006 | ||
3007 | # If -module or -export-dynamic was specified, set the dlname. | |
3008 | if test "$module" = yes || test "$export_dynamic" = yes; then | |
3009 | # On all known operating systems, these are identical. | |
3010 | dlname="$soname" | |
3011 | fi | |
3012 | fi | |
3013 | ;; | |
3014 | ||
6cf86f7f | 3015 | obj) |
252b5132 RH |
3016 | if test -n "$deplibs"; then |
3017 | $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 | |
3018 | fi | |
3019 | ||
2031769e | 3020 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
252b5132 RH |
3021 | $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 |
3022 | fi | |
3023 | ||
3024 | if test -n "$rpath"; then | |
3025 | $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 | |
3026 | fi | |
3027 | ||
3028 | if test -n "$xrpath"; then | |
3029 | $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 | |
3030 | fi | |
3031 | ||
3032 | if test -n "$vinfo"; then | |
3033 | $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 | |
3034 | fi | |
3035 | ||
3036 | if test -n "$release"; then | |
3037 | $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 | |
3038 | fi | |
3039 | ||
3040 | case "$output" in | |
3041 | *.lo) | |
6cf86f7f | 3042 | if test -n "$objs$old_deplibs"; then |
252b5132 RH |
3043 | $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 |
3044 | exit 1 | |
3045 | fi | |
3046 | libobj="$output" | |
3047 | obj=`$echo "X$output" | $Xsed -e "$lo2o"` | |
3048 | ;; | |
3049 | *) | |
3050 | libobj= | |
3051 | obj="$output" | |
3052 | ;; | |
3053 | esac | |
3054 | ||
3055 | # Delete the old objects. | |
3056 | $run $rm $obj $libobj | |
3057 | ||
2031769e ILT |
3058 | # Objects from convenience libraries. This assumes |
3059 | # single-version convenience libraries. Whenever we create | |
3060 | # different ones for PIC/non-PIC, this we'll have to duplicate | |
3061 | # the extraction. | |
3062 | reload_conv_objs= | |
3063 | gentop= | |
3064 | # reload_cmds runs $LD directly, so let us get rid of | |
3065 | # -Wl from whole_archive_flag_spec | |
6cf86f7f | 3066 | wl= |
2031769e ILT |
3067 | |
3068 | if test -n "$convenience"; then | |
3069 | if test -n "$whole_archive_flag_spec"; then | |
3070 | eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" | |
3071 | else | |
3072 | gentop="$output_objdir/${obj}x" | |
3073 | $show "${rm}r $gentop" | |
3074 | $run ${rm}r "$gentop" | |
6cf86f7f AO |
3075 | $show "$mkdir $gentop" |
3076 | $run $mkdir "$gentop" | |
2031769e ILT |
3077 | status=$? |
3078 | if test $status -ne 0 && test ! -d "$gentop"; then | |
3079 | exit $status | |
3080 | fi | |
3081 | generated="$generated $gentop" | |
3082 | ||
3083 | for xlib in $convenience; do | |
3084 | # Extract the objects. | |
3085 | case "$xlib" in | |
3086 | [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; | |
3087 | *) xabs=`pwd`"/$xlib" ;; | |
3088 | esac | |
3089 | xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` | |
3090 | xdir="$gentop/$xlib" | |
3091 | ||
3092 | $show "${rm}r $xdir" | |
3093 | $run ${rm}r "$xdir" | |
6cf86f7f AO |
3094 | $show "$mkdir $xdir" |
3095 | $run $mkdir "$xdir" | |
2031769e ILT |
3096 | status=$? |
3097 | if test $status -ne 0 && test ! -d "$xdir"; then | |
3098 | exit $status | |
3099 | fi | |
3100 | $show "(cd $xdir && $AR x $xabs)" | |
3101 | $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? | |
3102 | ||
6cf86f7f | 3103 | reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
2031769e ILT |
3104 | done |
3105 | fi | |
3106 | fi | |
3107 | ||
252b5132 | 3108 | # Create the old-style object. |
6cf86f7f | 3109 | reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test |
252b5132 RH |
3110 | |
3111 | output="$obj" | |
3112 | eval cmds=\"$reload_cmds\" | |
3113 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3114 | for cmd in $cmds; do | |
3115 | IFS="$save_ifs" | |
3116 | $show "$cmd" | |
3117 | $run eval "$cmd" || exit $? | |
3118 | done | |
3119 | IFS="$save_ifs" | |
3120 | ||
3121 | # Exit if we aren't doing a library object file. | |
2031769e ILT |
3122 | if test -z "$libobj"; then |
3123 | if test -n "$gentop"; then | |
3124 | $show "${rm}r $gentop" | |
3125 | $run ${rm}r $gentop | |
3126 | fi | |
3127 | ||
3128 | exit 0 | |
3129 | fi | |
252b5132 RH |
3130 | |
3131 | if test "$build_libtool_libs" != yes; then | |
2031769e ILT |
3132 | if test -n "$gentop"; then |
3133 | $show "${rm}r $gentop" | |
3134 | $run ${rm}r $gentop | |
3135 | fi | |
3136 | ||
252b5132 RH |
3137 | # Create an invalid libtool object if no PIC, so that we don't |
3138 | # accidentally link it into a program. | |
6cf86f7f AO |
3139 | # $show "echo timestamp > $libobj" |
3140 | # $run eval "echo timestamp > $libobj" || exit $? | |
252b5132 RH |
3141 | exit 0 |
3142 | fi | |
3143 | ||
6cf86f7f | 3144 | if test -n "$pic_flag" || test "$pic_mode" != default; then |
252b5132 | 3145 | # Only do commands if we really have different PIC objects. |
2031769e | 3146 | reload_objs="$libobjs $reload_conv_objs" |
252b5132 RH |
3147 | output="$libobj" |
3148 | eval cmds=\"$reload_cmds\" | |
3149 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3150 | for cmd in $cmds; do | |
3151 | IFS="$save_ifs" | |
3152 | $show "$cmd" | |
3153 | $run eval "$cmd" || exit $? | |
3154 | done | |
3155 | IFS="$save_ifs" | |
6cf86f7f AO |
3156 | # else |
3157 | # # Just create a symlink. | |
3158 | # $show $rm $libobj | |
3159 | # $run $rm $libobj | |
3160 | # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` | |
3161 | # if test "X$xdir" = "X$libobj"; then | |
3162 | # xdir="." | |
3163 | # else | |
3164 | # xdir="$xdir" | |
3165 | # fi | |
3166 | # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` | |
3167 | # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` | |
3168 | # $show "(cd $xdir && $LN_S $oldobj $baseobj)" | |
3169 | # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? | |
2031769e ILT |
3170 | fi |
3171 | ||
3172 | if test -n "$gentop"; then | |
3173 | $show "${rm}r $gentop" | |
3174 | $run ${rm}r $gentop | |
252b5132 RH |
3175 | fi |
3176 | ||
3177 | exit 0 | |
3178 | ;; | |
3179 | ||
6cf86f7f | 3180 | prog) |
252b5132 RH |
3181 | if test -n "$vinfo"; then |
3182 | $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 | |
3183 | fi | |
3184 | ||
3185 | if test -n "$release"; then | |
3186 | $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 | |
3187 | fi | |
3188 | ||
3189 | if test "$preload" = yes; then | |
6cf86f7f | 3190 | if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && |
252b5132 RH |
3191 | test "$dlopen_self_static" = unknown; then |
3192 | $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." | |
6cf86f7f | 3193 | fi |
252b5132 | 3194 | fi |
6cf86f7f AO |
3195 | |
3196 | compile_command="$compile_command $compile_deplibs" | |
3197 | finalize_command="$finalize_command $finalize_deplibs" | |
3198 | ||
252b5132 RH |
3199 | if test -n "$rpath$xrpath"; then |
3200 | # If the user specified any rpath flags, then add them. | |
3201 | for libdir in $rpath $xrpath; do | |
3202 | # This is the magic to use -rpath. | |
252b5132 RH |
3203 | case "$finalize_rpath " in |
3204 | *" $libdir "*) ;; | |
3205 | *) finalize_rpath="$finalize_rpath $libdir" ;; | |
3206 | esac | |
3207 | done | |
3208 | fi | |
3209 | ||
3210 | # Now hardcode the library paths | |
3211 | rpath= | |
3212 | hardcode_libdirs= | |
3213 | for libdir in $compile_rpath $finalize_rpath; do | |
3214 | if test -n "$hardcode_libdir_flag_spec"; then | |
3215 | if test -n "$hardcode_libdir_separator"; then | |
3216 | if test -z "$hardcode_libdirs"; then | |
3217 | hardcode_libdirs="$libdir" | |
3218 | else | |
3219 | # Just accumulate the unique libdirs. | |
3220 | case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in | |
3221 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | |
3222 | ;; | |
3223 | *) | |
3224 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | |
3225 | ;; | |
3226 | esac | |
3227 | fi | |
3228 | else | |
3229 | eval flag=\"$hardcode_libdir_flag_spec\" | |
252b5132 RH |
3230 | rpath="$rpath $flag" |
3231 | fi | |
3232 | elif test -n "$runpath_var"; then | |
3233 | case "$perm_rpath " in | |
3234 | *" $libdir "*) ;; | |
3235 | *) perm_rpath="$perm_rpath $libdir" ;; | |
3236 | esac | |
3237 | fi | |
6cf86f7f AO |
3238 | case "$host" in |
3239 | *-*-cygwin* | *-*-mingw* | *-*-os2*) | |
3240 | case ":$dllsearchpath:" in | |
3241 | *":$libdir:"*) ;; | |
3242 | *) dllsearchpath="$dllsearchpath:$libdir";; | |
3243 | esac | |
3244 | ;; | |
3245 | esac | |
252b5132 RH |
3246 | done |
3247 | # Substitute the hardcoded libdirs into the rpath. | |
3248 | if test -n "$hardcode_libdir_separator" && | |
3249 | test -n "$hardcode_libdirs"; then | |
3250 | libdir="$hardcode_libdirs" | |
3251 | eval rpath=\" $hardcode_libdir_flag_spec\" | |
3252 | fi | |
3253 | compile_rpath="$rpath" | |
3254 | ||
3255 | rpath= | |
3256 | hardcode_libdirs= | |
3257 | for libdir in $finalize_rpath; do | |
3258 | if test -n "$hardcode_libdir_flag_spec"; then | |
3259 | if test -n "$hardcode_libdir_separator"; then | |
3260 | if test -z "$hardcode_libdirs"; then | |
3261 | hardcode_libdirs="$libdir" | |
3262 | else | |
3263 | # Just accumulate the unique libdirs. | |
3264 | case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in | |
3265 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | |
3266 | ;; | |
3267 | *) | |
3268 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | |
3269 | ;; | |
3270 | esac | |
3271 | fi | |
3272 | else | |
3273 | eval flag=\"$hardcode_libdir_flag_spec\" | |
252b5132 RH |
3274 | rpath="$rpath $flag" |
3275 | fi | |
3276 | elif test -n "$runpath_var"; then | |
3277 | case "$finalize_perm_rpath " in | |
3278 | *" $libdir "*) ;; | |
3279 | *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; | |
3280 | esac | |
3281 | fi | |
3282 | done | |
3283 | # Substitute the hardcoded libdirs into the rpath. | |
3284 | if test -n "$hardcode_libdir_separator" && | |
3285 | test -n "$hardcode_libdirs"; then | |
3286 | libdir="$hardcode_libdirs" | |
3287 | eval rpath=\" $hardcode_libdir_flag_spec\" | |
3288 | fi | |
3289 | finalize_rpath="$rpath" | |
3290 | ||
252b5132 | 3291 | dlsyms= |
2031769e | 3292 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
252b5132 RH |
3293 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
3294 | dlsyms="${outputname}S.c" | |
3295 | else | |
3296 | $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 | |
3297 | fi | |
3298 | fi | |
3299 | ||
3300 | if test -n "$dlsyms"; then | |
3301 | case "$dlsyms" in | |
3302 | "") ;; | |
3303 | *.c) | |
3304 | # Discover the nlist of each of the dlfiles. | |
2031769e | 3305 | nlist="$output_objdir/${outputname}.nm" |
252b5132 | 3306 | |
2031769e ILT |
3307 | $show "$rm $nlist ${nlist}S ${nlist}T" |
3308 | $run $rm "$nlist" "${nlist}S" "${nlist}T" | |
252b5132 RH |
3309 | |
3310 | # Parse the name list into a source file. | |
2031769e | 3311 | $show "creating $output_objdir/$dlsyms" |
252b5132 | 3312 | |
2031769e | 3313 | test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ |
252b5132 RH |
3314 | /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ |
3315 | /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ | |
3316 | ||
3317 | #ifdef __cplusplus | |
3318 | extern \"C\" { | |
3319 | #endif | |
3320 | ||
3321 | /* Prevent the only kind of declaration conflicts we can make. */ | |
3322 | #define lt_preloaded_symbols some_other_symbol | |
3323 | ||
3324 | /* External symbol declarations for the compiler. */\ | |
3325 | " | |
3326 | ||
3327 | if test "$dlself" = yes; then | |
3328 | $show "generating symbol list for \`$output'" | |
3329 | ||
2031769e | 3330 | test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" |
252b5132 RH |
3331 | |
3332 | # Add our own program objects to the symbol list. | |
6cf86f7f | 3333 | progfiles="$objs$old_deplibs" |
252b5132 RH |
3334 | for arg in $progfiles; do |
3335 | $show "extracting global C symbols from \`$arg'" | |
3336 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" | |
3337 | done | |
3338 | ||
3339 | if test -n "$exclude_expsyms"; then | |
3340 | $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' | |
3341 | $run eval '$mv "$nlist"T "$nlist"' | |
3342 | fi | |
6cf86f7f | 3343 | |
252b5132 RH |
3344 | if test -n "$export_symbols_regex"; then |
3345 | $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' | |
3346 | $run eval '$mv "$nlist"T "$nlist"' | |
3347 | fi | |
3348 | ||
3349 | # Prepare the list of exported symbols | |
3350 | if test -z "$export_symbols"; then | |
2031769e | 3351 | export_symbols="$output_objdir/$output.exp" |
252b5132 RH |
3352 | $run $rm $export_symbols |
3353 | $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' | |
3354 | else | |
2031769e ILT |
3355 | $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' |
3356 | $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' | |
252b5132 RH |
3357 | $run eval 'mv "$nlist"T "$nlist"' |
3358 | fi | |
3359 | fi | |
3360 | ||
3361 | for arg in $dlprefiles; do | |
3362 | $show "extracting global C symbols from \`$arg'" | |
3363 | name=`echo "$arg" | sed -e 's%^.*/%%'` | |
3364 | $run eval 'echo ": $name " >> "$nlist"' | |
3365 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" | |
3366 | done | |
3367 | ||
3368 | if test -z "$run"; then | |
3369 | # Make sure we have at least an empty file. | |
3370 | test -f "$nlist" || : > "$nlist" | |
3371 | ||
3372 | if test -n "$exclude_expsyms"; then | |
3373 | egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T | |
3374 | $mv "$nlist"T "$nlist" | |
3375 | fi | |
3376 | ||
3377 | # Try sorting and uniquifying the output. | |
3378 | if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then | |
3379 | : | |
3380 | else | |
3381 | grep -v "^: " < "$nlist" > "$nlist"S | |
3382 | fi | |
3383 | ||
3384 | if test -f "$nlist"S; then | |
3385 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' | |
3386 | else | |
3387 | echo '/* NONE */' >> "$output_objdir/$dlsyms" | |
3388 | fi | |
3389 | ||
3390 | $echo >> "$output_objdir/$dlsyms" "\ | |
3391 | ||
3392 | #undef lt_preloaded_symbols | |
3393 | ||
3394 | #if defined (__STDC__) && __STDC__ | |
3395 | # define lt_ptr_t void * | |
3396 | #else | |
3397 | # define lt_ptr_t char * | |
3398 | # define const | |
3399 | #endif | |
3400 | ||
3401 | /* The mapping between symbol names and symbols. */ | |
3402 | const struct { | |
3403 | const char *name; | |
3404 | lt_ptr_t address; | |
3405 | } | |
3406 | lt_preloaded_symbols[] = | |
3407 | {\ | |
3408 | " | |
3409 | ||
3410 | sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ | |
3411 | -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ | |
3412 | < "$nlist" >> "$output_objdir/$dlsyms" | |
3413 | ||
3414 | $echo >> "$output_objdir/$dlsyms" "\ | |
3415 | {0, (lt_ptr_t) 0} | |
3416 | }; | |
3417 | ||
3418 | /* This works around a problem in FreeBSD linker */ | |
3419 | #ifdef FREEBSD_WORKAROUND | |
3420 | static const void *lt_preloaded_setup() { | |
3421 | return lt_preloaded_symbols; | |
3422 | } | |
3423 | #endif | |
3424 | ||
3425 | #ifdef __cplusplus | |
3426 | } | |
3427 | #endif\ | |
3428 | " | |
3429 | fi | |
3430 | ||
3431 | pic_flag_for_symtable= | |
2031769e | 3432 | case "$host" in |
252b5132 RH |
3433 | # compiling the symbol table file with pic_flag works around |
3434 | # a FreeBSD bug that causes programs to crash when -lm is | |
3435 | # linked before any other PIC object. But we must not use | |
3436 | # pic_flag when linking with -static. The problem exists in | |
3437 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. | |
6cf86f7f | 3438 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
252b5132 RH |
3439 | case "$compile_command " in |
3440 | *" -static "*) ;; | |
6cf86f7f | 3441 | *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; |
2031769e ILT |
3442 | esac;; |
3443 | *-*-hpux*) | |
3444 | case "$compile_command " in | |
3445 | *" -static "*) ;; | |
6cf86f7f | 3446 | *) pic_flag_for_symtable=" $pic_flag";; |
252b5132 RH |
3447 | esac |
3448 | esac | |
3449 | ||
3450 | # Now compile the dynamic symbol file. | |
6cf86f7f AO |
3451 | $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" |
3452 | $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? | |
2031769e ILT |
3453 | |
3454 | # Clean up the generated files. | |
3455 | $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" | |
3456 | $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" | |
252b5132 RH |
3457 | |
3458 | # Transform the symbol file into the correct name. | |
2031769e ILT |
3459 | compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
3460 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` | |
252b5132 RH |
3461 | ;; |
3462 | *) | |
3463 | $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 | |
3464 | exit 1 | |
3465 | ;; | |
3466 | esac | |
3467 | else | |
3468 | # We keep going just in case the user didn't refer to | |
3469 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe | |
3470 | # really was required. | |
3471 | ||
3472 | # Nullify the symbol file. | |
3473 | compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` | |
3474 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` | |
3475 | fi | |
3476 | ||
6cf86f7f | 3477 | if test $need_relink = no || test "$build_libtool_libs" != yes; then |
252b5132 RH |
3478 | # Replace the output file specification. |
3479 | compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` | |
3480 | link_command="$compile_command$compile_rpath" | |
3481 | ||
3482 | # We have no uninstalled library dependencies, so finalize right now. | |
3483 | $show "$link_command" | |
3484 | $run eval "$link_command" | |
2031769e | 3485 | status=$? |
6cf86f7f | 3486 | |
2031769e ILT |
3487 | # Delete the generated files. |
3488 | if test -n "$dlsyms"; then | |
3489 | $show "$rm $output_objdir/${outputname}S.${objext}" | |
3490 | $run $rm "$output_objdir/${outputname}S.${objext}" | |
3491 | fi | |
3492 | ||
3493 | exit $status | |
252b5132 RH |
3494 | fi |
3495 | ||
3496 | if test -n "$shlibpath_var"; then | |
3497 | # We should set the shlibpath_var | |
3498 | rpath= | |
3499 | for dir in $temp_rpath; do | |
3500 | case "$dir" in | |
2031769e | 3501 | [\\/]* | [A-Za-z]:[\\/]*) |
252b5132 RH |
3502 | # Absolute path. |
3503 | rpath="$rpath$dir:" | |
3504 | ;; | |
3505 | *) | |
3506 | # Relative path: add a thisdir entry. | |
3507 | rpath="$rpath\$thisdir/$dir:" | |
3508 | ;; | |
3509 | esac | |
3510 | done | |
3511 | temp_rpath="$rpath" | |
3512 | fi | |
3513 | ||
3514 | if test -n "$compile_shlibpath$finalize_shlibpath"; then | |
3515 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" | |
3516 | fi | |
3517 | if test -n "$finalize_shlibpath"; then | |
3518 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" | |
3519 | fi | |
3520 | ||
3521 | compile_var= | |
3522 | finalize_var= | |
3523 | if test -n "$runpath_var"; then | |
3524 | if test -n "$perm_rpath"; then | |
3525 | # We should set the runpath_var. | |
3526 | rpath= | |
3527 | for dir in $perm_rpath; do | |
3528 | rpath="$rpath$dir:" | |
3529 | done | |
3530 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " | |
3531 | fi | |
3532 | if test -n "$finalize_perm_rpath"; then | |
3533 | # We should set the runpath_var. | |
3534 | rpath= | |
3535 | for dir in $finalize_perm_rpath; do | |
3536 | rpath="$rpath$dir:" | |
3537 | done | |
3538 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " | |
3539 | fi | |
3540 | fi | |
3541 | ||
6cf86f7f AO |
3542 | if test "$no_install" = yes; then |
3543 | # We don't need to create a wrapper script. | |
3544 | link_command="$compile_var$compile_command$compile_rpath" | |
3545 | # Replace the output file specification. | |
3546 | link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` | |
3547 | # Delete the old output file. | |
3548 | $run $rm $output | |
3549 | # Link the executable and exit | |
3550 | $show "$link_command" | |
3551 | $run eval "$link_command" || exit $? | |
3552 | exit 0 | |
3553 | fi | |
3554 | ||
3555 | if test "$hardcode_action" = relink || test "$hardcode_into_libs" = all; then | |
252b5132 RH |
3556 | # Fast installation is not supported |
3557 | link_command="$compile_var$compile_command$compile_rpath" | |
3558 | relink_command="$finalize_var$finalize_command$finalize_rpath" | |
6cf86f7f | 3559 | |
252b5132 RH |
3560 | $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 |
3561 | $echo "$modename: \`$output' will be relinked during installation" 1>&2 | |
3562 | else | |
3563 | if test "$fast_install" != no; then | |
3564 | link_command="$finalize_var$compile_command$finalize_rpath" | |
3565 | if test "$fast_install" = yes; then | |
3566 | relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` | |
3567 | else | |
3568 | # fast_install is set to needless | |
3569 | relink_command= | |
3570 | fi | |
3571 | else | |
3572 | link_command="$compile_var$compile_command$compile_rpath" | |
3573 | relink_command="$finalize_var$finalize_command$finalize_rpath" | |
3574 | fi | |
3575 | fi | |
3576 | ||
3577 | # Replace the output file specification. | |
3578 | link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` | |
6cf86f7f | 3579 | |
2031769e | 3580 | # Delete the old output files. |
252b5132 RH |
3581 | $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname |
3582 | ||
3583 | $show "$link_command" | |
3584 | $run eval "$link_command" || exit $? | |
3585 | ||
3586 | # Now create the wrapper script. | |
3587 | $show "creating $output" | |
3588 | ||
3589 | # Quote the relink command for shipping. | |
3590 | if test -n "$relink_command"; then | |
6cf86f7f | 3591 | # Preserve any variables that may affect compiler behavior |
7c86ed39 | 3592 | for var in $variables_saved_for_relink; do |
6cf86f7f AO |
3593 | eval var_value=\$$var |
3594 | var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` | |
3595 | relink_command="$var=\"$var_value\"; export $var; $relink_command" | |
7c86ed39 | 3596 | done |
6cf86f7f | 3597 | relink_command="cd `pwd`; $relink_command" |
252b5132 RH |
3598 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
3599 | fi | |
3600 | ||
3601 | # Quote $echo for shipping. | |
3602 | if test "X$echo" = "X$SHELL $0 --fallback-echo"; then | |
3603 | case "$0" in | |
2031769e | 3604 | [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; |
252b5132 RH |
3605 | *) qecho="$SHELL `pwd`/$0 --fallback-echo";; |
3606 | esac | |
3607 | qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` | |
3608 | else | |
3609 | qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` | |
3610 | fi | |
3611 | ||
3612 | # Only actually do things if our run command is non-null. | |
3613 | if test -z "$run"; then | |
3614 | # win32 will think the script is a binary if it has | |
3615 | # a .exe suffix, so we strip it off here. | |
3616 | case $output in | |
3617 | *.exe) output=`echo $output|sed 's,.exe$,,'` ;; | |
3618 | esac | |
3619 | $rm $output | |
3620 | trap "$rm $output; exit 1" 1 2 15 | |
3621 | ||
3622 | $echo > $output "\ | |
3623 | #! $SHELL | |
3624 | ||
3625 | # $output - temporary wrapper script for $objdir/$outputname | |
3626 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP | |
3627 | # | |
3628 | # The $output program cannot be directly executed until all the libtool | |
3629 | # libraries that it depends on are installed. | |
3630 | # | |
3631 | # This wrapper script should never be moved out of the build directory. | |
3632 | # If it is, it will not operate correctly. | |
3633 | ||
3634 | # Sed substitution that helps us do robust quoting. It backslashifies | |
3635 | # metacharacters that are still active within double-quoted strings. | |
3636 | Xsed='sed -e 1s/^X//' | |
3637 | sed_quote_subst='$sed_quote_subst' | |
3638 | ||
3639 | # The HP-UX ksh and POSIX shell print the target directory to stdout | |
3640 | # if CDPATH is set. | |
2031769e | 3641 | if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi |
252b5132 RH |
3642 | |
3643 | relink_command=\"$relink_command\" | |
3644 | ||
3645 | # This environment variable determines our operation mode. | |
3646 | if test \"\$libtool_install_magic\" = \"$magic\"; then | |
3647 | # install mode needs the following variable: | |
6cf86f7f | 3648 | uninst_deplibs='$uninst_deplibs' |
252b5132 RH |
3649 | else |
3650 | # When we are sourced in execute mode, \$file and \$echo are already set. | |
3651 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | |
3652 | echo=\"$qecho\" | |
3653 | file=\"\$0\" | |
3654 | # Make sure echo works. | |
3655 | if test \"X\$1\" = X--no-reexec; then | |
3656 | # Discard the --no-reexec flag, and continue. | |
3657 | shift | |
3658 | elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then | |
3659 | # Yippee, \$echo works! | |
3660 | : | |
3661 | else | |
3662 | # Restart under the correct shell, and then maybe \$echo will work. | |
3663 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} | |
3664 | fi | |
3665 | fi\ | |
3666 | " | |
3667 | $echo >> $output "\ | |
3668 | ||
3669 | # Find the directory that this script lives in. | |
3670 | thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` | |
3671 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. | |
3672 | ||
3673 | # Follow symbolic links until we get to the real thisdir. | |
3674 | file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` | |
3675 | while test -n \"\$file\"; do | |
3676 | destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` | |
3677 | ||
3678 | # If there was a directory component, then change thisdir. | |
3679 | if test \"x\$destdir\" != \"x\$file\"; then | |
3680 | case \"\$destdir\" in | |
6cf86f7f | 3681 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
252b5132 RH |
3682 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
3683 | esac | |
3684 | fi | |
3685 | ||
3686 | file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` | |
3687 | file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` | |
3688 | done | |
3689 | ||
3690 | # Try to get the absolute directory name. | |
3691 | absdir=\`cd \"\$thisdir\" && pwd\` | |
3692 | test -n \"\$absdir\" && thisdir=\"\$absdir\" | |
3693 | " | |
3694 | ||
3695 | if test "$fast_install" = yes; then | |
3696 | echo >> $output "\ | |
3697 | program=lt-'$outputname' | |
3698 | progdir=\"\$thisdir/$objdir\" | |
6cf86f7f | 3699 | |
252b5132 RH |
3700 | if test ! -f \"\$progdir/\$program\" || \\ |
3701 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ | |
3702 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then | |
3703 | ||
3704 | file=\"\$\$-\$program\" | |
3705 | ||
3706 | if test ! -d \"\$progdir\"; then | |
3707 | $mkdir \"\$progdir\" | |
3708 | else | |
3709 | $rm \"\$progdir/\$file\" | |
3710 | fi" | |
3711 | ||
3712 | echo >> $output "\ | |
3713 | ||
3714 | # relink executable if necessary | |
3715 | if test -n \"\$relink_command\"; then | |
6cf86f7f | 3716 | if (eval \$relink_command); then : |
252b5132 RH |
3717 | else |
3718 | $rm \"\$progdir/\$file\" | |
3719 | exit 1 | |
3720 | fi | |
3721 | fi | |
3722 | ||
3723 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || | |
3724 | { $rm \"\$progdir/\$program\"; | |
3725 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } | |
3726 | $rm \"\$progdir/\$file\" | |
3727 | fi" | |
3728 | else | |
3729 | echo >> $output "\ | |
3730 | program='$outputname' | |
3731 | progdir=\"\$thisdir/$objdir\" | |
3732 | " | |
3733 | fi | |
3734 | ||
3735 | echo >> $output "\ | |
3736 | ||
3737 | if test -f \"\$progdir/\$program\"; then" | |
3738 | ||
3739 | # Export our shlibpath_var if we have one. | |
3740 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then | |
3741 | $echo >> $output "\ | |
3742 | # Add our own library path to $shlibpath_var | |
3743 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" | |
3744 | ||
3745 | # Some systems cannot cope with colon-terminated $shlibpath_var | |
3746 | # The second colon is a workaround for a bug in BeOS R4 sed | |
3747 | $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` | |
3748 | ||
3749 | export $shlibpath_var | |
3750 | " | |
3751 | fi | |
3752 | ||
3753 | # fixup the dll searchpath if we need to. | |
3754 | if test -n "$dllsearchpath"; then | |
3755 | $echo >> $output "\ | |
3756 | # Add the dll search path components to the executable PATH | |
3757 | PATH=$dllsearchpath:\$PATH | |
3758 | " | |
3759 | fi | |
3760 | ||
3761 | $echo >> $output "\ | |
3762 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | |
3763 | # Run the actual program with our arguments. | |
3764 | " | |
3765 | case $host in | |
6cf86f7f AO |
3766 | # win32 systems need to use the prog path for dll |
3767 | # lookup to work | |
3768 | *-*-cygwin*) | |
3769 | $echo >> $output "\ | |
3770 | exec \$progdir/\$program \${1+\"\$@\"} | |
3771 | " | |
3772 | ;; | |
3773 | ||
3774 | # Backslashes separate directories on plain windows | |
3775 | *-*-mingw | *-*-os2*) | |
252b5132 RH |
3776 | $echo >> $output "\ |
3777 | exec \$progdir\\\\\$program \${1+\"\$@\"} | |
3778 | " | |
3779 | ;; | |
6cf86f7f | 3780 | |
252b5132 RH |
3781 | *) |
3782 | $echo >> $output "\ | |
3783 | # Export the path to the program. | |
3784 | PATH=\"\$progdir:\$PATH\" | |
3785 | export PATH | |
3786 | ||
3787 | exec \$program \${1+\"\$@\"} | |
3788 | " | |
3789 | ;; | |
3790 | esac | |
3791 | $echo >> $output "\ | |
3792 | \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" | |
3793 | exit 1 | |
3794 | fi | |
3795 | else | |
3796 | # The program doesn't exist. | |
3797 | \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 | |
3798 | \$echo \"This script is just a wrapper for \$program.\" 1>&2 | |
3799 | echo \"See the $PACKAGE documentation for more information.\" 1>&2 | |
3800 | exit 1 | |
3801 | fi | |
3802 | fi\ | |
3803 | " | |
3804 | chmod +x $output | |
3805 | fi | |
3806 | exit 0 | |
3807 | ;; | |
3808 | esac | |
3809 | ||
3810 | # See if we need to build an old-fashioned archive. | |
3811 | for oldlib in $oldlibs; do | |
3812 | ||
3813 | if test "$build_libtool_libs" = convenience; then | |
3814 | oldobjs="$libobjs_save" | |
3815 | addlibs="$convenience" | |
3816 | build_libtool_libs=no | |
3817 | else | |
3818 | if test "$build_libtool_libs" = module; then | |
3819 | oldobjs="$libobjs_save" | |
3820 | build_libtool_libs=no | |
3821 | else | |
6cf86f7f | 3822 | oldobjs="$objs$old_deplibs $non_pic_objects" |
252b5132 RH |
3823 | fi |
3824 | addlibs="$old_convenience" | |
3825 | fi | |
3826 | ||
2031769e ILT |
3827 | if test -n "$addlibs"; then |
3828 | gentop="$output_objdir/${outputname}x" | |
3829 | $show "${rm}r $gentop" | |
3830 | $run ${rm}r "$gentop" | |
6cf86f7f AO |
3831 | $show "$mkdir $gentop" |
3832 | $run $mkdir "$gentop" | |
252b5132 | 3833 | status=$? |
2031769e | 3834 | if test $status -ne 0 && test ! -d "$gentop"; then |
252b5132 RH |
3835 | exit $status |
3836 | fi | |
2031769e | 3837 | generated="$generated $gentop" |
6cf86f7f | 3838 | |
2031769e ILT |
3839 | # Add in members from convenience archives. |
3840 | for xlib in $addlibs; do | |
3841 | # Extract the objects. | |
3842 | case "$xlib" in | |
3843 | [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; | |
3844 | *) xabs=`pwd`"/$xlib" ;; | |
3845 | esac | |
3846 | xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` | |
3847 | xdir="$gentop/$xlib" | |
252b5132 | 3848 | |
2031769e ILT |
3849 | $show "${rm}r $xdir" |
3850 | $run ${rm}r "$xdir" | |
6cf86f7f AO |
3851 | $show "$mkdir $xdir" |
3852 | $run $mkdir "$xdir" | |
2031769e ILT |
3853 | status=$? |
3854 | if test $status -ne 0 && test ! -d "$xdir"; then | |
3855 | exit $status | |
3856 | fi | |
3857 | $show "(cd $xdir && $AR x $xabs)" | |
3858 | $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? | |
3859 | ||
6cf86f7f | 3860 | oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP` |
2031769e ILT |
3861 | done |
3862 | fi | |
252b5132 RH |
3863 | |
3864 | # Do each command in the archive commands. | |
3865 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then | |
3866 | eval cmds=\"$old_archive_from_new_cmds\" | |
3867 | else | |
6cf86f7f AO |
3868 | # # Ensure that we have .o objects in place in case we decided |
3869 | # # not to build a shared library, and have fallen back to building | |
3870 | # # static libs even though --disable-static was passed! | |
3871 | # for oldobj in $oldobjs; do | |
3872 | # if test ! -f $oldobj; then | |
3873 | # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` | |
3874 | # if test "X$xdir" = "X$oldobj"; then | |
3875 | # xdir="." | |
3876 | # else | |
3877 | # xdir="$xdir" | |
3878 | # fi | |
3879 | # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` | |
3880 | # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` | |
3881 | # $show "(cd $xdir && ${LN_S} $obj $baseobj)" | |
3882 | # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? | |
3883 | # fi | |
3884 | # done | |
2031769e | 3885 | |
252b5132 RH |
3886 | eval cmds=\"$old_archive_cmds\" |
3887 | fi | |
3888 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3889 | for cmd in $cmds; do | |
3890 | IFS="$save_ifs" | |
3891 | $show "$cmd" | |
3892 | $run eval "$cmd" || exit $? | |
3893 | done | |
3894 | IFS="$save_ifs" | |
3895 | done | |
3896 | ||
3897 | if test -n "$generated"; then | |
3898 | $show "${rm}r$generated" | |
3899 | $run ${rm}r$generated | |
3900 | fi | |
3901 | ||
3902 | # Now create the libtool archive. | |
3903 | case "$output" in | |
3904 | *.la) | |
3905 | old_library= | |
3906 | test "$build_old_libs" = yes && old_library="$libname.$libext" | |
3907 | $show "creating $output" | |
3908 | ||
6cf86f7f AO |
3909 | # Preserve any variables that may affect compiler behavior |
3910 | for var in $variables_saved_for_relink; do | |
3911 | eval var_value=\$$var | |
3912 | var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` | |
3913 | relink_command="$var=\"$var_value\"; export $var; $relink_command" | |
3914 | done | |
3915 | # Quote the link command for shipping. | |
3916 | relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" | |
3917 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` | |
252b5132 RH |
3918 | |
3919 | # Only create the output if not a dry run. | |
3920 | if test -z "$run"; then | |
2031769e ILT |
3921 | for installed in no yes; do |
3922 | if test "$installed" = yes; then | |
3923 | if test -z "$install_libdir"; then | |
3924 | break | |
3925 | fi | |
3926 | output="$output_objdir/$outputname"i | |
6cf86f7f AO |
3927 | # Replace all uninstalled libtool libraries with the installed ones |
3928 | newdependency_libs= | |
3929 | for deplib in $dependency_libs; do | |
3930 | case "$deplib" in | |
3931 | *.la) | |
3932 | name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` | |
3933 | eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` | |
3934 | if test -z "$libdir"; then | |
3935 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 | |
3936 | exit 1 | |
3937 | fi | |
3938 | newdependency_libs="$newdependency_libs $libdir/$name" | |
3939 | ;; | |
3940 | *) newdependency_libs="$newdependency_libs $deplib" ;; | |
3941 | esac | |
3942 | done | |
3943 | dependency_libs="$newdependency_libs" | |
3944 | newdlfiles= | |
3945 | for lib in $dlfiles; do | |
3946 | name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` | |
3947 | eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` | |
3948 | if test -z "$libdir"; then | |
3949 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 | |
3950 | exit 1 | |
3951 | fi | |
3952 | newdlfiles="$newdlfiles $libdir/$name" | |
3953 | done | |
3954 | dlfiles="$newdlfiles" | |
3955 | newdlprefiles= | |
3956 | for lib in $dlprefiles; do | |
3957 | name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` | |
3958 | eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` | |
3959 | if test -z "$libdir"; then | |
3960 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 | |
3961 | exit 1 | |
3962 | fi | |
3963 | newdlprefiles="$newdlprefiles $libdir/$name" | |
3964 | done | |
3965 | dlprefiles="$newdlprefiles" | |
2031769e ILT |
3966 | fi |
3967 | $rm $output | |
3968 | $echo > $output "\ | |
3969 | # $outputname - a libtool library file | |
252b5132 | 3970 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
2031769e ILT |
3971 | # |
3972 | # Please DO NOT delete this file! | |
3973 | # It is necessary for linking the library. | |
252b5132 RH |
3974 | |
3975 | # The name that we can dlopen(3). | |
3976 | dlname='$dlname' | |
3977 | ||
3978 | # Names of this library. | |
3979 | library_names='$library_names' | |
3980 | ||
3981 | # The name of the static archive. | |
3982 | old_library='$old_library' | |
3983 | ||
3984 | # Libraries that this one depends upon. | |
3985 | dependency_libs='$dependency_libs' | |
3986 | ||
3987 | # Version information for $libname. | |
3988 | current=$current | |
3989 | age=$age | |
3990 | revision=$revision | |
3991 | ||
3992 | # Is this an already installed library? | |
2031769e | 3993 | installed=$installed |
252b5132 | 3994 | |
6cf86f7f AO |
3995 | # Files to dlopen/dlpreopen |
3996 | dlopen='$dlfiles' | |
3997 | dlpreopen='$dlprefiles' | |
3998 | ||
252b5132 | 3999 | # Directory that this library needs to be installed in: |
6cf86f7f AO |
4000 | libdir='$install_libdir'" |
4001 | if test $hardcode_into_libs = all && | |
4002 | test "$installed" = no && test $need_relink = yes; then | |
4003 | $echo >> $output "\ | |
4004 | relink_command=\"$relink_command\"" | |
4005 | fi | |
2031769e | 4006 | done |
252b5132 RH |
4007 | fi |
4008 | ||
4009 | # Do a symbolic link so that the libtool archive can be found in | |
4010 | # LD_LIBRARY_PATH before the program is installed. | |
4011 | $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" | |
6cf86f7f | 4012 | $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? |
252b5132 RH |
4013 | ;; |
4014 | esac | |
4015 | exit 0 | |
4016 | ;; | |
4017 | ||
4018 | # libtool install mode | |
4019 | install) | |
4020 | modename="$modename: install" | |
4021 | ||
4022 | # There may be an optional sh(1) argument at the beginning of | |
4023 | # install_prog (especially on Windows NT). | |
6cf86f7f AO |
4024 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
4025 | # Allow the use of GNU shtool's install command. | |
4026 | $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then | |
252b5132 RH |
4027 | # Aesthetically quote it. |
4028 | arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` | |
4029 | case "$arg" in | |
4030 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) | |
4031 | arg="\"$arg\"" | |
4032 | ;; | |
4033 | esac | |
4034 | install_prog="$arg " | |
4035 | arg="$1" | |
4036 | shift | |
4037 | else | |
4038 | install_prog= | |
4039 | arg="$nonopt" | |
4040 | fi | |
4041 | ||
4042 | # The real first argument should be the name of the installation program. | |
4043 | # Aesthetically quote it. | |
4044 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
4045 | case "$arg" in | |
4046 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) | |
4047 | arg="\"$arg\"" | |
4048 | ;; | |
4049 | esac | |
4050 | install_prog="$install_prog$arg" | |
4051 | ||
4052 | # We need to accept at least all the BSD install flags. | |
4053 | dest= | |
4054 | files= | |
4055 | opts= | |
4056 | prev= | |
4057 | install_type= | |
4058 | isdir=no | |
4059 | stripme= | |
4060 | for arg | |
4061 | do | |
4062 | if test -n "$dest"; then | |
4063 | files="$files $dest" | |
4064 | dest="$arg" | |
4065 | continue | |
4066 | fi | |
4067 | ||
4068 | case "$arg" in | |
4069 | -d) isdir=yes ;; | |
4070 | -f) prev="-f" ;; | |
4071 | -g) prev="-g" ;; | |
4072 | -m) prev="-m" ;; | |
4073 | -o) prev="-o" ;; | |
4074 | -s) | |
4075 | stripme=" -s" | |
4076 | continue | |
4077 | ;; | |
4078 | -*) ;; | |
4079 | ||
4080 | *) | |
4081 | # If the previous option needed an argument, then skip it. | |
4082 | if test -n "$prev"; then | |
4083 | prev= | |
4084 | else | |
4085 | dest="$arg" | |
4086 | continue | |
4087 | fi | |
4088 | ;; | |
4089 | esac | |
4090 | ||
4091 | # Aesthetically quote the argument. | |
4092 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
4093 | case "$arg" in | |
4094 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) | |
4095 | arg="\"$arg\"" | |
4096 | ;; | |
4097 | esac | |
4098 | install_prog="$install_prog $arg" | |
4099 | done | |
4100 | ||
4101 | if test -z "$install_prog"; then | |
4102 | $echo "$modename: you must specify an install program" 1>&2 | |
4103 | $echo "$help" 1>&2 | |
4104 | exit 1 | |
4105 | fi | |
4106 | ||
4107 | if test -n "$prev"; then | |
4108 | $echo "$modename: the \`$prev' option requires an argument" 1>&2 | |
4109 | $echo "$help" 1>&2 | |
4110 | exit 1 | |
4111 | fi | |
4112 | ||
4113 | if test -z "$files"; then | |
4114 | if test -z "$dest"; then | |
4115 | $echo "$modename: no file or destination specified" 1>&2 | |
4116 | else | |
4117 | $echo "$modename: you must specify a destination" 1>&2 | |
4118 | fi | |
4119 | $echo "$help" 1>&2 | |
4120 | exit 1 | |
4121 | fi | |
4122 | ||
4123 | # Strip any trailing slash from the destination. | |
4124 | dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` | |
4125 | ||
4126 | # Check to see that the destination is a directory. | |
4127 | test -d "$dest" && isdir=yes | |
4128 | if test "$isdir" = yes; then | |
4129 | destdir="$dest" | |
4130 | destname= | |
4131 | else | |
4132 | destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` | |
4133 | test "X$destdir" = "X$dest" && destdir=. | |
4134 | destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` | |
4135 | ||
4136 | # Not a directory, so check to see that there is only one file specified. | |
4137 | set dummy $files | |
4138 | if test $# -gt 2; then | |
4139 | $echo "$modename: \`$dest' is not a directory" 1>&2 | |
4140 | $echo "$help" 1>&2 | |
4141 | exit 1 | |
4142 | fi | |
4143 | fi | |
4144 | case "$destdir" in | |
2031769e | 4145 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
252b5132 RH |
4146 | *) |
4147 | for file in $files; do | |
4148 | case "$file" in | |
4149 | *.lo) ;; | |
4150 | *) | |
4151 | $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 | |
4152 | $echo "$help" 1>&2 | |
4153 | exit 1 | |
4154 | ;; | |
4155 | esac | |
4156 | done | |
4157 | ;; | |
4158 | esac | |
4159 | ||
4160 | # This variable tells wrapper scripts just to set variables rather | |
4161 | # than running their programs. | |
4162 | libtool_install_magic="$magic" | |
4163 | ||
4164 | staticlibs= | |
4165 | future_libdirs= | |
4166 | current_libdirs= | |
4167 | for file in $files; do | |
4168 | ||
4169 | # Do each installation. | |
4170 | case "$file" in | |
6cf86f7f | 4171 | *.$libext) |
252b5132 RH |
4172 | # Do the static libraries later. |
4173 | staticlibs="$staticlibs $file" | |
4174 | ;; | |
4175 | ||
4176 | *.la) | |
4177 | # Check to see that this really is a libtool archive. | |
4178 | if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : | |
4179 | else | |
4180 | $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 | |
4181 | $echo "$help" 1>&2 | |
4182 | exit 1 | |
4183 | fi | |
4184 | ||
4185 | library_names= | |
4186 | old_library= | |
6cf86f7f | 4187 | relink_command= |
252b5132 RH |
4188 | # If there is no directory component, then add one. |
4189 | case "$file" in | |
4190 | */* | *\\*) . $file ;; | |
4191 | *) . ./$file ;; | |
4192 | esac | |
4193 | ||
4194 | # Add the libdir to current_libdirs if it is the destination. | |
4195 | if test "X$destdir" = "X$libdir"; then | |
4196 | case "$current_libdirs " in | |
4197 | *" $libdir "*) ;; | |
4198 | *) current_libdirs="$current_libdirs $libdir" ;; | |
4199 | esac | |
4200 | else | |
4201 | # Note the libdir as a future libdir. | |
4202 | case "$future_libdirs " in | |
4203 | *" $libdir "*) ;; | |
4204 | *) future_libdirs="$future_libdirs $libdir" ;; | |
4205 | esac | |
4206 | fi | |
4207 | ||
6cf86f7f | 4208 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ |
252b5132 RH |
4209 | test "X$dir" = "X$file/" && dir= |
4210 | dir="$dir$objdir" | |
4211 | ||
6cf86f7f AO |
4212 | if test "$hardcode_into_libs" = all && test -n "$relink_command"; then |
4213 | $echo "$modename: warning: relinking \`$file'" 1>&2 | |
4214 | $show "$relink_command" | |
4215 | if $run eval "$relink_command"; then : | |
4216 | else | |
4217 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 | |
4218 | continue | |
4219 | fi | |
4220 | fi | |
4221 | ||
252b5132 RH |
4222 | # See the names of the shared library. |
4223 | set dummy $library_names | |
4224 | if test -n "$2"; then | |
4225 | realname="$2" | |
4226 | shift | |
4227 | shift | |
4228 | ||
6cf86f7f AO |
4229 | srcname="$realname" |
4230 | test "$hardcode_into_libs" = all && test -n "$relink_command" && srcname="$realname"T | |
4231 | ||
252b5132 | 4232 | # Install the shared library and build the symlinks. |
6cf86f7f AO |
4233 | $show "$install_prog $dir/$srcname $destdir/$realname" |
4234 | $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? | |
4235 | if test -n "$stripme" && test -n "$striplib"; then | |
4236 | $show "$striplib $destdir/$realname" | |
4237 | $run eval "$striplib $destdir/$realname" || exit $? | |
4238 | fi | |
252b5132 RH |
4239 | |
4240 | if test $# -gt 0; then | |
4241 | # Delete the old symlinks, and create new ones. | |
4242 | for linkname | |
4243 | do | |
252b5132 RH |
4244 | if test "$linkname" != "$realname"; then |
4245 | $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" | |
4246 | $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" | |
4247 | fi | |
4248 | done | |
4249 | fi | |
4250 | ||
252b5132 RH |
4251 | # Do each command in the postinstall commands. |
4252 | lib="$destdir/$realname" | |
4253 | eval cmds=\"$postinstall_cmds\" | |
4254 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
4255 | for cmd in $cmds; do | |
4256 | IFS="$save_ifs" | |
4257 | $show "$cmd" | |
4258 | $run eval "$cmd" || exit $? | |
4259 | done | |
4260 | IFS="$save_ifs" | |
4261 | fi | |
4262 | ||
4263 | # Install the pseudo-library for information purposes. | |
4264 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
4265 | instname="$dir/$name"i | |
252b5132 RH |
4266 | $show "$install_prog $instname $destdir/$name" |
4267 | $run eval "$install_prog $instname $destdir/$name" || exit $? | |
4268 | ||
4269 | # Maybe install the static library, too. | |
4270 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" | |
4271 | ;; | |
4272 | ||
4273 | *.lo) | |
4274 | # Install (i.e. copy) a libtool object. | |
4275 | ||
4276 | # Figure out destination file name, if it wasn't already specified. | |
4277 | if test -n "$destname"; then | |
4278 | destfile="$destdir/$destname" | |
4279 | else | |
4280 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
4281 | destfile="$destdir/$destfile" | |
4282 | fi | |
4283 | ||
4284 | # Deduce the name of the destination old-style object file. | |
4285 | case "$destfile" in | |
4286 | *.lo) | |
4287 | staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` | |
4288 | ;; | |
6cf86f7f | 4289 | *.$objext) |
252b5132 RH |
4290 | staticdest="$destfile" |
4291 | destfile= | |
4292 | ;; | |
4293 | *) | |
4294 | $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 | |
4295 | $echo "$help" 1>&2 | |
4296 | exit 1 | |
4297 | ;; | |
4298 | esac | |
4299 | ||
4300 | # Install the libtool object if requested. | |
4301 | if test -n "$destfile"; then | |
4302 | $show "$install_prog $file $destfile" | |
4303 | $run eval "$install_prog $file $destfile" || exit $? | |
4304 | fi | |
4305 | ||
4306 | # Install the old object if enabled. | |
4307 | if test "$build_old_libs" = yes; then | |
4308 | # Deduce the name of the old-style object file. | |
4309 | staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` | |
4310 | ||
4311 | $show "$install_prog $staticobj $staticdest" | |
4312 | $run eval "$install_prog \$staticobj \$staticdest" || exit $? | |
4313 | fi | |
4314 | exit 0 | |
4315 | ;; | |
4316 | ||
4317 | *) | |
4318 | # Figure out destination file name, if it wasn't already specified. | |
4319 | if test -n "$destname"; then | |
4320 | destfile="$destdir/$destname" | |
4321 | else | |
4322 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
4323 | destfile="$destdir/$destfile" | |
4324 | fi | |
4325 | ||
4326 | # Do a test to see if this is really a libtool program. | |
4327 | if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
6cf86f7f | 4328 | uninst_deplibs= |
252b5132 RH |
4329 | relink_command= |
4330 | ||
4331 | # If there is no directory component, then add one. | |
4332 | case "$file" in | |
4333 | */* | *\\*) . $file ;; | |
4334 | *) . ./$file ;; | |
4335 | esac | |
4336 | ||
4337 | # Check the variables that should have been set. | |
6cf86f7f | 4338 | if test -z "$uninst_deplibs"; then |
252b5132 RH |
4339 | $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 |
4340 | exit 1 | |
4341 | fi | |
4342 | ||
4343 | finalize=yes | |
6cf86f7f | 4344 | for lib in $uninst_deplibs; do |
252b5132 RH |
4345 | # Check to see that each library is installed. |
4346 | libdir= | |
4347 | if test -f "$lib"; then | |
4348 | # If there is no directory component, then add one. | |
4349 | case "$lib" in | |
4350 | */* | *\\*) . $lib ;; | |
4351 | *) . ./$lib ;; | |
4352 | esac | |
4353 | fi | |
6cf86f7f | 4354 | libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test |
252b5132 RH |
4355 | if test -n "$libdir" && test ! -f "$libfile"; then |
4356 | $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 | |
4357 | finalize=no | |
4358 | fi | |
4359 | done | |
4360 | ||
6cf86f7f AO |
4361 | relink_command= |
4362 | # If there is no directory component, then add one. | |
4363 | case "$file" in | |
4364 | */* | *\\*) . $file ;; | |
4365 | *) . ./$file ;; | |
4366 | esac | |
4367 | ||
252b5132 RH |
4368 | outputname= |
4369 | if test "$fast_install" = no && test -n "$relink_command"; then | |
2031769e ILT |
4370 | if test "$finalize" = yes && test -z "$run"; then |
4371 | tmpdir="/tmp" | |
4372 | test -n "$TMPDIR" && tmpdir="$TMPDIR" | |
4373 | tmpdir="$tmpdir/libtool-$$" | |
4374 | if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : | |
4375 | else | |
4376 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 | |
4377 | continue | |
4378 | fi | |
6cf86f7f | 4379 | file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
2031769e | 4380 | outputname="$tmpdir/$file" |
252b5132 RH |
4381 | # Replace the output file specification. |
4382 | relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` | |
4383 | ||
252b5132 RH |
4384 | $show "$relink_command" |
4385 | if $run eval "$relink_command"; then : | |
4386 | else | |
4387 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 | |
2031769e | 4388 | ${rm}r "$tmpdir" |
252b5132 RH |
4389 | continue |
4390 | fi | |
4391 | file="$outputname" | |
4392 | else | |
2031769e | 4393 | $echo "$modename: warning: cannot relink \`$file'" 1>&2 |
252b5132 RH |
4394 | fi |
4395 | else | |
4396 | # Install the binary that we compiled earlier. | |
4397 | file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` | |
4398 | fi | |
4399 | fi | |
4400 | ||
4401 | $show "$install_prog$stripme $file $destfile" | |
4402 | $run eval "$install_prog\$stripme \$file \$destfile" || exit $? | |
2031769e | 4403 | test -n "$outputname" && ${rm}r "$tmpdir" |
252b5132 RH |
4404 | ;; |
4405 | esac | |
4406 | done | |
4407 | ||
4408 | for file in $staticlibs; do | |
4409 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
4410 | ||
4411 | # Set up the ranlib parameters. | |
4412 | oldlib="$destdir/$name" | |
4413 | ||
4414 | $show "$install_prog $file $oldlib" | |
4415 | $run eval "$install_prog \$file \$oldlib" || exit $? | |
4416 | ||
6cf86f7f AO |
4417 | if test -n "$stripme" && test -n "$striplib"; then |
4418 | $show "$old_striplib $oldlib" | |
4419 | $run eval "$old_striplib $oldlib" || exit $? | |
4420 | fi | |
4421 | ||
252b5132 RH |
4422 | # Do each command in the postinstall commands. |
4423 | eval cmds=\"$old_postinstall_cmds\" | |
4424 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
4425 | for cmd in $cmds; do | |
4426 | IFS="$save_ifs" | |
4427 | $show "$cmd" | |
4428 | $run eval "$cmd" || exit $? | |
4429 | done | |
4430 | IFS="$save_ifs" | |
4431 | done | |
4432 | ||
4433 | if test -n "$future_libdirs"; then | |
4434 | $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 | |
4435 | fi | |
4436 | ||
4437 | if test -n "$current_libdirs"; then | |
4438 | # Maybe just do a dry run. | |
4439 | test -n "$run" && current_libdirs=" -n$current_libdirs" | |
4440 | exec $SHELL $0 --finish$current_libdirs | |
4441 | exit 1 | |
4442 | fi | |
4443 | ||
4444 | exit 0 | |
4445 | ;; | |
4446 | ||
4447 | # libtool finish mode | |
4448 | finish) | |
4449 | modename="$modename: finish" | |
4450 | libdirs="$nonopt" | |
4451 | admincmds= | |
4452 | ||
4453 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then | |
4454 | for dir | |
4455 | do | |
4456 | libdirs="$libdirs $dir" | |
4457 | done | |
4458 | ||
4459 | for libdir in $libdirs; do | |
4460 | if test -n "$finish_cmds"; then | |
4461 | # Do each command in the finish commands. | |
4462 | eval cmds=\"$finish_cmds\" | |
4463 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
4464 | for cmd in $cmds; do | |
4465 | IFS="$save_ifs" | |
4466 | $show "$cmd" | |
4467 | $run eval "$cmd" || admincmds="$admincmds | |
4468 | $cmd" | |
4469 | done | |
4470 | IFS="$save_ifs" | |
4471 | fi | |
4472 | if test -n "$finish_eval"; then | |
4473 | # Do the single finish_eval. | |
4474 | eval cmds=\"$finish_eval\" | |
4475 | $run eval "$cmds" || admincmds="$admincmds | |
4476 | $cmds" | |
4477 | fi | |
4478 | done | |
4479 | fi | |
4480 | ||
4481 | # Exit here if they wanted silent mode. | |
4482 | test "$show" = : && exit 0 | |
4483 | ||
4484 | echo "----------------------------------------------------------------------" | |
4485 | echo "Libraries have been installed in:" | |
4486 | for libdir in $libdirs; do | |
4487 | echo " $libdir" | |
4488 | done | |
4489 | echo | |
4490 | echo "If you ever happen to want to link against installed libraries" | |
4491 | echo "in a given directory, LIBDIR, you must either use libtool, and" | |
4492 | echo "specify the full pathname of the library, or use \`-LLIBDIR'" | |
4493 | echo "flag during linking and do at least one of the following:" | |
4494 | if test -n "$shlibpath_var"; then | |
4495 | echo " - add LIBDIR to the \`$shlibpath_var' environment variable" | |
4496 | echo " during execution" | |
4497 | fi | |
4498 | if test -n "$runpath_var"; then | |
4499 | echo " - add LIBDIR to the \`$runpath_var' environment variable" | |
4500 | echo " during linking" | |
4501 | fi | |
4502 | if test -n "$hardcode_libdir_flag_spec"; then | |
4503 | libdir=LIBDIR | |
4504 | eval flag=\"$hardcode_libdir_flag_spec\" | |
4505 | ||
4506 | echo " - use the \`$flag' linker flag" | |
4507 | fi | |
4508 | if test -n "$admincmds"; then | |
4509 | echo " - have your system administrator run these commands:$admincmds" | |
4510 | fi | |
4511 | if test -f /etc/ld.so.conf; then | |
4512 | echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" | |
4513 | fi | |
4514 | echo | |
4515 | echo "See any operating system documentation about shared libraries for" | |
4516 | echo "more information, such as the ld(1) and ld.so(8) manual pages." | |
4517 | echo "----------------------------------------------------------------------" | |
4518 | exit 0 | |
4519 | ;; | |
4520 | ||
4521 | # libtool execute mode | |
4522 | execute) | |
4523 | modename="$modename: execute" | |
4524 | ||
4525 | # The first argument is the command name. | |
4526 | cmd="$nonopt" | |
4527 | if test -z "$cmd"; then | |
4528 | $echo "$modename: you must specify a COMMAND" 1>&2 | |
4529 | $echo "$help" | |
4530 | exit 1 | |
4531 | fi | |
4532 | ||
4533 | # Handle -dlopen flags immediately. | |
4534 | for file in $execute_dlfiles; do | |
4535 | if test ! -f "$file"; then | |
4536 | $echo "$modename: \`$file' is not a file" 1>&2 | |
4537 | $echo "$help" 1>&2 | |
4538 | exit 1 | |
4539 | fi | |
4540 | ||
4541 | dir= | |
4542 | case "$file" in | |
4543 | *.la) | |
4544 | # Check to see that this really is a libtool archive. | |
4545 | if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : | |
4546 | else | |
4547 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 | |
4548 | $echo "$help" 1>&2 | |
4549 | exit 1 | |
4550 | fi | |
4551 | ||
4552 | # Read the libtool library. | |
4553 | dlname= | |
4554 | library_names= | |
4555 | ||
4556 | # If there is no directory component, then add one. | |
4557 | case "$file" in | |
4558 | */* | *\\*) . $file ;; | |
4559 | *) . ./$file ;; | |
4560 | esac | |
4561 | ||
4562 | # Skip this library if it cannot be dlopened. | |
4563 | if test -z "$dlname"; then | |
4564 | # Warn if it was a shared library. | |
4565 | test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" | |
4566 | continue | |
4567 | fi | |
4568 | ||
4569 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` | |
4570 | test "X$dir" = "X$file" && dir=. | |
4571 | ||
4572 | if test -f "$dir/$objdir/$dlname"; then | |
4573 | dir="$dir/$objdir" | |
4574 | else | |
4575 | $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 | |
4576 | exit 1 | |
4577 | fi | |
4578 | ;; | |
4579 | ||
4580 | *.lo) | |
4581 | # Just add the directory containing the .lo file. | |
4582 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` | |
4583 | test "X$dir" = "X$file" && dir=. | |
4584 | ;; | |
4585 | ||
4586 | *) | |
4587 | $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 | |
4588 | continue | |
4589 | ;; | |
4590 | esac | |
4591 | ||
4592 | # Get the absolute pathname. | |
4593 | absdir=`cd "$dir" && pwd` | |
4594 | test -n "$absdir" && dir="$absdir" | |
4595 | ||
4596 | # Now add the directory to shlibpath_var. | |
4597 | if eval "test -z \"\$$shlibpath_var\""; then | |
4598 | eval "$shlibpath_var=\"\$dir\"" | |
4599 | else | |
4600 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" | |
4601 | fi | |
4602 | done | |
4603 | ||
4604 | # This variable tells wrapper scripts just to set shlibpath_var | |
4605 | # rather than running their programs. | |
4606 | libtool_execute_magic="$magic" | |
4607 | ||
4608 | # Check if any of the arguments is a wrapper script. | |
4609 | args= | |
4610 | for file | |
4611 | do | |
4612 | case "$file" in | |
4613 | -*) ;; | |
4614 | *) | |
4615 | # Do a test to see if this is really a libtool program. | |
4616 | if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
4617 | # If there is no directory component, then add one. | |
4618 | case "$file" in | |
4619 | */* | *\\*) . $file ;; | |
4620 | *) . ./$file ;; | |
4621 | esac | |
4622 | ||
4623 | # Transform arg to wrapped name. | |
4624 | file="$progdir/$program" | |
4625 | fi | |
4626 | ;; | |
4627 | esac | |
4628 | # Quote arguments (to preserve shell metacharacters). | |
4629 | file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` | |
4630 | args="$args \"$file\"" | |
4631 | done | |
4632 | ||
4633 | if test -z "$run"; then | |
2031769e | 4634 | if test -n "$shlibpath_var"; then |
6cf86f7f AO |
4635 | # Export the shlibpath_var. |
4636 | eval "export $shlibpath_var" | |
2031769e | 4637 | fi |
252b5132 RH |
4638 | |
4639 | # Restore saved enviroment variables | |
4640 | if test "${save_LC_ALL+set}" = set; then | |
4641 | LC_ALL="$save_LC_ALL"; export LC_ALL | |
4642 | fi | |
4643 | if test "${save_LANG+set}" = set; then | |
4644 | LANG="$save_LANG"; export LANG | |
4645 | fi | |
4646 | ||
4647 | # Now actually exec the command. | |
4648 | eval "exec \$cmd$args" | |
4649 | ||
4650 | $echo "$modename: cannot exec \$cmd$args" | |
4651 | exit 1 | |
4652 | else | |
4653 | # Display what would be done. | |
2031769e | 4654 | if test -n "$shlibpath_var"; then |
6cf86f7f AO |
4655 | eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" |
4656 | $echo "export $shlibpath_var" | |
2031769e | 4657 | fi |
252b5132 RH |
4658 | $echo "$cmd$args" |
4659 | exit 0 | |
4660 | fi | |
4661 | ;; | |
4662 | ||
6cf86f7f AO |
4663 | # libtool clean and uninstall mode |
4664 | clean | uninstall) | |
4665 | modename="$modename: $mode" | |
252b5132 RH |
4666 | rm="$nonopt" |
4667 | files= | |
4668 | ||
6cf86f7f AO |
4669 | # This variable tells wrapper scripts just to set variables rather |
4670 | # than running their programs. | |
4671 | libtool_install_magic="$magic" | |
4672 | ||
252b5132 RH |
4673 | for arg |
4674 | do | |
4675 | case "$arg" in | |
4676 | -*) rm="$rm $arg" ;; | |
4677 | *) files="$files $arg" ;; | |
4678 | esac | |
4679 | done | |
4680 | ||
4681 | if test -z "$rm"; then | |
4682 | $echo "$modename: you must specify an RM program" 1>&2 | |
4683 | $echo "$help" 1>&2 | |
4684 | exit 1 | |
4685 | fi | |
4686 | ||
4687 | for file in $files; do | |
4688 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` | |
6cf86f7f AO |
4689 | if test "X$dir" = "X$file"; then |
4690 | dir=. | |
4691 | objdir="$objdir" | |
4692 | else | |
4693 | objdir="$dir/$objdir" | |
4694 | fi | |
252b5132 | 4695 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
6cf86f7f | 4696 | test $mode = uninstall && objdir="$dir" |
252b5132 RH |
4697 | |
4698 | rmfiles="$file" | |
4699 | ||
4700 | case "$name" in | |
4701 | *.la) | |
4702 | # Possibly a libtool archive, so verify it. | |
4703 | if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
4704 | . $dir/$name | |
4705 | ||
4706 | # Delete the libtool libraries and symlinks. | |
4707 | for n in $library_names; do | |
6cf86f7f | 4708 | rmfiles="$rmfiles $objdir/$n" |
252b5132 | 4709 | done |
6cf86f7f AO |
4710 | test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" |
4711 | test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" | |
4712 | ||
4713 | if test $mode = uninstall; then | |
4714 | if test -n "$library_names"; then | |
4715 | # Do each command in the postuninstall commands. | |
4716 | eval cmds=\"$postuninstall_cmds\" | |
4717 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
4718 | for cmd in $cmds; do | |
4719 | IFS="$save_ifs" | |
4720 | $show "$cmd" | |
4721 | $run eval "$cmd" | |
4722 | done | |
252b5132 | 4723 | IFS="$save_ifs" |
6cf86f7f | 4724 | fi |
252b5132 | 4725 | |
6cf86f7f AO |
4726 | if test -n "$old_library"; then |
4727 | # Do each command in the old_postuninstall commands. | |
4728 | eval cmds=\"$old_postuninstall_cmds\" | |
4729 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
4730 | for cmd in $cmds; do | |
4731 | IFS="$save_ifs" | |
4732 | $show "$cmd" | |
4733 | $run eval "$cmd" | |
4734 | done | |
252b5132 | 4735 | IFS="$save_ifs" |
6cf86f7f AO |
4736 | fi |
4737 | # FIXME: should reinstall the best remaining shared library. | |
252b5132 | 4738 | fi |
252b5132 RH |
4739 | fi |
4740 | ;; | |
4741 | ||
4742 | *.lo) | |
6cf86f7f AO |
4743 | # Possibly a libtool object, so verify it. |
4744 | if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
4745 | ||
4746 | # Read the .lo file | |
4747 | . ./$file | |
4748 | ||
4749 | # Add PIC object to the list of files to remove. | |
4750 | if test -n "$pic_object" \ | |
4751 | && test "$pic_object" != none; then | |
4752 | rmfiles="$rmfiles $dir/$pic_object" | |
4753 | fi | |
4754 | ||
4755 | # Add non-PIC object to the list of files to remove. | |
4756 | if test -n "$non_pic_object" \ | |
4757 | && test "$non_pic_object" != none; then | |
4758 | rmfiles="$rmfiles $dir/$non_pic_object" | |
4759 | fi | |
252b5132 | 4760 | fi |
252b5132 RH |
4761 | ;; |
4762 | ||
4763 | *) | |
6cf86f7f AO |
4764 | # Do a test to see if this is a libtool program. |
4765 | if test $mode = clean && | |
4766 | (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
4767 | relink_command= | |
4768 | . $dir/$file | |
4769 | ||
4770 | rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" | |
4771 | if test "$fast_install" = yes && test -n "$relink_command"; then | |
4772 | rmfiles="$rmfiles $objdir/lt-$name" | |
4773 | fi | |
4774 | fi | |
252b5132 RH |
4775 | ;; |
4776 | esac | |
6cf86f7f AO |
4777 | $show "$rm $rmfiles" |
4778 | $run $rm $rmfiles | |
252b5132 RH |
4779 | done |
4780 | exit 0 | |
4781 | ;; | |
4782 | ||
4783 | "") | |
4784 | $echo "$modename: you must specify a MODE" 1>&2 | |
4785 | $echo "$generic_help" 1>&2 | |
4786 | exit 1 | |
4787 | ;; | |
4788 | esac | |
4789 | ||
4790 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 | |
4791 | $echo "$generic_help" 1>&2 | |
4792 | exit 1 | |
4793 | fi # test -z "$show_help" | |
4794 | ||
4795 | # We need to display help for each of the modes. | |
4796 | case "$mode" in | |
4797 | "") $echo \ | |
4798 | "Usage: $modename [OPTION]... [MODE-ARG]... | |
4799 | ||
4800 | Provide generalized library-building support services. | |
4801 | ||
4802 | --config show all configuration variables | |
4803 | --debug enable verbose shell tracing | |
4804 | -n, --dry-run display commands without modifying any files | |
4805 | --features display basic configuration information and exit | |
4806 | --finish same as \`--mode=finish' | |
4807 | --help display this help message and exit | |
4808 | --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] | |
4809 | --quiet same as \`--silent' | |
4810 | --silent don't print informational messages | |
6cf86f7f | 4811 | --tag=TAG use configuration variables from tag TAG |
252b5132 RH |
4812 | --version print version information |
4813 | ||
4814 | MODE must be one of the following: | |
4815 | ||
6cf86f7f | 4816 | clean remove files from the build directory |
252b5132 RH |
4817 | compile compile a source file into a libtool object |
4818 | execute automatically set library path, then run a program | |
4819 | finish complete the installation of libtool libraries | |
4820 | install install libraries or executables | |
4821 | link create a library or an executable | |
4822 | uninstall remove libraries from an installed directory | |
4823 | ||
4824 | MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for | |
4825 | a more detailed description of MODE." | |
4826 | exit 0 | |
4827 | ;; | |
4828 | ||
6cf86f7f AO |
4829 | clean) |
4830 | $echo \ | |
4831 | "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... | |
4832 | ||
4833 | Remove files from the build directory. | |
4834 | ||
4835 | RM is the name of the program to use to delete files associated with each FILE | |
4836 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | |
4837 | to RM. | |
4838 | ||
4839 | If FILE is a libtool library, object or program, all the files associated | |
4840 | with it are deleted. Otherwise, only FILE itself is deleted using RM." | |
4841 | ;; | |
4842 | ||
252b5132 RH |
4843 | compile) |
4844 | $echo \ | |
4845 | "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE | |
4846 | ||
4847 | Compile a source file into a libtool library object. | |
4848 | ||
4849 | This mode accepts the following additional options: | |
4850 | ||
4851 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE | |
4852 | -static always build a \`.o' file suitable for static linking | |
4853 | ||
4854 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file | |
4855 | from the given SOURCEFILE. | |
4856 | ||
4857 | The output file name is determined by removing the directory component from | |
4858 | SOURCEFILE, then substituting the C source code suffix \`.c' with the | |
4859 | library object suffix, \`.lo'." | |
4860 | ;; | |
4861 | ||
4862 | execute) | |
4863 | $echo \ | |
4864 | "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... | |
4865 | ||
4866 | Automatically set library path, then run a program. | |
4867 | ||
4868 | This mode accepts the following additional options: | |
4869 | ||
4870 | -dlopen FILE add the directory containing FILE to the library path | |
4871 | ||
4872 | This mode sets the library path environment variable according to \`-dlopen' | |
4873 | flags. | |
4874 | ||
4875 | If any of the ARGS are libtool executable wrappers, then they are translated | |
4876 | into their corresponding uninstalled binary, and any of their required library | |
4877 | directories are added to the library path. | |
4878 | ||
4879 | Then, COMMAND is executed, with ARGS as arguments." | |
4880 | ;; | |
4881 | ||
4882 | finish) | |
4883 | $echo \ | |
4884 | "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... | |
4885 | ||
4886 | Complete the installation of libtool libraries. | |
4887 | ||
4888 | Each LIBDIR is a directory that contains libtool libraries. | |
4889 | ||
4890 | The commands that this mode executes may require superuser privileges. Use | |
4891 | the \`--dry-run' option if you just want to see what would be executed." | |
4892 | ;; | |
4893 | ||
4894 | install) | |
4895 | $echo \ | |
4896 | "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... | |
4897 | ||
4898 | Install executables or libraries. | |
4899 | ||
4900 | INSTALL-COMMAND is the installation command. The first component should be | |
4901 | either the \`install' or \`cp' program. | |
4902 | ||
4903 | The rest of the components are interpreted as arguments to that command (only | |
4904 | BSD-compatible install options are recognized)." | |
4905 | ;; | |
4906 | ||
4907 | link) | |
4908 | $echo \ | |
4909 | "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... | |
4910 | ||
4911 | Link object files or libraries together to form another library, or to | |
4912 | create an executable program. | |
4913 | ||
4914 | LINK-COMMAND is a command using the C compiler that you would use to create | |
4915 | a program from several object files. | |
4916 | ||
4917 | The following components of LINK-COMMAND are treated specially: | |
4918 | ||
4919 | -all-static do not do any dynamic linking at all | |
4920 | -avoid-version do not add a version suffix if possible | |
4921 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime | |
4922 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols | |
4923 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) | |
4924 | -export-symbols SYMFILE | |
4925 | try to export only the symbols listed in SYMFILE | |
2031769e ILT |
4926 | -export-symbols-regex REGEX |
4927 | try to export only the symbols matching REGEX | |
252b5132 RH |
4928 | -LLIBDIR search LIBDIR for required installed libraries |
4929 | -lNAME OUTPUT-FILE requires the installed library libNAME | |
4930 | -module build a library that can dlopened | |
6cf86f7f AO |
4931 | -no-fast-install disable the fast-install mode |
4932 | -no-install link a not-installable executable | |
252b5132 RH |
4933 | -no-undefined declare that a library does not refer to external symbols |
4934 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects | |
4935 | -release RELEASE specify package release information | |
4936 | -rpath LIBDIR the created library will eventually be installed in LIBDIR | |
4937 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries | |
4938 | -static do not do any dynamic linking of libtool libraries | |
4939 | -version-info CURRENT[:REVISION[:AGE]] | |
4940 | specify library version info [each variable defaults to 0] | |
4941 | ||
4942 | All other options (arguments beginning with \`-') are ignored. | |
4943 | ||
4944 | Every other argument is treated as a filename. Files ending in \`.la' are | |
4945 | treated as uninstalled libtool libraries, other files are standard or library | |
4946 | object files. | |
4947 | ||
4948 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, | |
4949 | only library objects (\`.lo' files) may be specified, and \`-rpath' is | |
4950 | required, except when creating a convenience library. | |
4951 | ||
4952 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created | |
4953 | using \`ar' and \`ranlib', or on Windows using \`lib'. | |
4954 | ||
4955 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file | |
4956 | is created, otherwise an executable program is created." | |
4957 | ;; | |
4958 | ||
4959 | uninstall) | |
2031769e | 4960 | $echo \ |
252b5132 RH |
4961 | "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
4962 | ||
4963 | Remove libraries from an installation directory. | |
4964 | ||
4965 | RM is the name of the program to use to delete files associated with each FILE | |
4966 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | |
4967 | to RM. | |
4968 | ||
4969 | If FILE is a libtool library, all the files associated with it are deleted. | |
4970 | Otherwise, only FILE itself is deleted using RM." | |
4971 | ;; | |
4972 | ||
4973 | *) | |
4974 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 | |
4975 | $echo "$help" 1>&2 | |
4976 | exit 1 | |
4977 | ;; | |
4978 | esac | |
4979 | ||
4980 | echo | |
4981 | $echo "Try \`$modename --help' for more information about other modes." | |
4982 | ||
4983 | exit 0 | |
4984 | ||
6cf86f7f AO |
4985 | ### BEGIN LIBTOOL TAG CONFIG: disable-shared |
4986 | build_libtool_libs=no | |
4987 | ### END LIBTOOL TAG CONFIG: disable-shared | |
4988 | ||
4989 | ### BEGIN LIBTOOL TAG CONFIG: disable-static | |
4990 | build_old_libs=no | |
4991 | ### END LIBTOOL TAG CONFIG: disable-static | |
4992 | ||
252b5132 RH |
4993 | # Local Variables: |
4994 | # mode:shell-script | |
4995 | # sh-indentation:2 | |
4996 | # End: |