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