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