]>
Commit | Line | Data |
---|---|---|
8414a40c VZ |
1 | # Generated from ltmain.m4sh; do not edit by hand |
2 | ||
3 | # ltmain.sh (GNU libtool 1.2248 2006/01/21 17:40:19) 2.1a | |
4 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 | |
5 | ||
6 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 | |
7 | # Free Software Foundation, Inc. | |
8 | # This is free software; see the source for copying conditions. There is NO | |
9 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
10 | ||
11 | # This program is free software; you can redistribute it and/or modify | |
12 | # it under the terms of the GNU General Public License as published by | |
13 | # the Free Software Foundation; either version 2 of the License, or | |
14 | # (at your option) any later version. | |
15 | # | |
16 | # This program is distributed in the hope that it will be useful, but | |
17 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | # General Public License for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with this program; if not, write to the Free Software | |
23 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
24 | # | |
25 | # As a special exception to the GNU General Public License, if you | |
26 | # distribute this file as part of a program that contains a | |
27 | # configuration script generated by Autoconf, you may include it under | |
28 | # the same distribution terms that you use for the rest of that program. | |
29 | ||
30 | # Usage: $progname [OPTION]... [MODE-ARG]... | |
31 | # | |
32 | # Provide generalized library-building support services. | |
33 | # | |
34 | # --config show all configuration variables | |
35 | # --debug enable verbose shell tracing | |
36 | # -n, --dry-run display commands without modifying any files | |
37 | # --features display basic configuration information and exit | |
38 | # --mode=MODE use operation mode MODE | |
39 | # --preserve-dup-deps don't remove duplicate dependency libraries | |
40 | # --quiet, --silent don't print informational messages | |
41 | # --tag=TAG use configuration variables from tag TAG | |
42 | # -v, --verbose print informational messages (default) | |
43 | # --version print version information | |
44 | # -h, --help print short or long help message | |
45 | # | |
46 | # MODE must be one of the following: | |
47 | # | |
48 | # clean remove files from the build directory | |
49 | # compile compile a source file into a libtool object | |
50 | # execute automatically set library path, then run a program | |
51 | # finish complete the installation of libtool libraries | |
52 | # install install libraries or executables | |
53 | # link create a library or an executable | |
54 | # uninstall remove libraries from an installed directory | |
55 | # | |
56 | # MODE-ARGS vary depending on the MODE. | |
57 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE. | |
58 | # | |
59 | # When reporting a bug, please describe a test case to reproduce it and | |
60 | # include the following information: | |
61 | # | |
62 | # host-triplet: powerpc-apple-darwin8.2.0 | |
63 | # shell: $SHELL | |
64 | # compiler: $LTCC | |
65 | # compiler flags: $LTCFLAGS | |
66 | # linker: $LD (gnu? $with_gnu_ld) | |
67 | # $progname: (GNU libtool 1.2248 2006/01/21 17:40:19) 2.1a | |
68 | # automake: $automake_version | |
69 | # autoconf: $autoconf_version | |
70 | # | |
71 | # Report bugs to <bug-libtool@gnu.org>. | |
72 | ||
73 | PROGRAM=ltmain.sh | |
74 | PACKAGE=libtool | |
75 | VERSION=2.1a | |
76 | TIMESTAMP=" 1.2248 2006/01/21 17:40:19" | |
77 | package_revision=1.2248 | |
78 | ||
79 | ## --------------------- ## | |
80 | ## M4sh Initialization. ## | |
81 | ## --------------------- ## | |
82 | ||
83 | # Be Bourne compatible | |
84 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then | |
85 | emulate sh | |
86 | NULLCMD=: | |
87 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which | |
88 | # is contrary to our usage. Disable this feature. | |
89 | alias -g '${1+"$@"}'='"$@"' | |
90 | elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then | |
91 | set -o posix | |
92 | fi | |
93 | DUALCASE=1; export DUALCASE # for MKS sh | |
94 | ||
95 | # Support unset when possible. | |
96 | if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then | |
97 | as_unset=unset | |
98 | else | |
99 | as_unset=false | |
100 | fi | |
101 | ||
102 | ||
103 | # Work around bugs in pre-3.0 UWIN ksh. | |
104 | $as_unset ENV MAIL MAILPATH | |
105 | PS1='$ ' | |
106 | PS2='> ' | |
107 | PS4='+ ' | |
108 | ||
109 | # NLS nuisances. | |
110 | for as_var in \ | |
111 | LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ | |
112 | LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ | |
113 | LC_TELEPHONE LC_TIME | |
114 | do | |
115 | if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then | |
116 | eval $as_var=C; export $as_var | |
117 | else | |
118 | $as_unset $as_var | |
119 | fi | |
120 | done | |
121 | ||
122 | # Required to use basename. | |
123 | if expr a : '\(a\)' >/dev/null 2>&1; then | |
124 | as_expr=expr | |
125 | else | |
126 | as_expr=false | |
127 | fi | |
128 | ||
129 | if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then | |
130 | as_basename=basename | |
131 | else | |
132 | as_basename=false | |
133 | fi | |
134 | ||
135 | ||
136 | # Name of the executable. | |
137 | as_me=`$as_basename "$0" || | |
138 | $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ | |
139 | X"$0" : 'X\(//\)$' \| \ | |
140 | X"$0" : 'X\(/\)$' \| \ | |
141 | . : '\(.\)' 2>/dev/null || | |
142 | echo X/"$0" | | |
143 | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } | |
144 | /^X\/\(\/\/\)$/{ s//\1/; q; } | |
145 | /^X\/\(\/\).*/{ s//\1/; q; } | |
146 | s/.*/./; q'` | |
147 | ||
148 | ||
149 | $as_unset CDPATH | |
150 | ||
151 | ||
152 | ||
153 | : ${CP="cp -f"} | |
154 | : ${ECHO="echo"} | |
155 | : ${EGREP="grep -E"} | |
156 | : ${FGREP="grep -F"} | |
157 | : ${GREP="grep"} | |
158 | : ${LN_S="ln -s"} | |
159 | : ${MAKE="make"} | |
160 | : ${MKDIR="mkdir"} | |
161 | : ${MV="mv -f"} | |
162 | : ${RM="rm -f"} | |
163 | : ${SED="/usr/bin/sed"} | |
164 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} | |
165 | : ${Xsed="$SED -e 1s/^X//"} | |
166 | ||
167 | # Global variables: | |
168 | EXIT_SUCCESS=0 | |
169 | EXIT_FAILURE=1 | |
170 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. | |
171 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. | |
172 | ||
173 | exit_status=$EXIT_SUCCESS | |
174 | ||
175 | # Make sure IFS has a sensible default | |
176 | lt_nl=' | |
177 | ' | |
178 | IFS=" $lt_nl" | |
179 | ||
180 | dirname="s,/[^/]*$,," | |
181 | basename="s,^.*/,," | |
182 | ||
183 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh | |
184 | # is ksh but when the shell is invoked as "sh" and the current value of | |
185 | # the _XPG environment variable is not equal to 1 (one), the special | |
186 | # positional parameter $0, within a function call, is the name of the | |
187 | # function. | |
188 | progpath="$0" | |
189 | ||
190 | # The name of this program: | |
191 | # In the unlikely event $progname began with a '-', it would play havoc with | |
192 | # func_echo (imagine progname=-n), so we prepend ./ in that case: | |
193 | progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'` | |
194 | ||
195 | # Make sure we have an absolute path for reexecution: | |
196 | case $progpath in | |
197 | [\\/]*|[A-Za-z]:\\*) ;; | |
198 | *[\\/]*) | |
199 | progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"` | |
200 | progdir=`cd "$progdir" && pwd` | |
201 | progpath="$progdir/$progname" | |
202 | ;; | |
203 | *) | |
204 | save_IFS="$IFS" | |
205 | IFS=: | |
206 | for progdir in $PATH; do | |
207 | IFS="$save_IFS" | |
208 | test -x "$progdir/$progname" && break | |
209 | done | |
210 | IFS="$save_IFS" | |
211 | test -n "$progdir" || progdir=`pwd` | |
212 | progpath="$progdir/$progname" | |
213 | ;; | |
214 | esac | |
215 | ||
216 | # Sed substitution that helps us do robust quoting. It backslashifies | |
217 | # metacharacters that are still active within double-quoted strings. | |
218 | Xsed="${SED}"' -e 1s/^X//' | |
219 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' | |
220 | ||
221 | # Same as above, but do not quote variable references. | |
222 | double_quote_subst='s/\(["`\\]\)/\\\1/g' | |
223 | ||
224 | # Re-`\' parameter expansions in output of double_quote_subst that were | |
225 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$' | |
226 | # in input to double_quote_subst, that '$' was protected from expansion. | |
227 | # Since each input `\' is now two `\'s, look for any number of runs of | |
228 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'. Note | |
229 | # that the embedded single quotes serve only to enhance readability. | |
230 | sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/; | |
231 | s/\([^\\]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g' | |
232 | ||
233 | # test EBCDIC or ASCII | |
234 | case `echo X|tr X '\101'` in | |
235 | A) # ASCII based system | |
236 | # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr | |
237 | SP2NL='tr \040 \012' | |
238 | NL2SP='tr \015\012 \040\040' | |
239 | ;; | |
240 | *) # EBCDIC based system | |
241 | SP2NL='tr \100 \n' | |
242 | NL2SP='tr \r\n \100\100' | |
243 | ;; | |
244 | esac | |
245 | ||
246 | # Standard options: | |
247 | opt_dry_run=false | |
248 | opt_help=false | |
249 | opt_quiet=false | |
250 | opt_verbose=false | |
251 | ||
252 | # func_echo arg... | |
253 | # Echo program name prefixed message, along with the current mode | |
254 | # name if it has been set yet. | |
255 | func_echo () | |
256 | { | |
257 | $ECHO "$progname${mode+: }$mode: "${1+"$@"} | |
258 | } | |
259 | ||
260 | # func_verbose arg... | |
261 | # Echo program name prefixed message in verbose mode only. | |
262 | func_verbose () | |
263 | { | |
264 | $opt_verbose && func_echo ${1+"$@"} | |
265 | ||
266 | # A bug in bash halts the script if the last line of a function | |
267 | # fails when set -e is in force, so we need another command to | |
268 | # work around that: | |
269 | : | |
270 | } | |
271 | ||
272 | # func_error arg... | |
273 | # Echo program name prefixed message to standard error. | |
274 | func_error () | |
275 | { | |
276 | $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 | |
277 | } | |
278 | ||
279 | # func_warning arg... | |
280 | # Echo program name prefixed warning message to standard error. | |
281 | func_warning () | |
282 | { | |
283 | $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 | |
284 | } | |
285 | ||
286 | # func_fatal_error arg... | |
287 | # Echo program name prefixed message to standard error, and exit. | |
288 | func_fatal_error () | |
289 | { | |
290 | func_error ${1+"$@"} | |
291 | exit $EXIT_FAILURE | |
292 | } | |
293 | ||
294 | # func_fatal_help arg... | |
295 | # Echo program name prefixed message to standard error, followed by | |
296 | # a help hint, and exit. | |
297 | func_fatal_help () | |
298 | { | |
299 | func_error ${1+"$@"} | |
300 | func_fatal_error "$help" | |
301 | } | |
302 | help="Try \`$progname --help' for more information." ## default | |
303 | ||
304 | ||
305 | # func_grep expression filename | |
306 | # Check whether EXPRESSION matches any line of FILENAME, without output. | |
307 | func_grep () | |
308 | { | |
309 | $GREP "$1" "$2" >/dev/null 2>&1 | |
310 | } | |
311 | ||
312 | ||
313 | # func_mkdir_p directory-path | |
314 | # Make sure the entire path to DIRECTORY-PATH is available. | |
315 | func_mkdir_p () | |
316 | { | |
317 | my_directory_path="$1" | |
318 | my_dir_list= | |
319 | ||
320 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then | |
321 | ||
322 | # Protect directory names starting with `-' | |
323 | case $my_directory_path in | |
324 | -*) my_directory_path="./$my_directory_path" ;; | |
325 | esac | |
326 | ||
327 | # While some portion of DIR does not yet exist... | |
328 | while test ! -d "$my_directory_path"; do | |
329 | # ...make a list in topmost first order. Use a colon delimited | |
330 | # list incase some portion of path contains whitespace. | |
331 | my_dir_list="$my_directory_path:$my_dir_list" | |
332 | ||
333 | # If the last portion added has no slash in it, the list is done | |
334 | case $my_directory_path in */*) ;; *) break ;; esac | |
335 | ||
336 | # ...otherwise throw away the child directory and loop | |
337 | my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` | |
338 | done | |
339 | my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` | |
340 | ||
341 | save_mkdir_p_IFS="$IFS"; IFS=':' | |
342 | for my_dir in $my_dir_list; do | |
343 | IFS="$save_mkdir_p_IFS" | |
344 | # mkdir can fail with a `File exist' error if two processes | |
345 | # try to create one of the directories concurrently. Don't | |
346 | # stop in that case! | |
347 | $MKDIR "$my_dir" 2>/dev/null || : | |
348 | done | |
349 | IFS="$save_mkdir_p_IFS" | |
350 | ||
351 | # Bail out if we (or some other process) failed to create a directory. | |
352 | test -d "$my_directory_path" || \ | |
353 | func_fatal_error "Failed to create \`$1'" | |
354 | fi | |
355 | } | |
356 | ||
357 | ||
358 | # func_mktempdir [string] | |
359 | # Make a temporary directory that won't clash with other running | |
360 | # libtool processes, and avoids race conditions if possible. If | |
361 | # given, STRING is the basename for that directory. | |
362 | func_mktempdir () | |
363 | { | |
364 | my_template="${TMPDIR-/tmp}/${1-$progname}" | |
365 | ||
366 | if test "$opt_dry_run" = ":"; then | |
367 | # Return a directory name, but don't create it in dry-run mode | |
368 | my_tmpdir="${my_template}-$$" | |
369 | else | |
370 | ||
371 | # If mktemp works, use that first and foremost | |
372 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` | |
373 | ||
374 | if test ! -d "$my_tmpdir"; then | |
375 | # Failing that, at least try and use $RANDOM to avoid a race | |
376 | my_tmpdir="${my_template}-${RANDOM-0}$$" | |
377 | ||
378 | save_mktempdir_umask=`umask` | |
379 | umask 0077 | |
380 | $MKDIR "$my_tmpdir" | |
381 | umask $save_mktempdir_umask | |
382 | fi | |
383 | ||
384 | # If we're not in dry-run mode, bomb out on failure | |
385 | test -d "$my_tmpdir" || \ | |
386 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" | |
387 | fi | |
388 | ||
389 | $ECHO "X$my_tmpdir" | $Xsed | |
390 | } | |
391 | ||
392 | ||
393 | # func_quote_for_eval arg | |
394 | # Aesthetically quote ARG to be evaled later. | |
395 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT | |
396 | # is double-quoted, suitable for a subsequent eval, whereas | |
397 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters | |
398 | # which are still active within double quotes backslashified. | |
399 | func_quote_for_eval () | |
400 | { | |
401 | case $1 in | |
402 | *[\\\`\"\$]*) | |
403 | func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; | |
404 | *) | |
405 | func_quote_for_eval_unquoted_result="$1" ;; | |
406 | esac | |
407 | ||
408 | case $func_quote_for_eval_unquoted_result in | |
409 | # Double-quote args containing shell metacharacters to delay | |
410 | # word splitting, command substitution and and variable | |
411 | # expansion for a subsequent eval. | |
412 | # Many Bourne shells cannot handle close brackets correctly | |
413 | # in scan sets, so we specify it separately. | |
414 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | |
415 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" | |
416 | ;; | |
417 | *) | |
418 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" | |
419 | esac | |
420 | } | |
421 | ||
422 | ||
423 | # func_quote_for_expand arg | |
424 | # Aesthetically quote ARG to be evaled later; same as above, | |
425 | # but do not quote variable references. | |
426 | func_quote_for_expand () | |
427 | { | |
428 | case $1 in | |
429 | *[\\\`\"]*) | |
430 | my_arg=`$ECHO "X$1" | $Xsed \ | |
431 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; | |
432 | *) | |
433 | my_arg="$1" ;; | |
434 | esac | |
435 | ||
436 | case $my_arg in | |
437 | # Double-quote args containing shell metacharacters to delay | |
438 | # word splitting and command substitution for a subsequent eval. | |
439 | # Many Bourne shells cannot handle close brackets correctly | |
440 | # in scan sets, so we specify it separately. | |
441 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | |
442 | my_arg="\"$my_arg\"" | |
443 | ;; | |
444 | esac | |
445 | ||
446 | func_quote_for_expand_result="$my_arg" | |
447 | } | |
448 | ||
449 | ||
450 | # func_show_eval cmd [fail_exp] | |
451 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is | |
452 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP | |
453 | # is given, then evaluate it. | |
454 | func_show_eval () | |
455 | { | |
456 | my_cmd="$1" | |
457 | my_fail_exp="${2-:}" | |
458 | ||
459 | ${opt_silent-false} || { | |
460 | func_quote_for_expand "$my_cmd" | |
461 | eval "func_echo $func_quote_for_expand_result" | |
462 | } | |
463 | ||
464 | if ${opt_dry_run-false}; then :; else | |
465 | eval "$my_cmd" | |
466 | my_status=$? | |
467 | if test "$my_status" -eq 0; then :; else | |
468 | eval "(exit $my_status); $my_fail_exp" | |
469 | fi | |
470 | fi | |
471 | } | |
472 | ||
473 | ||
474 | # func_version | |
475 | # Echo version message to standard output and exit. | |
476 | func_version () | |
477 | { | |
478 | $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { | |
479 | s/^# // | |
480 | s/^# *$// | |
481 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ | |
482 | p | |
483 | }' < "$progpath" | |
484 | exit $? | |
485 | } | |
486 | ||
487 | # func_usage | |
488 | # Echo short help message to standard output and exit. | |
489 | func_usage () | |
490 | { | |
491 | $SED -n '/^# Usage:/,/# -h/ { | |
492 | s/^# // | |
493 | s/^# *$// | |
494 | s/\$progname/'$progname'/ | |
495 | p | |
496 | }' < "$progpath" | |
497 | $ECHO | |
498 | $ECHO "run \`$progname --help | more' for full usage" | |
499 | exit $? | |
500 | } | |
501 | ||
502 | # func_help | |
503 | # Echo long help message to standard output and exit. | |
504 | func_help () | |
505 | { | |
506 | $SED -n '/^# Usage:/,/# Report bugs to/ { | |
507 | s/^# // | |
508 | s/^# *$// | |
509 | s*\$progname*'$progname'* | |
510 | s*\$SHELL*'"$SHELL"'* | |
511 | s*\$LTCC*'"$LTCC"'* | |
512 | s*\$LTCFLAGS*'"$LTCFLAGS"'* | |
513 | s*\$LD*'"$LD"'* | |
514 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ | |
515 | s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ | |
516 | s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ | |
517 | p | |
518 | }' < "$progpath" | |
519 | exit $? | |
520 | } | |
521 | ||
522 | # func_missing_arg argname | |
523 | # Echo program name prefixed message to standard error and set global | |
524 | # exit_cmd. | |
525 | func_missing_arg () | |
526 | { | |
527 | func_error "missing argument for $1" | |
528 | exit_cmd=exit | |
529 | } | |
530 | ||
531 | exit_cmd=: | |
532 | ||
533 | ||
534 | # Check that we have a working $ECHO. | |
535 | if test "X$1" = X--no-reexec; then | |
536 | # Discard the --no-reexec flag, and continue. | |
537 | shift | |
538 | elif test "X$1" = X--fallback-echo; then | |
539 | # Avoid inline document here, it may be left over | |
540 | : | |
541 | elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then | |
542 | # Yippee, $ECHO works! | |
543 | : | |
544 | else | |
545 | # Restart under the correct shell, and then maybe $ECHO will work. | |
546 | exec $SHELL "$progpath" --no-reexec ${1+"$@"} | |
547 | fi | |
548 | ||
549 | if test "X$1" = X--fallback-echo; then | |
550 | # used as fallback echo | |
551 | shift | |
552 | cat <<EOF | |
553 | $* | |
554 | EOF | |
555 | exit $EXIT_SUCCESS | |
556 | fi | |
557 | ||
558 | magic="%%%MAGIC variable%%%" | |
559 | ||
560 | ||
561 | # Global variables. | |
562 | # $mode is unset | |
563 | nonopt= | |
564 | execute_dlfiles= | |
565 | preserve_args= | |
566 | lo2o="s/\\.lo\$/.${objext}/" | |
567 | o2lo="s/\\.${objext}\$/.lo/" | |
568 | ||
569 | opt_dry_run=false | |
570 | opt_duplicate_deps=false | |
571 | opt_silent=false | |
572 | opt_debug=: | |
573 | ||
574 | # If this variable is set in any of the actions, the command in it | |
575 | # will be execed at the end. This prevents here-documents from being | |
576 | # left over by shells. | |
577 | exec_cmd= | |
578 | ||
579 | # func_fatal_configuration arg... | |
580 | # Echo program name prefixed message to standard error, followed by | |
581 | # a configuration failure hint, and exit. | |
582 | func_fatal_configuration () | |
583 | { | |
584 | func_error ${1+"$@"} | |
585 | func_error "See the $PACKAGE documentation for more information." | |
586 | func_fatal_error "Fatal configuration error." | |
587 | } | |
588 | ||
589 | ||
590 | # func_config | |
591 | # Display the configuration for all the tags in this script. | |
592 | func_config () | |
593 | { | |
594 | re_begincf='^# ### BEGIN LIBTOOL' | |
595 | re_endcf='^# ### END LIBTOOL' | |
596 | ||
597 | # Default configuration. | |
598 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" | |
599 | ||
600 | # Now print the configurations for the tags. | |
601 | for tagname in $taglist; do | |
602 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" | |
603 | done | |
604 | ||
605 | exit $? | |
606 | } | |
607 | ||
608 | # func_features | |
609 | # Display the features supported by this script. | |
610 | func_features () | |
611 | { | |
612 | $ECHO "host: $host" | |
613 | if test "$build_libtool_libs" = yes; then | |
614 | $ECHO "enable shared libraries" | |
615 | else | |
616 | $ECHO "disable shared libraries" | |
617 | fi | |
618 | if test "$build_old_libs" = yes; then | |
619 | $ECHO "enable static libraries" | |
620 | else | |
621 | $ECHO "disable static libraries" | |
622 | fi | |
623 | ||
624 | exit $? | |
625 | } | |
626 | ||
627 | # func_enable_tag tagname | |
628 | # Verify that TAGNAME is valid, and either flag an error and exit, or | |
629 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist | |
630 | # variable here. | |
631 | func_enable_tag () | |
632 | { | |
633 | # Global variable: | |
634 | tagname="$1" | |
635 | ||
636 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" | |
637 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" | |
638 | sed_extractcf="/$re_begincf/,/$re_endcf/p" | |
639 | ||
640 | # Validate tagname. | |
641 | case $tagname in | |
642 | *[!-_A-Za-z0-9,/]*) | |
643 | func_fatal_error "invalid tag name: $tagname" | |
644 | ;; | |
645 | esac | |
646 | ||
647 | # Don't test for the "default" C tag, as we know it's | |
648 | # there but not specially marked. | |
649 | case $tagname in | |
650 | CC) ;; | |
651 | *) | |
652 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then | |
653 | taglist="$taglist $tagname" | |
654 | ||
655 | # Evaluate the configuration. Be careful to quote the path | |
656 | # and the sed script, to avoid splitting on whitespace, but | |
657 | # also don't use non-portable quotes within backquotes within | |
658 | # quotes we have to do it in 2 steps: | |
659 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` | |
660 | eval "$extractedcf" | |
661 | else | |
662 | func_error "ignoring unknown tag $tagname" | |
663 | fi | |
664 | ;; | |
665 | esac | |
666 | } | |
667 | ||
668 | ||
669 | func_mode_help () | |
670 | { | |
671 | # We need to display help for each of the modes. | |
672 | case $mode in | |
673 | "") | |
674 | # Generic help is extracted from the usage comments | |
675 | # at the start of this file. | |
676 | func_help | |
677 | ;; | |
678 | ||
679 | clean) | |
680 | $ECHO \ | |
681 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... | |
682 | ||
683 | Remove files from the build directory. | |
684 | ||
685 | RM is the name of the program to use to delete files associated with each FILE | |
686 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | |
687 | to RM. | |
688 | ||
689 | If FILE is a libtool library, object or program, all the files associated | |
690 | with it are deleted. Otherwise, only FILE itself is deleted using RM." | |
691 | ;; | |
692 | ||
693 | compile) | |
694 | $ECHO \ | |
695 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE | |
696 | ||
697 | Compile a source file into a libtool library object. | |
698 | ||
699 | This mode accepts the following additional options: | |
700 | ||
701 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE | |
702 | -no-suppress do not suppress compiler output for multiple passes | |
703 | -prefer-pic try to building PIC objects only | |
704 | -prefer-non-pic try to building non-PIC objects only | |
705 | -shared do not build a \`.o' file suitable for static linking | |
706 | -static only build a \`.o' file suitable for static linking | |
707 | ||
708 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file | |
709 | from the given SOURCEFILE. | |
710 | ||
711 | The output file name is determined by removing the directory component from | |
712 | SOURCEFILE, then substituting the C source code suffix \`.c' with the | |
713 | library object suffix, \`.lo'." | |
714 | ;; | |
715 | ||
716 | execute) | |
717 | $ECHO \ | |
718 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... | |
719 | ||
720 | Automatically set library path, then run a program. | |
721 | ||
722 | This mode accepts the following additional options: | |
723 | ||
724 | -dlopen FILE add the directory containing FILE to the library path | |
725 | ||
726 | This mode sets the library path environment variable according to \`-dlopen' | |
727 | flags. | |
728 | ||
729 | If any of the ARGS are libtool executable wrappers, then they are translated | |
730 | into their corresponding uninstalled binary, and any of their required library | |
731 | directories are added to the library path. | |
732 | ||
733 | Then, COMMAND is executed, with ARGS as arguments." | |
734 | ;; | |
735 | ||
736 | finish) | |
737 | $ECHO \ | |
738 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... | |
739 | ||
740 | Complete the installation of libtool libraries. | |
741 | ||
742 | Each LIBDIR is a directory that contains libtool libraries. | |
743 | ||
744 | The commands that this mode executes may require superuser privileges. Use | |
745 | the \`--dry-run' option if you just want to see what would be executed." | |
746 | ;; | |
747 | ||
748 | install) | |
749 | $ECHO \ | |
750 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... | |
751 | ||
752 | Install executables or libraries. | |
753 | ||
754 | INSTALL-COMMAND is the installation command. The first component should be | |
755 | either the \`install' or \`cp' program. | |
756 | ||
757 | The following components of INSTALL-COMMAND are treated specially: | |
758 | ||
759 | -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation | |
760 | ||
761 | The rest of the components are interpreted as arguments to that command (only | |
762 | BSD-compatible install options are recognized)." | |
763 | ;; | |
764 | ||
765 | link) | |
766 | $ECHO \ | |
767 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... | |
768 | ||
769 | Link object files or libraries together to form another library, or to | |
770 | create an executable program. | |
771 | ||
772 | LINK-COMMAND is a command using the C compiler that you would use to create | |
773 | a program from several object files. | |
774 | ||
775 | The following components of LINK-COMMAND are treated specially: | |
776 | ||
777 | -all-static do not do any dynamic linking at all | |
778 | -avoid-version do not add a version suffix if possible | |
779 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime | |
780 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols | |
781 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) | |
782 | -export-symbols SYMFILE | |
783 | try to export only the symbols listed in SYMFILE | |
784 | -export-symbols-regex REGEX | |
785 | try to export only the symbols matching REGEX | |
786 | -LLIBDIR search LIBDIR for required installed libraries | |
787 | -lNAME OUTPUT-FILE requires the installed library libNAME | |
788 | -module build a library that can dlopened | |
789 | -no-fast-install disable the fast-install mode | |
790 | -no-install link a not-installable executable | |
791 | -no-undefined declare that a library does not refer to external symbols | |
792 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects | |
793 | -objectlist FILE Use a list of object files found in FILE to specify objects | |
794 | -precious-files-regex REGEX | |
795 | don't remove output files matching REGEX | |
796 | -release RELEASE specify package release information | |
797 | -rpath LIBDIR the created library will eventually be installed in LIBDIR | |
798 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries | |
799 | -shared only do dynamic linking of libtool libraries | |
800 | -shrext SUFFIX override the standard shared library file extension | |
801 | -static do not do any dynamic linking of libtool libraries | |
802 | -version-info CURRENT[:REVISION[:AGE]] | |
803 | specify library version info [each variable defaults to 0] | |
804 | -weak LIBNAME declare that the target provides the LIBNAME interface | |
805 | ||
806 | All other options (arguments beginning with \`-') are ignored. | |
807 | ||
808 | Every other argument is treated as a filename. Files ending in \`.la' are | |
809 | treated as uninstalled libtool libraries, other files are standard or library | |
810 | object files. | |
811 | ||
812 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, | |
813 | only library objects (\`.lo' files) may be specified, and \`-rpath' is | |
814 | required, except when creating a convenience library. | |
815 | ||
816 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created | |
817 | using \`ar' and \`ranlib', or on Windows using \`lib'. | |
818 | ||
819 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file | |
820 | is created, otherwise an executable program is created." | |
821 | ;; | |
822 | ||
823 | uninstall) | |
824 | $ECHO \ | |
825 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... | |
826 | ||
827 | Remove libraries from an installation directory. | |
828 | ||
829 | RM is the name of the program to use to delete files associated with each FILE | |
830 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | |
831 | to RM. | |
832 | ||
833 | If FILE is a libtool library, all the files associated with it are deleted. | |
834 | Otherwise, only FILE itself is deleted using RM." | |
835 | ;; | |
836 | ||
837 | *) | |
838 | func_fatal_help "invalid operation mode \`$mode'" | |
839 | ;; | |
840 | esac | |
841 | ||
842 | $ECHO | |
843 | $ECHO "Try \`$progname --help' for more information about other modes." | |
844 | ||
845 | exit $? | |
846 | } | |
847 | ||
848 | # TEST SUITE MARKER ## NON-FUNCTION | |
849 | # Parse options once, thoroughly. This comes as soon as possible in | |
850 | # the script to make things like `libtool --version' happen quickly. | |
851 | { | |
852 | # sed scripts: | |
853 | my_sed_single_opt='1s/^\(..\).*$/\1/;q' | |
854 | my_sed_single_rest='1s/^..\(.*\)$/\1/;q' | |
855 | my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' | |
856 | my_sed_long_arg='1s/^-[^=]*=//' | |
857 | ||
858 | # Shorthand for --mode=foo, only valid as the first argument | |
859 | case $1 in | |
860 | clean|clea|cle|cl) | |
861 | shift; set dummy --mode clean ${1+"$@"}; shift | |
862 | ;; | |
863 | compile|compil|compi|comp|com|co|c) | |
864 | shift; set dummy --mode compile ${1+"$@"}; shift | |
865 | ;; | |
866 | execute|execut|execu|exec|exe|ex|e) | |
867 | shift; set dummy --mode execute ${1+"$@"}; shift | |
868 | ;; | |
869 | finish|finis|fini|fin|fi|f) | |
870 | shift; set dummy --mode finish ${1+"$@"}; shift | |
871 | ;; | |
872 | install|instal|insta|inst|ins|in|i) | |
873 | shift; set dummy --mode install ${1+"$@"}; shift | |
874 | ;; | |
875 | link|lin|li|l) | |
876 | shift; set dummy --mode link ${1+"$@"}; shift | |
877 | ;; | |
878 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) | |
879 | shift; set dummy --mode uninstall ${1+"$@"}; shift | |
880 | ;; | |
881 | esac | |
882 | ||
883 | # Parse non-mode specific arguments: | |
884 | while test "$#" -gt 0; do | |
885 | opt="$1" | |
886 | shift | |
887 | ||
888 | case $opt in | |
889 | --config) func_config ;; | |
890 | ||
891 | --debug) preserve_args="$preserve_args $opt" | |
892 | func_echo "enabling shell trace mode" | |
893 | opt_debug='set -x' | |
894 | $opt_debug | |
895 | ;; | |
896 | ||
897 | -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break | |
898 | execute_dlfiles="$execute_dlfiles $1" | |
899 | shift | |
900 | ;; | |
901 | ||
902 | --dry-run | -n) opt_dry_run=: ;; | |
903 | --features) func_features ;; | |
904 | --finish) mode="finish" ;; | |
905 | ||
906 | --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break | |
907 | case $1 in | |
908 | # Valid mode arguments: | |
909 | clean) ;; | |
910 | compile) ;; | |
911 | execute) ;; | |
912 | finish) ;; | |
913 | install) ;; | |
914 | link) ;; | |
915 | relink) ;; | |
916 | uninstall) ;; | |
917 | ||
918 | # Catch anything else as an error | |
919 | *) func_error "invalid argument for $opt" | |
920 | exit_cmd=exit | |
921 | break | |
922 | ;; | |
923 | esac | |
924 | ||
925 | mode="$1" | |
926 | shift | |
927 | ;; | |
928 | ||
929 | --preserve-dup-deps) | |
930 | opt_duplicate_deps=: ;; | |
931 | ||
932 | --quiet|--silent) preserve_args="$preserve_args $opt" | |
933 | opt_silent=: | |
934 | ;; | |
935 | ||
936 | --verbose| -v) preserve_args="$preserve_args $opt" | |
937 | opt_silent=false | |
938 | ;; | |
939 | ||
940 | --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break | |
941 | preserve_args="$preserve_args $opt $1" | |
942 | func_enable_tag "$1" # tagname is set here | |
943 | shift | |
944 | ;; | |
945 | ||
946 | # Separate optargs to long options: | |
947 | -dlopen=*|--mode=*|--tag=*) | |
948 | arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"` | |
949 | opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"` | |
950 | set dummy "$opt" "$arg" ${1+"$@"} | |
951 | shift | |
952 | ;; | |
953 | ||
954 | # Separate optargs to short options: | |
955 | # -x*|-y*) | |
956 | # arg=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"` | |
957 | # opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"` | |
958 | # set dummy "$opt" "$arg" ${1+"$@"} | |
959 | # shift | |
960 | # ;; | |
961 | ||
962 | # Separate non-argument short options: | |
963 | # -z*|-z*|-y*) | |
964 | # rest=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"` | |
965 | # opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"` | |
966 | # set dummy "$opt" "-$rest" ${1+"$@"} | |
967 | # shift | |
968 | # ;; | |
969 | ||
970 | -\?|-h) func_usage ;; | |
971 | --help) opt_help=: ;; | |
972 | --version) func_version ;; | |
973 | ||
974 | -*) func_fatal_help "unrecognized option \`$opt'" ;; | |
975 | ||
976 | *) nonopt="$opt" | |
977 | break | |
978 | ;; | |
979 | esac | |
980 | done | |
981 | ||
982 | # Now that we've collected a possible --mode arg, show help if necessary | |
983 | $opt_help && func_mode_help | |
984 | ||
985 | case $host in | |
986 | *cygwin* | *mingw* | *pw32*) | |
987 | # don't eliminate duplications in $postdeps and $predeps | |
988 | opt_duplicate_compiler_generated_deps=: | |
989 | ;; | |
990 | *) | |
991 | opt_duplicate_compiler_generated_deps=$opt_duplicate_deps | |
992 | ;; | |
993 | esac | |
994 | ||
995 | # Having warned about all mis-specified options, bail out if | |
996 | # anything was wrong. | |
997 | $exit_cmd $EXIT_FAILURE | |
998 | } | |
999 | # TEST SUITE MARKER ## BEGIN SOURCABLE | |
1000 | ||
1001 | # func_check_version_match | |
1002 | # Ensure that we are using m4 macros, and libtool script from the same | |
1003 | # release of libtool. | |
1004 | func_check_version_match () | |
1005 | { | |
1006 | if test "$package_revision" != "$macro_revision"; then | |
1007 | if test "$VERSION" != "$macro_version"; then | |
1008 | if test -z "$macro_version"; then | |
1009 | cat >&2 <<_LT_EOF | |
1010 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the | |
1011 | $progname: definition of this LT_INIT comes from an older release. | |
1012 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION | |
1013 | $progname: and run autoconf again. | |
1014 | _LT_EOF | |
1015 | else | |
1016 | cat >&2 <<_LT_EOF | |
1017 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the | |
1018 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. | |
1019 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION | |
1020 | $progname: and run autoconf again. | |
1021 | _LT_EOF | |
1022 | fi | |
1023 | else | |
1024 | cat >&2 <<_LT_EOF | |
1025 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, | |
1026 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. | |
1027 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision | |
1028 | $progname: of $PACKAGE $VERSION and run autoconf again. | |
1029 | _LT_EOF | |
1030 | fi | |
1031 | ||
1032 | exit $EXIT_MISMATCH | |
1033 | fi | |
1034 | } | |
1035 | ||
1036 | ||
1037 | # func_lalib_p file | |
1038 | # True iff FILE is a libtool `.la' library or `.lo' object file. | |
1039 | # This function is only a basic sanity check; it will hardly flush out | |
1040 | # determined imposters. | |
1041 | func_lalib_p () | |
1042 | { | |
1043 | $SED -e 4q "$1" 2>/dev/null \ | |
1044 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 | |
1045 | } | |
1046 | ||
1047 | # func_lalib_unsafe_p file | |
1048 | # True iff FILE is a libtool `.la' library or `.lo' object file. | |
1049 | # This function implements the same check as func_lalib_p without | |
1050 | # resorting to external programs. To this end, it redirects stdin and | |
1051 | # closes it afterwards, without saving the original file descriptor. | |
1052 | # As a safety measure, use it only where a negative result would be | |
1053 | # fatal anyway. Works if `file' does not exist. | |
1054 | func_lalib_unsafe_p () | |
1055 | { | |
1056 | lalib_p=no | |
1057 | if test -r "$1" && exec 5<&1 <"$1"; then | |
1058 | for lalib_p_l in 1 2 3 4 | |
1059 | do | |
1060 | read lalib_p_line | |
1061 | case "$lalib_p_line" in | |
1062 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; | |
1063 | esac | |
1064 | done | |
1065 | exec 1<&5 5<&- | |
1066 | fi | |
1067 | test "$lalib_p" = yes | |
1068 | } | |
1069 | ||
1070 | # func_ltwrapper_p file | |
1071 | # True iff FILE is a libtool wrapper script. | |
1072 | # This function is only a basic sanity check; it will hardly flush out | |
1073 | # determined imposters. | |
1074 | func_ltwrapper_p () | |
1075 | { | |
1076 | func_lalib_p "$1" | |
1077 | } | |
1078 | ||
1079 | ||
1080 | # func_execute_cmds commands fail_cmd | |
1081 | # Execute tilde-delimited COMMANDS. | |
1082 | # If FAIL_CMD is given, eval that upon failure. | |
1083 | # FAIL_CMD may read-access the current command in variable CMD! | |
1084 | func_execute_cmds () | |
1085 | { | |
1086 | $opt_debug | |
1087 | save_ifs=$IFS; IFS='~' | |
1088 | for cmd in $1; do | |
1089 | IFS=$save_ifs | |
1090 | eval cmd=\"$cmd\" | |
1091 | func_show_eval "$cmd" "${2-:}" | |
1092 | done | |
1093 | IFS=$save_ifs | |
1094 | } | |
1095 | ||
1096 | ||
1097 | # func_source file | |
1098 | # Source FILE, adding directory component if necessary. | |
1099 | # Note that it is not necessary on cygwin/mingw to append a dot to | |
1100 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe | |
1101 | # behavior happens only for exec(3), not for open(2)! Also, sourcing | |
1102 | # `FILE.' does not work on cygwin managed mounts. | |
1103 | func_source () | |
1104 | { | |
1105 | $opt_debug | |
1106 | case $1 in | |
1107 | */* | *\\*) . "$1" ;; | |
1108 | *) . "./$1" ;; | |
1109 | esac | |
1110 | } | |
1111 | ||
1112 | ||
1113 | # Generated shell functions inserted here. | |
1114 | ||
1115 | ||
1116 | # func_win32_libid arg | |
1117 | # return the library type of file 'arg' | |
1118 | # | |
1119 | # Need a lot of goo to handle *both* DLLs and import libs | |
1120 | # Has to be a shell function in order to 'eat' the argument | |
1121 | # that is supplied when $file_magic_command is called. | |
1122 | func_win32_libid () | |
1123 | { | |
1124 | $opt_debug | |
1125 | win32_libid_type="unknown" | |
1126 | win32_fileres=`file -L $1 2>/dev/null` | |
1127 | case $win32_fileres in | |
1128 | *ar\ archive\ import\ library*) # definitely import | |
1129 | win32_libid_type="x86 archive import" | |
1130 | ;; | |
1131 | *ar\ archive*) # could be an import, or static | |
1132 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | | |
1133 | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then | |
1134 | win32_nmres=`eval $NM -f posix -A $1 | | |
1135 | $SED -n -e ' | |
1136 | 1,100{ | |
1137 | / I /{ | |
1138 | s,.*,import, | |
1139 | p | |
1140 | q | |
1141 | } | |
1142 | }'` | |
1143 | case $win32_nmres in | |
1144 | import*) win32_libid_type="x86 archive import";; | |
1145 | *) win32_libid_type="x86 archive static";; | |
1146 | esac | |
1147 | fi | |
1148 | ;; | |
1149 | *DLL*) | |
1150 | win32_libid_type="x86 DLL" | |
1151 | ;; | |
1152 | *executable*) # but shell scripts are "executable" too... | |
1153 | case $win32_fileres in | |
1154 | *MS\ Windows\ PE\ Intel*) | |
1155 | win32_libid_type="x86 DLL" | |
1156 | ;; | |
1157 | esac | |
1158 | ;; | |
1159 | esac | |
1160 | $ECHO "$win32_libid_type" | |
1161 | } | |
1162 | ||
1163 | ||
1164 | ||
1165 | # func_infer_tag arg | |
1166 | # Infer tagged configuration to use if any are available and | |
1167 | # if one wasn't chosen via the "--tag" command line option. | |
1168 | # Only attempt this if the compiler in the base compile | |
1169 | # command doesn't match the default compiler. | |
1170 | # arg is usually of the form 'gcc ...' | |
1171 | func_infer_tag () | |
1172 | { | |
1173 | $opt_debug | |
1174 | if test -n "$available_tags" && test -z "$tagname"; then | |
1175 | CC_quoted= | |
1176 | for arg in $CC; do | |
1177 | func_quote_for_eval "$arg" | |
1178 | CC_quoted="$CC_quoted $func_quote_for_eval_result" | |
1179 | done | |
1180 | case $@ in | |
1181 | # Blanks in the command may have been stripped by the calling shell, | |
1182 | # but not from the CC environment variable when configure was run. | |
1183 | " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; | |
1184 | # Blanks at the start of $base_compile will cause this to fail | |
1185 | # if we don't check for them as well. | |
1186 | *) | |
1187 | for z in $available_tags; do | |
1188 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then | |
1189 | # Evaluate the configuration. | |
1190 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" | |
1191 | CC_quoted= | |
1192 | for arg in $CC; do | |
1193 | # Double-quote args containing other shell metacharacters. | |
1194 | func_quote_for_eval "$arg" | |
1195 | CC_quoted="$CC_quoted $func_quote_for_eval_result" | |
1196 | done | |
1197 | case "$@ " in | |
1198 | " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) | |
1199 | # The compiler in the base compile command matches | |
1200 | # the one in the tagged configuration. | |
1201 | # Assume this is the tagged configuration we want. | |
1202 | tagname=$z | |
1203 | break | |
1204 | ;; | |
1205 | esac | |
1206 | fi | |
1207 | done | |
1208 | # If $tagname still isn't set, then no tagged configuration | |
1209 | # was found and let the user know that the "--tag" command | |
1210 | # line option must be used. | |
1211 | if test -z "$tagname"; then | |
1212 | func_echo "unable to infer tagged configuration" | |
1213 | func_fatal_error "specify a tag with \`--tag'" | |
1214 | # else | |
1215 | # func_verbose "using $tagname tagged configuration" | |
1216 | fi | |
1217 | ;; | |
1218 | esac | |
1219 | fi | |
1220 | } | |
1221 | ||
1222 | ||
1223 | ||
1224 | # func_generate_dlsyms outputname originator pic_p | |
1225 | # Extract symbols from dlprefiles and create ${outputname}S.o with | |
1226 | # a dlpreopen symbol table. | |
1227 | func_generate_dlsyms () | |
1228 | { | |
1229 | $opt_debug | |
1230 | my_outputname="$1" | |
1231 | my_originator="$2" | |
1232 | my_pic_p="${3-no}" | |
1233 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` | |
1234 | my_dlsyms= | |
1235 | ||
1236 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | |
1237 | if test -n "$NM" && test -n "$global_symbol_pipe"; then | |
1238 | my_dlsyms="${my_outputname}S.c" | |
1239 | else | |
1240 | func_error "not configured to extract global symbols from dlpreopened files" | |
1241 | fi | |
1242 | fi | |
1243 | ||
1244 | if test -n "$my_dlsyms"; then | |
1245 | case $my_dlsyms in | |
1246 | "") ;; | |
1247 | *.c) | |
1248 | # Discover the nlist of each of the dlfiles. | |
1249 | nlist="$output_objdir/${my_outputname}.nm" | |
1250 | ||
1251 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" | |
1252 | ||
1253 | # Parse the name list into a source file. | |
1254 | func_echo "creating $output_objdir/$my_dlsyms" | |
1255 | ||
1256 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ | |
1257 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ | |
1258 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ | |
1259 | ||
1260 | #ifdef __cplusplus | |
1261 | extern \"C\" { | |
1262 | #endif | |
1263 | ||
1264 | /* External symbol declarations for the compiler. */\ | |
1265 | " | |
1266 | ||
1267 | if test "$dlself" = yes; then | |
1268 | func_echo "generating symbol list for \`$output'" | |
1269 | ||
1270 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" | |
1271 | ||
1272 | # Add our own program objects to the symbol list. | |
1273 | progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
1274 | for progfile in $progfiles; do | |
1275 | func_echo "extracting global C symbols from \`$progfile'" | |
1276 | $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" | |
1277 | done | |
1278 | ||
1279 | if test -n "$exclude_expsyms"; then | |
1280 | $opt_dry_run || { | |
1281 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' | |
1282 | eval '$MV "$nlist"T "$nlist"' | |
1283 | } | |
1284 | fi | |
1285 | ||
1286 | if test -n "$export_symbols_regex"; then | |
1287 | $opt_dry_run || { | |
1288 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' | |
1289 | eval '$MV "$nlist"T "$nlist"' | |
1290 | } | |
1291 | fi | |
1292 | ||
1293 | # Prepare the list of exported symbols | |
1294 | if test -z "$export_symbols"; then | |
1295 | export_symbols="$output_objdir/$outputname.exp" | |
1296 | $opt_dry_run || { | |
1297 | $RM $export_symbols | |
1298 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' | |
1299 | case $host in | |
1300 | *cygwin* | *mingw* ) | |
1301 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' | |
1302 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' | |
1303 | ;; | |
1304 | esac | |
1305 | } | |
1306 | else | |
1307 | $opt_dry_run || { | |
1308 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' | |
1309 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' | |
1310 | eval '$MV "$nlist"T "$nlist"' | |
1311 | case $host in | |
1312 | *cygwin | *mingw* ) | |
1313 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' | |
1314 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' | |
1315 | ;; | |
1316 | esac | |
1317 | } | |
1318 | fi | |
1319 | fi | |
1320 | ||
1321 | for dlprefile in $dlprefiles; do | |
1322 | func_echo "extracting global C symbols from \`$dlprefile'" | |
1323 | func_basename "$dlprefile" | |
1324 | name="$func_basename_result" | |
1325 | $opt_dry_run || { | |
1326 | eval '$ECHO ": $name " >> "$nlist"' | |
1327 | eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" | |
1328 | } | |
1329 | done | |
1330 | ||
1331 | $opt_dry_run || { | |
1332 | # Make sure we have at least an empty file. | |
1333 | test -f "$nlist" || : > "$nlist" | |
1334 | ||
1335 | if test -n "$exclude_expsyms"; then | |
1336 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T | |
1337 | $MV "$nlist"T "$nlist" | |
1338 | fi | |
1339 | ||
1340 | # Try sorting and uniquifying the output. | |
1341 | if $GREP -v "^: " < "$nlist" | | |
1342 | if sort -k 3 </dev/null >/dev/null 2>&1; then | |
1343 | sort -k 3 | |
1344 | else | |
1345 | sort +2 | |
1346 | fi | | |
1347 | uniq > "$nlist"S; then | |
1348 | : | |
1349 | else | |
1350 | $GREP -v "^: " < "$nlist" > "$nlist"S | |
1351 | fi | |
1352 | ||
1353 | if test -f "$nlist"S; then | |
1354 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' | |
1355 | else | |
1356 | $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" | |
1357 | fi | |
1358 | ||
1359 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | |
1360 | ||
1361 | /* The mapping between symbol names and symbols. */ | |
1362 | " | |
1363 | case $host in | |
1364 | *cygwin* | *mingw* ) | |
1365 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | |
1366 | /* DATA imports from DLLs on WIN32 con't be const, because | |
1367 | runtime relocations are performed -- see ld's documentation | |
1368 | on pseudo-relocs. */ | |
1369 | struct { | |
1370 | " | |
1371 | ;; | |
1372 | *) | |
1373 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | |
1374 | const struct { | |
1375 | " | |
1376 | ;; | |
1377 | esac | |
1378 | ||
1379 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | |
1380 | const char *name; | |
1381 | void *address; | |
1382 | } | |
1383 | lt_${my_prefix}_LTX_preloaded_symbols[] = | |
1384 | {\ | |
1385 | { \"$my_originator\", (void *) 0 }, | |
1386 | " | |
1387 | ||
1388 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" | |
1389 | ||
1390 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | |
1391 | {0, (void *) 0} | |
1392 | }; | |
1393 | ||
1394 | /* This works around a problem in FreeBSD linker */ | |
1395 | #ifdef FREEBSD_WORKAROUND | |
1396 | static const void *lt_preloaded_setup() { | |
1397 | return lt_${my_prefix}_LTX_preloaded_symbols; | |
1398 | } | |
1399 | #endif | |
1400 | ||
1401 | #ifdef __cplusplus | |
1402 | } | |
1403 | #endif\ | |
1404 | " | |
1405 | } # !$opt_dry_run | |
1406 | ||
1407 | pic_flag_for_symtable= | |
1408 | case "$compile_command " in | |
1409 | *" -static "*) ;; | |
1410 | *) | |
1411 | case $host in | |
1412 | # compiling the symbol table file with pic_flag works around | |
1413 | # a FreeBSD bug that causes programs to crash when -lm is | |
1414 | # linked before any other PIC object. But we must not use | |
1415 | # pic_flag when linking with -static. The problem exists in | |
1416 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. | |
1417 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) | |
1418 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; | |
1419 | *-*-hpux*) | |
1420 | pic_flag_for_symtable=" $pic_flag" ;; | |
1421 | *) | |
1422 | if test "X$my_pic_p" != Xno; then | |
1423 | pic_flag_for_symtable=" $pic_flag" | |
1424 | fi | |
1425 | ;; | |
1426 | esac | |
1427 | ;; | |
1428 | esac | |
1429 | symtab_cflags= | |
1430 | for arg in $LTCFLAGS; do | |
1431 | case $arg in | |
1432 | -pie | -fpie | -fPIE) ;; | |
1433 | *) symtab_cflags="$symtab_cflags $arg" ;; | |
1434 | esac | |
1435 | done | |
1436 | ||
1437 | # Now compile the dynamic symbol file. | |
1438 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' | |
1439 | ||
1440 | # Clean up the generated files. | |
1441 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' | |
1442 | ||
1443 | # Transform the symbol file into the correct name. | |
1444 | symfileobj="$output_objdir/${my_outputname}S.$objext" | |
1445 | case $host in | |
1446 | *cygwin* | *mingw* ) | |
1447 | if test -f "$output_objdir/$my_outputname.def"; then | |
1448 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` | |
1449 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` | |
1450 | else | |
1451 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | |
1452 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | |
1453 | fi | |
1454 | ;; | |
1455 | *) | |
1456 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | |
1457 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | |
1458 | ;; | |
1459 | esac | |
1460 | ;; | |
1461 | *) | |
1462 | func_fatal_error "unknown suffix for \`$my_dlsyms'" | |
1463 | ;; | |
1464 | esac | |
1465 | else | |
1466 | # We keep going just in case the user didn't refer to | |
1467 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe | |
1468 | # really was required. | |
1469 | ||
1470 | # Nullify the symbol file. | |
1471 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` | |
1472 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` | |
1473 | fi | |
1474 | } | |
1475 | ||
1476 | # func_extract_an_archive dir oldlib | |
1477 | func_extract_an_archive () | |
1478 | { | |
1479 | $opt_debug | |
1480 | f_ex_an_ar_dir="$1"; shift | |
1481 | f_ex_an_ar_oldlib="$1" | |
1482 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?' | |
1483 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then | |
1484 | : | |
1485 | else | |
1486 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" | |
1487 | fi | |
1488 | } | |
1489 | ||
1490 | ||
1491 | # func_extract_archives gentop oldlib ... | |
1492 | func_extract_archives () | |
1493 | { | |
1494 | $opt_debug | |
1495 | my_gentop="$1"; shift | |
1496 | my_oldlibs=${1+"$@"} | |
1497 | my_oldobjs="" | |
1498 | my_xlib="" | |
1499 | my_xabs="" | |
1500 | my_xdir="" | |
1501 | ||
1502 | for my_xlib in $my_oldlibs; do | |
1503 | # Extract the objects. | |
1504 | case $my_xlib in | |
1505 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; | |
1506 | *) my_xabs=`pwd`"/$my_xlib" ;; | |
1507 | esac | |
1508 | func_basename "$my_xlib" | |
1509 | my_xlib="$func_basename_result" | |
1510 | my_xdir="$my_gentop/$my_xlib" | |
1511 | ||
1512 | func_mkdir_p "$my_xdir" | |
1513 | ||
1514 | case $host in | |
1515 | *-darwin*) | |
1516 | func_echo "Extracting $my_xabs" | |
1517 | # Do not bother doing anything if just a dry run | |
1518 | $opt_dry_run || { | |
1519 | darwin_orig_dir=`pwd` | |
1520 | cd $my_xdir || exit $? | |
1521 | darwin_archive=$my_xabs | |
1522 | darwin_curdir=`pwd` | |
1523 | darwin_base_archive=`basename $darwin_archive` | |
1524 | darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` | |
1525 | if test -n "$darwin_arches"; then | |
1526 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` | |
1527 | darwin_arch= | |
1528 | func_echo "$darwin_base_archive has multiple architectures $darwin_arches" | |
1529 | for darwin_arch in $darwin_arches ; do | |
1530 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" | |
1531 | lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" | |
1532 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" | |
1533 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" | |
1534 | cd "$darwin_curdir" | |
1535 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" | |
1536 | done # $darwin_arches | |
1537 | ## Okay now we've a bunch of thin objects, gotta fatten them up :) | |
1538 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` | |
1539 | darwin_file= | |
1540 | darwin_files= | |
1541 | for darwin_file in $darwin_filelist; do | |
1542 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` | |
1543 | lipo -create -output "$darwin_file" $darwin_files | |
1544 | done # $darwin_filelist | |
1545 | $RM -rf unfat-$$ | |
1546 | cd "$darwin_orig_dir" | |
1547 | else | |
1548 | cd $darwin_orig_dir | |
1549 | func_extract_an_archive "$my_xdir" "$my_xabs" | |
1550 | fi # $darwin_arches | |
1551 | } # !$opt_dry_run | |
1552 | ;; | |
1553 | *) | |
1554 | func_extract_an_archive "$my_xdir" "$my_xabs" | |
1555 | ;; | |
1556 | esac | |
1557 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` | |
1558 | done | |
1559 | ||
1560 | func_extract_archives_result="$my_oldobjs" | |
1561 | } | |
1562 | ||
1563 | ||
1564 | # func_mode_compile arg... | |
1565 | func_mode_compile () | |
1566 | { | |
1567 | $opt_debug | |
1568 | # Get the compilation command and the source file. | |
1569 | base_compile= | |
1570 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" | |
1571 | suppress_opt=yes | |
1572 | suppress_output= | |
1573 | arg_mode=normal | |
1574 | libobj= | |
1575 | later= | |
1576 | pie_flag= | |
1577 | ||
1578 | for arg | |
1579 | do | |
1580 | case $arg_mode in | |
1581 | arg ) | |
1582 | # do not "continue". Instead, add this to base_compile | |
1583 | lastarg="$arg" | |
1584 | arg_mode=normal | |
1585 | ;; | |
1586 | ||
1587 | target ) | |
1588 | libobj="$arg" | |
1589 | arg_mode=normal | |
1590 | continue | |
1591 | ;; | |
1592 | ||
1593 | normal ) | |
1594 | # Accept any command-line options. | |
1595 | case $arg in | |
1596 | -o) | |
1597 | test -n "$libobj" && \ | |
1598 | func_fatal_error "you cannot specify \`-o' more than once" | |
1599 | arg_mode=target | |
1600 | continue | |
1601 | ;; | |
1602 | ||
1603 | -pie | -fpie | -fPIE) | |
1604 | pie_flag="$pie_flag $arg" | |
1605 | continue | |
1606 | ;; | |
1607 | ||
1608 | -shared | -static | -prefer-pic | -prefer-non-pic) | |
1609 | later="$later $arg" | |
1610 | continue | |
1611 | ;; | |
1612 | ||
1613 | -no-suppress) | |
1614 | suppress_opt=no | |
1615 | continue | |
1616 | ;; | |
1617 | ||
1618 | -Xcompiler) | |
1619 | arg_mode=arg # the next one goes into the "base_compile" arg list | |
1620 | continue # The current "srcfile" will either be retained or | |
1621 | ;; # replaced later. I would guess that would be a bug. | |
1622 | ||
1623 | -Wc,*) | |
1624 | func_stripname '-Wc,' '' "$arg" | |
1625 | args=$func_stripname_result | |
1626 | lastarg= | |
1627 | save_ifs="$IFS"; IFS=',' | |
1628 | for arg in $args; do | |
1629 | IFS="$save_ifs" | |
1630 | func_quote_for_eval "$arg" | |
1631 | lastarg="$lastarg $func_quote_for_eval_result" | |
1632 | done | |
1633 | IFS="$save_ifs" | |
1634 | func_stripname ' ' '' "$lastarg" | |
1635 | lastarg=$func_stripname_result | |
1636 | ||
1637 | # Add the arguments to base_compile. | |
1638 | base_compile="$base_compile $lastarg" | |
1639 | continue | |
1640 | ;; | |
1641 | ||
1642 | *) | |
1643 | # Accept the current argument as the source file. | |
1644 | # The previous "srcfile" becomes the current argument. | |
1645 | # | |
1646 | lastarg="$srcfile" | |
1647 | srcfile="$arg" | |
1648 | ;; | |
1649 | esac # case $arg | |
1650 | ;; | |
1651 | esac # case $arg_mode | |
1652 | ||
1653 | # Aesthetically quote the previous argument. | |
1654 | func_quote_for_eval "$lastarg" | |
1655 | base_compile="$base_compile $func_quote_for_eval_result" | |
1656 | done # for arg | |
1657 | ||
1658 | case $arg_mode in | |
1659 | arg) | |
1660 | func_fatal_error "you must specify an argument for -Xcompile" | |
1661 | ;; | |
1662 | target) | |
1663 | func_fatal_error "you must specify a target with \`-o'" | |
1664 | ;; | |
1665 | *) | |
1666 | # Get the name of the library object. | |
1667 | test -z "$libobj" && { | |
1668 | func_basename "$srcfile" | |
1669 | libobj="$func_basename_result" | |
1670 | } | |
1671 | ;; | |
1672 | esac | |
1673 | ||
1674 | # Recognize several different file suffixes. | |
1675 | # If the user specifies -o file.o, it is replaced with file.lo | |
1676 | xform='[cCFSifmso]' | |
1677 | case $libobj in | |
1678 | *.ada) xform=ada ;; | |
1679 | *.adb) xform=adb ;; | |
1680 | *.ads) xform=ads ;; | |
1681 | *.asm) xform=asm ;; | |
1682 | *.c++) xform=c++ ;; | |
1683 | *.cc) xform=cc ;; | |
1684 | *.ii) xform=ii ;; | |
1685 | *.class) xform=class ;; | |
1686 | *.cpp) xform=cpp ;; | |
1687 | *.cxx) xform=cxx ;; | |
1688 | *.f90) xform=f90 ;; | |
1689 | *.for) xform=for ;; | |
1690 | *.java) xform=java ;; | |
1691 | *.obj) xform=obj ;; | |
1692 | esac | |
1693 | ||
1694 | libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` | |
1695 | ||
1696 | case $libobj in | |
1697 | *.lo) obj=`$ECHO "X$libobj" | $Xsed -e "$lo2o"` ;; | |
1698 | *) | |
1699 | func_fatal_error "cannot determine name of library object from \`$libobj'" | |
1700 | ;; | |
1701 | esac | |
1702 | ||
1703 | func_infer_tag $base_compile | |
1704 | ||
1705 | for arg in $later; do | |
1706 | case $arg in | |
1707 | -shared) | |
1708 | test "$build_libtool_libs" != yes && \ | |
1709 | func_fatal_configuration "can not build a shared library" | |
1710 | build_old_libs=no | |
1711 | continue | |
1712 | ;; | |
1713 | ||
1714 | -static) | |
1715 | build_libtool_libs=no | |
1716 | build_old_libs=yes | |
1717 | continue | |
1718 | ;; | |
1719 | ||
1720 | -prefer-pic) | |
1721 | pic_mode=yes | |
1722 | continue | |
1723 | ;; | |
1724 | ||
1725 | -prefer-non-pic) | |
1726 | pic_mode=no | |
1727 | continue | |
1728 | ;; | |
1729 | esac | |
1730 | done | |
1731 | ||
1732 | func_quote_for_eval "$libobj" | |
1733 | test "X$libobj" != "X$func_quote_for_eval_result" \ | |
1734 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ | |
1735 | && func_warning "libobj name \`$libobj' may not contain shell special characters." | |
1736 | func_basename "$obj" | |
1737 | objname="$func_basename_result" | |
1738 | func_dirname "$obj" "/" "" | |
1739 | xdir="$func_dirname_result" | |
1740 | lobj=${xdir}$objdir/$objname | |
1741 | ||
1742 | test -z "$base_compile" && \ | |
1743 | func_fatal_help "you must specify a compilation command" | |
1744 | ||
1745 | # Delete any leftover library objects. | |
1746 | if test "$build_old_libs" = yes; then | |
1747 | removelist="$obj $lobj $libobj ${libobj}T" | |
1748 | else | |
1749 | removelist="$lobj $libobj ${libobj}T" | |
1750 | fi | |
1751 | ||
1752 | $opt_dry_run || $RM $removelist | |
1753 | trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15 | |
1754 | ||
1755 | # On Cygwin there's no "real" PIC flag so we must build both object types | |
1756 | case $host_os in | |
1757 | cygwin* | mingw* | pw32* | os2*) | |
1758 | pic_mode=default | |
1759 | ;; | |
1760 | esac | |
1761 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then | |
1762 | # non-PIC code in shared libraries is not supported | |
1763 | pic_mode=default | |
1764 | fi | |
1765 | ||
1766 | # Calculate the filename of the output object if compiler does | |
1767 | # not support -o with -c | |
1768 | if test "$compiler_c_o" = no; then | |
1769 | output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} | |
1770 | lockfile="$output_obj.lock" | |
1771 | removelist="$removelist $output_obj $lockfile" | |
1772 | trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15 | |
1773 | else | |
1774 | output_obj= | |
1775 | need_locks=no | |
1776 | lockfile= | |
1777 | fi | |
1778 | ||
1779 | # Lock this critical section if it is needed | |
1780 | # We use this script file to make the link, it avoids creating a new file | |
1781 | if test "$need_locks" = yes; then | |
1782 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do | |
1783 | func_echo "Waiting for $lockfile to be removed" | |
1784 | sleep 2 | |
1785 | done | |
1786 | elif test "$need_locks" = warn; then | |
1787 | if test -f "$lockfile"; then | |
1788 | $ECHO "\ | |
1789 | *** ERROR, $lockfile exists and contains: | |
1790 | `cat $lockfile 2>/dev/null` | |
1791 | ||
1792 | This indicates that another process is trying to use the same | |
1793 | temporary object file, and libtool could not work around it because | |
1794 | your compiler does not support \`-c' and \`-o' together. If you | |
1795 | repeat this compilation, it may succeed, by chance, but you had better | |
1796 | avoid parallel builds (make -j) in this platform, or get a better | |
1797 | compiler." | |
1798 | ||
1799 | $opt_dry_run || $RM $removelist | |
1800 | exit $EXIT_FAILURE | |
1801 | fi | |
1802 | $ECHO "$srcfile" > "$lockfile" | |
1803 | fi | |
1804 | ||
1805 | if test -n "$fix_srcfile_path"; then | |
1806 | eval srcfile=\"$fix_srcfile_path\" | |
1807 | fi | |
1808 | func_quote_for_eval "$srcfile" | |
1809 | qsrcfile=$func_quote_for_eval_result | |
1810 | ||
1811 | $opt_dry_run || $RM "$libobj" "${libobj}T" | |
1812 | ||
1813 | # Create a libtool object file (analogous to a ".la" file), | |
1814 | # but don't create it if we're doing a dry run. | |
1815 | $opt_dry_run || cat > ${libobj}T <<EOF | |
1816 | # $libobj - a libtool object file | |
1817 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | |
1818 | # | |
1819 | # Please DO NOT delete this file! | |
1820 | # It is necessary for linking the library. | |
1821 | ||
1822 | # Name of the PIC object. | |
1823 | EOF | |
1824 | ||
1825 | # Only build a PIC object if we are building libtool libraries. | |
1826 | if test "$build_libtool_libs" = yes; then | |
1827 | # Without this assignment, base_compile gets emptied. | |
1828 | fbsd_hideous_sh_bug=$base_compile | |
1829 | ||
1830 | if test "$pic_mode" != no; then | |
1831 | command="$base_compile $qsrcfile $pic_flag" | |
1832 | else | |
1833 | # Don't build PIC code | |
1834 | command="$base_compile $qsrcfile" | |
1835 | fi | |
1836 | ||
1837 | func_mkdir_p "$xdir$objdir" | |
1838 | ||
1839 | if test -z "$output_obj"; then | |
1840 | # Place PIC objects in $objdir | |
1841 | command="$command -o $lobj" | |
1842 | fi | |
1843 | ||
1844 | $opt_dry_run || $RM "$lobj" "$output_obj" | |
1845 | ||
1846 | func_show_eval "$command" \ | |
1847 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' | |
1848 | ||
1849 | if test "$need_locks" = warn && | |
1850 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then | |
1851 | $ECHO "\ | |
1852 | *** ERROR, $lockfile contains: | |
1853 | `cat $lockfile 2>/dev/null` | |
1854 | ||
1855 | but it should contain: | |
1856 | $srcfile | |
1857 | ||
1858 | This indicates that another process is trying to use the same | |
1859 | temporary object file, and libtool could not work around it because | |
1860 | your compiler does not support \`-c' and \`-o' together. If you | |
1861 | repeat this compilation, it may succeed, by chance, but you had better | |
1862 | avoid parallel builds (make -j) in this platform, or get a better | |
1863 | compiler." | |
1864 | ||
1865 | $opt_dry_run || $RM $removelist | |
1866 | exit $EXIT_FAILURE | |
1867 | fi | |
1868 | ||
1869 | # Just move the object if needed, then go on to compile the next one | |
1870 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then | |
1871 | func_show_eval '$MV "$output_obj" "$lobj"' \ | |
1872 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' | |
1873 | fi | |
1874 | ||
1875 | # Append the name of the PIC object to the libtool object file. | |
1876 | $opt_dry_run || cat >> ${libobj}T <<EOF | |
1877 | pic_object='$objdir/$objname' | |
1878 | ||
1879 | EOF | |
1880 | ||
1881 | # Allow error messages only from the first compilation. | |
1882 | if test "$suppress_opt" = yes; then | |
1883 | suppress_output=' >/dev/null 2>&1' | |
1884 | fi | |
1885 | else | |
1886 | # No PIC object so indicate it doesn't exist in the libtool | |
1887 | # object file. | |
1888 | $opt_dry_run || cat >> ${libobj}T <<EOF | |
1889 | pic_object=none | |
1890 | ||
1891 | EOF | |
1892 | fi | |
1893 | ||
1894 | # Only build a position-dependent object if we build old libraries. | |
1895 | if test "$build_old_libs" = yes; then | |
1896 | if test "$pic_mode" != yes; then | |
1897 | # Don't build PIC code | |
1898 | command="$base_compile $qsrcfile$pie_flag" | |
1899 | else | |
1900 | command="$base_compile $qsrcfile $pic_flag" | |
1901 | fi | |
1902 | if test "$compiler_c_o" = yes; then | |
1903 | command="$command -o $obj" | |
1904 | fi | |
1905 | ||
1906 | # Suppress compiler output if we already did a PIC compilation. | |
1907 | command="$command$suppress_output" | |
1908 | $opt_dry_run || $RM "$obj" "$output_obj" | |
1909 | func_show_eval "$command" \ | |
1910 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' | |
1911 | ||
1912 | if test "$need_locks" = warn && | |
1913 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then | |
1914 | $ECHO "\ | |
1915 | *** ERROR, $lockfile contains: | |
1916 | `cat $lockfile 2>/dev/null` | |
1917 | ||
1918 | but it should contain: | |
1919 | $srcfile | |
1920 | ||
1921 | This indicates that another process is trying to use the same | |
1922 | temporary object file, and libtool could not work around it because | |
1923 | your compiler does not support \`-c' and \`-o' together. If you | |
1924 | repeat this compilation, it may succeed, by chance, but you had better | |
1925 | avoid parallel builds (make -j) in this platform, or get a better | |
1926 | compiler." | |
1927 | ||
1928 | $opt_dry_run || $RM $removelist | |
1929 | exit $EXIT_FAILURE | |
1930 | fi | |
1931 | ||
1932 | # Just move the object if needed | |
1933 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then | |
1934 | func_show_eval '$MV "$output_obj" "$obj"' \ | |
1935 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' | |
1936 | fi | |
1937 | ||
1938 | # Append the name of the non-PIC object the libtool object file. | |
1939 | # Only append if the libtool object file exists. | |
1940 | $opt_dry_run || cat >> ${libobj}T <<EOF | |
1941 | # Name of the non-PIC object. | |
1942 | non_pic_object='$objname' | |
1943 | ||
1944 | EOF | |
1945 | else | |
1946 | # Append the name of the non-PIC object the libtool object file. | |
1947 | # Only append if the libtool object file exists. | |
1948 | $opt_dry_run || cat >> ${libobj}T <<EOF | |
1949 | # Name of the non-PIC object. | |
1950 | non_pic_object=none | |
1951 | ||
1952 | EOF | |
1953 | fi | |
1954 | ||
1955 | $opt_dry_run || { | |
1956 | $MV "${libobj}T" "${libobj}" | |
1957 | ||
1958 | # Unlock the critical section if it was locked | |
1959 | if test "$need_locks" != no; then | |
1960 | $RM "$lockfile" | |
1961 | fi | |
1962 | } | |
1963 | ||
1964 | exit $EXIT_SUCCESS | |
1965 | } | |
1966 | ||
1967 | ||
1968 | # func_mode_execute arg... | |
1969 | func_mode_execute () | |
1970 | { | |
1971 | $opt_debug | |
1972 | # The first argument is the command name. | |
1973 | cmd="$nonopt" | |
1974 | test -z "$cmd" && \ | |
1975 | func_fatal_help "you must specify a COMMAND" | |
1976 | ||
1977 | # Handle -dlopen flags immediately. | |
1978 | for file in $execute_dlfiles; do | |
1979 | test -f "$file" \ | |
1980 | || func_fatal_help "\`$file' is not a file" | |
1981 | ||
1982 | dir= | |
1983 | case $file in | |
1984 | *.la) | |
1985 | # Check to see that this really is a libtool archive. | |
1986 | func_lalib_unsafe_p "$file" \ | |
1987 | || func_fatal_help "\`$lib' is not a valid libtool archive" | |
1988 | ||
1989 | # Read the libtool library. | |
1990 | dlname= | |
1991 | library_names= | |
1992 | func_source "$file" | |
1993 | ||
1994 | # Skip this library if it cannot be dlopened. | |
1995 | if test -z "$dlname"; then | |
1996 | # Warn if it was a shared library. | |
1997 | test -n "$library_names" && \ | |
1998 | func_warning "\`$file' was not linked with \`-export-dynamic'" | |
1999 | continue | |
2000 | fi | |
2001 | ||
2002 | func_dirname "$file" "" "." | |
2003 | dir="$func_dirname_result" | |
2004 | ||
2005 | if test -f "$dir/$objdir/$dlname"; then | |
2006 | dir="$dir/$objdir" | |
2007 | else | |
2008 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" | |
2009 | fi | |
2010 | ;; | |
2011 | ||
2012 | *.lo) | |
2013 | # Just add the directory containing the .lo file. | |
2014 | func_dirname "$file" "" "." | |
2015 | dir="$func_dirname_result" | |
2016 | ;; | |
2017 | ||
2018 | *) | |
2019 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" | |
2020 | continue | |
2021 | ;; | |
2022 | esac | |
2023 | ||
2024 | # Get the absolute pathname. | |
2025 | absdir=`cd "$dir" && pwd` | |
2026 | test -n "$absdir" && dir="$absdir" | |
2027 | ||
2028 | # Now add the directory to shlibpath_var. | |
2029 | if eval "test -z \"\$$shlibpath_var\""; then | |
2030 | eval "$shlibpath_var=\"\$dir\"" | |
2031 | else | |
2032 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" | |
2033 | fi | |
2034 | done | |
2035 | ||
2036 | # This variable tells wrapper scripts just to set shlibpath_var | |
2037 | # rather than running their programs. | |
2038 | libtool_execute_magic="$magic" | |
2039 | ||
2040 | # Check if any of the arguments is a wrapper script. | |
2041 | args= | |
2042 | for file | |
2043 | do | |
2044 | case $file in | |
2045 | -*) ;; | |
2046 | *) | |
2047 | # Do a test to see if this is really a libtool program. | |
2048 | if func_ltwrapper_p "$file"; then | |
2049 | func_source "$file" | |
2050 | ||
2051 | # Transform arg to wrapped name. | |
2052 | file="$progdir/$program" | |
2053 | fi | |
2054 | ;; | |
2055 | esac | |
2056 | # Quote arguments (to preserve shell metacharacters). | |
2057 | func_quote_for_eval "$file" | |
2058 | args="$args $func_quote_for_eval_result" | |
2059 | done | |
2060 | ||
2061 | if test "X$opt_dry_run" = Xfalse; then | |
2062 | if test -n "$shlibpath_var"; then | |
2063 | # Export the shlibpath_var. | |
2064 | eval "export $shlibpath_var" | |
2065 | fi | |
2066 | ||
2067 | # Restore saved environment variables | |
2068 | if test "${save_LC_ALL+set}" = set; then | |
2069 | LC_ALL="$save_LC_ALL"; export LC_ALL | |
2070 | fi | |
2071 | if test "${save_LANG+set}" = set; then | |
2072 | LANG="$save_LANG"; export LANG | |
2073 | fi | |
2074 | ||
2075 | # Now prepare to actually exec the command. | |
2076 | exec_cmd="\$cmd$args" | |
2077 | else | |
2078 | # Display what would be done. | |
2079 | if test -n "$shlibpath_var"; then | |
2080 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" | |
2081 | $ECHO "export $shlibpath_var" | |
2082 | fi | |
2083 | $ECHO "$cmd$args" | |
2084 | exit $EXIT_SUCCESS | |
2085 | fi | |
2086 | } | |
2087 | ||
2088 | ||
2089 | # func_mode_finish arg... | |
2090 | func_mode_finish () | |
2091 | { | |
2092 | $opt_debug | |
2093 | libdirs="$nonopt" | |
2094 | admincmds= | |
2095 | ||
2096 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then | |
2097 | for dir | |
2098 | do | |
2099 | libdirs="$libdirs $dir" | |
2100 | done | |
2101 | ||
2102 | for libdir in $libdirs; do | |
2103 | if test -n "$finish_cmds"; then | |
2104 | # Do each command in the finish commands. | |
2105 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds | |
2106 | '"$cmd"'"' | |
2107 | fi | |
2108 | if test -n "$finish_eval"; then | |
2109 | # Do the single finish_eval. | |
2110 | eval cmds=\"$finish_eval\" | |
2111 | $opt_dry_run || eval "$cmds" || admincmds="$admincmds | |
2112 | $cmds" | |
2113 | fi | |
2114 | done | |
2115 | fi | |
2116 | ||
2117 | # Exit here if they wanted silent mode. | |
2118 | $opt_silent && exit $EXIT_SUCCESS | |
2119 | ||
2120 | $ECHO "X----------------------------------------------------------------------" | $Xsed | |
2121 | $ECHO "Libraries have been installed in:" | |
2122 | for libdir in $libdirs; do | |
2123 | $ECHO " $libdir" | |
2124 | done | |
2125 | $ECHO | |
2126 | $ECHO "If you ever happen to want to link against installed libraries" | |
2127 | $ECHO "in a given directory, LIBDIR, you must either use libtool, and" | |
2128 | $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" | |
2129 | $ECHO "flag during linking and do at least one of the following:" | |
2130 | if test -n "$shlibpath_var"; then | |
2131 | $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" | |
2132 | $ECHO " during execution" | |
2133 | fi | |
2134 | if test -n "$runpath_var"; then | |
2135 | $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" | |
2136 | $ECHO " during linking" | |
2137 | fi | |
2138 | if test -n "$hardcode_libdir_flag_spec"; then | |
2139 | libdir=LIBDIR | |
2140 | eval flag=\"$hardcode_libdir_flag_spec\" | |
2141 | ||
2142 | $ECHO " - use the \`$flag' linker flag" | |
2143 | fi | |
2144 | if test -n "$admincmds"; then | |
2145 | $ECHO " - have your system administrator run these commands:$admincmds" | |
2146 | fi | |
2147 | if test -f /etc/ld.so.conf; then | |
2148 | $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" | |
2149 | fi | |
2150 | $ECHO | |
2151 | ||
2152 | $ECHO "See any operating system documentation about shared libraries for" | |
2153 | case $host in | |
2154 | solaris2.[6789]|solaris2.1[0-9]) | |
2155 | $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" | |
2156 | $ECHO "pages." | |
2157 | ;; | |
2158 | *) | |
2159 | $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." | |
2160 | ;; | |
2161 | esac | |
2162 | $ECHO "X----------------------------------------------------------------------" | $Xsed | |
2163 | exit $EXIT_SUCCESS | |
2164 | } | |
2165 | ||
2166 | ||
2167 | # func_mode_install arg... | |
2168 | func_mode_install () | |
2169 | { | |
2170 | $opt_debug | |
2171 | # There may be an optional sh(1) argument at the beginning of | |
2172 | # install_prog (especially on Windows NT). | |
2173 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || | |
2174 | # Allow the use of GNU shtool's install command. | |
2175 | $ECHO "X$nonopt" | $GREP shtool >/dev/null; then | |
2176 | # Aesthetically quote it. | |
2177 | func_quote_for_eval "$nonopt" | |
2178 | install_prog="$func_quote_for_eval_result " | |
2179 | arg=$1 | |
2180 | shift | |
2181 | else | |
2182 | install_prog= | |
2183 | arg=$nonopt | |
2184 | fi | |
2185 | ||
2186 | # The real first argument should be the name of the installation program. | |
2187 | # Aesthetically quote it. | |
2188 | func_quote_for_eval "$arg" | |
2189 | install_prog="$install_prog$func_quote_for_eval_result" | |
2190 | ||
2191 | # We need to accept at least all the BSD install flags. | |
2192 | dest= | |
2193 | files= | |
2194 | opts= | |
2195 | prev= | |
2196 | install_type= | |
2197 | isdir=no | |
2198 | stripme= | |
2199 | for arg | |
2200 | do | |
2201 | if test -n "$dest"; then | |
2202 | files="$files $dest" | |
2203 | dest=$arg | |
2204 | continue | |
2205 | fi | |
2206 | ||
2207 | case $arg in | |
2208 | -d) isdir=yes ;; | |
2209 | -f) | |
2210 | case " $install_prog " in | |
2211 | *[\\\ /]cp\ *) ;; | |
2212 | *) prev=$arg ;; | |
2213 | esac | |
2214 | ;; | |
2215 | -g | -m | -o) | |
2216 | prev=$arg | |
2217 | ;; | |
2218 | -s) | |
2219 | stripme=" -s" | |
2220 | continue | |
2221 | ;; | |
2222 | -*) | |
2223 | ;; | |
2224 | *) | |
2225 | # If the previous option needed an argument, then skip it. | |
2226 | if test -n "$prev"; then | |
2227 | prev= | |
2228 | else | |
2229 | dest=$arg | |
2230 | continue | |
2231 | fi | |
2232 | ;; | |
2233 | esac | |
2234 | ||
2235 | # Aesthetically quote the argument. | |
2236 | func_quote_for_eval "$arg" | |
2237 | install_prog="$install_prog $func_quote_for_eval_result" | |
2238 | done | |
2239 | ||
2240 | test -z "$install_prog" && \ | |
2241 | func_fatal_help "you must specify an install program" | |
2242 | ||
2243 | test -n "$prev" && \ | |
2244 | func_fatal_help "the \`$prev' option requires an argument" | |
2245 | ||
2246 | if test -z "$files"; then | |
2247 | if test -z "$dest"; then | |
2248 | func_fatal_help "no file or destination specified" | |
2249 | else | |
2250 | func_fatal_help "you must specify a destination" | |
2251 | fi | |
2252 | fi | |
2253 | ||
2254 | # Strip any trailing slash from the destination. | |
2255 | func_stripname '' '/' "$dest" | |
2256 | dest=$func_stripname_result | |
2257 | ||
2258 | # Check to see that the destination is a directory. | |
2259 | test -d "$dest" && isdir=yes | |
2260 | if test "$isdir" = yes; then | |
2261 | destdir="$dest" | |
2262 | destname= | |
2263 | else | |
2264 | func_dirname "$dest" "" "." | |
2265 | destdir="$func_dirname_result" | |
2266 | func_basename "$dest" | |
2267 | destname="$func_basename_result" | |
2268 | ||
2269 | # Not a directory, so check to see that there is only one file specified. | |
2270 | set dummy $files; shift | |
2271 | test "$#" -gt 1 && \ | |
2272 | func_fatal_help "\`$dest' is not a directory" | |
2273 | fi | |
2274 | case $destdir in | |
2275 | [\\/]* | [A-Za-z]:[\\/]*) ;; | |
2276 | *) | |
2277 | for file in $files; do | |
2278 | case $file in | |
2279 | *.lo) ;; | |
2280 | *) | |
2281 | func_fatal_help "\`$destdir' must be an absolute directory name" | |
2282 | ;; | |
2283 | esac | |
2284 | done | |
2285 | ;; | |
2286 | esac | |
2287 | ||
2288 | # This variable tells wrapper scripts just to set variables rather | |
2289 | # than running their programs. | |
2290 | libtool_install_magic="$magic" | |
2291 | ||
2292 | staticlibs= | |
2293 | future_libdirs= | |
2294 | current_libdirs= | |
2295 | for file in $files; do | |
2296 | ||
2297 | # Do each installation. | |
2298 | case $file in | |
2299 | *.$libext) | |
2300 | # Do the static libraries later. | |
2301 | staticlibs="$staticlibs $file" | |
2302 | ;; | |
2303 | ||
2304 | *.la) | |
2305 | # Check to see that this really is a libtool archive. | |
2306 | func_lalib_unsafe_p "$file" \ | |
2307 | || func_fatal_help "\`$file' is not a valid libtool archive" | |
2308 | ||
2309 | library_names= | |
2310 | old_library= | |
2311 | relink_command= | |
2312 | func_source "$file" | |
2313 | ||
2314 | # Add the libdir to current_libdirs if it is the destination. | |
2315 | if test "X$destdir" = "X$libdir"; then | |
2316 | case "$current_libdirs " in | |
2317 | *" $libdir "*) ;; | |
2318 | *) current_libdirs="$current_libdirs $libdir" ;; | |
2319 | esac | |
2320 | else | |
2321 | # Note the libdir as a future libdir. | |
2322 | case "$future_libdirs " in | |
2323 | *" $libdir "*) ;; | |
2324 | *) future_libdirs="$future_libdirs $libdir" ;; | |
2325 | esac | |
2326 | fi | |
2327 | ||
2328 | func_dirname "$file" "/" "" | |
2329 | dir="$func_dirname_result" | |
2330 | dir="$dir$objdir" | |
2331 | ||
2332 | if test -n "$relink_command"; then | |
2333 | # Determine the prefix the user has applied to our future dir. | |
2334 | inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` | |
2335 | ||
2336 | # Don't allow the user to place us outside of our expected | |
2337 | # location b/c this prevents finding dependent libraries that | |
2338 | # are installed to the same prefix. | |
2339 | # At present, this check doesn't affect windows .dll's that | |
2340 | # are installed into $libdir/../bin (currently, that works fine) | |
2341 | # but it's something to keep an eye on. | |
2342 | test "$inst_prefix_dir" = "$destdir" && \ | |
2343 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" | |
2344 | ||
2345 | if test -n "$inst_prefix_dir"; then | |
2346 | # Stick the inst_prefix_dir data into the link command. | |
2347 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` | |
2348 | else | |
2349 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` | |
2350 | fi | |
2351 | ||
2352 | func_warning "relinking \`$file'" | |
2353 | func_show_eval "$relink_command" \ | |
2354 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' | |
2355 | fi | |
2356 | ||
2357 | # See the names of the shared library. | |
2358 | set dummy $library_names; shift | |
2359 | if test -n "$1"; then | |
2360 | realname="$1" | |
2361 | shift | |
2362 | ||
2363 | srcname="$realname" | |
2364 | test -n "$relink_command" && srcname="$realname"T | |
2365 | ||
2366 | # Install the shared library and build the symlinks. | |
2367 | func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ | |
2368 | 'exit $?' | |
2369 | tstripme="$stripme" | |
2370 | case $host_os in | |
2371 | cygwin* | mingw* | pw32*) | |
2372 | case $realname in | |
2373 | *.dll.a) | |
2374 | tstripme="" | |
2375 | ;; | |
2376 | esac | |
2377 | ;; | |
2378 | esac | |
2379 | if test -n "$tstripme" && test -n "$striplib"; then | |
2380 | func_show_eval "$striplib $destdir/$realname" 'exit $?' | |
2381 | fi | |
2382 | ||
2383 | if test "$#" -gt 0; then | |
2384 | # Delete the old symlinks, and create new ones. | |
2385 | # Try `ln -sf' first, because the `ln' binary might depend on | |
2386 | # the symlink we replace! Solaris /bin/ln does not understand -f, | |
2387 | # so we also need to try rm && ln -s. | |
2388 | for linkname | |
2389 | do | |
2390 | test "$linkname" != "$realname" \ | |
2391 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" | |
2392 | done | |
2393 | fi | |
2394 | ||
2395 | # Do each command in the postinstall commands. | |
2396 | lib="$destdir/$realname" | |
2397 | func_execute_cmds "$postinstall_cmds" 'exit $?' | |
2398 | fi | |
2399 | ||
2400 | # Install the pseudo-library for information purposes. | |
2401 | func_basename "$file" | |
2402 | name="$func_basename_result" | |
2403 | instname="$dir/$name"i | |
2404 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' | |
2405 | ||
2406 | # Maybe install the static library, too. | |
2407 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" | |
2408 | ;; | |
2409 | ||
2410 | *.lo) | |
2411 | # Install (i.e. copy) a libtool object. | |
2412 | ||
2413 | # Figure out destination file name, if it wasn't already specified. | |
2414 | if test -n "$destname"; then | |
2415 | destfile="$destdir/$destname" | |
2416 | else | |
2417 | func_basename "$file" | |
2418 | destfile="$func_basename_result" | |
2419 | destfile="$destdir/$destfile" | |
2420 | fi | |
2421 | ||
2422 | # Deduce the name of the destination old-style object file. | |
2423 | case $destfile in | |
2424 | *.lo) | |
2425 | staticdest=`$ECHO "X$destfile" | $Xsed -e "$lo2o"` | |
2426 | ;; | |
2427 | *.$objext) | |
2428 | staticdest="$destfile" | |
2429 | destfile= | |
2430 | ;; | |
2431 | *) | |
2432 | func_fatal_help "cannot copy a libtool object to \`$destfile'" | |
2433 | ;; | |
2434 | esac | |
2435 | ||
2436 | # Install the libtool object if requested. | |
2437 | test -n "$destfile" && \ | |
2438 | func_show_eval "$install_prog $file $destfile" 'exit $?' | |
2439 | ||
2440 | # Install the old object if enabled. | |
2441 | if test "$build_old_libs" = yes; then | |
2442 | # Deduce the name of the old-style object file. | |
2443 | staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"` | |
2444 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' | |
2445 | fi | |
2446 | exit $EXIT_SUCCESS | |
2447 | ;; | |
2448 | ||
2449 | *) | |
2450 | # Figure out destination file name, if it wasn't already specified. | |
2451 | if test -n "$destname"; then | |
2452 | destfile="$destdir/$destname" | |
2453 | else | |
2454 | func_basename "$file" | |
2455 | destfile="$func_basename_result" | |
2456 | destfile="$destdir/$destfile" | |
2457 | fi | |
2458 | ||
2459 | # If the file is missing, and there is a .exe on the end, strip it | |
2460 | # because it is most likely a libtool script we actually want to | |
2461 | # install | |
2462 | stripped_ext="" | |
2463 | case $file in | |
2464 | *.exe) | |
2465 | if test ! -f "$file"; then | |
2466 | func_stripname '' '.exe' "$file" | |
2467 | file=$func_stripname_result | |
2468 | stripped_ext=".exe" | |
2469 | fi | |
2470 | ;; | |
2471 | esac | |
2472 | ||
2473 | # Do a test to see if this is really a libtool program. | |
2474 | case $host in | |
2475 | *cygwin*|*mingw*) | |
2476 | func_stripname '' '.exe' "$file" | |
2477 | wrapper=$func_stripname_result | |
2478 | ;; | |
2479 | *) | |
2480 | wrapper=$file | |
2481 | ;; | |
2482 | esac | |
2483 | if func_ltwrapper_p "$wrapper"; then | |
2484 | notinst_deplibs= | |
2485 | relink_command= | |
2486 | ||
2487 | func_source "$wrapper" | |
2488 | ||
2489 | # Check the variables that should have been set. | |
2490 | test -z "$generated_by_libtool_version" && \ | |
2491 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" | |
2492 | ||
2493 | finalize=yes | |
2494 | for lib in $notinst_deplibs; do | |
2495 | # Check to see that each library is installed. | |
2496 | libdir= | |
2497 | if test -f "$lib"; then | |
2498 | func_source "$lib" | |
2499 | fi | |
2500 | libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test | |
2501 | if test -n "$libdir" && test ! -f "$libfile"; then | |
2502 | func_warning "\`$lib' has not been installed in \`$libdir'" | |
2503 | finalize=no | |
2504 | fi | |
2505 | done | |
2506 | ||
2507 | relink_command= | |
2508 | func_source "$wrapper" | |
2509 | ||
2510 | outputname= | |
2511 | if test "$fast_install" = no && test -n "$relink_command"; then | |
2512 | $opt_dry_run || { | |
2513 | if test "$finalize" = yes; then | |
2514 | tmpdir=`func_mktempdir` | |
2515 | func_basename "$file$stripped_ext" | |
2516 | file="$func_basename_result" | |
2517 | outputname="$tmpdir/$file" | |
2518 | # Replace the output file specification. | |
2519 | relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` | |
2520 | ||
2521 | $opt_silent || { | |
2522 | func_quote_for_expand "$relink_command" | |
2523 | eval "func_echo $func_quote_for_expand_result" | |
2524 | } | |
2525 | if eval "$relink_command"; then : | |
2526 | else | |
2527 | func_error "error: relink \`$file' with the above command before installing it" | |
2528 | $opt_dry_run || ${RM}r "$tmpdir" | |
2529 | continue | |
2530 | fi | |
2531 | file="$outputname" | |
2532 | else | |
2533 | func_warning "cannot relink \`$file'" | |
2534 | fi | |
2535 | } | |
2536 | else | |
2537 | # Install the binary that we compiled earlier. | |
2538 | file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` | |
2539 | fi | |
2540 | fi | |
2541 | ||
2542 | # remove .exe since cygwin /usr/bin/install will append another | |
2543 | # one anyway | |
2544 | case $install_prog,$host in | |
2545 | */usr/bin/install*,*cygwin*) | |
2546 | case $file:$destfile in | |
2547 | *.exe:*.exe) | |
2548 | # this is ok | |
2549 | ;; | |
2550 | *.exe:*) | |
2551 | destfile=$destfile.exe | |
2552 | ;; | |
2553 | *:*.exe) | |
2554 | func_stripname '' '.exe' "$destfile" | |
2555 | destfile=$func_stripname_result | |
2556 | ;; | |
2557 | esac | |
2558 | ;; | |
2559 | esac | |
2560 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' | |
2561 | $opt_dry_run || if test -n "$outputname"; then | |
2562 | ${RM}r "$tmpdir" | |
2563 | fi | |
2564 | ;; | |
2565 | esac | |
2566 | done | |
2567 | ||
2568 | for file in $staticlibs; do | |
2569 | func_basename "$file" | |
2570 | name="$func_basename_result" | |
2571 | ||
2572 | # Set up the ranlib parameters. | |
2573 | oldlib="$destdir/$name" | |
2574 | ||
2575 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' | |
2576 | ||
2577 | if test -n "$stripme" && test -n "$old_striplib"; then | |
2578 | func_show_eval "$old_striplib $oldlib" 'exit $?' | |
2579 | fi | |
2580 | ||
2581 | # Do each command in the postinstall commands. | |
2582 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' | |
2583 | done | |
2584 | ||
2585 | test -n "$future_libdirs" && \ | |
2586 | func_warning "remember to run \`$progname --finish$future_libdirs'" | |
2587 | ||
2588 | if test -n "$current_libdirs"; then | |
2589 | # Maybe just do a dry run. | |
2590 | $opt_dry_run && current_libdirs=" -n$current_libdirs" | |
2591 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' | |
2592 | else | |
2593 | exit $EXIT_SUCCESS | |
2594 | fi | |
2595 | } | |
2596 | ||
2597 | ||
2598 | # func_mode_link arg... | |
2599 | func_mode_link () | |
2600 | { | |
2601 | $opt_debug | |
2602 | case $host in | |
2603 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | |
2604 | # It is impossible to link a dll without this setting, and | |
2605 | # we shouldn't force the makefile maintainer to figure out | |
2606 | # which system we are compiling for in order to pass an extra | |
2607 | # flag for every libtool invocation. | |
2608 | # allow_undefined=no | |
2609 | ||
2610 | # FIXME: Unfortunately, there are problems with the above when trying | |
2611 | # to make a dll which has undefined symbols, in which case not | |
2612 | # even a static library is built. For now, we need to specify | |
2613 | # -no-undefined on the libtool link line when we can be certain | |
2614 | # that all symbols are satisfied, otherwise we get a static library. | |
2615 | allow_undefined=yes | |
2616 | ;; | |
2617 | *) | |
2618 | allow_undefined=yes | |
2619 | ;; | |
2620 | esac | |
2621 | libtool_args="$nonopt" | |
2622 | base_compile="$nonopt $@" | |
2623 | compile_command="$nonopt" | |
2624 | finalize_command="$nonopt" | |
2625 | ||
2626 | compile_rpath= | |
2627 | finalize_rpath= | |
2628 | compile_shlibpath= | |
2629 | finalize_shlibpath= | |
2630 | convenience= | |
2631 | old_convenience= | |
2632 | deplibs= | |
2633 | old_deplibs= | |
2634 | compiler_flags= | |
2635 | linker_flags= | |
2636 | dllsearchpath= | |
2637 | lib_search_path=`pwd` | |
2638 | inst_prefix_dir= | |
2639 | new_inherited_linker_flags= | |
2640 | ||
2641 | avoid_version=no | |
2642 | dlfiles= | |
2643 | dlprefiles= | |
2644 | dlself=no | |
2645 | export_dynamic=no | |
2646 | export_symbols= | |
2647 | export_symbols_regex= | |
2648 | generated= | |
2649 | libobjs= | |
2650 | ltlibs= | |
2651 | module=no | |
2652 | no_install=no | |
2653 | objs= | |
2654 | non_pic_objects= | |
2655 | precious_files_regex= | |
2656 | prefer_static_libs=no | |
2657 | preload=no | |
2658 | prev= | |
2659 | prevarg= | |
2660 | release= | |
2661 | rpath= | |
2662 | xrpath= | |
2663 | perm_rpath= | |
2664 | temp_rpath= | |
2665 | thread_safe=no | |
2666 | vinfo= | |
2667 | vinfo_number=no | |
2668 | weak_libs= | |
2669 | single_module="${wl}-single_module" | |
2670 | func_infer_tag $base_compile | |
2671 | ||
2672 | # We need to know -static, to get the right output filenames. | |
2673 | for arg | |
2674 | do | |
2675 | case $arg in | |
2676 | -shared) | |
2677 | test "$build_libtool_libs" != yes && \ | |
2678 | func_fatal_configuration "can not build a shared library" | |
2679 | build_old_libs=no | |
2680 | break | |
2681 | ;; | |
2682 | -all-static | -static) | |
2683 | if test "X$arg" = "X-all-static"; then | |
2684 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then | |
2685 | func_warning "complete static linking is impossible in this configuration" | |
2686 | fi | |
2687 | if test -n "$link_static_flag"; then | |
2688 | dlopen_self=$dlopen_self_static | |
2689 | # See comment for -static flag below, for more details. | |
2690 | compile_command="$compile_command $link_static_flag" | |
2691 | finalize_command="$finalize_command $link_static_flag" | |
2692 | fi | |
2693 | prefer_static_libs=yes | |
2694 | else | |
2695 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | |
2696 | dlopen_self=$dlopen_self_static | |
2697 | fi | |
2698 | prefer_static_libs=built | |
2699 | fi | |
2700 | build_libtool_libs=no | |
2701 | build_old_libs=yes | |
2702 | break | |
2703 | ;; | |
2704 | esac | |
2705 | done | |
2706 | ||
2707 | # See if our shared archives depend on static archives. | |
2708 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes | |
2709 | ||
2710 | # Go through the arguments, transforming them on the way. | |
2711 | while test "$#" -gt 0; do | |
2712 | arg="$1" | |
2713 | shift | |
2714 | func_quote_for_eval "$arg" | |
2715 | qarg="$func_quote_for_eval_unquoted_result" | |
2716 | libtool_args="$libtool_args $func_quote_for_eval_result" | |
2717 | ||
2718 | # If the previous option needs an argument, assign it. | |
2719 | if test -n "$prev"; then | |
2720 | case $prev in | |
2721 | output) | |
2722 | compile_command="$compile_command @OUTPUT@" | |
2723 | finalize_command="$finalize_command @OUTPUT@" | |
2724 | ;; | |
2725 | esac | |
2726 | ||
2727 | case $prev in | |
2728 | dlfiles|dlprefiles) | |
2729 | if test "$preload" = no; then | |
2730 | # Add the symbol object into the linking commands. | |
2731 | compile_command="$compile_command @SYMFILE@" | |
2732 | finalize_command="$finalize_command @SYMFILE@" | |
2733 | preload=yes | |
2734 | fi | |
2735 | case $arg in | |
2736 | *.la | *.lo) ;; # We handle these cases below. | |
2737 | force) | |
2738 | if test "$dlself" = no; then | |
2739 | dlself=needless | |
2740 | export_dynamic=yes | |
2741 | fi | |
2742 | prev= | |
2743 | continue | |
2744 | ;; | |
2745 | self) | |
2746 | if test "$prev" = dlprefiles; then | |
2747 | dlself=yes | |
2748 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then | |
2749 | dlself=yes | |
2750 | else | |
2751 | dlself=needless | |
2752 | export_dynamic=yes | |
2753 | fi | |
2754 | prev= | |
2755 | continue | |
2756 | ;; | |
2757 | *) | |
2758 | if test "$prev" = dlfiles; then | |
2759 | dlfiles="$dlfiles $arg" | |
2760 | else | |
2761 | dlprefiles="$dlprefiles $arg" | |
2762 | fi | |
2763 | prev= | |
2764 | continue | |
2765 | ;; | |
2766 | esac | |
2767 | ;; | |
2768 | expsyms) | |
2769 | export_symbols="$arg" | |
2770 | test -f "$arg" \ | |
2771 | || func_fatal_error "symbol file \`$arg' does not exist" | |
2772 | prev= | |
2773 | continue | |
2774 | ;; | |
2775 | expsyms_regex) | |
2776 | export_symbols_regex="$arg" | |
2777 | prev= | |
2778 | continue | |
2779 | ;; | |
2780 | framework) | |
2781 | case $host in | |
2782 | *-*-darwin*) | |
2783 | case "$deplibs " in | |
2784 | *" $qarg.ltframework "*) ;; | |
2785 | *) deplibs="$deplibs $qarg.ltframework" # this is fixed later | |
2786 | ;; | |
2787 | esac | |
2788 | ;; | |
2789 | esac | |
2790 | prev= | |
2791 | continue | |
2792 | ;; | |
2793 | inst_prefix) | |
2794 | inst_prefix_dir="$arg" | |
2795 | prev= | |
2796 | continue | |
2797 | ;; | |
2798 | objectlist) | |
2799 | if test -f "$arg"; then | |
2800 | save_arg=$arg | |
2801 | moreargs= | |
2802 | for fil in `cat "$save_arg"` | |
2803 | do | |
2804 | # moreargs="$moreargs $fil" | |
2805 | arg=$fil | |
2806 | # A libtool-controlled object. | |
2807 | ||
2808 | # Check to see that this really is a libtool object. | |
2809 | if func_lalib_unsafe_p "$arg"; then | |
2810 | pic_object= | |
2811 | non_pic_object= | |
2812 | ||
2813 | # Read the .lo file | |
2814 | func_source "$arg" | |
2815 | ||
2816 | if test -z "$pic_object" || | |
2817 | test -z "$non_pic_object" || | |
2818 | test "$pic_object" = none && | |
2819 | test "$non_pic_object" = none; then | |
2820 | func_fatal_error "cannot find name of object for \`$arg'" | |
2821 | fi | |
2822 | ||
2823 | # Extract subdirectory from the argument. | |
2824 | func_dirname "$arg" "/" "" | |
2825 | xdir="$func_dirname_result" | |
2826 | ||
2827 | if test "$pic_object" != none; then | |
2828 | # Prepend the subdirectory the object is found in. | |
2829 | pic_object="$xdir$pic_object" | |
2830 | ||
2831 | if test "$prev" = dlfiles; then | |
2832 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | |
2833 | dlfiles="$dlfiles $pic_object" | |
2834 | prev= | |
2835 | continue | |
2836 | else | |
2837 | # If libtool objects are unsupported, then we need to preload. | |
2838 | prev=dlprefiles | |
2839 | fi | |
2840 | fi | |
2841 | ||
2842 | # CHECK ME: I think I busted this. -Ossama | |
2843 | if test "$prev" = dlprefiles; then | |
2844 | # Preload the old-style object. | |
2845 | dlprefiles="$dlprefiles $pic_object" | |
2846 | prev= | |
2847 | fi | |
2848 | ||
2849 | # A PIC object. | |
2850 | libobjs="$libobjs $pic_object" | |
2851 | arg="$pic_object" | |
2852 | fi | |
2853 | ||
2854 | # Non-PIC object. | |
2855 | if test "$non_pic_object" != none; then | |
2856 | # Prepend the subdirectory the object is found in. | |
2857 | non_pic_object="$xdir$non_pic_object" | |
2858 | ||
2859 | # A standard non-PIC object | |
2860 | non_pic_objects="$non_pic_objects $non_pic_object" | |
2861 | if test -z "$pic_object" || test "$pic_object" = none ; then | |
2862 | arg="$non_pic_object" | |
2863 | fi | |
2864 | else | |
2865 | # If the PIC object exists, use it instead. | |
2866 | # $xdir was prepended to $pic_object above. | |
2867 | non_pic_object="$pic_object" | |
2868 | non_pic_objects="$non_pic_objects $non_pic_object" | |
2869 | fi | |
2870 | else | |
2871 | # Only an error if not doing a dry-run. | |
2872 | if $opt_dry_run; then | |
2873 | # Extract subdirectory from the argument. | |
2874 | func_dirname "$arg" "/" "" | |
2875 | xdir="$func_dirname_result" | |
2876 | ||
2877 | pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` | |
2878 | non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"` | |
2879 | libobjs="$libobjs $pic_object" | |
2880 | non_pic_objects="$non_pic_objects $non_pic_object" | |
2881 | else | |
2882 | func_fatal_error "\`$arg' is not a valid libtool object" | |
2883 | fi | |
2884 | fi | |
2885 | done | |
2886 | else | |
2887 | func_fatal_error "link input file \`$arg' does not exist" | |
2888 | fi | |
2889 | arg=$save_arg | |
2890 | prev= | |
2891 | continue | |
2892 | ;; | |
2893 | precious_regex) | |
2894 | precious_files_regex="$arg" | |
2895 | prev= | |
2896 | continue | |
2897 | ;; | |
2898 | release) | |
2899 | release="-$arg" | |
2900 | prev= | |
2901 | continue | |
2902 | ;; | |
2903 | rpath | xrpath) | |
2904 | # We need an absolute path. | |
2905 | case $arg in | |
2906 | [\\/]* | [A-Za-z]:[\\/]*) ;; | |
2907 | *) | |
2908 | func_fatal_error "only absolute run-paths are allowed" | |
2909 | ;; | |
2910 | esac | |
2911 | if test "$prev" = rpath; then | |
2912 | case "$rpath " in | |
2913 | *" $arg "*) ;; | |
2914 | *) rpath="$rpath $arg" ;; | |
2915 | esac | |
2916 | else | |
2917 | case "$xrpath " in | |
2918 | *" $arg "*) ;; | |
2919 | *) xrpath="$xrpath $arg" ;; | |
2920 | esac | |
2921 | fi | |
2922 | prev= | |
2923 | continue | |
2924 | ;; | |
2925 | shrext) | |
2926 | shrext_cmds="$arg" | |
2927 | prev= | |
2928 | continue | |
2929 | ;; | |
2930 | weak) | |
2931 | weak_libs="$weak_libs $arg" | |
2932 | prev= | |
2933 | continue | |
2934 | ;; | |
2935 | xcclinker) | |
2936 | linker_flags="$linker_flags $qarg" | |
2937 | compiler_flags="$compiler_flags $qarg" | |
2938 | prev= | |
2939 | compile_command="$compile_command $qarg" | |
2940 | finalize_command="$finalize_command $qarg" | |
2941 | continue | |
2942 | ;; | |
2943 | xcompiler) | |
2944 | compiler_flags="$compiler_flags $qarg" | |
2945 | prev= | |
2946 | compile_command="$compile_command $qarg" | |
2947 | finalize_command="$finalize_command $qarg" | |
2948 | continue | |
2949 | ;; | |
2950 | xlinker) | |
2951 | linker_flags="$linker_flags $qarg" | |
2952 | compiler_flags="$compiler_flags $wl$qarg" | |
2953 | prev= | |
2954 | compile_command="$compile_command $wl$qarg" | |
2955 | finalize_command="$finalize_command $wl$qarg" | |
2956 | continue | |
2957 | ;; | |
2958 | *) | |
2959 | eval "$prev=\"\$arg\"" | |
2960 | prev= | |
2961 | continue | |
2962 | ;; | |
2963 | esac | |
2964 | fi # test -n "$prev" | |
2965 | ||
2966 | prevarg="$arg" | |
2967 | ||
2968 | case $arg in | |
2969 | -all-static) | |
2970 | # The effects of -all-static are defined in a previous loop. | |
2971 | continue | |
2972 | ;; | |
2973 | ||
2974 | -allow-undefined) | |
2975 | # FIXME: remove this flag sometime in the future. | |
2976 | func_fatal_error "\`-allow-undefined' must not be used because it is the default" | |
2977 | ;; | |
2978 | ||
2979 | -avoid-version) | |
2980 | avoid_version=yes | |
2981 | continue | |
2982 | ;; | |
2983 | ||
2984 | -dlopen) | |
2985 | prev=dlfiles | |
2986 | continue | |
2987 | ;; | |
2988 | ||
2989 | -dlpreopen) | |
2990 | prev=dlprefiles | |
2991 | continue | |
2992 | ;; | |
2993 | ||
2994 | -export-dynamic) | |
2995 | export_dynamic=yes | |
2996 | continue | |
2997 | ;; | |
2998 | ||
2999 | -export-symbols | -export-symbols-regex) | |
3000 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | |
3001 | func_fatal_error "more than one -exported-symbols argument is not allowed" | |
3002 | fi | |
3003 | if test "X$arg" = "X-export-symbols"; then | |
3004 | prev=expsyms | |
3005 | else | |
3006 | prev=expsyms_regex | |
3007 | fi | |
3008 | continue | |
3009 | ;; | |
3010 | ||
3011 | -framework) | |
3012 | prev=framework | |
3013 | continue | |
3014 | ;; | |
3015 | ||
3016 | -inst-prefix-dir) | |
3017 | prev=inst_prefix | |
3018 | continue | |
3019 | ;; | |
3020 | ||
3021 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* | |
3022 | # so, if we see these flags be careful not to treat them like -L | |
3023 | -L[A-Z][A-Z]*:*) | |
3024 | case $with_gcc/$host in | |
3025 | no/*-*-irix* | /*-*-irix*) | |
3026 | compile_command="$compile_command $arg" | |
3027 | finalize_command="$finalize_command $arg" | |
3028 | ;; | |
3029 | esac | |
3030 | continue | |
3031 | ;; | |
3032 | ||
3033 | -L*) | |
3034 | func_stripname '-L' '' "$arg" | |
3035 | dir=$func_stripname_result | |
3036 | # We need an absolute path. | |
3037 | case $dir in | |
3038 | [\\/]* | [A-Za-z]:[\\/]*) ;; | |
3039 | *) | |
3040 | absdir=`cd "$dir" && pwd` | |
3041 | test -z "$absdir" && \ | |
3042 | func_fatal_error "cannot determine absolute directory name of \`$dir'" | |
3043 | dir="$absdir" | |
3044 | ;; | |
3045 | esac | |
3046 | case "$deplibs " in | |
3047 | *" -L$dir "*) ;; | |
3048 | *) | |
3049 | deplibs="$deplibs -L$dir" | |
3050 | lib_search_path="$lib_search_path $dir" | |
3051 | ;; | |
3052 | esac | |
3053 | case $host in | |
3054 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | |
3055 | testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` | |
3056 | case :$dllsearchpath: in | |
3057 | *":$dir:"*) ;; | |
3058 | *) dllsearchpath="$dllsearchpath:$dir";; | |
3059 | esac | |
3060 | case :$dllsearchpath: in | |
3061 | *":$testbindir:"*) ;; | |
3062 | *) dllsearchpath="$dllsearchpath:$testbindir";; | |
3063 | esac | |
3064 | ;; | |
3065 | esac | |
3066 | continue | |
3067 | ;; | |
3068 | ||
3069 | -l*) | |
3070 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then | |
3071 | case $host in | |
3072 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) | |
3073 | # These systems don't actually have a C or math library (as such) | |
3074 | continue | |
3075 | ;; | |
3076 | *-*-os2*) | |
3077 | # These systems don't actually have a C library (as such) | |
3078 | test "X$arg" = "X-lc" && continue | |
3079 | ;; | |
3080 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) | |
3081 | # Do not include libc due to us having libc/libc_r. | |
3082 | test "X$arg" = "X-lc" && continue | |
3083 | ;; | |
3084 | *-*-rhapsody* | *-*-darwin1.[012]) | |
3085 | # Rhapsody C and math libraries are in the System framework | |
3086 | deplibs="$deplibs System.ltframework" | |
3087 | continue | |
3088 | ;; | |
3089 | *-*-sco3.2v5* | *-*-sco5v6*) | |
3090 | # Causes problems with __ctype | |
3091 | test "X$arg" = "X-lc" && continue | |
3092 | ;; | |
3093 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) | |
3094 | # Compiler inserts libc in the correct place for threads to work | |
3095 | test "X$arg" = "X-lc" && continue | |
3096 | ;; | |
3097 | esac | |
3098 | elif test "X$arg" = "X-lc_r"; then | |
3099 | case $host in | |
3100 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) | |
3101 | # Do not include libc_r directly, use -pthread flag. | |
3102 | continue | |
3103 | ;; | |
3104 | esac | |
3105 | fi | |
3106 | deplibs="$deplibs $arg" | |
3107 | continue | |
3108 | ;; | |
3109 | ||
3110 | -module) | |
3111 | module=yes | |
3112 | continue | |
3113 | ;; | |
3114 | ||
3115 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ | |
3116 | # classes, name mangling, and exception handling. | |
3117 | # Darwin uses the -arch flag to determine output architecture. | |
3118 | -model|-arch|-isysroot) | |
3119 | compile_command="$compile_command $arg" | |
3120 | compiler_flags="$compiler_flags $arg" | |
3121 | finalize_command="$finalize_command $arg" | |
3122 | prev=xcompiler | |
3123 | continue | |
3124 | ;; | |
3125 | ||
3126 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) | |
3127 | compiler_flags="$compiler_flags $arg" | |
3128 | compile_command="$compile_command $arg" | |
3129 | finalize_command="$finalize_command $arg" | |
3130 | case "$new_inherited_linker_flags " in | |
3131 | *" $arg "*) ;; | |
3132 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; | |
3133 | esac | |
3134 | continue | |
3135 | ;; | |
3136 | ||
3137 | -multi_module) | |
3138 | single_module="${wl}-multi_module" | |
3139 | continue | |
3140 | ;; | |
3141 | ||
3142 | -no-fast-install) | |
3143 | fast_install=no | |
3144 | continue | |
3145 | ;; | |
3146 | ||
3147 | -no-install) | |
3148 | case $host in | |
3149 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | |
3150 | # The PATH hackery in wrapper scripts is required on Windows | |
3151 | # in order for the loader to find any dlls it needs. | |
3152 | func_warning "\`-no-install' is ignored for $host" | |
3153 | func_warning "assuming \`-no-fast-install' instead" | |
3154 | fast_install=no | |
3155 | ;; | |
3156 | *) no_install=yes ;; | |
3157 | esac | |
3158 | continue | |
3159 | ;; | |
3160 | ||
3161 | -no-undefined) | |
3162 | allow_undefined=no | |
3163 | continue | |
3164 | ;; | |
3165 | ||
3166 | -objectlist) | |
3167 | prev=objectlist | |
3168 | continue | |
3169 | ;; | |
3170 | ||
3171 | -o) prev=output ;; | |
3172 | ||
3173 | -precious-files-regex) | |
3174 | prev=precious_regex | |
3175 | continue | |
3176 | ;; | |
3177 | ||
3178 | -release) | |
3179 | prev=release | |
3180 | continue | |
3181 | ;; | |
3182 | ||
3183 | -rpath) | |
3184 | prev=rpath | |
3185 | continue | |
3186 | ;; | |
3187 | ||
3188 | -R) | |
3189 | prev=xrpath | |
3190 | continue | |
3191 | ;; | |
3192 | ||
3193 | -R*) | |
3194 | func_stripname '-R' '' "$arg" | |
3195 | dir=$func_stripname_result | |
3196 | # We need an absolute path. | |
3197 | case $dir in | |
3198 | [\\/]* | [A-Za-z]:[\\/]*) ;; | |
3199 | *) | |
3200 | func_fatal_error "only absolute run-paths are allowed" | |
3201 | ;; | |
3202 | esac | |
3203 | case "$xrpath " in | |
3204 | *" $dir "*) ;; | |
3205 | *) xrpath="$xrpath $dir" ;; | |
3206 | esac | |
3207 | continue | |
3208 | ;; | |
3209 | ||
3210 | -shared) | |
3211 | # The effects of -shared are defined in a previous loop. | |
3212 | continue | |
3213 | ;; | |
3214 | ||
3215 | -shrext) | |
3216 | prev=shrext | |
3217 | continue | |
3218 | ;; | |
3219 | ||
3220 | -static) | |
3221 | # The effects of -static are defined in a previous loop. | |
3222 | # We used to do the same as -all-static on platforms that | |
3223 | # didn't have a PIC flag, but the assumption that the effects | |
3224 | # would be equivalent was wrong. It would break on at least | |
3225 | # Digital Unix and AIX. | |
3226 | continue | |
3227 | ;; | |
3228 | ||
3229 | -thread-safe) | |
3230 | thread_safe=yes | |
3231 | continue | |
3232 | ;; | |
3233 | ||
3234 | -version-info) | |
3235 | prev=vinfo | |
3236 | continue | |
3237 | ;; | |
3238 | ||
3239 | -version-number) | |
3240 | prev=vinfo | |
3241 | vinfo_number=yes | |
3242 | continue | |
3243 | ;; | |
3244 | ||
3245 | -weak) | |
3246 | prev=weak | |
3247 | continue | |
3248 | ;; | |
3249 | ||
3250 | -Wc,*) | |
3251 | func_stripname '-Wc,' '' "$arg" | |
3252 | args=$func_stripname_result | |
3253 | arg= | |
3254 | save_ifs="$IFS"; IFS=',' | |
3255 | for flag in $args; do | |
3256 | IFS="$save_ifs" | |
3257 | func_quote_for_eval "$flag" | |
3258 | arg="$arg $wl$func_quote_for_eval_result" | |
3259 | compiler_flags="$compiler_flags $func_quote_for_eval_result" | |
3260 | done | |
3261 | IFS="$save_ifs" | |
3262 | func_stripname ' ' '' "$arg" | |
3263 | arg=$func_stripname_result | |
3264 | ;; | |
3265 | ||
3266 | -Wl,*) | |
3267 | func_stripname '-Wl,' '' "$arg" | |
3268 | args=$func_stripname_result | |
3269 | arg= | |
3270 | save_ifs="$IFS"; IFS=',' | |
3271 | for flag in $args; do | |
3272 | IFS="$save_ifs" | |
3273 | func_quote_for_eval "$flag" | |
3274 | arg="$arg $wl$func_quote_for_eval_result" | |
3275 | compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" | |
3276 | linker_flags="$linker_flags $func_quote_for_eval_result" | |
3277 | done | |
3278 | IFS="$save_ifs" | |
3279 | func_stripname ' ' '' "$arg" | |
3280 | arg=$func_stripname_result | |
3281 | ;; | |
3282 | ||
3283 | -Xcompiler) | |
3284 | prev=xcompiler | |
3285 | continue | |
3286 | ;; | |
3287 | ||
3288 | -Xlinker) | |
3289 | prev=xlinker | |
3290 | continue | |
3291 | ;; | |
3292 | ||
3293 | -XCClinker) | |
3294 | prev=xcclinker | |
3295 | continue | |
3296 | ;; | |
3297 | ||
3298 | # -64, -mips[0-9] enable 64-bit mode on the SGI compiler | |
3299 | # -r[0-9][0-9]* specifies the processor on the SGI compiler | |
3300 | # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler | |
3301 | # +DA*, +DD* enable 64-bit mode on the HP compiler | |
3302 | # -q* pass through compiler args for the IBM compiler | |
3303 | # -m*, -t[45]*, -txscale* pass through architecture-specific | |
3304 | # compiler args for GCC | |
3305 | # @file GCC response files | |
3306 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ | |
3307 | -t[45]*|-txscale*|@*) | |
3308 | func_quote_for_eval "$arg" | |
3309 | arg="$func_quote_for_eval_result" | |
3310 | compile_command="$compile_command $arg" | |
3311 | finalize_command="$finalize_command $arg" | |
3312 | compiler_flags="$compiler_flags $arg" | |
3313 | continue | |
3314 | ;; | |
3315 | ||
3316 | # Some other compiler flag. | |
3317 | -* | +*) | |
3318 | func_quote_for_eval "$arg" | |
3319 | arg="$func_quote_for_eval_result" | |
3320 | ;; | |
3321 | ||
3322 | *.$objext) | |
3323 | # A standard object. | |
3324 | objs="$objs $arg" | |
3325 | ;; | |
3326 | ||
3327 | *.lo) | |
3328 | # A libtool-controlled object. | |
3329 | ||
3330 | # Check to see that this really is a libtool object. | |
3331 | if func_lalib_unsafe_p "$arg"; then | |
3332 | pic_object= | |
3333 | non_pic_object= | |
3334 | ||
3335 | # Read the .lo file | |
3336 | func_source "$arg" | |
3337 | ||
3338 | if test -z "$pic_object" || | |
3339 | test -z "$non_pic_object" || | |
3340 | test "$pic_object" = none && | |
3341 | test "$non_pic_object" = none; then | |
3342 | func_fatal_error "cannot find name of object for \`$arg'" | |
3343 | fi | |
3344 | ||
3345 | # Extract subdirectory from the argument. | |
3346 | func_dirname "$arg" "/" "" | |
3347 | xdir="$func_dirname_result" | |
3348 | ||
3349 | if test "$pic_object" != none; then | |
3350 | # Prepend the subdirectory the object is found in. | |
3351 | pic_object="$xdir$pic_object" | |
3352 | ||
3353 | if test "$prev" = dlfiles; then | |
3354 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | |
3355 | dlfiles="$dlfiles $pic_object" | |
3356 | prev= | |
3357 | continue | |
3358 | else | |
3359 | # If libtool objects are unsupported, then we need to preload. | |
3360 | prev=dlprefiles | |
3361 | fi | |
3362 | fi | |
3363 | ||
3364 | # CHECK ME: I think I busted this. -Ossama | |
3365 | if test "$prev" = dlprefiles; then | |
3366 | # Preload the old-style object. | |
3367 | dlprefiles="$dlprefiles $pic_object" | |
3368 | prev= | |
3369 | fi | |
3370 | ||
3371 | # A PIC object. | |
3372 | libobjs="$libobjs $pic_object" | |
3373 | arg="$pic_object" | |
3374 | fi | |
3375 | ||
3376 | # Non-PIC object. | |
3377 | if test "$non_pic_object" != none; then | |
3378 | # Prepend the subdirectory the object is found in. | |
3379 | non_pic_object="$xdir$non_pic_object" | |
3380 | ||
3381 | # A standard non-PIC object | |
3382 | non_pic_objects="$non_pic_objects $non_pic_object" | |
3383 | if test -z "$pic_object" || test "$pic_object" = none ; then | |
3384 | arg="$non_pic_object" | |
3385 | fi | |
3386 | else | |
3387 | # If the PIC object exists, use it instead. | |
3388 | # $xdir was prepended to $pic_object above. | |
3389 | non_pic_object="$pic_object" | |
3390 | non_pic_objects="$non_pic_objects $non_pic_object" | |
3391 | fi | |
3392 | else | |
3393 | # Only an error if not doing a dry-run. | |
3394 | if $opt_dry_run; then | |
3395 | # Extract subdirectory from the argument. | |
3396 | func_dirname "$arg" "/" "" | |
3397 | xdir="$func_dirname_result" | |
3398 | ||
3399 | pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` | |
3400 | non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"` | |
3401 | libobjs="$libobjs $pic_object" | |
3402 | non_pic_objects="$non_pic_objects $non_pic_object" | |
3403 | else | |
3404 | func_fatal_error "\`$arg' is not a valid libtool object" | |
3405 | fi | |
3406 | fi | |
3407 | ;; | |
3408 | ||
3409 | *.$libext) | |
3410 | # An archive. | |
3411 | deplibs="$deplibs $arg" | |
3412 | old_deplibs="$old_deplibs $arg" | |
3413 | continue | |
3414 | ;; | |
3415 | ||
3416 | *.la) | |
3417 | # A libtool-controlled library. | |
3418 | ||
3419 | if test "$prev" = dlfiles; then | |
3420 | # This library was specified with -dlopen. | |
3421 | dlfiles="$dlfiles $arg" | |
3422 | prev= | |
3423 | elif test "$prev" = dlprefiles; then | |
3424 | # The library was specified with -dlpreopen. | |
3425 | dlprefiles="$dlprefiles $arg" | |
3426 | prev= | |
3427 | else | |
3428 | deplibs="$deplibs $arg" | |
3429 | fi | |
3430 | continue | |
3431 | ;; | |
3432 | ||
3433 | # Some other compiler argument. | |
3434 | *) | |
3435 | # Unknown arguments in both finalize_command and compile_command need | |
3436 | # to be aesthetically quoted because they are evaled later. | |
3437 | func_quote_for_eval "$arg" | |
3438 | arg="$func_quote_for_eval_result" | |
3439 | ;; | |
3440 | esac # arg | |
3441 | ||
3442 | # Now actually substitute the argument into the commands. | |
3443 | if test -n "$arg"; then | |
3444 | compile_command="$compile_command $arg" | |
3445 | finalize_command="$finalize_command $arg" | |
3446 | fi | |
3447 | done # argument parsing loop | |
3448 | ||
3449 | test -n "$prev" && \ | |
3450 | func_fatal_help "the \`$prevarg' option requires an argument" | |
3451 | ||
3452 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then | |
3453 | eval arg=\"$export_dynamic_flag_spec\" | |
3454 | compile_command="$compile_command $arg" | |
3455 | finalize_command="$finalize_command $arg" | |
3456 | fi | |
3457 | ||
3458 | oldlibs= | |
3459 | # calculate the name of the file, without its directory | |
3460 | func_basename "$output" | |
3461 | outputname="$func_basename_result" | |
3462 | libobjs_save="$libobjs" | |
3463 | ||
3464 | if test -n "$shlibpath_var"; then | |
3465 | # get the directories listed in $shlibpath_var | |
3466 | eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` | |
3467 | else | |
3468 | shlib_search_path= | |
3469 | fi | |
3470 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" | |
3471 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" | |
3472 | ||
3473 | func_dirname "$output" "/" "" | |
3474 | output_objdir="$func_dirname_result$objdir" | |
3475 | # Create the object directory. | |
3476 | func_mkdir_p "$output_objdir" | |
3477 | ||
3478 | # Determine the type of output | |
3479 | case $output in | |
3480 | "") | |
3481 | func_fatal_help "you must specify an output file" | |
3482 | ;; | |
3483 | *.$libext) linkmode=oldlib ;; | |
3484 | *.lo | *.$objext) linkmode=obj ;; | |
3485 | *.la) linkmode=lib ;; | |
3486 | *) linkmode=prog ;; # Anything else should be a program. | |
3487 | esac | |
3488 | ||
3489 | specialdeplibs= | |
3490 | ||
3491 | libs= | |
3492 | # Find all interdependent deplibs by searching for libraries | |
3493 | # that are linked more than once (e.g. -la -lb -la) | |
3494 | for deplib in $deplibs; do | |
3495 | if $opt_duplicate_deps ; then | |
3496 | case "$libs " in | |
3497 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | |
3498 | esac | |
3499 | fi | |
3500 | libs="$libs $deplib" | |
3501 | done | |
3502 | ||
3503 | if test "$linkmode" = lib; then | |
3504 | libs="$predeps $libs $compiler_lib_search_path $postdeps" | |
3505 | ||
3506 | # Compute libraries that are listed more than once in $predeps | |
3507 | # $postdeps and mark them as special (i.e., whose duplicates are | |
3508 | # not to be eliminated). | |
3509 | pre_post_deps= | |
3510 | if $opt_duplicate_compiler_generated_deps; then | |
3511 | for pre_post_dep in $predeps $postdeps; do | |
3512 | case "$pre_post_deps " in | |
3513 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; | |
3514 | esac | |
3515 | pre_post_deps="$pre_post_deps $pre_post_dep" | |
3516 | done | |
3517 | fi | |
3518 | pre_post_deps= | |
3519 | fi | |
3520 | ||
3521 | deplibs= | |
3522 | newdependency_libs= | |
3523 | newlib_search_path= | |
3524 | need_relink=no # whether we're linking any uninstalled libtool libraries | |
3525 | notinst_deplibs= # not-installed libtool libraries | |
3526 | notinst_path= # paths that contain not-installed libtool libraries | |
3527 | ||
3528 | case $linkmode in | |
3529 | lib) | |
3530 | passes="conv dlpreopen link" | |
3531 | for file in $dlfiles $dlprefiles; do | |
3532 | case $file in | |
3533 | *.la) ;; | |
3534 | *) | |
3535 | func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" | |
3536 | ;; | |
3537 | esac | |
3538 | done | |
3539 | ;; | |
3540 | prog) | |
3541 | compile_deplibs= | |
3542 | finalize_deplibs= | |
3543 | alldeplibs=no | |
3544 | newdlfiles= | |
3545 | newdlprefiles= | |
3546 | passes="conv scan dlopen dlpreopen link" | |
3547 | ;; | |
3548 | *) passes="conv" | |
3549 | ;; | |
3550 | esac | |
3551 | ||
3552 | for pass in $passes; do | |
3553 | # The preopen pass in lib mode reverses $deplibs; put it back here | |
3554 | # so that -L comes before libs that need it for instance... | |
3555 | if test "$linkmode,$pass" = "lib,link"; then | |
3556 | ## FIXME: Find the place where the list is rebuilt in the wrong | |
3557 | ## order, and fix it there properly | |
3558 | tmp_deplibs= | |
3559 | for deplib in $deplibs; do | |
3560 | tmp_deplibs="$deplib $tmp_deplibs" | |
3561 | done | |
3562 | deplibs="$tmp_deplibs" | |
3563 | fi | |
3564 | ||
3565 | if test "$linkmode,$pass" = "lib,link" || | |
3566 | test "$linkmode,$pass" = "prog,scan"; then | |
3567 | libs="$deplibs" | |
3568 | deplibs= | |
3569 | fi | |
3570 | if test "$linkmode" = prog; then | |
3571 | case $pass in | |
3572 | dlopen) libs="$dlfiles" ;; | |
3573 | dlpreopen) libs="$dlprefiles" ;; | |
3574 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; | |
3575 | esac | |
3576 | fi | |
3577 | if test "$linkmode,$pass" = "lib,dlpreopen"; then | |
3578 | # Collect and forward deplibs of preopened libtool libs | |
3579 | for lib in $dlprefiles; do | |
3580 | # Ignore non-libtool-libs | |
3581 | dependency_libs= | |
3582 | case $lib in | |
3583 | *.la) func_source "$lib" ;; | |
3584 | esac | |
3585 | ||
3586 | # Collect preopened libtool deplibs, except any this library | |
3587 | # has declared as weak libs | |
3588 | for deplib in $dependency_libs; do | |
3589 | deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` | |
3590 | case " $weak_libs " in | |
3591 | *" $deplib_base "*) ;; | |
3592 | *) deplibs="$deplibs $deplib" ;; | |
3593 | esac | |
3594 | done | |
3595 | done | |
3596 | libs="$dlprefiles" | |
3597 | fi | |
3598 | if test "$pass" = dlopen; then | |
3599 | # Collect dlpreopened libraries | |
3600 | save_deplibs="$deplibs" | |
3601 | deplibs= | |
3602 | fi | |
3603 | ||
3604 | for deplib in $libs; do | |
3605 | lib= | |
3606 | found=no | |
3607 | case $deplib in | |
3608 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) | |
3609 | if test "$linkmode,$pass" = "prog,link"; then | |
3610 | compile_deplibs="$deplib $compile_deplibs" | |
3611 | finalize_deplibs="$deplib $finalize_deplibs" | |
3612 | else | |
3613 | compiler_flags="$compiler_flags $deplib" | |
3614 | if test "$linkmode" = lib ; then | |
3615 | case "$new_inherited_linker_flags " in | |
3616 | *" $deplib "*) ;; | |
3617 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; | |
3618 | esac | |
3619 | fi | |
3620 | fi | |
3621 | continue | |
3622 | ;; | |
3623 | -l*) | |
3624 | if test "$linkmode" != lib && test "$linkmode" != prog; then | |
3625 | func_warning "\`-l' is ignored for archives/objects" | |
3626 | continue | |
3627 | fi | |
3628 | func_stripname '-l' '' "$deplib" | |
3629 | name=$func_stripname_result | |
3630 | for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do | |
3631 | for search_ext in .la $std_shrext .so .a; do | |
3632 | # Search the libtool library | |
3633 | lib="$searchdir/lib${name}${search_ext}" | |
3634 | if test -f "$lib"; then | |
3635 | if test "$search_ext" = ".la"; then | |
3636 | found=yes | |
3637 | else | |
3638 | found=no | |
3639 | fi | |
3640 | break 2 | |
3641 | fi | |
3642 | done | |
3643 | done | |
3644 | if test "$found" != yes; then | |
3645 | # deplib doesn't seem to be a libtool library | |
3646 | if test "$linkmode,$pass" = "prog,link"; then | |
3647 | compile_deplibs="$deplib $compile_deplibs" | |
3648 | finalize_deplibs="$deplib $finalize_deplibs" | |
3649 | else | |
3650 | deplibs="$deplib $deplibs" | |
3651 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" | |
3652 | fi | |
3653 | continue | |
3654 | else # deplib is a libtool library | |
3655 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, | |
3656 | # We need to do some special things here, and not later. | |
3657 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | |
3658 | case " $predeps $postdeps " in | |
3659 | *" $deplib "*) | |
3660 | if func_lalib_p "$lib"; then | |
3661 | library_names= | |
3662 | old_library= | |
3663 | func_source "$lib" | |
3664 | for l in $old_library $library_names; do | |
3665 | ll="$l" | |
3666 | done | |
3667 | if test "X$ll" = "X$old_library" ; then # only static version available | |
3668 | found=no | |
3669 | func_dirname "$lib" "" "." | |
3670 | ladir="$func_dirname_result" | |
3671 | lib=$ladir/$old_library | |
3672 | if test "$linkmode,$pass" = "prog,link"; then | |
3673 | compile_deplibs="$deplib $compile_deplibs" | |
3674 | finalize_deplibs="$deplib $finalize_deplibs" | |
3675 | else | |
3676 | deplibs="$deplib $deplibs" | |
3677 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" | |
3678 | fi | |
3679 | continue | |
3680 | fi | |
3681 | fi | |
3682 | ;; | |
3683 | *) ;; | |
3684 | esac | |
3685 | fi | |
3686 | fi | |
3687 | ;; # -l | |
3688 | *.ltframework) | |
3689 | if test "$linkmode,$pass" = "prog,link"; then | |
3690 | compile_deplibs="$deplib $compile_deplibs" | |
3691 | finalize_deplibs="$deplib $finalize_deplibs" | |
3692 | else | |
3693 | deplibs="$deplib $deplibs" | |
3694 | if test "$linkmode" = lib ; then | |
3695 | case "$new_inherited_linker_flags " in | |
3696 | *" $deplib "*) ;; | |
3697 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; | |
3698 | esac | |
3699 | fi | |
3700 | fi | |
3701 | continue | |
3702 | ;; | |
3703 | -L*) | |
3704 | case $linkmode in | |
3705 | lib) | |
3706 | deplibs="$deplib $deplibs" | |
3707 | test "$pass" = conv && continue | |
3708 | newdependency_libs="$deplib $newdependency_libs" | |
3709 | func_stripname '-L' '' "$deplib" | |
3710 | newlib_search_path="$newlib_search_path $func_stripname_result" | |
3711 | ;; | |
3712 | prog) | |
3713 | if test "$pass" = conv; then | |
3714 | deplibs="$deplib $deplibs" | |
3715 | continue | |
3716 | fi | |
3717 | if test "$pass" = scan; then | |
3718 | deplibs="$deplib $deplibs" | |
3719 | else | |
3720 | compile_deplibs="$deplib $compile_deplibs" | |
3721 | finalize_deplibs="$deplib $finalize_deplibs" | |
3722 | fi | |
3723 | func_stripname '-L' '' "$deplib" | |
3724 | newlib_search_path="$newlib_search_path $func_stripname_result" | |
3725 | ;; | |
3726 | *) | |
3727 | func_warning "\`-L' is ignored for archives/objects" | |
3728 | ;; | |
3729 | esac # linkmode | |
3730 | continue | |
3731 | ;; # -L | |
3732 | -R*) | |
3733 | if test "$pass" = link; then | |
3734 | func_stripname '-R' '' "$deplib" | |
3735 | dir=$func_stripname_result | |
3736 | # Make sure the xrpath contains only unique directories. | |
3737 | case "$xrpath " in | |
3738 | *" $dir "*) ;; | |
3739 | *) xrpath="$xrpath $dir" ;; | |
3740 | esac | |
3741 | fi | |
3742 | deplibs="$deplib $deplibs" | |
3743 | continue | |
3744 | ;; | |
3745 | *.la) lib="$deplib" ;; | |
3746 | *.$libext) | |
3747 | if test "$pass" = conv; then | |
3748 | deplibs="$deplib $deplibs" | |
3749 | continue | |
3750 | fi | |
3751 | case $linkmode in | |
3752 | lib) | |
3753 | # Linking convenience modules into shared libraries is allowed, | |
3754 | # but linking other static libraries is non-portable. | |
3755 | case " $dlpreconveniencelibs " in | |
3756 | *" $lib "*) ;; | |
3757 | *) | |
3758 | valid_a_lib=no | |
3759 | case $deplibs_check_method in | |
3760 | match_pattern*) | |
3761 | set dummy $deplibs_check_method; shift | |
3762 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` | |
3763 | if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ | |
3764 | | $EGREP "$match_pattern_regex" > /dev/null; then | |
3765 | valid_a_lib=yes | |
3766 | fi | |
3767 | ;; | |
3768 | pass_all) | |
3769 | valid_a_lib=yes | |
3770 | ;; | |
3771 | esac | |
3772 | if test "$valid_a_lib" != yes; then | |
3773 | $ECHO | |
3774 | $ECHO "*** Warning: Trying to link with static lib archive $deplib." | |
3775 | $ECHO "*** I have the capability to make that library automatically link in when" | |
3776 | $ECHO "*** you link to this library. But I can only do this if you have a" | |
3777 | $ECHO "*** shared version of the library, which you do not appear to have" | |
3778 | $ECHO "*** because the file extensions .$libext of this argument makes me believe" | |
3779 | $ECHO "*** that it is just a static archive that I should not use here." | |
3780 | else | |
3781 | $ECHO | |
3782 | $ECHO "*** Warning: Linking the shared library $output against the" | |
3783 | $ECHO "*** static library $deplib is not portable!" | |
3784 | deplibs="$deplib $deplibs" | |
3785 | fi | |
3786 | ;; | |
3787 | esac | |
3788 | continue | |
3789 | ;; | |
3790 | prog) | |
3791 | if test "$pass" != link; then | |
3792 | deplibs="$deplib $deplibs" | |
3793 | else | |
3794 | compile_deplibs="$deplib $compile_deplibs" | |
3795 | finalize_deplibs="$deplib $finalize_deplibs" | |
3796 | fi | |
3797 | continue | |
3798 | ;; | |
3799 | esac # linkmode | |
3800 | ;; # *.$libext | |
3801 | *.lo | *.$objext) | |
3802 | if test "$pass" = conv; then | |
3803 | deplibs="$deplib $deplibs" | |
3804 | elif test "$linkmode" = prog; then | |
3805 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then | |
3806 | # If there is no dlopen support or we're linking statically, | |
3807 | # we need to preload. | |
3808 | newdlprefiles="$newdlprefiles $deplib" | |
3809 | compile_deplibs="$deplib $compile_deplibs" | |
3810 | finalize_deplibs="$deplib $finalize_deplibs" | |
3811 | else | |
3812 | newdlfiles="$newdlfiles $deplib" | |
3813 | fi | |
3814 | fi | |
3815 | continue | |
3816 | ;; | |
3817 | %DEPLIBS%) | |
3818 | alldeplibs=yes | |
3819 | continue | |
3820 | ;; | |
3821 | esac # case $deplib | |
3822 | ||
3823 | if test "$found" = yes || test -f "$lib"; then : | |
3824 | else | |
3825 | func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" | |
3826 | fi | |
3827 | ||
3828 | # Check to see that this really is a libtool archive. | |
3829 | func_lalib_unsafe_p "$lib" \ | |
3830 | || func_fatal_error "\`$lib' is not a valid libtool archive" | |
3831 | ||
3832 | func_dirname "$lib" "" "." | |
3833 | ladir="$func_dirname_result" | |
3834 | ||
3835 | dlname= | |
3836 | dlopen= | |
3837 | dlpreopen= | |
3838 | libdir= | |
3839 | library_names= | |
3840 | old_library= | |
3841 | inherited_linker_flags= | |
3842 | # If the library was installed with an old release of libtool, | |
3843 | # it will not redefine variables installed, or shouldnotlink | |
3844 | installed=yes | |
3845 | shouldnotlink=no | |
3846 | avoidtemprpath= | |
3847 | ||
3848 | ||
3849 | # Read the .la file | |
3850 | func_source "$lib" | |
3851 | ||
3852 | # Convert "-framework foo" to "foo.ltframework" | |
3853 | if test -n "$inherited_linker_flags"; then | |
3854 | tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` | |
3855 | for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do | |
3856 | case " $new_inherited_linker_flags " in | |
3857 | *" $tmp_inherited_linker_flag "*) ;; | |
3858 | *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; | |
3859 | esac | |
3860 | done | |
3861 | fi | |
3862 | dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` | |
3863 | if test "$linkmode,$pass" = "prog,link"; then | |
3864 | compile_deplibs="$new_inherited_linker_flags $compile_deplibs" | |
3865 | finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" | |
3866 | else | |
3867 | compiler_flags="$compiler_flags $inherited_linker_flags" | |
3868 | fi | |
3869 | if test "$linkmode,$pass" = "lib,link" || | |
3870 | test "$linkmode,$pass" = "prog,scan" || | |
3871 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then | |
3872 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" | |
3873 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" | |
3874 | fi | |
3875 | ||
3876 | if test "$pass" = conv; then | |
3877 | # Only check for convenience libraries | |
3878 | deplibs="$lib $deplibs" | |
3879 | if test -z "$libdir"; then | |
3880 | if test -z "$old_library"; then | |
3881 | func_fatal_error "cannot find name of link library for \`$lib'" | |
3882 | fi | |
3883 | # It is a libtool convenience library, so add in its objects. | |
3884 | convenience="$convenience $ladir/$objdir/$old_library" | |
3885 | old_convenience="$old_convenience $ladir/$objdir/$old_library" | |
3886 | elif test "$linkmode" != prog && test "$linkmode" != lib; then | |
3887 | func_fatal_error "\`$lib' is not a convenience library" | |
3888 | fi | |
3889 | tmp_libs= | |
3890 | for deplib in $dependency_libs; do | |
3891 | deplibs="$deplib $deplibs" | |
3892 | if $opt_duplicate_deps ; then | |
3893 | case "$tmp_libs " in | |
3894 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | |
3895 | esac | |
3896 | fi | |
3897 | tmp_libs="$tmp_libs $deplib" | |
3898 | done | |
3899 | continue | |
3900 | fi # $pass = conv | |
3901 | ||
3902 | ||
3903 | # Get the name of the library we link against. | |
3904 | linklib= | |
3905 | for l in $old_library $library_names; do | |
3906 | linklib="$l" | |
3907 | done | |
3908 | if test -z "$linklib"; then | |
3909 | func_fatal_error "cannot find name of link library for \`$lib'" | |
3910 | fi | |
3911 | ||
3912 | # This library was specified with -dlopen. | |
3913 | if test "$pass" = dlopen; then | |
3914 | if test -z "$libdir"; then | |
3915 | func_fatal_error "cannot -dlopen a convenience library: \`$lib'" | |
3916 | fi | |
3917 | if test -z "$dlname" || | |
3918 | test "$dlopen_support" != yes || | |
3919 | test "$build_libtool_libs" = no; then | |
3920 | # If there is no dlname, no dlopen support or we're linking | |
3921 | # statically, we need to preload. We also need to preload any | |
3922 | # dependent libraries so libltdl's deplib preloader doesn't | |
3923 | # bomb out in the load deplibs phase. | |
3924 | dlprefiles="$dlprefiles $lib $dependency_libs" | |
3925 | else | |
3926 | newdlfiles="$newdlfiles $lib" | |
3927 | fi | |
3928 | continue | |
3929 | fi # $pass = dlopen | |
3930 | ||
3931 | # We need an absolute path. | |
3932 | case $ladir in | |
3933 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; | |
3934 | *) | |
3935 | abs_ladir=`cd "$ladir" && pwd` | |
3936 | if test -z "$abs_ladir"; then | |
3937 | func_warning "cannot determine absolute directory name of \`$ladir'" | |
3938 | func_warning "passing it literally to the linker, although it might fail" | |
3939 | abs_ladir="$ladir" | |
3940 | fi | |
3941 | ;; | |
3942 | esac | |
3943 | func_basename "$lib" | |
3944 | laname="$func_basename_result" | |
3945 | ||
3946 | # Find the relevant object directory and library name. | |
3947 | if test "X$installed" = Xyes; then | |
3948 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then | |
3949 | func_warning "library \`$lib' was moved." | |
3950 | dir="$ladir" | |
3951 | absdir="$abs_ladir" | |
3952 | libdir="$abs_ladir" | |
3953 | else | |
3954 | dir="$libdir" | |
3955 | absdir="$libdir" | |
3956 | fi | |
3957 | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes | |
3958 | else | |
3959 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then | |
3960 | dir="$ladir" | |
3961 | absdir="$abs_ladir" | |
3962 | # Remove this search path later | |
3963 | notinst_path="$notinst_path $abs_ladir" | |
3964 | else | |
3965 | dir="$ladir/$objdir" | |
3966 | absdir="$abs_ladir/$objdir" | |
3967 | # Remove this search path later | |
3968 | notinst_path="$notinst_path $abs_ladir" | |
3969 | fi | |
3970 | fi # $installed = yes | |
3971 | func_stripname 'lib' '.la' "$laname" | |
3972 | name=$func_stripname_result | |
3973 | ||
3974 | # This library was specified with -dlpreopen. | |
3975 | if test "$pass" = dlpreopen; then | |
3976 | if test -z "$libdir" && test "$linkmode" = prog; then | |
3977 | func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" | |
3978 | fi | |
3979 | # Prefer using a static library (so that no silly _DYNAMIC symbols | |
3980 | # are required to link). | |
3981 | if test -n "$old_library"; then | |
3982 | newdlprefiles="$newdlprefiles $dir/$old_library" | |
3983 | # Keep a list of preopened convenience libraries to check | |
3984 | # that they are being used correctly in the link pass. | |
3985 | test -z "$libdir" && \ | |
3986 | dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" | |
3987 | # Otherwise, use the dlname, so that lt_dlopen finds it. | |
3988 | elif test -n "$dlname"; then | |
3989 | newdlprefiles="$newdlprefiles $dir/$dlname" | |
3990 | else | |
3991 | newdlprefiles="$newdlprefiles $dir/$linklib" | |
3992 | fi | |
3993 | fi # $pass = dlpreopen | |
3994 | ||
3995 | if test -z "$libdir"; then | |
3996 | # Link the convenience library | |
3997 | if test "$linkmode" = lib; then | |
3998 | deplibs="$dir/$old_library $deplibs" | |
3999 | elif test "$linkmode,$pass" = "prog,link"; then | |
4000 | compile_deplibs="$dir/$old_library $compile_deplibs" | |
4001 | finalize_deplibs="$dir/$old_library $finalize_deplibs" | |
4002 | else | |
4003 | deplibs="$lib $deplibs" # used for prog,scan pass | |
4004 | fi | |
4005 | continue | |
4006 | fi | |
4007 | ||
4008 | ||
4009 | if test "$linkmode" = prog && test "$pass" != link; then | |
4010 | newlib_search_path="$newlib_search_path $ladir" | |
4011 | deplibs="$lib $deplibs" | |
4012 | ||
4013 | linkalldeplibs=no | |
4014 | if test "$link_all_deplibs" != no || test -z "$library_names" || | |
4015 | test "$build_libtool_libs" = no; then | |
4016 | linkalldeplibs=yes | |
4017 | fi | |
4018 | ||
4019 | tmp_libs= | |
4020 | for deplib in $dependency_libs; do | |
4021 | case $deplib in | |
4022 | -L*) func_stripname '-L' '' "$deplib" | |
4023 | newlib_search_path="$newlib_search_path $func_stripname_result" | |
4024 | ;; | |
4025 | esac | |
4026 | # Need to link against all dependency_libs? | |
4027 | if test "$linkalldeplibs" = yes; then | |
4028 | deplibs="$deplib $deplibs" | |
4029 | else | |
4030 | # Need to hardcode shared library paths | |
4031 | # or/and link against static libraries | |
4032 | newdependency_libs="$deplib $newdependency_libs" | |
4033 | fi | |
4034 | if $opt_duplicate_deps ; then | |
4035 | case "$tmp_libs " in | |
4036 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | |
4037 | esac | |
4038 | fi | |
4039 | tmp_libs="$tmp_libs $deplib" | |
4040 | done # for deplib | |
4041 | continue | |
4042 | fi # $linkmode = prog... | |
4043 | ||
4044 | if test "$linkmode,$pass" = "prog,link"; then | |
4045 | if test -n "$library_names" && | |
4046 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then | |
4047 | # We need to hardcode the library path | |
4048 | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then | |
4049 | # Make sure the rpath contains only unique directories. | |
4050 | case "$temp_rpath " in | |
4051 | *"$absdir:"*) ;; | |
4052 | *) temp_rpath="$temp_rpath$absdir:" ;; | |
4053 | esac | |
4054 | fi | |
4055 | ||
4056 | # Hardcode the library path. | |
4057 | # Skip directories that are in the system default run-time | |
4058 | # search path. | |
4059 | case " $sys_lib_dlsearch_path " in | |
4060 | *" $absdir "*) ;; | |
4061 | *) | |
4062 | case "$compile_rpath " in | |
4063 | *" $absdir "*) ;; | |
4064 | *) compile_rpath="$compile_rpath $absdir" | |
4065 | esac | |
4066 | ;; | |
4067 | esac | |
4068 | case " $sys_lib_dlsearch_path " in | |
4069 | *" $libdir "*) ;; | |
4070 | *) | |
4071 | case "$finalize_rpath " in | |
4072 | *" $libdir "*) ;; | |
4073 | *) finalize_rpath="$finalize_rpath $libdir" | |
4074 | esac | |
4075 | ;; | |
4076 | esac | |
4077 | fi # $linkmode,$pass = prog,link... | |
4078 | ||
4079 | if test "$alldeplibs" = yes && | |
4080 | { test "$deplibs_check_method" = pass_all || | |
4081 | { test "$build_libtool_libs" = yes && | |
4082 | test -n "$library_names"; }; }; then | |
4083 | # We only need to search for static libraries | |
4084 | continue | |
4085 | fi | |
4086 | fi | |
4087 | ||
4088 | link_static=no # Whether the deplib will be linked statically | |
4089 | use_static_libs=$prefer_static_libs | |
4090 | if test "$use_static_libs" = built && test "$installed" = yes; then | |
4091 | use_static_libs=no | |
4092 | fi | |
4093 | if test -n "$library_names" && | |
4094 | { test "$use_static_libs" = no || test -z "$old_library"; }; then | |
4095 | case $host in | |
4096 | *cygwin* | *mingw*) | |
4097 | # No point in relinking DLLs because paths are not encoded | |
4098 | notinst_deplibs="$notinst_deplibs $lib" | |
4099 | need_relink=no | |
4100 | ;; | |
4101 | *) | |
4102 | if test "$installed" = no; then | |
4103 | notinst_deplibs="$notinst_deplibs $lib" | |
4104 | need_relink=yes | |
4105 | fi | |
4106 | ;; | |
4107 | esac | |
4108 | # This is a shared library | |
4109 | ||
4110 | # Warn about portability, can't link against -module's on some | |
4111 | # systems (darwin). Don't bleat about dlopened modules though! | |
4112 | dlopenmodule="" | |
4113 | for dlpremoduletest in $dlprefiles; do | |
4114 | if test "X$dlpremoduletest" = "X$lib"; then | |
4115 | dlopenmodule="$dlpremoduletest" | |
4116 | break | |
4117 | fi | |
4118 | done | |
4119 | if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then | |
4120 | $ECHO | |
4121 | if test "$linkmode" = prog; then | |
4122 | $ECHO "*** Warning: Linking the executable $output against the loadable module" | |
4123 | else | |
4124 | $ECHO "*** Warning: Linking the shared library $output against the loadable module" | |
4125 | fi | |
4126 | $ECHO "*** $linklib is not portable!" | |
4127 | fi | |
4128 | if test "$linkmode" = lib && | |
4129 | test "$hardcode_into_libs" = yes; then | |
4130 | # Hardcode the library path. | |
4131 | # Skip directories that are in the system default run-time | |
4132 | # search path. | |
4133 | case " $sys_lib_dlsearch_path " in | |
4134 | *" $absdir "*) ;; | |
4135 | *) | |
4136 | case "$compile_rpath " in | |
4137 | *" $absdir "*) ;; | |
4138 | *) compile_rpath="$compile_rpath $absdir" | |
4139 | esac | |
4140 | ;; | |
4141 | esac | |
4142 | case " $sys_lib_dlsearch_path " in | |
4143 | *" $libdir "*) ;; | |
4144 | *) | |
4145 | case "$finalize_rpath " in | |
4146 | *" $libdir "*) ;; | |
4147 | *) finalize_rpath="$finalize_rpath $libdir" | |
4148 | esac | |
4149 | ;; | |
4150 | esac | |
4151 | fi | |
4152 | ||
4153 | if test -n "$old_archive_from_expsyms_cmds"; then | |
4154 | # figure out the soname | |
4155 | set dummy $library_names | |
4156 | shift | |
4157 | realname="$1" | |
4158 | shift | |
4159 | libname=`eval "\\$ECHO \"$libname_spec\""` | |
4160 | # use dlname if we got it. it's perfectly good, no? | |
4161 | if test -n "$dlname"; then | |
4162 | soname="$dlname" | |
4163 | elif test -n "$soname_spec"; then | |
4164 | # bleh windows | |
4165 | case $host in | |
4166 | *cygwin* | mingw*) | |
4167 | major=`expr $current - $age` | |
4168 | versuffix="-$major" | |
4169 | ;; | |
4170 | esac | |
4171 | eval soname=\"$soname_spec\" | |
4172 | else | |
4173 | soname="$realname" | |
4174 | fi | |
4175 | ||
4176 | # Make a new name for the extract_expsyms_cmds to use | |
4177 | soroot="$soname" | |
4178 | func_basename "$soroot" | |
4179 | soname="$func_basename_result" | |
4180 | func_stripname 'lib' '.dll' "$soname" | |
4181 | newlib=libimp-$func_stripname_result.a | |
4182 | ||
4183 | # If the library has no export list, then create one now | |
4184 | if test -f "$output_objdir/$soname-def"; then : | |
4185 | else | |
4186 | func_echo "extracting exported symbol list from \`$soname'" | |
4187 | func_execute_cmds "$extract_expsyms_cmds" 'exit $?' | |
4188 | fi | |
4189 | ||
4190 | # Create $newlib | |
4191 | if test -f "$output_objdir/$newlib"; then :; else | |
4192 | func_echo "generating import library for \`$soname'" | |
4193 | func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' | |
4194 | fi | |
4195 | # make sure the library variables are pointing to the new library | |
4196 | dir=$output_objdir | |
4197 | linklib=$newlib | |
4198 | fi # test -n "$old_archive_from_expsyms_cmds" | |
4199 | ||
4200 | if test "$linkmode" = prog || test "$mode" != relink; then | |
4201 | add_shlibpath= | |
4202 | add_dir= | |
4203 | add= | |
4204 | lib_linked=yes | |
4205 | case $hardcode_action in | |
4206 | immediate | unsupported) | |
4207 | if test "$hardcode_direct" = no; then | |
4208 | add="$dir/$linklib" | |
4209 | case $host in | |
4210 | *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; | |
4211 | *-*-sysv4*uw2*) add_dir="-L$dir" ;; | |
4212 | *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ | |
4213 | *-*-unixware7*) add_dir="-L$dir" ;; | |
4214 | *-*-darwin* ) | |
4215 | # if the lib is a (non-dlopened) module then we can not | |
4216 | # link against it, someone is ignoring the earlier warnings | |
4217 | if /usr/bin/file -L $add 2> /dev/null | | |
4218 | $GREP ": [^:]* bundle" >/dev/null ; then | |
4219 | if test "X$dlopenmodule" != "X$lib"; then | |
4220 | $ECHO "*** Warning: lib $linklib is a module, not a shared library" | |
4221 | if test -z "$old_library" ; then | |
4222 | $ECHO | |
4223 | $ECHO "*** And there doesn't seem to be a static archive available" | |
4224 | $ECHO "*** The link will probably fail, sorry" | |
4225 | else | |
4226 | add="$dir/$old_library" | |
4227 | fi | |
4228 | elif test -n "$old_library"; then | |
4229 | add="$dir/$old_library" | |
4230 | fi | |
4231 | fi | |
4232 | esac | |
4233 | elif test "$hardcode_minus_L" = no; then | |
4234 | case $host in | |
4235 | *-*-sunos*) add_shlibpath="$dir" ;; | |
4236 | esac | |
4237 | add_dir="-L$dir" | |
4238 | add="-l$name" | |
4239 | elif test "$hardcode_shlibpath_var" = no; then | |
4240 | add_shlibpath="$dir" | |
4241 | add="-l$name" | |
4242 | else | |
4243 | lib_linked=no | |
4244 | fi | |
4245 | ;; | |
4246 | relink) | |
4247 | if test "$hardcode_direct" = yes; then | |
4248 | add="$dir/$linklib" | |
4249 | elif test "$hardcode_minus_L" = yes; then | |
4250 | add_dir="-L$dir" | |
4251 | # Try looking first in the location we're being installed to. | |
4252 | if test -n "$inst_prefix_dir"; then | |
4253 | case $libdir in | |
4254 | [\\/]*) | |
4255 | add_dir="$add_dir -L$inst_prefix_dir$libdir" | |
4256 | ;; | |
4257 | esac | |
4258 | fi | |
4259 | add="-l$name" | |
4260 | elif test "$hardcode_shlibpath_var" = yes; then | |
4261 | add_shlibpath="$dir" | |
4262 | add="-l$name" | |
4263 | else | |
4264 | lib_linked=no | |
4265 | fi | |
4266 | ;; | |
4267 | *) lib_linked=no ;; | |
4268 | esac | |
4269 | ||
4270 | if test "$lib_linked" != yes; then | |
4271 | func_fatal_configuration "unsupported hardcode properties" | |
4272 | fi | |
4273 | ||
4274 | if test -n "$add_shlibpath"; then | |
4275 | case :$compile_shlibpath: in | |
4276 | *":$add_shlibpath:"*) ;; | |
4277 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; | |
4278 | esac | |
4279 | fi | |
4280 | if test "$linkmode" = prog; then | |
4281 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" | |
4282 | test -n "$add" && compile_deplibs="$add $compile_deplibs" | |
4283 | else | |
4284 | test -n "$add_dir" && deplibs="$add_dir $deplibs" | |
4285 | test -n "$add" && deplibs="$add $deplibs" | |
4286 | if test "$hardcode_direct" != yes && | |
4287 | test "$hardcode_minus_L" != yes && | |
4288 | test "$hardcode_shlibpath_var" = yes; then | |
4289 | case :$finalize_shlibpath: in | |
4290 | *":$libdir:"*) ;; | |
4291 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; | |
4292 | esac | |
4293 | fi | |
4294 | fi | |
4295 | fi | |
4296 | ||
4297 | if test "$linkmode" = prog || test "$mode" = relink; then | |
4298 | add_shlibpath= | |
4299 | add_dir= | |
4300 | add= | |
4301 | # Finalize command for both is simple: just hardcode it. | |
4302 | if test "$hardcode_direct" = yes; then | |
4303 | add="$libdir/$linklib" | |
4304 | elif test "$hardcode_minus_L" = yes; then | |
4305 | add_dir="-L$libdir" | |
4306 | add="-l$name" | |
4307 | elif test "$hardcode_shlibpath_var" = yes; then | |
4308 | case :$finalize_shlibpath: in | |
4309 | *":$libdir:"*) ;; | |
4310 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; | |
4311 | esac | |
4312 | add="-l$name" | |
4313 | elif test "$hardcode_automatic" = yes; then | |
4314 | if test -n "$inst_prefix_dir" && | |
4315 | test -f "$inst_prefix_dir$libdir/$linklib" ; then | |
4316 | add="$inst_prefix_dir$libdir/$linklib" | |
4317 | else | |
4318 | add="$libdir/$linklib" | |
4319 | fi | |
4320 | else | |
4321 | # We cannot seem to hardcode it, guess we'll fake it. | |
4322 | add_dir="-L$libdir" | |
4323 | # Try looking first in the location we're being installed to. | |
4324 | if test -n "$inst_prefix_dir"; then | |
4325 | case $libdir in | |
4326 | [\\/]*) | |
4327 | add_dir="$add_dir -L$inst_prefix_dir$libdir" | |
4328 | ;; | |
4329 | esac | |
4330 | fi | |
4331 | add="-l$name" | |
4332 | fi | |
4333 | ||
4334 | if test "$linkmode" = prog; then | |
4335 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" | |
4336 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" | |
4337 | else | |
4338 | test -n "$add_dir" && deplibs="$add_dir $deplibs" | |
4339 | test -n "$add" && deplibs="$add $deplibs" | |
4340 | fi | |
4341 | fi | |
4342 | elif test "$linkmode" = prog; then | |
4343 | # Here we assume that one of hardcode_direct or hardcode_minus_L | |
4344 | # is not unsupported. This is valid on all known static and | |
4345 | # shared platforms. | |
4346 | if test "$hardcode_direct" != unsupported; then | |
4347 | test -n "$old_library" && linklib="$old_library" | |
4348 | compile_deplibs="$dir/$linklib $compile_deplibs" | |
4349 | finalize_deplibs="$dir/$linklib $finalize_deplibs" | |
4350 | else | |
4351 | compile_deplibs="-l$name -L$dir $compile_deplibs" | |
4352 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" | |
4353 | fi | |
4354 | elif test "$build_libtool_libs" = yes; then | |
4355 | # Not a shared library | |
4356 | if test "$deplibs_check_method" != pass_all; then | |
4357 | # We're trying link a shared library against a static one | |
4358 | # but the system doesn't support it. | |
4359 | ||
4360 | # Just print a warning and add the library to dependency_libs so | |
4361 | # that the program can be linked against the static library. | |
4362 | $ECHO | |
4363 | $ECHO "*** Warning: This system can not link to static lib archive $lib." | |
4364 | $ECHO "*** I have the capability to make that library automatically link in when" | |
4365 | $ECHO "*** you link to this library. But I can only do this if you have a" | |
4366 | $ECHO "*** shared version of the library, which you do not appear to have." | |
4367 | if test "$module" = yes; then | |
4368 | $ECHO "*** But as you try to build a module library, libtool will still create " | |
4369 | $ECHO "*** a static module, that should work as long as the dlopening application" | |
4370 | $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." | |
4371 | if test -z "$global_symbol_pipe"; then | |
4372 | $ECHO | |
4373 | $ECHO "*** However, this would only work if libtool was able to extract symbol" | |
4374 | $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" | |
4375 | $ECHO "*** not find such a program. So, this module is probably useless." | |
4376 | $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." | |
4377 | fi | |
4378 | if test "$build_old_libs" = no; then | |
4379 | build_libtool_libs=module | |
4380 | build_old_libs=yes | |
4381 | else | |
4382 | build_libtool_libs=no | |
4383 | fi | |
4384 | fi | |
4385 | else | |
4386 | deplibs="$dir/$old_library $deplibs" | |
4387 | link_static=yes | |
4388 | fi | |
4389 | fi # link shared/static library? | |
4390 | ||
4391 | if test "$linkmode" = lib; then | |
4392 | if test -n "$dependency_libs" && | |
4393 | { test "$hardcode_into_libs" != yes || | |
4394 | test "$build_old_libs" = yes || | |
4395 | test "$link_static" = yes; }; then | |
4396 | # Extract -R from dependency_libs | |
4397 | temp_deplibs= | |
4398 | for libdir in $dependency_libs; do | |
4399 | case $libdir in | |
4400 | -R*) func_stripname '-R' '' "$libdir" | |
4401 | temp_xrpath=$func_stripname_result | |
4402 | case " $xrpath " in | |
4403 | *" $temp_xrpath "*) ;; | |
4404 | *) xrpath="$xrpath $temp_xrpath";; | |
4405 | esac;; | |
4406 | *) temp_deplibs="$temp_deplibs $libdir";; | |
4407 | esac | |
4408 | done | |
4409 | dependency_libs="$temp_deplibs" | |
4410 | fi | |
4411 | ||
4412 | newlib_search_path="$newlib_search_path $absdir" | |
4413 | # Link against this library | |
4414 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" | |
4415 | # ... and its dependency_libs | |
4416 | tmp_libs= | |
4417 | for deplib in $dependency_libs; do | |
4418 | newdependency_libs="$deplib $newdependency_libs" | |
4419 | if $opt_duplicate_deps ; then | |
4420 | case "$tmp_libs " in | |
4421 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | |
4422 | esac | |
4423 | fi | |
4424 | tmp_libs="$tmp_libs $deplib" | |
4425 | done | |
4426 | ||
4427 | if test "$link_all_deplibs" != no; then | |
4428 | # Add the search paths of all dependency libraries | |
4429 | for deplib in $dependency_libs; do | |
4430 | case $deplib in | |
4431 | -L*) path="$deplib" ;; | |
4432 | *.la) | |
4433 | func_dirname "$deplib" "" "." | |
4434 | dir="$func_dirname_result" | |
4435 | # We need an absolute path. | |
4436 | case $dir in | |
4437 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; | |
4438 | *) | |
4439 | absdir=`cd "$dir" && pwd` | |
4440 | if test -z "$absdir"; then | |
4441 | func_warning "cannot determine absolute directory name of \`$dir'" | |
4442 | absdir="$dir" | |
4443 | fi | |
4444 | ;; | |
4445 | esac | |
4446 | if $GREP "^installed=no" $deplib > /dev/null; then | |
4447 | case $host in | |
4448 | *-*-darwin*) | |
4449 | depdepl= | |
4450 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` | |
4451 | if test -n "$deplibrary_names" ; then | |
4452 | for tmp in $deplibrary_names ; do | |
4453 | depdepl=$tmp | |
4454 | done | |
4455 | if test -f "$absdir/$objdir/$depdepl" ; then | |
4456 | depdepl="$absdir/$objdir/$depdepl" | |
4457 | darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'` | |
4458 | darwin_install_name=`$ECHO $darwin_install_name` | |
4459 | compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" | |
4460 | linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" | |
4461 | path= | |
4462 | fi | |
4463 | fi | |
4464 | ;; | |
4465 | *) | |
4466 | path="-L$absdir/$objdir" | |
4467 | ;; | |
4468 | esac | |
4469 | else | |
4470 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` | |
4471 | test -z "$libdir" && \ | |
4472 | func_fatal_error "\`$deplib' is not a valid libtool archive" | |
4473 | test "$absdir" != "$libdir" && \ | |
4474 | func_warning "\`$deplib' seems to be moved" | |
4475 | ||
4476 | path="-L$absdir" | |
4477 | fi | |
4478 | ;; | |
4479 | esac | |
4480 | case " $deplibs " in | |
4481 | *" $path "*) ;; | |
4482 | *) deplibs="$path $deplibs" ;; | |
4483 | esac | |
4484 | done | |
4485 | fi # link_all_deplibs != no | |
4486 | fi # linkmode = lib | |
4487 | done # for deplib in $libs | |
4488 | dependency_libs="$newdependency_libs" | |
4489 | if test "$pass" = dlpreopen; then | |
4490 | # Link the dlpreopened libraries before other libraries | |
4491 | for deplib in $save_deplibs; do | |
4492 | deplibs="$deplib $deplibs" | |
4493 | done | |
4494 | fi | |
4495 | if test "$pass" != dlopen; then | |
4496 | if test "$pass" != conv; then | |
4497 | # Make sure lib_search_path contains only unique directories. | |
4498 | lib_search_path= | |
4499 | for dir in $newlib_search_path; do | |
4500 | case "$lib_search_path " in | |
4501 | *" $dir "*) ;; | |
4502 | *) lib_search_path="$lib_search_path $dir" ;; | |
4503 | esac | |
4504 | done | |
4505 | newlib_search_path= | |
4506 | fi | |
4507 | ||
4508 | if test "$linkmode,$pass" != "prog,link"; then | |
4509 | vars="deplibs" | |
4510 | else | |
4511 | vars="compile_deplibs finalize_deplibs" | |
4512 | fi | |
4513 | for var in $vars dependency_libs; do | |
4514 | # Add libraries to $var in reverse order | |
4515 | eval tmp_libs=\"\$$var\" | |
4516 | new_libs= | |
4517 | for deplib in $tmp_libs; do | |
4518 | # FIXME: Pedantically, this is the right thing to do, so | |
4519 | # that some nasty dependency loop isn't accidentally | |
4520 | # broken: | |
4521 | #new_libs="$deplib $new_libs" | |
4522 | # Pragmatically, this seems to cause very few problems in | |
4523 | # practice: | |
4524 | case $deplib in | |
4525 | -L*) new_libs="$deplib $new_libs" ;; | |
4526 | -R*) ;; | |
4527 | *) | |
4528 | # And here is the reason: when a library appears more | |
4529 | # than once as an explicit dependence of a library, or | |
4530 | # is implicitly linked in more than once by the | |
4531 | # compiler, it is considered special, and multiple | |
4532 | # occurrences thereof are not removed. Compare this | |
4533 | # with having the same library being listed as a | |
4534 | # dependency of multiple other libraries: in this case, | |
4535 | # we know (pedantically, we assume) the library does not | |
4536 | # need to be listed more than once, so we keep only the | |
4537 | # last copy. This is not always right, but it is rare | |
4538 | # enough that we require users that really mean to play | |
4539 | # such unportable linking tricks to link the library | |
4540 | # using -Wl,-lname, so that libtool does not consider it | |
4541 | # for duplicate removal. | |
4542 | case " $specialdeplibs " in | |
4543 | *" $deplib "*) new_libs="$deplib $new_libs" ;; | |
4544 | *) | |
4545 | case " $new_libs " in | |
4546 | *" $deplib "*) ;; | |
4547 | *) new_libs="$deplib $new_libs" ;; | |
4548 | esac | |
4549 | ;; | |
4550 | esac | |
4551 | ;; | |
4552 | esac | |
4553 | done | |
4554 | tmp_libs= | |
4555 | for deplib in $new_libs; do | |
4556 | case $deplib in | |
4557 | -L*) | |
4558 | case " $tmp_libs " in | |
4559 | *" $deplib "*) ;; | |
4560 | *) tmp_libs="$tmp_libs $deplib" ;; | |
4561 | esac | |
4562 | ;; | |
4563 | *) tmp_libs="$tmp_libs $deplib" ;; | |
4564 | esac | |
4565 | done | |
4566 | eval $var=\"$tmp_libs\" | |
4567 | done # for var | |
4568 | fi | |
4569 | # Last step: remove runtime libs from dependency_libs | |
4570 | # (they stay in deplibs) | |
4571 | tmp_libs= | |
4572 | for i in $dependency_libs ; do | |
4573 | case " $predeps $postdeps $compiler_lib_search_path " in | |
4574 | *" $i "*) | |
4575 | i="" | |
4576 | ;; | |
4577 | esac | |
4578 | if test -n "$i" ; then | |
4579 | tmp_libs="$tmp_libs $i" | |
4580 | fi | |
4581 | done | |
4582 | dependency_libs=$tmp_libs | |
4583 | done # for pass | |
4584 | if test "$linkmode" = prog; then | |
4585 | dlfiles="$newdlfiles" | |
4586 | fi | |
4587 | if test "$linkmode" = prog || test "$linkmode" = lib; then | |
4588 | dlprefiles="$newdlprefiles" | |
4589 | fi | |
4590 | ||
4591 | case $linkmode in | |
4592 | oldlib) | |
4593 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | |
4594 | func_warning "\`-dlopen' is ignored for archives" | |
4595 | fi | |
4596 | ||
4597 | test -n "$deplibs" && \ | |
4598 | func_warning "\`-l' and \`-L' are ignored for archives" | |
4599 | ||
4600 | ||
4601 | test -n "$rpath" && \ | |
4602 | func_warning "\`-rpath' is ignored for archives" | |
4603 | ||
4604 | test -n "$xrpath" && \ | |
4605 | func_warning "\`-R' is ignored for archives" | |
4606 | ||
4607 | test -n "$vinfo" && \ | |
4608 | func_warning "\`-version-info/-version-number' is ignored for archives" | |
4609 | ||
4610 | test -n "$release" && \ | |
4611 | func_warning "\`-release' is ignored for archives" | |
4612 | ||
4613 | test -n "$export_symbols$export_symbols_regex" && \ | |
4614 | func_warning "\`-export-symbols' is ignored for archives" | |
4615 | ||
4616 | # Now set the variables for building old libraries. | |
4617 | build_libtool_libs=no | |
4618 | oldlibs="$output" | |
4619 | objs="$objs$old_deplibs" | |
4620 | ;; | |
4621 | ||
4622 | lib) | |
4623 | # Make sure we only generate libraries of the form `libNAME.la'. | |
4624 | case $outputname in | |
4625 | lib*) | |
4626 | func_stripname 'lib' '.la' "$outputname" | |
4627 | name=$func_stripname_result | |
4628 | eval shared_ext=\"$shrext_cmds\" | |
4629 | eval libname=\"$libname_spec\" | |
4630 | ;; | |
4631 | *) | |
4632 | test "$module" = no && \ | |
4633 | func_fatal_help "libtool library \`$output' must begin with \`lib'" | |
4634 | ||
4635 | if test "$need_lib_prefix" != no; then | |
4636 | # Add the "lib" prefix for modules if required | |
4637 | func_stripname '' '.la' "$outputname" | |
4638 | name=$func_stripname_result | |
4639 | eval shared_ext=\"$shrext_cmds\" | |
4640 | eval libname=\"$libname_spec\" | |
4641 | else | |
4642 | func_stripname '' '.la' "$outputname" | |
4643 | libname=$func_stripname_result | |
4644 | fi | |
4645 | ;; | |
4646 | esac | |
4647 | ||
4648 | if test -n "$objs"; then | |
4649 | if test "$deplibs_check_method" != pass_all; then | |
4650 | func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" | |
4651 | else | |
4652 | $ECHO | |
4653 | $ECHO "*** Warning: Linking the shared library $output against the non-libtool" | |
4654 | $ECHO "*** objects $objs is not portable!" | |
4655 | libobjs="$libobjs $objs" | |
4656 | fi | |
4657 | fi | |
4658 | ||
4659 | test "$dlself" != no && \ | |
4660 | func_warning "\`-dlopen self' is ignored for libtool libraries" | |
4661 | ||
4662 | set dummy $rpath | |
4663 | shift | |
4664 | test "$#" -gt 1 && \ | |
4665 | func_warning "ignoring multiple \`-rpath's for a libtool library" | |
4666 | ||
4667 | install_libdir="$1" | |
4668 | ||
4669 | oldlibs= | |
4670 | if test -z "$rpath"; then | |
4671 | if test "$build_libtool_libs" = yes; then | |
4672 | # Building a libtool convenience library. | |
4673 | # Some compilers have problems with a `.al' extension so | |
4674 | # convenience libraries should have the same extension an | |
4675 | # archive normally would. | |
4676 | oldlibs="$output_objdir/$libname.$libext $oldlibs" | |
4677 | build_libtool_libs=convenience | |
4678 | build_old_libs=yes | |
4679 | fi | |
4680 | ||
4681 | test -n "$vinfo" && \ | |
4682 | func_warning "\`-version-info/-version-number' is ignored for convenience libraries" | |
4683 | ||
4684 | test -n "$release" && \ | |
4685 | func_warning "\`-release' is ignored for convenience libraries" | |
4686 | else | |
4687 | ||
4688 | # Parse the version information argument. | |
4689 | save_ifs="$IFS"; IFS=':' | |
4690 | set dummy $vinfo 0 0 0 | |
4691 | shift | |
4692 | IFS="$save_ifs" | |
4693 | ||
4694 | test -n "$7" && \ | |
4695 | func_fatal_help "too many parameters to \`-version-info'" | |
4696 | ||
4697 | # convert absolute version numbers to libtool ages | |
4698 | # this retains compatibility with .la files and attempts | |
4699 | # to make the code below a bit more comprehensible | |
4700 | ||
4701 | case $vinfo_number in | |
4702 | yes) | |
4703 | number_major="$1" | |
4704 | number_minor="$2" | |
4705 | number_revision="$3" | |
4706 | # | |
4707 | # There are really only two kinds -- those that | |
4708 | # use the current revision as the major version | |
4709 | # and those that subtract age and use age as | |
4710 | # a minor version. But, then there is irix | |
4711 | # which has an extra 1 added just for fun | |
4712 | # | |
4713 | case $version_type in | |
4714 | darwin|linux|osf|windows) | |
4715 | current=`expr $number_major + $number_minor` | |
4716 | age="$number_minor" | |
4717 | revision="$number_revision" | |
4718 | ;; | |
4719 | freebsd-aout|freebsd-elf|sunos) | |
4720 | current="$number_major" | |
4721 | revision="$number_minor" | |
4722 | age="0" | |
4723 | ;; | |
4724 | irix|nonstopux) | |
4725 | current=`expr $number_major + $number_minor - 1` | |
4726 | age="$number_minor" | |
4727 | revision="$number_minor" | |
4728 | ;; | |
4729 | esac | |
4730 | ;; | |
4731 | no) | |
4732 | current="$1" | |
4733 | revision="$2" | |
4734 | age="$3" | |
4735 | ;; | |
4736 | esac | |
4737 | ||
4738 | # Check that each of the things are valid numbers. | |
4739 | case $current in | |
4740 | 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; | |
4741 | *) | |
4742 | func_error "CURRENT \`$current' must be a nonnegative integer" | |
4743 | func_fatal_error "\`$vinfo' is not valid version information" | |
4744 | ;; | |
4745 | esac | |
4746 | ||
4747 | case $revision in | |
4748 | 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; | |
4749 | *) | |
4750 | func_error "REVISION \`$revision' must be a nonnegative integer" | |
4751 | func_fatal_error "\`$vinfo' is not valid version information" | |
4752 | ;; | |
4753 | esac | |
4754 | ||
4755 | case $age in | |
4756 | 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; | |
4757 | *) | |
4758 | func_error "AGE \`$age' must be a nonnegative integer" | |
4759 | func_fatal_error "\`$vinfo' is not valid version information" | |
4760 | ;; | |
4761 | esac | |
4762 | ||
4763 | if test "$age" -gt "$current"; then | |
4764 | func_error "AGE \`$age' is greater than the current interface number \`$current'" | |
4765 | func_fatal_error "\`$vinfo' is not valid version information" | |
4766 | fi | |
4767 | ||
4768 | # Calculate the version variables. | |
4769 | major= | |
4770 | versuffix= | |
4771 | verstring= | |
4772 | case $version_type in | |
4773 | none) ;; | |
4774 | ||
4775 | darwin) | |
4776 | # Like Linux, but with the current version available in | |
4777 | # verstring for coding it into the library header | |
4778 | major=.`expr $current - $age` | |
4779 | versuffix="$major.$age.$revision" | |
4780 | # Darwin ld doesn't like 0 for these options... | |
4781 | minor_current=`expr $current + 1` | |
4782 | verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" | |
4783 | ;; | |
4784 | ||
4785 | freebsd-aout) | |
4786 | major=".$current" | |
4787 | versuffix=".$current.$revision"; | |
4788 | ;; | |
4789 | ||
4790 | freebsd-elf) | |
4791 | major=".$current" | |
4792 | versuffix=".$current" | |
4793 | ;; | |
4794 | ||
4795 | irix | nonstopux) | |
4796 | major=`expr $current - $age + 1` | |
4797 | ||
4798 | case $version_type in | |
4799 | nonstopux) verstring_prefix=nonstopux ;; | |
4800 | *) verstring_prefix=sgi ;; | |
4801 | esac | |
4802 | verstring="$verstring_prefix$major.$revision" | |
4803 | ||
4804 | # Add in all the interfaces that we are compatible with. | |
4805 | loop=$revision | |
4806 | while test "$loop" -ne 0; do | |
4807 | iface=`expr $revision - $loop` | |
4808 | loop=`expr $loop - 1` | |
4809 | verstring="$verstring_prefix$major.$iface:$verstring" | |
4810 | done | |
4811 | ||
4812 | # Before this point, $major must not contain `.'. | |
4813 | major=.$major | |
4814 | versuffix="$major.$revision" | |
4815 | ;; | |
4816 | ||
4817 | linux) | |
4818 | major=.`expr $current - $age` | |
4819 | versuffix="$major.$age.$revision" | |
4820 | ;; | |
4821 | ||
4822 | osf) | |
4823 | major=.`expr $current - $age` | |
4824 | versuffix=".$current.$age.$revision" | |
4825 | verstring="$current.$age.$revision" | |
4826 | ||
4827 | # Add in all the interfaces that we are compatible with. | |
4828 | loop=$age | |
4829 | while test "$loop" -ne 0; do | |
4830 | iface=`expr $current - $loop` | |
4831 | loop=`expr $loop - 1` | |
4832 | verstring="$verstring:${iface}.0" | |
4833 | done | |
4834 | ||
4835 | # Make executables depend on our current version. | |
4836 | verstring="$verstring:${current}.0" | |
4837 | ;; | |
4838 | ||
4839 | qnx) | |
4840 | major=".$current" | |
4841 | versuffix=".$current" | |
4842 | ;; | |
4843 | ||
4844 | sunos) | |
4845 | major=".$current" | |
4846 | versuffix=".$current.$revision" | |
4847 | ;; | |
4848 | ||
4849 | windows) | |
4850 | # Use '-' rather than '.', since we only want one | |
4851 | # extension on DOS 8.3 filesystems. | |
4852 | major=`expr $current - $age` | |
4853 | versuffix="-$major" | |
4854 | ;; | |
4855 | ||
4856 | *) | |
4857 | func_fatal_configuration "unknown library version type \`$version_type'" | |
4858 | ;; | |
4859 | esac | |
4860 | ||
4861 | # Clear the version info if we defaulted, and they specified a release. | |
4862 | if test -z "$vinfo" && test -n "$release"; then | |
4863 | major= | |
4864 | case $version_type in | |
4865 | darwin) | |
4866 | # we can't check for "0.0" in archive_cmds due to quoting | |
4867 | # problems, so we reset it completely | |
4868 | verstring= | |
4869 | ;; | |
4870 | *) | |
4871 | verstring="0.0" | |
4872 | ;; | |
4873 | esac | |
4874 | if test "$need_version" = no; then | |
4875 | versuffix= | |
4876 | else | |
4877 | versuffix=".0.0" | |
4878 | fi | |
4879 | fi | |
4880 | ||
4881 | # Remove version info from name if versioning should be avoided | |
4882 | if test "$avoid_version" = yes && test "$need_version" = no; then | |
4883 | major= | |
4884 | versuffix= | |
4885 | verstring="" | |
4886 | fi | |
4887 | ||
4888 | # Check to see if the archive will have undefined symbols. | |
4889 | if test "$allow_undefined" = yes; then | |
4890 | if test "$allow_undefined_flag" = unsupported; then | |
4891 | func_warning "undefined symbols not allowed in $host shared libraries" | |
4892 | build_libtool_libs=no | |
4893 | build_old_libs=yes | |
4894 | fi | |
4895 | else | |
4896 | # Don't allow undefined symbols. | |
4897 | allow_undefined_flag="$no_undefined_flag" | |
4898 | fi | |
4899 | ||
4900 | fi | |
4901 | ||
4902 | func_generate_dlsyms "$libname" "$libname" "yes" | |
4903 | libobjs="$libobjs $symfileobj" | |
4904 | ||
4905 | if test "$mode" != relink; then | |
4906 | # Remove our outputs, but don't remove object files since they | |
4907 | # may have been created when compiling PIC objects. | |
4908 | removelist= | |
4909 | tempremovelist=`$ECHO "$output_objdir/*"` | |
4910 | for p in $tempremovelist; do | |
4911 | case $p in | |
4912 | *.$objext) | |
4913 | ;; | |
4914 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) | |
4915 | if test "X$precious_files_regex" != "X"; then | |
4916 | if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 | |
4917 | then | |
4918 | continue | |
4919 | fi | |
4920 | fi | |
4921 | removelist="$removelist $p" | |
4922 | ;; | |
4923 | *) ;; | |
4924 | esac | |
4925 | done | |
4926 | test -n "$removelist" && \ | |
4927 | func_show_eval "${RM}r \$removelist" | |
4928 | fi | |
4929 | ||
4930 | # Now set the variables for building old libraries. | |
4931 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then | |
4932 | oldlibs="$oldlibs $output_objdir/$libname.$libext" | |
4933 | ||
4934 | # Transform .lo files to .o files. | |
4935 | oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` | |
4936 | fi | |
4937 | ||
4938 | # Eliminate all temporary directories. | |
4939 | for path in $notinst_path; do | |
4940 | lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e 's% $path % %g'` | |
4941 | deplibs=`$ECHO "X$deplibs " | $Xsed -e 's% -L$path % %g'` | |
4942 | dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e 's% -L$path % %g'` | |
4943 | done | |
4944 | ||
4945 | if test -n "$xrpath"; then | |
4946 | # If the user specified any rpath flags, then add them. | |
4947 | temp_xrpath= | |
4948 | for libdir in $xrpath; do | |
4949 | temp_xrpath="$temp_xrpath -R$libdir" | |
4950 | case "$finalize_rpath " in | |
4951 | *" $libdir "*) ;; | |
4952 | *) finalize_rpath="$finalize_rpath $libdir" ;; | |
4953 | esac | |
4954 | done | |
4955 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then | |
4956 | dependency_libs="$temp_xrpath $dependency_libs" | |
4957 | fi | |
4958 | fi | |
4959 | ||
4960 | # Make sure dlfiles contains only unique files that won't be dlpreopened | |
4961 | old_dlfiles="$dlfiles" | |
4962 | dlfiles= | |
4963 | for lib in $old_dlfiles; do | |
4964 | case " $dlprefiles $dlfiles " in | |
4965 | *" $lib "*) ;; | |
4966 | *) dlfiles="$dlfiles $lib" ;; | |
4967 | esac | |
4968 | done | |
4969 | ||
4970 | # Make sure dlprefiles contains only unique files | |
4971 | old_dlprefiles="$dlprefiles" | |
4972 | dlprefiles= | |
4973 | for lib in $old_dlprefiles; do | |
4974 | case "$dlprefiles " in | |
4975 | *" $lib "*) ;; | |
4976 | *) dlprefiles="$dlprefiles $lib" ;; | |
4977 | esac | |
4978 | done | |
4979 | ||
4980 | if test "$build_libtool_libs" = yes; then | |
4981 | if test -n "$rpath"; then | |
4982 | case $host in | |
4983 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) | |
4984 | # these systems don't actually have a c library (as such)! | |
4985 | ;; | |
4986 | *-*-rhapsody* | *-*-darwin1.[012]) | |
4987 | # Rhapsody C library is in the System framework | |
4988 | deplibs="$deplibs System.ltframework" | |
4989 | ;; | |
4990 | *-*-netbsd*) | |
4991 | # Don't link with libc until the a.out ld.so is fixed. | |
4992 | ;; | |
4993 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) | |
4994 | # Do not include libc due to us having libc/libc_r. | |
4995 | ;; | |
4996 | *-*-sco3.2v5* | *-*-sco5v6*) | |
4997 | # Causes problems with __ctype | |
4998 | ;; | |
4999 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) | |
5000 | # Compiler inserts libc in the correct place for threads to work | |
5001 | ;; | |
5002 | *) | |
5003 | # Add libc to deplibs on all other systems if necessary. | |
5004 | if test "$build_libtool_need_lc" = "yes"; then | |
5005 | deplibs="$deplibs -lc" | |
5006 | fi | |
5007 | ;; | |
5008 | esac | |
5009 | fi | |
5010 | ||
5011 | # Transform deplibs into only deplibs that can be linked in shared. | |
5012 | name_save=$name | |
5013 | libname_save=$libname | |
5014 | release_save=$release | |
5015 | versuffix_save=$versuffix | |
5016 | major_save=$major | |
5017 | # I'm not sure if I'm treating the release correctly. I think | |
5018 | # release should show up in the -l (ie -lgmp5) so we don't want to | |
5019 | # add it in twice. Is that correct? | |
5020 | release="" | |
5021 | versuffix="" | |
5022 | major="" | |
5023 | newdeplibs= | |
5024 | droppeddeps=no | |
5025 | case $deplibs_check_method in | |
5026 | pass_all) | |
5027 | # Don't check for shared/static. Everything works. | |
5028 | # This might be a little naive. We might want to check | |
5029 | # whether the library exists or not. But this is on | |
5030 | # osf3 & osf4 and I'm not really sure... Just | |
5031 | # implementing what was already the behavior. | |
5032 | newdeplibs=$deplibs | |
5033 | ;; | |
5034 | test_compile) | |
5035 | # This code stresses the "libraries are programs" paradigm to its | |
5036 | # limits. Maybe even breaks it. We compile a program, linking it | |
5037 | # against the deplibs as a proxy for the library. Then we can check | |
5038 | # whether they linked in statically or dynamically with ldd. | |
5039 | $opt_dry_run || $RM conftest.c | |
5040 | cat > conftest.c <<EOF | |
5041 | int main() { return 0; } | |
5042 | EOF | |
5043 | $opt_dry_run || $RM conftest | |
5044 | $LTCC $LTCFLAGS -o conftest conftest.c $deplibs | |
5045 | if test "$?" -eq 0 ; then | |
5046 | ldd_output=`ldd conftest` | |
5047 | for i in $deplibs; do | |
5048 | name=`expr $i : '-l\(.*\)'` | |
5049 | # If $name is empty we are operating on a -L argument. | |
5050 | if test "$name" != "" && test "$name" -ne "0"; then | |
5051 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | |
5052 | case " $predeps $postdeps " in | |
5053 | *" $i "*) | |
5054 | newdeplibs="$newdeplibs $i" | |
5055 | i="" | |
5056 | ;; | |
5057 | esac | |
5058 | fi | |
5059 | if test -n "$i" ; then | |
5060 | libname=`eval "\\$ECHO \"$libname_spec\""` | |
5061 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` | |
5062 | set dummy $deplib_matches; shift | |
5063 | deplib_match=$1 | |
5064 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | |
5065 | newdeplibs="$newdeplibs $i" | |
5066 | else | |
5067 | droppeddeps=yes | |
5068 | $ECHO | |
5069 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." | |
5070 | $ECHO "*** I have the capability to make that library automatically link in when" | |
5071 | $ECHO "*** you link to this library. But I can only do this if you have a" | |
5072 | $ECHO "*** shared version of the library, which I believe you do not have" | |
5073 | $ECHO "*** because a test_compile did reveal that the linker did not use it for" | |
5074 | $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." | |
5075 | fi | |
5076 | fi | |
5077 | else | |
5078 | newdeplibs="$newdeplibs $i" | |
5079 | fi | |
5080 | done | |
5081 | else | |
5082 | # Error occurred in the first compile. Let's try to salvage | |
5083 | # the situation: Compile a separate program for each library. | |
5084 | for i in $deplibs; do | |
5085 | name=`expr $i : '-l\(.*\)'` | |
5086 | # If $name is empty we are operating on a -L argument. | |
5087 | if test "$name" != "" && test "$name" != "0"; then | |
5088 | $opt_dry_run || $RM conftest | |
5089 | $LTCC $LTCFLAGS -o conftest conftest.c $i | |
5090 | # Did it work? | |
5091 | if test "$?" -eq 0 ; then | |
5092 | ldd_output=`ldd conftest` | |
5093 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | |
5094 | case " $predeps $postdeps " in | |
5095 | *" $i "*) | |
5096 | newdeplibs="$newdeplibs $i" | |
5097 | i="" | |
5098 | ;; | |
5099 | esac | |
5100 | fi | |
5101 | if test -n "$i" ; then | |
5102 | libname=`eval "\\$ECHO \"$libname_spec\""` | |
5103 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` | |
5104 | set dummy $deplib_matches; shift | |
5105 | deplib_match=$1 | |
5106 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | |
5107 | newdeplibs="$newdeplibs $i" | |
5108 | else | |
5109 | droppeddeps=yes | |
5110 | $ECHO | |
5111 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." | |
5112 | $ECHO "*** I have the capability to make that library automatically link in when" | |
5113 | $ECHO "*** you link to this library. But I can only do this if you have a" | |
5114 | $ECHO "*** shared version of the library, which you do not appear to have" | |
5115 | $ECHO "*** because a test_compile did reveal that the linker did not use this one" | |
5116 | $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." | |
5117 | fi | |
5118 | fi | |
5119 | else | |
5120 | droppeddeps=yes | |
5121 | $ECHO | |
5122 | $ECHO "*** Warning! Library $i is needed by this library but I was not able to" | |
5123 | $ECHO "*** make it link in! You will probably need to install it or some" | |
5124 | $ECHO "*** library that it depends on before this library will be fully" | |
5125 | $ECHO "*** functional. Installing it before continuing would be even better." | |
5126 | fi | |
5127 | else | |
5128 | newdeplibs="$newdeplibs $i" | |
5129 | fi | |
5130 | done | |
5131 | fi | |
5132 | ;; | |
5133 | file_magic*) | |
5134 | set dummy $deplibs_check_method; shift | |
5135 | file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` | |
5136 | for a_deplib in $deplibs; do | |
5137 | name=`expr $a_deplib : '-l\(.*\)'` | |
5138 | # If $name is empty we are operating on a -L argument. | |
5139 | if test "$name" != "" && test "$name" != "0"; then | |
5140 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | |
5141 | case " $predeps $postdeps " in | |
5142 | *" $a_deplib "*) | |
5143 | newdeplibs="$newdeplibs $a_deplib" | |
5144 | a_deplib="" | |
5145 | ;; | |
5146 | esac | |
5147 | fi | |
5148 | if test -n "$a_deplib" ; then | |
5149 | libname=`eval "\\$ECHO \"$libname_spec\""` | |
5150 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do | |
5151 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` | |
5152 | for potent_lib in $potential_libs; do | |
5153 | # Follow soft links. | |
5154 | if ls -lLd "$potent_lib" 2>/dev/null | | |
5155 | $GREP " -> " >/dev/null; then | |
5156 | continue | |
5157 | fi | |
5158 | # The statement above tries to avoid entering an | |
5159 | # endless loop below, in case of cyclic links. | |
5160 | # We might still enter an endless loop, since a link | |
5161 | # loop can be closed while we follow links, | |
5162 | # but so what? | |
5163 | potlib="$potent_lib" | |
5164 | while test -h "$potlib" 2>/dev/null; do | |
5165 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` | |
5166 | case $potliblink in | |
5167 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; | |
5168 | *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; | |
5169 | esac | |
5170 | done | |
5171 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | | |
5172 | $SED -e 10q | | |
5173 | $EGREP "$file_magic_regex" > /dev/null; then | |
5174 | newdeplibs="$newdeplibs $a_deplib" | |
5175 | a_deplib="" | |
5176 | break 2 | |
5177 | fi | |
5178 | done | |
5179 | done | |
5180 | fi | |
5181 | if test -n "$a_deplib" ; then | |
5182 | droppeddeps=yes | |
5183 | $ECHO | |
5184 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." | |
5185 | $ECHO "*** I have the capability to make that library automatically link in when" | |
5186 | $ECHO "*** you link to this library. But I can only do this if you have a" | |
5187 | $ECHO "*** shared version of the library, which you do not appear to have" | |
5188 | $ECHO "*** because I did check the linker path looking for a file starting" | |
5189 | if test -z "$potlib" ; then | |
5190 | $ECHO "*** with $libname but no candidates were found. (...for file magic test)" | |
5191 | else | |
5192 | $ECHO "*** with $libname and none of the candidates passed a file format test" | |
5193 | $ECHO "*** using a file magic. Last file checked: $potlib" | |
5194 | fi | |
5195 | fi | |
5196 | else | |
5197 | # Add a -L argument. | |
5198 | newdeplibs="$newdeplibs $a_deplib" | |
5199 | fi | |
5200 | done # Gone through all deplibs. | |
5201 | ;; | |
5202 | match_pattern*) | |
5203 | set dummy $deplibs_check_method; shift | |
5204 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` | |
5205 | for a_deplib in $deplibs; do | |
5206 | name=`expr $a_deplib : '-l\(.*\)'` | |
5207 | # If $name is empty we are operating on a -L argument. | |
5208 | if test -n "$name" && test "$name" != "0"; then | |
5209 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | |
5210 | case " $predeps $postdeps " in | |
5211 | *" $a_deplib "*) | |
5212 | newdeplibs="$newdeplibs $a_deplib" | |
5213 | a_deplib="" | |
5214 | ;; | |
5215 | esac | |
5216 | fi | |
5217 | if test -n "$a_deplib" ; then | |
5218 | libname=`eval "\\$ECHO \"$libname_spec\""` | |
5219 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do | |
5220 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` | |
5221 | for potent_lib in $potential_libs; do | |
5222 | potlib="$potent_lib" # see symlink-check above in file_magic test | |
5223 | if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ | |
5224 | $EGREP "$match_pattern_regex" > /dev/null; then | |
5225 | newdeplibs="$newdeplibs $a_deplib" | |
5226 | a_deplib="" | |
5227 | break 2 | |
5228 | fi | |
5229 | done | |
5230 | done | |
5231 | fi | |
5232 | if test -n "$a_deplib" ; then | |
5233 | droppeddeps=yes | |
5234 | $ECHO | |
5235 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." | |
5236 | $ECHO "*** I have the capability to make that library automatically link in when" | |
5237 | $ECHO "*** you link to this library. But I can only do this if you have a" | |
5238 | $ECHO "*** shared version of the library, which you do not appear to have" | |
5239 | $ECHO "*** because I did check the linker path looking for a file starting" | |
5240 | if test -z "$potlib" ; then | |
5241 | $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" | |
5242 | else | |
5243 | $ECHO "*** with $libname and none of the candidates passed a file format test" | |
5244 | $ECHO "*** using a regex pattern. Last file checked: $potlib" | |
5245 | fi | |
5246 | fi | |
5247 | else | |
5248 | # Add a -L argument. | |
5249 | newdeplibs="$newdeplibs $a_deplib" | |
5250 | fi | |
5251 | done # Gone through all deplibs. | |
5252 | ;; | |
5253 | none | unknown | *) | |
5254 | newdeplibs="" | |
5255 | tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ | |
5256 | -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` | |
5257 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | |
5258 | for i in $predeps $postdeps ; do | |
5259 | # can't use Xsed below, because $i might contain '/' | |
5260 | tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` | |
5261 | done | |
5262 | fi | |
5263 | if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | | |
5264 | $GREP . >/dev/null; then | |
5265 | $ECHO | |
5266 | if test "X$deplibs_check_method" = "Xnone"; then | |
5267 | $ECHO "*** Warning: inter-library dependencies are not supported in this platform." | |
5268 | else | |
5269 | $ECHO "*** Warning: inter-library dependencies are not known to be supported." | |
5270 | fi | |
5271 | $ECHO "*** All declared inter-library dependencies are being dropped." | |
5272 | droppeddeps=yes | |
5273 | fi | |
5274 | ;; | |
5275 | esac | |
5276 | versuffix=$versuffix_save | |
5277 | major=$major_save | |
5278 | release=$release_save | |
5279 | libname=$libname_save | |
5280 | name=$name_save | |
5281 | ||
5282 | case $host in | |
5283 | *-*-rhapsody* | *-*-darwin1.[012]) | |
5284 | # On Rhapsody replace the C library with the System framework | |
5285 | newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` | |
5286 | ;; | |
5287 | esac | |
5288 | ||
5289 | if test "$droppeddeps" = yes; then | |
5290 | if test "$module" = yes; then | |
5291 | $ECHO | |
5292 | $ECHO "*** Warning: libtool could not satisfy all declared inter-library" | |
5293 | $ECHO "*** dependencies of module $libname. Therefore, libtool will create" | |
5294 | $ECHO "*** a static module, that should work as long as the dlopening" | |
5295 | $ECHO "*** application is linked with the -dlopen flag." | |
5296 | if test -z "$global_symbol_pipe"; then | |
5297 | $ECHO | |
5298 | $ECHO "*** However, this would only work if libtool was able to extract symbol" | |
5299 | $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" | |
5300 | $ECHO "*** not find such a program. So, this module is probably useless." | |
5301 | $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." | |
5302 | fi | |
5303 | if test "$build_old_libs" = no; then | |
5304 | oldlibs="$output_objdir/$libname.$libext" | |
5305 | build_libtool_libs=module | |
5306 | build_old_libs=yes | |
5307 | else | |
5308 | build_libtool_libs=no | |
5309 | fi | |
5310 | else | |
5311 | $ECHO "*** The inter-library dependencies that have been dropped here will be" | |
5312 | $ECHO "*** automatically added whenever a program is linked with this library" | |
5313 | $ECHO "*** or is declared to -dlopen it." | |
5314 | ||
5315 | if test "$allow_undefined" = no; then | |
5316 | $ECHO | |
5317 | $ECHO "*** Since this library must not contain undefined symbols," | |
5318 | $ECHO "*** because either the platform does not support them or" | |
5319 | $ECHO "*** it was explicitly requested with -no-undefined," | |
5320 | $ECHO "*** libtool will only create a static version of it." | |
5321 | if test "$build_old_libs" = no; then | |
5322 | oldlibs="$output_objdir/$libname.$libext" | |
5323 | build_libtool_libs=module | |
5324 | build_old_libs=yes | |
5325 | else | |
5326 | build_libtool_libs=no | |
5327 | fi | |
5328 | fi | |
5329 | fi | |
5330 | fi | |
5331 | # Done checking deplibs! | |
5332 | deplibs=$newdeplibs | |
5333 | fi | |
5334 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" | |
5335 | case $host in | |
5336 | *-*-darwin*) | |
5337 | newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` | |
5338 | new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` | |
5339 | deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` | |
5340 | ;; | |
5341 | esac | |
5342 | ||
5343 | # move library search paths that coincide with paths to not yet | |
5344 | # installed libraries to the beginning of the library search list | |
5345 | new_libs= | |
5346 | for path in $notinst_path; do | |
5347 | case " $new_libs " in | |
5348 | *" -L$path/$objdir "*) ;; | |
5349 | *) | |
5350 | case " $deplibs " in | |
5351 | *" -L$path/$objdir "*) | |
5352 | new_libs="$new_libs -L$path/$objdir" ;; | |
5353 | esac | |
5354 | ;; | |
5355 | esac | |
5356 | done | |
5357 | for deplib in $deplibs; do | |
5358 | case $deplib in | |
5359 | -L*) | |
5360 | case " $new_libs " in | |
5361 | *" $deplib "*) ;; | |
5362 | *) new_libs="$new_libs $deplib" ;; | |
5363 | esac | |
5364 | ;; | |
5365 | *) new_libs="$new_libs $deplib" ;; | |
5366 | esac | |
5367 | done | |
5368 | deplibs="$new_libs" | |
5369 | ||
5370 | # All the library-specific variables (install_libdir is set above). | |
5371 | library_names= | |
5372 | old_library= | |
5373 | dlname= | |
5374 | ||
5375 | # Test again, we may have decided not to build it any more | |
5376 | if test "$build_libtool_libs" = yes; then | |
5377 | if test "$hardcode_into_libs" = yes; then | |
5378 | # Hardcode the library paths | |
5379 | hardcode_libdirs= | |
5380 | dep_rpath= | |
5381 | rpath="$finalize_rpath" | |
5382 | test "$mode" != relink && rpath="$compile_rpath$rpath" | |
5383 | for libdir in $rpath; do | |
5384 | if test -n "$hardcode_libdir_flag_spec"; then | |
5385 | if test -n "$hardcode_libdir_separator"; then | |
5386 | if test -z "$hardcode_libdirs"; then | |
5387 | hardcode_libdirs="$libdir" | |
5388 | else | |
5389 | # Just accumulate the unique libdirs. | |
5390 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in | |
5391 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | |
5392 | ;; | |
5393 | *) | |
5394 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | |
5395 | ;; | |
5396 | esac | |
5397 | fi | |
5398 | else | |
5399 | eval flag=\"$hardcode_libdir_flag_spec\" | |
5400 | dep_rpath="$dep_rpath $flag" | |
5401 | fi | |
5402 | elif test -n "$runpath_var"; then | |
5403 | case "$perm_rpath " in | |
5404 | *" $libdir "*) ;; | |
5405 | *) perm_rpath="$perm_rpath $libdir" ;; | |
5406 | esac | |
5407 | fi | |
5408 | done | |
5409 | # Substitute the hardcoded libdirs into the rpath. | |
5410 | if test -n "$hardcode_libdir_separator" && | |
5411 | test -n "$hardcode_libdirs"; then | |
5412 | libdir="$hardcode_libdirs" | |
5413 | if test -n "$hardcode_libdir_flag_spec_ld"; then | |
5414 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" | |
5415 | else | |
5416 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" | |
5417 | fi | |
5418 | fi | |
5419 | if test -n "$runpath_var" && test -n "$perm_rpath"; then | |
5420 | # We should set the runpath_var. | |
5421 | rpath= | |
5422 | for dir in $perm_rpath; do | |
5423 | rpath="$rpath$dir:" | |
5424 | done | |
5425 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" | |
5426 | fi | |
5427 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" | |
5428 | fi | |
5429 | ||
5430 | shlibpath="$finalize_shlibpath" | |
5431 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" | |
5432 | if test -n "$shlibpath"; then | |
5433 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" | |
5434 | fi | |
5435 | ||
5436 | # Get the real and link names of the library. | |
5437 | eval shared_ext=\"$shrext_cmds\" | |
5438 | eval library_names=\"$library_names_spec\" | |
5439 | set dummy $library_names | |
5440 | shift | |
5441 | realname="$1" | |
5442 | shift | |
5443 | ||
5444 | if test -n "$soname_spec"; then | |
5445 | eval soname=\"$soname_spec\" | |
5446 | else | |
5447 | soname="$realname" | |
5448 | fi | |
5449 | if test -z "$dlname"; then | |
5450 | dlname=$soname | |
5451 | fi | |
5452 | ||
5453 | lib="$output_objdir/$realname" | |
5454 | linknames= | |
5455 | for link | |
5456 | do | |
5457 | linknames="$linknames $link" | |
5458 | done | |
5459 | ||
5460 | # Use standard objects if they are pic | |
5461 | test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
5462 | ||
5463 | delfiles= | |
5464 | if test -n "$export_symbols" && test -n "$include_expsyms"; then | |
5465 | $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" | |
5466 | export_symbols="$output_objdir/$libname.uexp" | |
5467 | delfiles="$delfiles $export_symbols" | |
5468 | fi | |
5469 | ||
5470 | orig_export_symbols= | |
5471 | case $host_os in | |
5472 | cygwin* | mingw*) | |
5473 | if test -n "$export_symbols" && test -z "$export_symbols_regex"; then | |
5474 | # exporting using user supplied symfile | |
5475 | if test "x`$SED 1q $export_symbols`" != xEXPORTS; then | |
5476 | # and it's NOT already a .def file. Must figure out | |
5477 | # which of the given symbols are data symbols and tag | |
5478 | # them as such. So, trigger use of export_symbols_cmds. | |
5479 | # export_symbols gets reassigned inside the "prepare | |
5480 | # the list of exported symbols" if statement, so the | |
5481 | # include_expsyms logic still works. | |
5482 | orig_export_symbols="$export_symbols" | |
5483 | export_symbols= | |
5484 | always_export_symbols=yes | |
5485 | fi | |
5486 | fi | |
5487 | ;; | |
5488 | esac | |
5489 | ||
5490 | # Prepare the list of exported symbols | |
5491 | if test -z "$export_symbols"; then | |
5492 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then | |
5493 | func_echo "generating symbol list for \`$libname.la'" | |
5494 | export_symbols="$output_objdir/$libname.exp" | |
5495 | $opt_dry_run || $RM $export_symbols | |
5496 | cmds=$export_symbols_cmds | |
5497 | save_ifs="$IFS"; IFS='~' | |
5498 | for cmd in $cmds; do | |
5499 | IFS="$save_ifs" | |
5500 | eval cmd=\"$cmd\" | |
5501 | if len=`expr "X$cmd" : ".*"` && | |
5502 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then | |
5503 | func_show_eval "$cmd" 'exit $?' | |
5504 | skipped_export=false | |
5505 | else | |
5506 | # The command line is too long to execute in one step. | |
5507 | func_echo "using reloadable object file for export list..." | |
5508 | skipped_export=: | |
5509 | # Break out early, otherwise skipped_export may be | |
5510 | # set to false by a later but shorter cmd. | |
5511 | break | |
5512 | fi | |
5513 | done | |
5514 | IFS="$save_ifs" | |
5515 | if test -n "$export_symbols_regex"; then | |
5516 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' | |
5517 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' | |
5518 | fi | |
5519 | fi | |
5520 | fi | |
5521 | ||
5522 | if test -n "$export_symbols" && test -n "$include_expsyms"; then | |
5523 | tmp_export_symbols="$export_symbols" | |
5524 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" | |
5525 | $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' | |
5526 | fi | |
5527 | ||
5528 | if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then | |
5529 | # The given exports_symbols file has to be filtered, so filter it. | |
5530 | func_echo "filter symbol list for \`$libname.la' to tag DATA exports" | |
5531 | # FIXME: $output_objdir/$libname.filter potentially contains lots of | |
5532 | # 's' commands which not all seds can handle. GNU sed should be fine | |
5533 | # though. Also, the filter scales superlinearly with the number of | |
5534 | # global variables. join(1) would be nice here, but unfortunately | |
5535 | # isn't a blessed tool. | |
5536 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter | |
5537 | delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" | |
5538 | export_symbols=$output_objdir/$libname.def | |
5539 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols | |
5540 | fi | |
5541 | ||
5542 | tmp_deplibs= | |
5543 | for test_deplib in $deplibs; do | |
5544 | case " $convenience " in | |
5545 | *" $test_deplib "*) ;; | |
5546 | *) | |
5547 | tmp_deplibs="$tmp_deplibs $test_deplib" | |
5548 | ;; | |
5549 | esac | |
5550 | done | |
5551 | deplibs="$tmp_deplibs" | |
5552 | ||
5553 | if test -n "$convenience"; then | |
5554 | if test -n "$whole_archive_flag_spec"; then | |
5555 | save_libobjs=$libobjs | |
5556 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" | |
5557 | else | |
5558 | gentop="$output_objdir/${outputname}x" | |
5559 | generated="$generated $gentop" | |
5560 | ||
5561 | func_extract_archives $gentop $convenience | |
5562 | libobjs="$libobjs $func_extract_archives_result" | |
5563 | fi | |
5564 | fi | |
5565 | ||
5566 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then | |
5567 | eval flag=\"$thread_safe_flag_spec\" | |
5568 | linker_flags="$linker_flags $flag" | |
5569 | fi | |
5570 | ||
5571 | # Make a backup of the uninstalled library when relinking | |
5572 | if test "$mode" = relink; then | |
5573 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? | |
5574 | fi | |
5575 | ||
5576 | # Do each of the archive commands. | |
5577 | if test "$module" = yes && test -n "$module_cmds" ; then | |
5578 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then | |
5579 | eval test_cmds=\"$module_expsym_cmds\" | |
5580 | cmds=$module_expsym_cmds | |
5581 | else | |
5582 | eval test_cmds=\"$module_cmds\" | |
5583 | cmds=$module_cmds | |
5584 | fi | |
5585 | else | |
5586 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then | |
5587 | eval test_cmds=\"$archive_expsym_cmds\" | |
5588 | cmds=$archive_expsym_cmds | |
5589 | else | |
5590 | eval test_cmds=\"$archive_cmds\" | |
5591 | cmds=$archive_cmds | |
5592 | fi | |
5593 | fi | |
5594 | ||
5595 | if test "X$skipped_export" != "X:" && | |
5596 | len=`expr "X$test_cmds" : ".*" 2>/dev/null` && | |
5597 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then | |
5598 | : | |
5599 | else | |
5600 | # The command line is too long to link in one step, link piecewise | |
5601 | # or, if using GNU ld and skipped_export is not :, use a linker | |
5602 | # script. | |
5603 | ||
5604 | # Save the value of $output and $libobjs because we want to | |
5605 | # use them later. If we have whole_archive_flag_spec, we | |
5606 | # want to use save_libobjs as it was before | |
5607 | # whole_archive_flag_spec was expanded, because we can't | |
5608 | # assume the linker understands whole_archive_flag_spec. | |
5609 | # This may have to be revisited, in case too many | |
5610 | # convenience libraries get linked in and end up exceeding | |
5611 | # the spec. | |
5612 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then | |
5613 | save_libobjs=$libobjs | |
5614 | fi | |
5615 | save_output=$output | |
5616 | output_la=`$ECHO "X$output" | $Xsed -e "$basename"` | |
5617 | ||
5618 | # Clear the reloadable object creation command queue and | |
5619 | # initialize k to one. | |
5620 | test_cmds= | |
5621 | concat_cmds= | |
5622 | objlist= | |
5623 | last_robj= | |
5624 | k=1 | |
5625 | ||
5626 | if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then | |
5627 | output=${output_objdir}/${output_la}.lnkscript | |
5628 | func_echo "creating GNU ld script: $output" | |
5629 | $ECHO 'INPUT (' > $output | |
5630 | for obj in $save_libobjs | |
5631 | do | |
5632 | $ECHO \""$obj"\" >> $output | |
5633 | done | |
5634 | $ECHO ')' >> $output | |
5635 | delfiles="$delfiles $output" | |
5636 | elif test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then | |
5637 | output=${output_objdir}/${output_la}.lnk | |
5638 | func_echo "creating linker input file list: $output" | |
5639 | : > $output | |
5640 | for obj in $save_libobjs | |
5641 | do | |
5642 | $ECHO "$obj" >> $output | |
5643 | done | |
5644 | delfiles="$delfiles $output" | |
5645 | output=\"$file_list_spec$output\" | |
5646 | else | |
5647 | func_echo "creating reloadable object files..." | |
5648 | output=$output_objdir/$output_la-${k}.$objext | |
5649 | # Loop over the list of objects to be linked. | |
5650 | for obj in $save_libobjs | |
5651 | do | |
5652 | eval test_cmds=\"$reload_cmds $objlist $last_robj\" | |
5653 | if test "X$objlist" = X || | |
5654 | { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && | |
5655 | test "$len" -le "$max_cmd_len"; }; then | |
5656 | objlist="$objlist $obj" | |
5657 | else | |
5658 | # The command $test_cmds is almost too long, add a | |
5659 | # command to the queue. | |
5660 | if test "$k" -eq 1 ; then | |
5661 | # The first file doesn't have a previous command to add. | |
5662 | eval concat_cmds=\"$reload_cmds $objlist $last_robj\" | |
5663 | else | |
5664 | # All subsequent reloadable object files will link in | |
5665 | # the last one created. | |
5666 | eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" | |
5667 | fi | |
5668 | last_robj=$output_objdir/$output_la-${k}.$objext | |
5669 | k=`expr $k + 1` | |
5670 | output=$output_objdir/$output_la-${k}.$objext | |
5671 | objlist=$obj | |
5672 | len=1 | |
5673 | fi | |
5674 | done | |
5675 | # Handle the remaining objects by creating one last | |
5676 | # reloadable object file. All subsequent reloadable object | |
5677 | # files will link in the last one created. | |
5678 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ | |
5679 | eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" | |
5680 | ||
5681 | if ${skipped_export-false}; then | |
5682 | func_echo "generating symbol list for \`$libname.la'" | |
5683 | export_symbols="$output_objdir/$libname.exp" | |
5684 | $opt_dry_run || $RM $export_symbols | |
5685 | libobjs=$output | |
5686 | # Append the command to create the export file. | |
5687 | eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" | |
5688 | fi | |
5689 | ||
5690 | # Set up a command to remove the reloadable object files | |
5691 | # after they are used. | |
5692 | i=0 | |
5693 | while test "$i" -lt "$k" | |
5694 | do | |
5695 | i=`expr $i + 1` | |
5696 | delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" | |
5697 | done | |
5698 | ||
5699 | func_echo "creating a temporary reloadable object file: $output" | |
5700 | ||
5701 | # Loop through the commands generated above and execute them. | |
5702 | save_ifs="$IFS"; IFS='~' | |
5703 | for cmd in $concat_cmds; do | |
5704 | IFS="$save_ifs" | |
5705 | $opt_silent || { | |
5706 | func_quote_for_expand "$cmd" | |
5707 | eval "func_echo $func_quote_for_expand_result" | |
5708 | } | |
5709 | $opt_dry_run || eval "$cmd" || { | |
5710 | lt_exit=$? | |
5711 | ||
5712 | # Restore the uninstalled library and exit | |
5713 | if test "$mode" = relink; then | |
5714 | ( cd "$output_objdir" && \ | |
5715 | $RM "${realname}T" && \ | |
5716 | $MV "${realname}U" "$realname" ) | |
5717 | fi | |
5718 | ||
5719 | exit $lt_exit | |
5720 | } | |
5721 | done | |
5722 | IFS="$save_ifs" | |
5723 | fi | |
5724 | ||
5725 | libobjs=$output | |
5726 | # Restore the value of output. | |
5727 | output=$save_output | |
5728 | ||
5729 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then | |
5730 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" | |
5731 | fi | |
5732 | # Expand the library linking commands again to reset the | |
5733 | # value of $libobjs for piecewise linking. | |
5734 | ||
5735 | # Do each of the archive commands. | |
5736 | if test "$module" = yes && test -n "$module_cmds" ; then | |
5737 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then | |
5738 | cmds=$module_expsym_cmds | |
5739 | else | |
5740 | cmds=$module_cmds | |
5741 | fi | |
5742 | else | |
5743 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then | |
5744 | cmds=$archive_expsym_cmds | |
5745 | else | |
5746 | cmds=$archive_cmds | |
5747 | fi | |
5748 | fi | |
5749 | fi | |
5750 | ||
5751 | if test -n "$delfiles"; then | |
5752 | # Append the command to remove temporary files to $cmds. | |
5753 | eval cmds=\"\$cmds~\$RM $delfiles\" | |
5754 | fi | |
5755 | ||
5756 | # Add any objects from preloaded convenience libraries | |
5757 | if test -n "$dlprefiles"; then | |
5758 | gentop="$output_objdir/${outputname}x" | |
5759 | generated="$generated $gentop" | |
5760 | ||
5761 | func_extract_archives $gentop $dlprefiles | |
5762 | libobjs="$libobjs $func_extract_archives_result" | |
5763 | fi | |
5764 | ||
5765 | save_ifs="$IFS"; IFS='~' | |
5766 | for cmd in $cmds; do | |
5767 | IFS="$save_ifs" | |
5768 | eval cmd=\"$cmd\" | |
5769 | $opt_silent || { | |
5770 | func_quote_for_expand "$cmd" | |
5771 | eval "func_echo $func_quote_for_expand_result" | |
5772 | } | |
5773 | $opt_dry_run || eval "$cmd" || { | |
5774 | lt_exit=$? | |
5775 | ||
5776 | # Restore the uninstalled library and exit | |
5777 | if test "$mode" = relink; then | |
5778 | ( cd "$output_objdir" && \ | |
5779 | $RM "${realname}T" && \ | |
5780 | $MV "${realname}U" "$realname" ) | |
5781 | fi | |
5782 | ||
5783 | exit $lt_exit | |
5784 | } | |
5785 | done | |
5786 | IFS="$save_ifs" | |
5787 | ||
5788 | # Restore the uninstalled library and exit | |
5789 | if test "$mode" = relink; then | |
5790 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? | |
5791 | ||
5792 | if test -n "$convenience"; then | |
5793 | if test -z "$whole_archive_flag_spec"; then | |
5794 | func_show_eval '${RM}r "$gentop"' | |
5795 | fi | |
5796 | fi | |
5797 | ||
5798 | exit $EXIT_SUCCESS | |
5799 | fi | |
5800 | ||
5801 | # Create links to the real library. | |
5802 | for linkname in $linknames; do | |
5803 | if test "$realname" != "$linkname"; then | |
5804 | func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' | |
5805 | fi | |
5806 | done | |
5807 | ||
5808 | # If -module or -export-dynamic was specified, set the dlname. | |
5809 | if test "$module" = yes || test "$export_dynamic" = yes; then | |
5810 | # On all known operating systems, these are identical. | |
5811 | dlname="$soname" | |
5812 | fi | |
5813 | fi | |
5814 | ;; | |
5815 | ||
5816 | obj) | |
5817 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | |
5818 | func_warning "\`-dlopen' is ignored for objects" | |
5819 | fi | |
5820 | ||
5821 | test -n "$deplibs" && \ | |
5822 | func_warning "\`-l' and \`-L' are ignored for objects" | |
5823 | ||
5824 | test -n "$rpath" && \ | |
5825 | func_warning "\`-rpath' is ignored for objects" | |
5826 | ||
5827 | test -n "$xrpath" && \ | |
5828 | func_warning "\`-R' is ignored for objects" | |
5829 | ||
5830 | test -n "$vinfo" && \ | |
5831 | func_warning "\`-version-info' is ignored for objects" | |
5832 | ||
5833 | test -n "$release" && \ | |
5834 | func_warning "\`-release' is ignored for objects" | |
5835 | ||
5836 | case $output in | |
5837 | *.lo) | |
5838 | test -n "$objs$old_deplibs" && \ | |
5839 | func_fatal_error "cannot build library object \`$output' from non-libtool objects" | |
5840 | ||
5841 | libobj="$output" | |
5842 | obj=`$ECHO "X$output" | $Xsed -e "$lo2o"` | |
5843 | ;; | |
5844 | *) | |
5845 | libobj= | |
5846 | obj="$output" | |
5847 | ;; | |
5848 | esac | |
5849 | ||
5850 | # Delete the old objects. | |
5851 | $opt_dry_run || $RM $obj $libobj | |
5852 | ||
5853 | # Objects from convenience libraries. This assumes | |
5854 | # single-version convenience libraries. Whenever we create | |
5855 | # different ones for PIC/non-PIC, this we'll have to duplicate | |
5856 | # the extraction. | |
5857 | reload_conv_objs= | |
5858 | gentop= | |
5859 | # reload_cmds runs $LD directly, so let us get rid of | |
5860 | # -Wl from whole_archive_flag_spec | |
5861 | wl= | |
5862 | ||
5863 | if test -n "$convenience"; then | |
5864 | if test -n "$whole_archive_flag_spec"; then | |
5865 | eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" | |
5866 | else | |
5867 | gentop="$output_objdir/${obj}x" | |
5868 | generated="$generated $gentop" | |
5869 | ||
5870 | func_extract_archives $gentop $convenience | |
5871 | reload_conv_objs="$reload_objs $func_extract_archives_result" | |
5872 | fi | |
5873 | fi | |
5874 | ||
5875 | # Create the old-style object. | |
5876 | 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 | |
5877 | ||
5878 | output="$obj" | |
5879 | func_execute_cmds "$reload_cmds" 'exit $?' | |
5880 | ||
5881 | # Exit if we aren't doing a library object file. | |
5882 | if test -z "$libobj"; then | |
5883 | if test -n "$gentop"; then | |
5884 | func_show_eval '${RM}r "$gentop"' | |
5885 | fi | |
5886 | ||
5887 | exit $EXIT_SUCCESS | |
5888 | fi | |
5889 | ||
5890 | if test "$build_libtool_libs" != yes; then | |
5891 | if test -n "$gentop"; then | |
5892 | func_show_eval '${RM}r "$gentop"' | |
5893 | fi | |
5894 | ||
5895 | # Create an invalid libtool object if no PIC, so that we don't | |
5896 | # accidentally link it into a program. | |
5897 | # $show "echo timestamp > $libobj" | |
5898 | # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? | |
5899 | exit $EXIT_SUCCESS | |
5900 | fi | |
5901 | ||
5902 | if test -n "$pic_flag" || test "$pic_mode" != default; then | |
5903 | # Only do commands if we really have different PIC objects. | |
5904 | reload_objs="$libobjs $reload_conv_objs" | |
5905 | output="$libobj" | |
5906 | func_execute_cmds "$reload_cmds" 'exit $?' | |
5907 | fi | |
5908 | ||
5909 | if test -n "$gentop"; then | |
5910 | func_show_eval '${RM}r "$gentop"' | |
5911 | fi | |
5912 | ||
5913 | exit $EXIT_SUCCESS | |
5914 | ;; | |
5915 | ||
5916 | prog) | |
5917 | case $host in | |
5918 | *cygwin*) func_stripname '' '.exe' "$output" | |
5919 | output=$func_stripname_result.exe;; | |
5920 | esac | |
5921 | test -n "$vinfo" && \ | |
5922 | func_warning "\`-version-info' is ignored for programs" | |
5923 | ||
5924 | test -n "$release" && \ | |
5925 | func_warning "\`-release' is ignored for programs" | |
5926 | ||
5927 | test "$preload" = yes \ | |
5928 | && test "$dlopen_support" = unknown \ | |
5929 | && test "$dlopen_self" = unknown \ | |
5930 | && test "$dlopen_self_static" = unknown && \ | |
5931 | func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." | |
5932 | ||
5933 | case $host in | |
5934 | *-*-rhapsody* | *-*-darwin1.[012]) | |
5935 | # On Rhapsody replace the C library is the System framework | |
5936 | compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` | |
5937 | finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` | |
5938 | ;; | |
5939 | esac | |
5940 | ||
5941 | case $host in | |
5942 | *-*-darwin*) | |
5943 | # Don't allow lazy linking, it breaks C++ global constructors | |
5944 | # But is supposedly fixed on 10.4 or later (yay!). | |
5945 | if test "$tagname" = CXX ; then | |
5946 | case ${MACOSX_DEPLOYMENT_TARGET-10.0} in | |
5947 | 10.[0123]) | |
5948 | compile_command="$compile_command ${wl}-bind_at_load" | |
5949 | finalize_command="$finalize_command ${wl}-bind_at_load" | |
5950 | ;; | |
5951 | esac | |
5952 | fi | |
5953 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" | |
5954 | compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` | |
5955 | finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` | |
5956 | ;; | |
5957 | esac | |
5958 | ||
5959 | ||
5960 | # move library search paths that coincide with paths to not yet | |
5961 | # installed libraries to the beginning of the library search list | |
5962 | new_libs= | |
5963 | for path in $notinst_path; do | |
5964 | case " $new_libs " in | |
5965 | *" -L$path/$objdir "*) ;; | |
5966 | *) | |
5967 | case " $compile_deplibs " in | |
5968 | *" -L$path/$objdir "*) | |
5969 | new_libs="$new_libs -L$path/$objdir" ;; | |
5970 | esac | |
5971 | ;; | |
5972 | esac | |
5973 | done | |
5974 | for deplib in $compile_deplibs; do | |
5975 | case $deplib in | |
5976 | -L*) | |
5977 | case " $new_libs " in | |
5978 | *" $deplib "*) ;; | |
5979 | *) new_libs="$new_libs $deplib" ;; | |
5980 | esac | |
5981 | ;; | |
5982 | *) new_libs="$new_libs $deplib" ;; | |
5983 | esac | |
5984 | done | |
5985 | compile_deplibs="$new_libs" | |
5986 | ||
5987 | ||
5988 | compile_command="$compile_command $compile_deplibs" | |
5989 | finalize_command="$finalize_command $finalize_deplibs" | |
5990 | ||
5991 | if test -n "$rpath$xrpath"; then | |
5992 | # If the user specified any rpath flags, then add them. | |
5993 | for libdir in $rpath $xrpath; do | |
5994 | # This is the magic to use -rpath. | |
5995 | case "$finalize_rpath " in | |
5996 | *" $libdir "*) ;; | |
5997 | *) finalize_rpath="$finalize_rpath $libdir" ;; | |
5998 | esac | |
5999 | done | |
6000 | fi | |
6001 | ||
6002 | # Now hardcode the library paths | |
6003 | rpath= | |
6004 | hardcode_libdirs= | |
6005 | for libdir in $compile_rpath $finalize_rpath; do | |
6006 | if test -n "$hardcode_libdir_flag_spec"; then | |
6007 | if test -n "$hardcode_libdir_separator"; then | |
6008 | if test -z "$hardcode_libdirs"; then | |
6009 | hardcode_libdirs="$libdir" | |
6010 | else | |
6011 | # Just accumulate the unique libdirs. | |
6012 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in | |
6013 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | |
6014 | ;; | |
6015 | *) | |
6016 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | |
6017 | ;; | |
6018 | esac | |
6019 | fi | |
6020 | else | |
6021 | eval flag=\"$hardcode_libdir_flag_spec\" | |
6022 | rpath="$rpath $flag" | |
6023 | fi | |
6024 | elif test -n "$runpath_var"; then | |
6025 | case "$perm_rpath " in | |
6026 | *" $libdir "*) ;; | |
6027 | *) perm_rpath="$perm_rpath $libdir" ;; | |
6028 | esac | |
6029 | fi | |
6030 | case $host in | |
6031 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | |
6032 | testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` | |
6033 | case :$dllsearchpath: in | |
6034 | *":$libdir:"*) ;; | |
6035 | *) dllsearchpath="$dllsearchpath:$libdir";; | |
6036 | esac | |
6037 | case :$dllsearchpath: in | |
6038 | *":$testbindir:"*) ;; | |
6039 | *) dllsearchpath="$dllsearchpath:$testbindir";; | |
6040 | esac | |
6041 | ;; | |
6042 | esac | |
6043 | done | |
6044 | # Substitute the hardcoded libdirs into the rpath. | |
6045 | if test -n "$hardcode_libdir_separator" && | |
6046 | test -n "$hardcode_libdirs"; then | |
6047 | libdir="$hardcode_libdirs" | |
6048 | eval rpath=\" $hardcode_libdir_flag_spec\" | |
6049 | fi | |
6050 | compile_rpath="$rpath" | |
6051 | ||
6052 | rpath= | |
6053 | hardcode_libdirs= | |
6054 | for libdir in $finalize_rpath; do | |
6055 | if test -n "$hardcode_libdir_flag_spec"; then | |
6056 | if test -n "$hardcode_libdir_separator"; then | |
6057 | if test -z "$hardcode_libdirs"; then | |
6058 | hardcode_libdirs="$libdir" | |
6059 | else | |
6060 | # Just accumulate the unique libdirs. | |
6061 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in | |
6062 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | |
6063 | ;; | |
6064 | *) | |
6065 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | |
6066 | ;; | |
6067 | esac | |
6068 | fi | |
6069 | else | |
6070 | eval flag=\"$hardcode_libdir_flag_spec\" | |
6071 | rpath="$rpath $flag" | |
6072 | fi | |
6073 | elif test -n "$runpath_var"; then | |
6074 | case "$finalize_perm_rpath " in | |
6075 | *" $libdir "*) ;; | |
6076 | *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; | |
6077 | esac | |
6078 | fi | |
6079 | done | |
6080 | # Substitute the hardcoded libdirs into the rpath. | |
6081 | if test -n "$hardcode_libdir_separator" && | |
6082 | test -n "$hardcode_libdirs"; then | |
6083 | libdir="$hardcode_libdirs" | |
6084 | eval rpath=\" $hardcode_libdir_flag_spec\" | |
6085 | fi | |
6086 | finalize_rpath="$rpath" | |
6087 | ||
6088 | if test -n "$libobjs" && test "$build_old_libs" = yes; then | |
6089 | # Transform all the library objects into standard objects. | |
6090 | compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
6091 | finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | |
6092 | fi | |
6093 | ||
6094 | func_generate_dlsyms "$outputname" "@PROGRAM@" "no" | |
6095 | ||
6096 | # template prelinking step | |
6097 | if test -n "$prelink_cmds"; then | |
6098 | func_execute_cmds "$prelink_cmds" 'exit $?' | |
6099 | fi | |
6100 | ||
6101 | wrappers_required=yes | |
6102 | case $host in | |
6103 | *cygwin* | *mingw* ) | |
6104 | if test "$build_libtool_libs" != yes; then | |
6105 | wrappers_required=no | |
6106 | fi | |
6107 | ;; | |
6108 | *) | |
6109 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then | |
6110 | wrappers_required=no | |
6111 | fi | |
6112 | ;; | |
6113 | esac | |
6114 | if test "$wrappers_required" = no; then | |
6115 | # Replace the output file specification. | |
6116 | compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` | |
6117 | link_command="$compile_command$compile_rpath" | |
6118 | ||
6119 | # We have no uninstalled library dependencies, so finalize right now. | |
6120 | exit_status=0 | |
6121 | func_show_eval "$link_command" 'exit_status=$?' | |
6122 | ||
6123 | # Delete the generated files. | |
6124 | if test -f "$output_objdir/${outputname}S.${objext}"; then | |
6125 | func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' | |
6126 | fi | |
6127 | ||
6128 | exit $exit_status | |
6129 | fi | |
6130 | ||
6131 | if test -n "$compile_shlibpath$finalize_shlibpath"; then | |
6132 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" | |
6133 | fi | |
6134 | if test -n "$finalize_shlibpath"; then | |
6135 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" | |
6136 | fi | |
6137 | ||
6138 | compile_var= | |
6139 | finalize_var= | |
6140 | if test -n "$runpath_var"; then | |
6141 | if test -n "$perm_rpath"; then | |
6142 | # We should set the runpath_var. | |
6143 | rpath= | |
6144 | for dir in $perm_rpath; do | |
6145 | rpath="$rpath$dir:" | |
6146 | done | |
6147 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " | |
6148 | fi | |
6149 | if test -n "$finalize_perm_rpath"; then | |
6150 | # We should set the runpath_var. | |
6151 | rpath= | |
6152 | for dir in $finalize_perm_rpath; do | |
6153 | rpath="$rpath$dir:" | |
6154 | done | |
6155 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " | |
6156 | fi | |
6157 | fi | |
6158 | ||
6159 | if test "$no_install" = yes; then | |
6160 | # We don't need to create a wrapper script. | |
6161 | link_command="$compile_var$compile_command$compile_rpath" | |
6162 | # Replace the output file specification. | |
6163 | link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` | |
6164 | # Delete the old output file. | |
6165 | $opt_dry_run || $RM $output | |
6166 | # Link the executable and exit | |
6167 | func_show_eval "$link_command" 'exit $?' | |
6168 | exit $EXIT_SUCCESS | |
6169 | fi | |
6170 | ||
6171 | if test "$hardcode_action" = relink; then | |
6172 | # Fast installation is not supported | |
6173 | link_command="$compile_var$compile_command$compile_rpath" | |
6174 | relink_command="$finalize_var$finalize_command$finalize_rpath" | |
6175 | ||
6176 | func_warning "this platform does not like uninstalled shared libraries" | |
6177 | func_warning "\`$output' will be relinked during installation" | |
6178 | else | |
6179 | if test "$fast_install" != no; then | |
6180 | link_command="$finalize_var$compile_command$finalize_rpath" | |
6181 | if test "$fast_install" = yes; then | |
6182 | relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` | |
6183 | else | |
6184 | # fast_install is set to needless | |
6185 | relink_command= | |
6186 | fi | |
6187 | else | |
6188 | link_command="$compile_var$compile_command$compile_rpath" | |
6189 | relink_command="$finalize_var$finalize_command$finalize_rpath" | |
6190 | fi | |
6191 | fi | |
6192 | ||
6193 | # Replace the output file specification. | |
6194 | link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` | |
6195 | ||
6196 | # Delete the old output files. | |
6197 | $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname | |
6198 | ||
6199 | func_show_eval "$link_command" 'exit $?' | |
6200 | ||
6201 | # Now create the wrapper script. | |
6202 | func_echo "creating $output" | |
6203 | ||
6204 | # Quote the relink command for shipping. | |
6205 | if test -n "$relink_command"; then | |
6206 | # Preserve any variables that may affect compiler behavior | |
6207 | for var in $variables_saved_for_relink; do | |
6208 | if eval test -z \"\${$var+set}\"; then | |
6209 | relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" | |
6210 | elif eval var_value=\$$var; test -z "$var_value"; then | |
6211 | relink_command="$var=; export $var; $relink_command" | |
6212 | else | |
6213 | func_quote_for_eval "$var_value" | |
6214 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" | |
6215 | fi | |
6216 | done | |
6217 | relink_command="(cd `pwd`; $relink_command)" | |
6218 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` | |
6219 | fi | |
6220 | ||
6221 | # Quote $ECHO for shipping. | |
6222 | if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then | |
6223 | case $progpath in | |
6224 | [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; | |
6225 | *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; | |
6226 | esac | |
6227 | qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` | |
6228 | else | |
6229 | qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` | |
6230 | fi | |
6231 | ||
6232 | # Only actually do things if not in dry run mode. | |
6233 | $opt_dry_run || { | |
6234 | # win32 will think the script is a binary if it has | |
6235 | # a .exe suffix, so we strip it off here. | |
6236 | case $output in | |
6237 | *.exe) func_stripname '' '.exe' "$output" | |
6238 | output=$func_stripname_result ;; | |
6239 | esac | |
6240 | # test for cygwin because mv fails w/o .exe extensions | |
6241 | case $host in | |
6242 | *cygwin*) | |
6243 | exeext=.exe | |
6244 | func_stripname '' '.exe' "$outputname" | |
6245 | outputname=$func_stripname_result ;; | |
6246 | *) exeext= ;; | |
6247 | esac | |
6248 | case $host in | |
6249 | *cygwin* | *mingw* ) | |
6250 | output_name=`basename $output` | |
6251 | output_path=`dirname $output` | |
6252 | cwrappersource="$output_path/$objdir/lt-$output_name.c" | |
6253 | cwrapper="$output_path/$output_name.exe" | |
6254 | $RM $cwrappersource $cwrapper | |
6255 | trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 | |
6256 | ||
6257 | cat > $cwrappersource <<EOF | |
6258 | ||
6259 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname | |
6260 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | |
6261 | ||
6262 | The $output program cannot be directly executed until all the libtool | |
6263 | libraries that it depends on are installed. | |
6264 | ||
6265 | This wrapper executable should never be moved out of the build directory. | |
6266 | If it is, it will not operate correctly. | |
6267 | ||
6268 | Currently, it simply execs the wrapper *script* "/bin/sh $output", | |
6269 | but could eventually absorb all of the scripts functionality and | |
6270 | exec $objdir/$outputname directly. | |
6271 | */ | |
6272 | EOF | |
6273 | cat >> $cwrappersource<<"EOF" | |
6274 | #include <stdio.h> | |
6275 | #include <stdlib.h> | |
6276 | #include <unistd.h> | |
6277 | #include <malloc.h> | |
6278 | #include <stdarg.h> | |
6279 | #include <assert.h> | |
6280 | #include <string.h> | |
6281 | #include <ctype.h> | |
6282 | #include <sys/stat.h> | |
6283 | ||
6284 | #if defined(PATH_MAX) | |
6285 | # define LT_PATHMAX PATH_MAX | |
6286 | #elif defined(MAXPATHLEN) | |
6287 | # define LT_PATHMAX MAXPATHLEN | |
6288 | #else | |
6289 | # define LT_PATHMAX 1024 | |
6290 | #endif | |
6291 | ||
6292 | #ifndef DIR_SEPARATOR | |
6293 | # define DIR_SEPARATOR '/' | |
6294 | # define PATH_SEPARATOR ':' | |
6295 | #endif | |
6296 | ||
6297 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ | |
6298 | defined (__OS2__) | |
6299 | # define HAVE_DOS_BASED_FILE_SYSTEM | |
6300 | # ifndef DIR_SEPARATOR_2 | |
6301 | # define DIR_SEPARATOR_2 '\\' | |
6302 | # endif | |
6303 | # ifndef PATH_SEPARATOR_2 | |
6304 | # define PATH_SEPARATOR_2 ';' | |
6305 | # endif | |
6306 | #endif | |
6307 | ||
6308 | #ifndef DIR_SEPARATOR_2 | |
6309 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) | |
6310 | #else /* DIR_SEPARATOR_2 */ | |
6311 | # define IS_DIR_SEPARATOR(ch) \ | |
6312 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) | |
6313 | #endif /* DIR_SEPARATOR_2 */ | |
6314 | ||
6315 | #ifndef PATH_SEPARATOR_2 | |
6316 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) | |
6317 | #else /* PATH_SEPARATOR_2 */ | |
6318 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) | |
6319 | #endif /* PATH_SEPARATOR_2 */ | |
6320 | ||
6321 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) | |
6322 | #define XFREE(stale) do { \ | |
6323 | if (stale) { free ((void *) stale); stale = 0; } \ | |
6324 | } while (0) | |
6325 | ||
6326 | /* -DDEBUG is fairly common in CFLAGS. */ | |
6327 | #undef DEBUG | |
6328 | #if defined DEBUGWRAPPER | |
6329 | # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) | |
6330 | #else | |
6331 | # define DEBUG(format, ...) | |
6332 | #endif | |
6333 | ||
6334 | const char *program_name = NULL; | |
6335 | ||
6336 | void * xmalloc (size_t num); | |
6337 | char * xstrdup (const char *string); | |
6338 | const char * base_name (const char *name); | |
6339 | char * find_executable(const char *wrapper); | |
6340 | int check_executable(const char *path); | |
6341 | char * strendzap(char *str, const char *pat); | |
6342 | void lt_fatal (const char *message, ...); | |
6343 | ||
6344 | int | |
6345 | main (int argc, char *argv[]) | |
6346 | { | |
6347 | char **newargz; | |
6348 | int i; | |
6349 | ||
6350 | program_name = (char *) xstrdup (base_name (argv[0])); | |
6351 | DEBUG("(main) argv[0] : %s\n",argv[0]); | |
6352 | DEBUG("(main) program_name : %s\n",program_name); | |
6353 | newargz = XMALLOC(char *, argc+2); | |
6354 | EOF | |
6355 | ||
6356 | cat >> $cwrappersource <<EOF | |
6357 | newargz[0] = (char *) xstrdup("$SHELL"); | |
6358 | EOF | |
6359 | ||
6360 | cat >> $cwrappersource <<"EOF" | |
6361 | newargz[1] = find_executable(argv[0]); | |
6362 | if (newargz[1] == NULL) | |
6363 | lt_fatal("Couldn't find %s", argv[0]); | |
6364 | DEBUG("(main) found exe at : %s\n",newargz[1]); | |
6365 | /* we know the script has the same name, without the .exe */ | |
6366 | /* so make sure newargz[1] doesn't end in .exe */ | |
6367 | strendzap(newargz[1],".exe"); | |
6368 | for (i = 1; i < argc; i++) | |
6369 | newargz[i+1] = xstrdup(argv[i]); | |
6370 | newargz[argc+1] = NULL; | |
6371 | ||
6372 | for (i=0; i<argc+1; i++) | |
6373 | { | |
6374 | DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); | |
6375 | ; | |
6376 | } | |
6377 | ||
6378 | EOF | |
6379 | ||
6380 | case $host_os in | |
6381 | mingw*) | |
6382 | cat >> $cwrappersource <<EOF | |
6383 | execv("$SHELL",(char const **)newargz); | |
6384 | EOF | |
6385 | ;; | |
6386 | *) | |
6387 | cat >> $cwrappersource <<EOF | |
6388 | execv("$SHELL",newargz); | |
6389 | EOF | |
6390 | ;; | |
6391 | esac | |
6392 | ||
6393 | cat >> $cwrappersource <<"EOF" | |
6394 | return 127; | |
6395 | } | |
6396 | ||
6397 | void * | |
6398 | xmalloc (size_t num) | |
6399 | { | |
6400 | void * p = (void *) malloc (num); | |
6401 | if (!p) | |
6402 | lt_fatal ("Memory exhausted"); | |
6403 | ||
6404 | return p; | |
6405 | } | |
6406 | ||
6407 | char * | |
6408 | xstrdup (const char *string) | |
6409 | { | |
6410 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL | |
6411 | ; | |
6412 | } | |
6413 | ||
6414 | const char * | |
6415 | base_name (const char *name) | |
6416 | { | |
6417 | const char *base; | |
6418 | ||
6419 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | |
6420 | /* Skip over the disk name in MSDOS pathnames. */ | |
6421 | if (isalpha ((unsigned char)name[0]) && name[1] == ':') | |
6422 | name += 2; | |
6423 | #endif | |
6424 | ||
6425 | for (base = name; *name; name++) | |
6426 | if (IS_DIR_SEPARATOR (*name)) | |
6427 | base = name + 1; | |
6428 | return base; | |
6429 | } | |
6430 | ||
6431 | int | |
6432 | check_executable(const char * path) | |
6433 | { | |
6434 | struct stat st; | |
6435 | ||
6436 | DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); | |
6437 | if ((!path) || (!*path)) | |
6438 | return 0; | |
6439 | ||
6440 | if ((stat (path, &st) >= 0) && | |
6441 | ( | |
6442 | /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ | |
6443 | #if defined (S_IXOTH) | |
6444 | ((st.st_mode & S_IXOTH) == S_IXOTH) || | |
6445 | #endif | |
6446 | #if defined (S_IXGRP) | |
6447 | ((st.st_mode & S_IXGRP) == S_IXGRP) || | |
6448 | #endif | |
6449 | ((st.st_mode & S_IXUSR) == S_IXUSR)) | |
6450 | ) | |
6451 | return 1; | |
6452 | else | |
6453 | return 0; | |
6454 | } | |
6455 | ||
6456 | /* Searches for the full path of the wrapper. Returns | |
6457 | newly allocated full path name if found, NULL otherwise */ | |
6458 | char * | |
6459 | find_executable (const char* wrapper) | |
6460 | { | |
6461 | int has_slash = 0; | |
6462 | const char* p; | |
6463 | const char* p_next; | |
6464 | /* static buffer for getcwd */ | |
6465 | char tmp[LT_PATHMAX + 1]; | |
6466 | int tmp_len; | |
6467 | char* concat_name; | |
6468 | ||
6469 | DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); | |
6470 | ||
6471 | if ((wrapper == NULL) || (*wrapper == '\0')) | |
6472 | return NULL; | |
6473 | ||
6474 | /* Absolute path? */ | |
6475 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | |
6476 | if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') | |
6477 | { | |
6478 | concat_name = xstrdup (wrapper); | |
6479 | if (check_executable(concat_name)) | |
6480 | return concat_name; | |
6481 | XFREE(concat_name); | |
6482 | } | |
6483 | else | |
6484 | { | |
6485 | #endif | |
6486 | if (IS_DIR_SEPARATOR (wrapper[0])) | |
6487 | { | |
6488 | concat_name = xstrdup (wrapper); | |
6489 | if (check_executable(concat_name)) | |
6490 | return concat_name; | |
6491 | XFREE(concat_name); | |
6492 | } | |
6493 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | |
6494 | } | |
6495 | #endif | |
6496 | ||
6497 | for (p = wrapper; *p; p++) | |
6498 | if (*p == '/') | |
6499 | { | |
6500 | has_slash = 1; | |
6501 | break; | |
6502 | } | |
6503 | if (!has_slash) | |
6504 | { | |
6505 | /* no slashes; search PATH */ | |
6506 | const char* path = getenv ("PATH"); | |
6507 | if (path != NULL) | |
6508 | { | |
6509 | for (p = path; *p; p = p_next) | |
6510 | { | |
6511 | const char* q; | |
6512 | size_t p_len; | |
6513 | for (q = p; *q; q++) | |
6514 | if (IS_PATH_SEPARATOR(*q)) | |
6515 | break; | |
6516 | p_len = q - p; | |
6517 | p_next = (*q == '\0' ? q : q + 1); | |
6518 | if (p_len == 0) | |
6519 | { | |
6520 | /* empty path: current directory */ | |
6521 | if (getcwd (tmp, LT_PATHMAX) == NULL) | |
6522 | lt_fatal ("getcwd failed"); | |
6523 | tmp_len = strlen(tmp); | |
6524 | concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); | |
6525 | memcpy (concat_name, tmp, tmp_len); | |
6526 | concat_name[tmp_len] = '/'; | |
6527 | strcpy (concat_name + tmp_len + 1, wrapper); | |
6528 | } | |
6529 | else | |
6530 | { | |
6531 | concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); | |
6532 | memcpy (concat_name, p, p_len); | |
6533 | concat_name[p_len] = '/'; | |
6534 | strcpy (concat_name + p_len + 1, wrapper); | |
6535 | } | |
6536 | if (check_executable(concat_name)) | |
6537 | return concat_name; | |
6538 | XFREE(concat_name); | |
6539 | } | |
6540 | } | |
6541 | /* not found in PATH; assume curdir */ | |
6542 | } | |
6543 | /* Relative path | not found in path: prepend cwd */ | |
6544 | if (getcwd (tmp, LT_PATHMAX) == NULL) | |
6545 | lt_fatal ("getcwd failed"); | |
6546 | tmp_len = strlen(tmp); | |
6547 | concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); | |
6548 | memcpy (concat_name, tmp, tmp_len); | |
6549 | concat_name[tmp_len] = '/'; | |
6550 | strcpy (concat_name + tmp_len + 1, wrapper); | |
6551 | ||
6552 | if (check_executable(concat_name)) | |
6553 | return concat_name; | |
6554 | XFREE(concat_name); | |
6555 | return NULL; | |
6556 | } | |
6557 | ||
6558 | char * | |
6559 | strendzap(char *str, const char *pat) | |
6560 | { | |
6561 | size_t len, patlen; | |
6562 | ||
6563 | assert(str != NULL); | |
6564 | assert(pat != NULL); | |
6565 | ||
6566 | len = strlen(str); | |
6567 | patlen = strlen(pat); | |
6568 | ||
6569 | if (patlen <= len) | |
6570 | { | |
6571 | str += len - patlen; | |
6572 | if (strcmp(str, pat) == 0) | |
6573 | *str = '\0'; | |
6574 | } | |
6575 | return str; | |
6576 | } | |
6577 | ||
6578 | static void | |
6579 | lt_error_core (int exit_status, const char * mode, | |
6580 | const char * message, va_list ap) | |
6581 | { | |
6582 | fprintf (stderr, "%s: %s: ", program_name, mode); | |
6583 | vfprintf (stderr, message, ap); | |
6584 | fprintf (stderr, ".\n"); | |
6585 | ||
6586 | if (exit_status >= 0) | |
6587 | exit (exit_status); | |
6588 | } | |
6589 | ||
6590 | void | |
6591 | lt_fatal (const char *message, ...) | |
6592 | { | |
6593 | va_list ap; | |
6594 | va_start (ap, message); | |
6595 | lt_error_core (EXIT_FAILURE, "FATAL", message, ap); | |
6596 | va_end (ap); | |
6597 | } | |
6598 | EOF | |
6599 | # we should really use a build-platform specific compiler | |
6600 | # here, but OTOH, the wrappers (shell script and this C one) | |
6601 | # are only useful if you want to execute the "real" binary. | |
6602 | # Since the "real" binary is built for $host, then this | |
6603 | # wrapper might as well be built for $host, too. | |
6604 | $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource | |
6605 | ;; | |
6606 | esac | |
6607 | $RM $output | |
6608 | trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 | |
6609 | ||
6610 | $ECHO > $output "\ | |
6611 | #! $SHELL | |
6612 | ||
6613 | # $output - temporary wrapper script for $objdir/$outputname | |
6614 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | |
6615 | # | |
6616 | # The $output program cannot be directly executed until all the libtool | |
6617 | # libraries that it depends on are installed. | |
6618 | # | |
6619 | # This wrapper script should never be moved out of the build directory. | |
6620 | # If it is, it will not operate correctly. | |
6621 | ||
6622 | # Sed substitution that helps us do robust quoting. It backslashifies | |
6623 | # metacharacters that are still active within double-quoted strings. | |
6624 | Xsed='${SED} -e 1s/^X//' | |
6625 | sed_quote_subst='$sed_quote_subst' | |
6626 | ||
6627 | # The HP-UX ksh and POSIX shell print the target directory to stdout | |
6628 | # if CDPATH is set. | |
6629 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH | |
6630 | ||
6631 | relink_command=\"$relink_command\" | |
6632 | ||
6633 | # This environment variable determines our operation mode. | |
6634 | if test \"\$libtool_install_magic\" = \"$magic\"; then | |
6635 | # install mode needs the following variables: | |
6636 | generated_by_libtool_version='$macro_version' | |
6637 | notinst_deplibs='$notinst_deplibs' | |
6638 | else | |
6639 | # When we are sourced in execute mode, \$file and \$ECHO are already set. | |
6640 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | |
6641 | ECHO=\"$qecho\" | |
6642 | file=\"\$0\" | |
6643 | # Make sure echo works. | |
6644 | if test \"X\$1\" = X--no-reexec; then | |
6645 | # Discard the --no-reexec flag, and continue. | |
6646 | shift | |
6647 | elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then | |
6648 | # Yippee, \$ECHO works! | |
6649 | : | |
6650 | else | |
6651 | # Restart under the correct shell, and then maybe \$ECHO will work. | |
6652 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} | |
6653 | fi | |
6654 | fi\ | |
6655 | " | |
6656 | $ECHO >> $output "\ | |
6657 | ||
6658 | # Find the directory that this script lives in. | |
6659 | thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` | |
6660 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. | |
6661 | ||
6662 | # Follow symbolic links until we get to the real thisdir. | |
6663 | file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` | |
6664 | while test -n \"\$file\"; do | |
6665 | destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` | |
6666 | ||
6667 | # If there was a directory component, then change thisdir. | |
6668 | if test \"x\$destdir\" != \"x\$file\"; then | |
6669 | case \"\$destdir\" in | |
6670 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; | |
6671 | *) thisdir=\"\$thisdir/\$destdir\" ;; | |
6672 | esac | |
6673 | fi | |
6674 | ||
6675 | file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` | |
6676 | file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` | |
6677 | done | |
6678 | ||
6679 | # Try to get the absolute directory name. | |
6680 | absdir=\`cd \"\$thisdir\" && pwd\` | |
6681 | test -n \"\$absdir\" && thisdir=\"\$absdir\" | |
6682 | " | |
6683 | ||
6684 | if test "$fast_install" = yes; then | |
6685 | $ECHO >> $output "\ | |
6686 | program=lt-'$outputname'$exeext | |
6687 | progdir=\"\$thisdir/$objdir\" | |
6688 | ||
6689 | if test ! -f \"\$progdir/\$program\" || | |
6690 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ | |
6691 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then | |
6692 | ||
6693 | file=\"\$\$-\$program\" | |
6694 | ||
6695 | if test ! -d \"\$progdir\"; then | |
6696 | $MKDIR \"\$progdir\" | |
6697 | else | |
6698 | $RM \"\$progdir/\$file\" | |
6699 | fi" | |
6700 | ||
6701 | $ECHO >> $output "\ | |
6702 | ||
6703 | # relink executable if necessary | |
6704 | if test -n \"\$relink_command\"; then | |
6705 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : | |
6706 | else | |
6707 | $ECHO \"\$relink_command_output\" >&2 | |
6708 | $RM \"\$progdir/\$file\" | |
6709 | exit 1 | |
6710 | fi | |
6711 | fi | |
6712 | ||
6713 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || | |
6714 | { $RM \"\$progdir/\$program\"; | |
6715 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } | |
6716 | $RM \"\$progdir/\$file\" | |
6717 | fi" | |
6718 | else | |
6719 | $ECHO >> $output "\ | |
6720 | program='$outputname' | |
6721 | progdir=\"\$thisdir/$objdir\" | |
6722 | " | |
6723 | fi | |
6724 | ||
6725 | $ECHO >> $output "\ | |
6726 | ||
6727 | if test -f \"\$progdir/\$program\"; then" | |
6728 | ||
6729 | # Export our shlibpath_var if we have one. | |
6730 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then | |
6731 | $ECHO >> $output "\ | |
6732 | # Add our own library path to $shlibpath_var | |
6733 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" | |
6734 | ||
6735 | # Some systems cannot cope with colon-terminated $shlibpath_var | |
6736 | # The second colon is a workaround for a bug in BeOS R4 sed | |
6737 | $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` | |
6738 | ||
6739 | export $shlibpath_var | |
6740 | " | |
6741 | fi | |
6742 | ||
6743 | # fixup the dll searchpath if we need to. | |
6744 | if test -n "$dllsearchpath"; then | |
6745 | $ECHO >> $output "\ | |
6746 | # Add the dll search path components to the executable PATH | |
6747 | PATH=$dllsearchpath:\$PATH | |
6748 | " | |
6749 | fi | |
6750 | ||
6751 | $ECHO >> $output "\ | |
6752 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | |
6753 | # Run the actual program with our arguments. | |
6754 | " | |
6755 | case $host in | |
6756 | # Backslashes separate directories on plain windows | |
6757 | *-*-mingw | *-*-os2*) | |
6758 | $ECHO >> $output "\ | |
6759 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} | |
6760 | " | |
6761 | ;; | |
6762 | ||
6763 | *) | |
6764 | $ECHO >> $output "\ | |
6765 | exec \"\$progdir/\$program\" \${1+\"\$@\"} | |
6766 | " | |
6767 | ;; | |
6768 | esac | |
6769 | $ECHO >> $output "\ | |
6770 | \$ECHO \"\$0: cannot exec \$program \${1+\"\$@\"}\" | |
6771 | exit 1 | |
6772 | fi | |
6773 | else | |
6774 | # The program doesn't exist. | |
6775 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 | |
6776 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 | |
6777 | $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 | |
6778 | exit 1 | |
6779 | fi | |
6780 | fi\ | |
6781 | " | |
6782 | chmod +x $output | |
6783 | } | |
6784 | exit $EXIT_SUCCESS | |
6785 | ;; | |
6786 | esac | |
6787 | ||
6788 | # See if we need to build an old-fashioned archive. | |
6789 | for oldlib in $oldlibs; do | |
6790 | ||
6791 | if test "$build_libtool_libs" = convenience; then | |
6792 | oldobjs="$libobjs_save $symfileobj" | |
6793 | addlibs="$convenience" | |
6794 | build_libtool_libs=no | |
6795 | else | |
6796 | if test "$build_libtool_libs" = module; then | |
6797 | oldobjs="$libobjs_save" | |
6798 | build_libtool_libs=no | |
6799 | else | |
6800 | oldobjs="$old_deplibs $non_pic_objects" | |
6801 | if test "$preload" = yes && test -f "$symfileobj"; then | |
6802 | oldobjs="$oldobjs $symfileobj" | |
6803 | fi | |
6804 | fi | |
6805 | addlibs="$old_convenience" | |
6806 | fi | |
6807 | ||
6808 | if test -n "$addlibs"; then | |
6809 | gentop="$output_objdir/${outputname}x" | |
6810 | generated="$generated $gentop" | |
6811 | ||
6812 | func_extract_archives $gentop $addlibs | |
6813 | oldobjs="$oldobjs $func_extract_archives_result" | |
6814 | fi | |
6815 | ||
6816 | # Do each command in the archive commands. | |
6817 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then | |
6818 | cmds=$old_archive_from_new_cmds | |
6819 | else | |
6820 | ||
6821 | # Add any objects from preloaded convenience libraries | |
6822 | if test -n "$dlprefiles"; then | |
6823 | gentop="$output_objdir/${outputname}x" | |
6824 | generated="$generated $gentop" | |
6825 | ||
6826 | func_extract_archives $gentop $dlprefiles | |
6827 | oldobjs="$oldobjs $func_extract_archives_result" | |
6828 | fi | |
6829 | ||
6830 | # POSIX demands no paths to be encoded in archives. We have | |
6831 | # to avoid creating archives with duplicate basenames if we | |
6832 | # might have to extract them afterwards, e.g., when creating a | |
6833 | # static archive out of a convenience library, or when linking | |
6834 | # the entirety of a libtool archive into another (currently | |
6835 | # not supported by libtool). | |
6836 | if (for obj in $oldobjs | |
6837 | do | |
6838 | func_basename "$obj" | |
6839 | $ECHO "$func_basename_result" | |
6840 | done | sort | sort -uc >/dev/null 2>&1); then | |
6841 | : | |
6842 | else | |
6843 | $ECHO "copying selected object files to avoid basename conflicts..." | |
6844 | gentop="$output_objdir/${outputname}x" | |
6845 | generated="$generated $gentop" | |
6846 | func_mkdir_p "$gentop" | |
6847 | save_oldobjs=$oldobjs | |
6848 | oldobjs= | |
6849 | counter=1 | |
6850 | for obj in $save_oldobjs | |
6851 | do | |
6852 | func_basename "$obj" | |
6853 | objbase="$func_basename_result" | |
6854 | case " $oldobjs " in | |
6855 | " ") oldobjs=$obj ;; | |
6856 | *[\ /]"$objbase "*) | |
6857 | while :; do | |
6858 | # Make sure we don't pick an alternate name that also | |
6859 | # overlaps. | |
6860 | newobj=lt$counter-$objbase | |
6861 | counter=`expr $counter + 1` | |
6862 | case " $oldobjs " in | |
6863 | *[\ /]"$newobj "*) ;; | |
6864 | *) if test ! -f "$gentop/$newobj"; then break; fi ;; | |
6865 | esac | |
6866 | done | |
6867 | func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" | |
6868 | oldobjs="$oldobjs $gentop/$newobj" | |
6869 | ;; | |
6870 | *) oldobjs="$oldobjs $obj" ;; | |
6871 | esac | |
6872 | done | |
6873 | fi | |
6874 | eval cmds=\"$old_archive_cmds\" | |
6875 | ||
6876 | if len=`expr "X$cmds" : ".*" 2>/dev/null` && | |
6877 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then | |
6878 | cmds=$old_archive_cmds | |
6879 | else | |
6880 | # the command line is too long to link in one step, link in parts | |
6881 | func_echo "using piecewise archive linking..." | |
6882 | save_RANLIB=$RANLIB | |
6883 | RANLIB=: | |
6884 | objlist= | |
6885 | concat_cmds= | |
6886 | save_oldobjs=$oldobjs | |
6887 | # Is there a better way of finding the last object in the list? | |
6888 | for obj in $save_oldobjs | |
6889 | do | |
6890 | last_oldobj=$obj | |
6891 | done | |
6892 | for obj in $save_oldobjs | |
6893 | do | |
6894 | oldobjs="$objlist $obj" | |
6895 | objlist="$objlist $obj" | |
6896 | eval test_cmds=\"$old_archive_cmds\" | |
6897 | if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && | |
6898 | test "$len" -le "$max_cmd_len"; then | |
6899 | : | |
6900 | else | |
6901 | # the above command should be used before it gets too long | |
6902 | oldobjs=$objlist | |
6903 | if test "$obj" = "$last_oldobj" ; then | |
6904 | RANLIB=$save_RANLIB | |
6905 | fi | |
6906 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ | |
6907 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" | |
6908 | objlist= | |
6909 | fi | |
6910 | done | |
6911 | RANLIB=$save_RANLIB | |
6912 | oldobjs=$objlist | |
6913 | if test "X$oldobjs" = "X" ; then | |
6914 | eval cmds=\"\$concat_cmds\" | |
6915 | else | |
6916 | eval cmds=\"\$concat_cmds~\$old_archive_cmds\" | |
6917 | fi | |
6918 | fi | |
6919 | fi | |
6920 | func_execute_cmds "$cmds" 'exit $?' | |
6921 | done | |
6922 | ||
6923 | test -n "$generated" && \ | |
6924 | func_show_eval "${RM}r$generated" | |
6925 | ||
6926 | # Now create the libtool archive. | |
6927 | case $output in | |
6928 | *.la) | |
6929 | old_library= | |
6930 | test "$build_old_libs" = yes && old_library="$libname.$libext" | |
6931 | func_echo "creating $output" | |
6932 | ||
6933 | # Preserve any variables that may affect compiler behavior | |
6934 | for var in $variables_saved_for_relink; do | |
6935 | if eval test -z \"\${$var+set}\"; then | |
6936 | relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" | |
6937 | elif eval var_value=\$$var; test -z "$var_value"; then | |
6938 | relink_command="$var=; export $var; $relink_command" | |
6939 | else | |
6940 | func_quote_for_eval "$var_value" | |
6941 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" | |
6942 | fi | |
6943 | done | |
6944 | # Quote the link command for shipping. | |
6945 | relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" | |
6946 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` | |
6947 | if test "$hardcode_automatic" = yes ; then | |
6948 | relink_command= | |
6949 | fi | |
6950 | ||
6951 | # Only create the output if not a dry run. | |
6952 | $opt_dry_run || { | |
6953 | for installed in no yes; do | |
6954 | if test "$installed" = yes; then | |
6955 | if test -z "$install_libdir"; then | |
6956 | break | |
6957 | fi | |
6958 | output="$output_objdir/$outputname"i | |
6959 | # Replace all uninstalled libtool libraries with the installed ones | |
6960 | newdependency_libs= | |
6961 | for deplib in $dependency_libs; do | |
6962 | case $deplib in | |
6963 | *.la) | |
6964 | func_basename "$deplib" | |
6965 | name="$func_basename_result" | |
6966 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` | |
6967 | test -z "$libdir" && \ | |
6968 | func_fatal_error "\`$deplib' is not a valid libtool archive" | |
6969 | newdependency_libs="$newdependency_libs $libdir/$name" | |
6970 | ;; | |
6971 | *) newdependency_libs="$newdependency_libs $deplib" ;; | |
6972 | esac | |
6973 | done | |
6974 | dependency_libs="$newdependency_libs" | |
6975 | newdlfiles= | |
6976 | ||
6977 | for lib in $dlfiles; do | |
6978 | case $lib in | |
6979 | *.la) | |
6980 | func_basename "$lib" | |
6981 | name="$func_basename_result" | |
6982 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` | |
6983 | test -z "$libdir" && \ | |
6984 | func_fatal_error "\`$lib' is not a valid libtool archive" | |
6985 | newdlfiles="$newdlfiles $libdir/$name" | |
6986 | ;; | |
6987 | *) newdlfiles="$newdlfiles $lib" ;; | |
6988 | esac | |
6989 | done | |
6990 | dlfiles="$newdlfiles" | |
6991 | newdlprefiles= | |
6992 | for lib in $dlprefiles; do | |
6993 | case $lib in | |
6994 | *.la) | |
6995 | # Only pass preopened files to the pseudo-archive (for | |
6996 | # eventual linking with the app. that links it) if we | |
6997 | # didn't already link the preopened objects directly into | |
6998 | # the library: | |
6999 | func_basename "$lib" | |
7000 | name="$func_basename_result" | |
7001 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` | |
7002 | test -z "$libdir" && \ | |
7003 | func_fatal_error "\`$lib' is not a valid libtool archive" | |
7004 | newdlprefiles="$newdlprefiles $libdir/$name" | |
7005 | ;; | |
7006 | esac | |
7007 | done | |
7008 | dlprefiles="$newdlprefiles" | |
7009 | else | |
7010 | newdlfiles= | |
7011 | for lib in $dlfiles; do | |
7012 | case $lib in | |
7013 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; | |
7014 | *) abs=`pwd`"/$lib" ;; | |
7015 | esac | |
7016 | newdlfiles="$newdlfiles $abs" | |
7017 | done | |
7018 | dlfiles="$newdlfiles" | |
7019 | newdlprefiles= | |
7020 | for lib in $dlprefiles; do | |
7021 | case $lib in | |
7022 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; | |
7023 | *) abs=`pwd`"/$lib" ;; | |
7024 | esac | |
7025 | newdlprefiles="$newdlprefiles $abs" | |
7026 | done | |
7027 | dlprefiles="$newdlprefiles" | |
7028 | fi | |
7029 | $RM $output | |
7030 | # place dlname in correct position for cygwin | |
7031 | tdlname=$dlname | |
7032 | case $host,$output,$installed,$module,$dlname in | |
7033 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; | |
7034 | esac | |
7035 | $ECHO > $output "\ | |
7036 | # $outputname - a libtool library file | |
7037 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | |
7038 | # | |
7039 | # Please DO NOT delete this file! | |
7040 | # It is necessary for linking the library. | |
7041 | ||
7042 | # The name that we can dlopen(3). | |
7043 | dlname='$tdlname' | |
7044 | ||
7045 | # Names of this library. | |
7046 | library_names='$library_names' | |
7047 | ||
7048 | # The name of the static archive. | |
7049 | old_library='$old_library' | |
7050 | ||
7051 | # Linker flags that can not go in dependency_libs. | |
7052 | inherited_linker_flags='$new_inherited_linker_flags' | |
7053 | ||
7054 | # Libraries that this one depends upon. | |
7055 | dependency_libs='$dependency_libs' | |
7056 | ||
7057 | # Names of additional weak libraries provided by this library | |
7058 | weak_library_names='$weak_libs' | |
7059 | ||
7060 | # Version information for $libname. | |
7061 | current=$current | |
7062 | age=$age | |
7063 | revision=$revision | |
7064 | ||
7065 | # Is this an already installed library? | |
7066 | installed=$installed | |
7067 | ||
7068 | # Should we warn about portability when linking against -modules? | |
7069 | shouldnotlink=$module | |
7070 | ||
7071 | # Files to dlopen/dlpreopen | |
7072 | dlopen='$dlfiles' | |
7073 | dlpreopen='$dlprefiles' | |
7074 | ||
7075 | # Directory that this library needs to be installed in: | |
7076 | libdir='$install_libdir'" | |
7077 | if test "$installed" = no && test "$need_relink" = yes; then | |
7078 | $ECHO >> $output "\ | |
7079 | relink_command=\"$relink_command\"" | |
7080 | fi | |
7081 | done | |
7082 | } | |
7083 | ||
7084 | # Do a symbolic link so that the libtool archive can be found in | |
7085 | # LD_LIBRARY_PATH before the program is installed. | |
7086 | func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' | |
7087 | ;; | |
7088 | esac | |
7089 | exit $EXIT_SUCCESS | |
7090 | } | |
7091 | ||
7092 | ||
7093 | # func_mode_uninstall arg... | |
7094 | func_mode_uninstall () | |
7095 | { | |
7096 | $opt_debug | |
7097 | RM="$nonopt" | |
7098 | files= | |
7099 | rmforce= | |
7100 | exit_status=0 | |
7101 | ||
7102 | # This variable tells wrapper scripts just to set variables rather | |
7103 | # than running their programs. | |
7104 | libtool_install_magic="$magic" | |
7105 | ||
7106 | for arg | |
7107 | do | |
7108 | case $arg in | |
7109 | -f) RM="$RM $arg"; rmforce=yes ;; | |
7110 | -*) RM="$RM $arg" ;; | |
7111 | *) files="$files $arg" ;; | |
7112 | esac | |
7113 | done | |
7114 | ||
7115 | test -z "$RM" && \ | |
7116 | func_fatal_help "you must specify an RM program" | |
7117 | ||
7118 | rmdirs= | |
7119 | ||
7120 | origobjdir="$objdir" | |
7121 | for file in $files; do | |
7122 | func_dirname "$file" "" "." | |
7123 | dir="$func_dirname_result" | |
7124 | if test "X$dir" = X.; then | |
7125 | objdir="$origobjdir" | |
7126 | else | |
7127 | objdir="$dir/$origobjdir" | |
7128 | fi | |
7129 | func_basename "$file" | |
7130 | name="$func_basename_result" | |
7131 | test "$mode" = uninstall && objdir="$dir" | |
7132 | ||
7133 | # Remember objdir for removal later, being careful to avoid duplicates | |
7134 | if test "$mode" = clean; then | |
7135 | case " $rmdirs " in | |
7136 | *" $objdir "*) ;; | |
7137 | *) rmdirs="$rmdirs $objdir" ;; | |
7138 | esac | |
7139 | fi | |
7140 | ||
7141 | # Don't error if the file doesn't exist and rm -f was used. | |
7142 | if { test -L "$file"; } >/dev/null 2>&1 || | |
7143 | { test -h "$file"; } >/dev/null 2>&1 || | |
7144 | test -f "$file"; then | |
7145 | : | |
7146 | elif test -d "$file"; then | |
7147 | exit_status=1 | |
7148 | continue | |
7149 | elif test "$rmforce" = yes; then | |
7150 | continue | |
7151 | fi | |
7152 | ||
7153 | rmfiles="$file" | |
7154 | ||
7155 | case $name in | |
7156 | *.la) | |
7157 | # Possibly a libtool archive, so verify it. | |
7158 | if func_lalib_p "$file"; then | |
7159 | . $dir/$name | |
7160 | ||
7161 | # Delete the libtool libraries and symlinks. | |
7162 | for n in $library_names; do | |
7163 | rmfiles="$rmfiles $objdir/$n" | |
7164 | done | |
7165 | test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" | |
7166 | ||
7167 | case "$mode" in | |
7168 | clean) | |
7169 | case " $library_names " in | |
7170 | # " " in the beginning catches empty $dlname | |
7171 | *" $dlname "*) ;; | |
7172 | *) rmfiles="$rmfiles $objdir/$dlname" ;; | |
7173 | esac | |
7174 | test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" | |
7175 | ;; | |
7176 | uninstall) | |
7177 | if test -n "$library_names"; then | |
7178 | # Do each command in the postuninstall commands. | |
7179 | func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' | |
7180 | fi | |
7181 | ||
7182 | if test -n "$old_library"; then | |
7183 | # Do each command in the old_postuninstall commands. | |
7184 | func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' | |
7185 | fi | |
7186 | # FIXME: should reinstall the best remaining shared library. | |
7187 | ;; | |
7188 | esac | |
7189 | fi | |
7190 | ;; | |
7191 | ||
7192 | *.lo) | |
7193 | # Possibly a libtool object, so verify it. | |
7194 | if func_lalib_p "$file"; then | |
7195 | ||
7196 | # Read the .lo file | |
7197 | . $dir/$name | |
7198 | ||
7199 | # Add PIC object to the list of files to remove. | |
7200 | if test -n "$pic_object" && | |
7201 | test "$pic_object" != none; then | |
7202 | rmfiles="$rmfiles $dir/$pic_object" | |
7203 | fi | |
7204 | ||
7205 | # Add non-PIC object to the list of files to remove. | |
7206 | if test -n "$non_pic_object" && | |
7207 | test "$non_pic_object" != none; then | |
7208 | rmfiles="$rmfiles $dir/$non_pic_object" | |
7209 | fi | |
7210 | fi | |
7211 | ;; | |
7212 | ||
7213 | *) | |
7214 | if test "$mode" = clean ; then | |
7215 | noexename=$name | |
7216 | case $file in | |
7217 | *.exe) | |
7218 | func_stripname '' '.exe' "$file" | |
7219 | file=$func_stripname_result | |
7220 | func_stripname '' '.exe' "$name" | |
7221 | noexename=$func_stripname_result | |
7222 | # $file with .exe has already been added to rmfiles, | |
7223 | # add $file without .exe | |
7224 | rmfiles="$rmfiles $file" | |
7225 | ;; | |
7226 | esac | |
7227 | # Do a test to see if this is a libtool program. | |
7228 | if func_ltwrapper_p "$file"; then | |
7229 | relink_command= | |
7230 | . $dir/$noexename | |
7231 | ||
7232 | # note $name still contains .exe if it was in $file originally | |
7233 | # as does the version of $file that was added into $rmfiles | |
7234 | rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" | |
7235 | if test "$fast_install" = yes && test -n "$relink_command"; then | |
7236 | rmfiles="$rmfiles $objdir/lt-$name" | |
7237 | fi | |
7238 | if test "X$noexename" != "X$name" ; then | |
7239 | rmfiles="$rmfiles $objdir/lt-${noexename}.c" | |
7240 | fi | |
7241 | fi | |
7242 | fi | |
7243 | ;; | |
7244 | esac | |
7245 | func_show_eval "$RM $rmfiles" 'exit_status=1' | |
7246 | done | |
7247 | objdir="$origobjdir" | |
7248 | ||
7249 | # Try to remove the ${objdir}s in the directories where we deleted files | |
7250 | for dir in $rmdirs; do | |
7251 | if test -d "$dir"; then | |
7252 | func_show_eval "rmdir $dir >/dev/null 2>&1" | |
7253 | fi | |
7254 | done | |
7255 | ||
7256 | exit $exit_status | |
7257 | } | |
7258 | ||
7259 | ||
7260 | # TEST SUITE MARKER ## NON-FUNCTION | |
7261 | ## ----------- ## | |
7262 | ## Main. ## | |
7263 | ## ----------- ## | |
7264 | ||
7265 | { | |
7266 | # Sanity checks first: | |
7267 | func_check_version_match | |
7268 | ||
7269 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then | |
7270 | func_fatal_configuration "not configured to build any kind of library" | |
7271 | fi | |
7272 | ||
7273 | test -z "$mode" && func_fatal_error "error: you must specify a MODE." | |
7274 | ||
7275 | ||
7276 | # Darwin sucks | |
7277 | eval std_shrext=\"$shrext_cmds\" | |
7278 | ||
7279 | ||
7280 | # Only execute mode is allowed to have -dlopen flags. | |
7281 | if test -n "$execute_dlfiles" && test "$mode" != execute; then | |
7282 | func_error "unrecognized option \`-dlopen'" | |
7283 | $ECHO "$help" 1>&2 | |
7284 | exit $EXIT_FAILURE | |
7285 | fi | |
7286 | ||
7287 | # Change the help message to a mode-specific one. | |
7288 | generic_help="$help" | |
7289 | help="Try \`$progname --help --mode=$mode' for more information." | |
7290 | ||
7291 | case $mode in | |
7292 | compile) func_mode_compile ${1+"$@"} ;; | |
7293 | execute) func_mode_execute ${1+"$@"} ;; | |
7294 | finish) func_mode_finish ${1+"$@"} ;; | |
7295 | install) func_mode_install ${1+"$@"} ;; | |
7296 | link|relink) func_mode_link ${1+"$@"} ;; | |
7297 | uninstall|clean) func_mode_uninstall ${1+"$@"} ;; | |
7298 | ||
7299 | "") help="$generic_help" | |
7300 | func_fatal_help "you must specify a MODE" | |
7301 | ;; | |
7302 | esac | |
7303 | ||
7304 | test -z "$exec_cmd" && \ | |
7305 | func_fatal_help "invalid operation mode \`$mode'" | |
7306 | ||
7307 | if test -n "$exec_cmd"; then | |
7308 | eval exec "$exec_cmd" | |
7309 | exit $EXIT_FAILURE | |
7310 | fi | |
7311 | } | |
7312 | ||
7313 | exit $exit_status | |
7314 | ||
7315 | ||
7316 | # The TAGs below are defined such that we never get into a situation | |
7317 | # in which we disable both kinds of libraries. Given conflicting | |
7318 | # choices, we go for a static library, that is the most portable, | |
7319 | # since we can't tell whether shared libraries were disabled because | |
7320 | # the user asked for that or because the platform doesn't support | |
7321 | # them. This is particularly important on AIX, because we don't | |
7322 | # support having both static and shared libraries enabled at the same | |
7323 | # time on that platform, so we default to a shared-only configuration. | |
7324 | # If a disable-shared tag is given, we'll fallback to a static-only | |
7325 | # configuration. But we'll never go from static-only to shared-only. | |
7326 | ||
7327 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared | |
7328 | build_libtool_libs=no | |
7329 | build_old_libs=yes | |
7330 | # ### END LIBTOOL TAG CONFIG: disable-shared | |
7331 | ||
7332 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static | |
7333 | build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` | |
7334 | # ### END LIBTOOL TAG CONFIG: disable-static | |
7335 | ||
7336 | # Local Variables: | |
7337 | # mode:shell-script | |
7338 | # sh-indentation:2 | |
7339 | # End: |