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