1 | # ltmain.sh - Provide generalized library-building support services. |
---|
2 | # NOTE: Changing this file will not affect anything until you rerun configure. |
---|
3 | # |
---|
4 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 |
---|
5 | # Free Software Foundation, Inc. |
---|
6 | # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
---|
7 | # |
---|
8 | # This program is free software; you can redistribute it and/or modify |
---|
9 | # it under the terms of the GNU General Public License as published by |
---|
10 | # the Free Software Foundation; either version 2 of the License, or |
---|
11 | # (at your option) any later version. |
---|
12 | # |
---|
13 | # This program is distributed in the hope that it will be useful, but |
---|
14 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | # General Public License for more details. |
---|
17 | # |
---|
18 | # You should have received a copy of the GNU General Public License |
---|
19 | # along with this program; if not, write to the Free Software |
---|
20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
21 | # |
---|
22 | # As a special exception to the GNU General Public License, if you |
---|
23 | # distribute this file as part of a program that contains a |
---|
24 | # configuration script generated by Autoconf, you may include it under |
---|
25 | # the same distribution terms that you use for the rest of that program. |
---|
26 | |
---|
27 | # Check that we have a working $echo. |
---|
28 | if test "X$1" = X--no-reexec; then |
---|
29 | # Discard the --no-reexec flag, and continue. |
---|
30 | shift |
---|
31 | elif test "X$1" = X--fallback-echo; then |
---|
32 | # Avoid inline document here, it may be left over |
---|
33 | : |
---|
34 | elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then |
---|
35 | # Yippee, $echo works! |
---|
36 | : |
---|
37 | else |
---|
38 | # Restart under the correct shell, and then maybe $echo will work. |
---|
39 | exec $SHELL "$0" --no-reexec ${1+"$@"} |
---|
40 | fi |
---|
41 | |
---|
42 | if test "X$1" = X--fallback-echo; then |
---|
43 | # used as fallback echo |
---|
44 | shift |
---|
45 | cat <<EOF |
---|
46 | $* |
---|
47 | EOF |
---|
48 | exit 0 |
---|
49 | fi |
---|
50 | |
---|
51 | # The name of this program. |
---|
52 | progname=`$echo "$0" | ${SED} 's%^.*/%%'` |
---|
53 | modename="$progname" |
---|
54 | |
---|
55 | # Constants. |
---|
56 | PROGRAM=ltmain.sh |
---|
57 | PACKAGE=libtool |
---|
58 | VERSION=1.5 |
---|
59 | TIMESTAMP=" (1.1220 2003/04/05 19:32:58)" |
---|
60 | |
---|
61 | default_mode= |
---|
62 | help="Try \`$progname --help' for more information." |
---|
63 | magic="%%%MAGIC variable%%%" |
---|
64 | mkdir="mkdir" |
---|
65 | mv="mv -f" |
---|
66 | rm="rm -f" |
---|
67 | |
---|
68 | # Sed substitution that helps us do robust quoting. It backslashifies |
---|
69 | # metacharacters that are still active within double-quoted strings. |
---|
70 | Xsed="${SED}"' -e 1s/^X//' |
---|
71 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
---|
72 | # test EBCDIC or ASCII |
---|
73 | case `echo A|od -x` in |
---|
74 | *[Cc]1*) # EBCDIC based system |
---|
75 | SP2NL="tr '\100' '\n'" |
---|
76 | NL2SP="tr '\r\n' '\100\100'" |
---|
77 | ;; |
---|
78 | *) # Assume ASCII based system |
---|
79 | SP2NL="tr '\040' '\012'" |
---|
80 | NL2SP="tr '\015\012' '\040\040'" |
---|
81 | ;; |
---|
82 | esac |
---|
83 | |
---|
84 | # NLS nuisances. |
---|
85 | # Only set LANG and LC_ALL to C if already set. |
---|
86 | # These must not be set unconditionally because not all systems understand |
---|
87 | # e.g. LANG=C (notably SCO). |
---|
88 | # We save the old values to restore during execute mode. |
---|
89 | if test "${LC_ALL+set}" = set; then |
---|
90 | save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL |
---|
91 | fi |
---|
92 | if test "${LANG+set}" = set; then |
---|
93 | save_LANG="$LANG"; LANG=C; export LANG |
---|
94 | fi |
---|
95 | |
---|
96 | # Make sure IFS has a sensible default |
---|
97 | : ${IFS=" "} |
---|
98 | |
---|
99 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
---|
100 | $echo "$modename: not configured to build any kind of library" 1>&2 |
---|
101 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
---|
102 | exit 1 |
---|
103 | fi |
---|
104 | |
---|
105 | # Global variables. |
---|
106 | mode=$default_mode |
---|
107 | nonopt= |
---|
108 | prev= |
---|
109 | prevopt= |
---|
110 | run= |
---|
111 | show="$echo" |
---|
112 | show_help= |
---|
113 | execute_dlfiles= |
---|
114 | lo2o="s/\\.lo\$/.${objext}/" |
---|
115 | o2lo="s/\\.${objext}\$/.lo/" |
---|
116 | |
---|
117 | ##################################### |
---|
118 | # Shell function definitions: |
---|
119 | # This seems to be the best place for them |
---|
120 | |
---|
121 | # Need a lot of goo to handle *both* DLLs and import libs |
---|
122 | # Has to be a shell function in order to 'eat' the argument |
---|
123 | # that is supplied when $file_magic_command is called. |
---|
124 | win32_libid () { |
---|
125 | win32_libid_type="unknown" |
---|
126 | win32_fileres=`file -L $1 2>/dev/null` |
---|
127 | case $win32_fileres in |
---|
128 | *ar\ archive\ import\ library*) # definitely import |
---|
129 | win32_libid_type="x86 archive import" |
---|
130 | ;; |
---|
131 | *ar\ archive*) # could be an import, or static |
---|
132 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ |
---|
133 | grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then |
---|
134 | win32_nmres=`eval $NM -f posix -A $1 | \ |
---|
135 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` |
---|
136 | if test "X$win32_nmres" = "Ximport" ; then |
---|
137 | win32_libid_type="x86 archive import" |
---|
138 | else |
---|
139 | win32_libid_type="x86 archive static" |
---|
140 | fi |
---|
141 | fi |
---|
142 | ;; |
---|
143 | *DLL*) |
---|
144 | win32_libid_type="x86 DLL" |
---|
145 | ;; |
---|
146 | *executable*) # but shell scripts are "executable" too... |
---|
147 | case $win32_fileres in |
---|
148 | *MS\ Windows\ PE\ Intel*) |
---|
149 | win32_libid_type="x86 DLL" |
---|
150 | ;; |
---|
151 | esac |
---|
152 | ;; |
---|
153 | esac |
---|
154 | $echo $win32_libid_type |
---|
155 | } |
---|
156 | |
---|
157 | # End of Shell function definitions |
---|
158 | ##################################### |
---|
159 | |
---|
160 | # Parse our command line options once, thoroughly. |
---|
161 | while test "$#" -gt 0 |
---|
162 | do |
---|
163 | arg="$1" |
---|
164 | shift |
---|
165 | |
---|
166 | case $arg in |
---|
167 | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
---|
168 | *) optarg= ;; |
---|
169 | esac |
---|
170 | |
---|
171 | # If the previous option needs an argument, assign it. |
---|
172 | if test -n "$prev"; then |
---|
173 | case $prev in |
---|
174 | execute_dlfiles) |
---|
175 | execute_dlfiles="$execute_dlfiles $arg" |
---|
176 | ;; |
---|
177 | tag) |
---|
178 | tagname="$arg" |
---|
179 | |
---|
180 | # Check whether tagname contains only valid characters |
---|
181 | case $tagname in |
---|
182 | *[!-_A-Za-z0-9,/]*) |
---|
183 | $echo "$progname: invalid tag name: $tagname" 1>&2 |
---|
184 | exit 1 |
---|
185 | ;; |
---|
186 | esac |
---|
187 | |
---|
188 | case $tagname in |
---|
189 | CC) |
---|
190 | # Don't test for the "default" C tag, as we know, it's there, but |
---|
191 | # not specially marked. |
---|
192 | ;; |
---|
193 | *) |
---|
194 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then |
---|
195 | taglist="$taglist $tagname" |
---|
196 | # Evaluate the configuration. |
---|
197 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" |
---|
198 | else |
---|
199 | $echo "$progname: ignoring unknown tag $tagname" 1>&2 |
---|
200 | fi |
---|
201 | ;; |
---|
202 | esac |
---|
203 | ;; |
---|
204 | *) |
---|
205 | eval "$prev=\$arg" |
---|
206 | ;; |
---|
207 | esac |
---|
208 | |
---|
209 | prev= |
---|
210 | prevopt= |
---|
211 | continue |
---|
212 | fi |
---|
213 | |
---|
214 | # Have we seen a non-optional argument yet? |
---|
215 | case $arg in |
---|
216 | --help) |
---|
217 | show_help=yes |
---|
218 | ;; |
---|
219 | |
---|
220 | --version) |
---|
221 | $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
---|
222 | $echo |
---|
223 | $echo "Copyright (C) 2003 Free Software Foundation, Inc." |
---|
224 | $echo "This is free software; see the source for copying conditions. There is NO" |
---|
225 | $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." |
---|
226 | exit 0 |
---|
227 | ;; |
---|
228 | |
---|
229 | --config) |
---|
230 | ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 |
---|
231 | # Now print the configurations for the tags. |
---|
232 | for tagname in $taglist; do |
---|
233 | ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" |
---|
234 | done |
---|
235 | exit 0 |
---|
236 | ;; |
---|
237 | |
---|
238 | --debug) |
---|
239 | $echo "$progname: enabling shell trace mode" |
---|
240 | set -x |
---|
241 | ;; |
---|
242 | |
---|
243 | --dry-run | -n) |
---|
244 | run=: |
---|
245 | ;; |
---|
246 | |
---|
247 | --features) |
---|
248 | $echo "host: $host" |
---|
249 | if test "$build_libtool_libs" = yes; then |
---|
250 | $echo "enable shared libraries" |
---|
251 | else |
---|
252 | $echo "disable shared libraries" |
---|
253 | fi |
---|
254 | if test "$build_old_libs" = yes; then |
---|
255 | $echo "enable static libraries" |
---|
256 | else |
---|
257 | $echo "disable static libraries" |
---|
258 | fi |
---|
259 | exit 0 |
---|
260 | ;; |
---|
261 | |
---|
262 | --finish) mode="finish" ;; |
---|
263 | |
---|
264 | --mode) prevopt="--mode" prev=mode ;; |
---|
265 | --mode=*) mode="$optarg" ;; |
---|
266 | |
---|
267 | --preserve-dup-deps) duplicate_deps="yes" ;; |
---|
268 | |
---|
269 | --quiet | --silent) |
---|
270 | show=: |
---|
271 | ;; |
---|
272 | |
---|
273 | --tag) prevopt="--tag" prev=tag ;; |
---|
274 | --tag=*) |
---|
275 | set tag "$optarg" ${1+"$@"} |
---|
276 | shift |
---|
277 | prev=tag |
---|
278 | ;; |
---|
279 | |
---|
280 | -dlopen) |
---|
281 | prevopt="-dlopen" |
---|
282 | prev=execute_dlfiles |
---|
283 | ;; |
---|
284 | |
---|
285 | -*) |
---|
286 | $echo "$modename: unrecognized option \`$arg'" 1>&2 |
---|
287 | $echo "$help" 1>&2 |
---|
288 | exit 1 |
---|
289 | ;; |
---|
290 | |
---|
291 | *) |
---|
292 | nonopt="$arg" |
---|
293 | break |
---|
294 | ;; |
---|
295 | esac |
---|
296 | done |
---|
297 | |
---|
298 | if test -n "$prevopt"; then |
---|
299 | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
---|
300 | $echo "$help" 1>&2 |
---|
301 | exit 1 |
---|
302 | fi |
---|
303 | |
---|
304 | # If this variable is set in any of the actions, the command in it |
---|
305 | # will be execed at the end. This prevents here-documents from being |
---|
306 | # left over by shells. |
---|
307 | exec_cmd= |
---|
308 | |
---|
309 | if test -z "$show_help"; then |
---|
310 | |
---|
311 | # Infer the operation mode. |
---|
312 | if test -z "$mode"; then |
---|
313 | $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 |
---|
314 | $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 |
---|
315 | case $nonopt in |
---|
316 | *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) |
---|
317 | mode=link |
---|
318 | for arg |
---|
319 | do |
---|
320 | case $arg in |
---|
321 | -c) |
---|
322 | mode=compile |
---|
323 | break |
---|
324 | ;; |
---|
325 | esac |
---|
326 | done |
---|
327 | ;; |
---|
328 | *db | *dbx | *strace | *truss) |
---|
329 | mode=execute |
---|
330 | ;; |
---|
331 | *install*|cp|mv) |
---|
332 | mode=install |
---|
333 | ;; |
---|
334 | *rm) |
---|
335 | mode=uninstall |
---|
336 | ;; |
---|
337 | *) |
---|
338 | # If we have no mode, but dlfiles were specified, then do execute mode. |
---|
339 | test -n "$execute_dlfiles" && mode=execute |
---|
340 | |
---|
341 | # Just use the default operation mode. |
---|
342 | if test -z "$mode"; then |
---|
343 | if test -n "$nonopt"; then |
---|
344 | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
---|
345 | else |
---|
346 | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
---|
347 | fi |
---|
348 | fi |
---|
349 | ;; |
---|
350 | esac |
---|
351 | fi |
---|
352 | |
---|
353 | # Only execute mode is allowed to have -dlopen flags. |
---|
354 | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
---|
355 | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
---|
356 | $echo "$help" 1>&2 |
---|
357 | exit 1 |
---|
358 | fi |
---|
359 | |
---|
360 | # Change the help message to a mode-specific one. |
---|
361 | generic_help="$help" |
---|
362 | help="Try \`$modename --help --mode=$mode' for more information." |
---|
363 | |
---|
364 | # These modes are in order of execution frequency so that they run quickly. |
---|
365 | case $mode in |
---|
366 | # libtool compile mode |
---|
367 | compile) |
---|
368 | modename="$modename: compile" |
---|
369 | # Get the compilation command and the source file. |
---|
370 | base_compile= |
---|
371 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
---|
372 | suppress_output= |
---|
373 | arg_mode=normal |
---|
374 | libobj= |
---|
375 | |
---|
376 | for arg |
---|
377 | do |
---|
378 | case "$arg_mode" in |
---|
379 | arg ) |
---|
380 | # do not "continue". Instead, add this to base_compile |
---|
381 | lastarg="$arg" |
---|
382 | arg_mode=normal |
---|
383 | ;; |
---|
384 | |
---|
385 | target ) |
---|
386 | libobj="$arg" |
---|
387 | arg_mode=normal |
---|
388 | continue |
---|
389 | ;; |
---|
390 | |
---|
391 | normal ) |
---|
392 | # Accept any command-line options. |
---|
393 | case $arg in |
---|
394 | -o) |
---|
395 | if test -n "$libobj" ; then |
---|
396 | $echo "$modename: you cannot specify \`-o' more than once" 1>&2 |
---|
397 | exit 1 |
---|
398 | fi |
---|
399 | arg_mode=target |
---|
400 | continue |
---|
401 | ;; |
---|
402 | |
---|
403 | -static) |
---|
404 | build_old_libs=yes |
---|
405 | continue |
---|
406 | ;; |
---|
407 | |
---|
408 | -prefer-pic) |
---|
409 | pic_mode=yes |
---|
410 | continue |
---|
411 | ;; |
---|
412 | |
---|
413 | -prefer-non-pic) |
---|
414 | pic_mode=no |
---|
415 | continue |
---|
416 | ;; |
---|
417 | |
---|
418 | -Xcompiler) |
---|
419 | arg_mode=arg # the next one goes into the "base_compile" arg list |
---|
420 | continue # The current "srcfile" will either be retained or |
---|
421 | ;; # replaced later. I would guess that would be a bug. |
---|
422 | |
---|
423 | -Wc,*) |
---|
424 | args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` |
---|
425 | lastarg= |
---|
426 | save_ifs="$IFS"; IFS=',' |
---|
427 | for arg in $args; do |
---|
428 | IFS="$save_ifs" |
---|
429 | |
---|
430 | # Double-quote args containing other shell metacharacters. |
---|
431 | # Many Bourne shells cannot handle close brackets correctly |
---|
432 | # in scan sets, so we specify it separately. |
---|
433 | case $arg in |
---|
434 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
435 | arg="\"$arg\"" |
---|
436 | ;; |
---|
437 | esac |
---|
438 | lastarg="$lastarg $arg" |
---|
439 | done |
---|
440 | IFS="$save_ifs" |
---|
441 | lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` |
---|
442 | |
---|
443 | # Add the arguments to base_compile. |
---|
444 | base_compile="$base_compile $lastarg" |
---|
445 | continue |
---|
446 | ;; |
---|
447 | |
---|
448 | * ) |
---|
449 | # Accept the current argument as the source file. |
---|
450 | # The previous "srcfile" becomes the current argument. |
---|
451 | # |
---|
452 | lastarg="$srcfile" |
---|
453 | srcfile="$arg" |
---|
454 | ;; |
---|
455 | esac # case $arg |
---|
456 | ;; |
---|
457 | esac # case $arg_mode |
---|
458 | |
---|
459 | # Aesthetically quote the previous argument. |
---|
460 | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` |
---|
461 | |
---|
462 | case $lastarg in |
---|
463 | # Double-quote args containing other shell metacharacters. |
---|
464 | # Many Bourne shells cannot handle close brackets correctly |
---|
465 | # in scan sets, so we specify it separately. |
---|
466 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
467 | lastarg="\"$lastarg\"" |
---|
468 | ;; |
---|
469 | esac |
---|
470 | |
---|
471 | base_compile="$base_compile $lastarg" |
---|
472 | done # for arg |
---|
473 | |
---|
474 | case $arg_mode in |
---|
475 | arg) |
---|
476 | $echo "$modename: you must specify an argument for -Xcompile" |
---|
477 | exit 1 |
---|
478 | ;; |
---|
479 | target) |
---|
480 | $echo "$modename: you must specify a target with \`-o'" 1>&2 |
---|
481 | exit 1 |
---|
482 | ;; |
---|
483 | *) |
---|
484 | # Get the name of the library object. |
---|
485 | [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` |
---|
486 | ;; |
---|
487 | esac |
---|
488 | |
---|
489 | # Recognize several different file suffixes. |
---|
490 | # If the user specifies -o file.o, it is replaced with file.lo |
---|
491 | xform='[cCFSifmso]' |
---|
492 | case $libobj in |
---|
493 | *.ada) xform=ada ;; |
---|
494 | *.adb) xform=adb ;; |
---|
495 | *.ads) xform=ads ;; |
---|
496 | *.asm) xform=asm ;; |
---|
497 | *.c++) xform=c++ ;; |
---|
498 | *.cc) xform=cc ;; |
---|
499 | *.ii) xform=ii ;; |
---|
500 | *.class) xform=class ;; |
---|
501 | *.cpp) xform=cpp ;; |
---|
502 | *.cxx) xform=cxx ;; |
---|
503 | *.f90) xform=f90 ;; |
---|
504 | *.for) xform=for ;; |
---|
505 | *.java) xform=java ;; |
---|
506 | esac |
---|
507 | |
---|
508 | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` |
---|
509 | |
---|
510 | case $libobj in |
---|
511 | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
---|
512 | *) |
---|
513 | $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 |
---|
514 | exit 1 |
---|
515 | ;; |
---|
516 | esac |
---|
517 | |
---|
518 | # Infer tagged configuration to use if any are available and |
---|
519 | # if one wasn't chosen via the "--tag" command line option. |
---|
520 | # Only attempt this if the compiler in the base compile |
---|
521 | # command doesn't match the default compiler. |
---|
522 | if test -n "$available_tags" && test -z "$tagname"; then |
---|
523 | case $base_compile in |
---|
524 | # Blanks in the command may have been stripped by the calling shell, |
---|
525 | # but not from the CC environment variable when configure was run. |
---|
526 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; |
---|
527 | # Blanks at the start of $base_compile will cause this to fail |
---|
528 | # if we don't check for them as well. |
---|
529 | *) |
---|
530 | for z in $available_tags; do |
---|
531 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then |
---|
532 | # Evaluate the configuration. |
---|
533 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" |
---|
534 | case "$base_compile " in |
---|
535 | "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) |
---|
536 | # The compiler in the base compile command matches |
---|
537 | # the one in the tagged configuration. |
---|
538 | # Assume this is the tagged configuration we want. |
---|
539 | tagname=$z |
---|
540 | break |
---|
541 | ;; |
---|
542 | esac |
---|
543 | fi |
---|
544 | done |
---|
545 | # If $tagname still isn't set, then no tagged configuration |
---|
546 | # was found and let the user know that the "--tag" command |
---|
547 | # line option must be used. |
---|
548 | if test -z "$tagname"; then |
---|
549 | $echo "$modename: unable to infer tagged configuration" |
---|
550 | $echo "$modename: specify a tag with \`--tag'" 1>&2 |
---|
551 | exit 1 |
---|
552 | # else |
---|
553 | # $echo "$modename: using $tagname tagged configuration" |
---|
554 | fi |
---|
555 | ;; |
---|
556 | esac |
---|
557 | fi |
---|
558 | |
---|
559 | objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
---|
560 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
---|
561 | if test "X$xdir" = "X$obj"; then |
---|
562 | xdir= |
---|
563 | else |
---|
564 | xdir=$xdir/ |
---|
565 | fi |
---|
566 | lobj=${xdir}$objdir/$objname |
---|
567 | |
---|
568 | if test -z "$base_compile"; then |
---|
569 | $echo "$modename: you must specify a compilation command" 1>&2 |
---|
570 | $echo "$help" 1>&2 |
---|
571 | exit 1 |
---|
572 | fi |
---|
573 | |
---|
574 | # Delete any leftover library objects. |
---|
575 | if test "$build_old_libs" = yes; then |
---|
576 | removelist="$obj $lobj $libobj ${libobj}T" |
---|
577 | else |
---|
578 | removelist="$lobj $libobj ${libobj}T" |
---|
579 | fi |
---|
580 | |
---|
581 | $run $rm $removelist |
---|
582 | trap "$run $rm $removelist; exit 1" 1 2 15 |
---|
583 | |
---|
584 | # On Cygwin there's no "real" PIC flag so we must build both object types |
---|
585 | case $host_os in |
---|
586 | cygwin* | mingw* | pw32* | os2*) |
---|
587 | pic_mode=default |
---|
588 | ;; |
---|
589 | esac |
---|
590 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
---|
591 | # non-PIC code in shared libraries is not supported |
---|
592 | pic_mode=default |
---|
593 | fi |
---|
594 | |
---|
595 | # Calculate the filename of the output object if compiler does |
---|
596 | # not support -o with -c |
---|
597 | if test "$compiler_c_o" = no; then |
---|
598 | output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
---|
599 | lockfile="$output_obj.lock" |
---|
600 | removelist="$removelist $output_obj $lockfile" |
---|
601 | trap "$run $rm $removelist; exit 1" 1 2 15 |
---|
602 | else |
---|
603 | output_obj= |
---|
604 | need_locks=no |
---|
605 | lockfile= |
---|
606 | fi |
---|
607 | |
---|
608 | # Lock this critical section if it is needed |
---|
609 | # We use this script file to make the link, it avoids creating a new file |
---|
610 | if test "$need_locks" = yes; then |
---|
611 | until $run ln "$0" "$lockfile" 2>/dev/null; do |
---|
612 | $show "Waiting for $lockfile to be removed" |
---|
613 | sleep 2 |
---|
614 | done |
---|
615 | elif test "$need_locks" = warn; then |
---|
616 | if test -f "$lockfile"; then |
---|
617 | $echo "\ |
---|
618 | *** ERROR, $lockfile exists and contains: |
---|
619 | `cat $lockfile 2>/dev/null` |
---|
620 | |
---|
621 | This indicates that another process is trying to use the same |
---|
622 | temporary object file, and libtool could not work around it because |
---|
623 | your compiler does not support \`-c' and \`-o' together. If you |
---|
624 | repeat this compilation, it may succeed, by chance, but you had better |
---|
625 | avoid parallel builds (make -j) in this platform, or get a better |
---|
626 | compiler." |
---|
627 | |
---|
628 | $run $rm $removelist |
---|
629 | exit 1 |
---|
630 | fi |
---|
631 | $echo $srcfile > "$lockfile" |
---|
632 | fi |
---|
633 | |
---|
634 | if test -n "$fix_srcfile_path"; then |
---|
635 | eval srcfile=\"$fix_srcfile_path\" |
---|
636 | fi |
---|
637 | |
---|
638 | $run $rm "$libobj" "${libobj}T" |
---|
639 | |
---|
640 | # Create a libtool object file (analogous to a ".la" file), |
---|
641 | # but don't create it if we're doing a dry run. |
---|
642 | test -z "$run" && cat > ${libobj}T <<EOF |
---|
643 | # $libobj - a libtool object file |
---|
644 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
---|
645 | # |
---|
646 | # Please DO NOT delete this file! |
---|
647 | # It is necessary for linking the library. |
---|
648 | |
---|
649 | # Name of the PIC object. |
---|
650 | EOF |
---|
651 | |
---|
652 | # Only build a PIC object if we are building libtool libraries. |
---|
653 | if test "$build_libtool_libs" = yes; then |
---|
654 | # Without this assignment, base_compile gets emptied. |
---|
655 | fbsd_hideous_sh_bug=$base_compile |
---|
656 | |
---|
657 | if test "$pic_mode" != no; then |
---|
658 | command="$base_compile $srcfile $pic_flag" |
---|
659 | else |
---|
660 | # Don't build PIC code |
---|
661 | command="$base_compile $srcfile" |
---|
662 | fi |
---|
663 | |
---|
664 | if test ! -d "${xdir}$objdir"; then |
---|
665 | $show "$mkdir ${xdir}$objdir" |
---|
666 | $run $mkdir ${xdir}$objdir |
---|
667 | status=$? |
---|
668 | if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then |
---|
669 | exit $status |
---|
670 | fi |
---|
671 | $show "chmod 777 ${xdir}$objdir" |
---|
672 | $run chmod 777 ${xdir}$objdir |
---|
673 | fi |
---|
674 | |
---|
675 | if test -z "$output_obj"; then |
---|
676 | # Place PIC objects in $objdir |
---|
677 | command="$command -o $lobj" |
---|
678 | fi |
---|
679 | |
---|
680 | $run $rm "$lobj" "$output_obj" |
---|
681 | |
---|
682 | $show "$command" |
---|
683 | if $run eval "$command"; then : |
---|
684 | else |
---|
685 | test -n "$output_obj" && $run $rm $removelist |
---|
686 | exit 1 |
---|
687 | fi |
---|
688 | |
---|
689 | if test "$need_locks" = warn && |
---|
690 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
---|
691 | $echo "\ |
---|
692 | *** ERROR, $lockfile contains: |
---|
693 | `cat $lockfile 2>/dev/null` |
---|
694 | |
---|
695 | but it should contain: |
---|
696 | $srcfile |
---|
697 | |
---|
698 | This indicates that another process is trying to use the same |
---|
699 | temporary object file, and libtool could not work around it because |
---|
700 | your compiler does not support \`-c' and \`-o' together. If you |
---|
701 | repeat this compilation, it may succeed, by chance, but you had better |
---|
702 | avoid parallel builds (make -j) in this platform, or get a better |
---|
703 | compiler." |
---|
704 | |
---|
705 | $run $rm $removelist |
---|
706 | exit 1 |
---|
707 | fi |
---|
708 | |
---|
709 | # Just move the object if needed, then go on to compile the next one |
---|
710 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
---|
711 | $show "$mv $output_obj $lobj" |
---|
712 | if $run $mv $output_obj $lobj; then : |
---|
713 | else |
---|
714 | error=$? |
---|
715 | $run $rm $removelist |
---|
716 | exit $error |
---|
717 | fi |
---|
718 | fi |
---|
719 | |
---|
720 | # Append the name of the PIC object to the libtool object file. |
---|
721 | test -z "$run" && cat >> ${libobj}T <<EOF |
---|
722 | pic_object='$objdir/$objname' |
---|
723 | |
---|
724 | EOF |
---|
725 | |
---|
726 | # Allow error messages only from the first compilation. |
---|
727 | suppress_output=' >/dev/null 2>&1' |
---|
728 | else |
---|
729 | # No PIC object so indicate it doesn't exist in the libtool |
---|
730 | # object file. |
---|
731 | test -z "$run" && cat >> ${libobj}T <<EOF |
---|
732 | pic_object=none |
---|
733 | |
---|
734 | EOF |
---|
735 | fi |
---|
736 | |
---|
737 | # Only build a position-dependent object if we build old libraries. |
---|
738 | if test "$build_old_libs" = yes; then |
---|
739 | if test "$pic_mode" != yes; then |
---|
740 | # Don't build PIC code |
---|
741 | command="$base_compile $srcfile" |
---|
742 | else |
---|
743 | command="$base_compile $srcfile $pic_flag" |
---|
744 | fi |
---|
745 | if test "$compiler_c_o" = yes; then |
---|
746 | command="$command -o $obj" |
---|
747 | fi |
---|
748 | |
---|
749 | # Suppress compiler output if we already did a PIC compilation. |
---|
750 | command="$command$suppress_output" |
---|
751 | $run $rm "$obj" "$output_obj" |
---|
752 | $show "$command" |
---|
753 | if $run eval "$command"; then : |
---|
754 | else |
---|
755 | $run $rm $removelist |
---|
756 | exit 1 |
---|
757 | fi |
---|
758 | |
---|
759 | if test "$need_locks" = warn && |
---|
760 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
---|
761 | $echo "\ |
---|
762 | *** ERROR, $lockfile contains: |
---|
763 | `cat $lockfile 2>/dev/null` |
---|
764 | |
---|
765 | but it should contain: |
---|
766 | $srcfile |
---|
767 | |
---|
768 | This indicates that another process is trying to use the same |
---|
769 | temporary object file, and libtool could not work around it because |
---|
770 | your compiler does not support \`-c' and \`-o' together. If you |
---|
771 | repeat this compilation, it may succeed, by chance, but you had better |
---|
772 | avoid parallel builds (make -j) in this platform, or get a better |
---|
773 | compiler." |
---|
774 | |
---|
775 | $run $rm $removelist |
---|
776 | exit 1 |
---|
777 | fi |
---|
778 | |
---|
779 | # Just move the object if needed |
---|
780 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
---|
781 | $show "$mv $output_obj $obj" |
---|
782 | if $run $mv $output_obj $obj; then : |
---|
783 | else |
---|
784 | error=$? |
---|
785 | $run $rm $removelist |
---|
786 | exit $error |
---|
787 | fi |
---|
788 | fi |
---|
789 | |
---|
790 | # Append the name of the non-PIC object the libtool object file. |
---|
791 | # Only append if the libtool object file exists. |
---|
792 | test -z "$run" && cat >> ${libobj}T <<EOF |
---|
793 | # Name of the non-PIC object. |
---|
794 | non_pic_object='$objname' |
---|
795 | |
---|
796 | EOF |
---|
797 | else |
---|
798 | # Append the name of the non-PIC object the libtool object file. |
---|
799 | # Only append if the libtool object file exists. |
---|
800 | test -z "$run" && cat >> ${libobj}T <<EOF |
---|
801 | # Name of the non-PIC object. |
---|
802 | non_pic_object=none |
---|
803 | |
---|
804 | EOF |
---|
805 | fi |
---|
806 | |
---|
807 | $run $mv "${libobj}T" "${libobj}" |
---|
808 | |
---|
809 | # Unlock the critical section if it was locked |
---|
810 | if test "$need_locks" != no; then |
---|
811 | $run $rm "$lockfile" |
---|
812 | fi |
---|
813 | |
---|
814 | exit 0 |
---|
815 | ;; |
---|
816 | |
---|
817 | # libtool link mode |
---|
818 | link | relink) |
---|
819 | modename="$modename: link" |
---|
820 | case $host in |
---|
821 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
---|
822 | # It is impossible to link a dll without this setting, and |
---|
823 | # we shouldn't force the makefile maintainer to figure out |
---|
824 | # which system we are compiling for in order to pass an extra |
---|
825 | # flag for every libtool invocation. |
---|
826 | # allow_undefined=no |
---|
827 | |
---|
828 | # FIXME: Unfortunately, there are problems with the above when trying |
---|
829 | # to make a dll which has undefined symbols, in which case not |
---|
830 | # even a static library is built. For now, we need to specify |
---|
831 | # -no-undefined on the libtool link line when we can be certain |
---|
832 | # that all symbols are satisfied, otherwise we get a static library. |
---|
833 | allow_undefined=yes |
---|
834 | ;; |
---|
835 | *) |
---|
836 | allow_undefined=yes |
---|
837 | ;; |
---|
838 | esac |
---|
839 | libtool_args="$nonopt" |
---|
840 | base_compile="$nonopt" |
---|
841 | compile_command="$nonopt" |
---|
842 | finalize_command="$nonopt" |
---|
843 | |
---|
844 | compile_rpath= |
---|
845 | finalize_rpath= |
---|
846 | compile_shlibpath= |
---|
847 | finalize_shlibpath= |
---|
848 | convenience= |
---|
849 | old_convenience= |
---|
850 | deplibs= |
---|
851 | old_deplibs= |
---|
852 | compiler_flags= |
---|
853 | linker_flags= |
---|
854 | dllsearchpath= |
---|
855 | lib_search_path=`pwd` |
---|
856 | inst_prefix_dir= |
---|
857 | |
---|
858 | avoid_version=no |
---|
859 | dlfiles= |
---|
860 | dlprefiles= |
---|
861 | dlself=no |
---|
862 | export_dynamic=no |
---|
863 | export_symbols= |
---|
864 | export_symbols_regex= |
---|
865 | generated= |
---|
866 | libobjs= |
---|
867 | ltlibs= |
---|
868 | module=no |
---|
869 | no_install=no |
---|
870 | objs= |
---|
871 | non_pic_objects= |
---|
872 | prefer_static_libs=no |
---|
873 | preload=no |
---|
874 | prev= |
---|
875 | prevarg= |
---|
876 | release= |
---|
877 | rpath= |
---|
878 | xrpath= |
---|
879 | perm_rpath= |
---|
880 | temp_rpath= |
---|
881 | thread_safe=no |
---|
882 | vinfo= |
---|
883 | vinfo_number=no |
---|
884 | |
---|
885 | # We need to know -static, to get the right output filenames. |
---|
886 | for arg |
---|
887 | do |
---|
888 | case $arg in |
---|
889 | -all-static | -static) |
---|
890 | if test "X$arg" = "X-all-static"; then |
---|
891 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
---|
892 | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
---|
893 | fi |
---|
894 | if test -n "$link_static_flag"; then |
---|
895 | dlopen_self=$dlopen_self_static |
---|
896 | fi |
---|
897 | else |
---|
898 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
---|
899 | dlopen_self=$dlopen_self_static |
---|
900 | fi |
---|
901 | fi |
---|
902 | build_libtool_libs=no |
---|
903 | build_old_libs=yes |
---|
904 | prefer_static_libs=yes |
---|
905 | break |
---|
906 | ;; |
---|
907 | esac |
---|
908 | done |
---|
909 | |
---|
910 | # See if our shared archives depend on static archives. |
---|
911 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
---|
912 | |
---|
913 | # Go through the arguments, transforming them on the way. |
---|
914 | while test "$#" -gt 0; do |
---|
915 | arg="$1" |
---|
916 | base_compile="$base_compile $arg" |
---|
917 | shift |
---|
918 | case $arg in |
---|
919 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
920 | qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test |
---|
921 | ;; |
---|
922 | *) qarg=$arg ;; |
---|
923 | esac |
---|
924 | libtool_args="$libtool_args $qarg" |
---|
925 | |
---|
926 | # If the previous option needs an argument, assign it. |
---|
927 | if test -n "$prev"; then |
---|
928 | case $prev in |
---|
929 | output) |
---|
930 | compile_command="$compile_command @OUTPUT@" |
---|
931 | finalize_command="$finalize_command @OUTPUT@" |
---|
932 | ;; |
---|
933 | esac |
---|
934 | |
---|
935 | case $prev in |
---|
936 | dlfiles|dlprefiles) |
---|
937 | if test "$preload" = no; then |
---|
938 | # Add the symbol object into the linking commands. |
---|
939 | compile_command="$compile_command @SYMFILE@" |
---|
940 | finalize_command="$finalize_command @SYMFILE@" |
---|
941 | preload=yes |
---|
942 | fi |
---|
943 | case $arg in |
---|
944 | *.la | *.lo) ;; # We handle these cases below. |
---|
945 | force) |
---|
946 | if test "$dlself" = no; then |
---|
947 | dlself=needless |
---|
948 | export_dynamic=yes |
---|
949 | fi |
---|
950 | prev= |
---|
951 | continue |
---|
952 | ;; |
---|
953 | self) |
---|
954 | if test "$prev" = dlprefiles; then |
---|
955 | dlself=yes |
---|
956 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
---|
957 | dlself=yes |
---|
958 | else |
---|
959 | dlself=needless |
---|
960 | export_dynamic=yes |
---|
961 | fi |
---|
962 | prev= |
---|
963 | continue |
---|
964 | ;; |
---|
965 | *) |
---|
966 | if test "$prev" = dlfiles; then |
---|
967 | dlfiles="$dlfiles $arg" |
---|
968 | else |
---|
969 | dlprefiles="$dlprefiles $arg" |
---|
970 | fi |
---|
971 | prev= |
---|
972 | continue |
---|
973 | ;; |
---|
974 | esac |
---|
975 | ;; |
---|
976 | expsyms) |
---|
977 | export_symbols="$arg" |
---|
978 | if test ! -f "$arg"; then |
---|
979 | $echo "$modename: symbol file \`$arg' does not exist" |
---|
980 | exit 1 |
---|
981 | fi |
---|
982 | prev= |
---|
983 | continue |
---|
984 | ;; |
---|
985 | expsyms_regex) |
---|
986 | export_symbols_regex="$arg" |
---|
987 | prev= |
---|
988 | continue |
---|
989 | ;; |
---|
990 | inst_prefix) |
---|
991 | inst_prefix_dir="$arg" |
---|
992 | prev= |
---|
993 | continue |
---|
994 | ;; |
---|
995 | release) |
---|
996 | release="-$arg" |
---|
997 | prev= |
---|
998 | continue |
---|
999 | ;; |
---|
1000 | objectlist) |
---|
1001 | if test -f "$arg"; then |
---|
1002 | save_arg=$arg |
---|
1003 | moreargs= |
---|
1004 | for fil in `cat $save_arg` |
---|
1005 | do |
---|
1006 | # moreargs="$moreargs $fil" |
---|
1007 | arg=$fil |
---|
1008 | # A libtool-controlled object. |
---|
1009 | |
---|
1010 | # Check to see that this really is a libtool object. |
---|
1011 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
1012 | pic_object= |
---|
1013 | non_pic_object= |
---|
1014 | |
---|
1015 | # Read the .lo file |
---|
1016 | # If there is no directory component, then add one. |
---|
1017 | case $arg in |
---|
1018 | */* | *\\*) . $arg ;; |
---|
1019 | *) . ./$arg ;; |
---|
1020 | esac |
---|
1021 | |
---|
1022 | if test -z "$pic_object" || \ |
---|
1023 | test -z "$non_pic_object" || |
---|
1024 | test "$pic_object" = none && \ |
---|
1025 | test "$non_pic_object" = none; then |
---|
1026 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
---|
1027 | exit 1 |
---|
1028 | fi |
---|
1029 | |
---|
1030 | # Extract subdirectory from the argument. |
---|
1031 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
---|
1032 | if test "X$xdir" = "X$arg"; then |
---|
1033 | xdir= |
---|
1034 | else |
---|
1035 | xdir="$xdir/" |
---|
1036 | fi |
---|
1037 | |
---|
1038 | if test "$pic_object" != none; then |
---|
1039 | # Prepend the subdirectory the object is found in. |
---|
1040 | pic_object="$xdir$pic_object" |
---|
1041 | |
---|
1042 | if test "$prev" = dlfiles; then |
---|
1043 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
---|
1044 | dlfiles="$dlfiles $pic_object" |
---|
1045 | prev= |
---|
1046 | continue |
---|
1047 | else |
---|
1048 | # If libtool objects are unsupported, then we need to preload. |
---|
1049 | prev=dlprefiles |
---|
1050 | fi |
---|
1051 | fi |
---|
1052 | |
---|
1053 | # CHECK ME: I think I busted this. -Ossama |
---|
1054 | if test "$prev" = dlprefiles; then |
---|
1055 | # Preload the old-style object. |
---|
1056 | dlprefiles="$dlprefiles $pic_object" |
---|
1057 | prev= |
---|
1058 | fi |
---|
1059 | |
---|
1060 | # A PIC object. |
---|
1061 | libobjs="$libobjs $pic_object" |
---|
1062 | arg="$pic_object" |
---|
1063 | fi |
---|
1064 | |
---|
1065 | # Non-PIC object. |
---|
1066 | if test "$non_pic_object" != none; then |
---|
1067 | # Prepend the subdirectory the object is found in. |
---|
1068 | non_pic_object="$xdir$non_pic_object" |
---|
1069 | |
---|
1070 | # A standard non-PIC object |
---|
1071 | non_pic_objects="$non_pic_objects $non_pic_object" |
---|
1072 | if test -z "$pic_object" || test "$pic_object" = none ; then |
---|
1073 | arg="$non_pic_object" |
---|
1074 | fi |
---|
1075 | fi |
---|
1076 | else |
---|
1077 | # Only an error if not doing a dry-run. |
---|
1078 | if test -z "$run"; then |
---|
1079 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
---|
1080 | exit 1 |
---|
1081 | else |
---|
1082 | # Dry-run case. |
---|
1083 | |
---|
1084 | # Extract subdirectory from the argument. |
---|
1085 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
---|
1086 | if test "X$xdir" = "X$arg"; then |
---|
1087 | xdir= |
---|
1088 | else |
---|
1089 | xdir="$xdir/" |
---|
1090 | fi |
---|
1091 | |
---|
1092 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
---|
1093 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
---|
1094 | libobjs="$libobjs $pic_object" |
---|
1095 | non_pic_objects="$non_pic_objects $non_pic_object" |
---|
1096 | fi |
---|
1097 | fi |
---|
1098 | done |
---|
1099 | else |
---|
1100 | $echo "$modename: link input file \`$save_arg' does not exist" |
---|
1101 | exit 1 |
---|
1102 | fi |
---|
1103 | arg=$save_arg |
---|
1104 | prev= |
---|
1105 | continue |
---|
1106 | ;; |
---|
1107 | rpath | xrpath) |
---|
1108 | # We need an absolute path. |
---|
1109 | case $arg in |
---|
1110 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
---|
1111 | *) |
---|
1112 | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
---|
1113 | exit 1 |
---|
1114 | ;; |
---|
1115 | esac |
---|
1116 | if test "$prev" = rpath; then |
---|
1117 | case "$rpath " in |
---|
1118 | *" $arg "*) ;; |
---|
1119 | *) rpath="$rpath $arg" ;; |
---|
1120 | esac |
---|
1121 | else |
---|
1122 | case "$xrpath " in |
---|
1123 | *" $arg "*) ;; |
---|
1124 | *) xrpath="$xrpath $arg" ;; |
---|
1125 | esac |
---|
1126 | fi |
---|
1127 | prev= |
---|
1128 | continue |
---|
1129 | ;; |
---|
1130 | xcompiler) |
---|
1131 | compiler_flags="$compiler_flags $qarg" |
---|
1132 | prev= |
---|
1133 | compile_command="$compile_command $qarg" |
---|
1134 | finalize_command="$finalize_command $qarg" |
---|
1135 | continue |
---|
1136 | ;; |
---|
1137 | xlinker) |
---|
1138 | linker_flags="$linker_flags $qarg" |
---|
1139 | compiler_flags="$compiler_flags $wl$qarg" |
---|
1140 | prev= |
---|
1141 | compile_command="$compile_command $wl$qarg" |
---|
1142 | finalize_command="$finalize_command $wl$qarg" |
---|
1143 | continue |
---|
1144 | ;; |
---|
1145 | xcclinker) |
---|
1146 | linker_flags="$linker_flags $qarg" |
---|
1147 | compiler_flags="$compiler_flags $qarg" |
---|
1148 | prev= |
---|
1149 | compile_command="$compile_command $qarg" |
---|
1150 | finalize_command="$finalize_command $qarg" |
---|
1151 | continue |
---|
1152 | ;; |
---|
1153 | *) |
---|
1154 | eval "$prev=\"\$arg\"" |
---|
1155 | prev= |
---|
1156 | continue |
---|
1157 | ;; |
---|
1158 | esac |
---|
1159 | fi # test -n "$prev" |
---|
1160 | |
---|
1161 | prevarg="$arg" |
---|
1162 | |
---|
1163 | case $arg in |
---|
1164 | -all-static) |
---|
1165 | if test -n "$link_static_flag"; then |
---|
1166 | compile_command="$compile_command $link_static_flag" |
---|
1167 | finalize_command="$finalize_command $link_static_flag" |
---|
1168 | fi |
---|
1169 | continue |
---|
1170 | ;; |
---|
1171 | |
---|
1172 | -allow-undefined) |
---|
1173 | # FIXME: remove this flag sometime in the future. |
---|
1174 | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 |
---|
1175 | continue |
---|
1176 | ;; |
---|
1177 | |
---|
1178 | -avoid-version) |
---|
1179 | avoid_version=yes |
---|
1180 | continue |
---|
1181 | ;; |
---|
1182 | |
---|
1183 | -dlopen) |
---|
1184 | prev=dlfiles |
---|
1185 | continue |
---|
1186 | ;; |
---|
1187 | |
---|
1188 | -dlpreopen) |
---|
1189 | prev=dlprefiles |
---|
1190 | continue |
---|
1191 | ;; |
---|
1192 | |
---|
1193 | -export-dynamic) |
---|
1194 | export_dynamic=yes |
---|
1195 | continue |
---|
1196 | ;; |
---|
1197 | |
---|
1198 | -export-symbols | -export-symbols-regex) |
---|
1199 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
---|
1200 | $echo "$modename: more than one -exported-symbols argument is not allowed" |
---|
1201 | exit 1 |
---|
1202 | fi |
---|
1203 | if test "X$arg" = "X-export-symbols"; then |
---|
1204 | prev=expsyms |
---|
1205 | else |
---|
1206 | prev=expsyms_regex |
---|
1207 | fi |
---|
1208 | continue |
---|
1209 | ;; |
---|
1210 | |
---|
1211 | -inst-prefix-dir) |
---|
1212 | prev=inst_prefix |
---|
1213 | continue |
---|
1214 | ;; |
---|
1215 | |
---|
1216 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
---|
1217 | # so, if we see these flags be careful not to treat them like -L |
---|
1218 | -L[A-Z][A-Z]*:*) |
---|
1219 | case $with_gcc/$host in |
---|
1220 | no/*-*-irix* | /*-*-irix*) |
---|
1221 | compile_command="$compile_command $arg" |
---|
1222 | finalize_command="$finalize_command $arg" |
---|
1223 | ;; |
---|
1224 | esac |
---|
1225 | continue |
---|
1226 | ;; |
---|
1227 | |
---|
1228 | -L*) |
---|
1229 | dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` |
---|
1230 | # We need an absolute path. |
---|
1231 | case $dir in |
---|
1232 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
---|
1233 | *) |
---|
1234 | absdir=`cd "$dir" && pwd` |
---|
1235 | if test -z "$absdir"; then |
---|
1236 | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
---|
1237 | exit 1 |
---|
1238 | fi |
---|
1239 | dir="$absdir" |
---|
1240 | ;; |
---|
1241 | esac |
---|
1242 | case "$deplibs " in |
---|
1243 | *" -L$dir "*) ;; |
---|
1244 | *) |
---|
1245 | deplibs="$deplibs -L$dir" |
---|
1246 | lib_search_path="$lib_search_path $dir" |
---|
1247 | ;; |
---|
1248 | esac |
---|
1249 | case $host in |
---|
1250 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
---|
1251 | case :$dllsearchpath: in |
---|
1252 | *":$dir:"*) ;; |
---|
1253 | *) dllsearchpath="$dllsearchpath:$dir";; |
---|
1254 | esac |
---|
1255 | ;; |
---|
1256 | esac |
---|
1257 | continue |
---|
1258 | ;; |
---|
1259 | |
---|
1260 | -l*) |
---|
1261 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
---|
1262 | case $host in |
---|
1263 | *-*-cygwin* | *-*-pw32* | *-*-beos*) |
---|
1264 | # These systems don't actually have a C or math library (as such) |
---|
1265 | continue |
---|
1266 | ;; |
---|
1267 | *-*-mingw* | *-*-os2*) |
---|
1268 | # These systems don't actually have a C library (as such) |
---|
1269 | test "X$arg" = "X-lc" && continue |
---|
1270 | ;; |
---|
1271 | *-*-openbsd* | *-*-freebsd*) |
---|
1272 | # Do not include libc due to us having libc/libc_r. |
---|
1273 | test "X$arg" = "X-lc" && continue |
---|
1274 | ;; |
---|
1275 | *-*-rhapsody* | *-*-darwin1.[012]) |
---|
1276 | # Rhapsody C and math libraries are in the System framework |
---|
1277 | deplibs="$deplibs -framework System" |
---|
1278 | continue |
---|
1279 | esac |
---|
1280 | elif test "X$arg" = "X-lc_r"; then |
---|
1281 | case $host in |
---|
1282 | *-*-openbsd* | *-*-freebsd*) |
---|
1283 | # Do not include libc_r directly, use -pthread flag. |
---|
1284 | continue |
---|
1285 | ;; |
---|
1286 | esac |
---|
1287 | fi |
---|
1288 | deplibs="$deplibs $arg" |
---|
1289 | continue |
---|
1290 | ;; |
---|
1291 | |
---|
1292 | -module) |
---|
1293 | module=yes |
---|
1294 | continue |
---|
1295 | ;; |
---|
1296 | |
---|
1297 | # gcc -m* arguments should be passed to the linker via $compiler_flags |
---|
1298 | # in order to pass architecture information to the linker |
---|
1299 | # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo |
---|
1300 | # but this is not reliable with gcc because gcc may use -mfoo to |
---|
1301 | # select a different linker, different libraries, etc, while |
---|
1302 | # -Wl,-mfoo simply passes -mfoo to the linker. |
---|
1303 | -m*) |
---|
1304 | # Unknown arguments in both finalize_command and compile_command need |
---|
1305 | # to be aesthetically quoted because they are evaled later. |
---|
1306 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
1307 | case $arg in |
---|
1308 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1309 | arg="\"$arg\"" |
---|
1310 | ;; |
---|
1311 | esac |
---|
1312 | compile_command="$compile_command $arg" |
---|
1313 | finalize_command="$finalize_command $arg" |
---|
1314 | if test "$with_gcc" = "yes" ; then |
---|
1315 | compiler_flags="$compiler_flags $arg" |
---|
1316 | fi |
---|
1317 | continue |
---|
1318 | ;; |
---|
1319 | |
---|
1320 | -shrext) |
---|
1321 | prev=shrext |
---|
1322 | continue |
---|
1323 | ;; |
---|
1324 | |
---|
1325 | -no-fast-install) |
---|
1326 | fast_install=no |
---|
1327 | continue |
---|
1328 | ;; |
---|
1329 | |
---|
1330 | -no-install) |
---|
1331 | case $host in |
---|
1332 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
---|
1333 | # The PATH hackery in wrapper scripts is required on Windows |
---|
1334 | # in order for the loader to find any dlls it needs. |
---|
1335 | $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 |
---|
1336 | $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 |
---|
1337 | fast_install=no |
---|
1338 | ;; |
---|
1339 | *) no_install=yes ;; |
---|
1340 | esac |
---|
1341 | continue |
---|
1342 | ;; |
---|
1343 | |
---|
1344 | -no-undefined) |
---|
1345 | allow_undefined=no |
---|
1346 | continue |
---|
1347 | ;; |
---|
1348 | |
---|
1349 | -objectlist) |
---|
1350 | prev=objectlist |
---|
1351 | continue |
---|
1352 | ;; |
---|
1353 | |
---|
1354 | -o) prev=output ;; |
---|
1355 | |
---|
1356 | -release) |
---|
1357 | prev=release |
---|
1358 | continue |
---|
1359 | ;; |
---|
1360 | |
---|
1361 | -rpath) |
---|
1362 | prev=rpath |
---|
1363 | continue |
---|
1364 | ;; |
---|
1365 | |
---|
1366 | -R) |
---|
1367 | prev=xrpath |
---|
1368 | continue |
---|
1369 | ;; |
---|
1370 | |
---|
1371 | -R*) |
---|
1372 | dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` |
---|
1373 | # We need an absolute path. |
---|
1374 | case $dir in |
---|
1375 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
---|
1376 | *) |
---|
1377 | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
---|
1378 | exit 1 |
---|
1379 | ;; |
---|
1380 | esac |
---|
1381 | case "$xrpath " in |
---|
1382 | *" $dir "*) ;; |
---|
1383 | *) xrpath="$xrpath $dir" ;; |
---|
1384 | esac |
---|
1385 | continue |
---|
1386 | ;; |
---|
1387 | |
---|
1388 | -static) |
---|
1389 | # The effects of -static are defined in a previous loop. |
---|
1390 | # We used to do the same as -all-static on platforms that |
---|
1391 | # didn't have a PIC flag, but the assumption that the effects |
---|
1392 | # would be equivalent was wrong. It would break on at least |
---|
1393 | # Digital Unix and AIX. |
---|
1394 | continue |
---|
1395 | ;; |
---|
1396 | |
---|
1397 | -thread-safe) |
---|
1398 | thread_safe=yes |
---|
1399 | continue |
---|
1400 | ;; |
---|
1401 | |
---|
1402 | -version-info) |
---|
1403 | prev=vinfo |
---|
1404 | continue |
---|
1405 | ;; |
---|
1406 | -version-number) |
---|
1407 | prev=vinfo |
---|
1408 | vinfo_number=yes |
---|
1409 | continue |
---|
1410 | ;; |
---|
1411 | |
---|
1412 | -Wc,*) |
---|
1413 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` |
---|
1414 | arg= |
---|
1415 | save_ifs="$IFS"; IFS=',' |
---|
1416 | for flag in $args; do |
---|
1417 | IFS="$save_ifs" |
---|
1418 | case $flag in |
---|
1419 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1420 | flag="\"$flag\"" |
---|
1421 | ;; |
---|
1422 | esac |
---|
1423 | arg="$arg $wl$flag" |
---|
1424 | compiler_flags="$compiler_flags $flag" |
---|
1425 | done |
---|
1426 | IFS="$save_ifs" |
---|
1427 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
---|
1428 | ;; |
---|
1429 | |
---|
1430 | -Wl,*) |
---|
1431 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` |
---|
1432 | arg= |
---|
1433 | save_ifs="$IFS"; IFS=',' |
---|
1434 | for flag in $args; do |
---|
1435 | IFS="$save_ifs" |
---|
1436 | case $flag in |
---|
1437 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1438 | flag="\"$flag\"" |
---|
1439 | ;; |
---|
1440 | esac |
---|
1441 | arg="$arg $wl$flag" |
---|
1442 | compiler_flags="$compiler_flags $wl$flag" |
---|
1443 | linker_flags="$linker_flags $flag" |
---|
1444 | done |
---|
1445 | IFS="$save_ifs" |
---|
1446 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
---|
1447 | ;; |
---|
1448 | |
---|
1449 | -Xcompiler) |
---|
1450 | prev=xcompiler |
---|
1451 | continue |
---|
1452 | ;; |
---|
1453 | |
---|
1454 | -Xlinker) |
---|
1455 | prev=xlinker |
---|
1456 | continue |
---|
1457 | ;; |
---|
1458 | |
---|
1459 | -XCClinker) |
---|
1460 | prev=xcclinker |
---|
1461 | continue |
---|
1462 | ;; |
---|
1463 | |
---|
1464 | # Some other compiler flag. |
---|
1465 | -* | +*) |
---|
1466 | # Unknown arguments in both finalize_command and compile_command need |
---|
1467 | # to be aesthetically quoted because they are evaled later. |
---|
1468 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
1469 | case $arg in |
---|
1470 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1471 | arg="\"$arg\"" |
---|
1472 | ;; |
---|
1473 | esac |
---|
1474 | ;; |
---|
1475 | |
---|
1476 | *.$objext) |
---|
1477 | # A standard object. |
---|
1478 | objs="$objs $arg" |
---|
1479 | ;; |
---|
1480 | |
---|
1481 | *.lo) |
---|
1482 | # A libtool-controlled object. |
---|
1483 | |
---|
1484 | # Check to see that this really is a libtool object. |
---|
1485 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
1486 | pic_object= |
---|
1487 | non_pic_object= |
---|
1488 | |
---|
1489 | # Read the .lo file |
---|
1490 | # If there is no directory component, then add one. |
---|
1491 | case $arg in |
---|
1492 | */* | *\\*) . $arg ;; |
---|
1493 | *) . ./$arg ;; |
---|
1494 | esac |
---|
1495 | |
---|
1496 | if test -z "$pic_object" || \ |
---|
1497 | test -z "$non_pic_object" || |
---|
1498 | test "$pic_object" = none && \ |
---|
1499 | test "$non_pic_object" = none; then |
---|
1500 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
---|
1501 | exit 1 |
---|
1502 | fi |
---|
1503 | |
---|
1504 | # Extract subdirectory from the argument. |
---|
1505 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
---|
1506 | if test "X$xdir" = "X$arg"; then |
---|
1507 | xdir= |
---|
1508 | else |
---|
1509 | xdir="$xdir/" |
---|
1510 | fi |
---|
1511 | |
---|
1512 | if test "$pic_object" != none; then |
---|
1513 | # Prepend the subdirectory the object is found in. |
---|
1514 | pic_object="$xdir$pic_object" |
---|
1515 | |
---|
1516 | if test "$prev" = dlfiles; then |
---|
1517 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
---|
1518 | dlfiles="$dlfiles $pic_object" |
---|
1519 | prev= |
---|
1520 | continue |
---|
1521 | else |
---|
1522 | # If libtool objects are unsupported, then we need to preload. |
---|
1523 | prev=dlprefiles |
---|
1524 | fi |
---|
1525 | fi |
---|
1526 | |
---|
1527 | # CHECK ME: I think I busted this. -Ossama |
---|
1528 | if test "$prev" = dlprefiles; then |
---|
1529 | # Preload the old-style object. |
---|
1530 | dlprefiles="$dlprefiles $pic_object" |
---|
1531 | prev= |
---|
1532 | fi |
---|
1533 | |
---|
1534 | # A PIC object. |
---|
1535 | libobjs="$libobjs $pic_object" |
---|
1536 | arg="$pic_object" |
---|
1537 | fi |
---|
1538 | |
---|
1539 | # Non-PIC object. |
---|
1540 | if test "$non_pic_object" != none; then |
---|
1541 | # Prepend the subdirectory the object is found in. |
---|
1542 | non_pic_object="$xdir$non_pic_object" |
---|
1543 | |
---|
1544 | # A standard non-PIC object |
---|
1545 | non_pic_objects="$non_pic_objects $non_pic_object" |
---|
1546 | if test -z "$pic_object" || test "$pic_object" = none ; then |
---|
1547 | arg="$non_pic_object" |
---|
1548 | fi |
---|
1549 | fi |
---|
1550 | else |
---|
1551 | # Only an error if not doing a dry-run. |
---|
1552 | if test -z "$run"; then |
---|
1553 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
---|
1554 | exit 1 |
---|
1555 | else |
---|
1556 | # Dry-run case. |
---|
1557 | |
---|
1558 | # Extract subdirectory from the argument. |
---|
1559 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
---|
1560 | if test "X$xdir" = "X$arg"; then |
---|
1561 | xdir= |
---|
1562 | else |
---|
1563 | xdir="$xdir/" |
---|
1564 | fi |
---|
1565 | |
---|
1566 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
---|
1567 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
---|
1568 | libobjs="$libobjs $pic_object" |
---|
1569 | non_pic_objects="$non_pic_objects $non_pic_object" |
---|
1570 | fi |
---|
1571 | fi |
---|
1572 | ;; |
---|
1573 | |
---|
1574 | *.$libext) |
---|
1575 | # An archive. |
---|
1576 | deplibs="$deplibs $arg" |
---|
1577 | old_deplibs="$old_deplibs $arg" |
---|
1578 | continue |
---|
1579 | ;; |
---|
1580 | |
---|
1581 | *.la) |
---|
1582 | # A libtool-controlled library. |
---|
1583 | |
---|
1584 | if test "$prev" = dlfiles; then |
---|
1585 | # This library was specified with -dlopen. |
---|
1586 | dlfiles="$dlfiles $arg" |
---|
1587 | prev= |
---|
1588 | elif test "$prev" = dlprefiles; then |
---|
1589 | # The library was specified with -dlpreopen. |
---|
1590 | dlprefiles="$dlprefiles $arg" |
---|
1591 | prev= |
---|
1592 | else |
---|
1593 | deplibs="$deplibs $arg" |
---|
1594 | fi |
---|
1595 | continue |
---|
1596 | ;; |
---|
1597 | |
---|
1598 | # Some other compiler argument. |
---|
1599 | *) |
---|
1600 | # Unknown arguments in both finalize_command and compile_command need |
---|
1601 | # to be aesthetically quoted because they are evaled later. |
---|
1602 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
1603 | case $arg in |
---|
1604 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1605 | arg="\"$arg\"" |
---|
1606 | ;; |
---|
1607 | esac |
---|
1608 | ;; |
---|
1609 | esac # arg |
---|
1610 | |
---|
1611 | # Now actually substitute the argument into the commands. |
---|
1612 | if test -n "$arg"; then |
---|
1613 | compile_command="$compile_command $arg" |
---|
1614 | finalize_command="$finalize_command $arg" |
---|
1615 | fi |
---|
1616 | done # argument parsing loop |
---|
1617 | |
---|
1618 | if test -n "$prev"; then |
---|
1619 | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 |
---|
1620 | $echo "$help" 1>&2 |
---|
1621 | exit 1 |
---|
1622 | fi |
---|
1623 | |
---|
1624 | # Infer tagged configuration to use if any are available and |
---|
1625 | # if one wasn't chosen via the "--tag" command line option. |
---|
1626 | # Only attempt this if the compiler in the base link |
---|
1627 | # command doesn't match the default compiler. |
---|
1628 | if test -n "$available_tags" && test -z "$tagname"; then |
---|
1629 | case $base_compile in |
---|
1630 | # Blanks in the command may have been stripped by the calling shell, |
---|
1631 | # but not from the CC environment variable when configure was run. |
---|
1632 | "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; |
---|
1633 | # Blanks at the start of $base_compile will cause this to fail |
---|
1634 | # if we don't check for them as well. |
---|
1635 | *) |
---|
1636 | for z in $available_tags; do |
---|
1637 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then |
---|
1638 | # Evaluate the configuration. |
---|
1639 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" |
---|
1640 | case $base_compile in |
---|
1641 | "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) |
---|
1642 | # The compiler in $compile_command matches |
---|
1643 | # the one in the tagged configuration. |
---|
1644 | # Assume this is the tagged configuration we want. |
---|
1645 | tagname=$z |
---|
1646 | break |
---|
1647 | ;; |
---|
1648 | esac |
---|
1649 | fi |
---|
1650 | done |
---|
1651 | # If $tagname still isn't set, then no tagged configuration |
---|
1652 | # was found and let the user know that the "--tag" command |
---|
1653 | # line option must be used. |
---|
1654 | if test -z "$tagname"; then |
---|
1655 | $echo "$modename: unable to infer tagged configuration" |
---|
1656 | $echo "$modename: specify a tag with \`--tag'" 1>&2 |
---|
1657 | exit 1 |
---|
1658 | # else |
---|
1659 | # $echo "$modename: using $tagname tagged configuration" |
---|
1660 | fi |
---|
1661 | ;; |
---|
1662 | esac |
---|
1663 | fi |
---|
1664 | |
---|
1665 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
---|
1666 | eval arg=\"$export_dynamic_flag_spec\" |
---|
1667 | compile_command="$compile_command $arg" |
---|
1668 | finalize_command="$finalize_command $arg" |
---|
1669 | fi |
---|
1670 | |
---|
1671 | oldlibs= |
---|
1672 | # calculate the name of the file, without its directory |
---|
1673 | outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` |
---|
1674 | libobjs_save="$libobjs" |
---|
1675 | |
---|
1676 | if test -n "$shlibpath_var"; then |
---|
1677 | # get the directories listed in $shlibpath_var |
---|
1678 | eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` |
---|
1679 | else |
---|
1680 | shlib_search_path= |
---|
1681 | fi |
---|
1682 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
---|
1683 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
---|
1684 | |
---|
1685 | output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` |
---|
1686 | if test "X$output_objdir" = "X$output"; then |
---|
1687 | output_objdir="$objdir" |
---|
1688 | else |
---|
1689 | output_objdir="$output_objdir/$objdir" |
---|
1690 | fi |
---|
1691 | # Create the object directory. |
---|
1692 | if test ! -d "$output_objdir"; then |
---|
1693 | $show "$mkdir $output_objdir" |
---|
1694 | $run $mkdir $output_objdir |
---|
1695 | status=$? |
---|
1696 | if test "$status" -ne 0 && test ! -d "$output_objdir"; then |
---|
1697 | exit $status |
---|
1698 | fi |
---|
1699 | $show "chmod 777 $output_objdir" |
---|
1700 | $run chmod 777 $output_objdir |
---|
1701 | fi |
---|
1702 | |
---|
1703 | # Determine the type of output |
---|
1704 | case $output in |
---|
1705 | "") |
---|
1706 | $echo "$modename: you must specify an output file" 1>&2 |
---|
1707 | $echo "$help" 1>&2 |
---|
1708 | exit 1 |
---|
1709 | ;; |
---|
1710 | *.$libext) linkmode=oldlib ;; |
---|
1711 | *.lo | *.$objext) linkmode=obj ;; |
---|
1712 | *.la) linkmode=lib ;; |
---|
1713 | *) linkmode=prog ;; # Anything else should be a program. |
---|
1714 | esac |
---|
1715 | |
---|
1716 | case $host in |
---|
1717 | *cygwin* | *mingw* | *pw32*) |
---|
1718 | # don't eliminate duplcations in $postdeps and $predeps |
---|
1719 | duplicate_compiler_generated_deps=yes |
---|
1720 | ;; |
---|
1721 | *) |
---|
1722 | duplicate_compiler_generated_deps=$duplicate_deps |
---|
1723 | ;; |
---|
1724 | esac |
---|
1725 | specialdeplibs= |
---|
1726 | |
---|
1727 | libs= |
---|
1728 | # Find all interdependent deplibs by searching for libraries |
---|
1729 | # that are linked more than once (e.g. -la -lb -la) |
---|
1730 | for deplib in $deplibs; do |
---|
1731 | if test "X$duplicate_deps" = "Xyes" ; then |
---|
1732 | case "$libs " in |
---|
1733 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
---|
1734 | esac |
---|
1735 | fi |
---|
1736 | libs="$libs $deplib" |
---|
1737 | done |
---|
1738 | |
---|
1739 | if test "$linkmode" = lib; then |
---|
1740 | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
---|
1741 | |
---|
1742 | # Compute libraries that are listed more than once in $predeps |
---|
1743 | # $postdeps and mark them as special (i.e., whose duplicates are |
---|
1744 | # not to be eliminated). |
---|
1745 | pre_post_deps= |
---|
1746 | if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then |
---|
1747 | for pre_post_dep in $predeps $postdeps; do |
---|
1748 | case "$pre_post_deps " in |
---|
1749 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; |
---|
1750 | esac |
---|
1751 | pre_post_deps="$pre_post_deps $pre_post_dep" |
---|
1752 | done |
---|
1753 | fi |
---|
1754 | pre_post_deps= |
---|
1755 | fi |
---|
1756 | |
---|
1757 | deplibs= |
---|
1758 | newdependency_libs= |
---|
1759 | newlib_search_path= |
---|
1760 | need_relink=no # whether we're linking any uninstalled libtool libraries |
---|
1761 | notinst_deplibs= # not-installed libtool libraries |
---|
1762 | notinst_path= # paths that contain not-installed libtool libraries |
---|
1763 | case $linkmode in |
---|
1764 | lib) |
---|
1765 | passes="conv link" |
---|
1766 | for file in $dlfiles $dlprefiles; do |
---|
1767 | case $file in |
---|
1768 | *.la) ;; |
---|
1769 | *) |
---|
1770 | $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 |
---|
1771 | exit 1 |
---|
1772 | ;; |
---|
1773 | esac |
---|
1774 | done |
---|
1775 | ;; |
---|
1776 | prog) |
---|
1777 | compile_deplibs= |
---|
1778 | finalize_deplibs= |
---|
1779 | alldeplibs=no |
---|
1780 | newdlfiles= |
---|
1781 | newdlprefiles= |
---|
1782 | passes="conv scan dlopen dlpreopen link" |
---|
1783 | ;; |
---|
1784 | *) passes="conv" |
---|
1785 | ;; |
---|
1786 | esac |
---|
1787 | for pass in $passes; do |
---|
1788 | if test "$linkmode,$pass" = "lib,link" || |
---|
1789 | test "$linkmode,$pass" = "prog,scan"; then |
---|
1790 | libs="$deplibs" |
---|
1791 | deplibs= |
---|
1792 | fi |
---|
1793 | if test "$linkmode" = prog; then |
---|
1794 | case $pass in |
---|
1795 | dlopen) libs="$dlfiles" ;; |
---|
1796 | dlpreopen) libs="$dlprefiles" ;; |
---|
1797 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; |
---|
1798 | esac |
---|
1799 | fi |
---|
1800 | if test "$pass" = dlopen; then |
---|
1801 | # Collect dlpreopened libraries |
---|
1802 | save_deplibs="$deplibs" |
---|
1803 | deplibs= |
---|
1804 | fi |
---|
1805 | for deplib in $libs; do |
---|
1806 | lib= |
---|
1807 | found=no |
---|
1808 | case $deplib in |
---|
1809 | -l*) |
---|
1810 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
---|
1811 | $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 |
---|
1812 | continue |
---|
1813 | fi |
---|
1814 | if test "$pass" = conv; then |
---|
1815 | deplibs="$deplib $deplibs" |
---|
1816 | continue |
---|
1817 | fi |
---|
1818 | name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` |
---|
1819 | for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do |
---|
1820 | # Search the libtool library |
---|
1821 | lib="$searchdir/lib${name}.la" |
---|
1822 | if test -f "$lib"; then |
---|
1823 | found=yes |
---|
1824 | break |
---|
1825 | fi |
---|
1826 | done |
---|
1827 | if test "$found" != yes; then |
---|
1828 | # deplib doesn't seem to be a libtool library |
---|
1829 | if test "$linkmode,$pass" = "prog,link"; then |
---|
1830 | compile_deplibs="$deplib $compile_deplibs" |
---|
1831 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
1832 | else |
---|
1833 | deplibs="$deplib $deplibs" |
---|
1834 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
---|
1835 | fi |
---|
1836 | continue |
---|
1837 | else # deplib is a libtool library |
---|
1838 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
---|
1839 | # We need to do some special things here, and not later. |
---|
1840 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
1841 | case " $predeps $postdeps " in |
---|
1842 | *" $deplib "*) |
---|
1843 | if (${SED} -e '2q' $lib | |
---|
1844 | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
1845 | library_names= |
---|
1846 | old_library= |
---|
1847 | case $lib in |
---|
1848 | */* | *\\*) . $lib ;; |
---|
1849 | *) . ./$lib ;; |
---|
1850 | esac |
---|
1851 | for l in $old_library $library_names; do |
---|
1852 | ll="$l" |
---|
1853 | done |
---|
1854 | if test "X$ll" = "X$old_library" ; then # only static version available |
---|
1855 | found=no |
---|
1856 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
---|
1857 | test "X$ladir" = "X$lib" && ladir="." |
---|
1858 | lib=$ladir/$old_library |
---|
1859 | if test "$linkmode,$pass" = "prog,link"; then |
---|
1860 | compile_deplibs="$deplib $compile_deplibs" |
---|
1861 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
1862 | else |
---|
1863 | deplibs="$deplib $deplibs" |
---|
1864 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
---|
1865 | fi |
---|
1866 | continue |
---|
1867 | fi |
---|
1868 | fi |
---|
1869 | ;; |
---|
1870 | *) ;; |
---|
1871 | esac |
---|
1872 | fi |
---|
1873 | fi |
---|
1874 | ;; # -l |
---|
1875 | -L*) |
---|
1876 | case $linkmode in |
---|
1877 | lib) |
---|
1878 | deplibs="$deplib $deplibs" |
---|
1879 | test "$pass" = conv && continue |
---|
1880 | newdependency_libs="$deplib $newdependency_libs" |
---|
1881 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
---|
1882 | ;; |
---|
1883 | prog) |
---|
1884 | if test "$pass" = conv; then |
---|
1885 | deplibs="$deplib $deplibs" |
---|
1886 | continue |
---|
1887 | fi |
---|
1888 | if test "$pass" = scan; then |
---|
1889 | deplibs="$deplib $deplibs" |
---|
1890 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
---|
1891 | else |
---|
1892 | compile_deplibs="$deplib $compile_deplibs" |
---|
1893 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
1894 | fi |
---|
1895 | ;; |
---|
1896 | *) |
---|
1897 | $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 |
---|
1898 | ;; |
---|
1899 | esac # linkmode |
---|
1900 | continue |
---|
1901 | ;; # -L |
---|
1902 | -R*) |
---|
1903 | if test "$pass" = link; then |
---|
1904 | dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` |
---|
1905 | # Make sure the xrpath contains only unique directories. |
---|
1906 | case "$xrpath " in |
---|
1907 | *" $dir "*) ;; |
---|
1908 | *) xrpath="$xrpath $dir" ;; |
---|
1909 | esac |
---|
1910 | fi |
---|
1911 | deplibs="$deplib $deplibs" |
---|
1912 | continue |
---|
1913 | ;; |
---|
1914 | *.la) lib="$deplib" ;; |
---|
1915 | *.$libext) |
---|
1916 | if test "$pass" = conv; then |
---|
1917 | deplibs="$deplib $deplibs" |
---|
1918 | continue |
---|
1919 | fi |
---|
1920 | case $linkmode in |
---|
1921 | lib) |
---|
1922 | if test "$deplibs_check_method" != pass_all; then |
---|
1923 | $echo |
---|
1924 | $echo "*** Warning: Trying to link with static lib archive $deplib." |
---|
1925 | $echo "*** I have the capability to make that library automatically link in when" |
---|
1926 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
1927 | $echo "*** shared version of the library, which you do not appear to have" |
---|
1928 | $echo "*** because the file extensions .$libext of this argument makes me believe" |
---|
1929 | $echo "*** that it is just a static archive that I should not used here." |
---|
1930 | else |
---|
1931 | $echo |
---|
1932 | $echo "*** Warning: Linking the shared library $output against the" |
---|
1933 | $echo "*** static library $deplib is not portable!" |
---|
1934 | deplibs="$deplib $deplibs" |
---|
1935 | fi |
---|
1936 | continue |
---|
1937 | ;; |
---|
1938 | prog) |
---|
1939 | if test "$pass" != link; then |
---|
1940 | deplibs="$deplib $deplibs" |
---|
1941 | else |
---|
1942 | compile_deplibs="$deplib $compile_deplibs" |
---|
1943 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
1944 | fi |
---|
1945 | continue |
---|
1946 | ;; |
---|
1947 | esac # linkmode |
---|
1948 | ;; # *.$libext |
---|
1949 | *.lo | *.$objext) |
---|
1950 | if test "$pass" = conv; then |
---|
1951 | deplibs="$deplib $deplibs" |
---|
1952 | elif test "$linkmode" = prog; then |
---|
1953 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
---|
1954 | # If there is no dlopen support or we're linking statically, |
---|
1955 | # we need to preload. |
---|
1956 | newdlprefiles="$newdlprefiles $deplib" |
---|
1957 | compile_deplibs="$deplib $compile_deplibs" |
---|
1958 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
1959 | else |
---|
1960 | newdlfiles="$newdlfiles $deplib" |
---|
1961 | fi |
---|
1962 | fi |
---|
1963 | continue |
---|
1964 | ;; |
---|
1965 | %DEPLIBS%) |
---|
1966 | alldeplibs=yes |
---|
1967 | continue |
---|
1968 | ;; |
---|
1969 | esac # case $deplib |
---|
1970 | if test "$found" = yes || test -f "$lib"; then : |
---|
1971 | else |
---|
1972 | $echo "$modename: cannot find the library \`$lib'" 1>&2 |
---|
1973 | exit 1 |
---|
1974 | fi |
---|
1975 | |
---|
1976 | # Check to see that this really is a libtool archive. |
---|
1977 | if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
---|
1978 | else |
---|
1979 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
---|
1980 | exit 1 |
---|
1981 | fi |
---|
1982 | |
---|
1983 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
---|
1984 | test "X$ladir" = "X$lib" && ladir="." |
---|
1985 | |
---|
1986 | dlname= |
---|
1987 | dlopen= |
---|
1988 | dlpreopen= |
---|
1989 | libdir= |
---|
1990 | library_names= |
---|
1991 | old_library= |
---|
1992 | # If the library was installed with an old release of libtool, |
---|
1993 | # it will not redefine variables installed, or shouldnotlink |
---|
1994 | installed=yes |
---|
1995 | shouldnotlink=no |
---|
1996 | |
---|
1997 | # Read the .la file |
---|
1998 | case $lib in |
---|
1999 | */* | *\\*) . $lib ;; |
---|
2000 | *) . ./$lib ;; |
---|
2001 | esac |
---|
2002 | |
---|
2003 | if test "$linkmode,$pass" = "lib,link" || |
---|
2004 | test "$linkmode,$pass" = "prog,scan" || |
---|
2005 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
---|
2006 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
---|
2007 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" |
---|
2008 | fi |
---|
2009 | |
---|
2010 | if test "$pass" = conv; then |
---|
2011 | # Only check for convenience libraries |
---|
2012 | deplibs="$lib $deplibs" |
---|
2013 | if test -z "$libdir"; then |
---|
2014 | if test -z "$old_library"; then |
---|
2015 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
---|
2016 | exit 1 |
---|
2017 | fi |
---|
2018 | # It is a libtool convenience library, so add in its objects. |
---|
2019 | convenience="$convenience $ladir/$objdir/$old_library" |
---|
2020 | old_convenience="$old_convenience $ladir/$objdir/$old_library" |
---|
2021 | tmp_libs= |
---|
2022 | for deplib in $dependency_libs; do |
---|
2023 | deplibs="$deplib $deplibs" |
---|
2024 | if test "X$duplicate_deps" = "Xyes" ; then |
---|
2025 | case "$tmp_libs " in |
---|
2026 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
---|
2027 | esac |
---|
2028 | fi |
---|
2029 | tmp_libs="$tmp_libs $deplib" |
---|
2030 | done |
---|
2031 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
---|
2032 | $echo "$modename: \`$lib' is not a convenience library" 1>&2 |
---|
2033 | exit 1 |
---|
2034 | fi |
---|
2035 | continue |
---|
2036 | fi # $pass = conv |
---|
2037 | |
---|
2038 | |
---|
2039 | # Get the name of the library we link against. |
---|
2040 | linklib= |
---|
2041 | for l in $old_library $library_names; do |
---|
2042 | linklib="$l" |
---|
2043 | done |
---|
2044 | if test -z "$linklib"; then |
---|
2045 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
---|
2046 | exit 1 |
---|
2047 | fi |
---|
2048 | |
---|
2049 | # This library was specified with -dlopen. |
---|
2050 | if test "$pass" = dlopen; then |
---|
2051 | if test -z "$libdir"; then |
---|
2052 | $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 |
---|
2053 | exit 1 |
---|
2054 | fi |
---|
2055 | if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
---|
2056 | # If there is no dlname, no dlopen support or we're linking |
---|
2057 | # statically, we need to preload. We also need to preload any |
---|
2058 | # dependent libraries so libltdl's deplib preloader doesn't |
---|
2059 | # bomb out in the load deplibs phase. |
---|
2060 | dlprefiles="$dlprefiles $lib $dependency_libs" |
---|
2061 | else |
---|
2062 | newdlfiles="$newdlfiles $lib" |
---|
2063 | fi |
---|
2064 | continue |
---|
2065 | fi # $pass = dlopen |
---|
2066 | |
---|
2067 | # We need an absolute path. |
---|
2068 | case $ladir in |
---|
2069 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
---|
2070 | *) |
---|
2071 | abs_ladir=`cd "$ladir" && pwd` |
---|
2072 | if test -z "$abs_ladir"; then |
---|
2073 | $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 |
---|
2074 | $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 |
---|
2075 | abs_ladir="$ladir" |
---|
2076 | fi |
---|
2077 | ;; |
---|
2078 | esac |
---|
2079 | laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
---|
2080 | |
---|
2081 | # Find the relevant object directory and library name. |
---|
2082 | if test "X$installed" = Xyes; then |
---|
2083 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
---|
2084 | $echo "$modename: warning: library \`$lib' was moved." 1>&2 |
---|
2085 | dir="$ladir" |
---|
2086 | absdir="$abs_ladir" |
---|
2087 | libdir="$abs_ladir" |
---|
2088 | else |
---|
2089 | dir="$libdir" |
---|
2090 | absdir="$libdir" |
---|
2091 | fi |
---|
2092 | else |
---|
2093 | dir="$ladir/$objdir" |
---|
2094 | absdir="$abs_ladir/$objdir" |
---|
2095 | # Remove this search path later |
---|
2096 | notinst_path="$notinst_path $abs_ladir" |
---|
2097 | fi # $installed = yes |
---|
2098 | name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
---|
2099 | |
---|
2100 | # This library was specified with -dlpreopen. |
---|
2101 | if test "$pass" = dlpreopen; then |
---|
2102 | if test -z "$libdir"; then |
---|
2103 | $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 |
---|
2104 | exit 1 |
---|
2105 | fi |
---|
2106 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
---|
2107 | # are required to link). |
---|
2108 | if test -n "$old_library"; then |
---|
2109 | newdlprefiles="$newdlprefiles $dir/$old_library" |
---|
2110 | # Otherwise, use the dlname, so that lt_dlopen finds it. |
---|
2111 | elif test -n "$dlname"; then |
---|
2112 | newdlprefiles="$newdlprefiles $dir/$dlname" |
---|
2113 | else |
---|
2114 | newdlprefiles="$newdlprefiles $dir/$linklib" |
---|
2115 | fi |
---|
2116 | fi # $pass = dlpreopen |
---|
2117 | |
---|
2118 | if test -z "$libdir"; then |
---|
2119 | # Link the convenience library |
---|
2120 | if test "$linkmode" = lib; then |
---|
2121 | deplibs="$dir/$old_library $deplibs" |
---|
2122 | elif test "$linkmode,$pass" = "prog,link"; then |
---|
2123 | compile_deplibs="$dir/$old_library $compile_deplibs" |
---|
2124 | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
---|
2125 | else |
---|
2126 | deplibs="$lib $deplibs" # used for prog,scan pass |
---|
2127 | fi |
---|
2128 | continue |
---|
2129 | fi |
---|
2130 | |
---|
2131 | |
---|
2132 | if test "$linkmode" = prog && test "$pass" != link; then |
---|
2133 | newlib_search_path="$newlib_search_path $ladir" |
---|
2134 | deplibs="$lib $deplibs" |
---|
2135 | |
---|
2136 | linkalldeplibs=no |
---|
2137 | if test "$link_all_deplibs" != no || test -z "$library_names" || |
---|
2138 | test "$build_libtool_libs" = no; then |
---|
2139 | linkalldeplibs=yes |
---|
2140 | fi |
---|
2141 | |
---|
2142 | tmp_libs= |
---|
2143 | for deplib in $dependency_libs; do |
---|
2144 | case $deplib in |
---|
2145 | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test |
---|
2146 | esac |
---|
2147 | # Need to link against all dependency_libs? |
---|
2148 | if test "$linkalldeplibs" = yes; then |
---|
2149 | deplibs="$deplib $deplibs" |
---|
2150 | else |
---|
2151 | # Need to hardcode shared library paths |
---|
2152 | # or/and link against static libraries |
---|
2153 | newdependency_libs="$deplib $newdependency_libs" |
---|
2154 | fi |
---|
2155 | if test "X$duplicate_deps" = "Xyes" ; then |
---|
2156 | case "$tmp_libs " in |
---|
2157 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
---|
2158 | esac |
---|
2159 | fi |
---|
2160 | tmp_libs="$tmp_libs $deplib" |
---|
2161 | done # for deplib |
---|
2162 | continue |
---|
2163 | fi # $linkmode = prog... |
---|
2164 | |
---|
2165 | if test "$linkmode,$pass" = "prog,link"; then |
---|
2166 | if test -n "$library_names" && |
---|
2167 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then |
---|
2168 | # We need to hardcode the library path |
---|
2169 | if test -n "$shlibpath_var"; then |
---|
2170 | # Make sure the rpath contains only unique directories. |
---|
2171 | case "$temp_rpath " in |
---|
2172 | *" $dir "*) ;; |
---|
2173 | *" $absdir "*) ;; |
---|
2174 | *) temp_rpath="$temp_rpath $dir" ;; |
---|
2175 | esac |
---|
2176 | fi |
---|
2177 | |
---|
2178 | # Hardcode the library path. |
---|
2179 | # Skip directories that are in the system default run-time |
---|
2180 | # search path. |
---|
2181 | case " $sys_lib_dlsearch_path " in |
---|
2182 | *" $absdir "*) ;; |
---|
2183 | *) |
---|
2184 | case "$compile_rpath " in |
---|
2185 | *" $absdir "*) ;; |
---|
2186 | *) compile_rpath="$compile_rpath $absdir" |
---|
2187 | esac |
---|
2188 | ;; |
---|
2189 | esac |
---|
2190 | case " $sys_lib_dlsearch_path " in |
---|
2191 | *" $libdir "*) ;; |
---|
2192 | *) |
---|
2193 | case "$finalize_rpath " in |
---|
2194 | *" $libdir "*) ;; |
---|
2195 | *) finalize_rpath="$finalize_rpath $libdir" |
---|
2196 | esac |
---|
2197 | ;; |
---|
2198 | esac |
---|
2199 | fi # $linkmode,$pass = prog,link... |
---|
2200 | |
---|
2201 | if test "$alldeplibs" = yes && |
---|
2202 | { test "$deplibs_check_method" = pass_all || |
---|
2203 | { test "$build_libtool_libs" = yes && |
---|
2204 | test -n "$library_names"; }; }; then |
---|
2205 | # We only need to search for static libraries |
---|
2206 | continue |
---|
2207 | fi |
---|
2208 | fi |
---|
2209 | |
---|
2210 | link_static=no # Whether the deplib will be linked statically |
---|
2211 | if test -n "$library_names" && |
---|
2212 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then |
---|
2213 | if test "$installed" = no; then |
---|
2214 | notinst_deplibs="$notinst_deplibs $lib" |
---|
2215 | need_relink=yes |
---|
2216 | fi |
---|
2217 | # This is a shared library |
---|
2218 | |
---|
2219 | # Warn about portability, can't link against -module's on some systems (darwin) |
---|
2220 | if test "$shouldnotlink" = yes && test "$pass" = link ; then |
---|
2221 | $echo |
---|
2222 | if test "$linkmode" = prog; then |
---|
2223 | $echo "*** Warning: Linking the executable $output against the loadable module" |
---|
2224 | else |
---|
2225 | $echo "*** Warning: Linking the shared library $output against the loadable module" |
---|
2226 | fi |
---|
2227 | $echo "*** $linklib is not portable!" |
---|
2228 | fi |
---|
2229 | if test "$linkmode" = lib && |
---|
2230 | test "$hardcode_into_libs" = yes; then |
---|
2231 | # Hardcode the library path. |
---|
2232 | # Skip directories that are in the system default run-time |
---|
2233 | # search path. |
---|
2234 | case " $sys_lib_dlsearch_path " in |
---|
2235 | *" $absdir "*) ;; |
---|
2236 | *) |
---|
2237 | case "$compile_rpath " in |
---|
2238 | *" $absdir "*) ;; |
---|
2239 | *) compile_rpath="$compile_rpath $absdir" |
---|
2240 | esac |
---|
2241 | ;; |
---|
2242 | esac |
---|
2243 | case " $sys_lib_dlsearch_path " in |
---|
2244 | *" $libdir "*) ;; |
---|
2245 | *) |
---|
2246 | case "$finalize_rpath " in |
---|
2247 | *" $libdir "*) ;; |
---|
2248 | *) finalize_rpath="$finalize_rpath $libdir" |
---|
2249 | esac |
---|
2250 | ;; |
---|
2251 | esac |
---|
2252 | fi |
---|
2253 | |
---|
2254 | if test -n "$old_archive_from_expsyms_cmds"; then |
---|
2255 | # figure out the soname |
---|
2256 | set dummy $library_names |
---|
2257 | realname="$2" |
---|
2258 | shift; shift |
---|
2259 | libname=`eval \\$echo \"$libname_spec\"` |
---|
2260 | # use dlname if we got it. it's perfectly good, no? |
---|
2261 | if test -n "$dlname"; then |
---|
2262 | soname="$dlname" |
---|
2263 | elif test -n "$soname_spec"; then |
---|
2264 | # bleh windows |
---|
2265 | case $host in |
---|
2266 | *cygwin* | mingw*) |
---|
2267 | major=`expr $current - $age` |
---|
2268 | versuffix="-$major" |
---|
2269 | ;; |
---|
2270 | esac |
---|
2271 | eval soname=\"$soname_spec\" |
---|
2272 | else |
---|
2273 | soname="$realname" |
---|
2274 | fi |
---|
2275 | |
---|
2276 | # Make a new name for the extract_expsyms_cmds to use |
---|
2277 | soroot="$soname" |
---|
2278 | soname=`$echo $soroot | ${SED} -e 's/^.*\///'` |
---|
2279 | newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" |
---|
2280 | |
---|
2281 | # If the library has no export list, then create one now |
---|
2282 | if test -f "$output_objdir/$soname-def"; then : |
---|
2283 | else |
---|
2284 | $show "extracting exported symbol list from \`$soname'" |
---|
2285 | save_ifs="$IFS"; IFS='~' |
---|
2286 | eval cmds=\"$extract_expsyms_cmds\" |
---|
2287 | for cmd in $cmds; do |
---|
2288 | IFS="$save_ifs" |
---|
2289 | $show "$cmd" |
---|
2290 | $run eval "$cmd" || exit $? |
---|
2291 | done |
---|
2292 | IFS="$save_ifs" |
---|
2293 | fi |
---|
2294 | |
---|
2295 | # Create $newlib |
---|
2296 | if test -f "$output_objdir/$newlib"; then :; else |
---|
2297 | $show "generating import library for \`$soname'" |
---|
2298 | save_ifs="$IFS"; IFS='~' |
---|
2299 | eval cmds=\"$old_archive_from_expsyms_cmds\" |
---|
2300 | for cmd in $cmds; do |
---|
2301 | IFS="$save_ifs" |
---|
2302 | $show "$cmd" |
---|
2303 | $run eval "$cmd" || exit $? |
---|
2304 | done |
---|
2305 | IFS="$save_ifs" |
---|
2306 | fi |
---|
2307 | # make sure the library variables are pointing to the new library |
---|
2308 | dir=$output_objdir |
---|
2309 | linklib=$newlib |
---|
2310 | fi # test -n "$old_archive_from_expsyms_cmds" |
---|
2311 | |
---|
2312 | if test "$linkmode" = prog || test "$mode" != relink; then |
---|
2313 | add_shlibpath= |
---|
2314 | add_dir= |
---|
2315 | add= |
---|
2316 | lib_linked=yes |
---|
2317 | case $hardcode_action in |
---|
2318 | immediate | unsupported) |
---|
2319 | if test "$hardcode_direct" = no; then |
---|
2320 | add="$dir/$linklib" |
---|
2321 | case $host in |
---|
2322 | *-*-sco3.2v5* ) add_dir="-L$dir" ;; |
---|
2323 | *-*-darwin* ) |
---|
2324 | # if the lib is a module then we can not link against it, someone |
---|
2325 | # is ignoring the new warnings I added |
---|
2326 | if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then |
---|
2327 | $echo "** Warning, lib $linklib is a module, not a shared library" |
---|
2328 | if test -z "$old_library" ; then |
---|
2329 | $echo |
---|
2330 | $echo "** And there doesn't seem to be a static archive available" |
---|
2331 | $echo "** The link will probably fail, sorry" |
---|
2332 | else |
---|
2333 | add="$dir/$old_library" |
---|
2334 | fi |
---|
2335 | fi |
---|
2336 | esac |
---|
2337 | elif test "$hardcode_minus_L" = no; then |
---|
2338 | case $host in |
---|
2339 | *-*-sunos*) add_shlibpath="$dir" ;; |
---|
2340 | esac |
---|
2341 | add_dir="-L$dir" |
---|
2342 | add="-l$name" |
---|
2343 | elif test "$hardcode_shlibpath_var" = no; then |
---|
2344 | add_shlibpath="$dir" |
---|
2345 | add="-l$name" |
---|
2346 | else |
---|
2347 | lib_linked=no |
---|
2348 | fi |
---|
2349 | ;; |
---|
2350 | relink) |
---|
2351 | if test "$hardcode_direct" = yes; then |
---|
2352 | add="$dir/$linklib" |
---|
2353 | elif test "$hardcode_minus_L" = yes; then |
---|
2354 | add_dir="-L$dir" |
---|
2355 | # Try looking first in the location we're being installed to. |
---|
2356 | if test -n "$inst_prefix_dir"; then |
---|
2357 | case "$libdir" in |
---|
2358 | [\\/]*) |
---|
2359 | add_dir="-L$inst_prefix_dir$libdir $add_dir" |
---|
2360 | ;; |
---|
2361 | esac |
---|
2362 | fi |
---|
2363 | add="-l$name" |
---|
2364 | elif test "$hardcode_shlibpath_var" = yes; then |
---|
2365 | add_shlibpath="$dir" |
---|
2366 | add="-l$name" |
---|
2367 | else |
---|
2368 | lib_linked=no |
---|
2369 | fi |
---|
2370 | ;; |
---|
2371 | *) lib_linked=no ;; |
---|
2372 | esac |
---|
2373 | |
---|
2374 | if test "$lib_linked" != yes; then |
---|
2375 | $echo "$modename: configuration error: unsupported hardcode properties" |
---|
2376 | exit 1 |
---|
2377 | fi |
---|
2378 | |
---|
2379 | if test -n "$add_shlibpath"; then |
---|
2380 | case :$compile_shlibpath: in |
---|
2381 | *":$add_shlibpath:"*) ;; |
---|
2382 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; |
---|
2383 | esac |
---|
2384 | fi |
---|
2385 | if test "$linkmode" = prog; then |
---|
2386 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
---|
2387 | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
---|
2388 | else |
---|
2389 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
---|
2390 | test -n "$add" && deplibs="$add $deplibs" |
---|
2391 | if test "$hardcode_direct" != yes && \ |
---|
2392 | test "$hardcode_minus_L" != yes && \ |
---|
2393 | test "$hardcode_shlibpath_var" = yes; then |
---|
2394 | case :$finalize_shlibpath: in |
---|
2395 | *":$libdir:"*) ;; |
---|
2396 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
---|
2397 | esac |
---|
2398 | fi |
---|
2399 | fi |
---|
2400 | fi |
---|
2401 | |
---|
2402 | if test "$linkmode" = prog || test "$mode" = relink; then |
---|
2403 | add_shlibpath= |
---|
2404 | add_dir= |
---|
2405 | add= |
---|
2406 | # Finalize command for both is simple: just hardcode it. |
---|
2407 | if test "$hardcode_direct" = yes; then |
---|
2408 | add="$libdir/$linklib" |
---|
2409 | elif test "$hardcode_minus_L" = yes; then |
---|
2410 | add_dir="-L$libdir" |
---|
2411 | add="-l$name" |
---|
2412 | elif test "$hardcode_shlibpath_var" = yes; then |
---|
2413 | case :$finalize_shlibpath: in |
---|
2414 | *":$libdir:"*) ;; |
---|
2415 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
---|
2416 | esac |
---|
2417 | add="-l$name" |
---|
2418 | elif test "$hardcode_automatic" = yes; then |
---|
2419 | if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then |
---|
2420 | add="$inst_prefix_dir$libdir/$linklib" |
---|
2421 | else |
---|
2422 | add="$libdir/$linklib" |
---|
2423 | fi |
---|
2424 | else |
---|
2425 | # We cannot seem to hardcode it, guess we'll fake it. |
---|
2426 | add_dir="-L$libdir" |
---|
2427 | # Try looking first in the location we're being installed to. |
---|
2428 | if test -n "$inst_prefix_dir"; then |
---|
2429 | case "$libdir" in |
---|
2430 | [\\/]*) |
---|
2431 | add_dir="-L$inst_prefix_dir$libdir $add_dir" |
---|
2432 | ;; |
---|
2433 | esac |
---|
2434 | fi |
---|
2435 | add="-l$name" |
---|
2436 | fi |
---|
2437 | |
---|
2438 | if test "$linkmode" = prog; then |
---|
2439 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
---|
2440 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
---|
2441 | else |
---|
2442 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
---|
2443 | test -n "$add" && deplibs="$add $deplibs" |
---|
2444 | fi |
---|
2445 | fi |
---|
2446 | elif test "$linkmode" = prog; then |
---|
2447 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
---|
2448 | # is not unsupported. This is valid on all known static and |
---|
2449 | # shared platforms. |
---|
2450 | if test "$hardcode_direct" != unsupported; then |
---|
2451 | test -n "$old_library" && linklib="$old_library" |
---|
2452 | compile_deplibs="$dir/$linklib $compile_deplibs" |
---|
2453 | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
---|
2454 | else |
---|
2455 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
---|
2456 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
---|
2457 | fi |
---|
2458 | elif test "$build_libtool_libs" = yes; then |
---|
2459 | # Not a shared library |
---|
2460 | if test "$deplibs_check_method" != pass_all; then |
---|
2461 | # We're trying link a shared library against a static one |
---|
2462 | # but the system doesn't support it. |
---|
2463 | |
---|
2464 | # Just print a warning and add the library to dependency_libs so |
---|
2465 | # that the program can be linked against the static library. |
---|
2466 | $echo |
---|
2467 | $echo "*** Warning: This system can not link to static lib archive $lib." |
---|
2468 | $echo "*** I have the capability to make that library automatically link in when" |
---|
2469 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
2470 | $echo "*** shared version of the library, which you do not appear to have." |
---|
2471 | if test "$module" = yes; then |
---|
2472 | $echo "*** But as you try to build a module library, libtool will still create " |
---|
2473 | $echo "*** a static module, that should work as long as the dlopening application" |
---|
2474 | $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." |
---|
2475 | if test -z "$global_symbol_pipe"; then |
---|
2476 | $echo |
---|
2477 | $echo "*** However, this would only work if libtool was able to extract symbol" |
---|
2478 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
---|
2479 | $echo "*** not find such a program. So, this module is probably useless." |
---|
2480 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." |
---|
2481 | fi |
---|
2482 | if test "$build_old_libs" = no; then |
---|
2483 | build_libtool_libs=module |
---|
2484 | build_old_libs=yes |
---|
2485 | else |
---|
2486 | build_libtool_libs=no |
---|
2487 | fi |
---|
2488 | fi |
---|
2489 | else |
---|
2490 | convenience="$convenience $dir/$old_library" |
---|
2491 | old_convenience="$old_convenience $dir/$old_library" |
---|
2492 | deplibs="$dir/$old_library $deplibs" |
---|
2493 | link_static=yes |
---|
2494 | fi |
---|
2495 | fi # link shared/static library? |
---|
2496 | |
---|
2497 | if test "$linkmode" = lib; then |
---|
2498 | if test -n "$dependency_libs" && |
---|
2499 | { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || |
---|
2500 | test "$link_static" = yes; }; then |
---|
2501 | # Extract -R from dependency_libs |
---|
2502 | temp_deplibs= |
---|
2503 | for libdir in $dependency_libs; do |
---|
2504 | case $libdir in |
---|
2505 | -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` |
---|
2506 | case " $xrpath " in |
---|
2507 | *" $temp_xrpath "*) ;; |
---|
2508 | *) xrpath="$xrpath $temp_xrpath";; |
---|
2509 | esac;; |
---|
2510 | *) temp_deplibs="$temp_deplibs $libdir";; |
---|
2511 | esac |
---|
2512 | done |
---|
2513 | dependency_libs="$temp_deplibs" |
---|
2514 | fi |
---|
2515 | |
---|
2516 | newlib_search_path="$newlib_search_path $absdir" |
---|
2517 | # Link against this library |
---|
2518 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
---|
2519 | # ... and its dependency_libs |
---|
2520 | tmp_libs= |
---|
2521 | for deplib in $dependency_libs; do |
---|
2522 | newdependency_libs="$deplib $newdependency_libs" |
---|
2523 | if test "X$duplicate_deps" = "Xyes" ; then |
---|
2524 | case "$tmp_libs " in |
---|
2525 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
---|
2526 | esac |
---|
2527 | fi |
---|
2528 | tmp_libs="$tmp_libs $deplib" |
---|
2529 | done |
---|
2530 | |
---|
2531 | if test "$link_all_deplibs" != no; then |
---|
2532 | # Add the search paths of all dependency libraries |
---|
2533 | for deplib in $dependency_libs; do |
---|
2534 | case $deplib in |
---|
2535 | -L*) path="$deplib" ;; |
---|
2536 | *.la) |
---|
2537 | dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` |
---|
2538 | test "X$dir" = "X$deplib" && dir="." |
---|
2539 | # We need an absolute path. |
---|
2540 | case $dir in |
---|
2541 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; |
---|
2542 | *) |
---|
2543 | absdir=`cd "$dir" && pwd` |
---|
2544 | if test -z "$absdir"; then |
---|
2545 | $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 |
---|
2546 | absdir="$dir" |
---|
2547 | fi |
---|
2548 | ;; |
---|
2549 | esac |
---|
2550 | if grep "^installed=no" $deplib > /dev/null; then |
---|
2551 | path="$absdir/$objdir" |
---|
2552 | else |
---|
2553 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
---|
2554 | if test -z "$libdir"; then |
---|
2555 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
---|
2556 | exit 1 |
---|
2557 | fi |
---|
2558 | if test "$absdir" != "$libdir"; then |
---|
2559 | $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 |
---|
2560 | fi |
---|
2561 | path="$absdir" |
---|
2562 | fi |
---|
2563 | depdepl= |
---|
2564 | case $host in |
---|
2565 | *-*-darwin*) |
---|
2566 | # we do not want to link against static libs, but need to link against shared |
---|
2567 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` |
---|
2568 | if test -n "$deplibrary_names" ; then |
---|
2569 | for tmp in $deplibrary_names ; do |
---|
2570 | depdepl=$tmp |
---|
2571 | done |
---|
2572 | if test -f "$path/$depdepl" ; then |
---|
2573 | depdepl="$path/$depdepl" |
---|
2574 | fi |
---|
2575 | newlib_search_path="$newlib_search_path $path" |
---|
2576 | path="" |
---|
2577 | fi |
---|
2578 | ;; |
---|
2579 | *) |
---|
2580 | path="-L$path" |
---|
2581 | ;; |
---|
2582 | esac |
---|
2583 | |
---|
2584 | ;; |
---|
2585 | -l*) |
---|
2586 | case $host in |
---|
2587 | *-*-darwin*) |
---|
2588 | # Again, we only want to link against shared libraries |
---|
2589 | eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` |
---|
2590 | for tmp in $newlib_search_path ; do |
---|
2591 | if test -f "$tmp/lib$tmp_libs.dylib" ; then |
---|
2592 | eval depdepl="$tmp/lib$tmp_libs.dylib" |
---|
2593 | break |
---|
2594 | fi |
---|
2595 | done |
---|
2596 | path="" |
---|
2597 | ;; |
---|
2598 | *) continue ;; |
---|
2599 | esac |
---|
2600 | ;; |
---|
2601 | *) continue ;; |
---|
2602 | esac |
---|
2603 | case " $deplibs " in |
---|
2604 | *" $depdepl "*) ;; |
---|
2605 | *) deplibs="$deplibs $depdepl" ;; |
---|
2606 | esac |
---|
2607 | case " $deplibs " in |
---|
2608 | *" $path "*) ;; |
---|
2609 | *) deplibs="$deplibs $path" ;; |
---|
2610 | esac |
---|
2611 | done |
---|
2612 | fi # link_all_deplibs != no |
---|
2613 | fi # linkmode = lib |
---|
2614 | done # for deplib in $libs |
---|
2615 | dependency_libs="$newdependency_libs" |
---|
2616 | if test "$pass" = dlpreopen; then |
---|
2617 | # Link the dlpreopened libraries before other libraries |
---|
2618 | for deplib in $save_deplibs; do |
---|
2619 | deplibs="$deplib $deplibs" |
---|
2620 | done |
---|
2621 | fi |
---|
2622 | if test "$pass" != dlopen; then |
---|
2623 | if test "$pass" != conv; then |
---|
2624 | # Make sure lib_search_path contains only unique directories. |
---|
2625 | lib_search_path= |
---|
2626 | for dir in $newlib_search_path; do |
---|
2627 | case "$lib_search_path " in |
---|
2628 | *" $dir "*) ;; |
---|
2629 | *) lib_search_path="$lib_search_path $dir" ;; |
---|
2630 | esac |
---|
2631 | done |
---|
2632 | newlib_search_path= |
---|
2633 | fi |
---|
2634 | |
---|
2635 | if test "$linkmode,$pass" != "prog,link"; then |
---|
2636 | vars="deplibs" |
---|
2637 | else |
---|
2638 | vars="compile_deplibs finalize_deplibs" |
---|
2639 | fi |
---|
2640 | for var in $vars dependency_libs; do |
---|
2641 | # Add libraries to $var in reverse order |
---|
2642 | eval tmp_libs=\"\$$var\" |
---|
2643 | new_libs= |
---|
2644 | for deplib in $tmp_libs; do |
---|
2645 | # FIXME: Pedantically, this is the right thing to do, so |
---|
2646 | # that some nasty dependency loop isn't accidentally |
---|
2647 | # broken: |
---|
2648 | #new_libs="$deplib $new_libs" |
---|
2649 | # Pragmatically, this seems to cause very few problems in |
---|
2650 | # practice: |
---|
2651 | case $deplib in |
---|
2652 | -L*) new_libs="$deplib $new_libs" ;; |
---|
2653 | -R*) ;; |
---|
2654 | *) |
---|
2655 | # And here is the reason: when a library appears more |
---|
2656 | # than once as an explicit dependence of a library, or |
---|
2657 | # is implicitly linked in more than once by the |
---|
2658 | # compiler, it is considered special, and multiple |
---|
2659 | # occurrences thereof are not removed. Compare this |
---|
2660 | # with having the same library being listed as a |
---|
2661 | # dependency of multiple other libraries: in this case, |
---|
2662 | # we know (pedantically, we assume) the library does not |
---|
2663 | # need to be listed more than once, so we keep only the |
---|
2664 | # last copy. This is not always right, but it is rare |
---|
2665 | # enough that we require users that really mean to play |
---|
2666 | # such unportable linking tricks to link the library |
---|
2667 | # using -Wl,-lname, so that libtool does not consider it |
---|
2668 | # for duplicate removal. |
---|
2669 | case " $specialdeplibs " in |
---|
2670 | *" $deplib "*) new_libs="$deplib $new_libs" ;; |
---|
2671 | *) |
---|
2672 | case " $new_libs " in |
---|
2673 | *" $deplib "*) ;; |
---|
2674 | *) new_libs="$deplib $new_libs" ;; |
---|
2675 | esac |
---|
2676 | ;; |
---|
2677 | esac |
---|
2678 | ;; |
---|
2679 | esac |
---|
2680 | done |
---|
2681 | tmp_libs= |
---|
2682 | for deplib in $new_libs; do |
---|
2683 | case $deplib in |
---|
2684 | -L*) |
---|
2685 | case " $tmp_libs " in |
---|
2686 | *" $deplib "*) ;; |
---|
2687 | *) tmp_libs="$tmp_libs $deplib" ;; |
---|
2688 | esac |
---|
2689 | ;; |
---|
2690 | *) tmp_libs="$tmp_libs $deplib" ;; |
---|
2691 | esac |
---|
2692 | done |
---|
2693 | eval $var=\"$tmp_libs\" |
---|
2694 | done # for var |
---|
2695 | fi |
---|
2696 | # Last step: remove runtime libs from dependency_libs (they stay in deplibs) |
---|
2697 | tmp_libs= |
---|
2698 | for i in $dependency_libs ; do |
---|
2699 | case " $predeps $postdeps $compiler_lib_search_path " in |
---|
2700 | *" $i "*) |
---|
2701 | i="" |
---|
2702 | ;; |
---|
2703 | esac |
---|
2704 | if test -n "$i" ; then |
---|
2705 | tmp_libs="$tmp_libs $i" |
---|
2706 | fi |
---|
2707 | done |
---|
2708 | dependency_libs=$tmp_libs |
---|
2709 | done # for pass |
---|
2710 | if test "$linkmode" = prog; then |
---|
2711 | dlfiles="$newdlfiles" |
---|
2712 | dlprefiles="$newdlprefiles" |
---|
2713 | fi |
---|
2714 | |
---|
2715 | case $linkmode in |
---|
2716 | oldlib) |
---|
2717 | if test -n "$deplibs"; then |
---|
2718 | $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 |
---|
2719 | fi |
---|
2720 | |
---|
2721 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
---|
2722 | $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 |
---|
2723 | fi |
---|
2724 | |
---|
2725 | if test -n "$rpath"; then |
---|
2726 | $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 |
---|
2727 | fi |
---|
2728 | |
---|
2729 | if test -n "$xrpath"; then |
---|
2730 | $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 |
---|
2731 | fi |
---|
2732 | |
---|
2733 | if test -n "$vinfo"; then |
---|
2734 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 |
---|
2735 | fi |
---|
2736 | |
---|
2737 | if test -n "$release"; then |
---|
2738 | $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 |
---|
2739 | fi |
---|
2740 | |
---|
2741 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
---|
2742 | $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 |
---|
2743 | fi |
---|
2744 | |
---|
2745 | # Now set the variables for building old libraries. |
---|
2746 | build_libtool_libs=no |
---|
2747 | oldlibs="$output" |
---|
2748 | objs="$objs$old_deplibs" |
---|
2749 | ;; |
---|
2750 | |
---|
2751 | lib) |
---|
2752 | # Make sure we only generate libraries of the form `libNAME.la'. |
---|
2753 | case $outputname in |
---|
2754 | lib*) |
---|
2755 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
---|
2756 | eval shared_ext=\"$shrext\" |
---|
2757 | eval libname=\"$libname_spec\" |
---|
2758 | ;; |
---|
2759 | *) |
---|
2760 | if test "$module" = no; then |
---|
2761 | $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 |
---|
2762 | $echo "$help" 1>&2 |
---|
2763 | exit 1 |
---|
2764 | fi |
---|
2765 | if test "$need_lib_prefix" != no; then |
---|
2766 | # Add the "lib" prefix for modules if required |
---|
2767 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` |
---|
2768 | eval shared_ext=\"$shrext\" |
---|
2769 | eval libname=\"$libname_spec\" |
---|
2770 | else |
---|
2771 | libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` |
---|
2772 | fi |
---|
2773 | ;; |
---|
2774 | esac |
---|
2775 | |
---|
2776 | if test -n "$objs"; then |
---|
2777 | if test "$deplibs_check_method" != pass_all; then |
---|
2778 | $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 |
---|
2779 | exit 1 |
---|
2780 | else |
---|
2781 | $echo |
---|
2782 | $echo "*** Warning: Linking the shared library $output against the non-libtool" |
---|
2783 | $echo "*** objects $objs is not portable!" |
---|
2784 | libobjs="$libobjs $objs" |
---|
2785 | fi |
---|
2786 | fi |
---|
2787 | |
---|
2788 | if test "$dlself" != no; then |
---|
2789 | $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 |
---|
2790 | fi |
---|
2791 | |
---|
2792 | set dummy $rpath |
---|
2793 | if test "$#" -gt 2; then |
---|
2794 | $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 |
---|
2795 | fi |
---|
2796 | install_libdir="$2" |
---|
2797 | |
---|
2798 | oldlibs= |
---|
2799 | if test -z "$rpath"; then |
---|
2800 | if test "$build_libtool_libs" = yes; then |
---|
2801 | # Building a libtool convenience library. |
---|
2802 | # Some compilers have problems with a `.al' extension so |
---|
2803 | # convenience libraries should have the same extension an |
---|
2804 | # archive normally would. |
---|
2805 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
---|
2806 | build_libtool_libs=convenience |
---|
2807 | build_old_libs=yes |
---|
2808 | fi |
---|
2809 | |
---|
2810 | if test -n "$vinfo"; then |
---|
2811 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 |
---|
2812 | fi |
---|
2813 | |
---|
2814 | if test -n "$release"; then |
---|
2815 | $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 |
---|
2816 | fi |
---|
2817 | else |
---|
2818 | |
---|
2819 | # Parse the version information argument. |
---|
2820 | save_ifs="$IFS"; IFS=':' |
---|
2821 | set dummy $vinfo 0 0 0 |
---|
2822 | IFS="$save_ifs" |
---|
2823 | |
---|
2824 | if test -n "$8"; then |
---|
2825 | $echo "$modename: too many parameters to \`-version-info'" 1>&2 |
---|
2826 | $echo "$help" 1>&2 |
---|
2827 | exit 1 |
---|
2828 | fi |
---|
2829 | |
---|
2830 | # convert absolute version numbers to libtool ages |
---|
2831 | # this retains compatibility with .la files and attempts |
---|
2832 | # to make the code below a bit more comprehensible |
---|
2833 | |
---|
2834 | case $vinfo_number in |
---|
2835 | yes) |
---|
2836 | number_major="$2" |
---|
2837 | number_minor="$3" |
---|
2838 | number_revision="$4" |
---|
2839 | # |
---|
2840 | # There are really only two kinds -- those that |
---|
2841 | # use the current revision as the major version |
---|
2842 | # and those that subtract age and use age as |
---|
2843 | # a minor version. But, then there is irix |
---|
2844 | # which has an extra 1 added just for fun |
---|
2845 | # |
---|
2846 | case $version_type in |
---|
2847 | darwin|linux|osf|windows) |
---|
2848 | current=`expr $number_major + $number_minor` |
---|
2849 | age="$number_minor" |
---|
2850 | revision="$number_revision" |
---|
2851 | ;; |
---|
2852 | freebsd-aout|freebsd-elf|sunos) |
---|
2853 | current="$number_major" |
---|
2854 | revision="$number_minor" |
---|
2855 | age="0" |
---|
2856 | ;; |
---|
2857 | irix|nonstopux) |
---|
2858 | current=`expr $number_major + $number_minor - 1` |
---|
2859 | age="$number_minor" |
---|
2860 | revision="$number_minor" |
---|
2861 | ;; |
---|
2862 | esac |
---|
2863 | ;; |
---|
2864 | no) |
---|
2865 | current="$2" |
---|
2866 | revision="$3" |
---|
2867 | age="$4" |
---|
2868 | ;; |
---|
2869 | esac |
---|
2870 | |
---|
2871 | # Check that each of the things are valid numbers. |
---|
2872 | case $current in |
---|
2873 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; |
---|
2874 | *) |
---|
2875 | $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 |
---|
2876 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
---|
2877 | exit 1 |
---|
2878 | ;; |
---|
2879 | esac |
---|
2880 | |
---|
2881 | case $revision in |
---|
2882 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; |
---|
2883 | *) |
---|
2884 | $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 |
---|
2885 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
---|
2886 | exit 1 |
---|
2887 | ;; |
---|
2888 | esac |
---|
2889 | |
---|
2890 | case $age in |
---|
2891 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; |
---|
2892 | *) |
---|
2893 | $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 |
---|
2894 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
---|
2895 | exit 1 |
---|
2896 | ;; |
---|
2897 | esac |
---|
2898 | |
---|
2899 | if test "$age" -gt "$current"; then |
---|
2900 | $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 |
---|
2901 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
---|
2902 | exit 1 |
---|
2903 | fi |
---|
2904 | |
---|
2905 | # Calculate the version variables. |
---|
2906 | major= |
---|
2907 | versuffix= |
---|
2908 | verstring= |
---|
2909 | case $version_type in |
---|
2910 | none) ;; |
---|
2911 | |
---|
2912 | darwin) |
---|
2913 | # Like Linux, but with the current version available in |
---|
2914 | # verstring for coding it into the library header |
---|
2915 | major=.`expr $current - $age` |
---|
2916 | versuffix="$major.$age.$revision" |
---|
2917 | # Darwin ld doesn't like 0 for these options... |
---|
2918 | minor_current=`expr $current + 1` |
---|
2919 | verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" |
---|
2920 | ;; |
---|
2921 | |
---|
2922 | freebsd-aout) |
---|
2923 | major=".$current" |
---|
2924 | versuffix=".$current.$revision"; |
---|
2925 | ;; |
---|
2926 | |
---|
2927 | freebsd-elf) |
---|
2928 | major=".$current" |
---|
2929 | versuffix=".$current"; |
---|
2930 | ;; |
---|
2931 | |
---|
2932 | irix | nonstopux) |
---|
2933 | major=`expr $current - $age + 1` |
---|
2934 | |
---|
2935 | case $version_type in |
---|
2936 | nonstopux) verstring_prefix=nonstopux ;; |
---|
2937 | *) verstring_prefix=sgi ;; |
---|
2938 | esac |
---|
2939 | verstring="$verstring_prefix$major.$revision" |
---|
2940 | |
---|
2941 | # Add in all the interfaces that we are compatible with. |
---|
2942 | loop=$revision |
---|
2943 | while test "$loop" -ne 0; do |
---|
2944 | iface=`expr $revision - $loop` |
---|
2945 | loop=`expr $loop - 1` |
---|
2946 | verstring="$verstring_prefix$major.$iface:$verstring" |
---|
2947 | done |
---|
2948 | |
---|
2949 | # Before this point, $major must not contain `.'. |
---|
2950 | major=.$major |
---|
2951 | versuffix="$major.$revision" |
---|
2952 | ;; |
---|
2953 | |
---|
2954 | linux) |
---|
2955 | major=.`expr $current - $age` |
---|
2956 | versuffix="$major.$age.$revision" |
---|
2957 | ;; |
---|
2958 | |
---|
2959 | osf) |
---|
2960 | major=.`expr $current - $age` |
---|
2961 | versuffix=".$current.$age.$revision" |
---|
2962 | verstring="$current.$age.$revision" |
---|
2963 | |
---|
2964 | # Add in all the interfaces that we are compatible with. |
---|
2965 | loop=$age |
---|
2966 | while test "$loop" -ne 0; do |
---|
2967 | iface=`expr $current - $loop` |
---|
2968 | loop=`expr $loop - 1` |
---|
2969 | verstring="$verstring:${iface}.0" |
---|
2970 | done |
---|
2971 | |
---|
2972 | # Make executables depend on our current version. |
---|
2973 | verstring="$verstring:${current}.0" |
---|
2974 | ;; |
---|
2975 | |
---|
2976 | sunos) |
---|
2977 | major=".$current" |
---|
2978 | versuffix=".$current.$revision" |
---|
2979 | ;; |
---|
2980 | |
---|
2981 | windows) |
---|
2982 | # Use '-' rather than '.', since we only want one |
---|
2983 | # extension on DOS 8.3 filesystems. |
---|
2984 | major=`expr $current - $age` |
---|
2985 | versuffix="-$major" |
---|
2986 | ;; |
---|
2987 | |
---|
2988 | *) |
---|
2989 | $echo "$modename: unknown library version type \`$version_type'" 1>&2 |
---|
2990 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
---|
2991 | exit 1 |
---|
2992 | ;; |
---|
2993 | esac |
---|
2994 | |
---|
2995 | # Clear the version info if we defaulted, and they specified a release. |
---|
2996 | if test -z "$vinfo" && test -n "$release"; then |
---|
2997 | major= |
---|
2998 | case $version_type in |
---|
2999 | darwin) |
---|
3000 | # we can't check for "0.0" in archive_cmds due to quoting |
---|
3001 | # problems, so we reset it completely |
---|
3002 | verstring= |
---|
3003 | ;; |
---|
3004 | *) |
---|
3005 | verstring="0.0" |
---|
3006 | ;; |
---|
3007 | esac |
---|
3008 | if test "$need_version" = no; then |
---|
3009 | versuffix= |
---|
3010 | else |
---|
3011 | versuffix=".0.0" |
---|
3012 | fi |
---|
3013 | fi |
---|
3014 | |
---|
3015 | # Remove version info from name if versioning should be avoided |
---|
3016 | if test "$avoid_version" = yes && test "$need_version" = no; then |
---|
3017 | major= |
---|
3018 | versuffix= |
---|
3019 | verstring="" |
---|
3020 | fi |
---|
3021 | |
---|
3022 | # Check to see if the archive will have undefined symbols. |
---|
3023 | if test "$allow_undefined" = yes; then |
---|
3024 | if test "$allow_undefined_flag" = unsupported; then |
---|
3025 | $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 |
---|
3026 | build_libtool_libs=no |
---|
3027 | build_old_libs=yes |
---|
3028 | fi |
---|
3029 | else |
---|
3030 | # Don't allow undefined symbols. |
---|
3031 | allow_undefined_flag="$no_undefined_flag" |
---|
3032 | fi |
---|
3033 | fi |
---|
3034 | |
---|
3035 | if test "$mode" != relink; then |
---|
3036 | # Remove our outputs, but don't remove object files since they |
---|
3037 | # may have been created when compiling PIC objects. |
---|
3038 | removelist= |
---|
3039 | tempremovelist=`$echo "$output_objdir/*"` |
---|
3040 | for p in $tempremovelist; do |
---|
3041 | case $p in |
---|
3042 | *.$objext) |
---|
3043 | ;; |
---|
3044 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) |
---|
3045 | removelist="$removelist $p" |
---|
3046 | ;; |
---|
3047 | *) ;; |
---|
3048 | esac |
---|
3049 | done |
---|
3050 | if test -n "$removelist"; then |
---|
3051 | $show "${rm}r $removelist" |
---|
3052 | $run ${rm}r $removelist |
---|
3053 | fi |
---|
3054 | fi |
---|
3055 | |
---|
3056 | # Now set the variables for building old libraries. |
---|
3057 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then |
---|
3058 | oldlibs="$oldlibs $output_objdir/$libname.$libext" |
---|
3059 | |
---|
3060 | # Transform .lo files to .o files. |
---|
3061 | oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` |
---|
3062 | fi |
---|
3063 | |
---|
3064 | # Eliminate all temporary directories. |
---|
3065 | for path in $notinst_path; do |
---|
3066 | lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` |
---|
3067 | deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` |
---|
3068 | dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` |
---|
3069 | done |
---|
3070 | |
---|
3071 | if test -n "$xrpath"; then |
---|
3072 | # If the user specified any rpath flags, then add them. |
---|
3073 | temp_xrpath= |
---|
3074 | for libdir in $xrpath; do |
---|
3075 | temp_xrpath="$temp_xrpath -R$libdir" |
---|
3076 | case "$finalize_rpath " in |
---|
3077 | *" $libdir "*) ;; |
---|
3078 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
---|
3079 | esac |
---|
3080 | done |
---|
3081 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
---|
3082 | dependency_libs="$temp_xrpath $dependency_libs" |
---|
3083 | fi |
---|
3084 | fi |
---|
3085 | |
---|
3086 | # Make sure dlfiles contains only unique files that won't be dlpreopened |
---|
3087 | old_dlfiles="$dlfiles" |
---|
3088 | dlfiles= |
---|
3089 | for lib in $old_dlfiles; do |
---|
3090 | case " $dlprefiles $dlfiles " in |
---|
3091 | *" $lib "*) ;; |
---|
3092 | *) dlfiles="$dlfiles $lib" ;; |
---|
3093 | esac |
---|
3094 | done |
---|
3095 | |
---|
3096 | # Make sure dlprefiles contains only unique files |
---|
3097 | old_dlprefiles="$dlprefiles" |
---|
3098 | dlprefiles= |
---|
3099 | for lib in $old_dlprefiles; do |
---|
3100 | case "$dlprefiles " in |
---|
3101 | *" $lib "*) ;; |
---|
3102 | *) dlprefiles="$dlprefiles $lib" ;; |
---|
3103 | esac |
---|
3104 | done |
---|
3105 | |
---|
3106 | if test "$build_libtool_libs" = yes; then |
---|
3107 | if test -n "$rpath"; then |
---|
3108 | case $host in |
---|
3109 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) |
---|
3110 | # these systems don't actually have a c library (as such)! |
---|
3111 | ;; |
---|
3112 | *-*-rhapsody* | *-*-darwin1.[012]) |
---|
3113 | # Rhapsody C library is in the System framework |
---|
3114 | deplibs="$deplibs -framework System" |
---|
3115 | ;; |
---|
3116 | *-*-netbsd*) |
---|
3117 | # Don't link with libc until the a.out ld.so is fixed. |
---|
3118 | ;; |
---|
3119 | *-*-openbsd* | *-*-freebsd*) |
---|
3120 | # Do not include libc due to us having libc/libc_r. |
---|
3121 | test "X$arg" = "X-lc" && continue |
---|
3122 | ;; |
---|
3123 | *) |
---|
3124 | # Add libc to deplibs on all other systems if necessary. |
---|
3125 | if test "$build_libtool_need_lc" = "yes"; then |
---|
3126 | deplibs="$deplibs -lc" |
---|
3127 | fi |
---|
3128 | ;; |
---|
3129 | esac |
---|
3130 | fi |
---|
3131 | |
---|
3132 | # Transform deplibs into only deplibs that can be linked in shared. |
---|
3133 | name_save=$name |
---|
3134 | libname_save=$libname |
---|
3135 | release_save=$release |
---|
3136 | versuffix_save=$versuffix |
---|
3137 | major_save=$major |
---|
3138 | # I'm not sure if I'm treating the release correctly. I think |
---|
3139 | # release should show up in the -l (ie -lgmp5) so we don't want to |
---|
3140 | # add it in twice. Is that correct? |
---|
3141 | release="" |
---|
3142 | versuffix="" |
---|
3143 | major="" |
---|
3144 | newdeplibs= |
---|
3145 | droppeddeps=no |
---|
3146 | case $deplibs_check_method in |
---|
3147 | pass_all) |
---|
3148 | # Don't check for shared/static. Everything works. |
---|
3149 | # This might be a little naive. We might want to check |
---|
3150 | # whether the library exists or not. But this is on |
---|
3151 | # osf3 & osf4 and I'm not really sure... Just |
---|
3152 | # implementing what was already the behavior. |
---|
3153 | newdeplibs=$deplibs |
---|
3154 | ;; |
---|
3155 | test_compile) |
---|
3156 | # This code stresses the "libraries are programs" paradigm to its |
---|
3157 | # limits. Maybe even breaks it. We compile a program, linking it |
---|
3158 | # against the deplibs as a proxy for the library. Then we can check |
---|
3159 | # whether they linked in statically or dynamically with ldd. |
---|
3160 | $rm conftest.c |
---|
3161 | cat > conftest.c <<EOF |
---|
3162 | int main() { return 0; } |
---|
3163 | EOF |
---|
3164 | $rm conftest |
---|
3165 | $LTCC -o conftest conftest.c $deplibs |
---|
3166 | if test "$?" -eq 0 ; then |
---|
3167 | ldd_output=`ldd conftest` |
---|
3168 | for i in $deplibs; do |
---|
3169 | name="`expr $i : '-l\(.*\)'`" |
---|
3170 | # If $name is empty we are operating on a -L argument. |
---|
3171 | if test "$name" != "" && test "$name" -ne "0"; then |
---|
3172 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3173 | case " $predeps $postdeps " in |
---|
3174 | *" $i "*) |
---|
3175 | newdeplibs="$newdeplibs $i" |
---|
3176 | i="" |
---|
3177 | ;; |
---|
3178 | esac |
---|
3179 | fi |
---|
3180 | if test -n "$i" ; then |
---|
3181 | libname=`eval \\$echo \"$libname_spec\"` |
---|
3182 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
---|
3183 | set dummy $deplib_matches |
---|
3184 | deplib_match=$2 |
---|
3185 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
---|
3186 | newdeplibs="$newdeplibs $i" |
---|
3187 | else |
---|
3188 | droppeddeps=yes |
---|
3189 | $echo |
---|
3190 | $echo "*** Warning: dynamic linker does not accept needed library $i." |
---|
3191 | $echo "*** I have the capability to make that library automatically link in when" |
---|
3192 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
3193 | $echo "*** shared version of the library, which I believe you do not have" |
---|
3194 | $echo "*** because a test_compile did reveal that the linker did not use it for" |
---|
3195 | $echo "*** its dynamic dependency list that programs get resolved with at runtime." |
---|
3196 | fi |
---|
3197 | fi |
---|
3198 | else |
---|
3199 | newdeplibs="$newdeplibs $i" |
---|
3200 | fi |
---|
3201 | done |
---|
3202 | else |
---|
3203 | # Error occurred in the first compile. Let's try to salvage |
---|
3204 | # the situation: Compile a separate program for each library. |
---|
3205 | for i in $deplibs; do |
---|
3206 | name="`expr $i : '-l\(.*\)'`" |
---|
3207 | # If $name is empty we are operating on a -L argument. |
---|
3208 | if test "$name" != "" && test "$name" != "0"; then |
---|
3209 | $rm conftest |
---|
3210 | $LTCC -o conftest conftest.c $i |
---|
3211 | # Did it work? |
---|
3212 | if test "$?" -eq 0 ; then |
---|
3213 | ldd_output=`ldd conftest` |
---|
3214 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3215 | case " $predeps $postdeps " in |
---|
3216 | *" $i "*) |
---|
3217 | newdeplibs="$newdeplibs $i" |
---|
3218 | i="" |
---|
3219 | ;; |
---|
3220 | esac |
---|
3221 | fi |
---|
3222 | if test -n "$i" ; then |
---|
3223 | libname=`eval \\$echo \"$libname_spec\"` |
---|
3224 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
---|
3225 | set dummy $deplib_matches |
---|
3226 | deplib_match=$2 |
---|
3227 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
---|
3228 | newdeplibs="$newdeplibs $i" |
---|
3229 | else |
---|
3230 | droppeddeps=yes |
---|
3231 | $echo |
---|
3232 | $echo "*** Warning: dynamic linker does not accept needed library $i." |
---|
3233 | $echo "*** I have the capability to make that library automatically link in when" |
---|
3234 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
3235 | $echo "*** shared version of the library, which you do not appear to have" |
---|
3236 | $echo "*** because a test_compile did reveal that the linker did not use this one" |
---|
3237 | $echo "*** as a dynamic dependency that programs can get resolved with at runtime." |
---|
3238 | fi |
---|
3239 | fi |
---|
3240 | else |
---|
3241 | droppeddeps=yes |
---|
3242 | $echo |
---|
3243 | $echo "*** Warning! Library $i is needed by this library but I was not able to" |
---|
3244 | $echo "*** make it link in! You will probably need to install it or some" |
---|
3245 | $echo "*** library that it depends on before this library will be fully" |
---|
3246 | $echo "*** functional. Installing it before continuing would be even better." |
---|
3247 | fi |
---|
3248 | else |
---|
3249 | newdeplibs="$newdeplibs $i" |
---|
3250 | fi |
---|
3251 | done |
---|
3252 | fi |
---|
3253 | ;; |
---|
3254 | file_magic*) |
---|
3255 | set dummy $deplibs_check_method |
---|
3256 | file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
---|
3257 | for a_deplib in $deplibs; do |
---|
3258 | name="`expr $a_deplib : '-l\(.*\)'`" |
---|
3259 | # If $name is empty we are operating on a -L argument. |
---|
3260 | if test "$name" != "" && test "$name" != "0"; then |
---|
3261 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3262 | case " $predeps $postdeps " in |
---|
3263 | *" $a_deplib "*) |
---|
3264 | newdeplibs="$newdeplibs $a_deplib" |
---|
3265 | a_deplib="" |
---|
3266 | ;; |
---|
3267 | esac |
---|
3268 | fi |
---|
3269 | if test -n "$a_deplib" ; then |
---|
3270 | libname=`eval \\$echo \"$libname_spec\"` |
---|
3271 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
---|
3272 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
---|
3273 | for potent_lib in $potential_libs; do |
---|
3274 | # Follow soft links. |
---|
3275 | if ls -lLd "$potent_lib" 2>/dev/null \ |
---|
3276 | | grep " -> " >/dev/null; then |
---|
3277 | continue |
---|
3278 | fi |
---|
3279 | # The statement above tries to avoid entering an |
---|
3280 | # endless loop below, in case of cyclic links. |
---|
3281 | # We might still enter an endless loop, since a link |
---|
3282 | # loop can be closed while we follow links, |
---|
3283 | # but so what? |
---|
3284 | potlib="$potent_lib" |
---|
3285 | while test -h "$potlib" 2>/dev/null; do |
---|
3286 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
---|
3287 | case $potliblink in |
---|
3288 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
---|
3289 | *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; |
---|
3290 | esac |
---|
3291 | done |
---|
3292 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ |
---|
3293 | | ${SED} 10q \ |
---|
3294 | | $EGREP "$file_magic_regex" > /dev/null; then |
---|
3295 | newdeplibs="$newdeplibs $a_deplib" |
---|
3296 | a_deplib="" |
---|
3297 | break 2 |
---|
3298 | fi |
---|
3299 | done |
---|
3300 | done |
---|
3301 | fi |
---|
3302 | if test -n "$a_deplib" ; then |
---|
3303 | droppeddeps=yes |
---|
3304 | $echo |
---|
3305 | $echo "*** Warning: linker path does not have real file for library $a_deplib." |
---|
3306 | $echo "*** I have the capability to make that library automatically link in when" |
---|
3307 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
3308 | $echo "*** shared version of the library, which you do not appear to have" |
---|
3309 | $echo "*** because I did check the linker path looking for a file starting" |
---|
3310 | if test -z "$potlib" ; then |
---|
3311 | $echo "*** with $libname but no candidates were found. (...for file magic test)" |
---|
3312 | else |
---|
3313 | $echo "*** with $libname and none of the candidates passed a file format test" |
---|
3314 | $echo "*** using a file magic. Last file checked: $potlib" |
---|
3315 | fi |
---|
3316 | fi |
---|
3317 | else |
---|
3318 | # Add a -L argument. |
---|
3319 | newdeplibs="$newdeplibs $a_deplib" |
---|
3320 | fi |
---|
3321 | done # Gone through all deplibs. |
---|
3322 | ;; |
---|
3323 | match_pattern*) |
---|
3324 | set dummy $deplibs_check_method |
---|
3325 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
---|
3326 | for a_deplib in $deplibs; do |
---|
3327 | name="`expr $a_deplib : '-l\(.*\)'`" |
---|
3328 | # If $name is empty we are operating on a -L argument. |
---|
3329 | if test -n "$name" && test "$name" != "0"; then |
---|
3330 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3331 | case " $predeps $postdeps " in |
---|
3332 | *" $a_deplib "*) |
---|
3333 | newdeplibs="$newdeplibs $a_deplib" |
---|
3334 | a_deplib="" |
---|
3335 | ;; |
---|
3336 | esac |
---|
3337 | fi |
---|
3338 | if test -n "$a_deplib" ; then |
---|
3339 | libname=`eval \\$echo \"$libname_spec\"` |
---|
3340 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
---|
3341 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
---|
3342 | for potent_lib in $potential_libs; do |
---|
3343 | potlib="$potent_lib" # see symlink-check above in file_magic test |
---|
3344 | if eval $echo \"$potent_lib\" 2>/dev/null \ |
---|
3345 | | ${SED} 10q \ |
---|
3346 | | $EGREP "$match_pattern_regex" > /dev/null; then |
---|
3347 | newdeplibs="$newdeplibs $a_deplib" |
---|
3348 | a_deplib="" |
---|
3349 | break 2 |
---|
3350 | fi |
---|
3351 | done |
---|
3352 | done |
---|
3353 | fi |
---|
3354 | if test -n "$a_deplib" ; then |
---|
3355 | droppeddeps=yes |
---|
3356 | $echo |
---|
3357 | $echo "*** Warning: linker path does not have real file for library $a_deplib." |
---|
3358 | $echo "*** I have the capability to make that library automatically link in when" |
---|
3359 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
3360 | $echo "*** shared version of the library, which you do not appear to have" |
---|
3361 | $echo "*** because I did check the linker path looking for a file starting" |
---|
3362 | if test -z "$potlib" ; then |
---|
3363 | $echo "*** with $libname but no candidates were found. (...for regex pattern test)" |
---|
3364 | else |
---|
3365 | $echo "*** with $libname and none of the candidates passed a file format test" |
---|
3366 | $echo "*** using a regex pattern. Last file checked: $potlib" |
---|
3367 | fi |
---|
3368 | fi |
---|
3369 | else |
---|
3370 | # Add a -L argument. |
---|
3371 | newdeplibs="$newdeplibs $a_deplib" |
---|
3372 | fi |
---|
3373 | done # Gone through all deplibs. |
---|
3374 | ;; |
---|
3375 | none | unknown | *) |
---|
3376 | newdeplibs="" |
---|
3377 | tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ |
---|
3378 | -e 's/ -[LR][^ ]*//g'` |
---|
3379 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3380 | for i in $predeps $postdeps ; do |
---|
3381 | # can't use Xsed below, because $i might contain '/' |
---|
3382 | tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` |
---|
3383 | done |
---|
3384 | fi |
---|
3385 | if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ |
---|
3386 | | grep . >/dev/null; then |
---|
3387 | $echo |
---|
3388 | if test "X$deplibs_check_method" = "Xnone"; then |
---|
3389 | $echo "*** Warning: inter-library dependencies are not supported in this platform." |
---|
3390 | else |
---|
3391 | $echo "*** Warning: inter-library dependencies are not known to be supported." |
---|
3392 | fi |
---|
3393 | $echo "*** All declared inter-library dependencies are being dropped." |
---|
3394 | droppeddeps=yes |
---|
3395 | fi |
---|
3396 | ;; |
---|
3397 | esac |
---|
3398 | versuffix=$versuffix_save |
---|
3399 | major=$major_save |
---|
3400 | release=$release_save |
---|
3401 | libname=$libname_save |
---|
3402 | name=$name_save |
---|
3403 | |
---|
3404 | case $host in |
---|
3405 | *-*-rhapsody* | *-*-darwin1.[012]) |
---|
3406 | # On Rhapsody replace the C library is the System framework |
---|
3407 | newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` |
---|
3408 | ;; |
---|
3409 | esac |
---|
3410 | |
---|
3411 | if test "$droppeddeps" = yes; then |
---|
3412 | if test "$module" = yes; then |
---|
3413 | $echo |
---|
3414 | $echo "*** Warning: libtool could not satisfy all declared inter-library" |
---|
3415 | $echo "*** dependencies of module $libname. Therefore, libtool will create" |
---|
3416 | $echo "*** a static module, that should work as long as the dlopening" |
---|
3417 | $echo "*** application is linked with the -dlopen flag." |
---|
3418 | if test -z "$global_symbol_pipe"; then |
---|
3419 | $echo |
---|
3420 | $echo "*** However, this would only work if libtool was able to extract symbol" |
---|
3421 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
---|
3422 | $echo "*** not find such a program. So, this module is probably useless." |
---|
3423 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." |
---|
3424 | fi |
---|
3425 | if test "$build_old_libs" = no; then |
---|
3426 | oldlibs="$output_objdir/$libname.$libext" |
---|
3427 | build_libtool_libs=module |
---|
3428 | build_old_libs=yes |
---|
3429 | else |
---|
3430 | build_libtool_libs=no |
---|
3431 | fi |
---|
3432 | else |
---|
3433 | $echo "*** The inter-library dependencies that have been dropped here will be" |
---|
3434 | $echo "*** automatically added whenever a program is linked with this library" |
---|
3435 | $echo "*** or is declared to -dlopen it." |
---|
3436 | |
---|
3437 | if test "$allow_undefined" = no; then |
---|
3438 | $echo |
---|
3439 | $echo "*** Since this library must not contain undefined symbols," |
---|
3440 | $echo "*** because either the platform does not support them or" |
---|
3441 | $echo "*** it was explicitly requested with -no-undefined," |
---|
3442 | $echo "*** libtool will only create a static version of it." |
---|
3443 | if test "$build_old_libs" = no; then |
---|
3444 | oldlibs="$output_objdir/$libname.$libext" |
---|
3445 | build_libtool_libs=module |
---|
3446 | build_old_libs=yes |
---|
3447 | else |
---|
3448 | build_libtool_libs=no |
---|
3449 | fi |
---|
3450 | fi |
---|
3451 | fi |
---|
3452 | fi |
---|
3453 | # Done checking deplibs! |
---|
3454 | deplibs=$newdeplibs |
---|
3455 | fi |
---|
3456 | |
---|
3457 | # All the library-specific variables (install_libdir is set above). |
---|
3458 | library_names= |
---|
3459 | old_library= |
---|
3460 | dlname= |
---|
3461 | |
---|
3462 | # Test again, we may have decided not to build it any more |
---|
3463 | if test "$build_libtool_libs" = yes; then |
---|
3464 | if test "$hardcode_into_libs" = yes; then |
---|
3465 | # Hardcode the library paths |
---|
3466 | hardcode_libdirs= |
---|
3467 | dep_rpath= |
---|
3468 | rpath="$finalize_rpath" |
---|
3469 | test "$mode" != relink && rpath="$compile_rpath$rpath" |
---|
3470 | for libdir in $rpath; do |
---|
3471 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
3472 | if test -n "$hardcode_libdir_separator"; then |
---|
3473 | if test -z "$hardcode_libdirs"; then |
---|
3474 | hardcode_libdirs="$libdir" |
---|
3475 | else |
---|
3476 | # Just accumulate the unique libdirs. |
---|
3477 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
---|
3478 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
---|
3479 | ;; |
---|
3480 | *) |
---|
3481 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
---|
3482 | ;; |
---|
3483 | esac |
---|
3484 | fi |
---|
3485 | else |
---|
3486 | eval flag=\"$hardcode_libdir_flag_spec\" |
---|
3487 | dep_rpath="$dep_rpath $flag" |
---|
3488 | fi |
---|
3489 | elif test -n "$runpath_var"; then |
---|
3490 | case "$perm_rpath " in |
---|
3491 | *" $libdir "*) ;; |
---|
3492 | *) perm_rpath="$perm_rpath $libdir" ;; |
---|
3493 | esac |
---|
3494 | fi |
---|
3495 | done |
---|
3496 | # Substitute the hardcoded libdirs into the rpath. |
---|
3497 | if test -n "$hardcode_libdir_separator" && |
---|
3498 | test -n "$hardcode_libdirs"; then |
---|
3499 | libdir="$hardcode_libdirs" |
---|
3500 | if test -n "$hardcode_libdir_flag_spec_ld"; then |
---|
3501 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" |
---|
3502 | else |
---|
3503 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" |
---|
3504 | fi |
---|
3505 | fi |
---|
3506 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
---|
3507 | # We should set the runpath_var. |
---|
3508 | rpath= |
---|
3509 | for dir in $perm_rpath; do |
---|
3510 | rpath="$rpath$dir:" |
---|
3511 | done |
---|
3512 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
---|
3513 | fi |
---|
3514 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
---|
3515 | fi |
---|
3516 | |
---|
3517 | shlibpath="$finalize_shlibpath" |
---|
3518 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" |
---|
3519 | if test -n "$shlibpath"; then |
---|
3520 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
---|
3521 | fi |
---|
3522 | |
---|
3523 | # Get the real and link names of the library. |
---|
3524 | eval shared_ext=\"$shrext\" |
---|
3525 | eval library_names=\"$library_names_spec\" |
---|
3526 | set dummy $library_names |
---|
3527 | realname="$2" |
---|
3528 | shift; shift |
---|
3529 | |
---|
3530 | if test -n "$soname_spec"; then |
---|
3531 | eval soname=\"$soname_spec\" |
---|
3532 | else |
---|
3533 | soname="$realname" |
---|
3534 | fi |
---|
3535 | if test -z "$dlname"; then |
---|
3536 | dlname=$soname |
---|
3537 | fi |
---|
3538 | |
---|
3539 | lib="$output_objdir/$realname" |
---|
3540 | for link |
---|
3541 | do |
---|
3542 | linknames="$linknames $link" |
---|
3543 | done |
---|
3544 | |
---|
3545 | # Use standard objects if they are pic |
---|
3546 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
---|
3547 | |
---|
3548 | # Prepare the list of exported symbols |
---|
3549 | if test -z "$export_symbols"; then |
---|
3550 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then |
---|
3551 | $show "generating symbol list for \`$libname.la'" |
---|
3552 | export_symbols="$output_objdir/$libname.exp" |
---|
3553 | $run $rm $export_symbols |
---|
3554 | eval cmds=\"$export_symbols_cmds\" |
---|
3555 | save_ifs="$IFS"; IFS='~' |
---|
3556 | for cmd in $cmds; do |
---|
3557 | IFS="$save_ifs" |
---|
3558 | if len=`expr "X$cmd" : ".*"` && |
---|
3559 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
---|
3560 | $show "$cmd" |
---|
3561 | $run eval "$cmd" || exit $? |
---|
3562 | skipped_export=false |
---|
3563 | else |
---|
3564 | # The command line is too long to execute in one step. |
---|
3565 | $show "using reloadable object file for export list..." |
---|
3566 | skipped_export=: |
---|
3567 | fi |
---|
3568 | done |
---|
3569 | IFS="$save_ifs" |
---|
3570 | if test -n "$export_symbols_regex"; then |
---|
3571 | $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" |
---|
3572 | $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
---|
3573 | $show "$mv \"${export_symbols}T\" \"$export_symbols\"" |
---|
3574 | $run eval '$mv "${export_symbols}T" "$export_symbols"' |
---|
3575 | fi |
---|
3576 | fi |
---|
3577 | fi |
---|
3578 | |
---|
3579 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
---|
3580 | $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' |
---|
3581 | fi |
---|
3582 | |
---|
3583 | tmp_deplibs= |
---|
3584 | for test_deplib in $deplibs; do |
---|
3585 | case " $convenience " in |
---|
3586 | *" $test_deplib "*) ;; |
---|
3587 | *) |
---|
3588 | tmp_deplibs="$tmp_deplibs $test_deplib" |
---|
3589 | ;; |
---|
3590 | esac |
---|
3591 | done |
---|
3592 | deplibs="$tmp_deplibs" |
---|
3593 | |
---|
3594 | if test -n "$convenience"; then |
---|
3595 | if test -n "$whole_archive_flag_spec"; then |
---|
3596 | save_libobjs=$libobjs |
---|
3597 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
---|
3598 | else |
---|
3599 | gentop="$output_objdir/${outputname}x" |
---|
3600 | $show "${rm}r $gentop" |
---|
3601 | $run ${rm}r "$gentop" |
---|
3602 | $show "$mkdir $gentop" |
---|
3603 | $run $mkdir "$gentop" |
---|
3604 | status=$? |
---|
3605 | if test "$status" -ne 0 && test ! -d "$gentop"; then |
---|
3606 | exit $status |
---|
3607 | fi |
---|
3608 | generated="$generated $gentop" |
---|
3609 | |
---|
3610 | for xlib in $convenience; do |
---|
3611 | # Extract the objects. |
---|
3612 | case $xlib in |
---|
3613 | [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; |
---|
3614 | *) xabs=`pwd`"/$xlib" ;; |
---|
3615 | esac |
---|
3616 | xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` |
---|
3617 | xdir="$gentop/$xlib" |
---|
3618 | |
---|
3619 | $show "${rm}r $xdir" |
---|
3620 | $run ${rm}r "$xdir" |
---|
3621 | $show "$mkdir $xdir" |
---|
3622 | $run $mkdir "$xdir" |
---|
3623 | status=$? |
---|
3624 | if test "$status" -ne 0 && test ! -d "$xdir"; then |
---|
3625 | exit $status |
---|
3626 | fi |
---|
3627 | # We will extract separately just the conflicting names and we will no |
---|
3628 | # longer touch any unique names. It is faster to leave these extract |
---|
3629 | # automatically by $AR in one run. |
---|
3630 | $show "(cd $xdir && $AR x $xabs)" |
---|
3631 | $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? |
---|
3632 | if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then |
---|
3633 | : |
---|
3634 | else |
---|
3635 | $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 |
---|
3636 | $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 |
---|
3637 | $AR t "$xabs" | sort | uniq -cd | while read -r count name |
---|
3638 | do |
---|
3639 | i=1 |
---|
3640 | while test "$i" -le "$count" |
---|
3641 | do |
---|
3642 | # Put our $i before any first dot (extension) |
---|
3643 | # Never overwrite any file |
---|
3644 | name_to="$name" |
---|
3645 | while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" |
---|
3646 | do |
---|
3647 | name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` |
---|
3648 | done |
---|
3649 | $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" |
---|
3650 | $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? |
---|
3651 | i=`expr $i + 1` |
---|
3652 | done |
---|
3653 | done |
---|
3654 | fi |
---|
3655 | |
---|
3656 | libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
---|
3657 | done |
---|
3658 | fi |
---|
3659 | fi |
---|
3660 | |
---|
3661 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
---|
3662 | eval flag=\"$thread_safe_flag_spec\" |
---|
3663 | linker_flags="$linker_flags $flag" |
---|
3664 | fi |
---|
3665 | |
---|
3666 | # Make a backup of the uninstalled library when relinking |
---|
3667 | if test "$mode" = relink; then |
---|
3668 | $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? |
---|
3669 | fi |
---|
3670 | |
---|
3671 | # Do each of the archive commands. |
---|
3672 | if test "$module" = yes && test -n "$module_cmds" ; then |
---|
3673 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
---|
3674 | eval cmds=\"$module_expsym_cmds\" |
---|
3675 | else |
---|
3676 | eval cmds=\"$module_cmds\" |
---|
3677 | fi |
---|
3678 | else |
---|
3679 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
---|
3680 | eval cmds=\"$archive_expsym_cmds\" |
---|
3681 | else |
---|
3682 | eval cmds=\"$archive_cmds\" |
---|
3683 | fi |
---|
3684 | fi |
---|
3685 | |
---|
3686 | if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && |
---|
3687 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
---|
3688 | : |
---|
3689 | else |
---|
3690 | # The command line is too long to link in one step, link piecewise. |
---|
3691 | $echo "creating reloadable object files..." |
---|
3692 | |
---|
3693 | # Save the value of $output and $libobjs because we want to |
---|
3694 | # use them later. If we have whole_archive_flag_spec, we |
---|
3695 | # want to use save_libobjs as it was before |
---|
3696 | # whole_archive_flag_spec was expanded, because we can't |
---|
3697 | # assume the linker understands whole_archive_flag_spec. |
---|
3698 | # This may have to be revisited, in case too many |
---|
3699 | # convenience libraries get linked in and end up exceeding |
---|
3700 | # the spec. |
---|
3701 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then |
---|
3702 | save_libobjs=$libobjs |
---|
3703 | fi |
---|
3704 | save_output=$output |
---|
3705 | |
---|
3706 | # Clear the reloadable object creation command queue and |
---|
3707 | # initialize k to one. |
---|
3708 | test_cmds= |
---|
3709 | concat_cmds= |
---|
3710 | objlist= |
---|
3711 | delfiles= |
---|
3712 | last_robj= |
---|
3713 | k=1 |
---|
3714 | output=$output_objdir/$save_output-${k}.$objext |
---|
3715 | # Loop over the list of objects to be linked. |
---|
3716 | for obj in $save_libobjs |
---|
3717 | do |
---|
3718 | eval test_cmds=\"$reload_cmds $objlist $last_robj\" |
---|
3719 | if test "X$objlist" = X || |
---|
3720 | { len=`expr "X$test_cmds" : ".*"` && |
---|
3721 | test "$len" -le "$max_cmd_len"; }; then |
---|
3722 | objlist="$objlist $obj" |
---|
3723 | else |
---|
3724 | # The command $test_cmds is almost too long, add a |
---|
3725 | # command to the queue. |
---|
3726 | if test "$k" -eq 1 ; then |
---|
3727 | # The first file doesn't have a previous command to add. |
---|
3728 | eval concat_cmds=\"$reload_cmds $objlist $last_robj\" |
---|
3729 | else |
---|
3730 | # All subsequent reloadable object files will link in |
---|
3731 | # the last one created. |
---|
3732 | eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" |
---|
3733 | fi |
---|
3734 | last_robj=$output_objdir/$save_output-${k}.$objext |
---|
3735 | k=`expr $k + 1` |
---|
3736 | output=$output_objdir/$save_output-${k}.$objext |
---|
3737 | objlist=$obj |
---|
3738 | len=1 |
---|
3739 | fi |
---|
3740 | done |
---|
3741 | # Handle the remaining objects by creating one last |
---|
3742 | # reloadable object file. All subsequent reloadable object |
---|
3743 | # files will link in the last one created. |
---|
3744 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
---|
3745 | eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" |
---|
3746 | |
---|
3747 | if ${skipped_export-false}; then |
---|
3748 | $show "generating symbol list for \`$libname.la'" |
---|
3749 | export_symbols="$output_objdir/$libname.exp" |
---|
3750 | $run $rm $export_symbols |
---|
3751 | libobjs=$output |
---|
3752 | # Append the command to create the export file. |
---|
3753 | eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" |
---|
3754 | fi |
---|
3755 | |
---|
3756 | # Set up a command to remove the reloadale object files |
---|
3757 | # after they are used. |
---|
3758 | i=0 |
---|
3759 | while test "$i" -lt "$k" |
---|
3760 | do |
---|
3761 | i=`expr $i + 1` |
---|
3762 | delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" |
---|
3763 | done |
---|
3764 | |
---|
3765 | $echo "creating a temporary reloadable object file: $output" |
---|
3766 | |
---|
3767 | # Loop through the commands generated above and execute them. |
---|
3768 | save_ifs="$IFS"; IFS='~' |
---|
3769 | for cmd in $concat_cmds; do |
---|
3770 | IFS="$save_ifs" |
---|
3771 | $show "$cmd" |
---|
3772 | $run eval "$cmd" || exit $? |
---|
3773 | done |
---|
3774 | IFS="$save_ifs" |
---|
3775 | |
---|
3776 | libobjs=$output |
---|
3777 | # Restore the value of output. |
---|
3778 | output=$save_output |
---|
3779 | |
---|
3780 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then |
---|
3781 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
---|
3782 | fi |
---|
3783 | # Expand the library linking commands again to reset the |
---|
3784 | # value of $libobjs for piecewise linking. |
---|
3785 | |
---|
3786 | # Do each of the archive commands. |
---|
3787 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
---|
3788 | eval cmds=\"$archive_expsym_cmds\" |
---|
3789 | else |
---|
3790 | eval cmds=\"$archive_cmds\" |
---|
3791 | fi |
---|
3792 | |
---|
3793 | # Append the command to remove the reloadable object files |
---|
3794 | # to the just-reset $cmds. |
---|
3795 | eval cmds=\"\$cmds~$rm $delfiles\" |
---|
3796 | fi |
---|
3797 | save_ifs="$IFS"; IFS='~' |
---|
3798 | for cmd in $cmds; do |
---|
3799 | IFS="$save_ifs" |
---|
3800 | $show "$cmd" |
---|
3801 | $run eval "$cmd" || exit $? |
---|
3802 | done |
---|
3803 | IFS="$save_ifs" |
---|
3804 | |
---|
3805 | # Restore the uninstalled library and exit |
---|
3806 | if test "$mode" = relink; then |
---|
3807 | $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? |
---|
3808 | exit 0 |
---|
3809 | fi |
---|
3810 | |
---|
3811 | # Create links to the real library. |
---|
3812 | for linkname in $linknames; do |
---|
3813 | if test "$realname" != "$linkname"; then |
---|
3814 | $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" |
---|
3815 | $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? |
---|
3816 | fi |
---|
3817 | done |
---|
3818 | |
---|
3819 | # If -module or -export-dynamic was specified, set the dlname. |
---|
3820 | if test "$module" = yes || test "$export_dynamic" = yes; then |
---|
3821 | # On all known operating systems, these are identical. |
---|
3822 | dlname="$soname" |
---|
3823 | fi |
---|
3824 | fi |
---|
3825 | ;; |
---|
3826 | |
---|
3827 | obj) |
---|
3828 | if test -n "$deplibs"; then |
---|
3829 | $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 |
---|
3830 | fi |
---|
3831 | |
---|
3832 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
---|
3833 | $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 |
---|
3834 | fi |
---|
3835 | |
---|
3836 | if test -n "$rpath"; then |
---|
3837 | $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 |
---|
3838 | fi |
---|
3839 | |
---|
3840 | if test -n "$xrpath"; then |
---|
3841 | $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 |
---|
3842 | fi |
---|
3843 | |
---|
3844 | if test -n "$vinfo"; then |
---|
3845 | $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 |
---|
3846 | fi |
---|
3847 | |
---|
3848 | if test -n "$release"; then |
---|
3849 | $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 |
---|
3850 | fi |
---|
3851 | |
---|
3852 | case $output in |
---|
3853 | *.lo) |
---|
3854 | if test -n "$objs$old_deplibs"; then |
---|
3855 | $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 |
---|
3856 | exit 1 |
---|
3857 | fi |
---|
3858 | libobj="$output" |
---|
3859 | obj=`$echo "X$output" | $Xsed -e "$lo2o"` |
---|
3860 | ;; |
---|
3861 | *) |
---|
3862 | libobj= |
---|
3863 | obj="$output" |
---|
3864 | ;; |
---|
3865 | esac |
---|
3866 | |
---|
3867 | # Delete the old objects. |
---|
3868 | $run $rm $obj $libobj |
---|
3869 | |
---|
3870 | # Objects from convenience libraries. This assumes |
---|
3871 | # single-version convenience libraries. Whenever we create |
---|
3872 | # different ones for PIC/non-PIC, this we'll have to duplicate |
---|
3873 | # the extraction. |
---|
3874 | reload_conv_objs= |
---|
3875 | gentop= |
---|
3876 | # reload_cmds runs $LD directly, so let us get rid of |
---|
3877 | # -Wl from whole_archive_flag_spec |
---|
3878 | wl= |
---|
3879 | |
---|
3880 | if test -n "$convenience"; then |
---|
3881 | if test -n "$whole_archive_flag_spec"; then |
---|
3882 | eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" |
---|
3883 | else |
---|
3884 | gentop="$output_objdir/${obj}x" |
---|
3885 | $show "${rm}r $gentop" |
---|
3886 | $run ${rm}r "$gentop" |
---|
3887 | $show "$mkdir $gentop" |
---|
3888 | $run $mkdir "$gentop" |
---|
3889 | status=$? |
---|
3890 | if test "$status" -ne 0 && test ! -d "$gentop"; then |
---|
3891 | exit $status |
---|
3892 | fi |
---|
3893 | generated="$generated $gentop" |
---|
3894 | |
---|
3895 | for xlib in $convenience; do |
---|
3896 | # Extract the objects. |
---|
3897 | case $xlib in |
---|
3898 | [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; |
---|
3899 | *) xabs=`pwd`"/$xlib" ;; |
---|
3900 | esac |
---|
3901 | xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` |
---|
3902 | xdir="$gentop/$xlib" |
---|
3903 | |
---|
3904 | $show "${rm}r $xdir" |
---|
3905 | $run ${rm}r "$xdir" |
---|
3906 | $show "$mkdir $xdir" |
---|
3907 | $run $mkdir "$xdir" |
---|
3908 | status=$? |
---|
3909 | if test "$status" -ne 0 && test ! -d "$xdir"; then |
---|
3910 | exit $status |
---|
3911 | fi |
---|
3912 | # We will extract separately just the conflicting names and we will no |
---|
3913 | # longer touch any unique names. It is faster to leave these extract |
---|
3914 | # automatically by $AR in one run. |
---|
3915 | $show "(cd $xdir && $AR x $xabs)" |
---|
3916 | $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? |
---|
3917 | if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then |
---|
3918 | : |
---|
3919 | else |
---|
3920 | $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 |
---|
3921 | $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 |
---|
3922 | $AR t "$xabs" | sort | uniq -cd | while read -r count name |
---|
3923 | do |
---|
3924 | i=1 |
---|
3925 | while test "$i" -le "$count" |
---|
3926 | do |
---|
3927 | # Put our $i before any first dot (extension) |
---|
3928 | # Never overwrite any file |
---|
3929 | name_to="$name" |
---|
3930 | while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" |
---|
3931 | do |
---|
3932 | name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` |
---|
3933 | done |
---|
3934 | $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" |
---|
3935 | $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? |
---|
3936 | i=`expr $i + 1` |
---|
3937 | done |
---|
3938 | done |
---|
3939 | fi |
---|
3940 | |
---|
3941 | reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
---|
3942 | done |
---|
3943 | fi |
---|
3944 | fi |
---|
3945 | |
---|
3946 | # Create the old-style object. |
---|
3947 | 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 |
---|
3948 | |
---|
3949 | output="$obj" |
---|
3950 | eval cmds=\"$reload_cmds\" |
---|
3951 | save_ifs="$IFS"; IFS='~' |
---|
3952 | for cmd in $cmds; do |
---|
3953 | IFS="$save_ifs" |
---|
3954 | $show "$cmd" |
---|
3955 | $run eval "$cmd" || exit $? |
---|
3956 | done |
---|
3957 | IFS="$save_ifs" |
---|
3958 | |
---|
3959 | # Exit if we aren't doing a library object file. |
---|
3960 | if test -z "$libobj"; then |
---|
3961 | if test -n "$gentop"; then |
---|
3962 | $show "${rm}r $gentop" |
---|
3963 | $run ${rm}r $gentop |
---|
3964 | fi |
---|
3965 | |
---|
3966 | exit 0 |
---|
3967 | fi |
---|
3968 | |
---|
3969 | if test "$build_libtool_libs" != yes; then |
---|
3970 | if test -n "$gentop"; then |
---|
3971 | $show "${rm}r $gentop" |
---|
3972 | $run ${rm}r $gentop |
---|
3973 | fi |
---|
3974 | |
---|
3975 | # Create an invalid libtool object if no PIC, so that we don't |
---|
3976 | # accidentally link it into a program. |
---|
3977 | # $show "echo timestamp > $libobj" |
---|
3978 | # $run eval "echo timestamp > $libobj" || exit $? |
---|
3979 | exit 0 |
---|
3980 | fi |
---|
3981 | |
---|
3982 | if test -n "$pic_flag" || test "$pic_mode" != default; then |
---|
3983 | # Only do commands if we really have different PIC objects. |
---|
3984 | reload_objs="$libobjs $reload_conv_objs" |
---|
3985 | output="$libobj" |
---|
3986 | eval cmds=\"$reload_cmds\" |
---|
3987 | save_ifs="$IFS"; IFS='~' |
---|
3988 | for cmd in $cmds; do |
---|
3989 | IFS="$save_ifs" |
---|
3990 | $show "$cmd" |
---|
3991 | $run eval "$cmd" || exit $? |
---|
3992 | done |
---|
3993 | IFS="$save_ifs" |
---|
3994 | fi |
---|
3995 | |
---|
3996 | if test -n "$gentop"; then |
---|
3997 | $show "${rm}r $gentop" |
---|
3998 | $run ${rm}r $gentop |
---|
3999 | fi |
---|
4000 | |
---|
4001 | exit 0 |
---|
4002 | ;; |
---|
4003 | |
---|
4004 | prog) |
---|
4005 | case $host in |
---|
4006 | *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; |
---|
4007 | esac |
---|
4008 | if test -n "$vinfo"; then |
---|
4009 | $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 |
---|
4010 | fi |
---|
4011 | |
---|
4012 | if test -n "$release"; then |
---|
4013 | $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 |
---|
4014 | fi |
---|
4015 | |
---|
4016 | if test "$preload" = yes; then |
---|
4017 | if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && |
---|
4018 | test "$dlopen_self_static" = unknown; then |
---|
4019 | $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." |
---|
4020 | fi |
---|
4021 | fi |
---|
4022 | |
---|
4023 | case $host in |
---|
4024 | *-*-rhapsody* | *-*-darwin1.[012]) |
---|
4025 | # On Rhapsody replace the C library is the System framework |
---|
4026 | compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` |
---|
4027 | finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` |
---|
4028 | ;; |
---|
4029 | esac |
---|
4030 | |
---|
4031 | case $host in |
---|
4032 | *darwin*) |
---|
4033 | # Don't allow lazy linking, it breaks C++ global constructors |
---|
4034 | if test "$tagname" = CXX ; then |
---|
4035 | compile_command="$compile_command ${wl}-bind_at_load" |
---|
4036 | finalize_command="$finalize_command ${wl}-bind_at_load" |
---|
4037 | fi |
---|
4038 | ;; |
---|
4039 | esac |
---|
4040 | |
---|
4041 | compile_command="$compile_command $compile_deplibs" |
---|
4042 | finalize_command="$finalize_command $finalize_deplibs" |
---|
4043 | |
---|
4044 | if test -n "$rpath$xrpath"; then |
---|
4045 | # If the user specified any rpath flags, then add them. |
---|
4046 | for libdir in $rpath $xrpath; do |
---|
4047 | # This is the magic to use -rpath. |
---|
4048 | case "$finalize_rpath " in |
---|
4049 | *" $libdir "*) ;; |
---|
4050 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
---|
4051 | esac |
---|
4052 | done |
---|
4053 | fi |
---|
4054 | |
---|
4055 | # Now hardcode the library paths |
---|
4056 | rpath= |
---|
4057 | hardcode_libdirs= |
---|
4058 | for libdir in $compile_rpath $finalize_rpath; do |
---|
4059 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
4060 | if test -n "$hardcode_libdir_separator"; then |
---|
4061 | if test -z "$hardcode_libdirs"; then |
---|
4062 | hardcode_libdirs="$libdir" |
---|
4063 | else |
---|
4064 | # Just accumulate the unique libdirs. |
---|
4065 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
---|
4066 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
---|
4067 | ;; |
---|
4068 | *) |
---|
4069 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
---|
4070 | ;; |
---|
4071 | esac |
---|
4072 | fi |
---|
4073 | else |
---|
4074 | eval flag=\"$hardcode_libdir_flag_spec\" |
---|
4075 | rpath="$rpath $flag" |
---|
4076 | fi |
---|
4077 | elif test -n "$runpath_var"; then |
---|
4078 | case "$perm_rpath " in |
---|
4079 | *" $libdir "*) ;; |
---|
4080 | *) perm_rpath="$perm_rpath $libdir" ;; |
---|
4081 | esac |
---|
4082 | fi |
---|
4083 | case $host in |
---|
4084 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
---|
4085 | case :$dllsearchpath: in |
---|
4086 | *":$libdir:"*) ;; |
---|
4087 | *) dllsearchpath="$dllsearchpath:$libdir";; |
---|
4088 | esac |
---|
4089 | ;; |
---|
4090 | esac |
---|
4091 | done |
---|
4092 | # Substitute the hardcoded libdirs into the rpath. |
---|
4093 | if test -n "$hardcode_libdir_separator" && |
---|
4094 | test -n "$hardcode_libdirs"; then |
---|
4095 | libdir="$hardcode_libdirs" |
---|
4096 | eval rpath=\" $hardcode_libdir_flag_spec\" |
---|
4097 | fi |
---|
4098 | compile_rpath="$rpath" |
---|
4099 | |
---|
4100 | rpath= |
---|
4101 | hardcode_libdirs= |
---|
4102 | for libdir in $finalize_rpath; do |
---|
4103 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
4104 | if test -n "$hardcode_libdir_separator"; then |
---|
4105 | if test -z "$hardcode_libdirs"; then |
---|
4106 | hardcode_libdirs="$libdir" |
---|
4107 | else |
---|
4108 | # Just accumulate the unique libdirs. |
---|
4109 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
---|
4110 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
---|
4111 | ;; |
---|
4112 | *) |
---|
4113 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
---|
4114 | ;; |
---|
4115 | esac |
---|
4116 | fi |
---|
4117 | else |
---|
4118 | eval flag=\"$hardcode_libdir_flag_spec\" |
---|
4119 | rpath="$rpath $flag" |
---|
4120 | fi |
---|
4121 | elif test -n "$runpath_var"; then |
---|
4122 | case "$finalize_perm_rpath " in |
---|
4123 | *" $libdir "*) ;; |
---|
4124 | *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; |
---|
4125 | esac |
---|
4126 | fi |
---|
4127 | done |
---|
4128 | # Substitute the hardcoded libdirs into the rpath. |
---|
4129 | if test -n "$hardcode_libdir_separator" && |
---|
4130 | test -n "$hardcode_libdirs"; then |
---|
4131 | libdir="$hardcode_libdirs" |
---|
4132 | eval rpath=\" $hardcode_libdir_flag_spec\" |
---|
4133 | fi |
---|
4134 | finalize_rpath="$rpath" |
---|
4135 | |
---|
4136 | if test -n "$libobjs" && test "$build_old_libs" = yes; then |
---|
4137 | # Transform all the library objects into standard objects. |
---|
4138 | compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
---|
4139 | finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
---|
4140 | fi |
---|
4141 | |
---|
4142 | dlsyms= |
---|
4143 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
---|
4144 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
---|
4145 | dlsyms="${outputname}S.c" |
---|
4146 | else |
---|
4147 | $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 |
---|
4148 | fi |
---|
4149 | fi |
---|
4150 | |
---|
4151 | if test -n "$dlsyms"; then |
---|
4152 | case $dlsyms in |
---|
4153 | "") ;; |
---|
4154 | *.c) |
---|
4155 | # Discover the nlist of each of the dlfiles. |
---|
4156 | nlist="$output_objdir/${outputname}.nm" |
---|
4157 | |
---|
4158 | $show "$rm $nlist ${nlist}S ${nlist}T" |
---|
4159 | $run $rm "$nlist" "${nlist}S" "${nlist}T" |
---|
4160 | |
---|
4161 | # Parse the name list into a source file. |
---|
4162 | $show "creating $output_objdir/$dlsyms" |
---|
4163 | |
---|
4164 | test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ |
---|
4165 | /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ |
---|
4166 | /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ |
---|
4167 | |
---|
4168 | #ifdef __cplusplus |
---|
4169 | extern \"C\" { |
---|
4170 | #endif |
---|
4171 | |
---|
4172 | /* Prevent the only kind of declaration conflicts we can make. */ |
---|
4173 | #define lt_preloaded_symbols some_other_symbol |
---|
4174 | |
---|
4175 | /* External symbol declarations for the compiler. */\ |
---|
4176 | " |
---|
4177 | |
---|
4178 | if test "$dlself" = yes; then |
---|
4179 | $show "generating symbol list for \`$output'" |
---|
4180 | |
---|
4181 | test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" |
---|
4182 | |
---|
4183 | # Add our own program objects to the symbol list. |
---|
4184 | progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
---|
4185 | for arg in $progfiles; do |
---|
4186 | $show "extracting global C symbols from \`$arg'" |
---|
4187 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" |
---|
4188 | done |
---|
4189 | |
---|
4190 | if test -n "$exclude_expsyms"; then |
---|
4191 | $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
---|
4192 | $run eval '$mv "$nlist"T "$nlist"' |
---|
4193 | fi |
---|
4194 | |
---|
4195 | if test -n "$export_symbols_regex"; then |
---|
4196 | $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
---|
4197 | $run eval '$mv "$nlist"T "$nlist"' |
---|
4198 | fi |
---|
4199 | |
---|
4200 | # Prepare the list of exported symbols |
---|
4201 | if test -z "$export_symbols"; then |
---|
4202 | export_symbols="$output_objdir/$output.exp" |
---|
4203 | $run $rm $export_symbols |
---|
4204 | $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
---|
4205 | else |
---|
4206 | $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' |
---|
4207 | $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' |
---|
4208 | $run eval 'mv "$nlist"T "$nlist"' |
---|
4209 | fi |
---|
4210 | fi |
---|
4211 | |
---|
4212 | for arg in $dlprefiles; do |
---|
4213 | $show "extracting global C symbols from \`$arg'" |
---|
4214 | name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` |
---|
4215 | $run eval '$echo ": $name " >> "$nlist"' |
---|
4216 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" |
---|
4217 | done |
---|
4218 | |
---|
4219 | if test -z "$run"; then |
---|
4220 | # Make sure we have at least an empty file. |
---|
4221 | test -f "$nlist" || : > "$nlist" |
---|
4222 | |
---|
4223 | if test -n "$exclude_expsyms"; then |
---|
4224 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
---|
4225 | $mv "$nlist"T "$nlist" |
---|
4226 | fi |
---|
4227 | |
---|
4228 | # Try sorting and uniquifying the output. |
---|
4229 | if grep -v "^: " < "$nlist" | |
---|
4230 | if sort -k 3 </dev/null >/dev/null 2>&1; then |
---|
4231 | sort -k 3 |
---|
4232 | else |
---|
4233 | sort +2 |
---|
4234 | fi | |
---|
4235 | uniq > "$nlist"S; then |
---|
4236 | : |
---|
4237 | else |
---|
4238 | grep -v "^: " < "$nlist" > "$nlist"S |
---|
4239 | fi |
---|
4240 | |
---|
4241 | if test -f "$nlist"S; then |
---|
4242 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' |
---|
4243 | else |
---|
4244 | $echo '/* NONE */' >> "$output_objdir/$dlsyms" |
---|
4245 | fi |
---|
4246 | |
---|
4247 | $echo >> "$output_objdir/$dlsyms" "\ |
---|
4248 | |
---|
4249 | #undef lt_preloaded_symbols |
---|
4250 | |
---|
4251 | #if defined (__STDC__) && __STDC__ |
---|
4252 | # define lt_ptr void * |
---|
4253 | #else |
---|
4254 | # define lt_ptr char * |
---|
4255 | # define const |
---|
4256 | #endif |
---|
4257 | |
---|
4258 | /* The mapping between symbol names and symbols. */ |
---|
4259 | const struct { |
---|
4260 | const char *name; |
---|
4261 | lt_ptr address; |
---|
4262 | } |
---|
4263 | lt_preloaded_symbols[] = |
---|
4264 | {\ |
---|
4265 | " |
---|
4266 | |
---|
4267 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" |
---|
4268 | |
---|
4269 | $echo >> "$output_objdir/$dlsyms" "\ |
---|
4270 | {0, (lt_ptr) 0} |
---|
4271 | }; |
---|
4272 | |
---|
4273 | /* This works around a problem in FreeBSD linker */ |
---|
4274 | #ifdef FREEBSD_WORKAROUND |
---|
4275 | static const void *lt_preloaded_setup() { |
---|
4276 | return lt_preloaded_symbols; |
---|
4277 | } |
---|
4278 | #endif |
---|
4279 | |
---|
4280 | #ifdef __cplusplus |
---|
4281 | } |
---|
4282 | #endif\ |
---|
4283 | " |
---|
4284 | fi |
---|
4285 | |
---|
4286 | pic_flag_for_symtable= |
---|
4287 | case $host in |
---|
4288 | # compiling the symbol table file with pic_flag works around |
---|
4289 | # a FreeBSD bug that causes programs to crash when -lm is |
---|
4290 | # linked before any other PIC object. But we must not use |
---|
4291 | # pic_flag when linking with -static. The problem exists in |
---|
4292 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
---|
4293 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
---|
4294 | case "$compile_command " in |
---|
4295 | *" -static "*) ;; |
---|
4296 | *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; |
---|
4297 | esac;; |
---|
4298 | *-*-hpux*) |
---|
4299 | case "$compile_command " in |
---|
4300 | *" -static "*) ;; |
---|
4301 | *) pic_flag_for_symtable=" $pic_flag";; |
---|
4302 | esac |
---|
4303 | esac |
---|
4304 | |
---|
4305 | # Now compile the dynamic symbol file. |
---|
4306 | $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" |
---|
4307 | $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? |
---|
4308 | |
---|
4309 | # Clean up the generated files. |
---|
4310 | $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" |
---|
4311 | $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" |
---|
4312 | |
---|
4313 | # Transform the symbol file into the correct name. |
---|
4314 | compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
---|
4315 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
---|
4316 | ;; |
---|
4317 | *) |
---|
4318 | $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 |
---|
4319 | exit 1 |
---|
4320 | ;; |
---|
4321 | esac |
---|
4322 | else |
---|
4323 | # We keep going just in case the user didn't refer to |
---|
4324 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
---|
4325 | # really was required. |
---|
4326 | |
---|
4327 | # Nullify the symbol file. |
---|
4328 | compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` |
---|
4329 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` |
---|
4330 | fi |
---|
4331 | |
---|
4332 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then |
---|
4333 | # Replace the output file specification. |
---|
4334 | compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
---|
4335 | link_command="$compile_command$compile_rpath" |
---|
4336 | |
---|
4337 | # We have no uninstalled library dependencies, so finalize right now. |
---|
4338 | $show "$link_command" |
---|
4339 | $run eval "$link_command" |
---|
4340 | status=$? |
---|
4341 | |
---|
4342 | # Delete the generated files. |
---|
4343 | if test -n "$dlsyms"; then |
---|
4344 | $show "$rm $output_objdir/${outputname}S.${objext}" |
---|
4345 | $run $rm "$output_objdir/${outputname}S.${objext}" |
---|
4346 | fi |
---|
4347 | |
---|
4348 | exit $status |
---|
4349 | fi |
---|
4350 | |
---|
4351 | if test -n "$shlibpath_var"; then |
---|
4352 | # We should set the shlibpath_var |
---|
4353 | rpath= |
---|
4354 | for dir in $temp_rpath; do |
---|
4355 | case $dir in |
---|
4356 | [\\/]* | [A-Za-z]:[\\/]*) |
---|
4357 | # Absolute path. |
---|
4358 | rpath="$rpath$dir:" |
---|
4359 | ;; |
---|
4360 | *) |
---|
4361 | # Relative path: add a thisdir entry. |
---|
4362 | rpath="$rpath\$thisdir/$dir:" |
---|
4363 | ;; |
---|
4364 | esac |
---|
4365 | done |
---|
4366 | temp_rpath="$rpath" |
---|
4367 | fi |
---|
4368 | |
---|
4369 | if test -n "$compile_shlibpath$finalize_shlibpath"; then |
---|
4370 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" |
---|
4371 | fi |
---|
4372 | if test -n "$finalize_shlibpath"; then |
---|
4373 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
---|
4374 | fi |
---|
4375 | |
---|
4376 | compile_var= |
---|
4377 | finalize_var= |
---|
4378 | if test -n "$runpath_var"; then |
---|
4379 | if test -n "$perm_rpath"; then |
---|
4380 | # We should set the runpath_var. |
---|
4381 | rpath= |
---|
4382 | for dir in $perm_rpath; do |
---|
4383 | rpath="$rpath$dir:" |
---|
4384 | done |
---|
4385 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " |
---|
4386 | fi |
---|
4387 | if test -n "$finalize_perm_rpath"; then |
---|
4388 | # We should set the runpath_var. |
---|
4389 | rpath= |
---|
4390 | for dir in $finalize_perm_rpath; do |
---|
4391 | rpath="$rpath$dir:" |
---|
4392 | done |
---|
4393 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " |
---|
4394 | fi |
---|
4395 | fi |
---|
4396 | |
---|
4397 | if test "$no_install" = yes; then |
---|
4398 | # We don't need to create a wrapper script. |
---|
4399 | link_command="$compile_var$compile_command$compile_rpath" |
---|
4400 | # Replace the output file specification. |
---|
4401 | link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
---|
4402 | # Delete the old output file. |
---|
4403 | $run $rm $output |
---|
4404 | # Link the executable and exit |
---|
4405 | $show "$link_command" |
---|
4406 | $run eval "$link_command" || exit $? |
---|
4407 | exit 0 |
---|
4408 | fi |
---|
4409 | |
---|
4410 | if test "$hardcode_action" = relink; then |
---|
4411 | # Fast installation is not supported |
---|
4412 | link_command="$compile_var$compile_command$compile_rpath" |
---|
4413 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
---|
4414 | |
---|
4415 | $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 |
---|
4416 | $echo "$modename: \`$output' will be relinked during installation" 1>&2 |
---|
4417 | else |
---|
4418 | if test "$fast_install" != no; then |
---|
4419 | link_command="$finalize_var$compile_command$finalize_rpath" |
---|
4420 | if test "$fast_install" = yes; then |
---|
4421 | relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` |
---|
4422 | else |
---|
4423 | # fast_install is set to needless |
---|
4424 | relink_command= |
---|
4425 | fi |
---|
4426 | else |
---|
4427 | link_command="$compile_var$compile_command$compile_rpath" |
---|
4428 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
---|
4429 | fi |
---|
4430 | fi |
---|
4431 | |
---|
4432 | # Replace the output file specification. |
---|
4433 | link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` |
---|
4434 | |
---|
4435 | # Delete the old output files. |
---|
4436 | $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname |
---|
4437 | |
---|
4438 | $show "$link_command" |
---|
4439 | $run eval "$link_command" || exit $? |
---|
4440 | |
---|
4441 | # Now create the wrapper script. |
---|
4442 | $show "creating $output" |
---|
4443 | |
---|
4444 | # Quote the relink command for shipping. |
---|
4445 | if test -n "$relink_command"; then |
---|
4446 | # Preserve any variables that may affect compiler behavior |
---|
4447 | for var in $variables_saved_for_relink; do |
---|
4448 | if eval test -z \"\${$var+set}\"; then |
---|
4449 | relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" |
---|
4450 | elif eval var_value=\$$var; test -z "$var_value"; then |
---|
4451 | relink_command="$var=; export $var; $relink_command" |
---|
4452 | else |
---|
4453 | var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` |
---|
4454 | relink_command="$var=\"$var_value\"; export $var; $relink_command" |
---|
4455 | fi |
---|
4456 | done |
---|
4457 | relink_command="(cd `pwd`; $relink_command)" |
---|
4458 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
---|
4459 | fi |
---|
4460 | |
---|
4461 | # Quote $echo for shipping. |
---|
4462 | if test "X$echo" = "X$SHELL $0 --fallback-echo"; then |
---|
4463 | case $0 in |
---|
4464 | [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; |
---|
4465 | *) qecho="$SHELL `pwd`/$0 --fallback-echo";; |
---|
4466 | esac |
---|
4467 | qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` |
---|
4468 | else |
---|
4469 | qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` |
---|
4470 | fi |
---|
4471 | |
---|
4472 | # Only actually do things if our run command is non-null. |
---|
4473 | if test -z "$run"; then |
---|
4474 | # win32 will think the script is a binary if it has |
---|
4475 | # a .exe suffix, so we strip it off here. |
---|
4476 | case $output in |
---|
4477 | *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; |
---|
4478 | esac |
---|
4479 | # test for cygwin because mv fails w/o .exe extensions |
---|
4480 | case $host in |
---|
4481 | *cygwin*) |
---|
4482 | exeext=.exe |
---|
4483 | outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; |
---|
4484 | *) exeext= ;; |
---|
4485 | esac |
---|
4486 | case $host in |
---|
4487 | *cygwin* | *mingw* ) |
---|
4488 | cwrappersource=`$echo ${objdir}/lt-${output}.c` |
---|
4489 | cwrapper=`$echo ${output}.exe` |
---|
4490 | $rm $cwrappersource $cwrapper |
---|
4491 | trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 |
---|
4492 | |
---|
4493 | cat > $cwrappersource <<EOF |
---|
4494 | |
---|
4495 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
---|
4496 | Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
---|
4497 | |
---|
4498 | The $output program cannot be directly executed until all the libtool |
---|
4499 | libraries that it depends on are installed. |
---|
4500 | |
---|
4501 | This wrapper executable should never be moved out of the build directory. |
---|
4502 | If it is, it will not operate correctly. |
---|
4503 | |
---|
4504 | Currently, it simply execs the wrapper *script* "/bin/sh $output", |
---|
4505 | but could eventually absorb all of the scripts functionality and |
---|
4506 | exec $objdir/$outputname directly. |
---|
4507 | */ |
---|
4508 | EOF |
---|
4509 | cat >> $cwrappersource<<"EOF" |
---|
4510 | #include <stdio.h> |
---|
4511 | #include <stdlib.h> |
---|
4512 | #include <string.h> |
---|
4513 | #include <ctype.h> |
---|
4514 | #include <unistd.h> |
---|
4515 | #include <malloc.h> |
---|
4516 | #include <stdarg.h> |
---|
4517 | #include <assert.h> |
---|
4518 | |
---|
4519 | #if defined(PATH_MAX) |
---|
4520 | # define LT_PATHMAX PATH_MAX |
---|
4521 | #elif defined(MAXPATHLEN) |
---|
4522 | # define LT_PATHMAX MAXPATHLEN |
---|
4523 | #else |
---|
4524 | # define LT_PATHMAX 1024 |
---|
4525 | #endif |
---|
4526 | |
---|
4527 | #ifndef DIR_SEPARATOR |
---|
4528 | #define DIR_SEPARATOR '/' |
---|
4529 | #endif |
---|
4530 | |
---|
4531 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
---|
4532 | defined (__OS2__) |
---|
4533 | #define HAVE_DOS_BASED_FILE_SYSTEM |
---|
4534 | #ifndef DIR_SEPARATOR_2 |
---|
4535 | #define DIR_SEPARATOR_2 '\\' |
---|
4536 | #endif |
---|
4537 | #endif |
---|
4538 | |
---|
4539 | #ifndef DIR_SEPARATOR_2 |
---|
4540 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
---|
4541 | #else /* DIR_SEPARATOR_2 */ |
---|
4542 | # define IS_DIR_SEPARATOR(ch) \ |
---|
4543 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
---|
4544 | #endif /* DIR_SEPARATOR_2 */ |
---|
4545 | |
---|
4546 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
---|
4547 | #define XFREE(stale) do { \ |
---|
4548 | if (stale) { free ((void *) stale); stale = 0; } \ |
---|
4549 | } while (0) |
---|
4550 | |
---|
4551 | const char *program_name = NULL; |
---|
4552 | |
---|
4553 | void * xmalloc (size_t num); |
---|
4554 | char * xstrdup (const char *string); |
---|
4555 | char * basename (const char *name); |
---|
4556 | char * fnqualify(const char *path); |
---|
4557 | char * strendzap(char *str, const char *pat); |
---|
4558 | void lt_fatal (const char *message, ...); |
---|
4559 | |
---|
4560 | int |
---|
4561 | main (int argc, char *argv[]) |
---|
4562 | { |
---|
4563 | char **newargz; |
---|
4564 | int i; |
---|
4565 | |
---|
4566 | program_name = (char *) xstrdup ((char *) basename (argv[0])); |
---|
4567 | newargz = XMALLOC(char *, argc+2); |
---|
4568 | EOF |
---|
4569 | |
---|
4570 | cat >> $cwrappersource <<EOF |
---|
4571 | newargz[0] = "$SHELL"; |
---|
4572 | EOF |
---|
4573 | |
---|
4574 | cat >> $cwrappersource <<"EOF" |
---|
4575 | newargz[1] = fnqualify(argv[0]); |
---|
4576 | /* we know the script has the same name, without the .exe */ |
---|
4577 | /* so make sure newargz[1] doesn't end in .exe */ |
---|
4578 | strendzap(newargz[1],".exe"); |
---|
4579 | for (i = 1; i < argc; i++) |
---|
4580 | newargz[i+1] = xstrdup(argv[i]); |
---|
4581 | newargz[argc+1] = NULL; |
---|
4582 | EOF |
---|
4583 | |
---|
4584 | cat >> $cwrappersource <<EOF |
---|
4585 | execv("$SHELL",newargz); |
---|
4586 | EOF |
---|
4587 | |
---|
4588 | cat >> $cwrappersource <<"EOF" |
---|
4589 | return 127; |
---|
4590 | } |
---|
4591 | |
---|
4592 | void * |
---|
4593 | xmalloc (size_t num) |
---|
4594 | { |
---|
4595 | void * p = (void *) malloc (num); |
---|
4596 | if (!p) |
---|
4597 | lt_fatal ("Memory exhausted"); |
---|
4598 | |
---|
4599 | return p; |
---|
4600 | } |
---|
4601 | |
---|
4602 | char * |
---|
4603 | xstrdup (const char *string) |
---|
4604 | { |
---|
4605 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL |
---|
4606 | ; |
---|
4607 | } |
---|
4608 | |
---|
4609 | char * |
---|
4610 | basename (const char *name) |
---|
4611 | { |
---|
4612 | const char *base; |
---|
4613 | |
---|
4614 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
---|
4615 | /* Skip over the disk name in MSDOS pathnames. */ |
---|
4616 | if (isalpha (name[0]) && name[1] == ':') |
---|
4617 | name += 2; |
---|
4618 | #endif |
---|
4619 | |
---|
4620 | for (base = name; *name; name++) |
---|
4621 | if (IS_DIR_SEPARATOR (*name)) |
---|
4622 | base = name + 1; |
---|
4623 | return (char *) base; |
---|
4624 | } |
---|
4625 | |
---|
4626 | char * |
---|
4627 | fnqualify(const char *path) |
---|
4628 | { |
---|
4629 | size_t size; |
---|
4630 | char *p; |
---|
4631 | char tmp[LT_PATHMAX + 1]; |
---|
4632 | |
---|
4633 | assert(path != NULL); |
---|
4634 | |
---|
4635 | /* Is it qualified already? */ |
---|
4636 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
---|
4637 | if (isalpha (path[0]) && path[1] == ':') |
---|
4638 | return xstrdup (path); |
---|
4639 | #endif |
---|
4640 | if (IS_DIR_SEPARATOR (path[0])) |
---|
4641 | return xstrdup (path); |
---|
4642 | |
---|
4643 | /* prepend the current directory */ |
---|
4644 | /* doesn't handle '~' */ |
---|
4645 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
---|
4646 | lt_fatal ("getcwd failed"); |
---|
4647 | size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ |
---|
4648 | p = XMALLOC(char, size); |
---|
4649 | sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); |
---|
4650 | return p; |
---|
4651 | } |
---|
4652 | |
---|
4653 | char * |
---|
4654 | strendzap(char *str, const char *pat) |
---|
4655 | { |
---|
4656 | size_t len, patlen; |
---|
4657 | |
---|
4658 | assert(str != NULL); |
---|
4659 | assert(pat != NULL); |
---|
4660 | |
---|
4661 | len = strlen(str); |
---|
4662 | patlen = strlen(pat); |
---|
4663 | |
---|
4664 | if (patlen <= len) |
---|
4665 | { |
---|
4666 | str += len - patlen; |
---|
4667 | if (strcmp(str, pat) == 0) |
---|
4668 | *str = '\0'; |
---|
4669 | } |
---|
4670 | return str; |
---|
4671 | } |
---|
4672 | |
---|
4673 | static void |
---|
4674 | lt_error_core (int exit_status, const char * mode, |
---|
4675 | const char * message, va_list ap) |
---|
4676 | { |
---|
4677 | fprintf (stderr, "%s: %s: ", program_name, mode); |
---|
4678 | vfprintf (stderr, message, ap); |
---|
4679 | fprintf (stderr, ".\n"); |
---|
4680 | |
---|
4681 | if (exit_status >= 0) |
---|
4682 | exit (exit_status); |
---|
4683 | } |
---|
4684 | |
---|
4685 | void |
---|
4686 | lt_fatal (const char *message, ...) |
---|
4687 | { |
---|
4688 | va_list ap; |
---|
4689 | va_start (ap, message); |
---|
4690 | lt_error_core (EXIT_FAILURE, "FATAL", message, ap); |
---|
4691 | va_end (ap); |
---|
4692 | } |
---|
4693 | EOF |
---|
4694 | # we should really use a build-platform specific compiler |
---|
4695 | # here, but OTOH, the wrappers (shell script and this C one) |
---|
4696 | # are only useful if you want to execute the "real" binary. |
---|
4697 | # Since the "real" binary is built for $host, then this |
---|
4698 | # wrapper might as well be built for $host, too. |
---|
4699 | $run $LTCC -s -o $cwrapper $cwrappersource |
---|
4700 | ;; |
---|
4701 | esac |
---|
4702 | $rm $output |
---|
4703 | trap "$rm $output; exit 1" 1 2 15 |
---|
4704 | |
---|
4705 | $echo > $output "\ |
---|
4706 | #! $SHELL |
---|
4707 | |
---|
4708 | # $output - temporary wrapper script for $objdir/$outputname |
---|
4709 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
---|
4710 | # |
---|
4711 | # The $output program cannot be directly executed until all the libtool |
---|
4712 | # libraries that it depends on are installed. |
---|
4713 | # |
---|
4714 | # This wrapper script should never be moved out of the build directory. |
---|
4715 | # If it is, it will not operate correctly. |
---|
4716 | |
---|
4717 | # Sed substitution that helps us do robust quoting. It backslashifies |
---|
4718 | # metacharacters that are still active within double-quoted strings. |
---|
4719 | Xsed='${SED} -e 1s/^X//' |
---|
4720 | sed_quote_subst='$sed_quote_subst' |
---|
4721 | |
---|
4722 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
---|
4723 | # if CDPATH is set. |
---|
4724 | if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi |
---|
4725 | |
---|
4726 | relink_command=\"$relink_command\" |
---|
4727 | |
---|
4728 | # This environment variable determines our operation mode. |
---|
4729 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
---|
4730 | # install mode needs the following variable: |
---|
4731 | notinst_deplibs='$notinst_deplibs' |
---|
4732 | else |
---|
4733 | # When we are sourced in execute mode, \$file and \$echo are already set. |
---|
4734 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
---|
4735 | echo=\"$qecho\" |
---|
4736 | file=\"\$0\" |
---|
4737 | # Make sure echo works. |
---|
4738 | if test \"X\$1\" = X--no-reexec; then |
---|
4739 | # Discard the --no-reexec flag, and continue. |
---|
4740 | shift |
---|
4741 | elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then |
---|
4742 | # Yippee, \$echo works! |
---|
4743 | : |
---|
4744 | else |
---|
4745 | # Restart under the correct shell, and then maybe \$echo will work. |
---|
4746 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} |
---|
4747 | fi |
---|
4748 | fi\ |
---|
4749 | " |
---|
4750 | $echo >> $output "\ |
---|
4751 | |
---|
4752 | # Find the directory that this script lives in. |
---|
4753 | thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` |
---|
4754 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
---|
4755 | |
---|
4756 | # Follow symbolic links until we get to the real thisdir. |
---|
4757 | file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` |
---|
4758 | while test -n \"\$file\"; do |
---|
4759 | destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` |
---|
4760 | |
---|
4761 | # If there was a directory component, then change thisdir. |
---|
4762 | if test \"x\$destdir\" != \"x\$file\"; then |
---|
4763 | case \"\$destdir\" in |
---|
4764 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
---|
4765 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
---|
4766 | esac |
---|
4767 | fi |
---|
4768 | |
---|
4769 | file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` |
---|
4770 | file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` |
---|
4771 | done |
---|
4772 | |
---|
4773 | # Try to get the absolute directory name. |
---|
4774 | absdir=\`cd \"\$thisdir\" && pwd\` |
---|
4775 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
---|
4776 | " |
---|
4777 | |
---|
4778 | if test "$fast_install" = yes; then |
---|
4779 | $echo >> $output "\ |
---|
4780 | program=lt-'$outputname'$exeext |
---|
4781 | progdir=\"\$thisdir/$objdir\" |
---|
4782 | |
---|
4783 | if test ! -f \"\$progdir/\$program\" || \\ |
---|
4784 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
---|
4785 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
---|
4786 | |
---|
4787 | file=\"\$\$-\$program\" |
---|
4788 | |
---|
4789 | if test ! -d \"\$progdir\"; then |
---|
4790 | $mkdir \"\$progdir\" |
---|
4791 | else |
---|
4792 | $rm \"\$progdir/\$file\" |
---|
4793 | fi" |
---|
4794 | |
---|
4795 | $echo >> $output "\ |
---|
4796 | |
---|
4797 | # relink executable if necessary |
---|
4798 | if test -n \"\$relink_command\"; then |
---|
4799 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
---|
4800 | else |
---|
4801 | $echo \"\$relink_command_output\" >&2 |
---|
4802 | $rm \"\$progdir/\$file\" |
---|
4803 | exit 1 |
---|
4804 | fi |
---|
4805 | fi |
---|
4806 | |
---|
4807 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
---|
4808 | { $rm \"\$progdir/\$program\"; |
---|
4809 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
---|
4810 | $rm \"\$progdir/\$file\" |
---|
4811 | fi" |
---|
4812 | else |
---|
4813 | $echo >> $output "\ |
---|
4814 | program='$outputname' |
---|
4815 | progdir=\"\$thisdir/$objdir\" |
---|
4816 | " |
---|
4817 | fi |
---|
4818 | |
---|
4819 | $echo >> $output "\ |
---|
4820 | |
---|
4821 | if test -f \"\$progdir/\$program\"; then" |
---|
4822 | |
---|
4823 | # Export our shlibpath_var if we have one. |
---|
4824 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
---|
4825 | $echo >> $output "\ |
---|
4826 | # Add our own library path to $shlibpath_var |
---|
4827 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
---|
4828 | |
---|
4829 | # Some systems cannot cope with colon-terminated $shlibpath_var |
---|
4830 | # The second colon is a workaround for a bug in BeOS R4 sed |
---|
4831 | $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` |
---|
4832 | |
---|
4833 | export $shlibpath_var |
---|
4834 | " |
---|
4835 | fi |
---|
4836 | |
---|
4837 | # fixup the dll searchpath if we need to. |
---|
4838 | if test -n "$dllsearchpath"; then |
---|
4839 | $echo >> $output "\ |
---|
4840 | # Add the dll search path components to the executable PATH |
---|
4841 | PATH=$dllsearchpath:\$PATH |
---|
4842 | " |
---|
4843 | fi |
---|
4844 | |
---|
4845 | $echo >> $output "\ |
---|
4846 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
---|
4847 | # Run the actual program with our arguments. |
---|
4848 | " |
---|
4849 | case $host in |
---|
4850 | # Backslashes separate directories on plain windows |
---|
4851 | *-*-mingw | *-*-os2*) |
---|
4852 | $echo >> $output "\ |
---|
4853 | exec \$progdir\\\\\$program \${1+\"\$@\"} |
---|
4854 | " |
---|
4855 | ;; |
---|
4856 | |
---|
4857 | *) |
---|
4858 | $echo >> $output "\ |
---|
4859 | exec \$progdir/\$program \${1+\"\$@\"} |
---|
4860 | " |
---|
4861 | ;; |
---|
4862 | esac |
---|
4863 | $echo >> $output "\ |
---|
4864 | \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" |
---|
4865 | exit 1 |
---|
4866 | fi |
---|
4867 | else |
---|
4868 | # The program doesn't exist. |
---|
4869 | \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 |
---|
4870 | \$echo \"This script is just a wrapper for \$program.\" 1>&2 |
---|
4871 | $echo \"See the $PACKAGE documentation for more information.\" 1>&2 |
---|
4872 | exit 1 |
---|
4873 | fi |
---|
4874 | fi\ |
---|
4875 | " |
---|
4876 | chmod +x $output |
---|
4877 | fi |
---|
4878 | exit 0 |
---|
4879 | ;; |
---|
4880 | esac |
---|
4881 | |
---|
4882 | # See if we need to build an old-fashioned archive. |
---|
4883 | for oldlib in $oldlibs; do |
---|
4884 | |
---|
4885 | if test "$build_libtool_libs" = convenience; then |
---|
4886 | oldobjs="$libobjs_save" |
---|
4887 | addlibs="$convenience" |
---|
4888 | build_libtool_libs=no |
---|
4889 | else |
---|
4890 | if test "$build_libtool_libs" = module; then |
---|
4891 | oldobjs="$libobjs_save" |
---|
4892 | build_libtool_libs=no |
---|
4893 | else |
---|
4894 | oldobjs="$old_deplibs $non_pic_objects" |
---|
4895 | fi |
---|
4896 | addlibs="$old_convenience" |
---|
4897 | fi |
---|
4898 | |
---|
4899 | if test -n "$addlibs"; then |
---|
4900 | gentop="$output_objdir/${outputname}x" |
---|
4901 | $show "${rm}r $gentop" |
---|
4902 | $run ${rm}r "$gentop" |
---|
4903 | $show "$mkdir $gentop" |
---|
4904 | $run $mkdir "$gentop" |
---|
4905 | status=$? |
---|
4906 | if test "$status" -ne 0 && test ! -d "$gentop"; then |
---|
4907 | exit $status |
---|
4908 | fi |
---|
4909 | generated="$generated $gentop" |
---|
4910 | |
---|
4911 | # Add in members from convenience archives. |
---|
4912 | for xlib in $addlibs; do |
---|
4913 | # Extract the objects. |
---|
4914 | case $xlib in |
---|
4915 | [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; |
---|
4916 | *) xabs=`pwd`"/$xlib" ;; |
---|
4917 | esac |
---|
4918 | xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` |
---|
4919 | xdir="$gentop/$xlib" |
---|
4920 | |
---|
4921 | $show "${rm}r $xdir" |
---|
4922 | $run ${rm}r "$xdir" |
---|
4923 | $show "$mkdir $xdir" |
---|
4924 | $run $mkdir "$xdir" |
---|
4925 | status=$? |
---|
4926 | if test "$status" -ne 0 && test ! -d "$xdir"; then |
---|
4927 | exit $status |
---|
4928 | fi |
---|
4929 | # We will extract separately just the conflicting names and we will no |
---|
4930 | # longer touch any unique names. It is faster to leave these extract |
---|
4931 | # automatically by $AR in one run. |
---|
4932 | $show "(cd $xdir && $AR x $xabs)" |
---|
4933 | $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? |
---|
4934 | if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then |
---|
4935 | : |
---|
4936 | else |
---|
4937 | $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 |
---|
4938 | $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 |
---|
4939 | $AR t "$xabs" | sort | uniq -cd | while read -r count name |
---|
4940 | do |
---|
4941 | i=1 |
---|
4942 | while test "$i" -le "$count" |
---|
4943 | do |
---|
4944 | # Put our $i before any first dot (extension) |
---|
4945 | # Never overwrite any file |
---|
4946 | name_to="$name" |
---|
4947 | while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" |
---|
4948 | do |
---|
4949 | name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` |
---|
4950 | done |
---|
4951 | $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" |
---|
4952 | $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? |
---|
4953 | i=`expr $i + 1` |
---|
4954 | done |
---|
4955 | done |
---|
4956 | fi |
---|
4957 | |
---|
4958 | oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` |
---|
4959 | done |
---|
4960 | fi |
---|
4961 | |
---|
4962 | # Do each command in the archive commands. |
---|
4963 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
---|
4964 | eval cmds=\"$old_archive_from_new_cmds\" |
---|
4965 | else |
---|
4966 | eval cmds=\"$old_archive_cmds\" |
---|
4967 | |
---|
4968 | if len=`expr "X$cmds" : ".*"` && |
---|
4969 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
---|
4970 | : |
---|
4971 | else |
---|
4972 | # the command line is too long to link in one step, link in parts |
---|
4973 | $echo "using piecewise archive linking..." |
---|
4974 | save_RANLIB=$RANLIB |
---|
4975 | RANLIB=: |
---|
4976 | objlist= |
---|
4977 | concat_cmds= |
---|
4978 | save_oldobjs=$oldobjs |
---|
4979 | # GNU ar 2.10+ was changed to match POSIX; thus no paths are |
---|
4980 | # encoded into archives. This makes 'ar r' malfunction in |
---|
4981 | # this piecewise linking case whenever conflicting object |
---|
4982 | # names appear in distinct ar calls; check, warn and compensate. |
---|
4983 | if (for obj in $save_oldobjs |
---|
4984 | do |
---|
4985 | $echo "X$obj" | $Xsed -e 's%^.*/%%' |
---|
4986 | done | sort | sort -uc >/dev/null 2>&1); then |
---|
4987 | : |
---|
4988 | else |
---|
4989 | $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 |
---|
4990 | $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 |
---|
4991 | AR_FLAGS=cq |
---|
4992 | fi |
---|
4993 | # Is there a better way of finding the last object in the list? |
---|
4994 | for obj in $save_oldobjs |
---|
4995 | do |
---|
4996 | last_oldobj=$obj |
---|
4997 | done |
---|
4998 | for obj in $save_oldobjs |
---|
4999 | do |
---|
5000 | oldobjs="$objlist $obj" |
---|
5001 | objlist="$objlist $obj" |
---|
5002 | eval test_cmds=\"$old_archive_cmds\" |
---|
5003 | if len=`expr "X$test_cmds" : ".*"` && |
---|
5004 | test "$len" -le "$max_cmd_len"; then |
---|
5005 | : |
---|
5006 | else |
---|
5007 | # the above command should be used before it gets too long |
---|
5008 | oldobjs=$objlist |
---|
5009 | if test "$obj" = "$last_oldobj" ; then |
---|
5010 | RANLIB=$save_RANLIB |
---|
5011 | fi |
---|
5012 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
---|
5013 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" |
---|
5014 | objlist= |
---|
5015 | fi |
---|
5016 | done |
---|
5017 | RANLIB=$save_RANLIB |
---|
5018 | oldobjs=$objlist |
---|
5019 | if test "X$oldobjs" = "X" ; then |
---|
5020 | eval cmds=\"\$concat_cmds\" |
---|
5021 | else |
---|
5022 | eval cmds=\"\$concat_cmds~$old_archive_cmds\" |
---|
5023 | fi |
---|
5024 | fi |
---|
5025 | fi |
---|
5026 | save_ifs="$IFS"; IFS='~' |
---|
5027 | for cmd in $cmds; do |
---|
5028 | IFS="$save_ifs" |
---|
5029 | $show "$cmd" |
---|
5030 | $run eval "$cmd" || exit $? |
---|
5031 | done |
---|
5032 | IFS="$save_ifs" |
---|
5033 | done |
---|
5034 | |
---|
5035 | if test -n "$generated"; then |
---|
5036 | $show "${rm}r$generated" |
---|
5037 | $run ${rm}r$generated |
---|
5038 | fi |
---|
5039 | |
---|
5040 | # Now create the libtool archive. |
---|
5041 | case $output in |
---|
5042 | *.la) |
---|
5043 | old_library= |
---|
5044 | test "$build_old_libs" = yes && old_library="$libname.$libext" |
---|
5045 | $show "creating $output" |
---|
5046 | |
---|
5047 | # Preserve any variables that may affect compiler behavior |
---|
5048 | for var in $variables_saved_for_relink; do |
---|
5049 | if eval test -z \"\${$var+set}\"; then |
---|
5050 | relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" |
---|
5051 | elif eval var_value=\$$var; test -z "$var_value"; then |
---|
5052 | relink_command="$var=; export $var; $relink_command" |
---|
5053 | else |
---|
5054 | var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` |
---|
5055 | relink_command="$var=\"$var_value\"; export $var; $relink_command" |
---|
5056 | fi |
---|
5057 | done |
---|
5058 | # Quote the link command for shipping. |
---|
5059 | relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" |
---|
5060 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
---|
5061 | |
---|
5062 | # Only create the output if not a dry run. |
---|
5063 | if test -z "$run"; then |
---|
5064 | for installed in no yes; do |
---|
5065 | if test "$installed" = yes; then |
---|
5066 | if test -z "$install_libdir"; then |
---|
5067 | break |
---|
5068 | fi |
---|
5069 | output="$output_objdir/$outputname"i |
---|
5070 | # Replace all uninstalled libtool libraries with the installed ones |
---|
5071 | newdependency_libs= |
---|
5072 | for deplib in $dependency_libs; do |
---|
5073 | case $deplib in |
---|
5074 | *.la) |
---|
5075 | name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` |
---|
5076 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
---|
5077 | if test -z "$libdir"; then |
---|
5078 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
---|
5079 | exit 1 |
---|
5080 | fi |
---|
5081 | newdependency_libs="$newdependency_libs $libdir/$name" |
---|
5082 | ;; |
---|
5083 | *) newdependency_libs="$newdependency_libs $deplib" ;; |
---|
5084 | esac |
---|
5085 | done |
---|
5086 | dependency_libs="$newdependency_libs" |
---|
5087 | newdlfiles= |
---|
5088 | for lib in $dlfiles; do |
---|
5089 | name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
---|
5090 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
---|
5091 | if test -z "$libdir"; then |
---|
5092 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
---|
5093 | exit 1 |
---|
5094 | fi |
---|
5095 | newdlfiles="$newdlfiles $libdir/$name" |
---|
5096 | done |
---|
5097 | dlfiles="$newdlfiles" |
---|
5098 | newdlprefiles= |
---|
5099 | for lib in $dlprefiles; do |
---|
5100 | name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
---|
5101 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
---|
5102 | if test -z "$libdir"; then |
---|
5103 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
---|
5104 | exit 1 |
---|
5105 | fi |
---|
5106 | newdlprefiles="$newdlprefiles $libdir/$name" |
---|
5107 | done |
---|
5108 | dlprefiles="$newdlprefiles" |
---|
5109 | fi |
---|
5110 | $rm $output |
---|
5111 | # place dlname in correct position for cygwin |
---|
5112 | tdlname=$dlname |
---|
5113 | case $host,$output,$installed,$module,$dlname in |
---|
5114 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; |
---|
5115 | esac |
---|
5116 | $echo > $output "\ |
---|
5117 | # $outputname - a libtool library file |
---|
5118 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
---|
5119 | # |
---|
5120 | # Please DO NOT delete this file! |
---|
5121 | # It is necessary for linking the library. |
---|
5122 | |
---|
5123 | # The name that we can dlopen(3). |
---|
5124 | dlname='$tdlname' |
---|
5125 | |
---|
5126 | # Names of this library. |
---|
5127 | library_names='$library_names' |
---|
5128 | |
---|
5129 | # The name of the static archive. |
---|
5130 | old_library='$old_library' |
---|
5131 | |
---|
5132 | # Libraries that this one depends upon. |
---|
5133 | dependency_libs='$dependency_libs' |
---|
5134 | |
---|
5135 | # Version information for $libname. |
---|
5136 | current=$current |
---|
5137 | age=$age |
---|
5138 | revision=$revision |
---|
5139 | |
---|
5140 | # Is this an already installed library? |
---|
5141 | installed=$installed |
---|
5142 | |
---|
5143 | # Should we warn about portability when linking against -modules? |
---|
5144 | shouldnotlink=$module |
---|
5145 | |
---|
5146 | # Files to dlopen/dlpreopen |
---|
5147 | dlopen='$dlfiles' |
---|
5148 | dlpreopen='$dlprefiles' |
---|
5149 | |
---|
5150 | # Directory that this library needs to be installed in: |
---|
5151 | libdir='$install_libdir'" |
---|
5152 | if test "$installed" = no && test "$need_relink" = yes; then |
---|
5153 | $echo >> $output "\ |
---|
5154 | relink_command=\"$relink_command\"" |
---|
5155 | fi |
---|
5156 | done |
---|
5157 | fi |
---|
5158 | |
---|
5159 | # Do a symbolic link so that the libtool archive can be found in |
---|
5160 | # LD_LIBRARY_PATH before the program is installed. |
---|
5161 | $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" |
---|
5162 | $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? |
---|
5163 | ;; |
---|
5164 | esac |
---|
5165 | exit 0 |
---|
5166 | ;; |
---|
5167 | |
---|
5168 | # libtool install mode |
---|
5169 | install) |
---|
5170 | modename="$modename: install" |
---|
5171 | |
---|
5172 | # There may be an optional sh(1) argument at the beginning of |
---|
5173 | # install_prog (especially on Windows NT). |
---|
5174 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
---|
5175 | # Allow the use of GNU shtool's install command. |
---|
5176 | $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then |
---|
5177 | # Aesthetically quote it. |
---|
5178 | arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` |
---|
5179 | case $arg in |
---|
5180 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
---|
5181 | arg="\"$arg\"" |
---|
5182 | ;; |
---|
5183 | esac |
---|
5184 | install_prog="$arg " |
---|
5185 | arg="$1" |
---|
5186 | shift |
---|
5187 | else |
---|
5188 | install_prog= |
---|
5189 | arg="$nonopt" |
---|
5190 | fi |
---|
5191 | |
---|
5192 | # The real first argument should be the name of the installation program. |
---|
5193 | # Aesthetically quote it. |
---|
5194 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
5195 | case $arg in |
---|
5196 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
---|
5197 | arg="\"$arg\"" |
---|
5198 | ;; |
---|
5199 | esac |
---|
5200 | install_prog="$install_prog$arg" |
---|
5201 | |
---|
5202 | # We need to accept at least all the BSD install flags. |
---|
5203 | dest= |
---|
5204 | files= |
---|
5205 | opts= |
---|
5206 | prev= |
---|
5207 | install_type= |
---|
5208 | isdir=no |
---|
5209 | stripme= |
---|
5210 | for arg |
---|
5211 | do |
---|
5212 | if test -n "$dest"; then |
---|
5213 | files="$files $dest" |
---|
5214 | dest="$arg" |
---|
5215 | continue |
---|
5216 | fi |
---|
5217 | |
---|
5218 | case $arg in |
---|
5219 | -d) isdir=yes ;; |
---|
5220 | -f) prev="-f" ;; |
---|
5221 | -g) prev="-g" ;; |
---|
5222 | -m) prev="-m" ;; |
---|
5223 | -o) prev="-o" ;; |
---|
5224 | -s) |
---|
5225 | stripme=" -s" |
---|
5226 | continue |
---|
5227 | ;; |
---|
5228 | -*) ;; |
---|
5229 | |
---|
5230 | *) |
---|
5231 | # If the previous option needed an argument, then skip it. |
---|
5232 | if test -n "$prev"; then |
---|
5233 | prev= |
---|
5234 | else |
---|
5235 | dest="$arg" |
---|
5236 | continue |
---|
5237 | fi |
---|
5238 | ;; |
---|
5239 | esac |
---|
5240 | |
---|
5241 | # Aesthetically quote the argument. |
---|
5242 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
5243 | case $arg in |
---|
5244 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
---|
5245 | arg="\"$arg\"" |
---|
5246 | ;; |
---|
5247 | esac |
---|
5248 | install_prog="$install_prog $arg" |
---|
5249 | done |
---|
5250 | |
---|
5251 | if test -z "$install_prog"; then |
---|
5252 | $echo "$modename: you must specify an install program" 1>&2 |
---|
5253 | $echo "$help" 1>&2 |
---|
5254 | exit 1 |
---|
5255 | fi |
---|
5256 | |
---|
5257 | if test -n "$prev"; then |
---|
5258 | $echo "$modename: the \`$prev' option requires an argument" 1>&2 |
---|
5259 | $echo "$help" 1>&2 |
---|
5260 | exit 1 |
---|
5261 | fi |
---|
5262 | |
---|
5263 | if test -z "$files"; then |
---|
5264 | if test -z "$dest"; then |
---|
5265 | $echo "$modename: no file or destination specified" 1>&2 |
---|
5266 | else |
---|
5267 | $echo "$modename: you must specify a destination" 1>&2 |
---|
5268 | fi |
---|
5269 | $echo "$help" 1>&2 |
---|
5270 | exit 1 |
---|
5271 | fi |
---|
5272 | |
---|
5273 | # Strip any trailing slash from the destination. |
---|
5274 | dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` |
---|
5275 | |
---|
5276 | # Check to see that the destination is a directory. |
---|
5277 | test -d "$dest" && isdir=yes |
---|
5278 | if test "$isdir" = yes; then |
---|
5279 | destdir="$dest" |
---|
5280 | destname= |
---|
5281 | else |
---|
5282 | destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` |
---|
5283 | test "X$destdir" = "X$dest" && destdir=. |
---|
5284 | destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` |
---|
5285 | |
---|
5286 | # Not a directory, so check to see that there is only one file specified. |
---|
5287 | set dummy $files |
---|
5288 | if test "$#" -gt 2; then |
---|
5289 | $echo "$modename: \`$dest' is not a directory" 1>&2 |
---|
5290 | $echo "$help" 1>&2 |
---|
5291 | exit 1 |
---|
5292 | fi |
---|
5293 | fi |
---|
5294 | case $destdir in |
---|
5295 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
---|
5296 | *) |
---|
5297 | for file in $files; do |
---|
5298 | case $file in |
---|
5299 | *.lo) ;; |
---|
5300 | *) |
---|
5301 | $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 |
---|
5302 | $echo "$help" 1>&2 |
---|
5303 | exit 1 |
---|
5304 | ;; |
---|
5305 | esac |
---|
5306 | done |
---|
5307 | ;; |
---|
5308 | esac |
---|
5309 | |
---|
5310 | # This variable tells wrapper scripts just to set variables rather |
---|
5311 | # than running their programs. |
---|
5312 | libtool_install_magic="$magic" |
---|
5313 | |
---|
5314 | staticlibs= |
---|
5315 | future_libdirs= |
---|
5316 | current_libdirs= |
---|
5317 | for file in $files; do |
---|
5318 | |
---|
5319 | # Do each installation. |
---|
5320 | case $file in |
---|
5321 | *.$libext) |
---|
5322 | # Do the static libraries later. |
---|
5323 | staticlibs="$staticlibs $file" |
---|
5324 | ;; |
---|
5325 | |
---|
5326 | *.la) |
---|
5327 | # Check to see that this really is a libtool archive. |
---|
5328 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
---|
5329 | else |
---|
5330 | $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 |
---|
5331 | $echo "$help" 1>&2 |
---|
5332 | exit 1 |
---|
5333 | fi |
---|
5334 | |
---|
5335 | library_names= |
---|
5336 | old_library= |
---|
5337 | relink_command= |
---|
5338 | # If there is no directory component, then add one. |
---|
5339 | case $file in |
---|
5340 | */* | *\\*) . $file ;; |
---|
5341 | *) . ./$file ;; |
---|
5342 | esac |
---|
5343 | |
---|
5344 | # Add the libdir to current_libdirs if it is the destination. |
---|
5345 | if test "X$destdir" = "X$libdir"; then |
---|
5346 | case "$current_libdirs " in |
---|
5347 | *" $libdir "*) ;; |
---|
5348 | *) current_libdirs="$current_libdirs $libdir" ;; |
---|
5349 | esac |
---|
5350 | else |
---|
5351 | # Note the libdir as a future libdir. |
---|
5352 | case "$future_libdirs " in |
---|
5353 | *" $libdir "*) ;; |
---|
5354 | *) future_libdirs="$future_libdirs $libdir" ;; |
---|
5355 | esac |
---|
5356 | fi |
---|
5357 | |
---|
5358 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ |
---|
5359 | test "X$dir" = "X$file/" && dir= |
---|
5360 | dir="$dir$objdir" |
---|
5361 | |
---|
5362 | if test -n "$relink_command"; then |
---|
5363 | # Determine the prefix the user has applied to our future dir. |
---|
5364 | inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` |
---|
5365 | |
---|
5366 | # Don't allow the user to place us outside of our expected |
---|
5367 | # location b/c this prevents finding dependent libraries that |
---|
5368 | # are installed to the same prefix. |
---|
5369 | # At present, this check doesn't affect windows .dll's that |
---|
5370 | # are installed into $libdir/../bin (currently, that works fine) |
---|
5371 | # but it's something to keep an eye on. |
---|
5372 | if test "$inst_prefix_dir" = "$destdir"; then |
---|
5373 | $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 |
---|
5374 | exit 1 |
---|
5375 | fi |
---|
5376 | |
---|
5377 | if test -n "$inst_prefix_dir"; then |
---|
5378 | # Stick the inst_prefix_dir data into the link command. |
---|
5379 | relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
---|
5380 | else |
---|
5381 | relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
---|
5382 | fi |
---|
5383 | |
---|
5384 | $echo "$modename: warning: relinking \`$file'" 1>&2 |
---|
5385 | $show "$relink_command" |
---|
5386 | if $run eval "$relink_command"; then : |
---|
5387 | else |
---|
5388 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 |
---|
5389 | exit 1 |
---|
5390 | fi |
---|
5391 | fi |
---|
5392 | |
---|
5393 | # See the names of the shared library. |
---|
5394 | set dummy $library_names |
---|
5395 | if test -n "$2"; then |
---|
5396 | realname="$2" |
---|
5397 | shift |
---|
5398 | shift |
---|
5399 | |
---|
5400 | srcname="$realname" |
---|
5401 | test -n "$relink_command" && srcname="$realname"T |
---|
5402 | |
---|
5403 | # Install the shared library and build the symlinks. |
---|
5404 | $show "$install_prog $dir/$srcname $destdir/$realname" |
---|
5405 | $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? |
---|
5406 | if test -n "$stripme" && test -n "$striplib"; then |
---|
5407 | $show "$striplib $destdir/$realname" |
---|
5408 | $run eval "$striplib $destdir/$realname" || exit $? |
---|
5409 | fi |
---|
5410 | |
---|
5411 | if test "$#" -gt 0; then |
---|
5412 | # Delete the old symlinks, and create new ones. |
---|
5413 | for linkname |
---|
5414 | do |
---|
5415 | if test "$linkname" != "$realname"; then |
---|
5416 | $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" |
---|
5417 | $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" |
---|
5418 | fi |
---|
5419 | done |
---|
5420 | fi |
---|
5421 | |
---|
5422 | # Do each command in the postinstall commands. |
---|
5423 | lib="$destdir/$realname" |
---|
5424 | eval cmds=\"$postinstall_cmds\" |
---|
5425 | save_ifs="$IFS"; IFS='~' |
---|
5426 | for cmd in $cmds; do |
---|
5427 | IFS="$save_ifs" |
---|
5428 | $show "$cmd" |
---|
5429 | $run eval "$cmd" || exit $? |
---|
5430 | done |
---|
5431 | IFS="$save_ifs" |
---|
5432 | fi |
---|
5433 | |
---|
5434 | # Install the pseudo-library for information purposes. |
---|
5435 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5436 | instname="$dir/$name"i |
---|
5437 | $show "$install_prog $instname $destdir/$name" |
---|
5438 | $run eval "$install_prog $instname $destdir/$name" || exit $? |
---|
5439 | |
---|
5440 | # Maybe install the static library, too. |
---|
5441 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" |
---|
5442 | ;; |
---|
5443 | |
---|
5444 | *.lo) |
---|
5445 | # Install (i.e. copy) a libtool object. |
---|
5446 | |
---|
5447 | # Figure out destination file name, if it wasn't already specified. |
---|
5448 | if test -n "$destname"; then |
---|
5449 | destfile="$destdir/$destname" |
---|
5450 | else |
---|
5451 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5452 | destfile="$destdir/$destfile" |
---|
5453 | fi |
---|
5454 | |
---|
5455 | # Deduce the name of the destination old-style object file. |
---|
5456 | case $destfile in |
---|
5457 | *.lo) |
---|
5458 | staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` |
---|
5459 | ;; |
---|
5460 | *.$objext) |
---|
5461 | staticdest="$destfile" |
---|
5462 | destfile= |
---|
5463 | ;; |
---|
5464 | *) |
---|
5465 | $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 |
---|
5466 | $echo "$help" 1>&2 |
---|
5467 | exit 1 |
---|
5468 | ;; |
---|
5469 | esac |
---|
5470 | |
---|
5471 | # Install the libtool object if requested. |
---|
5472 | if test -n "$destfile"; then |
---|
5473 | $show "$install_prog $file $destfile" |
---|
5474 | $run eval "$install_prog $file $destfile" || exit $? |
---|
5475 | fi |
---|
5476 | |
---|
5477 | # Install the old object if enabled. |
---|
5478 | if test "$build_old_libs" = yes; then |
---|
5479 | # Deduce the name of the old-style object file. |
---|
5480 | staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` |
---|
5481 | |
---|
5482 | $show "$install_prog $staticobj $staticdest" |
---|
5483 | $run eval "$install_prog \$staticobj \$staticdest" || exit $? |
---|
5484 | fi |
---|
5485 | exit 0 |
---|
5486 | ;; |
---|
5487 | |
---|
5488 | *) |
---|
5489 | # Figure out destination file name, if it wasn't already specified. |
---|
5490 | if test -n "$destname"; then |
---|
5491 | destfile="$destdir/$destname" |
---|
5492 | else |
---|
5493 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5494 | destfile="$destdir/$destfile" |
---|
5495 | fi |
---|
5496 | |
---|
5497 | # If the file is missing, and there is a .exe on the end, strip it |
---|
5498 | # because it is most likely a libtool script we actually want to |
---|
5499 | # install |
---|
5500 | stripped_ext="" |
---|
5501 | case $file in |
---|
5502 | *.exe) |
---|
5503 | if test ! -f "$file"; then |
---|
5504 | file=`$echo $file|${SED} 's,.exe$,,'` |
---|
5505 | stripped_ext=".exe" |
---|
5506 | fi |
---|
5507 | ;; |
---|
5508 | esac |
---|
5509 | |
---|
5510 | # Do a test to see if this is really a libtool program. |
---|
5511 | case $host in |
---|
5512 | *cygwin*|*mingw*) |
---|
5513 | wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` |
---|
5514 | ;; |
---|
5515 | *) |
---|
5516 | wrapper=$file |
---|
5517 | ;; |
---|
5518 | esac |
---|
5519 | if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then |
---|
5520 | notinst_deplibs= |
---|
5521 | relink_command= |
---|
5522 | |
---|
5523 | # To insure that "foo" is sourced, and not "foo.exe", |
---|
5524 | # finese the cygwin/MSYS system by explicitly sourcing "foo." |
---|
5525 | # which disallows the automatic-append-.exe behavior. |
---|
5526 | case $build in |
---|
5527 | *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; |
---|
5528 | *) wrapperdot=${wrapper} ;; |
---|
5529 | esac |
---|
5530 | # If there is no directory component, then add one. |
---|
5531 | case $file in |
---|
5532 | */* | *\\*) . ${wrapperdot} ;; |
---|
5533 | *) . ./${wrapperdot} ;; |
---|
5534 | esac |
---|
5535 | |
---|
5536 | # Check the variables that should have been set. |
---|
5537 | if test -z "$notinst_deplibs"; then |
---|
5538 | $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 |
---|
5539 | exit 1 |
---|
5540 | fi |
---|
5541 | |
---|
5542 | finalize=yes |
---|
5543 | for lib in $notinst_deplibs; do |
---|
5544 | # Check to see that each library is installed. |
---|
5545 | libdir= |
---|
5546 | if test -f "$lib"; then |
---|
5547 | # If there is no directory component, then add one. |
---|
5548 | case $lib in |
---|
5549 | */* | *\\*) . $lib ;; |
---|
5550 | *) . ./$lib ;; |
---|
5551 | esac |
---|
5552 | fi |
---|
5553 | libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test |
---|
5554 | if test -n "$libdir" && test ! -f "$libfile"; then |
---|
5555 | $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 |
---|
5556 | finalize=no |
---|
5557 | fi |
---|
5558 | done |
---|
5559 | |
---|
5560 | relink_command= |
---|
5561 | # To insure that "foo" is sourced, and not "foo.exe", |
---|
5562 | # finese the cygwin/MSYS system by explicitly sourcing "foo." |
---|
5563 | # which disallows the automatic-append-.exe behavior. |
---|
5564 | case $build in |
---|
5565 | *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; |
---|
5566 | *) wrapperdot=${wrapper} ;; |
---|
5567 | esac |
---|
5568 | # If there is no directory component, then add one. |
---|
5569 | case $file in |
---|
5570 | */* | *\\*) . ${wrapperdot} ;; |
---|
5571 | *) . ./${wrapperdot} ;; |
---|
5572 | esac |
---|
5573 | |
---|
5574 | outputname= |
---|
5575 | if test "$fast_install" = no && test -n "$relink_command"; then |
---|
5576 | if test "$finalize" = yes && test -z "$run"; then |
---|
5577 | tmpdir="/tmp" |
---|
5578 | test -n "$TMPDIR" && tmpdir="$TMPDIR" |
---|
5579 | tmpdir="$tmpdir/libtool-$$" |
---|
5580 | if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : |
---|
5581 | else |
---|
5582 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 |
---|
5583 | continue |
---|
5584 | fi |
---|
5585 | file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` |
---|
5586 | outputname="$tmpdir/$file" |
---|
5587 | # Replace the output file specification. |
---|
5588 | relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` |
---|
5589 | |
---|
5590 | $show "$relink_command" |
---|
5591 | if $run eval "$relink_command"; then : |
---|
5592 | else |
---|
5593 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 |
---|
5594 | ${rm}r "$tmpdir" |
---|
5595 | continue |
---|
5596 | fi |
---|
5597 | file="$outputname" |
---|
5598 | else |
---|
5599 | $echo "$modename: warning: cannot relink \`$file'" 1>&2 |
---|
5600 | fi |
---|
5601 | else |
---|
5602 | # Install the binary that we compiled earlier. |
---|
5603 | file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` |
---|
5604 | fi |
---|
5605 | fi |
---|
5606 | |
---|
5607 | # remove .exe since cygwin /usr/bin/install will append another |
---|
5608 | # one anyways |
---|
5609 | case $install_prog,$host in |
---|
5610 | */usr/bin/install*,*cygwin*) |
---|
5611 | case $file:$destfile in |
---|
5612 | *.exe:*.exe) |
---|
5613 | # this is ok |
---|
5614 | ;; |
---|
5615 | *.exe:*) |
---|
5616 | destfile=$destfile.exe |
---|
5617 | ;; |
---|
5618 | *:*.exe) |
---|
5619 | destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` |
---|
5620 | ;; |
---|
5621 | esac |
---|
5622 | ;; |
---|
5623 | esac |
---|
5624 | $show "$install_prog$stripme $file $destfile" |
---|
5625 | $run eval "$install_prog\$stripme \$file \$destfile" || exit $? |
---|
5626 | test -n "$outputname" && ${rm}r "$tmpdir" |
---|
5627 | ;; |
---|
5628 | esac |
---|
5629 | done |
---|
5630 | |
---|
5631 | for file in $staticlibs; do |
---|
5632 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5633 | |
---|
5634 | # Set up the ranlib parameters. |
---|
5635 | oldlib="$destdir/$name" |
---|
5636 | |
---|
5637 | $show "$install_prog $file $oldlib" |
---|
5638 | $run eval "$install_prog \$file \$oldlib" || exit $? |
---|
5639 | |
---|
5640 | if test -n "$stripme" && test -n "$striplib"; then |
---|
5641 | $show "$old_striplib $oldlib" |
---|
5642 | $run eval "$old_striplib $oldlib" || exit $? |
---|
5643 | fi |
---|
5644 | |
---|
5645 | # Do each command in the postinstall commands. |
---|
5646 | eval cmds=\"$old_postinstall_cmds\" |
---|
5647 | save_ifs="$IFS"; IFS='~' |
---|
5648 | for cmd in $cmds; do |
---|
5649 | IFS="$save_ifs" |
---|
5650 | $show "$cmd" |
---|
5651 | $run eval "$cmd" || exit $? |
---|
5652 | done |
---|
5653 | IFS="$save_ifs" |
---|
5654 | done |
---|
5655 | |
---|
5656 | if test -n "$future_libdirs"; then |
---|
5657 | $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 |
---|
5658 | fi |
---|
5659 | |
---|
5660 | if test -n "$current_libdirs"; then |
---|
5661 | # Maybe just do a dry run. |
---|
5662 | test -n "$run" && current_libdirs=" -n$current_libdirs" |
---|
5663 | exec_cmd='$SHELL $0 --finish$current_libdirs' |
---|
5664 | else |
---|
5665 | exit 0 |
---|
5666 | fi |
---|
5667 | ;; |
---|
5668 | |
---|
5669 | # libtool finish mode |
---|
5670 | finish) |
---|
5671 | modename="$modename: finish" |
---|
5672 | libdirs="$nonopt" |
---|
5673 | admincmds= |
---|
5674 | |
---|
5675 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
---|
5676 | for dir |
---|
5677 | do |
---|
5678 | libdirs="$libdirs $dir" |
---|
5679 | done |
---|
5680 | |
---|
5681 | for libdir in $libdirs; do |
---|
5682 | if test -n "$finish_cmds"; then |
---|
5683 | # Do each command in the finish commands. |
---|
5684 | eval cmds=\"$finish_cmds\" |
---|
5685 | save_ifs="$IFS"; IFS='~' |
---|
5686 | for cmd in $cmds; do |
---|
5687 | IFS="$save_ifs" |
---|
5688 | $show "$cmd" |
---|
5689 | $run eval "$cmd" || admincmds="$admincmds |
---|
5690 | $cmd" |
---|
5691 | done |
---|
5692 | IFS="$save_ifs" |
---|
5693 | fi |
---|
5694 | if test -n "$finish_eval"; then |
---|
5695 | # Do the single finish_eval. |
---|
5696 | eval cmds=\"$finish_eval\" |
---|
5697 | $run eval "$cmds" || admincmds="$admincmds |
---|
5698 | $cmds" |
---|
5699 | fi |
---|
5700 | done |
---|
5701 | fi |
---|
5702 | |
---|
5703 | # Exit here if they wanted silent mode. |
---|
5704 | test "$show" = : && exit 0 |
---|
5705 | |
---|
5706 | $echo "----------------------------------------------------------------------" |
---|
5707 | $echo "Libraries have been installed in:" |
---|
5708 | for libdir in $libdirs; do |
---|
5709 | $echo " $libdir" |
---|
5710 | done |
---|
5711 | $echo |
---|
5712 | $echo "If you ever happen to want to link against installed libraries" |
---|
5713 | $echo "in a given directory, LIBDIR, you must either use libtool, and" |
---|
5714 | $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
---|
5715 | $echo "flag during linking and do at least one of the following:" |
---|
5716 | if test -n "$shlibpath_var"; then |
---|
5717 | $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
---|
5718 | $echo " during execution" |
---|
5719 | fi |
---|
5720 | if test -n "$runpath_var"; then |
---|
5721 | $echo " - add LIBDIR to the \`$runpath_var' environment variable" |
---|
5722 | $echo " during linking" |
---|
5723 | fi |
---|
5724 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
5725 | libdir=LIBDIR |
---|
5726 | eval flag=\"$hardcode_libdir_flag_spec\" |
---|
5727 | |
---|
5728 | $echo " - use the \`$flag' linker flag" |
---|
5729 | fi |
---|
5730 | if test -n "$admincmds"; then |
---|
5731 | $echo " - have your system administrator run these commands:$admincmds" |
---|
5732 | fi |
---|
5733 | if test -f /etc/ld.so.conf; then |
---|
5734 | $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
---|
5735 | fi |
---|
5736 | $echo |
---|
5737 | $echo "See any operating system documentation about shared libraries for" |
---|
5738 | $echo "more information, such as the ld(1) and ld.so(8) manual pages." |
---|
5739 | $echo "----------------------------------------------------------------------" |
---|
5740 | exit 0 |
---|
5741 | ;; |
---|
5742 | |
---|
5743 | # libtool execute mode |
---|
5744 | execute) |
---|
5745 | modename="$modename: execute" |
---|
5746 | |
---|
5747 | # The first argument is the command name. |
---|
5748 | cmd="$nonopt" |
---|
5749 | if test -z "$cmd"; then |
---|
5750 | $echo "$modename: you must specify a COMMAND" 1>&2 |
---|
5751 | $echo "$help" |
---|
5752 | exit 1 |
---|
5753 | fi |
---|
5754 | |
---|
5755 | # Handle -dlopen flags immediately. |
---|
5756 | for file in $execute_dlfiles; do |
---|
5757 | if test ! -f "$file"; then |
---|
5758 | $echo "$modename: \`$file' is not a file" 1>&2 |
---|
5759 | $echo "$help" 1>&2 |
---|
5760 | exit 1 |
---|
5761 | fi |
---|
5762 | |
---|
5763 | dir= |
---|
5764 | case $file in |
---|
5765 | *.la) |
---|
5766 | # Check to see that this really is a libtool archive. |
---|
5767 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
---|
5768 | else |
---|
5769 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
---|
5770 | $echo "$help" 1>&2 |
---|
5771 | exit 1 |
---|
5772 | fi |
---|
5773 | |
---|
5774 | # Read the libtool library. |
---|
5775 | dlname= |
---|
5776 | library_names= |
---|
5777 | |
---|
5778 | # If there is no directory component, then add one. |
---|
5779 | case $file in |
---|
5780 | */* | *\\*) . $file ;; |
---|
5781 | *) . ./$file ;; |
---|
5782 | esac |
---|
5783 | |
---|
5784 | # Skip this library if it cannot be dlopened. |
---|
5785 | if test -z "$dlname"; then |
---|
5786 | # Warn if it was a shared library. |
---|
5787 | test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" |
---|
5788 | continue |
---|
5789 | fi |
---|
5790 | |
---|
5791 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
---|
5792 | test "X$dir" = "X$file" && dir=. |
---|
5793 | |
---|
5794 | if test -f "$dir/$objdir/$dlname"; then |
---|
5795 | dir="$dir/$objdir" |
---|
5796 | else |
---|
5797 | $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 |
---|
5798 | exit 1 |
---|
5799 | fi |
---|
5800 | ;; |
---|
5801 | |
---|
5802 | *.lo) |
---|
5803 | # Just add the directory containing the .lo file. |
---|
5804 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
---|
5805 | test "X$dir" = "X$file" && dir=. |
---|
5806 | ;; |
---|
5807 | |
---|
5808 | *) |
---|
5809 | $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 |
---|
5810 | continue |
---|
5811 | ;; |
---|
5812 | esac |
---|
5813 | |
---|
5814 | # Get the absolute pathname. |
---|
5815 | absdir=`cd "$dir" && pwd` |
---|
5816 | test -n "$absdir" && dir="$absdir" |
---|
5817 | |
---|
5818 | # Now add the directory to shlibpath_var. |
---|
5819 | if eval "test -z \"\$$shlibpath_var\""; then |
---|
5820 | eval "$shlibpath_var=\"\$dir\"" |
---|
5821 | else |
---|
5822 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
---|
5823 | fi |
---|
5824 | done |
---|
5825 | |
---|
5826 | # This variable tells wrapper scripts just to set shlibpath_var |
---|
5827 | # rather than running their programs. |
---|
5828 | libtool_execute_magic="$magic" |
---|
5829 | |
---|
5830 | # Check if any of the arguments is a wrapper script. |
---|
5831 | args= |
---|
5832 | for file |
---|
5833 | do |
---|
5834 | case $file in |
---|
5835 | -*) ;; |
---|
5836 | *) |
---|
5837 | # Do a test to see if this is really a libtool program. |
---|
5838 | if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
5839 | # If there is no directory component, then add one. |
---|
5840 | case $file in |
---|
5841 | */* | *\\*) . $file ;; |
---|
5842 | *) . ./$file ;; |
---|
5843 | esac |
---|
5844 | |
---|
5845 | # Transform arg to wrapped name. |
---|
5846 | file="$progdir/$program" |
---|
5847 | fi |
---|
5848 | ;; |
---|
5849 | esac |
---|
5850 | # Quote arguments (to preserve shell metacharacters). |
---|
5851 | file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` |
---|
5852 | args="$args \"$file\"" |
---|
5853 | done |
---|
5854 | |
---|
5855 | if test -z "$run"; then |
---|
5856 | if test -n "$shlibpath_var"; then |
---|
5857 | # Export the shlibpath_var. |
---|
5858 | eval "export $shlibpath_var" |
---|
5859 | fi |
---|
5860 | |
---|
5861 | # Restore saved environment variables |
---|
5862 | if test "${save_LC_ALL+set}" = set; then |
---|
5863 | LC_ALL="$save_LC_ALL"; export LC_ALL |
---|
5864 | fi |
---|
5865 | if test "${save_LANG+set}" = set; then |
---|
5866 | LANG="$save_LANG"; export LANG |
---|
5867 | fi |
---|
5868 | |
---|
5869 | # Now prepare to actually exec the command. |
---|
5870 | exec_cmd="\$cmd$args" |
---|
5871 | else |
---|
5872 | # Display what would be done. |
---|
5873 | if test -n "$shlibpath_var"; then |
---|
5874 | eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" |
---|
5875 | $echo "export $shlibpath_var" |
---|
5876 | fi |
---|
5877 | $echo "$cmd$args" |
---|
5878 | exit 0 |
---|
5879 | fi |
---|
5880 | ;; |
---|
5881 | |
---|
5882 | # libtool clean and uninstall mode |
---|
5883 | clean | uninstall) |
---|
5884 | modename="$modename: $mode" |
---|
5885 | rm="$nonopt" |
---|
5886 | files= |
---|
5887 | rmforce= |
---|
5888 | exit_status=0 |
---|
5889 | |
---|
5890 | # This variable tells wrapper scripts just to set variables rather |
---|
5891 | # than running their programs. |
---|
5892 | libtool_install_magic="$magic" |
---|
5893 | |
---|
5894 | for arg |
---|
5895 | do |
---|
5896 | case $arg in |
---|
5897 | -f) rm="$rm $arg"; rmforce=yes ;; |
---|
5898 | -*) rm="$rm $arg" ;; |
---|
5899 | *) files="$files $arg" ;; |
---|
5900 | esac |
---|
5901 | done |
---|
5902 | |
---|
5903 | if test -z "$rm"; then |
---|
5904 | $echo "$modename: you must specify an RM program" 1>&2 |
---|
5905 | $echo "$help" 1>&2 |
---|
5906 | exit 1 |
---|
5907 | fi |
---|
5908 | |
---|
5909 | rmdirs= |
---|
5910 | |
---|
5911 | origobjdir="$objdir" |
---|
5912 | for file in $files; do |
---|
5913 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
---|
5914 | if test "X$dir" = "X$file"; then |
---|
5915 | dir=. |
---|
5916 | objdir="$origobjdir" |
---|
5917 | else |
---|
5918 | objdir="$dir/$origobjdir" |
---|
5919 | fi |
---|
5920 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5921 | test "$mode" = uninstall && objdir="$dir" |
---|
5922 | |
---|
5923 | # Remember objdir for removal later, being careful to avoid duplicates |
---|
5924 | if test "$mode" = clean; then |
---|
5925 | case " $rmdirs " in |
---|
5926 | *" $objdir "*) ;; |
---|
5927 | *) rmdirs="$rmdirs $objdir" ;; |
---|
5928 | esac |
---|
5929 | fi |
---|
5930 | |
---|
5931 | # Don't error if the file doesn't exist and rm -f was used. |
---|
5932 | if (test -L "$file") >/dev/null 2>&1 \ |
---|
5933 | || (test -h "$file") >/dev/null 2>&1 \ |
---|
5934 | || test -f "$file"; then |
---|
5935 | : |
---|
5936 | elif test -d "$file"; then |
---|
5937 | exit_status=1 |
---|
5938 | continue |
---|
5939 | elif test "$rmforce" = yes; then |
---|
5940 | continue |
---|
5941 | fi |
---|
5942 | |
---|
5943 | rmfiles="$file" |
---|
5944 | |
---|
5945 | case $name in |
---|
5946 | *.la) |
---|
5947 | # Possibly a libtool archive, so verify it. |
---|
5948 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
5949 | . $dir/$name |
---|
5950 | |
---|
5951 | # Delete the libtool libraries and symlinks. |
---|
5952 | for n in $library_names; do |
---|
5953 | rmfiles="$rmfiles $objdir/$n" |
---|
5954 | done |
---|
5955 | test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" |
---|
5956 | test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" |
---|
5957 | |
---|
5958 | if test "$mode" = uninstall; then |
---|
5959 | if test -n "$library_names"; then |
---|
5960 | # Do each command in the postuninstall commands. |
---|
5961 | eval cmds=\"$postuninstall_cmds\" |
---|
5962 | save_ifs="$IFS"; IFS='~' |
---|
5963 | for cmd in $cmds; do |
---|
5964 | IFS="$save_ifs" |
---|
5965 | $show "$cmd" |
---|
5966 | $run eval "$cmd" |
---|
5967 | if test "$?" -ne 0 && test "$rmforce" != yes; then |
---|
5968 | exit_status=1 |
---|
5969 | fi |
---|
5970 | done |
---|
5971 | IFS="$save_ifs" |
---|
5972 | fi |
---|
5973 | |
---|
5974 | if test -n "$old_library"; then |
---|
5975 | # Do each command in the old_postuninstall commands. |
---|
5976 | eval cmds=\"$old_postuninstall_cmds\" |
---|
5977 | save_ifs="$IFS"; IFS='~' |
---|
5978 | for cmd in $cmds; do |
---|
5979 | IFS="$save_ifs" |
---|
5980 | $show "$cmd" |
---|
5981 | $run eval "$cmd" |
---|
5982 | if test "$?" -ne 0 && test "$rmforce" != yes; then |
---|
5983 | exit_status=1 |
---|
5984 | fi |
---|
5985 | done |
---|
5986 | IFS="$save_ifs" |
---|
5987 | fi |
---|
5988 | # FIXME: should reinstall the best remaining shared library. |
---|
5989 | fi |
---|
5990 | fi |
---|
5991 | ;; |
---|
5992 | |
---|
5993 | *.lo) |
---|
5994 | # Possibly a libtool object, so verify it. |
---|
5995 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
5996 | |
---|
5997 | # Read the .lo file |
---|
5998 | . $dir/$name |
---|
5999 | |
---|
6000 | # Add PIC object to the list of files to remove. |
---|
6001 | if test -n "$pic_object" \ |
---|
6002 | && test "$pic_object" != none; then |
---|
6003 | rmfiles="$rmfiles $dir/$pic_object" |
---|
6004 | fi |
---|
6005 | |
---|
6006 | # Add non-PIC object to the list of files to remove. |
---|
6007 | if test -n "$non_pic_object" \ |
---|
6008 | && test "$non_pic_object" != none; then |
---|
6009 | rmfiles="$rmfiles $dir/$non_pic_object" |
---|
6010 | fi |
---|
6011 | fi |
---|
6012 | ;; |
---|
6013 | |
---|
6014 | *) |
---|
6015 | if test "$mode" = clean ; then |
---|
6016 | noexename=$name |
---|
6017 | case $file in |
---|
6018 | *.exe) |
---|
6019 | file=`$echo $file|${SED} 's,.exe$,,'` |
---|
6020 | noexename=`$echo $name|${SED} 's,.exe$,,'` |
---|
6021 | # $file with .exe has already been added to rmfiles, |
---|
6022 | # add $file without .exe |
---|
6023 | rmfiles="$rmfiles $file" |
---|
6024 | ;; |
---|
6025 | esac |
---|
6026 | # Do a test to see if this is a libtool program. |
---|
6027 | if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
6028 | relink_command= |
---|
6029 | . $dir/$noexename |
---|
6030 | |
---|
6031 | # note $name still contains .exe if it was in $file originally |
---|
6032 | # as does the version of $file that was added into $rmfiles |
---|
6033 | rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" |
---|
6034 | if test "$fast_install" = yes && test -n "$relink_command"; then |
---|
6035 | rmfiles="$rmfiles $objdir/lt-$name" |
---|
6036 | fi |
---|
6037 | if test "X$noexename" != "X$name" ; then |
---|
6038 | rmfiles="$rmfiles $objdir/lt-${noexename}.c" |
---|
6039 | fi |
---|
6040 | fi |
---|
6041 | fi |
---|
6042 | ;; |
---|
6043 | esac |
---|
6044 | $show "$rm $rmfiles" |
---|
6045 | $run $rm $rmfiles || exit_status=1 |
---|
6046 | done |
---|
6047 | objdir="$origobjdir" |
---|
6048 | |
---|
6049 | # Try to remove the ${objdir}s in the directories where we deleted files |
---|
6050 | for dir in $rmdirs; do |
---|
6051 | if test -d "$dir"; then |
---|
6052 | $show "rmdir $dir" |
---|
6053 | $run rmdir $dir >/dev/null 2>&1 |
---|
6054 | fi |
---|
6055 | done |
---|
6056 | |
---|
6057 | exit $exit_status |
---|
6058 | ;; |
---|
6059 | |
---|
6060 | "") |
---|
6061 | $echo "$modename: you must specify a MODE" 1>&2 |
---|
6062 | $echo "$generic_help" 1>&2 |
---|
6063 | exit 1 |
---|
6064 | ;; |
---|
6065 | esac |
---|
6066 | |
---|
6067 | if test -z "$exec_cmd"; then |
---|
6068 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
---|
6069 | $echo "$generic_help" 1>&2 |
---|
6070 | exit 1 |
---|
6071 | fi |
---|
6072 | fi # test -z "$show_help" |
---|
6073 | |
---|
6074 | if test -n "$exec_cmd"; then |
---|
6075 | eval exec $exec_cmd |
---|
6076 | exit 1 |
---|
6077 | fi |
---|
6078 | |
---|
6079 | # We need to display help for each of the modes. |
---|
6080 | case $mode in |
---|
6081 | "") $echo \ |
---|
6082 | "Usage: $modename [OPTION]... [MODE-ARG]... |
---|
6083 | |
---|
6084 | Provide generalized library-building support services. |
---|
6085 | |
---|
6086 | --config show all configuration variables |
---|
6087 | --debug enable verbose shell tracing |
---|
6088 | -n, --dry-run display commands without modifying any files |
---|
6089 | --features display basic configuration information and exit |
---|
6090 | --finish same as \`--mode=finish' |
---|
6091 | --help display this help message and exit |
---|
6092 | --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] |
---|
6093 | --quiet same as \`--silent' |
---|
6094 | --silent don't print informational messages |
---|
6095 | --tag=TAG use configuration variables from tag TAG |
---|
6096 | --version print version information |
---|
6097 | |
---|
6098 | MODE must be one of the following: |
---|
6099 | |
---|
6100 | clean remove files from the build directory |
---|
6101 | compile compile a source file into a libtool object |
---|
6102 | execute automatically set library path, then run a program |
---|
6103 | finish complete the installation of libtool libraries |
---|
6104 | install install libraries or executables |
---|
6105 | link create a library or an executable |
---|
6106 | uninstall remove libraries from an installed directory |
---|
6107 | |
---|
6108 | MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for |
---|
6109 | a more detailed description of MODE. |
---|
6110 | |
---|
6111 | Report bugs to <bug-libtool@gnu.org>." |
---|
6112 | exit 0 |
---|
6113 | ;; |
---|
6114 | |
---|
6115 | clean) |
---|
6116 | $echo \ |
---|
6117 | "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
---|
6118 | |
---|
6119 | Remove files from the build directory. |
---|
6120 | |
---|
6121 | RM is the name of the program to use to delete files associated with each FILE |
---|
6122 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
---|
6123 | to RM. |
---|
6124 | |
---|
6125 | If FILE is a libtool library, object or program, all the files associated |
---|
6126 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
---|
6127 | ;; |
---|
6128 | |
---|
6129 | compile) |
---|
6130 | $echo \ |
---|
6131 | "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
---|
6132 | |
---|
6133 | Compile a source file into a libtool library object. |
---|
6134 | |
---|
6135 | This mode accepts the following additional options: |
---|
6136 | |
---|
6137 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
---|
6138 | -prefer-pic try to building PIC objects only |
---|
6139 | -prefer-non-pic try to building non-PIC objects only |
---|
6140 | -static always build a \`.o' file suitable for static linking |
---|
6141 | |
---|
6142 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
---|
6143 | from the given SOURCEFILE. |
---|
6144 | |
---|
6145 | The output file name is determined by removing the directory component from |
---|
6146 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
---|
6147 | library object suffix, \`.lo'." |
---|
6148 | ;; |
---|
6149 | |
---|
6150 | execute) |
---|
6151 | $echo \ |
---|
6152 | "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... |
---|
6153 | |
---|
6154 | Automatically set library path, then run a program. |
---|
6155 | |
---|
6156 | This mode accepts the following additional options: |
---|
6157 | |
---|
6158 | -dlopen FILE add the directory containing FILE to the library path |
---|
6159 | |
---|
6160 | This mode sets the library path environment variable according to \`-dlopen' |
---|
6161 | flags. |
---|
6162 | |
---|
6163 | If any of the ARGS are libtool executable wrappers, then they are translated |
---|
6164 | into their corresponding uninstalled binary, and any of their required library |
---|
6165 | directories are added to the library path. |
---|
6166 | |
---|
6167 | Then, COMMAND is executed, with ARGS as arguments." |
---|
6168 | ;; |
---|
6169 | |
---|
6170 | finish) |
---|
6171 | $echo \ |
---|
6172 | "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... |
---|
6173 | |
---|
6174 | Complete the installation of libtool libraries. |
---|
6175 | |
---|
6176 | Each LIBDIR is a directory that contains libtool libraries. |
---|
6177 | |
---|
6178 | The commands that this mode executes may require superuser privileges. Use |
---|
6179 | the \`--dry-run' option if you just want to see what would be executed." |
---|
6180 | ;; |
---|
6181 | |
---|
6182 | install) |
---|
6183 | $echo \ |
---|
6184 | "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... |
---|
6185 | |
---|
6186 | Install executables or libraries. |
---|
6187 | |
---|
6188 | INSTALL-COMMAND is the installation command. The first component should be |
---|
6189 | either the \`install' or \`cp' program. |
---|
6190 | |
---|
6191 | The rest of the components are interpreted as arguments to that command (only |
---|
6192 | BSD-compatible install options are recognized)." |
---|
6193 | ;; |
---|
6194 | |
---|
6195 | link) |
---|
6196 | $echo \ |
---|
6197 | "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... |
---|
6198 | |
---|
6199 | Link object files or libraries together to form another library, or to |
---|
6200 | create an executable program. |
---|
6201 | |
---|
6202 | LINK-COMMAND is a command using the C compiler that you would use to create |
---|
6203 | a program from several object files. |
---|
6204 | |
---|
6205 | The following components of LINK-COMMAND are treated specially: |
---|
6206 | |
---|
6207 | -all-static do not do any dynamic linking at all |
---|
6208 | -avoid-version do not add a version suffix if possible |
---|
6209 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
---|
6210 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
---|
6211 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
---|
6212 | -export-symbols SYMFILE |
---|
6213 | try to export only the symbols listed in SYMFILE |
---|
6214 | -export-symbols-regex REGEX |
---|
6215 | try to export only the symbols matching REGEX |
---|
6216 | -LLIBDIR search LIBDIR for required installed libraries |
---|
6217 | -lNAME OUTPUT-FILE requires the installed library libNAME |
---|
6218 | -module build a library that can dlopened |
---|
6219 | -no-fast-install disable the fast-install mode |
---|
6220 | -no-install link a not-installable executable |
---|
6221 | -no-undefined declare that a library does not refer to external symbols |
---|
6222 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
---|
6223 | -objectlist FILE Use a list of object files found in FILE to specify objects |
---|
6224 | -release RELEASE specify package release information |
---|
6225 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
---|
6226 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
---|
6227 | -static do not do any dynamic linking of libtool libraries |
---|
6228 | -version-info CURRENT[:REVISION[:AGE]] |
---|
6229 | specify library version info [each variable defaults to 0] |
---|
6230 | |
---|
6231 | All other options (arguments beginning with \`-') are ignored. |
---|
6232 | |
---|
6233 | Every other argument is treated as a filename. Files ending in \`.la' are |
---|
6234 | treated as uninstalled libtool libraries, other files are standard or library |
---|
6235 | object files. |
---|
6236 | |
---|
6237 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
---|
6238 | only library objects (\`.lo' files) may be specified, and \`-rpath' is |
---|
6239 | required, except when creating a convenience library. |
---|
6240 | |
---|
6241 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
---|
6242 | using \`ar' and \`ranlib', or on Windows using \`lib'. |
---|
6243 | |
---|
6244 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
---|
6245 | is created, otherwise an executable program is created." |
---|
6246 | ;; |
---|
6247 | |
---|
6248 | uninstall) |
---|
6249 | $echo \ |
---|
6250 | "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
---|
6251 | |
---|
6252 | Remove libraries from an installation directory. |
---|
6253 | |
---|
6254 | RM is the name of the program to use to delete files associated with each FILE |
---|
6255 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
---|
6256 | to RM. |
---|
6257 | |
---|
6258 | If FILE is a libtool library, all the files associated with it are deleted. |
---|
6259 | Otherwise, only FILE itself is deleted using RM." |
---|
6260 | ;; |
---|
6261 | |
---|
6262 | *) |
---|
6263 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
---|
6264 | $echo "$help" 1>&2 |
---|
6265 | exit 1 |
---|
6266 | ;; |
---|
6267 | esac |
---|
6268 | |
---|
6269 | $echo |
---|
6270 | $echo "Try \`$modename --help' for more information about other modes." |
---|
6271 | |
---|
6272 | exit 0 |
---|
6273 | |
---|
6274 | # The TAGs below are defined such that we never get into a situation |
---|
6275 | # in which we disable both kinds of libraries. Given conflicting |
---|
6276 | # choices, we go for a static library, that is the most portable, |
---|
6277 | # since we can't tell whether shared libraries were disabled because |
---|
6278 | # the user asked for that or because the platform doesn't support |
---|
6279 | # them. This is particularly important on AIX, because we don't |
---|
6280 | # support having both static and shared libraries enabled at the same |
---|
6281 | # time on that platform, so we default to a shared-only configuration. |
---|
6282 | # If a disable-shared tag is given, we'll fallback to a static-only |
---|
6283 | # configuration. But we'll never go from static-only to shared-only. |
---|
6284 | |
---|
6285 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared |
---|
6286 | build_libtool_libs=no |
---|
6287 | build_old_libs=yes |
---|
6288 | # ### END LIBTOOL TAG CONFIG: disable-shared |
---|
6289 | |
---|
6290 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static |
---|
6291 | build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` |
---|
6292 | # ### END LIBTOOL TAG CONFIG: disable-static |
---|
6293 | |
---|
6294 | # Local Variables: |
---|
6295 | # mode:shell-script |
---|
6296 | # sh-indentation:2 |
---|
6297 | # End: |
---|