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