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