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