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