Rev 6 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | paul | 1 | # ltmain.sh - Provide generalized library-building support services. |
2 | # NOTE: Changing this file will not affect anything until you rerun ltconfig. |
||
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 | # The name of this program. |
||
52 | progname=`$echo "$0" | sed 's%^.*/%%'` |
||
53 | modename="$progname" |
||
54 | |||
55 | # Constants. |
||
56 | PROGRAM=ltmain.sh |
||
57 | PACKAGE=libtool |
||
58 | VERSION=1.4a |
||
59 | TIMESTAMP=" (1.641.2.206mm 2001/04/03 21:47:47)" |
||
60 | |||
61 | default_mode= |
||
62 | help="Try \`$progname --help' for more information." |
||
63 | magic="%%%MAGIC variable%%%" |
||
64 | mkdir="mkdir" |
||
65 | mv="mv -f" |
||
66 | rm="rm -f" |
||
67 | |||
68 | # Sed substitution that helps us do robust quoting. It backslashifies |
||
69 | # metacharacters that are still active within double-quoted strings. |
||
70 | Xsed='sed -e 1s/^X//' |
||
71 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
||
72 | SP2NL='tr \040 \012' |
||
73 | NL2SP='tr \015\012 \040\040' |
||
74 | |||
75 | # NLS nuisances. |
||
76 | # Only set LANG and LC_ALL to C if already set. |
||
77 | # These must not be set unconditionally because not all systems understand |
||
78 | # e.g. LANG=C (notably SCO). |
||
79 | # We save the old values to restore during execute mode. |
||
80 | if test "${LC_ALL+set}" = set; then |
||
81 | save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL |
||
82 | fi |
||
83 | if test "${LANG+set}" = set; then |
||
84 | save_LANG="$LANG"; LANG=C; export LANG |
||
85 | fi |
||
86 | |||
87 | if test "$LTCONFIG_VERSION" != "$VERSION"; then |
||
88 | echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 |
||
89 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
||
90 | exit 1 |
||
91 | fi |
||
92 | |||
93 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
||
94 | echo "$modename: not configured to build any kind of library" 1>&2 |
||
95 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
||
96 | exit 1 |
||
97 | fi |
||
98 | |||
99 | # Global variables. |
||
100 | mode=$default_mode |
||
101 | nonopt= |
||
102 | prev= |
||
103 | prevopt= |
||
104 | run= |
||
105 | show="$echo" |
||
106 | show_help= |
||
107 | execute_dlfiles= |
||
108 | lo2o="s/\\.lo\$/.${objext}/" |
||
109 | o2lo="s/\\.${objext}\$/.lo/" |
||
110 | |||
111 | # Parse our command line options once, thoroughly. |
||
112 | while test $# -gt 0 |
||
113 | do |
||
114 | arg="$1" |
||
115 | shift |
||
116 | |||
117 | case $arg in |
||
118 | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
||
119 | *) optarg= ;; |
||
120 | esac |
||
121 | |||
122 | # If the previous option needs an argument, assign it. |
||
123 | if test -n "$prev"; then |
||
124 | case $prev in |
||
125 | execute_dlfiles) |
||
126 | execute_dlfiles="$execute_dlfiles $arg" |
||
127 | ;; |
||
128 | tag) |
||
129 | tagname="$arg" |
||
130 | |||
131 | # Check whether tagname contains only valid characters |
||
132 | case $tagname in |
||
133 | *[!-_A-Za-z0-9,/]*) |
||
134 | echo "$progname: invalid tag name: $tagname" 1>&2 |
||
135 | exit 1 |
||
136 | ;; |
||
137 | esac |
||
138 | |||
139 | if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then |
||
140 | taglist="$taglist $tagname" |
||
141 | # Evaluate the configuration. |
||
142 | eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" |
||
143 | else |
||
144 | echo "$progname: ignoring unknown tag $tagname" 1>&2 |
||
145 | fi |
||
146 | ;; |
||
147 | *) |
||
148 | eval "$prev=\$arg" |
||
149 | ;; |
||
150 | esac |
||
151 | |||
152 | prev= |
||
153 | prevopt= |
||
154 | continue |
||
155 | fi |
||
156 | |||
157 | # Have we seen a non-optional argument yet? |
||
158 | case $arg in |
||
159 | --help) |
||
160 | show_help=yes |
||
161 | ;; |
||
162 | |||
163 | --version) |
||
164 | echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
||
165 | exit 0 |
||
166 | ;; |
||
167 | |||
168 | --config) |
||
169 | sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0" |
||
170 | # Now print the configurations for the tags. |
||
171 | for tagname in $taglist; do |
||
172 | sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" |
||
173 | done |
||
174 | exit 0 |
||
175 | ;; |
||
176 | |||
177 | --debug) |
||
178 | echo "$progname: enabling shell trace mode" |
||
179 | set -x |
||
180 | ;; |
||
181 | |||
182 | --dry-run | -n) |
||
183 | run=: |
||
184 | ;; |
||
185 | |||
186 | --features) |
||
187 | echo "host: $host" |
||
188 | if test "$build_libtool_libs" = yes; then |
||
189 | echo "enable shared libraries" |
||
190 | else |
||
191 | echo "disable shared libraries" |
||
192 | fi |
||
193 | if test "$build_old_libs" = yes; then |
||
194 | echo "enable static libraries" |
||
195 | else |
||
196 | echo "disable static libraries" |
||
197 | fi |
||
198 | exit 0 |
||
199 | ;; |
||
200 | |||
201 | --finish) mode="finish" ;; |
||
202 | |||
203 | --mode) prevopt="--mode" prev=mode ;; |
||
204 | --mode=*) mode="$optarg" ;; |
||
205 | |||
206 | --quiet | --silent) |
||
207 | show=: |
||
208 | ;; |
||
209 | |||
210 | --tag) prevopt="--tag" prev=tag ;; |
||
211 | --tag=*) |
||
212 | set tag "$optarg" ${1+"$@"} |
||
213 | shift |
||
214 | prev=tag |
||
215 | ;; |
||
216 | |||
217 | -dlopen) |
||
218 | prevopt="-dlopen" |
||
219 | prev=execute_dlfiles |
||
220 | ;; |
||
221 | |||
222 | -*) |
||
223 | $echo "$modename: unrecognized option \`$arg'" 1>&2 |
||
224 | $echo "$help" 1>&2 |
||
225 | exit 1 |
||
226 | ;; |
||
227 | |||
228 | *) |
||
229 | nonopt="$arg" |
||
230 | break |
||
231 | ;; |
||
232 | esac |
||
233 | done |
||
234 | |||
235 | if test -n "$prevopt"; then |
||
236 | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
||
237 | $echo "$help" 1>&2 |
||
238 | exit 1 |
||
239 | fi |
||
240 | |||
241 | if test -z "$show_help"; then |
||
242 | |||
243 | # Infer the operation mode. |
||
244 | if test -z "$mode"; then |
||
245 | case $nonopt in |
||
246 | *cc | *++ | gcc* | *-gcc*) |
||
247 | mode=link |
||
248 | for arg |
||
249 | do |
||
250 | case $arg in |
||
251 | -c) |
||
252 | mode=compile |
||
253 | break |
||
254 | ;; |
||
255 | esac |
||
256 | done |
||
257 | ;; |
||
258 | *db | *dbx | *strace | *truss) |
||
259 | mode=execute |
||
260 | ;; |
||
261 | *install*|cp|mv) |
||
262 | mode=install |
||
263 | ;; |
||
264 | *rm) |
||
265 | mode=uninstall |
||
266 | ;; |
||
267 | *) |
||
268 | # If we have no mode, but dlfiles were specified, then do execute mode. |
||
269 | test -n "$execute_dlfiles" && mode=execute |
||
270 | |||
271 | # Just use the default operation mode. |
||
272 | if test -z "$mode"; then |
||
273 | if test -n "$nonopt"; then |
||
274 | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
||
275 | else |
||
276 | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
||
277 | fi |
||
278 | fi |
||
279 | ;; |
||
280 | esac |
||
281 | fi |
||
282 | |||
283 | # Only execute mode is allowed to have -dlopen flags. |
||
284 | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
||
285 | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
||
286 | $echo "$help" 1>&2 |
||
287 | exit 1 |
||
288 | fi |
||
289 | |||
290 | # Change the help message to a mode-specific one. |
||
291 | generic_help="$help" |
||
292 | help="Try \`$modename --help --mode=$mode' for more information." |
||
293 | |||
294 | # These modes are in order of execution frequency so that they run quickly. |
||
295 | case $mode in |
||
296 | # libtool compile mode |
||
297 | compile) |
||
298 | modename="$modename: compile" |
||
299 | # Get the compilation command and the source file. |
||
300 | base_compile= |
||
301 | prev= |
||
302 | lastarg= |
||
303 | srcfile="$nonopt" |
||
304 | suppress_output= |
||
305 | |||
306 | user_target=no |
||
307 | for arg |
||
308 | do |
||
309 | case $prev in |
||
310 | "") ;; |
||
311 | xcompiler) |
||
312 | # Aesthetically quote the previous argument. |
||
313 | prev= |
||
314 | lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
||
315 | |||
316 | case $arg in |
||
317 | # Double-quote args containing other shell metacharacters. |
||
318 | # Many Bourne shells cannot handle close brackets correctly |
||
319 | # in scan sets, so we specify it separately. |
||
320 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
321 | arg="\"$arg\"" |
||
322 | ;; |
||
323 | esac |
||
324 | |||
325 | # Add the previous argument to base_compile. |
||
326 | if test -z "$base_compile"; then |
||
327 | base_compile="$lastarg" |
||
328 | else |
||
329 | base_compile="$base_compile $lastarg" |
||
330 | fi |
||
331 | continue |
||
332 | ;; |
||
333 | esac |
||
334 | |||
335 | # Accept any command-line options. |
||
336 | case $arg in |
||
337 | -o) |
||
338 | if test "$user_target" != "no"; then |
||
339 | $echo "$modename: you cannot specify \`-o' more than once" 1>&2 |
||
340 | exit 1 |
||
341 | fi |
||
342 | user_target=next |
||
343 | ;; |
||
344 | |||
345 | -static) |
||
346 | build_old_libs=yes |
||
347 | continue |
||
348 | ;; |
||
349 | |||
350 | -prefer-pic) |
||
351 | pic_mode=yes |
||
352 | continue |
||
353 | ;; |
||
354 | |||
355 | -prefer-non-pic) |
||
356 | pic_mode=no |
||
357 | continue |
||
358 | ;; |
||
359 | |||
360 | -Xcompiler) |
||
361 | prev=xcompiler |
||
362 | continue |
||
363 | ;; |
||
364 | |||
365 | -Wc,*) |
||
366 | args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` |
||
367 | lastarg= |
||
368 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' |
||
369 | for arg in $args; do |
||
370 | IFS="$save_ifs" |
||
371 | |||
372 | # Double-quote args containing other shell metacharacters. |
||
373 | # Many Bourne shells cannot handle close brackets correctly |
||
374 | # in scan sets, so we specify it separately. |
||
375 | case $arg in |
||
376 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
377 | arg="\"$arg\"" |
||
378 | ;; |
||
379 | esac |
||
380 | lastarg="$lastarg $arg" |
||
381 | done |
||
382 | IFS="$save_ifs" |
||
383 | lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` |
||
384 | |||
385 | # Add the arguments to base_compile. |
||
386 | if test -z "$base_compile"; then |
||
387 | base_compile="$lastarg" |
||
388 | else |
||
389 | base_compile="$base_compile $lastarg" |
||
390 | fi |
||
391 | continue |
||
392 | ;; |
||
393 | esac |
||
394 | |||
395 | case $user_target in |
||
396 | next) |
||
397 | # The next one is the -o target name |
||
398 | user_target=yes |
||
399 | continue |
||
400 | ;; |
||
401 | yes) |
||
402 | # We got the output file |
||
403 | user_target=set |
||
404 | libobj="$arg" |
||
405 | continue |
||
406 | ;; |
||
407 | esac |
||
408 | |||
409 | # Accept the current argument as the source file. |
||
410 | lastarg="$srcfile" |
||
411 | srcfile="$arg" |
||
412 | |||
413 | # Aesthetically quote the previous argument. |
||
414 | |||
415 | # Backslashify any backslashes, double quotes, and dollar signs. |
||
416 | # These are the only characters that are still specially |
||
417 | # interpreted inside of double-quoted scrings. |
||
418 | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` |
||
419 | |||
420 | # Double-quote args containing other shell metacharacters. |
||
421 | # Many Bourne shells cannot handle close brackets correctly |
||
422 | # in scan sets, so we specify it separately. |
||
423 | case $lastarg in |
||
424 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
425 | lastarg="\"$lastarg\"" |
||
426 | ;; |
||
427 | esac |
||
428 | |||
429 | # Add the previous argument to base_compile. |
||
430 | if test -z "$base_compile"; then |
||
431 | base_compile="$lastarg" |
||
432 | else |
||
433 | base_compile="$base_compile $lastarg" |
||
434 | fi |
||
435 | done |
||
436 | |||
437 | case $user_target in |
||
438 | set) |
||
439 | ;; |
||
440 | no) |
||
441 | # Get the name of the library object. |
||
442 | libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` |
||
443 | ;; |
||
444 | *) |
||
445 | $echo "$modename: you must specify a target with \`-o'" 1>&2 |
||
446 | exit 1 |
||
447 | ;; |
||
448 | esac |
||
449 | |||
450 | # Recognize several different file suffixes. |
||
451 | # If the user specifies -o file.o, it is replaced with file.lo |
||
452 | xform='[cCFSfmso]' |
||
453 | case $libobj in |
||
454 | *.ada) xform=ada ;; |
||
455 | *.adb) xform=adb ;; |
||
456 | *.ads) xform=ads ;; |
||
457 | *.asm) xform=asm ;; |
||
458 | *.c++) xform=c++ ;; |
||
459 | *.cc) xform=cc ;; |
||
460 | *.class) xform=class ;; |
||
461 | *.cpp) xform=cpp ;; |
||
462 | *.cxx) xform=cxx ;; |
||
463 | *.f90) xform=f90 ;; |
||
464 | *.for) xform=for ;; |
||
465 | *.java) xform=java ;; |
||
466 | esac |
||
467 | |||
468 | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` |
||
469 | |||
470 | case $libobj in |
||
471 | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
||
472 | *) |
||
473 | $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 |
||
474 | exit 1 |
||
475 | ;; |
||
476 | esac |
||
477 | |||
478 | # Infer tagged configuration to use if any are available and |
||
479 | # if one wasn't chosen via the "--tag" command line option. |
||
480 | # Only attempt this if the compiler in the base compile |
||
481 | # command doesn't match the default compiler. |
||
482 | if test -n "$available_tags" && test -z "$tagname"; then |
||
483 | case $base_compile in |
||
484 | "$CC "*) ;; |
||
485 | # Blanks in the command may have been stripped by the calling shell, |
||
486 | # but not from the CC environment variable when ltconfig was run. |
||
487 | "`$echo $CC` "*) ;; |
||
488 | *) |
||
489 | for z in $available_tags; do |
||
490 | if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then |
||
491 | # Evaluate the configuration. |
||
492 | eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" |
||
493 | case $base_compile in |
||
494 | "$CC "*) |
||
495 | # The compiler in the base compile command matches |
||
496 | # the one in the tagged configuration. |
||
497 | # Assume this is the tagged configuration we want. |
||
498 | tagname=$z |
||
499 | break |
||
500 | ;; |
||
501 | "`$echo $CC` "*) |
||
502 | tagname=$z |
||
503 | break |
||
504 | ;; |
||
505 | esac |
||
506 | fi |
||
507 | done |
||
508 | # If $tagname still isn't set, then no tagged configuration |
||
509 | # was found and let the user know that the "--tag" command |
||
510 | # line option must be used. |
||
511 | if test -z "$tagname"; then |
||
512 | echo "$modename: unable to infer tagged configuration" |
||
513 | echo "$modename: specify a tag with \`--tag'" 1>&2 |
||
514 | exit 1 |
||
515 | # else |
||
516 | # echo "$modename: using $tagname tagged configuration" |
||
517 | fi |
||
518 | ;; |
||
519 | esac |
||
520 | fi |
||
521 | |||
522 | objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
||
523 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
||
524 | if test "X$xdir" = "X$obj"; then |
||
525 | xdir= |
||
526 | else |
||
527 | xdir=$xdir/ |
||
528 | fi |
||
529 | lobj=${xdir}$objdir/$objname |
||
530 | |||
531 | if test -z "$base_compile"; then |
||
532 | $echo "$modename: you must specify a compilation command" 1>&2 |
||
533 | $echo "$help" 1>&2 |
||
534 | exit 1 |
||
535 | fi |
||
536 | |||
537 | # Delete any leftover library objects. |
||
538 | if test "$build_old_libs" = yes; then |
||
539 | removelist="$obj $lobj $libobj ${libobj}T" |
||
540 | else |
||
541 | removelist="$lobj $libobj ${libobj}T" |
||
542 | fi |
||
543 | |||
544 | $run $rm $removelist |
||
545 | trap "$run $rm $removelist; exit 1" 1 2 15 |
||
546 | |||
547 | # On Cygwin there's no "real" PIC flag so we must build both object types |
||
548 | case $host_os in |
||
549 | cygwin* | mingw* | pw32* | os2*) |
||
550 | pic_mode=default |
||
551 | ;; |
||
552 | esac |
||
553 | if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then |
||
554 | # non-PIC code in shared libraries is not supported |
||
555 | pic_mode=default |
||
556 | fi |
||
557 | |||
558 | # Calculate the filename of the output object if compiler does |
||
559 | # not support -o with -c |
||
560 | if test "$compiler_c_o" = no; then |
||
561 | output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
||
562 | lockfile="$output_obj.lock" |
||
563 | removelist="$removelist $output_obj $lockfile" |
||
564 | trap "$run $rm $removelist; exit 1" 1 2 15 |
||
565 | else |
||
566 | output_obj= |
||
567 | need_locks=no |
||
568 | lockfile= |
||
569 | fi |
||
570 | |||
571 | # Lock this critical section if it is needed |
||
572 | # We use this script file to make the link, it avoids creating a new file |
||
573 | if test "$need_locks" = yes; then |
||
574 | until $run ln "$0" "$lockfile" 2>/dev/null; do |
||
575 | $show "Waiting for $lockfile to be removed" |
||
576 | sleep 2 |
||
577 | done |
||
578 | elif test "$need_locks" = warn; then |
||
579 | if test -f "$lockfile"; then |
||
580 | echo "\ |
||
581 | *** ERROR, $lockfile exists and contains: |
||
582 | `cat $lockfile 2>/dev/null` |
||
583 | |||
584 | This indicates that another process is trying to use the same |
||
585 | temporary object file, and libtool could not work around it because |
||
586 | your compiler does not support \`-c' and \`-o' together. If you |
||
587 | repeat this compilation, it may succeed, by chance, but you had better |
||
588 | avoid parallel builds (make -j) in this platform, or get a better |
||
589 | compiler." |
||
590 | |||
591 | $run $rm $removelist |
||
592 | exit 1 |
||
593 | fi |
||
594 | echo $srcfile > "$lockfile" |
||
595 | fi |
||
596 | |||
597 | if test -n "$fix_srcfile_path"; then |
||
598 | eval srcfile=\"$fix_srcfile_path\" |
||
599 | fi |
||
600 | |||
601 | $run $rm "$libobj" "${libobj}T" |
||
602 | |||
603 | # Create a libtool object file (analogous to a ".la" file), |
||
604 | # but don't create it if we're doing a dry run. |
||
605 | test -z "$run" && cat > ${libobj}T <<EOF |
||
606 | # $libobj - a libtool object file |
||
607 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
||
608 | # |
||
609 | # Please DO NOT delete this file! |
||
610 | # It is necessary for linking the library. |
||
611 | |||
612 | # Name of the PIC object. |
||
613 | EOF |
||
614 | |||
615 | # Only build a PIC object if we are building libtool libraries. |
||
616 | if test "$build_libtool_libs" = yes; then |
||
617 | # Without this assignment, base_compile gets emptied. |
||
618 | fbsd_hideous_sh_bug=$base_compile |
||
619 | |||
620 | if test "$pic_mode" != no; then |
||
621 | command="$base_compile $srcfile $pic_flag" |
||
622 | else |
||
623 | # Don't build PIC code |
||
624 | command="$base_compile $srcfile" |
||
625 | fi |
||
626 | |||
627 | if test ! -d ${xdir}$objdir; then |
||
628 | $show "$mkdir ${xdir}$objdir" |
||
629 | $run $mkdir ${xdir}$objdir |
||
630 | status=$? |
||
631 | if test $status -ne 0 && test ! -d ${xdir}$objdir; then |
||
632 | exit $status |
||
633 | fi |
||
634 | fi |
||
635 | |||
636 | if test -z "$output_obj"; then |
||
637 | # Place PIC objects in $objdir |
||
638 | command="$command -o $lobj" |
||
639 | fi |
||
640 | |||
641 | $run $rm "$lobj" "$output_obj" |
||
642 | |||
643 | $show "$command" |
||
644 | if $run eval "$command"; then : |
||
645 | else |
||
646 | test -n "$output_obj" && $run $rm $removelist |
||
647 | exit 1 |
||
648 | fi |
||
649 | |||
650 | if test "$need_locks" = warn && |
||
651 | test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then |
||
652 | echo "\ |
||
653 | *** ERROR, $lockfile contains: |
||
654 | `cat $lockfile 2>/dev/null` |
||
655 | |||
656 | but it should contain: |
||
657 | $srcfile |
||
658 | |||
659 | This indicates that another process is trying to use the same |
||
660 | temporary object file, and libtool could not work around it because |
||
661 | your compiler does not support \`-c' and \`-o' together. If you |
||
662 | repeat this compilation, it may succeed, by chance, but you had better |
||
663 | avoid parallel builds (make -j) in this platform, or get a better |
||
664 | compiler." |
||
665 | |||
666 | $run $rm $removelist |
||
667 | exit 1 |
||
668 | fi |
||
669 | |||
670 | # Just move the object if needed, then go on to compile the next one |
||
671 | if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then |
||
672 | $show "$mv $output_obj $lobj" |
||
673 | if $run $mv $output_obj $lobj; then : |
||
674 | else |
||
675 | error=$? |
||
676 | $run $rm $removelist |
||
677 | exit $error |
||
678 | fi |
||
679 | fi |
||
680 | |||
681 | # Append the name of the PIC object to the libtool object file. |
||
682 | test -z "$run" && cat >> ${libobj}T <<EOF |
||
683 | pic_object='$objdir/$objname' |
||
684 | |||
685 | EOF |
||
686 | |||
687 | # Allow error messages only from the first compilation. |
||
688 | suppress_output=' >/dev/null 2>&1' |
||
689 | else |
||
690 | # No PIC object so indicate it doesn't exist in the libtool |
||
691 | # object file. |
||
692 | test -z "$run" && cat >> ${libobj}T <<EOF |
||
693 | pic_object=none |
||
694 | |||
695 | EOF |
||
696 | fi |
||
697 | |||
698 | # Only build a position-dependent object if we build old libraries. |
||
699 | if test "$build_old_libs" = yes; then |
||
700 | if test "$pic_mode" != yes; then |
||
701 | # Don't build PIC code |
||
702 | command="$base_compile $srcfile" |
||
703 | else |
||
704 | command="$base_compile $srcfile $pic_flag" |
||
705 | fi |
||
706 | if test "$compiler_c_o" = yes; then |
||
707 | command="$command -o $obj" |
||
708 | fi |
||
709 | |||
710 | # Suppress compiler output if we already did a PIC compilation. |
||
711 | command="$command$suppress_output" |
||
712 | $run $rm "$obj" "$output_obj" |
||
713 | $show "$command" |
||
714 | if $run eval "$command"; then : |
||
715 | else |
||
716 | $run $rm $removelist |
||
717 | exit 1 |
||
718 | fi |
||
719 | |||
720 | if test "$need_locks" = warn && |
||
721 | test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then |
||
722 | echo "\ |
||
723 | *** ERROR, $lockfile contains: |
||
724 | `cat $lockfile 2>/dev/null` |
||
725 | |||
726 | but it should contain: |
||
727 | $srcfile |
||
728 | |||
729 | This indicates that another process is trying to use the same |
||
730 | temporary object file, and libtool could not work around it because |
||
731 | your compiler does not support \`-c' and \`-o' together. If you |
||
732 | repeat this compilation, it may succeed, by chance, but you had better |
||
733 | avoid parallel builds (make -j) in this platform, or get a better |
||
734 | compiler." |
||
735 | |||
736 | $run $rm $removelist |
||
737 | exit 1 |
||
738 | fi |
||
739 | |||
740 | # Just move the object if needed |
||
741 | if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then |
||
742 | $show "$mv $output_obj $obj" |
||
743 | if $run $mv $output_obj $obj; then : |
||
744 | else |
||
745 | error=$? |
||
746 | $run $rm $removelist |
||
747 | exit $error |
||
748 | fi |
||
749 | fi |
||
750 | |||
751 | # Append the name of the non-PIC object the libtool object file. |
||
752 | # Only append if the libtool object file exists. |
||
753 | test -z "$run" && cat >> ${libobj}T <<EOF |
||
754 | # Name of the non-PIC object. |
||
755 | non_pic_object='$objname' |
||
756 | |||
757 | EOF |
||
758 | else |
||
759 | # Append the name of the non-PIC object the libtool object file. |
||
760 | # Only append if the libtool object file exists. |
||
761 | test -z "$run" && cat >> ${libobj}T <<EOF |
||
762 | # Name of the non-PIC object. |
||
763 | non_pic_object=none |
||
764 | |||
765 | EOF |
||
766 | fi |
||
767 | |||
768 | $run $mv "${libobj}T" "${libobj}" |
||
769 | |||
770 | # Unlock the critical section if it was locked |
||
771 | if test "$need_locks" != no; then |
||
772 | $run $rm "$lockfile" |
||
773 | fi |
||
774 | |||
775 | exit 0 |
||
776 | ;; |
||
777 | |||
778 | # libtool link mode |
||
779 | link | relink) |
||
780 | modename="$modename: link" |
||
781 | case $host in |
||
782 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
||
783 | # It is impossible to link a dll without this setting, and |
||
784 | # we shouldn't force the makefile maintainer to figure out |
||
785 | # which system we are compiling for in order to pass an extra |
||
786 | # flag for every libtool invokation. |
||
787 | # allow_undefined=no |
||
788 | |||
789 | # FIXME: Unfortunately, there are problems with the above when trying |
||
790 | # to make a dll which has undefined symbols, in which case not |
||
791 | # even a static library is built. For now, we need to specify |
||
792 | # -no-undefined on the libtool link line when we can be certain |
||
793 | # that all symbols are satisfied, otherwise we get a static library. |
||
794 | allow_undefined=yes |
||
795 | ;; |
||
796 | *) |
||
797 | allow_undefined=yes |
||
798 | ;; |
||
799 | esac |
||
800 | libtool_args="$nonopt" |
||
801 | base_compile="$nonopt" |
||
802 | compile_command="$nonopt" |
||
803 | finalize_command="$nonopt" |
||
804 | |||
805 | compile_rpath= |
||
806 | finalize_rpath= |
||
807 | compile_shlibpath= |
||
808 | finalize_shlibpath= |
||
809 | convenience= |
||
810 | old_convenience= |
||
811 | deplibs= |
||
812 | old_deplibs= |
||
813 | add_flags= |
||
814 | compiler_flags= |
||
815 | linker_flags= |
||
816 | dllsearchpath= |
||
817 | lib_search_path=`pwd` |
||
818 | |||
819 | avoid_version=no |
||
820 | dlfiles= |
||
821 | dlprefiles= |
||
822 | dlself=no |
||
823 | export_dynamic=no |
||
824 | export_symbols= |
||
825 | export_symbols_regex= |
||
826 | generated= |
||
827 | libobjs= |
||
828 | ltlibs= |
||
829 | module=no |
||
830 | no_install=no |
||
831 | objs= |
||
832 | non_pic_objects= |
||
833 | prefer_static_libs=no |
||
834 | preload=no |
||
835 | prev= |
||
836 | prevarg= |
||
837 | release= |
||
838 | rpath= |
||
839 | xrpath= |
||
840 | perm_rpath= |
||
841 | temp_rpath= |
||
842 | thread_safe=no |
||
843 | vinfo= |
||
844 | |||
845 | # We need to know -static, to get the right output filenames. |
||
846 | for arg |
||
847 | do |
||
848 | case $arg in |
||
849 | -all-static | -static) |
||
850 | if test "X$arg" = "X-all-static"; then |
||
851 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
||
852 | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
||
853 | fi |
||
854 | if test -n "$link_static_flag"; then |
||
855 | dlopen_self=$dlopen_self_static |
||
856 | fi |
||
857 | else |
||
858 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
||
859 | dlopen_self=$dlopen_self_static |
||
860 | fi |
||
861 | fi |
||
862 | build_libtool_libs=no |
||
863 | build_old_libs=yes |
||
864 | prefer_static_libs=yes |
||
865 | break |
||
866 | ;; |
||
867 | esac |
||
868 | done |
||
869 | |||
870 | # See if our shared archives depend on static archives. |
||
871 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
||
872 | |||
873 | # Go through the arguments, transforming them on the way. |
||
874 | while test $# -gt 0; do |
||
875 | arg="$1" |
||
876 | base_compile="$base_compile $arg" |
||
877 | shift |
||
878 | case $arg in |
||
879 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
880 | qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test |
||
881 | ;; |
||
882 | *) qarg=$arg ;; |
||
883 | esac |
||
884 | libtool_args="$libtool_args $qarg" |
||
885 | |||
886 | # If the previous option needs an argument, assign it. |
||
887 | if test -n "$prev"; then |
||
888 | case $prev in |
||
889 | output) |
||
890 | compile_command="$compile_command @OUTPUT@" |
||
891 | finalize_command="$finalize_command @OUTPUT@" |
||
892 | ;; |
||
893 | esac |
||
894 | |||
895 | case $prev in |
||
896 | dlfiles|dlprefiles) |
||
897 | if test "$preload" = no; then |
||
898 | # Add the symbol object into the linking commands. |
||
899 | compile_command="$compile_command @SYMFILE@" |
||
900 | finalize_command="$finalize_command @SYMFILE@" |
||
901 | preload=yes |
||
902 | fi |
||
903 | case $arg in |
||
904 | *.la | *.lo) ;; # We handle these cases below. |
||
905 | force) |
||
906 | if test "$dlself" = no; then |
||
907 | dlself=needless |
||
908 | export_dynamic=yes |
||
909 | fi |
||
910 | prev= |
||
911 | continue |
||
912 | ;; |
||
913 | self) |
||
914 | if test "$prev" = dlprefiles; then |
||
915 | dlself=yes |
||
916 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
||
917 | dlself=yes |
||
918 | else |
||
919 | dlself=needless |
||
920 | export_dynamic=yes |
||
921 | fi |
||
922 | prev= |
||
923 | continue |
||
924 | ;; |
||
925 | *) |
||
926 | if test "$prev" = dlfiles; then |
||
927 | dlfiles="$dlfiles $arg" |
||
928 | else |
||
929 | dlprefiles="$dlprefiles $arg" |
||
930 | fi |
||
931 | prev= |
||
932 | continue |
||
933 | ;; |
||
934 | esac |
||
935 | ;; |
||
936 | expsyms) |
||
937 | export_symbols="$arg" |
||
938 | if test ! -f "$arg"; then |
||
939 | $echo "$modename: symbol file \`$arg' does not exist" |
||
940 | exit 1 |
||
941 | fi |
||
942 | prev= |
||
943 | continue |
||
944 | ;; |
||
945 | expsyms_regex) |
||
946 | export_symbols_regex="$arg" |
||
947 | prev= |
||
948 | continue |
||
949 | ;; |
||
950 | release) |
||
951 | release="-$arg" |
||
952 | prev= |
||
953 | continue |
||
954 | ;; |
||
955 | objectlist) |
||
956 | if test -f "$arg"; then |
||
957 | save_arg=$arg |
||
958 | moreargs= |
||
959 | for fil in `cat $save_arg` |
||
960 | do |
||
961 | # moreargs="$moreargs $fil" |
||
962 | arg=$fil |
||
963 | # A libtool-controlled object. |
||
964 | |||
965 | # Check to see that this really is a libtool object. |
||
966 | if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
||
967 | pic_object= |
||
968 | non_pic_object= |
||
969 | |||
970 | # Read the .lo file |
||
971 | # If there is no directory component, then add one. |
||
972 | case $arg in |
||
973 | */* | *\\*) . $arg ;; |
||
974 | *) . ./$arg ;; |
||
975 | esac |
||
976 | |||
977 | if test -z "$pic_object" || \ |
||
978 | test -z "$non_pic_object" || |
||
979 | test "$pic_object" = none && \ |
||
980 | test "$non_pic_object" = none; then |
||
981 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
||
982 | exit 1 |
||
983 | fi |
||
984 | |||
985 | # Extract subdirectory from the argument. |
||
986 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
||
987 | if test "X$xdir" = "X$arg"; then |
||
988 | xdir= |
||
989 | else |
||
990 | xdir="$xdir/" |
||
991 | fi |
||
992 | |||
993 | if test "$pic_object" != none; then |
||
994 | # Prepend the subdirectory the object is found in. |
||
995 | pic_object="$xdir$pic_object" |
||
996 | |||
997 | if test "$prev" = dlfiles; then |
||
998 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
||
999 | dlfiles="$dlfiles $pic_object" |
||
1000 | prev= |
||
1001 | continue |
||
1002 | else |
||
1003 | # If libtool objects are unsupported, then we need to preload. |
||
1004 | prev=dlprefiles |
||
1005 | fi |
||
1006 | fi |
||
1007 | |||
1008 | # CHECK ME: I think I busted this. -Ossama |
||
1009 | if test "$prev" = dlprefiles; then |
||
1010 | # Preload the old-style object. |
||
1011 | dlprefiles="$dlprefiles $pic_object" |
||
1012 | prev= |
||
1013 | fi |
||
1014 | |||
1015 | # A PIC object. |
||
1016 | libobjs="$libobjs $pic_object" |
||
1017 | arg="$pic_object" |
||
1018 | fi |
||
1019 | |||
1020 | # Non-PIC object. |
||
1021 | if test "$non_pic_object" != none; then |
||
1022 | # Prepend the subdirectory the object is found in. |
||
1023 | non_pic_object="$xdir$non_pic_object" |
||
1024 | |||
1025 | # A standard non-PIC object |
||
1026 | non_pic_objects="$non_pic_objects $non_pic_object" |
||
1027 | if test -z "$pic_object" || test "$pic_object" = none ; then |
||
1028 | arg="$non_pic_object" |
||
1029 | fi |
||
1030 | fi |
||
1031 | else |
||
1032 | # Only an error if not doing a dry-run. |
||
1033 | if test -z "$run"; then |
||
1034 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
||
1035 | exit 1 |
||
1036 | else |
||
1037 | # Dry-run case. |
||
1038 | |||
1039 | # Extract subdirectory from the argument. |
||
1040 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
||
1041 | if test "X$xdir" = "X$arg"; then |
||
1042 | xdir= |
||
1043 | else |
||
1044 | xdir="$xdir/" |
||
1045 | fi |
||
1046 | |||
1047 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
||
1048 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
||
1049 | libobjs="$libobjs $pic_object" |
||
1050 | non_pic_objects="$non_pic_objects $non_pic_object" |
||
1051 | fi |
||
1052 | fi |
||
1053 | done |
||
1054 | else |
||
1055 | $echo "$modename: link input file \`$save_arg' does not exist" |
||
1056 | exit 1 |
||
1057 | fi |
||
1058 | arg=$save_arg |
||
1059 | prev= |
||
1060 | continue |
||
1061 | ;; |
||
1062 | rpath | xrpath) |
||
1063 | # We need an absolute path. |
||
1064 | case $arg in |
||
1065 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
||
1066 | *) |
||
1067 | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
||
1068 | exit 1 |
||
1069 | ;; |
||
1070 | esac |
||
1071 | if test "$prev" = rpath; then |
||
1072 | case "$rpath " in |
||
1073 | *" $arg "*) ;; |
||
1074 | *) rpath="$rpath $arg" ;; |
||
1075 | esac |
||
1076 | else |
||
1077 | case "$xrpath " in |
||
1078 | *" $arg "*) ;; |
||
1079 | *) xrpath="$xrpath $arg" ;; |
||
1080 | esac |
||
1081 | fi |
||
1082 | prev= |
||
1083 | continue |
||
1084 | ;; |
||
1085 | xcompiler) |
||
1086 | compiler_flags="$compiler_flags $qarg" |
||
1087 | prev= |
||
1088 | compile_command="$compile_command $qarg" |
||
1089 | finalize_command="$finalize_command $qarg" |
||
1090 | continue |
||
1091 | ;; |
||
1092 | xlinker) |
||
1093 | linker_flags="$linker_flags $qarg" |
||
1094 | compiler_flags="$compiler_flags $wl$qarg" |
||
1095 | prev= |
||
1096 | compile_command="$compile_command $wl$qarg" |
||
1097 | finalize_command="$finalize_command $wl$qarg" |
||
1098 | continue |
||
1099 | ;; |
||
1100 | *) |
||
1101 | eval "$prev=\"\$arg\"" |
||
1102 | prev= |
||
1103 | continue |
||
1104 | ;; |
||
1105 | esac |
||
1106 | fi |
||
1107 | |||
1108 | prevarg="$arg" |
||
1109 | |||
1110 | case $arg in |
||
1111 | -all-static) |
||
1112 | if test -n "$link_static_flag"; then |
||
1113 | compile_command="$compile_command $link_static_flag" |
||
1114 | finalize_command="$finalize_command $link_static_flag" |
||
1115 | fi |
||
1116 | continue |
||
1117 | ;; |
||
1118 | |||
1119 | -allow-undefined) |
||
1120 | # FIXME: remove this flag sometime in the future. |
||
1121 | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 |
||
1122 | continue |
||
1123 | ;; |
||
1124 | |||
1125 | -avoid-version) |
||
1126 | avoid_version=yes |
||
1127 | continue |
||
1128 | ;; |
||
1129 | |||
1130 | -dlopen) |
||
1131 | prev=dlfiles |
||
1132 | continue |
||
1133 | ;; |
||
1134 | |||
1135 | -dlpreopen) |
||
1136 | prev=dlprefiles |
||
1137 | continue |
||
1138 | ;; |
||
1139 | |||
1140 | -export-dynamic) |
||
1141 | export_dynamic=yes |
||
1142 | continue |
||
1143 | ;; |
||
1144 | |||
1145 | -export-symbols | -export-symbols-regex) |
||
1146 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
||
1147 | $echo "$modename: not more than one -exported-symbols argument allowed" |
||
1148 | exit 1 |
||
1149 | fi |
||
1150 | if test "X$arg" = "X-export-symbols"; then |
||
1151 | prev=expsyms |
||
1152 | else |
||
1153 | prev=expsyms_regex |
||
1154 | fi |
||
1155 | continue |
||
1156 | ;; |
||
1157 | |||
1158 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
||
1159 | # so, if we see these flags be careful not to treat them like -L |
||
1160 | -L[A-Z][A-Z]*:*) |
||
1161 | case $with_gcc/$host in |
||
1162 | no/*-*-irix*) |
||
1163 | compile_command="$compile_command $arg" |
||
1164 | finalize_command="$finalize_command $arg" |
||
1165 | ;; |
||
1166 | esac |
||
1167 | continue |
||
1168 | ;; |
||
1169 | |||
1170 | -L*) |
||
1171 | dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` |
||
1172 | # We need an absolute path. |
||
1173 | case $dir in |
||
1174 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
||
1175 | *) |
||
1176 | absdir=`cd "$dir" && pwd` |
||
1177 | if test -z "$absdir"; then |
||
1178 | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
||
1179 | exit 1 |
||
1180 | fi |
||
1181 | dir="$absdir" |
||
1182 | ;; |
||
1183 | esac |
||
1184 | case "$deplibs " in |
||
1185 | *" -L$dir "*) ;; |
||
1186 | *) |
||
1187 | deplibs="$deplibs -L$dir" |
||
1188 | lib_search_path="$lib_search_path $dir" |
||
1189 | ;; |
||
1190 | esac |
||
1191 | case $host in |
||
1192 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
||
1193 | case :$dllsearchpath: in |
||
1194 | *":$dir:"*) ;; |
||
1195 | *) dllsearchpath="$dllsearchpath:$dir";; |
||
1196 | esac |
||
1197 | ;; |
||
1198 | esac |
||
1199 | continue |
||
1200 | ;; |
||
1201 | |||
1202 | -l*) |
||
1203 | if test "$arg" = "-lc"; then |
||
1204 | case $host in |
||
1205 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) |
||
1206 | # These systems don't actually have c library (as such) |
||
1207 | continue |
||
1208 | ;; |
||
1209 | *-*-rhapsody* | *-*-darwin1.[012]) |
||
1210 | # Rhapsody C library is in the System framework |
||
1211 | deplibs="$deplibs -framework System" |
||
1212 | continue |
||
1213 | ;; |
||
1214 | esac |
||
1215 | elif test "$arg" = "-lm"; then |
||
1216 | case $host in |
||
1217 | *-*-cygwin* | *-*-pw32* | *-*-beos*) |
||
1218 | # These systems don't actually have math library (as such) |
||
1219 | continue |
||
1220 | ;; |
||
1221 | *-*-rhapsody* | *-*-darwin1.[012]) |
||
1222 | # Rhapsody math library is in the System framework |
||
1223 | deplibs="$deplibs -framework System" |
||
1224 | continue |
||
1225 | ;; |
||
1226 | esac |
||
1227 | fi |
||
1228 | deplibs="$deplibs $arg" |
||
1229 | continue |
||
1230 | ;; |
||
1231 | |||
1232 | -module) |
||
1233 | module=yes |
||
1234 | continue |
||
1235 | ;; |
||
1236 | |||
1237 | -no-fast-install) |
||
1238 | fast_install=no |
||
1239 | continue |
||
1240 | ;; |
||
1241 | |||
1242 | -no-install) |
||
1243 | case $host in |
||
1244 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
||
1245 | # The PATH hackery in wrapper scripts is required on Windows |
||
1246 | # in order for the loader to find any dlls it needs. |
||
1247 | $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 |
||
1248 | $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 |
||
1249 | fast_install=no |
||
1250 | ;; |
||
1251 | *) |
||
1252 | no_install=yes |
||
1253 | ;; |
||
1254 | esac |
||
1255 | continue |
||
1256 | ;; |
||
1257 | |||
1258 | -no-undefined) |
||
1259 | allow_undefined=no |
||
1260 | continue |
||
1261 | ;; |
||
1262 | |||
1263 | -objectlist) |
||
1264 | prev=objectlist |
||
1265 | continue |
||
1266 | ;; |
||
1267 | |||
1268 | -o) prev=output ;; |
||
1269 | |||
1270 | -release) |
||
1271 | prev=release |
||
1272 | continue |
||
1273 | ;; |
||
1274 | |||
1275 | -rpath) |
||
1276 | prev=rpath |
||
1277 | continue |
||
1278 | ;; |
||
1279 | |||
1280 | -R) |
||
1281 | prev=xrpath |
||
1282 | continue |
||
1283 | ;; |
||
1284 | |||
1285 | -R*) |
||
1286 | dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` |
||
1287 | # We need an absolute path. |
||
1288 | case $dir in |
||
1289 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
||
1290 | *) |
||
1291 | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
||
1292 | exit 1 |
||
1293 | ;; |
||
1294 | esac |
||
1295 | case "$xrpath " in |
||
1296 | *" $dir "*) ;; |
||
1297 | *) xrpath="$xrpath $dir" ;; |
||
1298 | esac |
||
1299 | continue |
||
1300 | ;; |
||
1301 | |||
1302 | -static) |
||
1303 | # The effects of -static are defined in a previous loop. |
||
1304 | # We used to do the same as -all-static on platforms that |
||
1305 | # didn't have a PIC flag, but the assumption that the effects |
||
1306 | # would be equivalent was wrong. It would break on at least |
||
1307 | # Digital Unix and AIX. |
||
1308 | continue |
||
1309 | ;; |
||
1310 | |||
1311 | -thread-safe) |
||
1312 | thread_safe=yes |
||
1313 | continue |
||
1314 | ;; |
||
1315 | |||
1316 | -version-info) |
||
1317 | prev=vinfo |
||
1318 | continue |
||
1319 | ;; |
||
1320 | |||
1321 | -Wc,*) |
||
1322 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` |
||
1323 | arg= |
||
1324 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' |
||
1325 | for flag in $args; do |
||
1326 | IFS="$save_ifs" |
||
1327 | case $flag in |
||
1328 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
1329 | flag="\"$flag\"" |
||
1330 | ;; |
||
1331 | esac |
||
1332 | arg="$arg $wl$flag" |
||
1333 | compiler_flags="$compiler_flags $flag" |
||
1334 | done |
||
1335 | IFS="$save_ifs" |
||
1336 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
||
1337 | ;; |
||
1338 | |||
1339 | -Wl,*) |
||
1340 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` |
||
1341 | arg= |
||
1342 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' |
||
1343 | for flag in $args; do |
||
1344 | IFS="$save_ifs" |
||
1345 | case $flag in |
||
1346 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
1347 | flag="\"$flag\"" |
||
1348 | ;; |
||
1349 | esac |
||
1350 | arg="$arg $wl$flag" |
||
1351 | compiler_flags="$compiler_flags $wl$flag" |
||
1352 | linker_flags="$linker_flags $flag" |
||
1353 | done |
||
1354 | IFS="$save_ifs" |
||
1355 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
||
1356 | ;; |
||
1357 | |||
1358 | -Xcompiler) |
||
1359 | prev=xcompiler |
||
1360 | continue |
||
1361 | ;; |
||
1362 | |||
1363 | -Xlinker) |
||
1364 | prev=xlinker |
||
1365 | continue |
||
1366 | ;; |
||
1367 | |||
1368 | # Some other compiler flag. |
||
1369 | -* | +*) |
||
1370 | # Unknown arguments in both finalize_command and compile_command need |
||
1371 | # to be aesthetically quoted because they are evaled later. |
||
1372 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
||
1373 | case $arg in |
||
1374 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
1375 | arg="\"$arg\"" |
||
1376 | ;; |
||
1377 | esac |
||
1378 | add_flags="$add_flags $arg" |
||
1379 | ;; |
||
1380 | |||
1381 | *.$objext) |
||
1382 | # A standard object. |
||
1383 | objs="$objs $arg" |
||
1384 | ;; |
||
1385 | |||
1386 | *.lo) |
||
1387 | # A libtool-controlled object. |
||
1388 | |||
1389 | # Check to see that this really is a libtool object. |
||
1390 | if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
||
1391 | pic_object= |
||
1392 | non_pic_object= |
||
1393 | |||
1394 | # Read the .lo file |
||
1395 | # If there is no directory component, then add one. |
||
1396 | case $arg in |
||
1397 | */* | *\\*) . $arg ;; |
||
1398 | *) . ./$arg ;; |
||
1399 | esac |
||
1400 | |||
1401 | if test -z "$pic_object" || \ |
||
1402 | test -z "$non_pic_object" || |
||
1403 | test "$pic_object" = none && \ |
||
1404 | test "$non_pic_object" = none; then |
||
1405 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
||
1406 | exit 1 |
||
1407 | fi |
||
1408 | |||
1409 | # Extract subdirectory from the argument. |
||
1410 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
||
1411 | if test "X$xdir" = "X$arg"; then |
||
1412 | xdir= |
||
1413 | else |
||
1414 | xdir="$xdir/" |
||
1415 | fi |
||
1416 | |||
1417 | if test "$pic_object" != none; then |
||
1418 | # Prepend the subdirectory the object is found in. |
||
1419 | pic_object="$xdir$pic_object" |
||
1420 | |||
1421 | if test "$prev" = dlfiles; then |
||
1422 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
||
1423 | dlfiles="$dlfiles $pic_object" |
||
1424 | prev= |
||
1425 | continue |
||
1426 | else |
||
1427 | # If libtool objects are unsupported, then we need to preload. |
||
1428 | prev=dlprefiles |
||
1429 | fi |
||
1430 | fi |
||
1431 | |||
1432 | # CHECK ME: I think I busted this. -Ossama |
||
1433 | if test "$prev" = dlprefiles; then |
||
1434 | # Preload the old-style object. |
||
1435 | dlprefiles="$dlprefiles $pic_object" |
||
1436 | prev= |
||
1437 | fi |
||
1438 | |||
1439 | # A PIC object. |
||
1440 | libobjs="$libobjs $pic_object" |
||
1441 | arg="$pic_object" |
||
1442 | fi |
||
1443 | |||
1444 | # Non-PIC object. |
||
1445 | if test "$non_pic_object" != none; then |
||
1446 | # Prepend the subdirectory the object is found in. |
||
1447 | non_pic_object="$xdir$non_pic_object" |
||
1448 | |||
1449 | # A standard non-PIC object |
||
1450 | non_pic_objects="$non_pic_objects $non_pic_object" |
||
1451 | if test -z "$pic_object" || test "$pic_object" = none ; then |
||
1452 | arg="$non_pic_object" |
||
1453 | fi |
||
1454 | fi |
||
1455 | else |
||
1456 | # Only an error if not doing a dry-run. |
||
1457 | if test -z "$run"; then |
||
1458 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
||
1459 | exit 1 |
||
1460 | else |
||
1461 | # Dry-run case. |
||
1462 | |||
1463 | # Extract subdirectory from the argument. |
||
1464 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
||
1465 | if test "X$xdir" = "X$arg"; then |
||
1466 | xdir= |
||
1467 | else |
||
1468 | xdir="$xdir/" |
||
1469 | fi |
||
1470 | |||
1471 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
||
1472 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
||
1473 | libobjs="$libobjs $pic_object" |
||
1474 | non_pic_objects="$non_pic_objects $non_pic_object" |
||
1475 | fi |
||
1476 | fi |
||
1477 | ;; |
||
1478 | |||
1479 | *.$libext) |
||
1480 | # An archive. |
||
1481 | deplibs="$deplibs $arg" |
||
1482 | old_deplibs="$old_deplibs $arg" |
||
1483 | continue |
||
1484 | ;; |
||
1485 | |||
1486 | *.la) |
||
1487 | # A libtool-controlled library. |
||
1488 | |||
1489 | if test "$prev" = dlfiles; then |
||
1490 | # This library was specified with -dlopen. |
||
1491 | dlfiles="$dlfiles $arg" |
||
1492 | prev= |
||
1493 | elif test "$prev" = dlprefiles; then |
||
1494 | # The library was specified with -dlpreopen. |
||
1495 | dlprefiles="$dlprefiles $arg" |
||
1496 | prev= |
||
1497 | else |
||
1498 | deplibs="$deplibs $arg" |
||
1499 | fi |
||
1500 | continue |
||
1501 | ;; |
||
1502 | |||
1503 | # Some other compiler argument. |
||
1504 | *) |
||
1505 | # Unknown arguments in both finalize_command and compile_command need |
||
1506 | # to be aesthetically quoted because they are evaled later. |
||
1507 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
||
1508 | case $arg in |
||
1509 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
1510 | arg="\"$arg\"" |
||
1511 | ;; |
||
1512 | esac |
||
1513 | add_flags="$add_flags $arg" |
||
1514 | ;; |
||
1515 | esac |
||
1516 | |||
1517 | # Now actually substitute the argument into the commands. |
||
1518 | if test -n "$arg"; then |
||
1519 | compile_command="$compile_command $arg" |
||
1520 | finalize_command="$finalize_command $arg" |
||
1521 | fi |
||
1522 | done |
||
1523 | |||
1524 | if test -n "$prev"; then |
||
1525 | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 |
||
1526 | $echo "$help" 1>&2 |
||
1527 | exit 1 |
||
1528 | fi |
||
1529 | |||
1530 | # Infer tagged configuration to use if any are available and |
||
1531 | # if one wasn't chosen via the "--tag" command line option. |
||
1532 | # Only attempt this if the compiler in the base link |
||
1533 | # command doesn't match the default compiler. |
||
1534 | if test -n "$available_tags" && test -z "$tagname"; then |
||
1535 | case $base_compile in |
||
1536 | "$CC "*) ;; |
||
1537 | # Blanks in the command may have been stripped by the calling shell, |
||
1538 | # but not from the CC environment variable when ltconfig was run. |
||
1539 | "`$echo $CC` "*) ;; |
||
1540 | *) |
||
1541 | for z in $available_tags; do |
||
1542 | if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then |
||
1543 | # Evaluate the configuration. |
||
1544 | eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" |
||
1545 | case $base_compile in |
||
1546 | "$CC "*) |
||
1547 | # The compiler in $compile_command matches |
||
1548 | # the one in the tagged configuration. |
||
1549 | # Assume this is the tagged configuration we want. |
||
1550 | tagname=$z |
||
1551 | break |
||
1552 | ;; |
||
1553 | "`$echo $CC` "*) |
||
1554 | tagname=$z |
||
1555 | break |
||
1556 | ;; |
||
1557 | esac |
||
1558 | fi |
||
1559 | done |
||
1560 | # If $tagname still isn't set, then no tagged configuration |
||
1561 | # was found and let the user know that the "--tag" command |
||
1562 | # line option must be used. |
||
1563 | if test -z "$tagname"; then |
||
1564 | echo "$modename: unable to infer tagged configuration" |
||
1565 | echo "$modename: specify a tag with \`--tag'" 1>&2 |
||
1566 | exit 1 |
||
1567 | # else |
||
1568 | # echo "$modename: using $tagname tagged configuration" |
||
1569 | fi |
||
1570 | ;; |
||
1571 | esac |
||
1572 | fi |
||
1573 | |||
1574 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
||
1575 | eval arg=\"$export_dynamic_flag_spec\" |
||
1576 | compile_command="$compile_command $arg" |
||
1577 | finalize_command="$finalize_command $arg" |
||
1578 | fi |
||
1579 | |||
1580 | oldlibs= |
||
1581 | # calculate the name of the file, without its directory |
||
1582 | outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` |
||
1583 | libobjs_save="$libobjs" |
||
1584 | |||
1585 | if test -n "$shlibpath_var"; then |
||
1586 | # get the directories listed in $shlibpath_var |
||
1587 | eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` |
||
1588 | else |
||
1589 | shlib_search_path= |
||
1590 | fi |
||
1591 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
||
1592 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
||
1593 | |||
1594 | output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` |
||
1595 | if test "X$output_objdir" = "X$output"; then |
||
1596 | output_objdir="$objdir" |
||
1597 | else |
||
1598 | output_objdir="$output_objdir/$objdir" |
||
1599 | fi |
||
1600 | # Create the object directory. |
||
1601 | if test ! -d $output_objdir; then |
||
1602 | $show "$mkdir $output_objdir" |
||
1603 | $run $mkdir $output_objdir |
||
1604 | status=$? |
||
1605 | if test $status -ne 0 && test ! -d $output_objdir; then |
||
1606 | exit $status |
||
1607 | fi |
||
1608 | fi |
||
1609 | |||
1610 | # Determine the type of output |
||
1611 | case $output in |
||
1612 | "") |
||
1613 | $echo "$modename: you must specify an output file" 1>&2 |
||
1614 | $echo "$help" 1>&2 |
||
1615 | exit 1 |
||
1616 | ;; |
||
1617 | *.$libext) linkmode=oldlib ;; |
||
1618 | *.lo | *.$objext) linkmode=obj ;; |
||
1619 | *.la) linkmode=lib ;; |
||
1620 | *) linkmode=prog ;; # Anything else should be a program. |
||
1621 | esac |
||
1622 | |||
1623 | specialdeplibs= |
||
1624 | libs= |
||
1625 | # Find all interdependent deplibs by searching for libraries |
||
1626 | # that are linked more than once (e.g. -la -lb -la) |
||
1627 | for deplib in $deplibs; do |
||
1628 | case "$libs " in |
||
1629 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
||
1630 | esac |
||
1631 | libs="$libs $deplib" |
||
1632 | done |
||
1633 | |||
1634 | if test $linkmode = lib; then |
||
1635 | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
||
1636 | fi |
||
1637 | |||
1638 | deplibs= |
||
1639 | newdependency_libs= |
||
1640 | newlib_search_path= |
||
1641 | need_relink=no # whether we're linking any uninstalled libtool libraries |
||
1642 | uninst_deplibs= # uninstalled libtool libraries |
||
1643 | uninst_path= # paths that contain uninstalled libtool libraries |
||
1644 | case $linkmode in |
||
1645 | lib) |
||
1646 | passes="conv link" |
||
1647 | for file in $dlfiles $dlprefiles; do |
||
1648 | case $file in |
||
1649 | *.la) ;; |
||
1650 | *) |
||
1651 | $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 |
||
1652 | exit 1 |
||
1653 | ;; |
||
1654 | esac |
||
1655 | done |
||
1656 | ;; |
||
1657 | prog) |
||
1658 | compile_deplibs= |
||
1659 | finalize_deplibs= |
||
1660 | alldeplibs=no |
||
1661 | newdlfiles= |
||
1662 | newdlprefiles= |
||
1663 | passes="conv scan dlopen dlpreopen link" |
||
1664 | ;; |
||
1665 | *) passes="conv" |
||
1666 | ;; |
||
1667 | esac |
||
1668 | for pass in $passes; do |
||
1669 | if test "$linkmode,$pass" = "lib,link" || |
||
1670 | test "$linkmode,$pass" = "prog,scan"; then |
||
1671 | libs="$deplibs" |
||
1672 | deplibs= |
||
1673 | fi |
||
1674 | if test $linkmode = prog; then |
||
1675 | case $pass in |
||
1676 | dlopen) libs="$dlfiles" ;; |
||
1677 | dlpreopen) libs="$dlprefiles" ;; |
||
1678 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; |
||
1679 | esac |
||
1680 | fi |
||
1681 | if test $pass = dlopen; then |
||
1682 | # Collect dlpreopened libraries |
||
1683 | save_deplibs="$deplibs" |
||
1684 | deplibs= |
||
1685 | fi |
||
1686 | for deplib in $libs; do |
||
1687 | lib= |
||
1688 | found=no |
||
1689 | case $deplib in |
||
1690 | -l*) |
||
1691 | if test $linkmode != lib && test $linkmode != prog; then |
||
1692 | $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 |
||
1693 | continue |
||
1694 | fi |
||
1695 | if test $pass = conv; then |
||
1696 | deplibs="$deplib $deplibs" |
||
1697 | continue |
||
1698 | fi |
||
1699 | name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` |
||
1700 | for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do |
||
1701 | # Search the libtool library |
||
1702 | lib="$searchdir/lib${name}.la" |
||
1703 | if test -f "$lib"; then |
||
1704 | found=yes |
||
1705 | break |
||
1706 | fi |
||
1707 | done |
||
1708 | if test "$found" != yes; then |
||
1709 | if test "$linkmode,$pass" = "prog,link"; then |
||
1710 | compile_deplibs="$deplib $compile_deplibs" |
||
1711 | finalize_deplibs="$deplib $finalize_deplibs" |
||
1712 | else |
||
1713 | deplibs="$deplib $deplibs" |
||
1714 | test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" |
||
1715 | fi |
||
1716 | continue |
||
1717 | fi |
||
1718 | ;; |
||
1719 | -L*) |
||
1720 | case $linkmode in |
||
1721 | lib) |
||
1722 | deplibs="$deplib $deplibs" |
||
1723 | test $pass = conv && continue |
||
1724 | newdependency_libs="$deplib $newdependency_libs" |
||
1725 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
||
1726 | ;; |
||
1727 | prog) |
||
1728 | if test $pass = conv; then |
||
1729 | deplibs="$deplib $deplibs" |
||
1730 | continue |
||
1731 | fi |
||
1732 | if test $pass = scan; then |
||
1733 | deplibs="$deplib $deplibs" |
||
1734 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
||
1735 | else |
||
1736 | compile_deplibs="$deplib $compile_deplibs" |
||
1737 | finalize_deplibs="$deplib $finalize_deplibs" |
||
1738 | fi |
||
1739 | ;; |
||
1740 | *) |
||
1741 | $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 |
||
1742 | ;; |
||
1743 | esac |
||
1744 | continue |
||
1745 | ;; |
||
1746 | -R*) |
||
1747 | if test $pass = link; then |
||
1748 | dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` |
||
1749 | # Make sure the xrpath contains only unique directories. |
||
1750 | case "$xrpath " in |
||
1751 | *" $dir "*) ;; |
||
1752 | *) xrpath="$xrpath $dir" ;; |
||
1753 | esac |
||
1754 | fi |
||
1755 | deplibs="$deplib $deplibs" |
||
1756 | continue |
||
1757 | ;; |
||
1758 | *.la) lib="$deplib" ;; |
||
1759 | *.$libext) |
||
1760 | if test $pass = conv; then |
||
1761 | deplibs="$deplib $deplibs" |
||
1762 | continue |
||
1763 | fi |
||
1764 | case $linkmode in |
||
1765 | lib) |
||
1766 | if test "$deplibs_check_method" != pass_all; then |
||
1767 | echo |
||
1768 | echo "*** Warning: This library needs some functionality provided by $deplib." |
||
1769 | echo "*** I have the capability to make that library automatically link in when" |
||
1770 | echo "*** you link to this library. But I can only do this if you have a" |
||
1771 | echo "*** shared version of the library, which you do not appear to have." |
||
1772 | else |
||
1773 | echo |
||
1774 | echo "*** Warning: Linking the shared library $output against the" |
||
1775 | echo "*** static library $deplib is not portable!" |
||
1776 | deplibs="$deplib $deplibs" |
||
1777 | fi |
||
1778 | continue |
||
1779 | ;; |
||
1780 | prog) |
||
1781 | if test $pass != link; then |
||
1782 | deplibs="$deplib $deplibs" |
||
1783 | else |
||
1784 | compile_deplibs="$deplib $compile_deplibs" |
||
1785 | finalize_deplibs="$deplib $finalize_deplibs" |
||
1786 | fi |
||
1787 | continue |
||
1788 | ;; |
||
1789 | esac |
||
1790 | ;; |
||
1791 | *.lo | *.$objext) |
||
1792 | if test $pass = conv; then |
||
1793 | deplibs="$deplib $deplibs" |
||
1794 | elif test $linkmode = prog; then |
||
1795 | if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
||
1796 | # If there is no dlopen support or we're linking statically, |
||
1797 | # we need to preload. |
||
1798 | newdlprefiles="$newdlprefiles $deplib" |
||
1799 | compile_deplibs="$deplib $compile_deplibs" |
||
1800 | finalize_deplibs="$deplib $finalize_deplibs" |
||
1801 | else |
||
1802 | newdlfiles="$newdlfiles $deplib" |
||
1803 | fi |
||
1804 | fi |
||
1805 | continue |
||
1806 | ;; |
||
1807 | %DEPLIBS%) |
||
1808 | alldeplibs=yes |
||
1809 | continue |
||
1810 | ;; |
||
1811 | esac |
||
1812 | if test $found = yes || test -f "$lib"; then : |
||
1813 | else |
||
1814 | $echo "$modename: cannot find the library \`$lib'" 1>&2 |
||
1815 | exit 1 |
||
1816 | fi |
||
1817 | |||
1818 | # Check to see that this really is a libtool archive. |
||
1819 | if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
||
1820 | else |
||
1821 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
||
1822 | exit 1 |
||
1823 | fi |
||
1824 | |||
1825 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
||
1826 | test "X$ladir" = "X$lib" && ladir="." |
||
1827 | |||
1828 | dlname= |
||
1829 | dlopen= |
||
1830 | dlpreopen= |
||
1831 | libdir= |
||
1832 | library_names= |
||
1833 | old_library= |
||
1834 | # If the library was installed with an old release of libtool, |
||
1835 | # it will not redefine variable installed. |
||
1836 | installed=yes |
||
1837 | |||
1838 | # Read the .la file |
||
1839 | case $lib in |
||
1840 | */* | *\\*) . $lib ;; |
||
1841 | *) . ./$lib ;; |
||
1842 | esac |
||
1843 | |||
1844 | if test "$linkmode,$pass" = "lib,link" || |
||
1845 | test "$linkmode,$pass" = "prog,scan" || |
||
1846 | { test $linkmode != prog && test $linkmode != lib; }; then |
||
1847 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
||
1848 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" |
||
1849 | fi |
||
1850 | |||
1851 | if test $pass = conv; then |
||
1852 | # only check for convenience libraries |
||
1853 | deplibs="$lib $deplibs" |
||
1854 | if test -z "$libdir"; then |
||
1855 | if test -z "$old_library"; then |
||
1856 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
||
1857 | exit 1 |
||
1858 | fi |
||
1859 | # It is a libtool convenience library, so add in its objects. |
||
1860 | convenience="$convenience $ladir/$objdir/$old_library" |
||
1861 | old_convenience="$old_convenience $ladir/$objdir/$old_library" |
||
1862 | tmp_libs= |
||
1863 | for deplib in $dependency_libs; do |
||
1864 | deplibs="$deplib $deplibs" |
||
1865 | case "$tmp_libs " in |
||
1866 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
||
1867 | esac |
||
1868 | tmp_libs="$tmp_libs $deplib" |
||
1869 | done |
||
1870 | elif test $linkmode != prog && test $linkmode != lib; then |
||
1871 | $echo "$modename: \`$lib' is not a convenience library" 1>&2 |
||
1872 | exit 1 |
||
1873 | fi |
||
1874 | continue |
||
1875 | fi |
||
1876 | |||
1877 | # Get the name of the library we link against. |
||
1878 | linklib= |
||
1879 | for l in $old_library $library_names; do |
||
1880 | linklib="$l" |
||
1881 | done |
||
1882 | if test -z "$linklib"; then |
||
1883 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
||
1884 | exit 1 |
||
1885 | fi |
||
1886 | |||
1887 | # This library was specified with -dlopen. |
||
1888 | if test $pass = dlopen; then |
||
1889 | if test -z "$libdir"; then |
||
1890 | $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 |
||
1891 | exit 1 |
||
1892 | fi |
||
1893 | if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
||
1894 | # If there is no dlname, no dlopen support or we're linking |
||
1895 | # statically, we need to preload. We also need to preload any |
||
1896 | # dependent libraries so libltdl's deplib preloader doesn't |
||
1897 | # bomb out in the load deplibs phase. |
||
1898 | dlprefiles="$dlprefiles $lib $dependency_libs" |
||
1899 | else |
||
1900 | newdlfiles="$newdlfiles $lib" |
||
1901 | fi |
||
1902 | continue |
||
1903 | fi |
||
1904 | |||
1905 | # We need an absolute path. |
||
1906 | case $ladir in |
||
1907 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
||
1908 | *) |
||
1909 | abs_ladir=`cd "$ladir" && pwd` |
||
1910 | if test -z "$abs_ladir"; then |
||
1911 | $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 |
||
1912 | $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 |
||
1913 | abs_ladir="$ladir" |
||
1914 | fi |
||
1915 | ;; |
||
1916 | esac |
||
1917 | laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
||
1918 | |||
1919 | # Find the relevant object directory and library name. |
||
1920 | if test "X$installed" = Xyes; then |
||
1921 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
||
1922 | $echo "$modename: warning: library \`$lib' was moved." 1>&2 |
||
1923 | dir="$ladir" |
||
1924 | absdir="$abs_ladir" |
||
1925 | libdir="$abs_ladir" |
||
1926 | else |
||
1927 | dir="$libdir" |
||
1928 | absdir="$libdir" |
||
1929 | fi |
||
1930 | else |
||
1931 | dir="$ladir/$objdir" |
||
1932 | absdir="$abs_ladir/$objdir" |
||
1933 | # Remove this search path later |
||
1934 | uninst_path="$uninst_path $abs_ladir" |
||
1935 | fi |
||
1936 | name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
||
1937 | |||
1938 | # This library was specified with -dlpreopen. |
||
1939 | if test $pass = dlpreopen; then |
||
1940 | if test -z "$libdir"; then |
||
1941 | $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 |
||
1942 | exit 1 |
||
1943 | fi |
||
1944 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
||
1945 | # are required to link). |
||
1946 | if test -n "$old_library"; then |
||
1947 | newdlprefiles="$newdlprefiles $dir/$old_library" |
||
1948 | # Otherwise, use the dlname, so that lt_dlopen finds it. |
||
1949 | elif test -n "$dlname"; then |
||
1950 | newdlprefiles="$newdlprefiles $dir/$dlname" |
||
1951 | else |
||
1952 | newdlprefiles="$newdlprefiles $dir/$linklib" |
||
1953 | fi |
||
1954 | fi |
||
1955 | |||
1956 | if test -z "$libdir"; then |
||
1957 | # link the convenience library |
||
1958 | if test $linkmode = lib; then |
||
1959 | deplibs="$dir/$old_library $deplibs" |
||
1960 | elif test "$linkmode,$pass" = "prog,link"; then |
||
1961 | compile_deplibs="$dir/$old_library $compile_deplibs" |
||
1962 | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
||
1963 | else |
||
1964 | deplibs="$lib $deplibs" # used for prog,scan pass |
||
1965 | fi |
||
1966 | continue |
||
1967 | fi |
||
1968 | |||
1969 | if test $linkmode = prog && test $pass != link; then |
||
1970 | newlib_search_path="$newlib_search_path $ladir" |
||
1971 | deplibs="$lib $deplibs" |
||
1972 | |||
1973 | linkalldeplibs=no |
||
1974 | if test "$link_all_deplibs" != no || test -z "$library_names" || |
||
1975 | test "$build_libtool_libs" = no; then |
||
1976 | linkalldeplibs=yes |
||
1977 | fi |
||
1978 | |||
1979 | tmp_libs= |
||
1980 | for deplib in $dependency_libs; do |
||
1981 | case $deplib in |
||
1982 | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test |
||
1983 | esac |
||
1984 | # Need to link against all dependency_libs? |
||
1985 | if test $linkalldeplibs = yes; then |
||
1986 | deplibs="$deplib $deplibs" |
||
1987 | else |
||
1988 | # Need to hardcode shared library paths |
||
1989 | # or/and link against static libraries |
||
1990 | newdependency_libs="$deplib $newdependency_libs" |
||
1991 | fi |
||
1992 | case "$tmp_libs " in |
||
1993 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
||
1994 | esac |
||
1995 | tmp_libs="$tmp_libs $deplib" |
||
1996 | done |
||
1997 | continue |
||
1998 | fi |
||
1999 | |||
2000 | if test "$linkmode,$pass" = "prog,link"; then |
||
2001 | if test -n "$library_names" && |
||
2002 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then |
||
2003 | # We need to hardcode the library path |
||
2004 | if test -n "$shlibpath_var"; then |
||
2005 | # Make sure the rpath contains only unique directories. |
||
2006 | case "$temp_rpath " in |
||
2007 | *" $dir "*) ;; |
||
2008 | *" $absdir "*) ;; |
||
2009 | *) temp_rpath="$temp_rpath $dir" ;; |
||
2010 | esac |
||
2011 | fi |
||
2012 | |||
2013 | # Hardcode the library path. |
||
2014 | # Skip directories that are in the system default run-time |
||
2015 | # search path. |
||
2016 | case " $sys_lib_dlsearch_path " in |
||
2017 | *" $absdir "*) ;; |
||
2018 | *) |
||
2019 | case "$compile_rpath " in |
||
2020 | *" $absdir "*) ;; |
||
2021 | *) compile_rpath="$compile_rpath $absdir" |
||
2022 | esac |
||
2023 | ;; |
||
2024 | esac |
||
2025 | |||
2026 | case " $sys_lib_dlsearch_path " in |
||
2027 | *" $libdir "*) ;; |
||
2028 | *) |
||
2029 | case "$finalize_rpath " in |
||
2030 | *" $libdir "*) ;; |
||
2031 | *) finalize_rpath="$finalize_rpath $libdir" |
||
2032 | esac |
||
2033 | ;; |
||
2034 | esac |
||
2035 | fi |
||
2036 | |||
2037 | if test "$alldeplibs" = yes && |
||
2038 | { test "$deplibs_check_method" = pass_all || |
||
2039 | { test "$build_libtool_libs" = yes && |
||
2040 | test -n "$library_names"; }; }; then |
||
2041 | # We only need to search for static libraries |
||
2042 | continue |
||
2043 | fi |
||
2044 | fi |
||
2045 | |||
2046 | link_static=no # Whether the deplib will be linked statically |
||
2047 | if test -n "$library_names" && |
||
2048 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then |
||
2049 | if test "$installed" = no; then |
||
2050 | uninst_deplibs="$uninst_deplibs $lib" |
||
2051 | need_relink=yes |
||
2052 | fi |
||
2053 | # This is a shared library |
||
2054 | if test $linkmode = lib && test "$hardcode_into_libs" = all; then |
||
2055 | # Hardcode the library path. |
||
2056 | # Skip directories that are in the system default run-time |
||
2057 | # search path. |
||
2058 | case " $sys_lib_dlsearch_path " in |
||
2059 | *" $absdir "*) ;; |
||
2060 | *) |
||
2061 | case "$compile_rpath " in |
||
2062 | *" $absdir "*) ;; |
||
2063 | *) compile_rpath="$compile_rpath $absdir" |
||
2064 | esac |
||
2065 | ;; |
||
2066 | esac |
||
2067 | case " $sys_lib_dlsearch_path " in |
||
2068 | *" $libdir "*) ;; |
||
2069 | *) |
||
2070 | case "$finalize_rpath " in |
||
2071 | *" $libdir "*) ;; |
||
2072 | *) finalize_rpath="$finalize_rpath $libdir" |
||
2073 | esac |
||
2074 | ;; |
||
2075 | esac |
||
2076 | fi |
||
2077 | |||
2078 | if test -n "$old_archive_from_expsyms_cmds"; then |
||
2079 | # figure out the soname |
||
2080 | set dummy $library_names |
||
2081 | realname="$2" |
||
2082 | shift; shift |
||
2083 | libname=`eval \\$echo \"$libname_spec\"` |
||
2084 | # use dlname if we got it. it's perfectly good, no? |
||
2085 | if test -n "$dlname"; then |
||
2086 | soname="$dlname" |
||
2087 | elif test -n "$soname_spec"; then |
||
2088 | # bleh windows |
||
2089 | case $host in |
||
2090 | *cygwin*) |
||
2091 | major=`expr $current - $age` |
||
2092 | versuffix="-$major" |
||
2093 | ;; |
||
2094 | esac |
||
2095 | eval soname=\"$soname_spec\" |
||
2096 | else |
||
2097 | soname="$realname" |
||
2098 | fi |
||
2099 | |||
2100 | # Make a new name for the extract_expsyms_cmds to use |
||
2101 | soroot="$soname" |
||
2102 | soname=`echo $soroot | sed -e 's/^.*\///'` |
||
2103 | newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" |
||
2104 | |||
2105 | # If the library has no export list, then create one now |
||
2106 | if test -f "$output_objdir/$soname-def"; then : |
||
2107 | else |
||
2108 | $show "extracting exported symbol list from \`$soname'" |
||
2109 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' |
||
2110 | eval cmds=\"$extract_expsyms_cmds\" |
||
2111 | for cmd in $cmds; do |
||
2112 | IFS="$save_ifs" |
||
2113 | $show "$cmd" |
||
2114 | $run eval "$cmd" || exit $? |
||
2115 | done |
||
2116 | IFS="$save_ifs" |
||
2117 | fi |
||
2118 | |||
2119 | # Create $newlib |
||
2120 | if test -f "$output_objdir/$newlib"; then :; else |
||
2121 | $show "generating import library for \`$soname'" |
||
2122 | IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' |
||
2123 | eval cmds=\"$old_archive_from_expsyms_cmds\" |
||
2124 | for cmd in $cmds; do |
||
2125 | IFS="$save_ifs" |
||
2126 | $show "$cmd" |
||
2127 | $run eval "$cmd" || exit $? |
||
2128 | done |
||
2129 | IFS="$save_ifs" |
||
2130 | fi |
||
2131 | # make sure the library variables are pointing to the new library |
||
2132 | dir=$output_objdir |
||
2133 | linklib=$newlib |
||
2134 | fi |
||
2135 | |||
2136 | if test $linkmode = prog || test "$mode" != relink; then |
||
2137 | add_shlibpath= |
||
2138 | add_dir= |
||
2139 | add= |
||
2140 | lib_linked=yes |
||
2141 | case $hardcode_action in |
||
2142 | immediate | unsupported) |
||
2143 | if test "$hardcode_direct" = no; then |
||
2144 | add="$dir/$linklib" |
||
2145 | elif test "$hardcode_minus_L" = no; then |
||
2146 | case $host in |
||
2147 | *-*-sunos*) add_shlibpath="$dir" ;; |
||
2148 | esac |
||
2149 | add_dir="-L$dir" |
||
2150 | add="-l$name" |
||
2151 | elif test "$hardcode_shlibpath_var" = no; then |
||
2152 | add_shlibpath="$dir" |
||
2153 | add="-l$name" |
||
2154 | else |
||
2155 | lib_linked=no |
||
2156 | fi |
||
2157 | ;; |
||
2158 | relink) |
||
2159 | if test "$hardcode_direct" = yes; then |
||
2160 | add="$dir/$linklib" |
||
2161 | elif test "$hardcode_minus_L" = yes; then |
||
2162 | add_dir="-L$dir" |
||
2163 | add="-l$name" |
||
2164 | elif test "$hardcode_shlibpath_var" = yes; then |
||
2165 | add_shlibpath="$dir" |
||
2166 | add="-l$name" |
||
2167 | else |
||
2168 | lib_linked=no |
||
2169 | fi |
||
2170 | ;; |
||
2171 | *) lib_linked=no ;; |
||
2172 | esac |
||
2173 | |||
2174 | if test "$lib_linked" != yes; then |
||
2175 | $echo "$modename: configuration error: unsupported hardcode properties" |
||
2176 | exit 1 |
||
2177 | fi |
||
2178 | |||
2179 | if test -n "$add_shlibpath"; then |
||
2180 | case :$compile_shlibpath: in |
||
2181 | *":$add_shlibpath:"*) ;; |
||
2182 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; |
||
2183 | esac |
||
2184 | fi |
||
2185 | if test $linkmode = prog; then |
||
2186 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
||
2187 | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
||
2188 | else |
||
2189 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
||
2190 | test -n "$add" && deplibs="$add $deplibs" |
||
2191 | if test "$hardcode_direct" != yes && \ |
||
2192 | test "$hardcode_minus_L" != yes && \ |
||
2193 | test "$hardcode_shlibpath_var" = yes; then |
||
2194 | case :$finalize_shlibpath: in |
||
2195 | *":$libdir:"*) ;; |
||
2196 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
||
2197 | esac |
||
2198 | fi |
||
2199 | fi |
||
2200 | fi |
||
2201 | |||
2202 | if test $linkmode = prog || test "$mode" = relink; then |
||
2203 | add_shlibpath= |
||
2204 | add_dir= |
||
2205 | add= |
||
2206 | # Finalize command for both is simple: just hardcode it. |
||
2207 | if test "$hardcode_direct" = yes; then |
||
2208 | add="$libdir/$linklib" |
||
2209 | elif test "$hardcode_minus_L" = yes; then |
||
2210 | add_dir="-L$libdir" |
||
2211 | add="-l$name" |
||
2212 | elif test "$hardcode_shlibpath_var" = yes; then |
||
2213 | case :$finalize_shlibpath: in |
||
2214 | *":$libdir:"*) ;; |
||
2215 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
||
2216 | esac |
||
2217 | add="-l$name" |
||
2218 | else |
||
2219 | # We cannot seem to hardcode it, guess we'll fake it. |
||
2220 | add_dir="-L$libdir" |
||
2221 | add="-l$name" |
||
2222 | fi |
||
2223 | |||
2224 | if test $linkmode = prog; then |
||
2225 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
||
2226 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
||
2227 | else |
||
2228 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
||
2229 | test -n "$add" && deplibs="$add $deplibs" |
||
2230 | fi |
||
2231 | fi |
||
2232 | elif test $linkmode = prog; then |
||
2233 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
||
2234 | # is not unsupported. This is valid on all known static and |
||
2235 | # shared platforms. |
||
2236 | if test "$hardcode_direct" != unsupported; then |
||
2237 | test -n "$old_library" && linklib="$old_library" |
||
2238 | compile_deplibs="$dir/$linklib $compile_deplibs" |
||
2239 | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
||
2240 | else |
||
2241 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
||
2242 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
||
2243 | fi |
||
2244 | elif test "$build_libtool_libs" = yes; then |
||
2245 | # Not a shared library |
||
2246 | if test "$deplibs_check_method" != pass_all; then |
||
2247 | # We're trying link a shared library against a static one |
||
2248 | # but the system doesn't support it. |
||
2249 | # Just print a warning and add the library to dependency_libs so |
||
2250 | # that the program can be linked against the static library. |
||
2251 | echo |
||
2252 | echo "*** Warning: This library needs some functionality provided by $lib." |
||
2253 | echo "*** I have the capability to make that library automatically link in when" |
||
2254 | echo "*** you link to this library. But I can only do this if you have a" |
||
2255 | echo "*** shared version of the library, which you do not appear to have." |
||
2256 | else |
||
2257 | convenience="$convenience $dir/$old_library" |
||
2258 | old_convenience="$old_convenience $dir/$old_library" |
||
2259 | deplibs="$dir/$old_library $deplibs" |
||
2260 | link_static=yes |
||
2261 | fi |
||
2262 | fi |
||
2263 | |||
2264 | if test $linkmode = lib; then |
||
2265 | if test -n "$dependency_libs" && |
||
2266 | { test $hardcode_into_libs != yes || test $build_old_libs = yes || |
||
2267 | test $link_static = yes; }; then |
||
2268 | # Extract -R from dependency_libs |
||
2269 | temp_deplibs= |
||
2270 | for libdir in $dependency_libs; do |
||
2271 | case $libdir in |
||
2272 | -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` |
||
2273 | case " $xrpath " in |
||
2274 | *" $temp_xrpath "*) ;; |
||
2275 | *) xrpath="$xrpath $temp_xrpath";; |
||
2276 | esac;; |
||
2277 | *) temp_deplibs="$temp_deplibs $libdir";; |
||
2278 | esac |
||
2279 | done |
||
2280 | dependency_libs="$temp_deplibs" |
||
2281 | fi |
||
2282 | |||
2283 | newlib_search_path="$newlib_search_path $absdir" |
||
2284 | # Link against this library |
||
2285 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
||
2286 | # ... and its dependency_libs |
||
2287 | tmp_libs= |
||
2288 | for deplib in $dependency_libs; do |
||
2289 | newdependency_libs="$deplib $newdependency_libs" |
||
2290 | case "$tmp_libs " in |
||
2291 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
||
2292 | esac |
||
2293 | tmp_libs="$tmp_libs $deplib" |
||
2294 | done |
||
2295 | |||
2296 | if test $link_all_deplibs != no; then |
||
2297 | # Add the search paths of all dependency libraries |
||
2298 | for deplib in $dependency_libs; do |
||
2299 | case $deplib in |
||
2300 | -L*) path="$deplib" ;; |
||
2301 | *.la) |
||
2302 | dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` |
||
2303 | test "X$dir" = "X$deplib" && dir="." |
||
2304 | # We need an absolute path. |
||
2305 | case $dir in |
||
2306 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; |
||
2307 | *) |
||
2308 | absdir=`cd "$dir" && pwd` |
||
2309 | if test -z "$absdir"; then |
||
2310 | $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 |
||
2311 | absdir="$dir" |
||
2312 | fi |
||
2313 | ;; |
||
2314 | esac |
||
2315 | if grep "^installed=no" $deplib > /dev/null; then |
||
2316 | path="-L$absdir/$objdir" |
||
2317 | else |
||
2318 | eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
||
2319 | if test -z "$libdir"; then |
||
2320 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
||
2321 | exit 1 |
||
2322 | fi |
||
2323 | if test "$absdir" != "$libdir"; then |
||
2324 | $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 |
||
2325 | fi |
||
2326 | path="-L$absdir" |
||
2327 | fi |
||
2328 | ;; |
||
2329 | *) continue ;; |
||
2330 | esac |
||
2331 | case " $deplibs " in |
||
2332 | *" $path "*) ;; |
||
2333 | *) deplibs="$path $deplibs" ;; |
||
2334 | esac |
||
2335 | done |
||
2336 | fi |
||
2337 | fi |
||
2338 | done |
||
2339 | dependency_libs="$newdependency_libs" |
||
2340 | if test $pass = dlpreopen; then |
||
2341 | # Link the dlpreopened libraries before other libraries |
||
2342 | for deplib in $save_deplibs; do |
||
2343 | deplibs="$deplib $deplibs" |
||
2344 | done |
||
2345 | fi |
||
2346 | if test $pass != dlopen; then |
||
2347 | if test $pass != conv; then |
||
2348 | # Make sure lib_search_path contains only unique directories. |
||
2349 | lib_search_path= |
||
2350 | for dir in $newlib_search_path; do |
||
2351 | case "$lib_search_path " in |
||
2352 | *" $dir "*) ;; |
||
2353 | *) lib_search_path="$lib_search_path $dir" ;; |
||
2354 | esac |
||
2355 | done |
||
2356 | newlib_search_path= |
||
2357 | fi |
||
2358 | |||
2359 | if test "$linkmode,$pass" != "prog,link"; then |
||
2360 | vars="deplibs" |
||
2361 | else |
||
2362 | vars="compile_deplibs finalize_deplibs" |
||
2363 | fi |
||
2364 | for var in $vars dependency_libs; do |
||
2365 | # Make sure that $var contains only unique libraries |
||
2366 | # and add them in reverse order |
||
2367 | eval tmp_libs=\"\$$var\" |
||
2368 | new_libs= |
||
2369 | for deplib in $tmp_libs; do |
||
2370 | case "$deplib" in |
||
2371 | -L*) new_libs="$deplib $new_libs" ;; |
||
2372 | *) |
||
2373 | case " $specialdeplibs " in |
||
2374 | *" $deplib "*) new_libs="$deplib $new_libs" ;; |
||
2375 | *) |
||
2376 | case " $new_libs " in |
||
2377 | *" $deplib "*) ;; |
||
2378 | *) new_libs="$deplib $new_libs" ;; |
||
2379 | esac |
||
2380 | ;; |
||
2381 | esac |
||
2382 | ;; |
||
2383 | esac |
||
2384 | done |
||
2385 | tmp_libs= |
||
2386 | for deplib in $new_libs; do |
||
2387 | case $deplib in |
||
2388 | -L*) |
||
2389 | case " $tmp_libs " in |
||
2390 | *" $deplib "*) ;; |
||
2391 | *) tmp_libs="$tmp_libs $deplib" ;; |
||
2392 | esac |
||
2393 | ;; |
||
2394 | *) tmp_libs="$tmp_libs $deplib" ;; |
||
2395 | esac |
||
2396 | done |
||
2397 | eval $var=\"$tmp_libs\" |
||
2398 | done |
||
2399 | fi |
||
2400 | done |
||
2401 | if test $linkmode = prog; then |
||
2402 | dlfiles="$newdlfiles" |
||
2403 | dlprefiles="$newdlprefiles" |
||
2404 | fi |
||
2405 | |||
2406 | case $linkmode in |
||
2407 | oldlib) |
||
2408 | if test -n "$deplibs"; then |
||
2409 | $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 |
||
2410 | fi |
||
2411 | |||
2412 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
||
2413 | $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 |
||
2414 | fi |
||
2415 | |||
2416 | if test -n "$rpath"; then |
||
2417 | $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 |
||
2418 | fi |
||
2419 | |||
2420 | if test -n "$xrpath"; then |
||
2421 | $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 |
||
2422 | fi |
||
2423 | |||
2424 | if test -n "$vinfo"; then |
||
2425 | $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 |
||
2426 | fi |
||
2427 | |||
2428 | if test -n "$release"; then |
||
2429 | $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 |
||
2430 | fi |
||
2431 | |||
2432 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
||
2433 | $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 |
||
2434 | fi |
||
2435 | |||
2436 | # Now set the variables for building old libraries. |
||
2437 | build_libtool_libs=no |
||
2438 | oldlibs="$output" |
||
2439 | objs="$objs$old_deplibs" |
||
2440 | ;; |
||
2441 | |||
2442 | lib) |
||
2443 | # Make sure we only generate libraries of the form `libNAME.la'. |
||
2444 | case $outputname in |
||
2445 | lib*) |
||
2446 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
||
2447 | eval libname=\"$libname_spec\" |
||
2448 | ;; |
||
2449 | *) |
||
2450 | if test "$module" = no; then |
||
2451 | $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 |
||
2452 | $echo "$help" 1>&2 |
||
2453 | exit 1 |
||
2454 | fi |
||
2455 | if test "$need_lib_prefix" != no; then |
||
2456 | # Add the "lib" prefix for modules if required |
||
2457 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` |
||
2458 | eval libname=\"$libname_spec\" |
||
2459 | else |
||
2460 | libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` |
||
2461 | fi |
||
2462 | ;; |
||
2463 | esac |
||
2464 | |||
2465 | if test -n "$objs"; then |
||
2466 | if test "$deplibs_check_method" != pass_all; then |
||
2467 | $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 |
||
2468 | exit 1 |
||
2469 | else |
||
2470 | echo |
||
2471 | echo "*** Warning: Linking the shared library $output against the non-libtool" |
||
2472 | echo "*** objects $objs is not portable!" |
||
2473 | libobjs="$libobjs $objs" |
||
2474 | fi |
||
2475 | fi |
||
2476 | |||
2477 | if test "$dlself" != no; then |
||
2478 | $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 |
||
2479 | fi |
||
2480 | |||
2481 | set dummy $rpath |
||
2482 | if test $# -gt 2; then |
||
2483 | $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 |
||
2484 | fi |
||
2485 | install_libdir="$2" |
||
2486 | |||
2487 | oldlibs= |
||
2488 | if test -z "$rpath"; then |
||
2489 | if test "$build_libtool_libs" = yes; then |
||
2490 | # Building a libtool convenience library. |
||
2491 | # Some compilers have problems with a `.al' extension so |
||
2492 | # convenience libraries should have the same extension an |
||
2493 | # archive normally would. |
||
2494 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
||
2495 | build_libtool_libs=convenience |
||
2496 | build_old_libs=yes |
||
2497 | fi |
||
2498 | |||
2499 | if test -n "$vinfo"; then |
||
2500 | $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 |
||
2501 | fi |
||
2502 | |||
2503 | if test -n "$release"; then |
||
2504 | $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 |
||
2505 | fi |
||
2506 | else |
||
2507 | |||
2508 | # Parse the version information argument. |
||
2509 | IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' |
||
2510 | set dummy $vinfo 0 0 0 |
||
2511 | IFS="$save_ifs" |
||
2512 | |||
2513 | if test -n "$8"; then |
||
2514 | $echo "$modename: too many parameters to \`-version-info'" 1>&2 |
||
2515 | $echo "$help" 1>&2 |
||
2516 | exit 1 |
||
2517 | fi |
||
2518 | |||
2519 | current="$2" |
||
2520 | revision="$3" |
||
2521 | age="$4" |
||
2522 | |||
2523 | # Check that each of the things are valid numbers. |
||
2524 | case $current in |
||
2525 | |||
2526 | *) |
||
2527 | $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 |
||
2528 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
||
2529 | exit 1 |
||
2530 | ;; |
||
2531 | esac |
||
2532 | |||
2533 | case $revision in |
||
2534 | |||
2535 | *) |
||
2536 | $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 |
||
2537 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
||
2538 | exit 1 |
||
2539 | ;; |
||
2540 | esac |
||
2541 | |||
2542 | case $age in |
||
2543 | |||
2544 | *) |
||
2545 | $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 |
||
2546 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
||
2547 | exit 1 |
||
2548 | ;; |
||
2549 | esac |
||
2550 | |||
2551 | if test $age -gt $current; then |
||
2552 | $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 |
||
2553 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
||
2554 | exit 1 |
||
2555 | fi |
||
2556 | |||
2557 | # Calculate the version variables. |
||
2558 | major= |
||
2559 | versuffix= |
||
2560 | verstring= |
||
2561 | case $version_type in |
||
2562 | none) ;; |
||
2563 | |||
2564 | darwin) |
||
2565 | # Like Linux, but with the current version available in |
||
2566 | # verstring for coding it into the library header |
||
2567 | major=.`expr $current - $age` |
||
2568 | versuffix="$major.$age.$revision" |
||
2569 | # Darwin ld doesn't like 0 for these options... |
||
2570 | minor_current=`expr $current + 1` |
||
2571 | verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" |
||
2572 | ;; |
||
2573 | |||
2574 | freebsd-aout) |
||
2575 | major=".$current" |
||
2576 | versuffix=".$current.$revision"; |
||
2577 | ;; |
||
2578 | |||
2579 | freebsd-elf) |
||
2580 | major=".$current" |
||
2581 | versuffix=".$current"; |
||
2582 | ;; |
||
2583 | |||
2584 | irix) |
||
2585 | major=`expr $current - $age + 1` |
||
2586 | verstring="sgi$major.$revision" |
||
2587 | |||
2588 | # Add in all the interfaces that we are compatible with. |
||
2589 | loop=$revision |
||
2590 | while test $loop != 0; do |
||
2591 | iface=`expr $revision - $loop` |
||
2592 | loop=`expr $loop - 1` |
||
2593 | verstring="sgi$major.$iface:$verstring" |
||
2594 | done |
||
2595 | |||
2596 | # Before this point, $major must not contain `.'. |
||
2597 | major=.$major |
||
2598 | versuffix="$major.$revision" |
||
2599 | ;; |
||
2600 | |||
2601 | linux) |
||
2602 | major=.`expr $current - $age` |
||
2603 | versuffix="$major.$age.$revision" |
||
2604 | ;; |
||
2605 | |||
2606 | osf) |
||
2607 | major=`expr $current - $age` |
||
2608 | versuffix=".$current.$age.$revision" |
||
2609 | verstring="$current.$age.$revision" |
||
2610 | |||
2611 | # Add in all the interfaces that we are compatible with. |
||
2612 | loop=$age |
||
2613 | while test $loop != 0; do |
||
2614 | iface=`expr $current - $loop` |
||
2615 | loop=`expr $loop - 1` |
||
2616 | verstring="$verstring:${iface}.0" |
||
2617 | done |
||
2618 | |||
2619 | # Make executables depend on our current version. |
||
2620 | verstring="$verstring:${current}.0" |
||
2621 | ;; |
||
2622 | |||
2623 | sunos) |
||
2624 | major=".$current" |
||
2625 | versuffix=".$current.$revision" |
||
2626 | ;; |
||
2627 | |||
2628 | windows) |
||
2629 | # Use '-' rather than '.', since we only want one |
||
2630 | # extension on DOS 8.3 filesystems. |
||
2631 | major=`expr $current - $age` |
||
2632 | versuffix="-$major" |
||
2633 | ;; |
||
2634 | |||
2635 | *) |
||
2636 | $echo "$modename: unknown library version type \`$version_type'" 1>&2 |
||
2637 | echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
||
2638 | exit 1 |
||
2639 | ;; |
||
2640 | esac |
||
2641 | |||
2642 | # Clear the version info if we defaulted, and they specified a release. |
||
2643 | if test -z "$vinfo" && test -n "$release"; then |
||
2644 | major= |
||
2645 | verstring="0.0" |
||
2646 | if test "$need_version" = no; then |
||
2647 | versuffix= |
||
2648 | else |
||
2649 | versuffix=".0.0" |
||
2650 | fi |
||
2651 | fi |
||
2652 | |||
2653 | # Remove version info from name if versioning should be avoided |
||
2654 | if test "$avoid_version" = yes && test "$need_version" = no; then |
||
2655 | major= |
||
2656 | versuffix= |
||
2657 | verstring="" |
||
2658 | fi |
||
2659 | |||
2660 | # Check to see if the archive will have undefined symbols. |
||
2661 | if test "$allow_undefined" = yes; then |
||
2662 | if test "$allow_undefined_flag" = unsupported; then |
||
2663 | $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 |
||
2664 | build_libtool_libs=no |
||
2665 | build_old_libs=yes |
||
2666 | fi |
||
2667 | else |
||
2668 | # Don't allow undefined symbols. |
||
2669 | allow_undefined_flag="$no_undefined_flag" |
||
2670 | fi |
||
2671 | fi |
||
2672 | |||
2673 | if test "$mode" != relink; then |
||
2674 | # Remove our outputs, but don't remove object files since they |
||
2675 | # may have been created when compiling PIC objects. |
||
2676 | removelist= |
||
2677 | tempremovelist=`echo "$output_objdir/*"` |
||
2678 | for p in $tempremovelist; do |
||
2679 | case $p in |
||
2680 | *.$objext) |
||
2681 | ;; |
||
2682 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) |
||
2683 | removelist="$removelist $p" |
||
2684 | ;; |
||
2685 | *) ;; |
||
2686 | esac |
||
2687 | done |
||
2688 | if test -n "$removelist"; then |
||
2689 | $show "${rm}r $removelist" |
||
2690 | $run ${rm}r $removelist |
||
2691 | fi |
||
2692 | fi |
||
2693 | |||
2694 | # Now set the variables for building old libraries. |
||
2695 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then |
||
2696 | oldlibs="$oldlibs $output_objdir/$libname.$libext" |
||
2697 | |||
2698 | # Transform .lo files to .o files. |
||
2699 | oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` |
||
2700 | fi |
||
2701 | |||
2702 | # Eliminate all temporary directories. |
||
2703 | for path in $uninst_path; do |
||
2704 | lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` |
||
2705 | deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` |
||
2706 | dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` |
||
2707 | done |
||
2708 | |||
2709 | if test -n "$xrpath"; then |
||
2710 | # If the user specified any rpath flags, then add them. |
||
2711 | temp_xrpath= |
||
2712 | for libdir in $xrpath; do |
||
2713 | temp_xrpath="$temp_xrpath -R$libdir" |
||
2714 | case "$finalize_rpath " in |
||
2715 | *" $libdir "*) ;; |
||
2716 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
||
2717 | esac |
||
2718 | done |
||
2719 | if test $hardcode_into_libs != yes || test $build_old_libs = yes; then |
||
2720 | dependency_libs="$temp_xrpath $dependency_libs" |
||
2721 | fi |
||
2722 | fi |
||
2723 | |||
2724 | # Make sure dlfiles contains only unique files that won't be dlpreopened |
||
2725 | old_dlfiles="$dlfiles" |
||
2726 | dlfiles= |
||
2727 | for lib in $old_dlfiles; do |
||
2728 | case " $dlprefiles $dlfiles " in |
||
2729 | *" $lib "*) ;; |
||
2730 | *) dlfiles="$dlfiles $lib" ;; |
||
2731 | esac |
||
2732 | done |
||
2733 | |||
2734 | # Make sure dlprefiles contains only unique files |
||
2735 | old_dlprefiles="$dlprefiles" |
||
2736 | dlprefiles= |
||
2737 | for lib in $old_dlprefiles; do |
||
2738 | case "$dlprefiles " in |
||
2739 | *" $lib "*) ;; |
||
2740 | *) dlprefiles="$dlprefiles $lib" ;; |
||
2741 | esac |
||
2742 | done |
||
2743 | |||
2744 | if test "$build_libtool_libs" = yes; then |
||
2745 | if test -n "$rpath"; then |
||
2746 | case $host in |
||
2747 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) |
||
2748 | # these systems don't actually have a c library (as such)! |
||
2749 | ;; |
||
2750 | *-*-rhapsody* | *-*-darwin1.[012]) |
||
2751 | # Rhapsody C library is in the System framework |
||
2752 | deplibs="$deplibs -framework System" |
||
2753 | ;; |
||
2754 | *) |
||
2755 | # Add libc to deplibs on all other systems if necessary. |
||
2756 | if test $build_libtool_need_lc = "yes"; then |
||
2757 | deplibs="$deplibs -lc" |
||
2758 | fi |
||
2759 | ;; |
||
2760 | esac |
||
2761 | fi |
||
2762 | |||
2763 | # Transform deplibs into only deplibs that can be linked in shared. |
||
2764 | name_save=$name |
||
2765 | libname_save=$libname |
||
2766 | release_save=$release |
||
2767 | versuffix_save=$versuffix |
||
2768 | major_save=$major |
||
2769 | # I'm not sure if I'm treating the release correctly. I think |
||
2770 | # release should show up in the -l (ie -lgmp5) so we don't want to |
||
2771 | # add it in twice. Is that correct? |
||
2772 | release="" |
||
2773 | versuffix="" |
||
2774 | major="" |
||
2775 | newdeplibs= |
||
2776 | droppeddeps=no |
||
2777 | case $deplibs_check_method in |
||
2778 | pass_all) |
||
2779 | # Don't check for shared/static. Everything works. |
||
2780 | # This might be a little naive. We might want to check |
||
2781 | # whether the library exists or not. But this is on |
||
2782 | # osf3 & osf4 and I'm not really sure... Just |
||
2783 | # implementing what was already the behaviour. |
||
2784 | newdeplibs=$deplibs |
||
2785 | ;; |
||
2786 | test_compile) |
||
2787 | # This code stresses the "libraries are programs" paradigm to its |
||
2788 | # limits. Maybe even breaks it. We compile a program, linking it |
||
2789 | # against the deplibs as a proxy for the library. Then we can check |
||
2790 | # whether they linked in statically or dynamically with ldd. |
||
2791 | $rm conftest.c |
||
2792 | cat > conftest.c <<EOF |
||
2793 | int main() { return 0; } |
||
2794 | EOF |
||
2795 | $rm conftest |
||
2796 | $LTCC -o conftest conftest.c $deplibs |
||
2797 | if test $? -eq 0 ; then |
||
2798 | ldd_output=`ldd conftest` |
||
2799 | for i in $deplibs; do |
||
2800 | name="`expr $i : '-l\(.*\)'`" |
||
2801 | # If $name is empty we are operating on a -L argument. |
||
2802 | if test "$name" != "" -a "$name" != "0"; then |
||
2803 | libname=`eval \\$echo \"$libname_spec\"` |
||
2804 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
||
2805 | set dummy $deplib_matches |
||
2806 | deplib_match=$2 |
||
2807 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
||
2808 | newdeplibs="$newdeplibs $i" |
||
2809 | else |
||
2810 | droppeddeps=yes |
||
2811 | echo |
||
2812 | echo "*** Warning: This library needs some functionality provided by $i." |
||
2813 | echo "*** I have the capability to make that library automatically link in when" |
||
2814 | echo "*** you link to this library. But I can only do this if you have a" |
||
2815 | echo "*** shared version of the library, which you do not appear to have." |
||
2816 | fi |
||
2817 | else |
||
2818 | newdeplibs="$newdeplibs $i" |
||
2819 | fi |
||
2820 | done |
||
2821 | else |
||
2822 | # Error occured in the first compile. Let's try to salvage the situation: |
||
2823 | # Compile a seperate program for each library. |
||
2824 | for i in $deplibs; do |
||
2825 | name="`expr $i : '-l\(.*\)'`" |
||
2826 | # If $name is empty we are operating on a -L argument. |
||
2827 | if test "$name" != "" -a "$name" != "0"; then |
||
2828 | $rm conftest |
||
2829 | $LTCC -o conftest conftest.c $i |
||
2830 | # Did it work? |
||
2831 | if test $? -eq 0 ; then |
||
2832 | ldd_output=`ldd conftest` |
||
2833 | libname=`eval \\$echo \"$libname_spec\"` |
||
2834 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
||
2835 | set dummy $deplib_matches |
||
2836 | deplib_match=$2 |
||
2837 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
||
2838 | newdeplibs="$newdeplibs $i" |
||
2839 | else |
||
2840 | droppeddeps=yes |
||
2841 | echo |
||
2842 | echo "*** Warning: This library needs some functionality provided by $i." |
||
2843 | echo "*** I have the capability to make that library automatically link in when" |
||
2844 | echo "*** you link to this library. But I can only do this if you have a" |
||
2845 | echo "*** shared version of the library, which you do not appear to have." |
||
2846 | fi |
||
2847 | else |
||
2848 | droppeddeps=yes |
||
2849 | echo |
||
2850 | echo "*** Warning! Library $i is needed by this library but I was not able to" |
||
2851 | echo "*** make it link in! You will probably need to install it or some" |
||
2852 | echo "*** library that it depends on before this library will be fully" |
||
2853 | echo "*** functional. Installing it before continuing would be even better." |
||
2854 | fi |
||
2855 | else |
||
2856 | newdeplibs="$newdeplibs $i" |
||
2857 | fi |
||
2858 | done |
||
2859 | fi |
||
2860 | ;; |
||
2861 | file_magic*) |
||
2862 | set dummy $deplibs_check_method |
||
2863 | file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
||
2864 | for a_deplib in $deplibs; do |
||
2865 | name="`expr $a_deplib : '-l\(.*\)'`" |
||
2866 | # If $name is empty we are operating on a -L argument. |
||
2867 | if test "$name" != "" -a "$name" != "0"; then |
||
2868 | libname=`eval \\$echo \"$libname_spec\"` |
||
2869 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
||
2870 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
||
2871 | for potent_lib in $potential_libs; do |
||
2872 | # Follow soft links. |
||
2873 | if ls -lLd "$potent_lib" 2>/dev/null \ |
||
2874 | | grep " -> " >/dev/null; then |
||
2875 | continue |
||
2876 | fi |
||
2877 | # The statement above tries to avoid entering an |
||
2878 | # endless loop below, in case of cyclic links. |
||
2879 | # We might still enter an endless loop, since a link |
||
2880 | # loop can be closed while we follow links, |
||
2881 | # but so what? |
||
2882 | potlib="$potent_lib" |
||
2883 | while test -h "$potlib" 2>/dev/null; do |
||
2884 | potliblink=`ls -ld $potlib | sed 's/.* -> //'` |
||
2885 | case $potliblink in |
||
2886 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
||
2887 | *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; |
||
2888 | esac |
||
2889 | done |
||
2890 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ |
||
2891 | | sed 10q \ |
||
2892 | | egrep "$file_magic_regex" > /dev/null; then |
||
2893 | newdeplibs="$newdeplibs $a_deplib" |
||
2894 | a_deplib="" |
||
2895 | break 2 |
||
2896 | fi |
||
2897 | done |
||
2898 | done |
||
2899 | if test -n "$a_deplib" ; then |
||
2900 | droppeddeps=yes |
||
2901 | echo |
||
2902 | echo "*** Warning: This library needs some functionality provided by $a_deplib." |
||
2903 | echo "*** I have the capability to make that library automatically link in when" |
||
2904 | echo "*** you link to this library. But I can only do this if you have a" |
||
2905 | echo "*** shared version of the library, which you do not appear to have." |
||
2906 | fi |
||
2907 | else |
||
2908 | # Add a -L argument. |
||
2909 | newdeplibs="$newdeplibs $a_deplib" |
||
2910 | fi |
||
2911 | done # Gone through all deplibs. |
||
2912 | ;; |
||
2913 | none | unknown | *) |
||
2914 | newdeplibs="" |
||
2915 | if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ |
||
2916 | -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | |
||
2917 | grep . >/dev/null; then |
||
2918 | echo |
||
2919 | if test "X$deplibs_check_method" = "Xnone"; then |
||
2920 | echo "*** Warning: inter-library dependencies are not supported in this platform." |
||
2921 | else |
||
2922 | echo "*** Warning: inter-library dependencies are not known to be supported." |
||
2923 | fi |
||
2924 | echo "*** All declared inter-library dependencies are being dropped." |
||
2925 | droppeddeps=yes |
||
2926 | fi |
||
2927 | ;; |
||
2928 | esac |
||
2929 | versuffix=$versuffix_save |
||
2930 | major=$major_save |
||
2931 | release=$release_save |
||
2932 | libname=$libname_save |
||
2933 | name=$name_save |
||
2934 | |||
2935 | if test "$droppeddeps" = yes; then |
||
2936 | if test "$module" = yes; then |
||
2937 | echo |
||
2938 | echo "*** Warning: libtool could not satisfy all declared inter-library" |
||
2939 | echo "*** dependencies of module $libname. Therefore, libtool will create" |
||
2940 | echo "*** a static module, that should work as long as the dlopening" |
||
2941 | echo "*** application is linked with the -dlopen flag." |
||
2942 | if test -z "$global_symbol_pipe"; then |
||
2943 | echo |
||
2944 | echo "*** However, this would only work if libtool was able to extract symbol" |
||
2945 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
||
2946 | echo "*** not find such a program. So, this module is probably useless." |
||
2947 | echo "*** \`nm' from GNU binutils and a full rebuild may help." |
||
2948 | fi |
||
2949 | if test "$build_old_libs" = no; then |
||
2950 | oldlibs="$output_objdir/$libname.$libext" |
||
2951 | build_libtool_libs=module |
||
2952 | build_old_libs=yes |
||
2953 | else |
||
2954 | build_libtool_libs=no |
||
2955 | fi |
||
2956 | else |
||
2957 | echo "*** The inter-library dependencies that have been dropped here will be" |
||
2958 | echo "*** automatically added whenever a program is linked with this library" |
||
2959 | echo "*** or is declared to -dlopen it." |
||
2960 | |||
2961 | if test $allow_undefined = no; then |
||
2962 | echo |
||
2963 | echo "*** Since this library must not contain undefined symbols," |
||
2964 | echo "*** because either the platform does not support them or" |
||
2965 | echo "*** it was explicitly requested with -no-undefined," |
||
2966 | echo "*** libtool will only create a static version of it." |
||
2967 | if test "$build_old_libs" = no; then |
||
2968 | oldlibs="$output_objdir/$libname.$libext" |
||
2969 | build_libtool_libs=module |
||
2970 | build_old_libs=yes |
||
2971 | else |
||
2972 | build_libtool_libs=no |
||
2973 | fi |
||
2974 | fi |
||
2975 | fi |
||
2976 | fi |
||
2977 | # Done checking deplibs! |
||
2978 | deplibs=$newdeplibs |
||
2979 | fi |
||
2980 | |||
2981 | # All the library-specific variables (install_libdir is set above). |
||
2982 | library_names= |
||
2983 | old_library= |
||
2984 | dlname= |
||
2985 | |||
2986 | # Test again, we may have decided not to build it any more |
||
2987 | if test "$build_libtool_libs" = yes; then |
||
2988 | if test $hardcode_into_libs = yes; then |
||
2989 | # Hardcode the library paths |
||
2990 | hardcode_libdirs= |
||
2991 | dep_rpath= |
||
2992 | rpath="$finalize_rpath" |
||
2993 | test "$mode" != relink && rpath="$compile_rpath$rpath" |
||
2994 | for libdir in $rpath; do |
||
2995 | if test -n "$hardcode_libdir_flag_spec"; then |
||
2996 | if test -n "$hardcode_libdir_separator"; then |
||
2997 | if test -z "$hardcode_libdirs"; then |
||
2998 | hardcode_libdirs="$libdir" |
||
2999 | else |
||
3000 | # Just accumulate the unique libdirs. |
||
3001 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
||
3002 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
||
3003 | ;; |
||
3004 | *) |
||
3005 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
||
3006 | ;; |
||
3007 | esac |
||
3008 | fi |
||
3009 | else |
||
3010 | eval flag=\"$hardcode_libdir_flag_spec\" |
||
3011 | dep_rpath="$dep_rpath $flag" |
||
3012 | fi |
||
3013 | elif test -n "$runpath_var"; then |
||
3014 | case "$perm_rpath " in |
||
3015 | *" $libdir "*) ;; |
||
3016 | *) perm_rpath="$perm_rpath $libdir" ;; |
||
3017 | esac |
||
3018 | fi |
||
3019 | done |
||
3020 | # Substitute the hardcoded libdirs into the rpath. |
||
3021 | if test -n "$hardcode_libdir_separator" && |
||
3022 | test -n "$hardcode_libdirs"; then |
||
3023 | libdir="$hardcode_libdirs" |
||
3024 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" |
||
3025 | fi |
||
3026 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
||
3027 | # We should set the runpath_var. |
||
3028 | rpath= |
||
3029 | for dir in $perm_rpath; do |
||
3030 | rpath="$rpath$dir:" |
||
3031 | done |
||
3032 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
||
3033 | fi |
||
3034 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
||
3035 | fi |
||
3036 | |||
3037 | shlibpath="$finalize_shlibpath" |
||
3038 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" |
||
3039 | if test -n "$shlibpath"; then |
||
3040 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
||
3041 | fi |
||
3042 | |||
3043 | # Get the real and link names of the library. |
||
3044 | eval library_names=\"$library_names_spec\" |
||
3045 | set dummy $library_names |
||
3046 | realname="$2" |
||
3047 | shift; shift |
||
3048 | |||
3049 | if test -n "$soname_spec"; then |
||
3050 | eval soname=\"$soname_spec\" |
||
3051 | else |
||
3052 | soname="$realname" |
||
3053 | fi |
||
3054 | if test x$dlname = x; then |
||
3055 | dlname=$soname |
||
3056 | fi |
||
3057 | |||
3058 | lib="$output_objdir/$realname" |
||
3059 | for link |
||
3060 | do |
||
3061 | linknames="$linknames $link" |
||
3062 | done |
||
3063 | |||
3064 | # # Ensure that we have .o objects for linkers which dislike .lo |
||
3065 | # # (e.g. aix) in case we are running --disable-static |
||
3066 | # for obj in $libobjs; do |
||
3067 | # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
||
3068 | # if test "X$xdir" = "X$obj"; then |
||
3069 | # xdir="." |
||
3070 | # else |
||
3071 | # xdir="$xdir" |
||
3072 | # fi |
||
3073 | # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
||
3074 | # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` |
||
3075 | # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then |
||
3076 | # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" |
||
3077 | # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? |
||
3078 | # fi |
||
3079 | # done |
||
3080 | |||
3081 | # Use standard objects if they are pic |
||
3082 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
||
3083 | |||
3084 | # Prepare the list of exported symbols |
||
3085 | if test -z "$export_symbols"; then |
||
3086 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then |
||
3087 | $show "generating symbol list for \`$libname.la'" |
||
3088 | export_symbols="$output_objdir/$libname.exp" |
||
3089 | $run $rm $export_symbols |
||
3090 | eval cmds=\"$export_symbols_cmds\" |
||
3091 | IFS="${IFS= }"; 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 | if test -n "$export_symbols_regex"; then |
||
3099 | $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" |
||
3100 | $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
||
3101 | $show "$mv \"${export_symbols}T\" \"$export_symbols\"" |
||
3102 | $run eval '$mv "${export_symbols}T" "$export_symbols"' |
||
3103 | fi |
||
3104 | fi |
||
3105 | fi |
||
3106 | |||
3107 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
||
3108 | $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' |
||
3109 | fi |
||
3110 | |||
3111 | if test -n "$convenience"; then |
||
3112 | if test -n "$whole_archive_flag_spec"; then |
||
3113 | save_libobjs=$libobjs |
||
3114 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
||
3115 | else |
||
3116 | gentop="$output_objdir/${outputname}x" |
||
3117 | $show "${rm}r $gentop" |
||
3118 | $run ${rm}r "$gentop" |
||
3119 | $show "$mkdir $gentop" |
||
3120 | $run $mkdir "$gentop" |
||
3121 | status=$? |
||
3122 | if test $status -ne 0 && test ! -d "$gentop"; then |
||
3123 | exit $status |
||
3124 | fi |
||
3125 | generated="$generated $gentop" |
||
3126 | |||
3127 | for xlib in $convenience; do |
||
3128 | # Extract the objects. |
||
3129 | case $xlib in |
||
3130 | [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; |
||
3131 | *) xabs=`pwd`"/$xlib" ;; |
||
3132 | esac |
||
3133 | xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` |
||
3134 | xdir="$gentop/$xlib" |
||
3135 | |||
3136 | $show "${rm}r $xdir" |
||
3137 | $run ${rm}r "$xdir" |
||
3138 | $show "$mkdir $xdir" |
||
3139 | $run $mkdir "$xdir" |
||
3140 | status=$? |
||
3141 | if test $status -ne 0 && test ! -d "$xdir"; then |
||
3142 | exit $status |
||
3143 | fi |
||
3144 | $show "(cd $xdir && $AR x $xabs)" |
||
3145 | $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? |
||
3146 | |||
3147 | libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
||
3148 | done |
||
3149 | fi |
||
3150 | fi |
||
3151 | |||
3152 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
||
3153 | eval flag=\"$thread_safe_flag_spec\" |
||
3154 | linker_flags="$linker_flags $flag" |
||
3155 | fi |
||
3156 | |||
3157 | # Make a backup of the uninstalled library when relinking |
||
3158 | if test "$mode" = relink && test "$hardcode_into_libs" = all; then |
||
3159 | $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? |
||
3160 | fi |
||
3161 | |||
3162 | # Add all flags from the command line. We here create a library, |
||
3163 | # but those flags were only added to compile_command and |
||
3164 | # finalize_command, which are only used when creating executables. |
||
3165 | # So do it by hand here. |
||
3166 | compiler_flags="$compiler_flags $add_flags" |
||
3167 | # Only add it to commands which use CC, instead of LD, i.e. |
||
3168 | # only to $compiler_flags |
||
3169 | #linker_flags="$linker_flags $add_flags" |
||
3170 | |||
3171 | # Do each of the archive commands. |
||
3172 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
||
3173 | eval cmds=\"$archive_expsym_cmds\" |
||
3174 | else |
||
3175 | eval cmds=\"$archive_cmds\" |
||
3176 | fi |
||
3177 | if len=`expr "X$cmds" : ".*"` && |
||
3178 | test $len -le $max_cmd_len; then |
||
3179 | : |
||
3180 | else |
||
3181 | # The command line is too long to link in one step, link piecewise. |
||
3182 | $echo "creating reloadable object files..." |
||
3183 | |||
3184 | # Save the value of $output and $libobjs because we want to |
||
3185 | # |