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