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