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