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