Mercurial > sdl-ios-xcode
annotate ltmain.sh @ 76:f28fa29a3a0c
Bumped the library version
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Tue, 19 Jun 2001 13:35:05 +0000 |
parents | cf2af46e9e2a |
children | 469d5c0da01d |
rev | line source |
---|---|
0 | 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 ;; | |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1082 *-*-openbsd*) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1083 # Do not include libc due to us having libc/libc_r. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1084 continue |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1085 ;; |
0 | 1086 esac |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1087 elif test "$arg" = "-lc_r"; then |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1088 case "$host" in |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1089 *-*-openbsd*) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1090 # Do not include libc_r directly, use -pthread flag. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1091 continue |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1092 ;; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1093 esac |
0 | 1094 elif test "$arg" = "-lm"; then |
1095 case "$host" in | |
1096 *-*-cygwin* | *-*-beos*) | |
1097 # These systems don't actually have math library (as such) | |
1098 continue | |
1099 ;; | |
1100 esac | |
1101 fi | |
1102 deplibs="$deplibs $arg" | |
1103 ;; | |
1104 | |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1105 -?thread) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1106 deplibs="$deplibs $arg" |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1107 ;; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1108 |
0 | 1109 -module) |
1110 module=yes | |
1111 continue | |
1112 ;; | |
1113 | |
1114 -no-undefined) | |
1115 allow_undefined=no | |
1116 continue | |
1117 ;; | |
1118 | |
1119 -o) prev=output ;; | |
1120 | |
1121 -release) | |
1122 prev=release | |
1123 continue | |
1124 ;; | |
1125 | |
1126 -rpath) | |
1127 prev=rpath | |
1128 continue | |
1129 ;; | |
1130 | |
1131 -R) | |
1132 prev=xrpath | |
1133 continue | |
1134 ;; | |
1135 | |
1136 -R*) | |
1137 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` | |
1138 # We need an absolute path. | |
1139 case "$dir" in | |
1140 [\\/]* | [A-Za-z]:[\\/]*) ;; | |
1141 *) | |
1142 $echo "$modename: only absolute run-paths are allowed" 1>&2 | |
1143 exit 1 | |
1144 ;; | |
1145 esac | |
1146 case "$xrpath " in | |
1147 *" $dir "*) ;; | |
1148 *) xrpath="$xrpath $dir" ;; | |
1149 esac | |
1150 continue | |
1151 ;; | |
1152 | |
1153 -static) | |
1154 # If we have no pic_flag, then this is the same as -all-static. | |
1155 if test -z "$pic_flag" && test -n "$link_static_flag"; then | |
1156 compile_command="$compile_command $link_static_flag" | |
1157 finalize_command="$finalize_command $link_static_flag" | |
1158 fi | |
1159 continue | |
1160 ;; | |
1161 | |
1162 -thread-safe) | |
1163 thread_safe=yes | |
1164 continue | |
1165 ;; | |
1166 | |
1167 -version-info) | |
1168 prev=vinfo | |
1169 continue | |
1170 ;; | |
1171 | |
1172 # Some other compiler flag. | |
1173 -* | +*) | |
1174 # Unknown arguments in both finalize_command and compile_command need | |
1175 # to be aesthetically quoted because they are evaled later. | |
1176 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
1177 case "$arg" in | |
1178 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) | |
1179 arg="\"$arg\"" | |
1180 ;; | |
1181 esac | |
1182 ;; | |
1183 | |
1184 *.o | *.obj | *.a | *.lib) | |
1185 # A standard object. | |
1186 objs="$objs $arg" | |
1187 ;; | |
1188 | |
1189 *.lo) | |
1190 # A library object. | |
1191 if test "$prev" = dlfiles; then | |
1192 dlfiles="$dlfiles $arg" | |
1193 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then | |
1194 prev= | |
1195 continue | |
1196 else | |
1197 # If libtool objects are unsupported, then we need to preload. | |
1198 prev=dlprefiles | |
1199 fi | |
1200 fi | |
1201 | |
1202 if test "$prev" = dlprefiles; then | |
1203 # Preload the old-style object. | |
1204 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` | |
1205 prev= | |
1206 fi | |
1207 libobjs="$libobjs $arg" | |
1208 ;; | |
1209 | |
1210 *.la) | |
1211 # A libtool-controlled library. | |
1212 | |
1213 dlname= | |
1214 libdir= | |
1215 library_names= | |
1216 old_library= | |
1217 | |
1218 # Check to see that this really is a libtool archive. | |
1219 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : | |
1220 else | |
1221 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 | |
1222 exit 1 | |
1223 fi | |
1224 | |
1225 # If the library was installed with an old release of libtool, | |
1226 # it will not redefine variable installed. | |
1227 installed=yes | |
1228 | |
1229 # Read the .la file | |
1230 # If there is no directory component, then add one. | |
1231 case "$arg" in | |
1232 */* | *\\*) . $arg ;; | |
1233 *) . ./$arg ;; | |
1234 esac | |
1235 | |
1236 # Get the name of the library we link against. | |
1237 linklib= | |
1238 for l in $old_library $library_names; do | |
1239 linklib="$l" | |
1240 done | |
1241 | |
1242 if test -z "$linklib"; then | |
1243 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 | |
1244 exit 1 | |
1245 fi | |
1246 | |
1247 # Find the relevant object directory and library name. | |
1248 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` | |
1249 | |
1250 if test "X$installed" = Xyes; then | |
1251 dir="$libdir" | |
1252 else | |
1253 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | |
1254 if test "X$dir" = "X$arg"; then | |
1255 dir="$objdir" | |
1256 else | |
1257 dir="$dir/$objdir" | |
1258 fi | |
1259 fi | |
1260 | |
1261 if test -n "$dependency_libs"; then | |
1262 # Extract -R and -L from dependency_libs | |
1263 temp_deplibs= | |
1264 for deplib in $dependency_libs; do | |
1265 case "$deplib" in | |
1266 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` | |
1267 case " $rpath $xrpath " in | |
1268 *" $temp_xrpath "*) ;; | |
1269 *) xrpath="$xrpath $temp_xrpath";; | |
1270 esac;; | |
1271 -L*) case "$compile_command $temp_deplibs " in | |
1272 *" $deplib "*) ;; | |
1273 *) temp_deplibs="$temp_deplibs $deplib";; | |
1274 esac | |
1275 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` | |
1276 case " $lib_search_path " in | |
1277 *" $temp_dir "*) ;; | |
1278 *) lib_search_path="$lib_search_path $temp_dir";; | |
1279 esac | |
1280 ;; | |
1281 *) temp_deplibs="$temp_deplibs $deplib";; | |
1282 esac | |
1283 done | |
1284 dependency_libs="$temp_deplibs" | |
1285 fi | |
1286 | |
1287 if test -z "$libdir"; then | |
1288 # It is a libtool convenience library, so add in its objects. | |
1289 convenience="$convenience $dir/$old_library" | |
1290 old_convenience="$old_convenience $dir/$old_library" | |
1291 deplibs="$deplibs$dependency_libs" | |
1292 compile_command="$compile_command $dir/$old_library$dependency_libs" | |
1293 finalize_command="$finalize_command $dir/$old_library$dependency_libs" | |
1294 continue | |
1295 fi | |
1296 | |
1297 # This library was specified with -dlopen. | |
1298 if test "$prev" = dlfiles; then | |
1299 dlfiles="$dlfiles $arg" | |
1300 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then | |
1301 # If there is no dlname, no dlopen support or we're linking statically, | |
1302 # we need to preload. | |
1303 prev=dlprefiles | |
1304 else | |
1305 # We should not create a dependency on this library, but we | |
1306 # may need any libraries it requires. | |
1307 compile_command="$compile_command$dependency_libs" | |
1308 finalize_command="$finalize_command$dependency_libs" | |
1309 prev= | |
1310 continue | |
1311 fi | |
1312 fi | |
1313 | |
1314 # The library was specified with -dlpreopen. | |
1315 if test "$prev" = dlprefiles; then | |
1316 # Prefer using a static library (so that no silly _DYNAMIC symbols | |
1317 # are required to link). | |
1318 if test -n "$old_library"; then | |
1319 dlprefiles="$dlprefiles $dir/$old_library" | |
1320 else | |
1321 dlprefiles="$dlprefiles $dir/$linklib" | |
1322 fi | |
1323 prev= | |
1324 fi | |
1325 | |
1326 if test -n "$library_names" && | |
1327 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then | |
1328 link_against_libtool_libs="$link_against_libtool_libs $arg" | |
1329 if test -n "$shlibpath_var"; then | |
1330 # Make sure the rpath contains only unique directories. | |
1331 case "$temp_rpath " in | |
1332 *" $dir "*) ;; | |
1333 *) temp_rpath="$temp_rpath $dir" ;; | |
1334 esac | |
1335 fi | |
1336 | |
1337 # We need an absolute path. | |
1338 case "$dir" in | |
1339 [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; | |
1340 *) | |
1341 absdir=`cd "$dir" && pwd` | |
1342 if test -z "$absdir"; then | |
1343 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 | |
1344 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 | |
1345 absdir="$dir" | |
1346 fi | |
1347 ;; | |
1348 esac | |
1349 | |
1350 # This is the magic to use -rpath. | |
1351 # Skip directories that are in the system default run-time | |
1352 # search path, unless they have been requested with -R. | |
1353 case " $sys_lib_dlsearch_path " in | |
1354 *" $absdir "*) ;; | |
1355 *) | |
1356 case "$compile_rpath " in | |
1357 *" $absdir "*) ;; | |
1358 *) compile_rpath="$compile_rpath $absdir" | |
1359 esac | |
1360 ;; | |
1361 esac | |
1362 | |
1363 case " $sys_lib_dlsearch_path " in | |
1364 *" $libdir "*) ;; | |
1365 *) | |
1366 case "$finalize_rpath " in | |
1367 *" $libdir "*) ;; | |
1368 *) finalize_rpath="$finalize_rpath $libdir" | |
1369 esac | |
1370 ;; | |
1371 esac | |
1372 | |
1373 lib_linked=yes | |
1374 case "$hardcode_action" in | |
1375 immediate | unsupported) | |
1376 if test "$hardcode_direct" = no; then | |
1377 compile_command="$compile_command $dir/$linklib" | |
1378 deplibs="$deplibs $dir/$linklib" | |
1379 case "$host" in | |
1380 *-*-cygwin* | *-*-mingw* | *-*-os2*) | |
1381 dllsearchdir=`cd "$dir" && pwd || echo "$dir"` | |
1382 if test -n "$dllsearchpath"; then | |
1383 dllsearchpath="$dllsearchpath:$dllsearchdir" | |
1384 else | |
1385 dllsearchpath="$dllsearchdir" | |
1386 fi | |
1387 ;; | |
1388 esac | |
1389 elif test "$hardcode_minus_L" = no; then | |
1390 case "$host" in | |
1391 *-*-sunos*) | |
1392 compile_shlibpath="$compile_shlibpath$dir:" | |
1393 ;; | |
1394 esac | |
1395 case "$compile_command " in | |
1396 *" -L$dir "*) ;; | |
1397 *) compile_command="$compile_command -L$dir";; | |
1398 esac | |
1399 compile_command="$compile_command -l$name" | |
1400 deplibs="$deplibs -L$dir -l$name" | |
1401 elif test "$hardcode_shlibpath_var" = no; then | |
1402 case ":$compile_shlibpath:" in | |
1403 *":$dir:"*) ;; | |
1404 *) compile_shlibpath="$compile_shlibpath$dir:";; | |
1405 esac | |
1406 compile_command="$compile_command -l$name" | |
1407 deplibs="$deplibs -l$name" | |
1408 else | |
1409 lib_linked=no | |
1410 fi | |
1411 ;; | |
1412 | |
1413 relink) | |
1414 if test "$hardcode_direct" = yes; then | |
1415 compile_command="$compile_command $absdir/$linklib" | |
1416 deplibs="$deplibs $absdir/$linklib" | |
1417 elif test "$hardcode_minus_L" = yes; then | |
1418 case "$compile_command " in | |
1419 *" -L$absdir "*) ;; | |
1420 *) compile_command="$compile_command -L$absdir";; | |
1421 esac | |
1422 compile_command="$compile_command -l$name" | |
1423 deplibs="$deplibs -L$absdir -l$name" | |
1424 elif test "$hardcode_shlibpath_var" = yes; then | |
1425 case ":$compile_shlibpath:" in | |
1426 *":$absdir:"*) ;; | |
1427 *) compile_shlibpath="$compile_shlibpath$absdir:";; | |
1428 esac | |
1429 compile_command="$compile_command -l$name" | |
1430 deplibs="$deplibs -l$name" | |
1431 else | |
1432 lib_linked=no | |
1433 fi | |
1434 ;; | |
1435 | |
1436 *) | |
1437 lib_linked=no | |
1438 ;; | |
1439 esac | |
1440 | |
1441 if test "$lib_linked" != yes; then | |
1442 $echo "$modename: configuration error: unsupported hardcode properties" | |
1443 exit 1 | |
1444 fi | |
1445 | |
1446 # Finalize command for both is simple: just hardcode it. | |
1447 if test "$hardcode_direct" = yes; then | |
1448 finalize_command="$finalize_command $libdir/$linklib" | |
1449 elif test "$hardcode_minus_L" = yes; then | |
1450 case "$finalize_command " in | |
1451 *" -L$libdir "*) ;; | |
1452 *) finalize_command="$finalize_command -L$libdir";; | |
1453 esac | |
1454 finalize_command="$finalize_command -l$name" | |
1455 elif test "$hardcode_shlibpath_var" = yes; then | |
1456 case ":$finalize_shlibpath:" in | |
1457 *":$libdir:"*) ;; | |
1458 *) finalize_shlibpath="$finalize_shlibpath$libdir:";; | |
1459 esac | |
1460 finalize_command="$finalize_command -l$name" | |
1461 else | |
1462 # We cannot seem to hardcode it, guess we'll fake it. | |
1463 case "$finalize_command " in | |
1464 *" -L$dir "*) ;; | |
1465 *) finalize_command="$finalize_command -L$libdir";; | |
1466 esac | |
1467 finalize_command="$finalize_command -l$name" | |
1468 fi | |
1469 else | |
1470 # Transform directly to old archives if we don't build new libraries. | |
1471 if test -n "$pic_flag" && test -z "$old_library"; then | |
1472 $echo "$modename: cannot find static library for \`$arg'" 1>&2 | |
1473 exit 1 | |
1474 fi | |
1475 | |
1476 # Here we assume that one of hardcode_direct or hardcode_minus_L | |
1477 # is not unsupported. This is valid on all known static and | |
1478 # shared platforms. | |
1479 if test "$hardcode_direct" != unsupported; then | |
1480 test -n "$old_library" && linklib="$old_library" | |
1481 compile_command="$compile_command $dir/$linklib" | |
1482 finalize_command="$finalize_command $dir/$linklib" | |
1483 else | |
1484 case "$compile_command " in | |
1485 *" -L$dir "*) ;; | |
1486 *) compile_command="$compile_command -L$dir";; | |
1487 esac | |
1488 compile_command="$compile_command -l$name" | |
1489 case "$finalize_command " in | |
1490 *" -L$dir "*) ;; | |
1491 *) finalize_command="$finalize_command -L$dir";; | |
1492 esac | |
1493 finalize_command="$finalize_command -l$name" | |
1494 fi | |
1495 fi | |
1496 | |
1497 # Add in any libraries that this one depends upon. | |
1498 compile_command="$compile_command$dependency_libs" | |
1499 finalize_command="$finalize_command$dependency_libs" | |
1500 continue | |
1501 ;; | |
1502 | |
1503 # Some other compiler argument. | |
1504 *) | |
1505 # Unknown arguments in both finalize_command and compile_command need | |
1506 # to be aesthetically quoted because they are evaled later. | |
1507 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
1508 case "$arg" in | |
1509 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) | |
1510 arg="\"$arg\"" | |
1511 ;; | |
1512 esac | |
1513 ;; | |
1514 esac | |
1515 | |
1516 # Now actually substitute the argument into the commands. | |
1517 if test -n "$arg"; then | |
1518 compile_command="$compile_command $arg" | |
1519 finalize_command="$finalize_command $arg" | |
1520 fi | |
1521 done | |
1522 | |
1523 if test -n "$prev"; then | |
1524 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 | |
1525 $echo "$help" 1>&2 | |
1526 exit 1 | |
1527 fi | |
1528 | |
1529 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then | |
1530 eval arg=\"$export_dynamic_flag_spec\" | |
1531 compile_command="$compile_command $arg" | |
1532 finalize_command="$finalize_command $arg" | |
1533 fi | |
1534 | |
1535 oldlibs= | |
1536 # calculate the name of the file, without its directory | |
1537 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` | |
1538 libobjs_save="$libobjs" | |
1539 | |
1540 case "$output" in | |
1541 "") | |
1542 $echo "$modename: you must specify an output file" 1>&2 | |
1543 $echo "$help" 1>&2 | |
1544 exit 1 | |
1545 ;; | |
1546 | |
1547 *.a | *.lib) | |
1548 if test -n "$link_against_libtool_libs"; then | |
1549 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 | |
1550 exit 1 | |
1551 fi | |
1552 | |
1553 if test -n "$deplibs"; then | |
1554 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 | |
1555 fi | |
1556 | |
1557 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | |
1558 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 | |
1559 fi | |
1560 | |
1561 if test -n "$rpath"; then | |
1562 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 | |
1563 fi | |
1564 | |
1565 if test -n "$xrpath"; then | |
1566 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 | |
1567 fi | |
1568 | |
1569 if test -n "$vinfo"; then | |
1570 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 | |
1571 fi | |
1572 | |
1573 if test -n "$release"; then | |
1574 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 | |
1575 fi | |
1576 | |
1577 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | |
1578 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 | |
1579 fi | |
1580 | |
1581 # Now set the variables for building old libraries. | |
1582 build_libtool_libs=no | |
1583 oldlibs="$output" | |
1584 ;; | |
1585 | |
1586 *.la) | |
1587 # Make sure we only generate libraries of the form `libNAME.la'. | |
1588 case "$outputname" in | |
1589 lib*) | |
1590 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` | |
1591 eval libname=\"$libname_spec\" | |
1592 ;; | |
1593 *) | |
1594 if test "$module" = no; then | |
1595 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 | |
1596 $echo "$help" 1>&2 | |
1597 exit 1 | |
1598 fi | |
1599 if test "$need_lib_prefix" != no; then | |
1600 # Add the "lib" prefix for modules if required | |
1601 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` | |
1602 eval libname=\"$libname_spec\" | |
1603 else | |
1604 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` | |
1605 fi | |
1606 ;; | |
1607 esac | |
1608 | |
1609 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` | |
1610 if test "X$output_objdir" = "X$output"; then | |
1611 output_objdir="$objdir" | |
1612 else | |
1613 output_objdir="$output_objdir/$objdir" | |
1614 fi | |
1615 | |
1616 if test -n "$objs"; then | |
1617 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 | |
1618 exit 1 | |
1619 fi | |
1620 | |
1621 # How the heck are we supposed to write a wrapper for a shared library? | |
1622 if test -n "$link_against_libtool_libs"; then | |
1623 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 | |
1624 exit 1 | |
1625 fi | |
1626 | |
1627 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | |
1628 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 | |
1629 fi | |
1630 | |
1631 set dummy $rpath | |
1632 if test $# -gt 2; then | |
1633 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 | |
1634 fi | |
1635 install_libdir="$2" | |
1636 | |
1637 oldlibs= | |
1638 if test -z "$rpath"; then | |
1639 if test "$build_libtool_libs" = yes; then | |
1640 # Building a libtool convenience library. | |
1641 libext=al | |
1642 oldlibs="$output_objdir/$libname.$libext $oldlibs" | |
1643 build_libtool_libs=convenience | |
1644 build_old_libs=yes | |
1645 fi | |
1646 dependency_libs="$deplibs" | |
1647 | |
1648 if test -n "$vinfo"; then | |
1649 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 | |
1650 fi | |
1651 | |
1652 if test -n "$release"; then | |
1653 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 | |
1654 fi | |
1655 else | |
1656 | |
1657 # Parse the version information argument. | |
1658 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' | |
1659 set dummy $vinfo 0 0 0 | |
1660 IFS="$save_ifs" | |
1661 | |
1662 if test -n "$8"; then | |
1663 $echo "$modename: too many parameters to \`-version-info'" 1>&2 | |
1664 $echo "$help" 1>&2 | |
1665 exit 1 | |
1666 fi | |
1667 | |
1668 current="$2" | |
1669 revision="$3" | |
1670 age="$4" | |
1671 | |
1672 # Check that each of the things are valid numbers. | |
1673 case "$current" in | |
1674 0 | [1-9] | [1-9][0-9]*) ;; | |
1675 *) | |
1676 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 | |
1677 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | |
1678 exit 1 | |
1679 ;; | |
1680 esac | |
1681 | |
1682 case "$revision" in | |
1683 0 | [1-9] | [1-9][0-9]*) ;; | |
1684 *) | |
1685 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 | |
1686 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | |
1687 exit 1 | |
1688 ;; | |
1689 esac | |
1690 | |
1691 case "$age" in | |
1692 0 | [1-9] | [1-9][0-9]*) ;; | |
1693 *) | |
1694 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 | |
1695 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | |
1696 exit 1 | |
1697 ;; | |
1698 esac | |
1699 | |
1700 if test $age -gt $current; then | |
1701 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 | |
1702 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | |
1703 exit 1 | |
1704 fi | |
1705 | |
1706 # Calculate the version variables. | |
1707 major= | |
1708 versuffix= | |
1709 verstring= | |
1710 case "$version_type" in | |
1711 none) ;; | |
1712 | |
1713 irix) | |
1714 major=`expr $current - $age + 1` | |
1715 versuffix="$major.$revision" | |
1716 verstring="sgi$major.$revision" | |
1717 | |
1718 # Add in all the interfaces that we are compatible with. | |
1719 loop=$revision | |
1720 while test $loop != 0; do | |
1721 iface=`expr $revision - $loop` | |
1722 loop=`expr $loop - 1` | |
1723 verstring="sgi$major.$iface:$verstring" | |
1724 done | |
1725 ;; | |
1726 | |
1727 linux) | |
1728 major=.`expr $current - $age` | |
1729 versuffix="$major.$age.$revision" | |
1730 ;; | |
1731 | |
1732 osf) | |
1733 major=`expr $current - $age` | |
1734 versuffix=".$current.$age.$revision" | |
1735 verstring="$current.$age.$revision" | |
1736 | |
1737 # Add in all the interfaces that we are compatible with. | |
1738 loop=$age | |
1739 while test $loop != 0; do | |
1740 iface=`expr $current - $loop` | |
1741 loop=`expr $loop - 1` | |
1742 verstring="$verstring:${iface}.0" | |
1743 done | |
1744 | |
1745 # Make executables depend on our current version. | |
1746 verstring="$verstring:${current}.0" | |
1747 ;; | |
1748 | |
1749 sunos) | |
1750 major=".$current" | |
1751 versuffix=".$current.$revision" | |
1752 ;; | |
1753 | |
1754 freebsd-aout) | |
1755 major=".$current" | |
1756 versuffix=".$current.$revision"; | |
1757 ;; | |
1758 | |
1759 freebsd-elf) | |
1760 major=".$current" | |
1761 versuffix=".$current"; | |
1762 ;; | |
1763 | |
1764 windows) | |
1765 # Like Linux, but with '-' rather than '.', since we only | |
1766 # want one extension on Windows 95. | |
1767 major=`expr $current - $age` | |
1768 versuffix="-$major-$age-$revision" | |
1769 ;; | |
1770 | |
1771 *) | |
1772 $echo "$modename: unknown library version type \`$version_type'" 1>&2 | |
1773 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 | |
1774 exit 1 | |
1775 ;; | |
1776 esac | |
1777 | |
1778 # Clear the version info if we defaulted, and they specified a release. | |
1779 if test -z "$vinfo" && test -n "$release"; then | |
1780 major= | |
1781 verstring="0.0" | |
1782 if test "$need_version" = no; then | |
1783 versuffix= | |
1784 else | |
1785 versuffix=".0.0" | |
1786 fi | |
1787 fi | |
1788 | |
1789 # Remove version info from name if versioning should be avoided | |
1790 if test "$avoid_version" = yes && test "$need_version" = no; then | |
1791 major= | |
1792 versuffix= | |
1793 verstring="" | |
1794 fi | |
1795 | |
1796 # Check to see if the archive will have undefined symbols. | |
1797 if test "$allow_undefined" = yes; then | |
1798 if test "$allow_undefined_flag" = unsupported; then | |
1799 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 | |
1800 build_libtool_libs=no | |
1801 build_old_libs=yes | |
1802 fi | |
1803 else | |
1804 # Don't allow undefined symbols. | |
1805 allow_undefined_flag="$no_undefined_flag" | |
1806 fi | |
1807 | |
1808 dependency_libs="$deplibs" | |
1809 case "$host" in | |
1810 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* ) | |
1811 # these systems don't actually have a c library (as such)! | |
1812 ;; | |
1813 *-*-rhapsody*) | |
1814 # rhapsody is a little odd... | |
1815 deplibs="$deplibs -framework System" | |
1816 ;; | |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1817 *-*-openbsd*) |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1818 # do not include libc due to us having libc/libc_r. |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
1819 ;; |
0 | 1820 *) |
1821 # Add libc to deplibs on all other systems. | |
1822 deplibs="$deplibs -lc" | |
1823 ;; | |
1824 esac | |
1825 fi | |
1826 | |
1827 # Create the output directory, or remove our outputs if we need to. | |
1828 if test -d $output_objdir; then | |
1829 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" | |
1830 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* | |
1831 else | |
1832 $show "$mkdir $output_objdir" | |
1833 $run $mkdir $output_objdir | |
1834 status=$? | |
1835 if test $status -ne 0 && test ! -d $output_objdir; then | |
1836 exit $status | |
1837 fi | |
1838 fi | |
1839 | |
1840 # Now set the variables for building old libraries. | |
1841 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then | |
1842 oldlibs="$oldlibs $output_objdir/$libname.$libext" | |
1843 | |
1844 # Transform .lo files to .o files. | |
1845 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` | |
1846 fi | |
1847 | |
1848 if test "$build_libtool_libs" = yes; then | |
1849 # Transform deplibs into only deplibs that can be linked in shared. | |
1850 name_save=$name | |
1851 libname_save=$libname | |
1852 release_save=$release | |
1853 versuffix_save=$versuffix | |
1854 major_save=$major | |
1855 # I'm not sure if I'm treating the release correctly. I think | |
1856 # release should show up in the -l (ie -lgmp5) so we don't want to | |
1857 # add it in twice. Is that correct? | |
1858 release="" | |
1859 versuffix="" | |
1860 major="" | |
1861 newdeplibs= | |
1862 droppeddeps=no | |
1863 case "$deplibs_check_method" in | |
1864 pass_all) | |
1865 # Don't check for shared/static. Everything works. | |
1866 # This might be a little naive. We might want to check | |
1867 # whether the library exists or not. But this is on | |
1868 # osf3 & osf4 and I'm not really sure... Just | |
1869 # implementing what was already the behaviour. | |
1870 newdeplibs=$deplibs | |
1871 ;; | |
1872 test_compile) | |
1873 # This code stresses the "libraries are programs" paradigm to its | |
1874 # limits. Maybe even breaks it. We compile a program, linking it | |
1875 # against the deplibs as a proxy for the library. Then we can check | |
1876 # whether they linked in statically or dynamically with ldd. | |
1877 $rm conftest.c | |
1878 cat > conftest.c <<EOF | |
1879 int main() { return 0; } | |
1880 EOF | |
1881 $rm conftest | |
1882 $CC -o conftest conftest.c $deplibs | |
1883 if test $? -eq 0 ; then | |
1884 ldd_output=`ldd conftest` | |
1885 for i in $deplibs; do | |
1886 name="`expr $i : '-l\(.*\)'`" | |
1887 # If $name is empty we are operating on a -L argument. | |
1888 if test "$name" != "" ; then | |
1889 libname=`eval \\$echo \"$libname_spec\"` | |
1890 deplib_matches=`eval \\$echo \"$library_names_spec\"` | |
1891 set dummy $deplib_matches | |
1892 deplib_match=$2 | |
1893 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | |
1894 newdeplibs="$newdeplibs $i" | |
1895 else | |
1896 droppeddeps=yes | |
1897 echo | |
1898 echo "*** Warning: This library needs some functionality provided by $i." | |
1899 echo "*** I have the capability to make that library automatically link in when" | |
1900 echo "*** you link to this library. But I can only do this if you have a" | |
1901 echo "*** shared version of the library, which you do not appear to have." | |
1902 fi | |
1903 else | |
1904 newdeplibs="$newdeplibs $i" | |
1905 fi | |
1906 done | |
1907 else | |
1908 # Error occured in the first compile. Let's try to salvage the situation: | |
1909 # Compile a seperate program for each library. | |
1910 for i in $deplibs; do | |
1911 name="`expr $i : '-l\(.*\)'`" | |
1912 # If $name is empty we are operating on a -L argument. | |
1913 if test "$name" != "" ; then | |
1914 $rm conftest | |
1915 $CC -o conftest conftest.c $i | |
1916 # Did it work? | |
1917 if test $? -eq 0 ; then | |
1918 ldd_output=`ldd conftest` | |
1919 libname=`eval \\$echo \"$libname_spec\"` | |
1920 deplib_matches=`eval \\$echo \"$library_names_spec\"` | |
1921 set dummy $deplib_matches | |
1922 deplib_match=$2 | |
1923 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | |
1924 newdeplibs="$newdeplibs $i" | |
1925 else | |
1926 droppeddeps=yes | |
1927 echo | |
1928 echo "*** Warning: This library needs some functionality provided by $i." | |
1929 echo "*** I have the capability to make that library automatically link in when" | |
1930 echo "*** you link to this library. But I can only do this if you have a" | |
1931 echo "*** shared version of the library, which you do not appear to have." | |
1932 fi | |
1933 else | |
1934 droppeddeps=yes | |
1935 echo | |
1936 echo "*** Warning! Library $i is needed by this library but I was not able to" | |
1937 echo "*** make it link in! You will probably need to install it or some" | |
1938 echo "*** library that it depends on before this library will be fully" | |
1939 echo "*** functional. Installing it before continuing would be even better." | |
1940 fi | |
1941 else | |
1942 newdeplibs="$newdeplibs $i" | |
1943 fi | |
1944 done | |
1945 fi | |
1946 ;; | |
1947 file_magic*) | |
1948 set dummy $deplibs_check_method | |
1949 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`" | |
1950 for a_deplib in $deplibs; do | |
1951 name="`expr $a_deplib : '-l\(.*\)'`" | |
1952 # If $name is empty we are operating on a -L argument. | |
1953 if test "$name" != "" ; then | |
1954 libname=`eval \\$echo \"$libname_spec\"` | |
1955 for i in $lib_search_path; do | |
1956 potential_libs=`ls $i/$libname[.-]* 2>/dev/null` | |
1957 for potent_lib in $potential_libs; do | |
1958 # Follow soft links. | |
1959 if ls -lLd "$potent_lib" 2>/dev/null \ | |
1960 | grep " -> " >/dev/null; then | |
1961 continue | |
1962 fi | |
1963 # The statement above tries to avoid entering an | |
1964 # endless loop below, in case of cyclic links. | |
1965 # We might still enter an endless loop, since a link | |
1966 # loop can be closed while we follow links, | |
1967 # but so what? | |
1968 potlib="$potent_lib" | |
1969 while test -h "$potlib" 2>/dev/null; do | |
1970 potliblink=`ls -ld $potlib | sed 's/.* -> //'` | |
1971 case "$potliblink" in | |
1972 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; | |
1973 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; | |
1974 esac | |
1975 done | |
1976 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | |
1977 | sed 10q \ | |
1978 | egrep "$file_magic_regex" > /dev/null; then | |
1979 newdeplibs="$newdeplibs $a_deplib" | |
1980 a_deplib="" | |
1981 break 2 | |
1982 fi | |
1983 done | |
1984 done | |
1985 if test -n "$a_deplib" ; then | |
1986 droppeddeps=yes | |
1987 echo | |
1988 echo "*** Warning: This library needs some functionality provided by $a_deplib." | |
1989 echo "*** I have the capability to make that library automatically link in when" | |
1990 echo "*** you link to this library. But I can only do this if you have a" | |
1991 echo "*** shared version of the library, which you do not appear to have." | |
1992 fi | |
1993 else | |
1994 # Add a -L argument. | |
1995 newdeplibs="$newdeplibs $a_deplib" | |
1996 fi | |
1997 done # Gone through all deplibs. | |
1998 ;; | |
1999 none | unknown | *) | |
2000 newdeplibs="" | |
2001 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ | |
2002 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | | |
2003 grep . >/dev/null; then | |
2004 echo | |
2005 if test "X$deplibs_check_method" = "Xnone"; then | |
2006 echo "*** Warning: inter-library dependencies are not supported in this platform." | |
2007 else | |
2008 echo "*** Warning: inter-library dependencies are not known to be supported." | |
2009 fi | |
2010 echo "*** All declared inter-library dependencies are being dropped." | |
2011 droppeddeps=yes | |
2012 fi | |
2013 ;; | |
2014 esac | |
2015 versuffix=$versuffix_save | |
2016 major=$major_save | |
2017 release=$release_save | |
2018 libname=$libname_save | |
2019 name=$name_save | |
2020 | |
2021 if test "$droppeddeps" = yes; then | |
2022 if test "$module" = yes; then | |
2023 echo | |
2024 echo "*** Warning: libtool could not satisfy all declared inter-library" | |
2025 echo "*** dependencies of module $libname. Therefore, libtool will create" | |
2026 echo "*** a static module, that should work as long as the dlopening" | |
2027 echo "*** application is linked with the -dlopen flag." | |
2028 if test -z "$global_symbol_pipe"; then | |
2029 echo | |
2030 echo "*** However, this would only work if libtool was able to extract symbol" | |
2031 echo "*** lists from a program, using \`nm' or equivalent, but libtool could" | |
2032 echo "*** not find such a program. So, this module is probably useless." | |
2033 echo "*** \`nm' from GNU binutils and a full rebuild may help." | |
2034 fi | |
2035 if test "$build_old_libs" = no; then | |
2036 oldlibs="$output_objdir/$libname.$libext" | |
2037 build_libtool_libs=module | |
2038 build_old_libs=yes | |
2039 else | |
2040 build_libtool_libs=no | |
2041 fi | |
2042 else | |
2043 echo "*** The inter-library dependencies that have been dropped here will be" | |
2044 echo "*** automatically added whenever a program is linked with this library" | |
2045 echo "*** or is declared to -dlopen it." | |
2046 fi | |
2047 fi | |
2048 # Done checking deplibs! | |
2049 deplibs=$newdeplibs | |
2050 fi | |
2051 | |
2052 # All the library-specific variables (install_libdir is set above). | |
2053 library_names= | |
2054 old_library= | |
2055 dlname= | |
2056 | |
2057 # Test again, we may have decided not to build it any more | |
2058 if test "$build_libtool_libs" = yes; then | |
2059 # Get the real and link names of the library. | |
2060 eval library_names=\"$library_names_spec\" | |
2061 set dummy $library_names | |
2062 realname="$2" | |
2063 shift; shift | |
2064 | |
2065 if test -n "$soname_spec"; then | |
2066 eval soname=\"$soname_spec\" | |
2067 else | |
2068 soname="$realname" | |
2069 fi | |
2070 | |
2071 lib="$output_objdir/$realname" | |
2072 for link | |
2073 do | |
2074 linknames="$linknames $link" | |
2075 done | |
2076 | |
2077 # Ensure that we have .o objects for linkers which dislike .lo | |
2078 # (e.g. aix) in case we are running --disable-static | |
2079 for obj in $libobjs; do | |
2080 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` | |
2081 if test "X$xdir" = "X$obj"; then | |
2082 xdir="." | |
2083 else | |
2084 xdir="$xdir" | |
2085 fi | |
2086 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` | |
2087 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` | |
2088 if test ! -f $xdir/$oldobj; then | |
2089 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" | |
2090 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? | |
2091 fi | |
2092 done | |
2093 | |
2094 # Use standard objects if they are pic | |
2095 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
2096 | |
2097 # Prepare the list of exported symbols | |
2098 if test -z "$export_symbols"; then | |
2099 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then | |
2100 $show "generating symbol list for \`$libname.la'" | |
2101 export_symbols="$output_objdir/$libname.exp" | |
2102 $run $rm $export_symbols | |
2103 eval cmds=\"$export_symbols_cmds\" | |
2104 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
2105 for cmd in $cmds; do | |
2106 IFS="$save_ifs" | |
2107 $show "$cmd" | |
2108 $run eval "$cmd" || exit $? | |
2109 done | |
2110 IFS="$save_ifs" | |
2111 if test -n "$export_symbols_regex"; then | |
2112 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" | |
2113 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' | |
2114 $show "$mv \"${export_symbols}T\" \"$export_symbols\"" | |
2115 $run eval '$mv "${export_symbols}T" "$export_symbols"' | |
2116 fi | |
2117 fi | |
2118 fi | |
2119 | |
2120 if test -n "$export_symbols" && test -n "$include_expsyms"; then | |
2121 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' | |
2122 fi | |
2123 | |
2124 if test -n "$convenience"; then | |
2125 if test -n "$whole_archive_flag_spec"; then | |
2126 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" | |
2127 else | |
2128 gentop="$output_objdir/${outputname}x" | |
2129 $show "${rm}r $gentop" | |
2130 $run ${rm}r "$gentop" | |
2131 $show "mkdir $gentop" | |
2132 $run mkdir "$gentop" | |
2133 status=$? | |
2134 if test $status -ne 0 && test ! -d "$gentop"; then | |
2135 exit $status | |
2136 fi | |
2137 generated="$generated $gentop" | |
2138 | |
2139 for xlib in $convenience; do | |
2140 # Extract the objects. | |
2141 case "$xlib" in | |
2142 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; | |
2143 *) xabs=`pwd`"/$xlib" ;; | |
2144 esac | |
2145 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` | |
2146 xdir="$gentop/$xlib" | |
2147 | |
2148 $show "${rm}r $xdir" | |
2149 $run ${rm}r "$xdir" | |
2150 $show "mkdir $xdir" | |
2151 $run mkdir "$xdir" | |
2152 status=$? | |
2153 if test $status -ne 0 && test ! -d "$xdir"; then | |
2154 exit $status | |
2155 fi | |
2156 $show "(cd $xdir && $AR x $xabs)" | |
2157 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? | |
2158 | |
2159 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` | |
2160 done | |
2161 fi | |
2162 fi | |
2163 | |
2164 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then | |
2165 eval flag=\"$thread_safe_flag_spec\" | |
2166 linkopts="$linkopts $flag" | |
2167 fi | |
2168 | |
2169 # Do each of the archive commands. | |
2170 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then | |
2171 eval cmds=\"$archive_expsym_cmds\" | |
2172 else | |
2173 eval cmds=\"$archive_cmds\" | |
2174 fi | |
2175 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
2176 for cmd in $cmds; do | |
2177 IFS="$save_ifs" | |
2178 $show "$cmd" | |
2179 $run eval "$cmd" || exit $? | |
2180 done | |
2181 IFS="$save_ifs" | |
2182 | |
2183 # Create links to the real library. | |
2184 for linkname in $linknames; do | |
2185 if test "$realname" != "$linkname"; then | |
2186 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" | |
2187 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? | |
2188 fi | |
2189 done | |
2190 | |
2191 # If -module or -export-dynamic was specified, set the dlname. | |
2192 if test "$module" = yes || test "$export_dynamic" = yes; then | |
2193 # On all known operating systems, these are identical. | |
2194 dlname="$soname" | |
2195 fi | |
2196 fi | |
2197 ;; | |
2198 | |
2199 *.lo | *.o | *.obj) | |
2200 if test -n "$link_against_libtool_libs"; then | |
2201 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 | |
2202 exit 1 | |
2203 fi | |
2204 | |
2205 if test -n "$deplibs"; then | |
2206 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 | |
2207 fi | |
2208 | |
2209 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | |
2210 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 | |
2211 fi | |
2212 | |
2213 if test -n "$rpath"; then | |
2214 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 | |
2215 fi | |
2216 | |
2217 if test -n "$xrpath"; then | |
2218 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 | |
2219 fi | |
2220 | |
2221 if test -n "$vinfo"; then | |
2222 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 | |
2223 fi | |
2224 | |
2225 if test -n "$release"; then | |
2226 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 | |
2227 fi | |
2228 | |
2229 case "$output" in | |
2230 *.lo) | |
2231 if test -n "$objs"; then | |
2232 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 | |
2233 exit 1 | |
2234 fi | |
2235 libobj="$output" | |
2236 obj=`$echo "X$output" | $Xsed -e "$lo2o"` | |
2237 ;; | |
2238 *) | |
2239 libobj= | |
2240 obj="$output" | |
2241 ;; | |
2242 esac | |
2243 | |
2244 # Delete the old objects. | |
2245 $run $rm $obj $libobj | |
2246 | |
2247 # Objects from convenience libraries. This assumes | |
2248 # single-version convenience libraries. Whenever we create | |
2249 # different ones for PIC/non-PIC, this we'll have to duplicate | |
2250 # the extraction. | |
2251 reload_conv_objs= | |
2252 gentop= | |
2253 # reload_cmds runs $LD directly, so let us get rid of | |
2254 # -Wl from whole_archive_flag_spec | |
2255 wl= | |
2256 | |
2257 if test -n "$convenience"; then | |
2258 if test -n "$whole_archive_flag_spec"; then | |
2259 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" | |
2260 else | |
2261 gentop="$output_objdir/${obj}x" | |
2262 $show "${rm}r $gentop" | |
2263 $run ${rm}r "$gentop" | |
2264 $show "mkdir $gentop" | |
2265 $run mkdir "$gentop" | |
2266 status=$? | |
2267 if test $status -ne 0 && test ! -d "$gentop"; then | |
2268 exit $status | |
2269 fi | |
2270 generated="$generated $gentop" | |
2271 | |
2272 for xlib in $convenience; do | |
2273 # Extract the objects. | |
2274 case "$xlib" in | |
2275 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; | |
2276 *) xabs=`pwd`"/$xlib" ;; | |
2277 esac | |
2278 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` | |
2279 xdir="$gentop/$xlib" | |
2280 | |
2281 $show "${rm}r $xdir" | |
2282 $run ${rm}r "$xdir" | |
2283 $show "mkdir $xdir" | |
2284 $run mkdir "$xdir" | |
2285 status=$? | |
2286 if test $status -ne 0 && test ! -d "$xdir"; then | |
2287 exit $status | |
2288 fi | |
2289 $show "(cd $xdir && $AR x $xabs)" | |
2290 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? | |
2291 | |
2292 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` | |
2293 done | |
2294 fi | |
2295 fi | |
2296 | |
2297 # Create the old-style object. | |
2298 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" | |
2299 | |
2300 output="$obj" | |
2301 eval cmds=\"$reload_cmds\" | |
2302 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
2303 for cmd in $cmds; do | |
2304 IFS="$save_ifs" | |
2305 $show "$cmd" | |
2306 $run eval "$cmd" || exit $? | |
2307 done | |
2308 IFS="$save_ifs" | |
2309 | |
2310 # Exit if we aren't doing a library object file. | |
2311 if test -z "$libobj"; then | |
2312 if test -n "$gentop"; then | |
2313 $show "${rm}r $gentop" | |
2314 $run ${rm}r $gentop | |
2315 fi | |
2316 | |
2317 exit 0 | |
2318 fi | |
2319 | |
2320 if test "$build_libtool_libs" != yes; then | |
2321 if test -n "$gentop"; then | |
2322 $show "${rm}r $gentop" | |
2323 $run ${rm}r $gentop | |
2324 fi | |
2325 | |
2326 # Create an invalid libtool object if no PIC, so that we don't | |
2327 # accidentally link it into a program. | |
2328 $show "echo timestamp > $libobj" | |
2329 $run eval "echo timestamp > $libobj" || exit $? | |
2330 exit 0 | |
2331 fi | |
2332 | |
2333 if test -n "$pic_flag"; then | |
2334 # Only do commands if we really have different PIC objects. | |
2335 reload_objs="$libobjs $reload_conv_objs" | |
2336 output="$libobj" | |
2337 eval cmds=\"$reload_cmds\" | |
2338 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
2339 for cmd in $cmds; do | |
2340 IFS="$save_ifs" | |
2341 $show "$cmd" | |
2342 $run eval "$cmd" || exit $? | |
2343 done | |
2344 IFS="$save_ifs" | |
2345 else | |
2346 # Just create a symlink. | |
2347 $show $rm $libobj | |
2348 $run $rm $libobj | |
2349 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` | |
2350 if test "X$xdir" = "X$libobj"; then | |
2351 xdir="." | |
2352 else | |
2353 xdir="$xdir" | |
2354 fi | |
2355 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` | |
2356 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` | |
2357 $show "(cd $xdir && $LN_S $oldobj $baseobj)" | |
2358 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? | |
2359 fi | |
2360 | |
2361 if test -n "$gentop"; then | |
2362 $show "${rm}r $gentop" | |
2363 $run ${rm}r $gentop | |
2364 fi | |
2365 | |
2366 exit 0 | |
2367 ;; | |
2368 | |
2369 # Anything else should be a program. | |
2370 *) | |
2371 if test -n "$vinfo"; then | |
2372 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 | |
2373 fi | |
2374 | |
2375 if test -n "$release"; then | |
2376 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 | |
2377 fi | |
2378 | |
2379 if test "$preload" = yes; then | |
2380 if test "$dlopen" = unknown && test "$dlopen_self" = unknown && | |
2381 test "$dlopen_self_static" = unknown; then | |
2382 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." | |
2383 fi | |
2384 fi | |
2385 | |
2386 if test -n "$rpath$xrpath"; then | |
2387 # If the user specified any rpath flags, then add them. | |
2388 for libdir in $rpath $xrpath; do | |
2389 # This is the magic to use -rpath. | |
2390 case "$compile_rpath " in | |
2391 *" $libdir "*) ;; | |
2392 *) compile_rpath="$compile_rpath $libdir" ;; | |
2393 esac | |
2394 case "$finalize_rpath " in | |
2395 *" $libdir "*) ;; | |
2396 *) finalize_rpath="$finalize_rpath $libdir" ;; | |
2397 esac | |
2398 done | |
2399 fi | |
2400 | |
2401 # Now hardcode the library paths | |
2402 rpath= | |
2403 hardcode_libdirs= | |
2404 for libdir in $compile_rpath $finalize_rpath; do | |
2405 if test -n "$hardcode_libdir_flag_spec"; then | |
2406 if test -n "$hardcode_libdir_separator"; then | |
2407 if test -z "$hardcode_libdirs"; then | |
2408 hardcode_libdirs="$libdir" | |
2409 else | |
2410 # Just accumulate the unique libdirs. | |
2411 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in | |
2412 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | |
2413 ;; | |
2414 *) | |
2415 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | |
2416 ;; | |
2417 esac | |
2418 fi | |
2419 else | |
2420 eval flag=\"$hardcode_libdir_flag_spec\" | |
2421 rpath="$rpath $flag" | |
2422 fi | |
2423 elif test -n "$runpath_var"; then | |
2424 case "$perm_rpath " in | |
2425 *" $libdir "*) ;; | |
2426 *) perm_rpath="$perm_rpath $libdir" ;; | |
2427 esac | |
2428 fi | |
2429 done | |
2430 # Substitute the hardcoded libdirs into the rpath. | |
2431 if test -n "$hardcode_libdir_separator" && | |
2432 test -n "$hardcode_libdirs"; then | |
2433 libdir="$hardcode_libdirs" | |
2434 eval rpath=\" $hardcode_libdir_flag_spec\" | |
2435 fi | |
2436 compile_rpath="$rpath" | |
2437 | |
2438 rpath= | |
2439 hardcode_libdirs= | |
2440 for libdir in $finalize_rpath; do | |
2441 if test -n "$hardcode_libdir_flag_spec"; then | |
2442 if test -n "$hardcode_libdir_separator"; then | |
2443 if test -z "$hardcode_libdirs"; then | |
2444 hardcode_libdirs="$libdir" | |
2445 else | |
2446 # Just accumulate the unique libdirs. | |
2447 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in | |
2448 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | |
2449 ;; | |
2450 *) | |
2451 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | |
2452 ;; | |
2453 esac | |
2454 fi | |
2455 else | |
2456 eval flag=\"$hardcode_libdir_flag_spec\" | |
2457 rpath="$rpath $flag" | |
2458 fi | |
2459 elif test -n "$runpath_var"; then | |
2460 case "$finalize_perm_rpath " in | |
2461 *" $libdir "*) ;; | |
2462 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; | |
2463 esac | |
2464 fi | |
2465 done | |
2466 # Substitute the hardcoded libdirs into the rpath. | |
2467 if test -n "$hardcode_libdir_separator" && | |
2468 test -n "$hardcode_libdirs"; then | |
2469 libdir="$hardcode_libdirs" | |
2470 eval rpath=\" $hardcode_libdir_flag_spec\" | |
2471 fi | |
2472 finalize_rpath="$rpath" | |
2473 | |
2474 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` | |
2475 if test "X$output_objdir" = "X$output"; then | |
2476 output_objdir="$objdir" | |
2477 else | |
2478 output_objdir="$output_objdir/$objdir" | |
2479 fi | |
2480 | |
2481 # Create the binary in the object directory, then wrap it. | |
2482 if test ! -d $output_objdir; then | |
2483 $show "$mkdir $output_objdir" | |
2484 $run $mkdir $output_objdir | |
2485 status=$? | |
2486 if test $status -ne 0 && test ! -d $output_objdir; then | |
2487 exit $status | |
2488 fi | |
2489 fi | |
2490 | |
2491 if test -n "$libobjs" && test "$build_old_libs" = yes; then | |
2492 # Transform all the library objects into standard objects. | |
2493 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
2494 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
2495 fi | |
2496 | |
2497 dlsyms= | |
2498 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | |
2499 if test -n "$NM" && test -n "$global_symbol_pipe"; then | |
2500 dlsyms="${outputname}S.c" | |
2501 else | |
2502 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 | |
2503 fi | |
2504 fi | |
2505 | |
2506 if test -n "$dlsyms"; then | |
2507 case "$dlsyms" in | |
2508 "") ;; | |
2509 *.c) | |
2510 # Discover the nlist of each of the dlfiles. | |
2511 nlist="$output_objdir/${outputname}.nm" | |
2512 | |
2513 $show "$rm $nlist ${nlist}S ${nlist}T" | |
2514 $run $rm "$nlist" "${nlist}S" "${nlist}T" | |
2515 | |
2516 # Parse the name list into a source file. | |
2517 $show "creating $output_objdir/$dlsyms" | |
2518 | |
2519 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ | |
2520 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ | |
2521 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ | |
2522 | |
2523 #ifdef __cplusplus | |
2524 extern \"C\" { | |
2525 #endif | |
2526 | |
2527 /* Prevent the only kind of declaration conflicts we can make. */ | |
2528 #define lt_preloaded_symbols some_other_symbol | |
2529 | |
2530 /* External symbol declarations for the compiler. */\ | |
2531 " | |
2532 | |
2533 if test "$dlself" = yes; then | |
2534 $show "generating symbol list for \`$output'" | |
2535 | |
2536 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" | |
2537 | |
2538 # Add our own program objects to the symbol list. | |
2539 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
2540 for arg in $progfiles; do | |
2541 $show "extracting global C symbols from \`$arg'" | |
2542 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" | |
2543 done | |
2544 | |
2545 if test -n "$exclude_expsyms"; then | |
2546 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' | |
2547 $run eval '$mv "$nlist"T "$nlist"' | |
2548 fi | |
2549 | |
2550 if test -n "$export_symbols_regex"; then | |
2551 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' | |
2552 $run eval '$mv "$nlist"T "$nlist"' | |
2553 fi | |
2554 | |
2555 # Prepare the list of exported symbols | |
2556 if test -z "$export_symbols"; then | |
2557 export_symbols="$output_objdir/$output.exp" | |
2558 $run $rm $export_symbols | |
2559 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' | |
2560 else | |
2561 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' | |
2562 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' | |
2563 $run eval 'mv "$nlist"T "$nlist"' | |
2564 fi | |
2565 fi | |
2566 | |
2567 for arg in $dlprefiles; do | |
2568 $show "extracting global C symbols from \`$arg'" | |
2569 name=`echo "$arg" | sed -e 's%^.*/%%'` | |
2570 $run eval 'echo ": $name " >> "$nlist"' | |
2571 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" | |
2572 done | |
2573 | |
2574 if test -z "$run"; then | |
2575 # Make sure we have at least an empty file. | |
2576 test -f "$nlist" || : > "$nlist" | |
2577 | |
2578 if test -n "$exclude_expsyms"; then | |
2579 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T | |
2580 $mv "$nlist"T "$nlist" | |
2581 fi | |
2582 | |
2583 # Try sorting and uniquifying the output. | |
2584 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then | |
2585 : | |
2586 else | |
2587 grep -v "^: " < "$nlist" > "$nlist"S | |
2588 fi | |
2589 | |
2590 if test -f "$nlist"S; then | |
2591 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' | |
2592 else | |
2593 echo '/* NONE */' >> "$output_objdir/$dlsyms" | |
2594 fi | |
2595 | |
2596 $echo >> "$output_objdir/$dlsyms" "\ | |
2597 | |
2598 #undef lt_preloaded_symbols | |
2599 | |
2600 #if defined (__STDC__) && __STDC__ | |
2601 # define lt_ptr_t void * | |
2602 #else | |
2603 # define lt_ptr_t char * | |
2604 # define const | |
2605 #endif | |
2606 | |
2607 /* The mapping between symbol names and symbols. */ | |
2608 const struct { | |
2609 const char *name; | |
2610 lt_ptr_t address; | |
2611 } | |
2612 lt_preloaded_symbols[] = | |
2613 {\ | |
2614 " | |
2615 | |
2616 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ | |
2617 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ | |
2618 < "$nlist" >> "$output_objdir/$dlsyms" | |
2619 | |
2620 $echo >> "$output_objdir/$dlsyms" "\ | |
2621 {0, (lt_ptr_t) 0} | |
2622 }; | |
2623 | |
2624 /* This works around a problem in FreeBSD linker */ | |
2625 #ifdef FREEBSD_WORKAROUND | |
2626 static const void *lt_preloaded_setup() { | |
2627 return lt_preloaded_symbols; | |
2628 } | |
2629 #endif | |
2630 | |
2631 #ifdef __cplusplus | |
2632 } | |
2633 #endif\ | |
2634 " | |
2635 fi | |
2636 | |
2637 pic_flag_for_symtable= | |
2638 case "$host" in | |
2639 # compiling the symbol table file with pic_flag works around | |
2640 # a FreeBSD bug that causes programs to crash when -lm is | |
2641 # linked before any other PIC object. But we must not use | |
2642 # pic_flag when linking with -static. The problem exists in | |
2643 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. | |
2644 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) | |
2645 case "$compile_command " in | |
2646 *" -static "*) ;; | |
2647 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; | |
2648 esac;; | |
2649 *-*-hpux*) | |
2650 case "$compile_command " in | |
2651 *" -static "*) ;; | |
2652 *) pic_flag_for_symtable=" $pic_flag -DPIC";; | |
2653 esac | |
2654 esac | |
2655 | |
2656 # Now compile the dynamic symbol file. | |
2657 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" | |
2658 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? | |
2659 | |
2660 # Clean up the generated files. | |
2661 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" | |
2662 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" | |
2663 | |
2664 # Transform the symbol file into the correct name. | |
2665 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` | |
2666 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` | |
2667 ;; | |
2668 *) | |
2669 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 | |
2670 exit 1 | |
2671 ;; | |
2672 esac | |
2673 else | |
2674 # We keep going just in case the user didn't refer to | |
2675 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe | |
2676 # really was required. | |
2677 | |
2678 # Nullify the symbol file. | |
2679 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` | |
2680 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` | |
2681 fi | |
2682 | |
2683 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then | |
2684 # Replace the output file specification. | |
2685 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` | |
2686 link_command="$compile_command$compile_rpath" | |
2687 | |
2688 # We have no uninstalled library dependencies, so finalize right now. | |
2689 $show "$link_command" | |
2690 $run eval "$link_command" | |
2691 status=$? | |
2692 | |
2693 # Delete the generated files. | |
2694 if test -n "$dlsyms"; then | |
2695 $show "$rm $output_objdir/${outputname}S.${objext}" | |
2696 $run $rm "$output_objdir/${outputname}S.${objext}" | |
2697 fi | |
2698 | |
2699 exit $status | |
2700 fi | |
2701 | |
2702 if test -n "$shlibpath_var"; then | |
2703 # We should set the shlibpath_var | |
2704 rpath= | |
2705 for dir in $temp_rpath; do | |
2706 case "$dir" in | |
2707 [\\/]* | [A-Za-z]:[\\/]*) | |
2708 # Absolute path. | |
2709 rpath="$rpath$dir:" | |
2710 ;; | |
2711 *) | |
2712 # Relative path: add a thisdir entry. | |
2713 rpath="$rpath\$thisdir/$dir:" | |
2714 ;; | |
2715 esac | |
2716 done | |
2717 temp_rpath="$rpath" | |
2718 fi | |
2719 | |
2720 if test -n "$compile_shlibpath$finalize_shlibpath"; then | |
2721 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" | |
2722 fi | |
2723 if test -n "$finalize_shlibpath"; then | |
2724 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" | |
2725 fi | |
2726 | |
2727 compile_var= | |
2728 finalize_var= | |
2729 if test -n "$runpath_var"; then | |
2730 if test -n "$perm_rpath"; then | |
2731 # We should set the runpath_var. | |
2732 rpath= | |
2733 for dir in $perm_rpath; do | |
2734 rpath="$rpath$dir:" | |
2735 done | |
2736 compile_var="$runpath_var=\"$rpath\$$runpath_var\" " | |
2737 fi | |
2738 if test -n "$finalize_perm_rpath"; then | |
2739 # We should set the runpath_var. | |
2740 rpath= | |
2741 for dir in $finalize_perm_rpath; do | |
2742 rpath="$rpath$dir:" | |
2743 done | |
2744 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " | |
2745 fi | |
2746 fi | |
2747 | |
2748 if test "$hardcode_action" = relink; then | |
2749 # Fast installation is not supported | |
2750 link_command="$compile_var$compile_command$compile_rpath" | |
2751 relink_command="$finalize_var$finalize_command$finalize_rpath" | |
2752 | |
2753 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 | |
2754 $echo "$modename: \`$output' will be relinked during installation" 1>&2 | |
2755 else | |
2756 if test "$fast_install" != no; then | |
2757 link_command="$finalize_var$compile_command$finalize_rpath" | |
2758 if test "$fast_install" = yes; then | |
2759 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` | |
2760 else | |
2761 # fast_install is set to needless | |
2762 relink_command= | |
2763 fi | |
2764 else | |
2765 link_command="$compile_var$compile_command$compile_rpath" | |
2766 relink_command="$finalize_var$finalize_command$finalize_rpath" | |
2767 fi | |
2768 fi | |
2769 | |
2770 # Replace the output file specification. | |
2771 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` | |
2772 | |
2773 # Delete the old output files. | |
2774 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname | |
2775 | |
2776 $show "$link_command" | |
2777 $run eval "$link_command" || exit $? | |
2778 | |
2779 # Now create the wrapper script. | |
2780 $show "creating $output" | |
2781 | |
2782 # Quote the relink command for shipping. | |
2783 if test -n "$relink_command"; then | |
2784 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` | |
2785 fi | |
2786 | |
2787 # Quote $echo for shipping. | |
2788 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then | |
2789 case "$0" in | |
2790 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; | |
2791 *) qecho="$SHELL `pwd`/$0 --fallback-echo";; | |
2792 esac | |
2793 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` | |
2794 else | |
2795 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` | |
2796 fi | |
2797 | |
2798 # Only actually do things if our run command is non-null. | |
2799 if test -z "$run"; then | |
2800 # win32 will think the script is a binary if it has | |
2801 # a .exe suffix, so we strip it off here. | |
2802 case $output in | |
2803 *.exe) output=`echo $output|sed 's,.exe$,,'` ;; | |
2804 esac | |
2805 $rm $output | |
2806 trap "$rm $output; exit 1" 1 2 15 | |
2807 | |
2808 $echo > $output "\ | |
2809 #! $SHELL | |
2810 | |
2811 # $output - temporary wrapper script for $objdir/$outputname | |
2812 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP | |
2813 # | |
2814 # The $output program cannot be directly executed until all the libtool | |
2815 # libraries that it depends on are installed. | |
2816 # | |
2817 # This wrapper script should never be moved out of the build directory. | |
2818 # If it is, it will not operate correctly. | |
2819 | |
2820 # Sed substitution that helps us do robust quoting. It backslashifies | |
2821 # metacharacters that are still active within double-quoted strings. | |
2822 Xsed='sed -e 1s/^X//' | |
2823 sed_quote_subst='$sed_quote_subst' | |
2824 | |
2825 # The HP-UX ksh and POSIX shell print the target directory to stdout | |
2826 # if CDPATH is set. | |
2827 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi | |
2828 | |
2829 relink_command=\"$relink_command\" | |
2830 | |
2831 # This environment variable determines our operation mode. | |
2832 if test \"\$libtool_install_magic\" = \"$magic\"; then | |
2833 # install mode needs the following variable: | |
2834 link_against_libtool_libs='$link_against_libtool_libs' | |
2835 else | |
2836 # When we are sourced in execute mode, \$file and \$echo are already set. | |
2837 if test \"\$libtool_execute_magic\" != \"$magic\"; then | |
2838 echo=\"$qecho\" | |
2839 file=\"\$0\" | |
2840 # Make sure echo works. | |
2841 if test \"X\$1\" = X--no-reexec; then | |
2842 # Discard the --no-reexec flag, and continue. | |
2843 shift | |
2844 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then | |
2845 # Yippee, \$echo works! | |
2846 : | |
2847 else | |
2848 # Restart under the correct shell, and then maybe \$echo will work. | |
2849 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} | |
2850 fi | |
2851 fi\ | |
2852 " | |
2853 $echo >> $output "\ | |
2854 | |
2855 # Find the directory that this script lives in. | |
2856 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` | |
2857 test \"x\$thisdir\" = \"x\$file\" && thisdir=. | |
2858 | |
2859 # Follow symbolic links until we get to the real thisdir. | |
2860 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` | |
2861 while test -n \"\$file\"; do | |
2862 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` | |
2863 | |
2864 # If there was a directory component, then change thisdir. | |
2865 if test \"x\$destdir\" != \"x\$file\"; then | |
2866 case \"\$destdir\" in | |
2867 [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; | |
2868 *) thisdir=\"\$thisdir/\$destdir\" ;; | |
2869 esac | |
2870 fi | |
2871 | |
2872 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` | |
2873 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` | |
2874 done | |
2875 | |
2876 # Try to get the absolute directory name. | |
2877 absdir=\`cd \"\$thisdir\" && pwd\` | |
2878 test -n \"\$absdir\" && thisdir=\"\$absdir\" | |
2879 " | |
2880 | |
2881 if test "$fast_install" = yes; then | |
2882 echo >> $output "\ | |
2883 program=lt-'$outputname' | |
2884 progdir=\"\$thisdir/$objdir\" | |
2885 | |
2886 if test ! -f \"\$progdir/\$program\" || \\ | |
2887 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ | |
2888 test \"X\$file\" != \"X\$progdir/\$program\"; }; then | |
2889 | |
2890 file=\"\$\$-\$program\" | |
2891 | |
2892 if test ! -d \"\$progdir\"; then | |
2893 $mkdir \"\$progdir\" | |
2894 else | |
2895 $rm \"\$progdir/\$file\" | |
2896 fi" | |
2897 | |
2898 echo >> $output "\ | |
2899 | |
2900 # relink executable if necessary | |
2901 if test -n \"\$relink_command\"; then | |
2902 if (cd \"\$thisdir\" && eval \$relink_command); then : | |
2903 else | |
2904 $rm \"\$progdir/\$file\" | |
2905 exit 1 | |
2906 fi | |
2907 fi | |
2908 | |
2909 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || | |
2910 { $rm \"\$progdir/\$program\"; | |
2911 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } | |
2912 $rm \"\$progdir/\$file\" | |
2913 fi" | |
2914 else | |
2915 echo >> $output "\ | |
2916 program='$outputname' | |
2917 progdir=\"\$thisdir/$objdir\" | |
2918 " | |
2919 fi | |
2920 | |
2921 echo >> $output "\ | |
2922 | |
2923 if test -f \"\$progdir/\$program\"; then" | |
2924 | |
2925 # Export our shlibpath_var if we have one. | |
2926 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then | |
2927 $echo >> $output "\ | |
2928 # Add our own library path to $shlibpath_var | |
2929 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" | |
2930 | |
2931 # Some systems cannot cope with colon-terminated $shlibpath_var | |
2932 # The second colon is a workaround for a bug in BeOS R4 sed | |
2933 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` | |
2934 | |
2935 export $shlibpath_var | |
2936 " | |
2937 fi | |
2938 | |
2939 # fixup the dll searchpath if we need to. | |
2940 if test -n "$dllsearchpath"; then | |
2941 $echo >> $output "\ | |
2942 # Add the dll search path components to the executable PATH | |
2943 PATH=$dllsearchpath:\$PATH | |
2944 " | |
2945 fi | |
2946 | |
2947 $echo >> $output "\ | |
2948 if test \"\$libtool_execute_magic\" != \"$magic\"; then | |
2949 # Run the actual program with our arguments. | |
2950 " | |
2951 case $host in | |
2952 # win32 systems need to use the prog path for dll | |
2953 # lookup to work | |
2954 *-*-cygwin*) | |
2955 $echo >> $output "\ | |
2956 exec \$progdir/\$program \${1+\"\$@\"} | |
2957 " | |
2958 ;; | |
2959 | |
2960 # Backslashes separate directories on plain windows | |
2961 *-*-mingw | *-*-os2*) | |
2962 $echo >> $output "\ | |
2963 exec \$progdir\\\\\$program \${1+\"\$@\"} | |
2964 " | |
2965 ;; | |
2966 | |
2967 *) | |
2968 $echo >> $output "\ | |
2969 # Export the path to the program. | |
2970 PATH=\"\$progdir:\$PATH\" | |
2971 export PATH | |
2972 | |
2973 exec \$program \${1+\"\$@\"} | |
2974 " | |
2975 ;; | |
2976 esac | |
2977 $echo >> $output "\ | |
2978 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" | |
2979 exit 1 | |
2980 fi | |
2981 else | |
2982 # The program doesn't exist. | |
2983 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 | |
2984 \$echo \"This script is just a wrapper for \$program.\" 1>&2 | |
2985 echo \"See the $PACKAGE documentation for more information.\" 1>&2 | |
2986 exit 1 | |
2987 fi | |
2988 fi\ | |
2989 " | |
2990 chmod +x $output | |
2991 fi | |
2992 exit 0 | |
2993 ;; | |
2994 esac | |
2995 | |
2996 # See if we need to build an old-fashioned archive. | |
2997 for oldlib in $oldlibs; do | |
2998 | |
2999 if test "$build_libtool_libs" = convenience; then | |
3000 oldobjs="$libobjs_save" | |
3001 addlibs="$convenience" | |
3002 build_libtool_libs=no | |
3003 else | |
3004 if test "$build_libtool_libs" = module; then | |
3005 oldobjs="$libobjs_save" | |
3006 build_libtool_libs=no | |
3007 else | |
3008 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` | |
3009 fi | |
3010 addlibs="$old_convenience" | |
3011 fi | |
3012 | |
3013 if test -n "$addlibs"; then | |
3014 gentop="$output_objdir/${outputname}x" | |
3015 $show "${rm}r $gentop" | |
3016 $run ${rm}r "$gentop" | |
3017 $show "mkdir $gentop" | |
3018 $run mkdir "$gentop" | |
3019 status=$? | |
3020 if test $status -ne 0 && test ! -d "$gentop"; then | |
3021 exit $status | |
3022 fi | |
3023 generated="$generated $gentop" | |
3024 | |
3025 # Add in members from convenience archives. | |
3026 for xlib in $addlibs; do | |
3027 # Extract the objects. | |
3028 case "$xlib" in | |
3029 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; | |
3030 *) xabs=`pwd`"/$xlib" ;; | |
3031 esac | |
3032 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` | |
3033 xdir="$gentop/$xlib" | |
3034 | |
3035 $show "${rm}r $xdir" | |
3036 $run ${rm}r "$xdir" | |
3037 $show "mkdir $xdir" | |
3038 $run mkdir "$xdir" | |
3039 status=$? | |
3040 if test $status -ne 0 && test ! -d "$xdir"; then | |
3041 exit $status | |
3042 fi | |
3043 $show "(cd $xdir && $AR x $xabs)" | |
3044 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? | |
3045 | |
3046 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` | |
3047 done | |
3048 fi | |
3049 | |
3050 # Do each command in the archive commands. | |
3051 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then | |
3052 eval cmds=\"$old_archive_from_new_cmds\" | |
3053 else | |
3054 # Ensure that we have .o objects in place in case we decided | |
3055 # not to build a shared library, and have fallen back to building | |
3056 # static libs even though --disable-static was passed! | |
3057 for oldobj in $oldobjs; do | |
3058 if test ! -f $oldobj; then | |
3059 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` | |
3060 if test "X$xdir" = "X$oldobj"; then | |
3061 xdir="." | |
3062 else | |
3063 xdir="$xdir" | |
3064 fi | |
3065 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` | |
3066 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` | |
3067 $show "(cd $xdir && ${LN_S} $obj $baseobj)" | |
3068 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? | |
3069 fi | |
3070 done | |
3071 | |
3072 eval cmds=\"$old_archive_cmds\" | |
3073 fi | |
3074 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3075 for cmd in $cmds; do | |
3076 IFS="$save_ifs" | |
3077 $show "$cmd" | |
3078 $run eval "$cmd" || exit $? | |
3079 done | |
3080 IFS="$save_ifs" | |
3081 done | |
3082 | |
3083 if test -n "$generated"; then | |
3084 $show "${rm}r$generated" | |
3085 $run ${rm}r$generated | |
3086 fi | |
3087 | |
3088 # Now create the libtool archive. | |
3089 case "$output" in | |
3090 *.la) | |
3091 old_library= | |
3092 test "$build_old_libs" = yes && old_library="$libname.$libext" | |
3093 $show "creating $output" | |
3094 | |
3095 if test -n "$xrpath"; then | |
3096 temp_xrpath= | |
3097 for libdir in $xrpath; do | |
3098 temp_xrpath="$temp_xrpath -R$libdir" | |
3099 done | |
3100 dependency_libs="$temp_xrpath $dependency_libs" | |
3101 fi | |
3102 | |
3103 # Only create the output if not a dry run. | |
3104 if test -z "$run"; then | |
3105 for installed in no yes; do | |
3106 if test "$installed" = yes; then | |
3107 if test -z "$install_libdir"; then | |
3108 break | |
3109 fi | |
3110 output="$output_objdir/$outputname"i | |
3111 fi | |
3112 $rm $output | |
3113 $echo > $output "\ | |
3114 # $outputname - a libtool library file | |
3115 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP | |
3116 # | |
3117 # Please DO NOT delete this file! | |
3118 # It is necessary for linking the library. | |
3119 | |
3120 # The name that we can dlopen(3). | |
3121 dlname='$dlname' | |
3122 | |
3123 # Names of this library. | |
3124 library_names='$library_names' | |
3125 | |
3126 # The name of the static archive. | |
3127 old_library='$old_library' | |
3128 | |
3129 # Libraries that this one depends upon. | |
3130 dependency_libs='$dependency_libs' | |
3131 | |
3132 # Version information for $libname. | |
3133 current=$current | |
3134 age=$age | |
3135 revision=$revision | |
3136 | |
3137 # Is this an already installed library? | |
3138 installed=$installed | |
3139 | |
3140 # Directory that this library needs to be installed in: | |
3141 libdir='$install_libdir'\ | |
3142 " | |
3143 done | |
3144 fi | |
3145 | |
3146 # Do a symbolic link so that the libtool archive can be found in | |
3147 # LD_LIBRARY_PATH before the program is installed. | |
3148 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" | |
3149 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? | |
3150 ;; | |
3151 esac | |
3152 exit 0 | |
3153 ;; | |
3154 | |
3155 # libtool install mode | |
3156 install) | |
3157 modename="$modename: install" | |
3158 | |
3159 # There may be an optional sh(1) argument at the beginning of | |
3160 # install_prog (especially on Windows NT). | |
3161 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then | |
3162 # Aesthetically quote it. | |
3163 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` | |
3164 case "$arg" in | |
3165 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) | |
3166 arg="\"$arg\"" | |
3167 ;; | |
3168 esac | |
3169 install_prog="$arg " | |
3170 arg="$1" | |
3171 shift | |
3172 else | |
3173 install_prog= | |
3174 arg="$nonopt" | |
3175 fi | |
3176 | |
3177 # The real first argument should be the name of the installation program. | |
3178 # Aesthetically quote it. | |
3179 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
3180 case "$arg" in | |
3181 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) | |
3182 arg="\"$arg\"" | |
3183 ;; | |
3184 esac | |
3185 install_prog="$install_prog$arg" | |
3186 | |
3187 # We need to accept at least all the BSD install flags. | |
3188 dest= | |
3189 files= | |
3190 opts= | |
3191 prev= | |
3192 install_type= | |
3193 isdir=no | |
3194 stripme= | |
3195 for arg | |
3196 do | |
3197 if test -n "$dest"; then | |
3198 files="$files $dest" | |
3199 dest="$arg" | |
3200 continue | |
3201 fi | |
3202 | |
3203 case "$arg" in | |
3204 -d) isdir=yes ;; | |
3205 -f) prev="-f" ;; | |
3206 -g) prev="-g" ;; | |
3207 -m) prev="-m" ;; | |
3208 -o) prev="-o" ;; | |
3209 -s) | |
3210 stripme=" -s" | |
3211 continue | |
3212 ;; | |
3213 -*) ;; | |
3214 | |
3215 *) | |
3216 # If the previous option needed an argument, then skip it. | |
3217 if test -n "$prev"; then | |
3218 prev= | |
3219 else | |
3220 dest="$arg" | |
3221 continue | |
3222 fi | |
3223 ;; | |
3224 esac | |
3225 | |
3226 # Aesthetically quote the argument. | |
3227 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | |
3228 case "$arg" in | |
3229 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) | |
3230 arg="\"$arg\"" | |
3231 ;; | |
3232 esac | |
3233 install_prog="$install_prog $arg" | |
3234 done | |
3235 | |
3236 if test -z "$install_prog"; then | |
3237 $echo "$modename: you must specify an install program" 1>&2 | |
3238 $echo "$help" 1>&2 | |
3239 exit 1 | |
3240 fi | |
3241 | |
3242 if test -n "$prev"; then | |
3243 $echo "$modename: the \`$prev' option requires an argument" 1>&2 | |
3244 $echo "$help" 1>&2 | |
3245 exit 1 | |
3246 fi | |
3247 | |
3248 if test -z "$files"; then | |
3249 if test -z "$dest"; then | |
3250 $echo "$modename: no file or destination specified" 1>&2 | |
3251 else | |
3252 $echo "$modename: you must specify a destination" 1>&2 | |
3253 fi | |
3254 $echo "$help" 1>&2 | |
3255 exit 1 | |
3256 fi | |
3257 | |
3258 # Strip any trailing slash from the destination. | |
3259 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` | |
3260 | |
3261 # Check to see that the destination is a directory. | |
3262 test -d "$dest" && isdir=yes | |
3263 if test "$isdir" = yes; then | |
3264 destdir="$dest" | |
3265 destname= | |
3266 else | |
3267 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` | |
3268 test "X$destdir" = "X$dest" && destdir=. | |
3269 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` | |
3270 | |
3271 # Not a directory, so check to see that there is only one file specified. | |
3272 set dummy $files | |
3273 if test $# -gt 2; then | |
3274 $echo "$modename: \`$dest' is not a directory" 1>&2 | |
3275 $echo "$help" 1>&2 | |
3276 exit 1 | |
3277 fi | |
3278 fi | |
3279 case "$destdir" in | |
3280 [\\/]* | [A-Za-z]:[\\/]*) ;; | |
3281 *) | |
3282 for file in $files; do | |
3283 case "$file" in | |
3284 *.lo) ;; | |
3285 *) | |
3286 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 | |
3287 $echo "$help" 1>&2 | |
3288 exit 1 | |
3289 ;; | |
3290 esac | |
3291 done | |
3292 ;; | |
3293 esac | |
3294 | |
3295 # This variable tells wrapper scripts just to set variables rather | |
3296 # than running their programs. | |
3297 libtool_install_magic="$magic" | |
3298 | |
3299 staticlibs= | |
3300 future_libdirs= | |
3301 current_libdirs= | |
3302 for file in $files; do | |
3303 | |
3304 # Do each installation. | |
3305 case "$file" in | |
3306 *.a | *.lib) | |
3307 # Do the static libraries later. | |
3308 staticlibs="$staticlibs $file" | |
3309 ;; | |
3310 | |
3311 *.la) | |
3312 # Check to see that this really is a libtool archive. | |
3313 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : | |
3314 else | |
3315 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 | |
3316 $echo "$help" 1>&2 | |
3317 exit 1 | |
3318 fi | |
3319 | |
3320 library_names= | |
3321 old_library= | |
3322 # If there is no directory component, then add one. | |
3323 case "$file" in | |
3324 */* | *\\*) . $file ;; | |
3325 *) . ./$file ;; | |
3326 esac | |
3327 | |
3328 # Add the libdir to current_libdirs if it is the destination. | |
3329 if test "X$destdir" = "X$libdir"; then | |
3330 case "$current_libdirs " in | |
3331 *" $libdir "*) ;; | |
3332 *) current_libdirs="$current_libdirs $libdir" ;; | |
3333 esac | |
3334 else | |
3335 # Note the libdir as a future libdir. | |
3336 case "$future_libdirs " in | |
3337 *" $libdir "*) ;; | |
3338 *) future_libdirs="$future_libdirs $libdir" ;; | |
3339 esac | |
3340 fi | |
3341 | |
3342 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" | |
3343 test "X$dir" = "X$file/" && dir= | |
3344 dir="$dir$objdir" | |
3345 | |
3346 # See the names of the shared library. | |
3347 set dummy $library_names | |
3348 if test -n "$2"; then | |
3349 realname="$2" | |
3350 shift | |
3351 shift | |
3352 | |
3353 # Install the shared library and build the symlinks. | |
3354 $show "$install_prog $dir/$realname $destdir/$realname" | |
3355 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? | |
3356 | |
3357 if test $# -gt 0; then | |
3358 # Delete the old symlinks, and create new ones. | |
3359 for linkname | |
3360 do | |
3361 if test "$linkname" != "$realname"; then | |
3362 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" | |
3363 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" | |
3364 fi | |
3365 done | |
3366 fi | |
3367 | |
3368 # Do each command in the postinstall commands. | |
3369 lib="$destdir/$realname" | |
3370 eval cmds=\"$postinstall_cmds\" | |
3371 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3372 for cmd in $cmds; do | |
3373 IFS="$save_ifs" | |
3374 $show "$cmd" | |
3375 $run eval "$cmd" || exit $? | |
3376 done | |
3377 IFS="$save_ifs" | |
3378 fi | |
3379 | |
3380 # Install the pseudo-library for information purposes. | |
3381 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
3382 instname="$dir/$name"i | |
3383 $show "$install_prog $instname $destdir/$name" | |
3384 $run eval "$install_prog $instname $destdir/$name" || exit $? | |
3385 | |
3386 # Maybe install the static library, too. | |
3387 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" | |
3388 ;; | |
3389 | |
3390 *.lo) | |
3391 # Install (i.e. copy) a libtool object. | |
3392 | |
3393 # Figure out destination file name, if it wasn't already specified. | |
3394 if test -n "$destname"; then | |
3395 destfile="$destdir/$destname" | |
3396 else | |
3397 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
3398 destfile="$destdir/$destfile" | |
3399 fi | |
3400 | |
3401 # Deduce the name of the destination old-style object file. | |
3402 case "$destfile" in | |
3403 *.lo) | |
3404 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` | |
3405 ;; | |
3406 *.o | *.obj) | |
3407 staticdest="$destfile" | |
3408 destfile= | |
3409 ;; | |
3410 *) | |
3411 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 | |
3412 $echo "$help" 1>&2 | |
3413 exit 1 | |
3414 ;; | |
3415 esac | |
3416 | |
3417 # Install the libtool object if requested. | |
3418 if test -n "$destfile"; then | |
3419 $show "$install_prog $file $destfile" | |
3420 $run eval "$install_prog $file $destfile" || exit $? | |
3421 fi | |
3422 | |
3423 # Install the old object if enabled. | |
3424 if test "$build_old_libs" = yes; then | |
3425 # Deduce the name of the old-style object file. | |
3426 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` | |
3427 | |
3428 $show "$install_prog $staticobj $staticdest" | |
3429 $run eval "$install_prog \$staticobj \$staticdest" || exit $? | |
3430 fi | |
3431 exit 0 | |
3432 ;; | |
3433 | |
3434 *) | |
3435 # Figure out destination file name, if it wasn't already specified. | |
3436 if test -n "$destname"; then | |
3437 destfile="$destdir/$destname" | |
3438 else | |
3439 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
3440 destfile="$destdir/$destfile" | |
3441 fi | |
3442 | |
3443 # Do a test to see if this is really a libtool program. | |
3444 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
3445 link_against_libtool_libs= | |
3446 relink_command= | |
3447 | |
3448 # If there is no directory component, then add one. | |
3449 case "$file" in | |
3450 */* | *\\*) . $file ;; | |
3451 *) . ./$file ;; | |
3452 esac | |
3453 | |
3454 # Check the variables that should have been set. | |
3455 if test -z "$link_against_libtool_libs"; then | |
3456 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 | |
3457 exit 1 | |
3458 fi | |
3459 | |
3460 finalize=yes | |
3461 for lib in $link_against_libtool_libs; do | |
3462 # Check to see that each library is installed. | |
3463 libdir= | |
3464 if test -f "$lib"; then | |
3465 # If there is no directory component, then add one. | |
3466 case "$lib" in | |
3467 */* | *\\*) . $lib ;; | |
3468 *) . ./$lib ;; | |
3469 esac | |
3470 fi | |
3471 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" | |
3472 if test -n "$libdir" && test ! -f "$libfile"; then | |
3473 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 | |
3474 finalize=no | |
3475 fi | |
3476 done | |
3477 | |
3478 outputname= | |
3479 if test "$fast_install" = no && test -n "$relink_command"; then | |
3480 if test "$finalize" = yes && test -z "$run"; then | |
3481 tmpdir="/tmp" | |
3482 test -n "$TMPDIR" && tmpdir="$TMPDIR" | |
3483 tmpdir="$tmpdir/libtool-$$" | |
3484 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : | |
3485 else | |
3486 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 | |
3487 continue | |
3488 fi | |
3489 outputname="$tmpdir/$file" | |
3490 # Replace the output file specification. | |
3491 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` | |
3492 | |
3493 $show "$relink_command" | |
3494 if $run eval "$relink_command"; then : | |
3495 else | |
3496 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 | |
3497 ${rm}r "$tmpdir" | |
3498 continue | |
3499 fi | |
3500 file="$outputname" | |
3501 else | |
3502 $echo "$modename: warning: cannot relink \`$file'" 1>&2 | |
3503 fi | |
3504 else | |
3505 # Install the binary that we compiled earlier. | |
3506 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` | |
3507 fi | |
3508 fi | |
3509 | |
3510 $show "$install_prog$stripme $file $destfile" | |
3511 $run eval "$install_prog\$stripme \$file \$destfile" || exit $? | |
3512 test -n "$outputname" && ${rm}r "$tmpdir" | |
3513 ;; | |
3514 esac | |
3515 done | |
3516 | |
3517 for file in $staticlibs; do | |
3518 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
3519 | |
3520 # Set up the ranlib parameters. | |
3521 oldlib="$destdir/$name" | |
3522 | |
3523 $show "$install_prog $file $oldlib" | |
3524 $run eval "$install_prog \$file \$oldlib" || exit $? | |
3525 | |
3526 # Do each command in the postinstall commands. | |
3527 eval cmds=\"$old_postinstall_cmds\" | |
3528 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3529 for cmd in $cmds; do | |
3530 IFS="$save_ifs" | |
3531 $show "$cmd" | |
3532 $run eval "$cmd" || exit $? | |
3533 done | |
3534 IFS="$save_ifs" | |
3535 done | |
3536 | |
3537 if test -n "$future_libdirs"; then | |
3538 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 | |
3539 fi | |
3540 | |
3541 if test -n "$current_libdirs"; then | |
3542 # Maybe just do a dry run. | |
3543 test -n "$run" && current_libdirs=" -n$current_libdirs" | |
3544 exec $SHELL $0 --finish$current_libdirs | |
3545 exit 1 | |
3546 fi | |
3547 | |
3548 exit 0 | |
3549 ;; | |
3550 | |
3551 # libtool finish mode | |
3552 finish) | |
3553 modename="$modename: finish" | |
3554 libdirs="$nonopt" | |
3555 admincmds= | |
3556 | |
3557 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then | |
3558 for dir | |
3559 do | |
3560 libdirs="$libdirs $dir" | |
3561 done | |
3562 | |
3563 for libdir in $libdirs; do | |
3564 if test -n "$finish_cmds"; then | |
3565 # Do each command in the finish commands. | |
3566 eval cmds=\"$finish_cmds\" | |
3567 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3568 for cmd in $cmds; do | |
3569 IFS="$save_ifs" | |
3570 $show "$cmd" | |
3571 $run eval "$cmd" || admincmds="$admincmds | |
3572 $cmd" | |
3573 done | |
3574 IFS="$save_ifs" | |
3575 fi | |
3576 if test -n "$finish_eval"; then | |
3577 # Do the single finish_eval. | |
3578 eval cmds=\"$finish_eval\" | |
3579 $run eval "$cmds" || admincmds="$admincmds | |
3580 $cmds" | |
3581 fi | |
3582 done | |
3583 fi | |
3584 | |
3585 # Exit here if they wanted silent mode. | |
3586 test "$show" = : && exit 0 | |
3587 | |
3588 echo "----------------------------------------------------------------------" | |
3589 echo "Libraries have been installed in:" | |
3590 for libdir in $libdirs; do | |
3591 echo " $libdir" | |
3592 done | |
3593 echo | |
3594 echo "If you ever happen to want to link against installed libraries" | |
3595 echo "in a given directory, LIBDIR, you must either use libtool, and" | |
3596 echo "specify the full pathname of the library, or use \`-LLIBDIR'" | |
3597 echo "flag during linking and do at least one of the following:" | |
3598 if test -n "$shlibpath_var"; then | |
3599 echo " - add LIBDIR to the \`$shlibpath_var' environment variable" | |
3600 echo " during execution" | |
3601 fi | |
3602 if test -n "$runpath_var"; then | |
3603 echo " - add LIBDIR to the \`$runpath_var' environment variable" | |
3604 echo " during linking" | |
3605 fi | |
3606 if test -n "$hardcode_libdir_flag_spec"; then | |
3607 libdir=LIBDIR | |
3608 eval flag=\"$hardcode_libdir_flag_spec\" | |
3609 | |
3610 echo " - use the \`$flag' linker flag" | |
3611 fi | |
3612 if test -n "$admincmds"; then | |
3613 echo " - have your system administrator run these commands:$admincmds" | |
3614 fi | |
3615 if test -f /etc/ld.so.conf; then | |
3616 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" | |
3617 fi | |
3618 echo | |
3619 echo "See any operating system documentation about shared libraries for" | |
3620 echo "more information, such as the ld(1) and ld.so(8) manual pages." | |
3621 echo "----------------------------------------------------------------------" | |
3622 exit 0 | |
3623 ;; | |
3624 | |
3625 # libtool execute mode | |
3626 execute) | |
3627 modename="$modename: execute" | |
3628 | |
3629 # The first argument is the command name. | |
3630 cmd="$nonopt" | |
3631 if test -z "$cmd"; then | |
3632 $echo "$modename: you must specify a COMMAND" 1>&2 | |
3633 $echo "$help" | |
3634 exit 1 | |
3635 fi | |
3636 | |
3637 # Handle -dlopen flags immediately. | |
3638 for file in $execute_dlfiles; do | |
3639 if test ! -f "$file"; then | |
3640 $echo "$modename: \`$file' is not a file" 1>&2 | |
3641 $echo "$help" 1>&2 | |
3642 exit 1 | |
3643 fi | |
3644 | |
3645 dir= | |
3646 case "$file" in | |
3647 *.la) | |
3648 # Check to see that this really is a libtool archive. | |
3649 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : | |
3650 else | |
3651 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 | |
3652 $echo "$help" 1>&2 | |
3653 exit 1 | |
3654 fi | |
3655 | |
3656 # Read the libtool library. | |
3657 dlname= | |
3658 library_names= | |
3659 | |
3660 # If there is no directory component, then add one. | |
3661 case "$file" in | |
3662 */* | *\\*) . $file ;; | |
3663 *) . ./$file ;; | |
3664 esac | |
3665 | |
3666 # Skip this library if it cannot be dlopened. | |
3667 if test -z "$dlname"; then | |
3668 # Warn if it was a shared library. | |
3669 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" | |
3670 continue | |
3671 fi | |
3672 | |
3673 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` | |
3674 test "X$dir" = "X$file" && dir=. | |
3675 | |
3676 if test -f "$dir/$objdir/$dlname"; then | |
3677 dir="$dir/$objdir" | |
3678 else | |
3679 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 | |
3680 exit 1 | |
3681 fi | |
3682 ;; | |
3683 | |
3684 *.lo) | |
3685 # Just add the directory containing the .lo file. | |
3686 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` | |
3687 test "X$dir" = "X$file" && dir=. | |
3688 ;; | |
3689 | |
3690 *) | |
3691 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 | |
3692 continue | |
3693 ;; | |
3694 esac | |
3695 | |
3696 # Get the absolute pathname. | |
3697 absdir=`cd "$dir" && pwd` | |
3698 test -n "$absdir" && dir="$absdir" | |
3699 | |
3700 # Now add the directory to shlibpath_var. | |
3701 if eval "test -z \"\$$shlibpath_var\""; then | |
3702 eval "$shlibpath_var=\"\$dir\"" | |
3703 else | |
3704 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" | |
3705 fi | |
3706 done | |
3707 | |
3708 # This variable tells wrapper scripts just to set shlibpath_var | |
3709 # rather than running their programs. | |
3710 libtool_execute_magic="$magic" | |
3711 | |
3712 # Check if any of the arguments is a wrapper script. | |
3713 args= | |
3714 for file | |
3715 do | |
3716 case "$file" in | |
3717 -*) ;; | |
3718 *) | |
3719 # Do a test to see if this is really a libtool program. | |
3720 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
3721 # If there is no directory component, then add one. | |
3722 case "$file" in | |
3723 */* | *\\*) . $file ;; | |
3724 *) . ./$file ;; | |
3725 esac | |
3726 | |
3727 # Transform arg to wrapped name. | |
3728 file="$progdir/$program" | |
3729 fi | |
3730 ;; | |
3731 esac | |
3732 # Quote arguments (to preserve shell metacharacters). | |
3733 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` | |
3734 args="$args \"$file\"" | |
3735 done | |
3736 | |
3737 if test -z "$run"; then | |
3738 if test -n "$shlibpath_var"; then | |
3739 # Export the shlibpath_var. | |
3740 eval "export $shlibpath_var" | |
3741 fi | |
3742 | |
3743 # Restore saved enviroment variables | |
3744 if test "${save_LC_ALL+set}" = set; then | |
3745 LC_ALL="$save_LC_ALL"; export LC_ALL | |
3746 fi | |
3747 if test "${save_LANG+set}" = set; then | |
3748 LANG="$save_LANG"; export LANG | |
3749 fi | |
3750 | |
3751 # Now actually exec the command. | |
3752 eval "exec \$cmd$args" | |
3753 | |
3754 $echo "$modename: cannot exec \$cmd$args" | |
3755 exit 1 | |
3756 else | |
3757 # Display what would be done. | |
3758 if test -n "$shlibpath_var"; then | |
3759 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" | |
3760 $echo "export $shlibpath_var" | |
3761 fi | |
3762 $echo "$cmd$args" | |
3763 exit 0 | |
3764 fi | |
3765 ;; | |
3766 | |
3767 # libtool uninstall mode | |
3768 uninstall) | |
3769 modename="$modename: uninstall" | |
3770 rm="$nonopt" | |
3771 files= | |
3772 | |
3773 for arg | |
3774 do | |
3775 case "$arg" in | |
3776 -*) rm="$rm $arg" ;; | |
3777 *) files="$files $arg" ;; | |
3778 esac | |
3779 done | |
3780 | |
3781 if test -z "$rm"; then | |
3782 $echo "$modename: you must specify an RM program" 1>&2 | |
3783 $echo "$help" 1>&2 | |
3784 exit 1 | |
3785 fi | |
3786 | |
3787 for file in $files; do | |
3788 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` | |
3789 test "X$dir" = "X$file" && dir=. | |
3790 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` | |
3791 | |
3792 rmfiles="$file" | |
3793 | |
3794 case "$name" in | |
3795 *.la) | |
3796 # Possibly a libtool archive, so verify it. | |
3797 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | |
3798 . $dir/$name | |
3799 | |
3800 # Delete the libtool libraries and symlinks. | |
3801 for n in $library_names; do | |
3802 rmfiles="$rmfiles $dir/$n" | |
3803 done | |
3804 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" | |
3805 | |
3806 $show "$rm $rmfiles" | |
3807 $run $rm $rmfiles | |
3808 | |
3809 if test -n "$library_names"; then | |
3810 # Do each command in the postuninstall commands. | |
3811 eval cmds=\"$postuninstall_cmds\" | |
3812 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3813 for cmd in $cmds; do | |
3814 IFS="$save_ifs" | |
3815 $show "$cmd" | |
3816 $run eval "$cmd" | |
3817 done | |
3818 IFS="$save_ifs" | |
3819 fi | |
3820 | |
3821 if test -n "$old_library"; then | |
3822 # Do each command in the old_postuninstall commands. | |
3823 eval cmds=\"$old_postuninstall_cmds\" | |
3824 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' | |
3825 for cmd in $cmds; do | |
3826 IFS="$save_ifs" | |
3827 $show "$cmd" | |
3828 $run eval "$cmd" | |
3829 done | |
3830 IFS="$save_ifs" | |
3831 fi | |
3832 | |
3833 # FIXME: should reinstall the best remaining shared library. | |
3834 fi | |
3835 ;; | |
3836 | |
3837 *.lo) | |
3838 if test "$build_old_libs" = yes; then | |
3839 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` | |
3840 rmfiles="$rmfiles $dir/$oldobj" | |
3841 fi | |
3842 $show "$rm $rmfiles" | |
3843 $run $rm $rmfiles | |
3844 ;; | |
3845 | |
3846 *) | |
3847 $show "$rm $rmfiles" | |
3848 $run $rm $rmfiles | |
3849 ;; | |
3850 esac | |
3851 done | |
3852 exit 0 | |
3853 ;; | |
3854 | |
3855 "") | |
3856 $echo "$modename: you must specify a MODE" 1>&2 | |
3857 $echo "$generic_help" 1>&2 | |
3858 exit 1 | |
3859 ;; | |
3860 esac | |
3861 | |
3862 $echo "$modename: invalid operation mode \`$mode'" 1>&2 | |
3863 $echo "$generic_help" 1>&2 | |
3864 exit 1 | |
3865 fi # test -z "$show_help" | |
3866 | |
3867 # We need to display help for each of the modes. | |
3868 case "$mode" in | |
3869 "") $echo \ | |
3870 "Usage: $modename [OPTION]... [MODE-ARG]... | |
3871 | |
3872 Provide generalized library-building support services. | |
3873 | |
3874 --config show all configuration variables | |
3875 --debug enable verbose shell tracing | |
3876 -n, --dry-run display commands without modifying any files | |
3877 --features display basic configuration information and exit | |
3878 --finish same as \`--mode=finish' | |
3879 --help display this help message and exit | |
3880 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] | |
3881 --quiet same as \`--silent' | |
3882 --silent don't print informational messages | |
3883 --version print version information | |
3884 | |
3885 MODE must be one of the following: | |
3886 | |
3887 compile compile a source file into a libtool object | |
3888 execute automatically set library path, then run a program | |
3889 finish complete the installation of libtool libraries | |
3890 install install libraries or executables | |
3891 link create a library or an executable | |
3892 uninstall remove libraries from an installed directory | |
3893 | |
3894 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for | |
3895 a more detailed description of MODE." | |
3896 exit 0 | |
3897 ;; | |
3898 | |
3899 compile) | |
3900 $echo \ | |
3901 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE | |
3902 | |
3903 Compile a source file into a libtool library object. | |
3904 | |
3905 This mode accepts the following additional options: | |
3906 | |
3907 -o OUTPUT-FILE set the output file name to OUTPUT-FILE | |
3908 -static always build a \`.o' file suitable for static linking | |
3909 | |
3910 COMPILE-COMMAND is a command to be used in creating a \`standard' object file | |
3911 from the given SOURCEFILE. | |
3912 | |
3913 The output file name is determined by removing the directory component from | |
3914 SOURCEFILE, then substituting the C source code suffix \`.c' with the | |
3915 library object suffix, \`.lo'." | |
3916 ;; | |
3917 | |
3918 execute) | |
3919 $echo \ | |
3920 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... | |
3921 | |
3922 Automatically set library path, then run a program. | |
3923 | |
3924 This mode accepts the following additional options: | |
3925 | |
3926 -dlopen FILE add the directory containing FILE to the library path | |
3927 | |
3928 This mode sets the library path environment variable according to \`-dlopen' | |
3929 flags. | |
3930 | |
3931 If any of the ARGS are libtool executable wrappers, then they are translated | |
3932 into their corresponding uninstalled binary, and any of their required library | |
3933 directories are added to the library path. | |
3934 | |
3935 Then, COMMAND is executed, with ARGS as arguments." | |
3936 ;; | |
3937 | |
3938 finish) | |
3939 $echo \ | |
3940 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... | |
3941 | |
3942 Complete the installation of libtool libraries. | |
3943 | |
3944 Each LIBDIR is a directory that contains libtool libraries. | |
3945 | |
3946 The commands that this mode executes may require superuser privileges. Use | |
3947 the \`--dry-run' option if you just want to see what would be executed." | |
3948 ;; | |
3949 | |
3950 install) | |
3951 $echo \ | |
3952 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... | |
3953 | |
3954 Install executables or libraries. | |
3955 | |
3956 INSTALL-COMMAND is the installation command. The first component should be | |
3957 either the \`install' or \`cp' program. | |
3958 | |
3959 The rest of the components are interpreted as arguments to that command (only | |
3960 BSD-compatible install options are recognized)." | |
3961 ;; | |
3962 | |
3963 link) | |
3964 $echo \ | |
3965 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... | |
3966 | |
3967 Link object files or libraries together to form another library, or to | |
3968 create an executable program. | |
3969 | |
3970 LINK-COMMAND is a command using the C compiler that you would use to create | |
3971 a program from several object files. | |
3972 | |
3973 The following components of LINK-COMMAND are treated specially: | |
3974 | |
3975 -all-static do not do any dynamic linking at all | |
3976 -avoid-version do not add a version suffix if possible | |
3977 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime | |
3978 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols | |
3979 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) | |
3980 -export-symbols SYMFILE | |
3981 try to export only the symbols listed in SYMFILE | |
3982 -export-symbols-regex REGEX | |
3983 try to export only the symbols matching REGEX | |
3984 -LLIBDIR search LIBDIR for required installed libraries | |
3985 -lNAME OUTPUT-FILE requires the installed library libNAME | |
3986 -module build a library that can dlopened | |
3987 -no-undefined declare that a library does not refer to external symbols | |
3988 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects | |
3989 -release RELEASE specify package release information | |
3990 -rpath LIBDIR the created library will eventually be installed in LIBDIR | |
3991 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries | |
3992 -static do not do any dynamic linking of libtool libraries | |
3993 -version-info CURRENT[:REVISION[:AGE]] | |
3994 specify library version info [each variable defaults to 0] | |
3995 | |
3996 All other options (arguments beginning with \`-') are ignored. | |
3997 | |
3998 Every other argument is treated as a filename. Files ending in \`.la' are | |
3999 treated as uninstalled libtool libraries, other files are standard or library | |
4000 object files. | |
4001 | |
4002 If the OUTPUT-FILE ends in \`.la', then a libtool library is created, | |
4003 only library objects (\`.lo' files) may be specified, and \`-rpath' is | |
4004 required, except when creating a convenience library. | |
4005 | |
4006 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created | |
4007 using \`ar' and \`ranlib', or on Windows using \`lib'. | |
4008 | |
4009 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file | |
4010 is created, otherwise an executable program is created." | |
4011 ;; | |
4012 | |
4013 uninstall) | |
4014 $echo \ | |
4015 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... | |
4016 | |
4017 Remove libraries from an installation directory. | |
4018 | |
4019 RM is the name of the program to use to delete files associated with each FILE | |
4020 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | |
4021 to RM. | |
4022 | |
4023 If FILE is a libtool library, all the files associated with it are deleted. | |
4024 Otherwise, only FILE itself is deleted using RM." | |
4025 ;; | |
4026 | |
4027 *) | |
4028 $echo "$modename: invalid operation mode \`$mode'" 1>&2 | |
4029 $echo "$help" 1>&2 | |
4030 exit 1 | |
4031 ;; | |
4032 esac | |
4033 | |
4034 echo | |
4035 $echo "Try \`$modename --help' for more information about other modes." | |
4036 | |
4037 exit 0 | |
4038 | |
4039 # Local Variables: | |
4040 # mode:shell-script | |
4041 # sh-indentation:2 | |
4042 # End: |