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