Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4758 | right-hear | 1 | # Generated from ltmain.m4sh. |
2 | |||
3 | # libtool (GNU libtool) 2.2.8 |
||
4 | # Written by Gordon Matzigkeit |
||
5 | |||
6 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, |
||
7 | # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
||
8 | # This is free software; see the source for copying conditions. There is NO |
||
9 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
10 | |||
11 | # GNU Libtool is free software; you can redistribute it and/or modify |
||
12 | # it under the terms of the GNU General Public License as published by |
||
13 | # the Free Software Foundation; either version 2 of the License, or |
||
14 | # (at your option) any later version. |
||
15 | # |
||
16 | # As a special exception to the GNU General Public License, |
||
17 | # if you distribute this file as part of a program or library that |
||
18 | # is built using GNU Libtool, you may include this file under the |
||
19 | # same distribution terms that you use for the rest of that program. |
||
20 | # |
||
21 | # GNU Libtool is distributed in the hope that it will be useful, but |
||
22 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
||
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||
24 | # General Public License for more details. |
||
25 | # |
||
26 | # You should have received a copy of the GNU General Public License |
||
27 | # along with GNU Libtool; see the file COPYING. If not, a copy |
||
28 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, |
||
29 | # or obtained by writing to the Free Software Foundation, Inc., |
||
30 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||
31 | |||
32 | # Usage: $progname [OPTION]... [MODE-ARG]... |
||
33 | # |
||
34 | # Provide generalized library-building support services. |
||
35 | # |
||
36 | # --config show all configuration variables |
||
37 | # --debug enable verbose shell tracing |
||
38 | # -n, --dry-run display commands without modifying any files |
||
39 | # --features display basic configuration information and exit |
||
40 | # --mode=MODE use operation mode MODE |
||
41 | # --preserve-dup-deps don't remove duplicate dependency libraries |
||
42 | # --quiet, --silent don't print informational messages |
||
43 | # --no-quiet, --no-silent |
||
44 | # print informational messages (default) |
||
45 | # --tag=TAG use configuration variables from tag TAG |
||
46 | # -v, --verbose print more informational messages than default |
||
47 | # --no-verbose don't print the extra informational messages |
||
48 | # --version print version information |
||
49 | # -h, --help, --help-all print short, long, or detailed help message |
||
50 | # |
||
51 | # MODE must be one of the following: |
||
52 | # |
||
53 | # clean remove files from the build directory |
||
54 | # compile compile a source file into a libtool object |
||
55 | # execute automatically set library path, then run a program |
||
56 | # finish complete the installation of libtool libraries |
||
57 | # install install libraries or executables |
||
58 | # link create a library or an executable |
||
59 | # uninstall remove libraries from an installed directory |
||
60 | # |
||
61 | # MODE-ARGS vary depending on the MODE. When passed as first option, |
||
62 | # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. |
||
63 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE. |
||
64 | # |
||
65 | # When reporting a bug, please describe a test case to reproduce it and |
||
66 | # include the following information: |
||
67 | # |
||
68 | # host-triplet: $host |
||
69 | # shell: $SHELL |
||
70 | # compiler: $LTCC |
||
71 | # compiler flags: $LTCFLAGS |
||
72 | # linker: $LD (gnu? $with_gnu_ld) |
||
73 | # $progname: (GNU libtool) 2.2.8 |
||
74 | # automake: $automake_version |
||
75 | # autoconf: $autoconf_version |
||
76 | # |
||
77 | # Report bugs to |
||
78 | |||
79 | PROGRAM=libtool |
||
80 | PACKAGE=libtool |
||
81 | VERSION=2.2.8 |
||
82 | TIMESTAMP="" |
||
83 | package_revision=1.3169 |
||
84 | |||
85 | # Be Bourne compatible |
||
86 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
||
87 | emulate sh |
||
88 | NULLCMD=: |
||
89 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which |
||
90 | # is contrary to our usage. Disable this feature. |
||
91 | alias -g '${1+"$@"}'='"$@"' |
||
92 | setopt NO_GLOB_SUBST |
||
93 | else |
||
94 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac |
||
95 | fi |
||
96 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
||
97 | DUALCASE=1; export DUALCASE # for MKS sh |
||
98 | |||
99 | # A function that is used when there is no print builtin or printf. |
||
100 | func_fallback_echo () |
||
101 | { |
||
102 | eval 'cat <<_LTECHO_EOF |
||
103 | $1 |
||
104 | _LTECHO_EOF' |
||
105 | } |
||
106 | |||
107 | # NLS nuisances: We save the old values to restore during execute mode. |
||
108 | lt_user_locale= |
||
109 | lt_safe_locale= |
||
110 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
||
111 | do |
||
112 | eval "if test \"\${$lt_var+set}\" = set; then |
||
113 | save_$lt_var=\$$lt_var |
||
114 | $lt_var=C |
||
115 | export $lt_var |
||
116 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" |
||
117 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" |
||
118 | fi" |
||
119 | done |
||
120 | LC_ALL=C |
||
121 | LANGUAGE=C |
||
122 | export LANGUAGE LC_ALL |
||
123 | |||
124 | $lt_unset CDPATH |
||
125 | |||
126 | |||
127 | |||
128 | |||
129 | |||
130 | |||
131 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
||
132 | # is ksh but when the shell is invoked as "sh" and the current value of |
||
133 | # the _XPG environment variable is not equal to 1 (one), the special |
||
134 | # positional parameter $0, within a function call, is the name of the |
||
135 | # function. |
||
136 | progpath="$0" |
||
137 | |||
138 | |||
139 | |||
140 | : ${CP="cp -f"} |
||
141 | test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} |
||
142 | : ${EGREP="grep -E"} |
||
143 | : ${FGREP="grep -F"} |
||
144 | : ${GREP="grep"} |
||
145 | : ${LN_S="ln -s"} |
||
146 | : ${MAKE="make"} |
||
147 | : ${MKDIR="mkdir"} |
||
148 | : ${MV="mv -f"} |
||
149 | : ${RM="rm -f"} |
||
150 | : ${SED="sed"} |
||
151 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
||
152 | : ${Xsed="$SED -e 1s/^X//"} |
||
153 | |||
154 | # Global variables: |
||
155 | EXIT_SUCCESS=0 |
||
156 | EXIT_FAILURE=1 |
||
157 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. |
||
158 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. |
||
159 | |||
160 | exit_status=$EXIT_SUCCESS |
||
161 | |||
162 | # Make sure IFS has a sensible default |
||
163 | lt_nl=' |
||
164 | ' |
||
165 | IFS=" $lt_nl" |
||
166 | |||
167 | dirname="s,/[^/]*$,," |
||
168 | basename="s,^.*/,," |
||
169 | |||
170 | # func_dirname_and_basename file append nondir_replacement |
||
171 | # perform func_basename and func_dirname in a single function |
||
172 | # call: |
||
173 | # dirname: Compute the dirname of FILE. If nonempty, |
||
174 | # add APPEND to the result, otherwise set result |
||
175 | # to NONDIR_REPLACEMENT. |
||
176 | # value returned in "$func_dirname_result" |
||
177 | # basename: Compute filename of FILE. |
||
178 | # value retuned in "$func_basename_result" |
||
179 | # Implementation must be kept synchronized with func_dirname |
||
180 | # and func_basename. For efficiency, we do not delegate to |
||
181 | # those functions but instead duplicate the functionality here. |
||
182 | func_dirname_and_basename () |
||
183 | { |
||
184 | # Extract subdirectory from the argument. |
||
185 | func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` |
||
186 | if test "X$func_dirname_result" = "X${1}"; then |
||
187 | func_dirname_result="${3}" |
||
188 | else |
||
189 | func_dirname_result="$func_dirname_result${2}" |
||
190 | fi |
||
191 | func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` |
||
192 | } |
||
193 | |||
194 | # Generated shell functions inserted here. |
||
195 | |||
196 | # These SED scripts presuppose an absolute path with a trailing slash. |
||
197 | pathcar='s,^/\([^/]*\).*$,\1,' |
||
198 | pathcdr='s,^/[^/]*,,' |
||
199 | removedotparts=':dotsl |
||
200 | s@/\./@/@g |
||
201 | t dotsl |
||
202 | s,/\.$,/,' |
||
203 | collapseslashes='s@/\{1,\}@/@g' |
||
204 | finalslash='s,/*$,/,' |
||
205 | |||
206 | # func_normal_abspath PATH |
||
207 | # Remove doubled-up and trailing slashes, "." path components, |
||
208 | # and cancel out any ".." path components in PATH after making |
||
209 | # it an absolute path. |
||
210 | # value returned in "$func_normal_abspath_result" |
||
211 | func_normal_abspath () |
||
212 | { |
||
213 | # Start from root dir and reassemble the path. |
||
214 | func_normal_abspath_result= |
||
215 | func_normal_abspath_tpath=$1 |
||
216 | func_normal_abspath_altnamespace= |
||
217 | case $func_normal_abspath_tpath in |
||
218 | "") |
||
219 | # Empty path, that just means $cwd. |
||
220 | func_stripname '' '/' "`pwd`" |
||
221 | func_normal_abspath_result=$func_stripname_result |
||
222 | return |
||
223 | ;; |
||
224 | # The next three entries are used to spot a run of precisely |
||
225 | # two leading slashes without using negated character classes; |
||
226 | # we take advantage of case's first-match behaviour. |
||
227 | ///*) |
||
228 | # Unusual form of absolute path, do nothing. |
||
229 | ;; |
||
230 | //*) |
||
231 | # Not necessarily an ordinary path; POSIX reserves leading '//' |
||
232 | # and for example Cygwin uses it to access remote file shares |
||
233 | # over CIFS/SMB, so we conserve a leading double slash if found. |
||
234 | func_normal_abspath_altnamespace=/ |
||
235 | ;; |
||
236 | /*) |
||
237 | # Absolute path, do nothing. |
||
238 | ;; |
||
239 | *) |
||
240 | # Relative path, prepend $cwd. |
||
241 | func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath |
||
242 | ;; |
||
243 | esac |
||
244 | # Cancel out all the simple stuff to save iterations. We also want |
||
245 | # the path to end with a slash for ease of parsing, so make sure |
||
246 | # there is one (and only one) here. |
||
247 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
||
248 | -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` |
||
249 | while :; do |
||
250 | # Processed it all yet? |
||
251 | if test "$func_normal_abspath_tpath" = / ; then |
||
252 | # If we ascended to the root using ".." the result may be empty now. |
||
253 | if test -z "$func_normal_abspath_result" ; then |
||
254 | func_normal_abspath_result=/ |
||
255 | fi |
||
256 | break |
||
257 | fi |
||
258 | func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
||
259 | -e "$pathcar"` |
||
260 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ |
||
261 | -e "$pathcdr"` |
||
262 | # Figure out what to do with it |
||
263 | case $func_normal_abspath_tcomponent in |
||
264 | "") |
||
265 | # Trailing empty path component, ignore it. |
||
266 | ;; |
||
267 | ..) |
||
268 | # Parent dir; strip last assembled component from result. |
||
269 | func_dirname "$func_normal_abspath_result" |
||
270 | func_normal_abspath_result=$func_dirname_result |
||
271 | ;; |
||
272 | *) |
||
273 | # Actual path component, append it. |
||
274 | func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent |
||
275 | ;; |
||
276 | esac |
||
277 | done |
||
278 | # Restore leading double-slash if one was found on entry. |
||
279 | func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result |
||
280 | } |
||
281 | |||
282 | # func_relative_path SRCDIR DSTDIR |
||
283 | # generates a relative path from SRCDIR to DSTDIR, with a trailing |
||
284 | # slash if non-empty, suitable for immediately appending a filename |
||
285 | # without needing to append a separator. |
||
286 | # value returned in "$func_relative_path_result" |
||
287 | func_relative_path () |
||
288 | { |
||
289 | func_relative_path_result= |
||
290 | func_normal_abspath "$1" |
||
291 | func_relative_path_tlibdir=$func_normal_abspath_result |
||
292 | func_normal_abspath "$2" |
||
293 | func_relative_path_tbindir=$func_normal_abspath_result |
||
294 | |||
295 | # Ascend the tree starting from libdir |
||
296 | while :; do |
||
297 | # check if we have found a prefix of bindir |
||
298 | case $func_relative_path_tbindir in |
||
299 | $func_relative_path_tlibdir) |
||
300 | # found an exact match |
||
301 | func_relative_path_tcancelled= |
||
302 | break |
||
303 | ;; |
||
304 | $func_relative_path_tlibdir*) |
||
305 | # found a matching prefix |
||
306 | func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" |
||
307 | func_relative_path_tcancelled=$func_stripname_result |
||
308 | if test -z "$func_relative_path_result"; then |
||
309 | func_relative_path_result=. |
||
310 | fi |
||
311 | break |
||
312 | ;; |
||
313 | *) |
||
314 | func_dirname $func_relative_path_tlibdir |
||
315 | func_relative_path_tlibdir=${func_dirname_result} |
||
316 | if test "x$func_relative_path_tlibdir" = x ; then |
||
317 | # Have to descend all the way to the root! |
||
318 | func_relative_path_result=../$func_relative_path_result |
||
319 | func_relative_path_tcancelled=$func_relative_path_tbindir |
||
320 | break |
||
321 | fi |
||
322 | func_relative_path_result=../$func_relative_path_result |
||
323 | ;; |
||
324 | esac |
||
325 | done |
||
326 | |||
327 | # Now calculate path; take care to avoid doubling-up slashes. |
||
328 | func_stripname '' '/' "$func_relative_path_result" |
||
329 | func_relative_path_result=$func_stripname_result |
||
330 | func_stripname '/' '/' "$func_relative_path_tcancelled" |
||
331 | if test "x$func_stripname_result" != x ; then |
||
332 | func_relative_path_result=${func_relative_path_result}/${func_stripname_result} |
||
333 | fi |
||
334 | |||
335 | # Normalisation. If bindir is libdir, return empty string, |
||
336 | # else relative path ending with a slash; either way, target |
||
337 | # file name can be directly appended. |
||
338 | if test ! -z "$func_relative_path_result"; then |
||
339 | func_stripname './' '' "$func_relative_path_result/" |
||
340 | func_relative_path_result=$func_stripname_result |
||
341 | fi |
||
342 | } |
||
343 | |||
344 | # The name of this program: |
||
345 | func_dirname_and_basename "$progpath" |
||
346 | progname=$func_basename_result |
||
347 | |||
348 | # Make sure we have an absolute path for reexecution: |
||
349 | case $progpath in |
||
350 | [\\/]*|[A-Za-z]:\\*) ;; |
||
351 | *[\\/]*) |
||
352 | progdir=$func_dirname_result |
||
353 | progdir=`cd "$progdir" && pwd` |
||
354 | progpath="$progdir/$progname" |
||
355 | ;; |
||
356 | *) |
||
357 | save_IFS="$IFS" |
||
358 | IFS=: |
||
359 | for progdir in $PATH; do |
||
360 | IFS="$save_IFS" |
||
361 | test -x "$progdir/$progname" && break |
||
362 | done |
||
363 | IFS="$save_IFS" |
||
364 | test -n "$progdir" || progdir=`pwd` |
||
365 | progpath="$progdir/$progname" |
||
366 | ;; |
||
367 | esac |
||
368 | |||
369 | # Sed substitution that helps us do robust quoting. It backslashifies |
||
370 | # metacharacters that are still active within double-quoted strings. |
||
371 | Xsed="${SED}"' -e 1s/^X//' |
||
372 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' |
||
373 | |||
374 | # Same as above, but do not quote variable references. |
||
375 | double_quote_subst='s/\(["`\\]\)/\\\1/g' |
||
376 | |||
377 | # Re-`\' parameter expansions in output of double_quote_subst that were |
||
378 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$' |
||
379 | # in input to double_quote_subst, that '$' was protected from expansion. |
||
380 | # Since each input `\' is now two `\'s, look for any number of runs of |
||
381 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'. |
||
382 | bs='\\' |
||
383 | bs2='\\\\' |
||
384 | bs4='\\\\\\\\' |
||
385 | dollar='\$' |
||
386 | sed_double_backslash="\ |
||
387 | s/$bs4/&\\ |
||
388 | /g |
||
389 | s/^$bs2$dollar/$bs&/ |
||
390 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g |
||
391 | s/\n//g" |
||
392 | |||
393 | # Standard options: |
||
394 | opt_dry_run=false |
||
395 | opt_help=false |
||
396 | opt_quiet=false |
||
397 | opt_verbose=false |
||
398 | opt_warning=: |
||
399 | |||
400 | # func_echo arg... |
||
401 | # Echo program name prefixed message, along with the current mode |
||
402 | # name if it has been set yet. |
||
403 | func_echo () |
||
404 | { |
||
405 | $ECHO "$progname${mode+: }$mode: $*" |
||
406 | } |
||
407 | |||
408 | # func_verbose arg... |
||
409 | # Echo program name prefixed message in verbose mode only. |
||
410 | func_verbose () |
||
411 | { |
||
412 | $opt_verbose && func_echo ${1+"$@"} |
||
413 | |||
414 | # A bug in bash halts the script if the last line of a function |
||
415 | # fails when set -e is in force, so we need another command to |
||
416 | # work around that: |
||
417 | : |
||
418 | } |
||
419 | |||
420 | # func_echo_all arg... |
||
421 | # Invoke $ECHO with all args, space-separated. |
||
422 | func_echo_all () |
||
423 | { |
||
424 | $ECHO "$*" |
||
425 | } |
||
426 | |||
427 | # func_error arg... |
||
428 | # Echo program name prefixed message to standard error. |
||
429 | func_error () |
||
430 | { |
||
431 | $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 |
||
432 | } |
||
433 | |||
434 | # func_warning arg... |
||
435 | # Echo program name prefixed warning message to standard error. |
||
436 | func_warning () |
||
437 | { |
||
438 | $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 |
||
439 | |||
440 | # bash bug again: |
||
441 | : |
||
442 | } |
||
443 | |||
444 | # func_fatal_error arg... |
||
445 | # Echo program name prefixed message to standard error, and exit. |
||
446 | func_fatal_error () |
||
447 | { |
||
448 | func_error ${1+"$@"} |
||
449 | exit $EXIT_FAILURE |
||
450 | } |
||
451 | |||
452 | # func_fatal_help arg... |
||
453 | # Echo program name prefixed message to standard error, followed by |
||
454 | # a help hint, and exit. |
||
455 | func_fatal_help () |
||
456 | { |
||
457 | func_error ${1+"$@"} |
||
458 | func_fatal_error "$help" |
||
459 | } |
||
460 | help="Try \`$progname --help' for more information." ## default |
||
461 | |||
462 | |||
463 | # func_grep expression filename |
||
464 | # Check whether EXPRESSION matches any line of FILENAME, without output. |
||
465 | func_grep () |
||
466 | { |
||
467 | $GREP "$1" "$2" >/dev/null 2>&1 |
||
468 | } |
||
469 | |||
470 | |||
471 | # func_mkdir_p directory-path |
||
472 | # Make sure the entire path to DIRECTORY-PATH is available. |
||
473 | func_mkdir_p () |
||
474 | { |
||
475 | my_directory_path="$1" |
||
476 | my_dir_list= |
||
477 | |||
478 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then |
||
479 | |||
480 | # Protect directory names starting with `-' |
||
481 | case $my_directory_path in |
||
482 | -*) my_directory_path="./$my_directory_path" ;; |
||
483 | esac |
||
484 | |||
485 | # While some portion of DIR does not yet exist... |
||
486 | while test ! -d "$my_directory_path"; do |
||
487 | # ...make a list in topmost first order. Use a colon delimited |
||
488 | # list incase some portion of path contains whitespace. |
||
489 | my_dir_list="$my_directory_path:$my_dir_list" |
||
490 | |||
491 | # If the last portion added has no slash in it, the list is done |
||
492 | case $my_directory_path in */*) ;; *) break ;; esac |
||
493 | |||
494 | # ...otherwise throw away the child directory and loop |
||
495 | my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` |
||
496 | done |
||
497 | my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` |
||
498 | |||
499 | save_mkdir_p_IFS="$IFS"; IFS=':' |
||
500 | for my_dir in $my_dir_list; do |
||
501 | IFS="$save_mkdir_p_IFS" |
||
502 | # mkdir can fail with a `File exist' error if two processes |
||
503 | # try to create one of the directories concurrently. Don't |
||
504 | # stop in that case! |
||
505 | $MKDIR "$my_dir" 2>/dev/null || : |
||
506 | done |
||
507 | IFS="$save_mkdir_p_IFS" |
||
508 | |||
509 | # Bail out if we (or some other process) failed to create a directory. |
||
510 | test -d "$my_directory_path" || \ |
||
511 | func_fatal_error "Failed to create \`$1'" |
||
512 | fi |
||
513 | } |
||
514 | |||
515 | |||
516 | # func_mktempdir [string] |
||
517 | # Make a temporary directory that won't clash with other running |
||
518 | # libtool processes, and avoids race conditions if possible. If |
||
519 | # given, STRING is the basename for that directory. |
||
520 | func_mktempdir () |
||
521 | { |
||
522 | my_template="${TMPDIR-/tmp}/${1-$progname}" |
||
523 | |||
524 | if test "$opt_dry_run" = ":"; then |
||
525 | # Return a directory name, but don't create it in dry-run mode |
||
526 | my_tmpdir="${my_template}-$$" |
||
527 | else |
||
528 | |||
529 | # If mktemp works, use that first and foremost |
||
530 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` |
||
531 | |||
532 | if test ! -d "$my_tmpdir"; then |
||
533 | # Failing that, at least try and use $RANDOM to avoid a race |
||
534 | my_tmpdir="${my_template}-${RANDOM-0}$$" |
||
535 | |||
536 | save_mktempdir_umask=`umask` |
||
537 | umask 0077 |
||
538 | $MKDIR "$my_tmpdir" |
||
539 | umask $save_mktempdir_umask |
||
540 | fi |
||
541 | |||
542 | # If we're not in dry-run mode, bomb out on failure |
||
543 | test -d "$my_tmpdir" || \ |
||
544 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" |
||
545 | fi |
||
546 | |||
547 | $ECHO "$my_tmpdir" |
||
548 | } |
||
549 | |||
550 | |||
551 | # func_quote_for_eval arg |
||
552 | # Aesthetically quote ARG to be evaled later. |
||
553 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT |
||
554 | # is double-quoted, suitable for a subsequent eval, whereas |
||
555 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters |
||
556 | # which are still active within double quotes backslashified. |
||
557 | func_quote_for_eval () |
||
558 | { |
||
559 | case $1 in |
||
560 | *[\\\`\"\$]*) |
||
561 | func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; |
||
562 | *) |
||
563 | func_quote_for_eval_unquoted_result="$1" ;; |
||
564 | esac |
||
565 | |||
566 | case $func_quote_for_eval_unquoted_result in |
||
567 | # Double-quote args containing shell metacharacters to delay |
||
568 | # word splitting, command substitution and and variable |
||
569 | # expansion for a subsequent eval. |
||
570 | # Many Bourne shells cannot handle close brackets correctly |
||
571 | # in scan sets, so we specify it separately. |
||
572 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
573 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" |
||
574 | ;; |
||
575 | *) |
||
576 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" |
||
577 | esac |
||
578 | } |
||
579 | |||
580 | |||
581 | # func_quote_for_expand arg |
||
582 | # Aesthetically quote ARG to be evaled later; same as above, |
||
583 | # but do not quote variable references. |
||
584 | func_quote_for_expand () |
||
585 | { |
||
586 | case $1 in |
||
587 | *[\\\`\"]*) |
||
588 | my_arg=`$ECHO "$1" | $SED \ |
||
589 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; |
||
590 | *) |
||
591 | my_arg="$1" ;; |
||
592 | esac |
||
593 | |||
594 | case $my_arg in |
||
595 | # Double-quote args containing shell metacharacters to delay |
||
596 | # word splitting and command substitution for a subsequent eval. |
||
597 | # Many Bourne shells cannot handle close brackets correctly |
||
598 | # in scan sets, so we specify it separately. |
||
599 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
||
600 | my_arg="\"$my_arg\"" |
||
601 | ;; |
||
602 | esac |
||
603 | |||
604 | func_quote_for_expand_result="$my_arg" |
||
605 | } |
||
606 | |||
607 | |||
608 | # func_show_eval cmd [fail_exp] |
||
609 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
||
610 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
||
611 | # is given, then evaluate it. |
||
612 | func_show_eval () |
||
613 | { |
||
614 | my_cmd="$1" |
||
615 | my_fail_exp="${2-:}" |
||
616 | |||
617 | ${opt_silent-false} || { |
||
618 | func_quote_for_expand "$my_cmd" |
||
619 | eval "func_echo $func_quote_for_expand_result" |
||
620 | } |
||
621 | |||
622 | if ${opt_dry_run-false}; then :; else |
||
623 | eval "$my_cmd" |
||
624 | my_status=$? |
||
625 | if test "$my_status" -eq 0; then :; else |
||
626 | eval "(exit $my_status); $my_fail_exp" |
||
627 | fi |
||
628 | fi |
||
629 | } |
||
630 | |||
631 | |||
632 | # func_show_eval_locale cmd [fail_exp] |
||
633 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
||
634 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
||
635 | # is given, then evaluate it. Use the saved locale for evaluation. |
||
636 | func_show_eval_locale () |
||
637 | { |
||
638 | my_cmd="$1" |
||
639 | my_fail_exp="${2-:}" |
||
640 | |||
641 | ${opt_silent-false} || { |
||
642 | func_quote_for_expand "$my_cmd" |
||
643 | eval "func_echo $func_quote_for_expand_result" |
||
644 | } |
||
645 | |||
646 | if ${opt_dry_run-false}; then :; else |
||
647 | eval "$lt_user_locale |
||
648 | $my_cmd" |
||
649 | my_status=$? |
||
650 | eval "$lt_safe_locale" |
||
651 | if test "$my_status" -eq 0; then :; else |
||
652 | eval "(exit $my_status); $my_fail_exp" |
||
653 | fi |
||
654 | fi |
||
655 | } |
||
656 | |||
657 | |||
658 | |||
659 | # func_version |
||
660 | # Echo version message to standard output and exit. |
||
661 | func_version () |
||
662 | { |
||
663 | $SED -n '/(C)/!b go |
||
664 | :more |
||
665 | /\./!{ |
||
666 | N |
||
667 | s/\n# // |
||
668 | b more |
||
669 | } |
||
670 | :go |
||
671 | /^# '$PROGRAM' (GNU /,/# warranty; / { |
||
672 | s/^# // |
||
673 | s/^# *$// |
||
674 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ |
||
675 | p |
||
676 | }' < "$progpath" |
||
677 | exit $? |
||
678 | } |
||
679 | |||
680 | # func_usage |
||
681 | # Echo short help message to standard output and exit. |
||
682 | func_usage () |
||
683 | { |
||
684 | $SED -n '/^# Usage:/,/^# *.*--help/ { |
||
685 | s/^# // |
||
686 | s/^# *$// |
||
687 | s/\$progname/'$progname'/ |
||
688 | p |
||
689 | }' < "$progpath" |
||
690 | echo |
||
691 | $ECHO "run \`$progname --help | more' for full usage" |
||
692 | exit $? |
||
693 | } |
||
694 | |||
695 | # func_help [NOEXIT] |
||
696 | # Echo long help message to standard output and exit, |
||
697 | # unless 'noexit' is passed as argument. |
||
698 | func_help () |
||
699 | { |
||
700 | $SED -n '/^# Usage:/,/# Report bugs to/ { |
||
701 | s/^# // |
||
702 | s/^# *$// |
||
703 | s*\$progname*'$progname'* |
||
704 | s*\$host*'"$host"'* |
||
705 | s*\$SHELL*'"$SHELL"'* |
||
706 | s*\$LTCC*'"$LTCC"'* |
||
707 | s*\$LTCFLAGS*'"$LTCFLAGS"'* |
||
708 | s*\$LD*'"$LD"'* |
||
709 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ |
||
710 | s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ |
||
711 | s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ |
||
712 | p |
||
713 | }' < "$progpath" |
||
714 | ret=$? |
||
715 | if test -z "$1"; then |
||
716 | exit $ret |
||
717 | fi |
||
718 | } |
||
719 | |||
720 | # func_missing_arg argname |
||
721 | # Echo program name prefixed message to standard error and set global |
||
722 | # exit_cmd. |
||
723 | func_missing_arg () |
||
724 | { |
||
725 | func_error "missing argument for $1." |
||
726 | exit_cmd=exit |
||
727 | } |
||
728 | |||
729 | exit_cmd=: |
||
730 | |||
731 | |||
732 | |||
733 | |||
734 | |||
735 | |||
736 | magic="%%%MAGIC variable%%%" |
||
737 | magic_exe="%%%MAGIC EXE variable%%%" |
||
738 | |||
739 | # Global variables. |
||
740 | # $mode is unset |
||
741 | nonopt= |
||
742 | execute_dlfiles= |
||
743 | preserve_args= |
||
744 | lo2o="s/\\.lo\$/.${objext}/" |
||
745 | o2lo="s/\\.${objext}\$/.lo/" |
||
746 | extracted_archives= |
||
747 | extracted_serial=0 |
||
748 | |||
749 | opt_dry_run=false |
||
750 | opt_duplicate_deps=false |
||
751 | opt_silent=false |
||
752 | opt_debug=: |
||
753 | |||
754 | # If this variable is set in any of the actions, the command in it |
||
755 | # will be execed at the end. This prevents here-documents from being |
||
756 | # left over by shells. |
||
757 | exec_cmd= |
||
758 | |||
759 | # func_fatal_configuration arg... |
||
760 | # Echo program name prefixed message to standard error, followed by |
||
761 | # a configuration failure hint, and exit. |
||
762 | func_fatal_configuration () |
||
763 | { |
||
764 | func_error ${1+"$@"} |
||
765 | func_error "See the $PACKAGE documentation for more information." |
||
766 | func_fatal_error "Fatal configuration error." |
||
767 | } |
||
768 | |||
769 | |||
770 | # func_config |
||
771 | # Display the configuration for all the tags in this script. |
||
772 | func_config () |
||
773 | { |
||
774 | re_begincf='^# ### BEGIN LIBTOOL' |
||
775 | re_endcf='^# ### END LIBTOOL' |
||
776 | |||
777 | # Default configuration. |
||
778 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" |
||
779 | |||
780 | # Now print the configurations for the tags. |
||
781 | for tagname in $taglist; do |
||
782 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
||
783 | done |
||
784 | |||
785 | exit $? |
||
786 | } |
||
787 | |||
788 | # func_features |
||
789 | # Display the features supported by this script. |
||
790 | func_features () |
||
791 | { |
||
792 | echo "host: $host" |
||
793 | if test "$build_libtool_libs" = yes; then |
||
794 | echo "enable shared libraries" |
||
795 | else |
||
796 | echo "disable shared libraries" |
||
797 | fi |
||
798 | if test "$build_old_libs" = yes; then |
||
799 | echo "enable static libraries" |
||
800 | else |
||
801 | echo "disable static libraries" |
||
802 | fi |
||
803 | |||
804 | exit $? |
||
805 | } |
||
806 | |||
807 | # func_enable_tag tagname |
||
808 | # Verify that TAGNAME is valid, and either flag an error and exit, or |
||
809 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist |
||
810 | # variable here. |
||
811 | func_enable_tag () |
||
812 | { |
||
813 | # Global variable: |
||
814 | tagname="$1" |
||
815 | |||
816 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
||
817 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
||
818 | sed_extractcf="/$re_begincf/,/$re_endcf/p" |
||
819 | |||
820 | # Validate tagname. |
||
821 | case $tagname in |
||
822 | *[!-_A-Za-z0-9,/]*) |
||
823 | func_fatal_error "invalid tag name: $tagname" |
||
824 | ;; |
||
825 | esac |
||
826 | |||
827 | # Don't test for the "default" C tag, as we know it's |
||
828 | # there but not specially marked. |
||
829 | case $tagname in |
||
830 | CC) ;; |
||
831 | *) |
||
832 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
||
833 | taglist="$taglist $tagname" |
||
834 | |||
835 | # Evaluate the configuration. Be careful to quote the path |
||
836 | # and the sed script, to avoid splitting on whitespace, but |
||
837 | # also don't use non-portable quotes within backquotes within |
||
838 | # quotes we have to do it in 2 steps: |
||
839 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` |
||
840 | eval "$extractedcf" |
||
841 | else |
||
842 | func_error "ignoring unknown tag $tagname" |
||
843 | fi |
||
844 | ;; |
||
845 | esac |
||
846 | } |
||
847 | |||
848 | # Parse options once, thoroughly. This comes as soon as possible in |
||
849 | # the script to make things like `libtool --version' happen quickly. |
||
850 | { |
||
851 | |||
852 | # Shorthand for --mode=foo, only valid as the first argument |
||
853 | case $1 in |
||
854 | clean|clea|cle|cl) |
||
855 | shift; set dummy --mode clean ${1+"$@"}; shift |
||
856 | ;; |
||
857 | compile|compil|compi|comp|com|co|c) |
||
858 | shift; set dummy --mode compile ${1+"$@"}; shift |
||
859 | ;; |
||
860 | execute|execut|execu|exec|exe|ex|e) |
||
861 | shift; set dummy --mode execute ${1+"$@"}; shift |
||
862 | ;; |
||
863 | finish|finis|fini|fin|fi|f) |
||
864 | shift; set dummy --mode finish ${1+"$@"}; shift |
||
865 | ;; |
||
866 | install|instal|insta|inst|ins|in|i) |
||
867 | shift; set dummy --mode install ${1+"$@"}; shift |
||
868 | ;; |
||
869 | link|lin|li|l) |
||
870 | shift; set dummy --mode link ${1+"$@"}; shift |
||
871 | ;; |
||
872 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
||
873 | shift; set dummy --mode uninstall ${1+"$@"}; shift |
||
874 | ;; |
||
875 | esac |
||
876 | |||
877 | # Parse non-mode specific arguments: |
||
878 | while test "$#" -gt 0; do |
||
879 | opt="$1" |
||
880 | shift |
||
881 | |||
882 | case $opt in |
||
883 | --config) func_config ;; |
||
884 | |||
885 | --debug) preserve_args="$preserve_args $opt" |
||
886 | func_echo "enabling shell trace mode" |
||
887 | opt_debug='set -x' |
||
888 | $opt_debug |
||
889 | ;; |
||
890 | |||
891 | -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break |
||
892 | execute_dlfiles="$execute_dlfiles $1" |
||
893 | shift |
||
894 | ;; |
||
895 | |||
896 | --dry-run | -n) opt_dry_run=: ;; |
||
897 | --features) func_features ;; |
||
898 | --finish) mode="finish" ;; |
||
899 | |||
900 | --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break |
||
901 | case $1 in |
||
902 | # Valid mode arguments: |
||
903 | clean) ;; |
||
904 | compile) ;; |
||
905 | execute) ;; |
||
906 | finish) ;; |
||
907 | install) ;; |
||
908 | link) ;; |
||
909 | relink) ;; |
||
910 | uninstall) ;; |
||
911 | |||
912 | # Catch anything else as an error |
||
913 | *) func_error "invalid argument for $opt" |
||
914 | exit_cmd=exit |
||
915 | break |
||
916 | ;; |
||
917 | esac |
||
918 | |||
919 | mode="$1" |
||
920 | shift |
||
921 | ;; |
||
922 | |||
923 | --preserve-dup-deps) |
||
924 | opt_duplicate_deps=: ;; |
||
925 | |||
926 | --quiet|--silent) preserve_args="$preserve_args $opt" |
||
927 | opt_silent=: |
||
928 | opt_verbose=false |
||
929 | ;; |
||
930 | |||
931 | --no-quiet|--no-silent) |
||
932 | preserve_args="$preserve_args $opt" |
||
933 | opt_silent=false |
||
934 | ;; |
||
935 | |||
936 | --verbose| -v) preserve_args="$preserve_args $opt" |
||
937 | opt_silent=false |
||
938 | opt_verbose=: |
||
939 | ;; |
||
940 | |||
941 | --no-verbose) preserve_args="$preserve_args $opt" |
||
942 | opt_verbose=false |
||
943 | ;; |
||
944 | |||
945 | --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break |
||
946 | preserve_args="$preserve_args $opt $1" |
||
947 | func_enable_tag "$1" # tagname is set here |
||
948 | shift |
||
949 | ;; |
||
950 | |||
951 | # Separate optargs to long options: |
||
952 | -dlopen=*|--mode=*|--tag=*) |
||
953 | func_opt_split "$opt" |
||
954 | set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} |
||
955 | shift |
||
956 | ;; |
||
957 | |||
958 | -\?|-h) func_usage ;; |
||
959 | --help) opt_help=: ;; |
||
960 | --help-all) opt_help=': help-all' ;; |
||
961 | --version) func_version ;; |
||
962 | |||
963 | -*) func_fatal_help "unrecognized option \`$opt'" ;; |
||
964 | |||
965 | *) nonopt="$opt" |
||
966 | break |
||
967 | ;; |
||
968 | esac |
||
969 | done |
||
970 | |||
971 | |||
972 | case $host in |
||
973 | *cygwin* | *mingw* | *pw32* | *cegcc*) |
||
974 | # don't eliminate duplications in $postdeps and $predeps |
||
975 | opt_duplicate_compiler_generated_deps=: |
||
976 | ;; |
||
977 | *) |
||
978 | opt_duplicate_compiler_generated_deps=$opt_duplicate_deps |
||
979 | ;; |
||
980 | esac |
||
981 | |||
982 | # Having warned about all mis-specified options, bail out if |
||
983 | # anything was wrong. |
||
984 | $exit_cmd $EXIT_FAILURE |
||
985 | } |
||
986 | |||
987 | # func_check_version_match |
||
988 | # Ensure that we are using m4 macros, and libtool script from the same |
||
989 | # release of libtool. |
||
990 | func_check_version_match () |
||
991 | { |
||
992 | if test "$package_revision" != "$macro_revision"; then |
||
993 | if test "$VERSION" != "$macro_version"; then |
||
994 | if test -z "$macro_version"; then |
||
995 | cat >&2 <<_LT_EOF |
||
996 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
||
997 | $progname: definition of this LT_INIT comes from an older release. |
||
998 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
||
999 | $progname: and run autoconf again. |
||
1000 | _LT_EOF |
||
1001 | else |
||
1002 | cat >&2 <<_LT_EOF |
||
1003 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
||
1004 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. |
||
1005 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
||
1006 | $progname: and run autoconf again. |
||
1007 | _LT_EOF |
||
1008 | fi |
||
1009 | else |
||
1010 | cat >&2 <<_LT_EOF |
||
1011 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, |
||
1012 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. |
||
1013 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision |
||
1014 | $progname: of $PACKAGE $VERSION and run autoconf again. |
||
1015 | _LT_EOF |
||
1016 | fi |
||
1017 | |||
1018 | exit $EXIT_MISMATCH |
||
1019 | fi |
||
1020 | } |
||
1021 | |||
1022 | |||
1023 | ## ----------- ## |
||
1024 | ## Main. ## |
||
1025 | ## ----------- ## |
||
1026 | |||
1027 | $opt_help || { |
||
1028 | # Sanity checks first: |
||
1029 | func_check_version_match |
||
1030 | |||
1031 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
||
1032 | func_fatal_configuration "not configured to build any kind of library" |
||
1033 | fi |
||
1034 | |||
1035 | test -z "$mode" && func_fatal_error "error: you must specify a MODE." |
||
1036 | |||
1037 | |||
1038 | # Darwin sucks |
||
1039 | eval std_shrext=\"$shrext_cmds\" |
||
1040 | |||
1041 | |||
1042 | # Only execute mode is allowed to have -dlopen flags. |
||
1043 | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
||
1044 | func_error "unrecognized option \`-dlopen'" |
||
1045 | $ECHO "$help" 1>&2 |
||
1046 | exit $EXIT_FAILURE |
||
1047 | fi |
||
1048 | |||
1049 | # Change the help message to a mode-specific one. |
||
1050 | generic_help="$help" |
||
1051 | help="Try \`$progname --help --mode=$mode' for more information." |
||
1052 | } |
||
1053 | |||
1054 | |||
1055 | # func_lalib_p file |
||
1056 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
||
1057 | # This function is only a basic sanity check; it will hardly flush out |
||
1058 | # determined imposters. |
||
1059 | func_lalib_p () |
||
1060 | { |
||
1061 | test -f "$1" && |
||
1062 | $SED -e 4q "$1" 2>/dev/null \ |
||
1063 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 |
||
1064 | } |
||
1065 | |||
1066 | # func_lalib_unsafe_p file |
||
1067 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
||
1068 | # This function implements the same check as func_lalib_p without |
||
1069 | # resorting to external programs. To this end, it redirects stdin and |
||
1070 | # closes it afterwards, without saving the original file descriptor. |
||
1071 | # As a safety measure, use it only where a negative result would be |
||
1072 | # fatal anyway. Works if `file' does not exist. |
||
1073 | func_lalib_unsafe_p () |
||
1074 | { |
||
1075 | lalib_p=no |
||
1076 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
||
1077 | for lalib_p_l in 1 2 3 4 |
||
1078 | do |
||
1079 | read lalib_p_line |
||
1080 | case "$lalib_p_line" in |
||
1081 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; |
||
1082 | esac |
||
1083 | done |
||
1084 | exec 0<&5 5<&- |
||
1085 | fi |
||
1086 | test "$lalib_p" = yes |
||
1087 | } |
||
1088 | |||
1089 | # func_ltwrapper_script_p file |
||
1090 | # True iff FILE is a libtool wrapper script |
||
1091 | # This function is only a basic sanity check; it will hardly flush out |
||
1092 | # determined imposters. |
||
1093 | func_ltwrapper_script_p () |
||
1094 | { |
||
1095 | func_lalib_p "$1" |
||
1096 | } |
||
1097 | |||
1098 | # func_ltwrapper_executable_p file |
||
1099 | # True iff FILE is a libtool wrapper executable |
||
1100 | # This function is only a basic sanity check; it will hardly flush out |
||
1101 | # determined imposters. |
||
1102 | func_ltwrapper_executable_p () |
||
1103 | { |
||
1104 | func_ltwrapper_exec_suffix= |
||
1105 | case $1 in |
||
1106 | *.exe) ;; |
||
1107 | *) func_ltwrapper_exec_suffix=.exe ;; |
||
1108 | esac |
||
1109 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 |
||
1110 | } |
||
1111 | |||
1112 | # func_ltwrapper_scriptname file |
||
1113 | # Assumes file is an ltwrapper_executable |
||
1114 | # uses $file to determine the appropriate filename for a |
||
1115 | # temporary ltwrapper_script. |
||
1116 | func_ltwrapper_scriptname () |
||
1117 | { |
||
1118 | func_ltwrapper_scriptname_result="" |
||
1119 | if func_ltwrapper_executable_p "$1"; then |
||
1120 | func_dirname_and_basename "$1" "" "." |
||
1121 | func_stripname '' '.exe' "$func_basename_result" |
||
1122 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" |
||
1123 | fi |
||
1124 | } |
||
1125 | |||
1126 | # func_ltwrapper_p file |
||
1127 | # True iff FILE is a libtool wrapper script or wrapper executable |
||
1128 | # This function is only a basic sanity check; it will hardly flush out |
||
1129 | # determined imposters. |
||
1130 | func_ltwrapper_p () |
||
1131 | { |
||
1132 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" |
||
1133 | } |
||
1134 | |||
1135 | |||
1136 | # func_execute_cmds commands fail_cmd |
||
1137 | # Execute tilde-delimited COMMANDS. |
||
1138 | # If FAIL_CMD is given, eval that upon failure. |
||
1139 | # FAIL_CMD may read-access the current command in variable CMD! |
||
1140 | func_execute_cmds () |
||
1141 | { |
||
1142 | $opt_debug |
||
1143 | save_ifs=$IFS; IFS='~' |
||
1144 | for cmd in $1; do |
||
1145 | IFS=$save_ifs |
||
1146 | eval cmd=\"$cmd\" |
||
1147 | func_show_eval "$cmd" "${2-:}" |
||
1148 | done |
||
1149 | IFS=$save_ifs |
||
1150 | } |
||
1151 | |||
1152 | |||
1153 | # func_source file |
||
1154 | # Source FILE, adding directory component if necessary. |
||
1155 | # Note that it is not necessary on cygwin/mingw to append a dot to |
||
1156 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe |
||
1157 | # behavior happens only for exec(3), not for open(2)! Also, sourcing |
||
1158 | # `FILE.' does not work on cygwin managed mounts. |
||
1159 | func_source () |
||
1160 | { |
||
1161 | $opt_debug |
||
1162 | case $1 in |
||
1163 | */* | *\\*) . "$1" ;; |
||
1164 | *) . "./$1" ;; |
||
1165 | esac |
||
1166 | } |
||
1167 | |||
1168 | |||
1169 | # func_infer_tag arg |
||
1170 | # Infer tagged configuration to use if any are available and |
||
1171 | # if one wasn't chosen via the "--tag" command line option. |
||
1172 | # Only attempt this if the compiler in the base compile |
||
1173 | # command doesn't match the default compiler. |
||
1174 | # arg is usually of the form 'gcc ...' |
||
1175 | func_infer_tag () |
||
1176 | { |
||
1177 | $opt_debug |
||
1178 | if test -n "$available_tags" && test -z "$tagname"; then |
||
1179 | CC_quoted= |
||
1180 | for arg in $CC; do |
||
1181 | func_quote_for_eval "$arg" |
||
1182 | CC_quoted="$CC_quoted $func_quote_for_eval_result" |
||
1183 | done |
||
1184 | CC_expanded=`func_echo_all $CC` |
||
1185 | CC_quoted_expanded=`func_echo_all $CC_quoted` |
||
1186 | case $@ in |
||
1187 | # Blanks in the command may have been stripped by the calling shell, |
||
1188 | # but not from the CC environment variable when configure was run. |
||
1189 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
||
1190 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; |
||
1191 | # Blanks at the start of $base_compile will cause this to fail |
||
1192 | # if we don't check for them as well. |
||
1193 | *) |
||
1194 | for z in $available_tags; do |
||
1195 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
||
1196 | # Evaluate the configuration. |
||
1197 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
||
1198 | CC_quoted= |
||
1199 | for arg in $CC; do |
||
1200 | # Double-quote args containing other shell metacharacters. |
||
1201 | func_quote_for_eval "$arg" |
||
1202 | CC_quoted="$CC_quoted $func_quote_for_eval_result" |
||
1203 | done |
||
1204 | CC_expanded=`func_echo_all $CC` |
||
1205 | CC_quoted_expanded=`func_echo_all $CC_quoted` |
||
1206 | case "$@ " in |
||
1207 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ |
||
1208 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) |
||
1209 | # The compiler in the base compile command matches |
||
1210 | # the one in the tagged configuration. |
||
1211 | # Assume this is the tagged configuration we want. |
||
1212 | tagname=$z |
||
1213 | break |
||
1214 | ;; |
||
1215 | esac |
||
1216 | fi |
||
1217 | done |
||
1218 | # If $tagname still isn't set, then no tagged configuration |
||
1219 | # was found and let the user know that the "--tag" command |
||
1220 | # line option must be used. |
||
1221 | if test -z "$tagname"; then |
||
1222 | func_echo "unable to infer tagged configuration" |
||
1223 | func_fatal_error "specify a tag with \`--tag'" |
||
1224 | # else |
||
1225 | # func_verbose "using $tagname tagged configuration" |
||
1226 | fi |
||
1227 | ;; |
||
1228 | esac |
||
1229 | fi |
||
1230 | } |
||
1231 | |||
1232 | |||
1233 | |||
1234 | # func_write_libtool_object output_name pic_name nonpic_name |
||
1235 | # Create a libtool object file (analogous to a ".la" file), |
||
1236 | # but don't create it if we're doing a dry run. |
||
1237 | func_write_libtool_object () |
||
1238 | { |
||
1239 | write_libobj=${1} |
||
1240 | if test "$build_libtool_libs" = yes; then |
||
1241 | write_lobj=\'${2}\' |
||
1242 | else |
||
1243 | write_lobj=none |
||
1244 | fi |
||
1245 | |||
1246 | if test "$build_old_libs" = yes; then |
||
1247 | write_oldobj=\'${3}\' |
||
1248 | else |
||
1249 | write_oldobj=none |
||
1250 | fi |
||
1251 | |||
1252 | $opt_dry_run || { |
||
1253 | cat >${write_libobj}T < |
||
1254 | # $write_libobj - a libtool object file |
||
1255 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
||
1256 | # |
||
1257 | # Please DO NOT delete this file! |
||
1258 | # It is necessary for linking the library. |
||
1259 | |||
1260 | # Name of the PIC object. |
||
1261 | pic_object=$write_lobj |
||
1262 | |||
1263 | # Name of the non-PIC object |
||
1264 | non_pic_object=$write_oldobj |
||
1265 | |||
1266 | EOF |
||
1267 | $MV "${write_libobj}T" "${write_libobj}" |
||
1268 | } |
||
1269 | } |
||
1270 | |||
1271 | # func_mode_compile arg... |
||
1272 | func_mode_compile () |
||
1273 | { |
||
1274 | $opt_debug |
||
1275 | # Get the compilation command and the source file. |
||
1276 | base_compile= |
||
1277 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
||
1278 | suppress_opt=yes |
||
1279 | suppress_output= |
||
1280 | arg_mode=normal |
||
1281 | libobj= |
||
1282 | later= |
||
1283 | pie_flag= |
||
1284 | |||
1285 | for arg |
||
1286 | do |
||
1287 | case $arg_mode in |
||
1288 | arg ) |
||
1289 | # do not "continue". Instead, add this to base_compile |
||
1290 | lastarg="$arg" |
||
1291 | arg_mode=normal |
||
1292 | ;; |
||
1293 | |||
1294 | target ) |
||
1295 | libobj="$arg" |
||
1296 | arg_mode=normal |
||
1297 | continue |
||
1298 | ;; |
||
1299 | |||
1300 | normal ) |
||
1301 | # Accept any command-line options. |
||
1302 | case $arg in |
||
1303 | -o) |
||
1304 | test -n "$libobj" && \ |
||
1305 | func_fatal_error "you cannot specify \`-o' more than once" |
||
1306 | arg_mode=target |
||
1307 | continue |
||
1308 | ;; |
||
1309 | |||
1310 | -pie | -fpie | -fPIE) |
||
1311 | pie_flag="$pie_flag $arg" |
||
1312 | continue |
||
1313 | ;; |
||
1314 | |||
1315 | -shared | -static | -prefer-pic | -prefer-non-pic) |
||
1316 | later="$later $arg" |
||
1317 | continue |
||
1318 | ;; |
||
1319 | |||
1320 | -no-suppress) |
||
1321 | suppress_opt=no |
||
1322 | continue |
||
1323 | ;; |
||
1324 | |||
1325 | -Xcompiler) |
||
1326 | arg_mode=arg # the next one goes into the "base_compile" arg list |
||
1327 | continue # The current "srcfile" will either be retained or |
||
1328 | ;; # replaced later. I would guess that would be a bug. |
||
1329 | |||
1330 | -Wc,*) |
||
1331 | func_stripname '-Wc,' '' "$arg" |
||
1332 | args=$func_stripname_result |
||
1333 | lastarg= |
||
1334 | save_ifs="$IFS"; IFS=',' |
||
1335 | for arg in $args; do |
||
1336 | IFS="$save_ifs" |
||
1337 | func_quote_for_eval "$arg" |
||
1338 | lastarg="$lastarg $func_quote_for_eval_result" |
||
1339 | done |
||
1340 | IFS="$save_ifs" |
||
1341 | func_stripname ' ' '' "$lastarg" |
||
1342 | lastarg=$func_stripname_result |
||
1343 | |||
1344 | # Add the arguments to base_compile. |
||
1345 | base_compile="$base_compile $lastarg" |
||
1346 | continue |
||
1347 | ;; |
||
1348 | |||
1349 | *) |
||
1350 | # Accept the current argument as the source file. |
||
1351 | # The previous "srcfile" becomes the current argument. |
||
1352 | # |
||
1353 | lastarg="$srcfile" |
||
1354 | srcfile="$arg" |
||
1355 | ;; |
||
1356 | esac # case $arg |
||
1357 | ;; |
||
1358 | esac # case $arg_mode |
||
1359 | |||
1360 | # Aesthetically quote the previous argument. |
||
1361 | func_quote_for_eval "$lastarg" |
||
1362 | base_compile="$base_compile $func_quote_for_eval_result" |
||
1363 | done # for arg |
||
1364 | |||
1365 | case $arg_mode in |
||
1366 | arg) |
||
1367 | func_fatal_error "you must specify an argument for -Xcompile" |
||
1368 | ;; |
||
1369 | target) |
||
1370 | func_fatal_error "you must specify a target with \`-o'" |
||
1371 | ;; |
||
1372 | *) |
||
1373 | # Get the name of the library object. |
||
1374 | test -z "$libobj" && { |
||
1375 | func_basename "$srcfile" |
||
1376 | libobj="$func_basename_result" |
||
1377 | } |
||
1378 | ;; |
||
1379 | esac |
||
1380 | |||
1381 | # Recognize several different file suffixes. |
||
1382 | # If the user specifies -o file.o, it is replaced with file.lo |
||
1383 | case $libobj in |
||
1384 | *.[cCFSifmso] | \ |
||
1385 | *.ada | *.adb | *.ads | *.asm | \ |
||
1386 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
||
1387 | *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) |
||
1388 | func_xform "$libobj" |
||
1389 | libobj=$func_xform_result |
||
1390 | ;; |
||
1391 | esac |
||
1392 | |||
1393 | case $libobj in |
||
1394 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
||
1395 | *) |
||
1396 | func_fatal_error "cannot determine name of library object from \`$libobj'" |
||
1397 | ;; |
||
1398 | esac |
||
1399 | |||
1400 | func_infer_tag $base_compile |
||
1401 | |||
1402 | for arg in $later; do |
||
1403 | case $arg in |
||
1404 | -shared) |
||
1405 | test "$build_libtool_libs" != yes && \ |
||
1406 | func_fatal_configuration "can not build a shared library" |
||
1407 | build_old_libs=no |
||
1408 | continue |
||
1409 | ;; |
||
1410 | |||
1411 | -static) |
||
1412 | build_libtool_libs=no |
||
1413 | build_old_libs=yes |
||
1414 | continue |
||
1415 | ;; |
||
1416 | |||
1417 | -prefer-pic) |
||
1418 | pic_mode=yes |
||
1419 | continue |
||
1420 | ;; |
||
1421 | |||
1422 | -prefer-non-pic) |
||
1423 | pic_mode=no |
||
1424 | continue |
||
1425 | ;; |
||
1426 | esac |
||
1427 | done |
||
1428 | |||
1429 | func_quote_for_eval "$libobj" |
||
1430 | test "X$libobj" != "X$func_quote_for_eval_result" \ |
||
1431 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ |
||
1432 | && func_warning "libobj name \`$libobj' may not contain shell special characters." |
||
1433 | func_dirname_and_basename "$obj" "/" "" |
||
1434 | objname="$func_basename_result" |
||
1435 | xdir="$func_dirname_result" |
||
1436 | lobj=${xdir}$objdir/$objname |
||
1437 | |||
1438 | test -z "$base_compile" && \ |
||
1439 | func_fatal_help "you must specify a compilation command" |
||
1440 | |||
1441 | # Delete any leftover library objects. |
||
1442 | if test "$build_old_libs" = yes; then |
||
1443 | removelist="$obj $lobj $libobj ${libobj}T" |
||
1444 | else |
||
1445 | removelist="$lobj $libobj ${libobj}T" |
||
1446 | fi |
||
1447 | |||
1448 | # On Cygwin there's no "real" PIC flag so we must build both object types |
||
1449 | case $host_os in |
||
1450 | cygwin* | mingw* | pw32* | os2* | cegcc*) |
||
1451 | pic_mode=default |
||
1452 | ;; |
||
1453 | esac |
||
1454 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
||
1455 | # non-PIC code in shared libraries is not supported |
||
1456 | pic_mode=default |
||
1457 | fi |
||
1458 | |||
1459 | # Calculate the filename of the output object if compiler does |
||
1460 | # not support -o with -c |
||
1461 | if test "$compiler_c_o" = no; then |
||
1462 | output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} |
||
1463 | lockfile="$output_obj.lock" |
||
1464 | else |
||
1465 | output_obj= |
||
1466 | need_locks=no |
||
1467 | lockfile= |
||
1468 | fi |
||
1469 | |||
1470 | # Lock this critical section if it is needed |
||
1471 | # We use this script file to make the link, it avoids creating a new file |
||
1472 | if test "$need_locks" = yes; then |
||
1473 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
||
1474 | func_echo "Waiting for $lockfile to be removed" |
||
1475 | sleep 2 |
||
1476 | done |
||
1477 | elif test "$need_locks" = warn; then |
||
1478 | if test -f "$lockfile"; then |
||
1479 | $ECHO "\ |
||
1480 | *** ERROR, $lockfile exists and contains: |
||
1481 | `cat $lockfile 2>/dev/null` |
||
1482 | |||
1483 | This indicates that another process is trying to use the same |
||
1484 | temporary object file, and libtool could not work around it because |
||
1485 | your compiler does not support \`-c' and \`-o' together. If you |
||
1486 | repeat this compilation, it may succeed, by chance, but you had better |
||
1487 | avoid parallel builds (make -j) in this platform, or get a better |
||
1488 | compiler." |
||
1489 | |||
1490 | $opt_dry_run || $RM $removelist |
||
1491 | exit $EXIT_FAILURE |
||
1492 | fi |
||
1493 | removelist="$removelist $output_obj" |
||
1494 | $ECHO "$srcfile" > "$lockfile" |
||
1495 | fi |
||
1496 | |||
1497 | $opt_dry_run || $RM $removelist |
||
1498 | removelist="$removelist $lockfile" |
||
1499 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
||
1500 | |||
1501 | if test -n "$fix_srcfile_path"; then |
||
1502 | eval srcfile=\"$fix_srcfile_path\" |
||
1503 | fi |
||
1504 | func_quote_for_eval "$srcfile" |
||
1505 | qsrcfile=$func_quote_for_eval_result |
||
1506 | |||
1507 | # Only build a PIC object if we are building libtool libraries. |
||
1508 | if test "$build_libtool_libs" = yes; then |
||
1509 | # Without this assignment, base_compile gets emptied. |
||
1510 | fbsd_hideous_sh_bug=$base_compile |
||
1511 | |||
1512 | if test "$pic_mode" != no; then |
||
1513 | command="$base_compile $qsrcfile $pic_flag" |
||
1514 | else |
||
1515 | # Don't build PIC code |
||
1516 | command="$base_compile $qsrcfile" |
||
1517 | fi |
||
1518 | |||
1519 | func_mkdir_p "$xdir$objdir" |
||
1520 | |||
1521 | if test -z "$output_obj"; then |
||
1522 | # Place PIC objects in $objdir |
||
1523 | command="$command -o $lobj" |
||
1524 | fi |
||
1525 | |||
1526 | func_show_eval_locale "$command" \ |
||
1527 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' |
||
1528 | |||
1529 | if test "$need_locks" = warn && |
||
1530 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
||
1531 | $ECHO "\ |
||
1532 | *** ERROR, $lockfile contains: |
||
1533 | `cat $lockfile 2>/dev/null` |
||
1534 | |||
1535 | but it should contain: |
||
1536 | $srcfile |
||
1537 | |||
1538 | This indicates that another process is trying to use the same |
||
1539 | temporary object file, and libtool could not work around it because |
||
1540 | your compiler does not support \`-c' and \`-o' together. If you |
||
1541 | repeat this compilation, it may succeed, by chance, but you had better |
||
1542 | avoid parallel builds (make -j) in this platform, or get a better |
||
1543 | compiler." |
||
1544 | |||
1545 | $opt_dry_run || $RM $removelist |
||
1546 | exit $EXIT_FAILURE |
||
1547 | fi |
||
1548 | |||
1549 | # Just move the object if needed, then go on to compile the next one |
||
1550 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
||
1551 | func_show_eval '$MV "$output_obj" "$lobj"' \ |
||
1552 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
||
1553 | fi |
||
1554 | |||
1555 | # Allow error messages only from the first compilation. |
||
1556 | if test "$suppress_opt" = yes; then |
||
1557 | suppress_output=' >/dev/null 2>&1' |
||
1558 | fi |
||
1559 | fi |
||
1560 | |||
1561 | # Only build a position-dependent object if we build old libraries. |
||
1562 | if test "$build_old_libs" = yes; then |
||
1563 | if test "$pic_mode" != yes; then |
||
1564 | # Don't build PIC code |
||
1565 | command="$base_compile $qsrcfile$pie_flag" |
||
1566 | else |
||
1567 | command="$base_compile $qsrcfile $pic_flag" |
||
1568 | fi |
||
1569 | if test "$compiler_c_o" = yes; then |
||
1570 | command="$command -o $obj" |
||
1571 | fi |
||
1572 | |||
1573 | # Suppress compiler output if we already did a PIC compilation. |
||
1574 | command="$command$suppress_output" |
||
1575 | func_show_eval_locale "$command" \ |
||
1576 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' |
||
1577 | |||
1578 | if test "$need_locks" = warn && |
||
1579 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
||
1580 | $ECHO "\ |
||
1581 | *** ERROR, $lockfile contains: |
||
1582 | `cat $lockfile 2>/dev/null` |
||
1583 | |||
1584 | but it should contain: |
||
1585 | $srcfile |
||
1586 | |||
1587 | This indicates that another process is trying to use the same |
||
1588 | temporary object file, and libtool could not work around it because |
||
1589 | your compiler does not support \`-c' and \`-o' together. If you |
||
1590 | repeat this compilation, it may succeed, by chance, but you had better |
||
1591 | avoid parallel builds (make -j) in this platform, or get a better |
||
1592 | compiler." |
||
1593 | |||
1594 | $opt_dry_run || $RM $removelist |
||
1595 | exit $EXIT_FAILURE |
||
1596 | fi |
||
1597 | |||
1598 | # Just move the object if needed |
||
1599 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
||
1600 | func_show_eval '$MV "$output_obj" "$obj"' \ |
||
1601 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
||
1602 | fi |
||
1603 | fi |
||
1604 | |||
1605 | $opt_dry_run || { |
||
1606 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" |
||
1607 | |||
1608 | # Unlock the critical section if it was locked |
||
1609 | if test "$need_locks" != no; then |
||
1610 | removelist=$lockfile |
||
1611 | $RM "$lockfile" |
||
1612 | fi |
||
1613 | } |
||
1614 | |||
1615 | exit $EXIT_SUCCESS |
||
1616 | } |
||
1617 | |||
1618 | $opt_help || { |
||
1619 | test "$mode" = compile && func_mode_compile ${1+"$@"} |
||
1620 | } |
||
1621 | |||
1622 | func_mode_help () |
||
1623 | { |
||
1624 | # We need to display help for each of the modes. |
||
1625 | case $mode in |
||
1626 | "") |
||
1627 | # Generic help is extracted from the usage comments |
||
1628 | # at the start of this file. |
||
1629 | func_help |
||
1630 | ;; |
||
1631 | |||
1632 | clean) |
||
1633 | $ECHO \ |
||
1634 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
||
1635 | |||
1636 | Remove files from the build directory. |
||
1637 | |||
1638 | RM is the name of the program to use to delete files associated with each FILE |
||
1639 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
||
1640 | to RM. |
||
1641 | |||
1642 | If FILE is a libtool library, object or program, all the files associated |
||
1643 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
||
1644 | ;; |
||
1645 | |||
1646 | compile) |
||
1647 | $ECHO \ |
||
1648 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
||
1649 | |||
1650 | Compile a source file into a libtool library object. |
||
1651 | |||
1652 | This mode accepts the following additional options: |
||
1653 | |||
1654 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
||
1655 | -no-suppress do not suppress compiler output for multiple passes |
||
1656 | -prefer-pic try to build PIC objects only |
||
1657 | -prefer-non-pic try to build non-PIC objects only |
||
1658 | -shared do not build a \`.o' file suitable for static linking |
||
1659 | -static only build a \`.o' file suitable for static linking |
||
1660 | -Wc,FLAG pass FLAG directly to the compiler |
||
1661 | |||
1662 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
||
1663 | from the given SOURCEFILE. |
||
1664 | |||
1665 | The output file name is determined by removing the directory component from |
||
1666 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
||
1667 | library object suffix, \`.lo'." |
||
1668 | ;; |
||
1669 | |||
1670 | execute) |
||
1671 | $ECHO \ |
||
1672 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
||
1673 | |||
1674 | Automatically set library path, then run a program. |
||
1675 | |||
1676 | This mode accepts the following additional options: |
||
1677 | |||
1678 | -dlopen FILE add the directory containing FILE to the library path |
||
1679 | |||
1680 | This mode sets the library path environment variable according to \`-dlopen' |
||
1681 | flags. |
||
1682 | |||
1683 | If any of the ARGS are libtool executable wrappers, then they are translated |
||
1684 | into their corresponding uninstalled binary, and any of their required library |
||
1685 | directories are added to the library path. |
||
1686 | |||
1687 | Then, COMMAND is executed, with ARGS as arguments." |
||
1688 | ;; |
||
1689 | |||
1690 | finish) |
||
1691 | $ECHO \ |
||
1692 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
||
1693 | |||
1694 | Complete the installation of libtool libraries. |
||
1695 | |||
1696 | Each LIBDIR is a directory that contains libtool libraries. |
||
1697 | |||
1698 | The commands that this mode executes may require superuser privileges. Use |
||
1699 | the \`--dry-run' option if you just want to see what would be executed." |
||
1700 | ;; |
||
1701 | |||
1702 | install) |
||
1703 | $ECHO \ |
||
1704 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
||
1705 | |||
1706 | Install executables or libraries. |
||
1707 | |||
1708 | INSTALL-COMMAND is the installation command. The first component should be |
||
1709 | either the \`install' or \`cp' program. |
||
1710 | |||
1711 | The following components of INSTALL-COMMAND are treated specially: |
||
1712 | |||
1713 | -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation |
||
1714 | |||
1715 | The rest of the components are interpreted as arguments to that command (only |
||
1716 | BSD-compatible install options are recognized)." |
||
1717 | ;; |
||
1718 | |||
1719 | link) |
||
1720 | $ECHO \ |
||
1721 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
||
1722 | |||
1723 | Link object files or libraries together to form another library, or to |
||
1724 | create an executable program. |
||
1725 | |||
1726 | LINK-COMMAND is a command using the C compiler that you would use to create |
||
1727 | a program from several object files. |
||
1728 | |||
1729 | The following components of LINK-COMMAND are treated specially: |
||
1730 | |||
1731 | -all-static do not do any dynamic linking at all |
||
1732 | -avoid-version do not add a version suffix if possible |
||
1733 | -bindir BINDIR specify path to binaries directory (for systems where |
||
1734 | libraries must be found in the PATH setting at runtime) |
||
1735 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
||
1736 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
||
1737 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
||
1738 | -export-symbols SYMFILE |
||
1739 | try to export only the symbols listed in SYMFILE |
||
1740 | -export-symbols-regex REGEX |
||
1741 | try to export only the symbols matching REGEX |
||
1742 | -LLIBDIR search LIBDIR for required installed libraries |
||
1743 | -lNAME OUTPUT-FILE requires the installed library libNAME |
||
1744 | -module build a library that can dlopened |
||
1745 | -no-fast-install disable the fast-install mode |
||
1746 | -no-install link a not-installable executable |
||
1747 | -no-undefined declare that a library does not refer to external symbols |
||
1748 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
||
1749 | -objectlist FILE Use a list of object files found in FILE to specify objects |
||
1750 | -precious-files-regex REGEX |
||
1751 | don't remove output files matching REGEX |
||
1752 | -release RELEASE specify package release information |
||
1753 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
||
1754 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
||
1755 | -shared only do dynamic linking of libtool libraries |
||
1756 | -shrext SUFFIX override the standard shared library file extension |
||
1757 | -static do not do any dynamic linking of uninstalled libtool libraries |
||
1758 | -static-libtool-libs |
||
1759 | do not do any dynamic linking of libtool libraries |
||
1760 | -version-info CURRENT[:REVISION[:AGE]] |
||
1761 | specify library version info [each variable defaults to 0] |
||
1762 | -weak LIBNAME declare that the target provides the LIBNAME interface |
||
1763 | -Wc,FLAG |
||
1764 | -Xcompiler FLAG pass linker-specific FLAG directly to the compiler |
||
1765 | -Wl,FLAG |
||
1766 | -Xlinker FLAG pass linker-specific FLAG directly to the linker |
||
1767 | -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) |
||
1768 | |||
1769 | All other options (arguments beginning with \`-') are ignored. |
||
1770 | |||
1771 | Every other argument is treated as a filename. Files ending in \`.la' are |
||
1772 | treated as uninstalled libtool libraries, other files are standard or library |
||
1773 | object files. |
||
1774 | |||
1775 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
||
1776 | only library objects (\`.lo' files) may be specified, and \`-rpath' is |
||
1777 | required, except when creating a convenience library. |
||
1778 | |||
1779 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
||
1780 | using \`ar' and \`ranlib', or on Windows using \`lib'. |
||
1781 | |||
1782 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
||
1783 | is created, otherwise an executable program is created." |
||
1784 | ;; |
||
1785 | |||
1786 | uninstall) |
||
1787 | $ECHO \ |
||
1788 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
||
1789 | |||
1790 | Remove libraries from an installation directory. |
||
1791 | |||
1792 | RM is the name of the program to use to delete files associated with each FILE |
||
1793 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
||
1794 | to RM. |
||
1795 | |||
1796 | If FILE is a libtool library, all the files associated with it are deleted. |
||
1797 | Otherwise, only FILE itself is deleted using RM." |
||
1798 | ;; |
||
1799 | |||
1800 | *) |
||
1801 | func_fatal_help "invalid operation mode \`$mode'" |
||
1802 | ;; |
||
1803 | esac |
||
1804 | |||
1805 | echo |
||
1806 | $ECHO "Try \`$progname --help' for more information about other modes." |
||
1807 | } |
||
1808 | |||
1809 | # Now that we've collected a possible --mode arg, show help if necessary |
||
1810 | if $opt_help; then |
||
1811 | if test "$opt_help" = :; then |
||
1812 | func_mode_help |
||
1813 | else |
||
1814 | { |
||
1815 | func_help noexit |
||
1816 | for mode in compile link execute install finish uninstall clean; do |
||
1817 | func_mode_help |
||
1818 | done |
||
1819 | } | sed -n '1p; 2,$s/^Usage:/ or: /p' |
||
1820 | { |
||
1821 | func_help noexit |
||
1822 | for mode in compile link execute install finish uninstall clean; do |
||
1823 | echo |
||
1824 | func_mode_help |
||
1825 | done |
||
1826 | } | |
||
1827 | sed '1d |
||
1828 | /^When reporting/,/^Report/{ |
||
1829 | H |
||
1830 | d |
||
1831 | } |
||
1832 | $x |
||
1833 | /information about other modes/d |
||
1834 | /more detailed .*MODE/d |
||
1835 | s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' |
||
1836 | fi |
||
1837 | exit $? |
||
1838 | fi |
||
1839 | |||
1840 | |||
1841 | # func_mode_execute arg... |
||
1842 | func_mode_execute () |
||
1843 | { |
||
1844 | $opt_debug |
||
1845 | # The first argument is the command name. |
||
1846 | cmd="$nonopt" |
||
1847 | test -z "$cmd" && \ |
||
1848 | func_fatal_help "you must specify a COMMAND" |
||
1849 | |||
1850 | # Handle -dlopen flags immediately. |
||
1851 | for file in $execute_dlfiles; do |
||
1852 | test -f "$file" \ |
||
1853 | || func_fatal_help "\`$file' is not a file" |
||
1854 | |||
1855 | dir= |
||
1856 | case $file in |
||
1857 | *.la) |
||
1858 | # Check to see that this really is a libtool archive. |
||
1859 | func_lalib_unsafe_p "$file" \ |
||
1860 | || func_fatal_help "\`$lib' is not a valid libtool archive" |
||
1861 | |||
1862 | # Read the libtool library. |
||
1863 | dlname= |
||
1864 | library_names= |
||
1865 | func_source "$file" |
||
1866 | |||
1867 | # Skip this library if it cannot be dlopened. |
||
1868 | if test -z "$dlname"; then |
||
1869 | # Warn if it was a shared library. |
||
1870 | test -n "$library_names" && \ |
||
1871 | func_warning "\`$file' was not linked with \`-export-dynamic'" |
||
1872 | continue |
||
1873 | fi |
||
1874 | |||
1875 | func_dirname "$file" "" "." |
||
1876 | dir="$func_dirname_result" |
||
1877 | |||
1878 | if test -f "$dir/$objdir/$dlname"; then |
||
1879 | dir="$dir/$objdir" |
||
1880 | else |
||
1881 | if test ! -f "$dir/$dlname"; then |
||
1882 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" |
||
1883 | fi |
||
1884 | fi |
||
1885 | ;; |
||
1886 | |||
1887 | *.lo) |
||
1888 | # Just add the directory containing the .lo file. |
||
1889 | func_dirname "$file" "" "." |
||
1890 | dir="$func_dirname_result" |
||
1891 | ;; |
||
1892 | |||
1893 | *) |
||
1894 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" |
||
1895 | continue |
||
1896 | ;; |
||
1897 | esac |
||
1898 | |||
1899 | # Get the absolute pathname. |
||
1900 | absdir=`cd "$dir" && pwd` |
||
1901 | test -n "$absdir" && dir="$absdir" |
||
1902 | |||
1903 | # Now add the directory to shlibpath_var. |
||
1904 | if eval "test -z \"\$$shlibpath_var\""; then |
||
1905 | eval "$shlibpath_var=\"\$dir\"" |
||
1906 | else |
||
1907 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
||
1908 | fi |
||
1909 | done |
||
1910 | |||
1911 | # This variable tells wrapper scripts just to set shlibpath_var |
||
1912 | # rather than running their programs. |
||
1913 | libtool_execute_magic="$magic" |
||
1914 | |||
1915 | # Check if any of the arguments is a wrapper script. |
||
1916 | args= |
||
1917 | for file |
||
1918 | do |
||
1919 | case $file in |
||
1920 | -* | *.la | *.lo ) ;; |
||
1921 | *) |
||
1922 | # Do a test to see if this is really a libtool program. |
||
1923 | if func_ltwrapper_script_p "$file"; then |
||
1924 | func_source "$file" |
||
1925 | # Transform arg to wrapped name. |
||
1926 | file="$progdir/$program" |
||
1927 | elif func_ltwrapper_executable_p "$file"; then |
||
1928 | func_ltwrapper_scriptname "$file" |
||
1929 | func_source "$func_ltwrapper_scriptname_result" |
||
1930 | # Transform arg to wrapped name. |
||
1931 | file="$progdir/$program" |
||
1932 | fi |
||
1933 | ;; |
||
1934 | esac |
||
1935 | # Quote arguments (to preserve shell metacharacters). |
||
1936 | func_quote_for_eval "$file" |
||
1937 | args="$args $func_quote_for_eval_result" |
||
1938 | done |
||
1939 | |||
1940 | if test "X$opt_dry_run" = Xfalse; then |
||
1941 | if test -n "$shlibpath_var"; then |
||
1942 | # Export the shlibpath_var. |
||
1943 | eval "export $shlibpath_var" |
||
1944 | fi |
||
1945 | |||
1946 | # Restore saved environment variables |
||
1947 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
||
1948 | do |
||
1949 | eval "if test \"\${save_$lt_var+set}\" = set; then |
||
1950 | $lt_var=\$save_$lt_var; export $lt_var |
||
1951 | else |
||
1952 | $lt_unset $lt_var |
||
1953 | fi" |
||
1954 | done |
||
1955 | |||
1956 | # Now prepare to actually exec the command. |
||
1957 | exec_cmd="\$cmd$args" |
||
1958 | else |
||
1959 | # Display what would be done. |
||
1960 | if test -n "$shlibpath_var"; then |
||
1961 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
||
1962 | echo "export $shlibpath_var" |
||
1963 | fi |
||
1964 | $ECHO "$cmd$args" |
||
1965 | exit $EXIT_SUCCESS |
||
1966 | fi |
||
1967 | } |
||
1968 | |||
1969 | test "$mode" = execute && func_mode_execute ${1+"$@"} |
||
1970 | |||
1971 | |||
1972 | # func_mode_finish arg... |
||
1973 | func_mode_finish () |
||
1974 | { |
||
1975 | $opt_debug |
||
1976 | libdirs="$nonopt" |
||
1977 | admincmds= |
||
1978 | |||
1979 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
||
1980 | for dir |
||
1981 | do |
||
1982 | libdirs="$libdirs $dir" |
||
1983 | done |
||
1984 | |||
1985 | for libdir in $libdirs; do |
||
1986 | if test -n "$finish_cmds"; then |
||
1987 | # Do each command in the finish commands. |
||
1988 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds |
||
1989 | '"$cmd"'"' |
||
1990 | fi |
||
1991 | if test -n "$finish_eval"; then |
||
1992 | # Do the single finish_eval. |
||
1993 | eval cmds=\"$finish_eval\" |
||
1994 | $opt_dry_run || eval "$cmds" || admincmds="$admincmds |
||
1995 | $cmds" |
||
1996 | fi |
||
1997 | done |
||
1998 | fi |
||
1999 | |||
2000 | # Exit here if they wanted silent mode. |
||
2001 | $opt_silent && exit $EXIT_SUCCESS |
||
2002 | |||
2003 | echo "----------------------------------------------------------------------" |
||
2004 | echo "Libraries have been installed in:" |
||
2005 | for libdir in $libdirs; do |
||
2006 | $ECHO " $libdir" |
||
2007 | done |
||
2008 | echo |
||
2009 | echo "If you ever happen to want to link against installed libraries" |
||
2010 | echo "in a given directory, LIBDIR, you must either use libtool, and" |
||
2011 | echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
||
2012 | echo "flag during linking and do at least one of the following:" |
||
2013 | if test -n "$shlibpath_var"; then |
||
2014 | echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
||
2015 | echo " during execution" |
||
2016 | fi |
||
2017 | if test -n "$runpath_var"; then |
||
2018 | echo " - add LIBDIR to the \`$runpath_var' environment variable" |
||
2019 | echo " during linking" |
||
2020 | fi |
||
2021 | if test -n "$hardcode_libdir_flag_spec"; then |
||
2022 | libdir=LIBDIR |
||
2023 | eval flag=\"$hardcode_libdir_flag_spec\" |
||
2024 | |||
2025 | $ECHO " - use the \`$flag' linker flag" |
||
2026 | fi |
||
2027 | if test -n "$admincmds"; then |
||
2028 | $ECHO " - have your system administrator run these commands:$admincmds" |
||
2029 | fi |
||
2030 | if test -f /etc/ld.so.conf; then |
||
2031 | echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
||
2032 | fi |
||
2033 | echo |
||
2034 | |||
2035 | echo "See any operating system documentation about shared libraries for" |
||
2036 | case $host in |
||
2037 | solaris2.[6789]|solaris2.1[0-9]) |
||
2038 | echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
||
2039 | echo "pages." |
||
2040 | ;; |
||
2041 | *) |
||
2042 | echo "more information, such as the ld(1) and ld.so(8) manual pages." |
||
2043 | ;; |
||
2044 | esac |
||
2045 | echo "----------------------------------------------------------------------" |
||
2046 | exit $EXIT_SUCCESS |
||
2047 | } |
||
2048 | |||
2049 | test "$mode" = finish && func_mode_finish ${1+"$@"} |
||
2050 | |||
2051 | |||
2052 | # func_mode_install arg... |
||
2053 | func_mode_install () |
||
2054 | { |
||
2055 | $opt_debug |
||
2056 | # There may be an optional sh(1) argument at the beginning of |
||
2057 | # install_prog (especially on Windows NT). |
||
2058 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
||
2059 | # Allow the use of GNU shtool's install command. |
||
2060 | case $nonopt in *shtool*) :;; *) false;; esac; then |
||
2061 | # Aesthetically quote it. |
||
2062 | func_quote_for_eval "$nonopt" |
||
2063 | install_prog="$func_quote_for_eval_result " |
||
2064 | arg=$1 |
||
2065 | shift |
||
2066 | else |
||
2067 | install_prog= |
||
2068 | arg=$nonopt |
||
2069 | fi |
||
2070 | |||
2071 | # The real first argument should be the name of the installation program. |
||
2072 | # Aesthetically quote it. |
||
2073 | func_quote_for_eval "$arg" |
||
2074 | install_prog="$install_prog$func_quote_for_eval_result" |
||
2075 | install_shared_prog=$install_prog |
||
2076 | case " $install_prog " in |
||
2077 | *[\\\ /]cp\ *) install_cp=: ;; |
||
2078 | *) install_cp=false ;; |
||
2079 | esac |
||
2080 | |||
2081 | # We need to accept at least all the BSD install flags. |
||
2082 | dest= |
||
2083 | files= |
||
2084 | opts= |
||
2085 | prev= |
||
2086 | install_type= |
||
2087 | isdir=no |
||
2088 | stripme= |
||
2089 | no_mode=: |
||
2090 | for arg |
||
2091 | do |
||
2092 | arg2= |
||
2093 | if test -n "$dest"; then |
||
2094 | files="$files $dest" |
||
2095 | dest=$arg |
||
2096 | continue |
||
2097 | fi |
||
2098 | |||
2099 | case $arg in |
||
2100 | -d) isdir=yes ;; |
||
2101 | -f) |
||
2102 | if $install_cp; then :; else |
||
2103 | prev=$arg |
||
2104 | fi |
||
2105 | ;; |
||
2106 | -g | -m | -o) |
||
2107 | prev=$arg |
||
2108 | ;; |
||
2109 | -s) |
||
2110 | stripme=" -s" |
||
2111 | continue |
||
2112 | ;; |
||
2113 | -*) |
||
2114 | ;; |
||
2115 | *) |
||
2116 | # If the previous option needed an argument, then skip it. |
||
2117 | if test -n "$prev"; then |
||
2118 | if test "x$prev" = x-m && test -n "$install_override_mode"; then |
||
2119 | arg2=$install_override_mode |
||
2120 | no_mode=false |
||
2121 | fi |
||
2122 | prev= |
||
2123 | else |
||
2124 | dest=$arg |
||
2125 | continue |
||
2126 | fi |
||
2127 | ;; |
||
2128 | esac |
||
2129 | |||
2130 | # Aesthetically quote the argument. |
||
2131 | func_quote_for_eval "$arg" |
||
2132 | install_prog="$install_prog $func_quote_for_eval_result" |
||
2133 | if test -n "$arg2"; then |
||
2134 | func_quote_for_eval "$arg2" |
||
2135 | fi |
||
2136 | install_shared_prog="$install_shared_prog $func_quote_for_eval_result" |
||
2137 | done |
||
2138 | |||
2139 | test -z "$install_prog" && \ |
||
2140 | func_fatal_help "you must specify an install program" |
||
2141 | |||
2142 | test -n "$prev" && \ |
||
2143 | func_fatal_help "the \`$prev' option requires an argument" |
||
2144 | |||
2145 | if test -n "$install_override_mode" && $no_mode; then |
||
2146 | if $install_cp; then :; else |
||
2147 | func_quote_for_eval "$install_override_mode" |
||
2148 | install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" |
||
2149 | fi |
||
2150 | fi |
||
2151 | |||
2152 | if test -z "$files"; then |
||
2153 | if test -z "$dest"; then |
||
2154 | func_fatal_help "no file or destination specified" |
||
2155 | else |
||
2156 | func_fatal_help "you must specify a destination" |
||
2157 | fi |
||
2158 | fi |
||
2159 | |||
2160 | # Strip any trailing slash from the destination. |
||
2161 | func_stripname '' '/' "$dest" |
||
2162 | dest=$func_stripname_result |
||
2163 | |||
2164 | # Check to see that the destination is a directory. |
||
2165 | test -d "$dest" && isdir=yes |
||
2166 | if test "$isdir" = yes; then |
||
2167 | destdir="$dest" |
||
2168 | destname= |
||
2169 | else |
||
2170 | func_dirname_and_basename "$dest" "" "." |
||
2171 | destdir="$func_dirname_result" |
||
2172 | destname="$func_basename_result" |
||
2173 | |||
2174 | # Not a directory, so check to see that there is only one file specified. |
||
2175 | set dummy $files; shift |
||
2176 | test "$#" -gt 1 && \ |
||
2177 | func_fatal_help "\`$dest' is not a directory" |
||
2178 | fi |
||
2179 | case $destdir in |
||
2180 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
||
2181 | *) |
||
2182 | for file in $files; do |
||
2183 | case $file in |
||
2184 | *.lo) ;; |
||
2185 | *) |
||
2186 | func_fatal_help "\`$destdir' must be an absolute directory name" |
||
2187 | ;; |
||
2188 | esac |
||
2189 | done |
||
2190 | ;; |
||
2191 | esac |
||
2192 | |||
2193 | # This variable tells wrapper scripts just to set variables rather |
||
2194 | # than running their programs. |
||
2195 | libtool_install_magic="$magic" |
||
2196 | |||
2197 | staticlibs= |
||
2198 | future_libdirs= |
||
2199 | current_libdirs= |
||
2200 | for file in $files; do |
||
2201 | |||
2202 | # Do each installation. |
||
2203 | case $file in |
||
2204 | *.$libext) |
||
2205 | # Do the static libraries later. |
||
2206 | staticlibs="$staticlibs $file" |
||
2207 | ;; |
||
2208 | |||
2209 | *.la) |
||
2210 | # Check to see that this really is a libtool archive. |
||
2211 | func_lalib_unsafe_p "$file" \ |
||
2212 | || func_fatal_help "\`$file' is not a valid libtool archive" |
||
2213 | |||
2214 | library_names= |
||
2215 | old_library= |
||
2216 | relink_command= |
||
2217 | func_source "$file" |
||
2218 | |||
2219 | # Add the libdir to current_libdirs if it is the destination. |
||
2220 | if test "X$destdir" = "X$libdir"; then |
||
2221 | case "$current_libdirs " in |
||
2222 | *" $libdir "*) ;; |
||
2223 | *) current_libdirs="$current_libdirs $libdir" ;; |
||
2224 | esac |
||
2225 | else |
||
2226 | # Note the libdir as a future libdir. |
||
2227 | case "$future_libdirs " in |
||
2228 | *" $libdir "*) ;; |
||
2229 | *) future_libdirs="$future_libdirs $libdir" ;; |
||
2230 | esac |
||
2231 | fi |
||
2232 | |||
2233 | func_dirname "$file" "/" "" |
||
2234 | dir="$func_dirname_result" |
||
2235 | dir="$dir$objdir" |
||
2236 | |||
2237 | if test -n "$relink_command"; then |
||
2238 | # Determine the prefix the user has applied to our future dir. |
||
2239 | inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` |
||
2240 | |||
2241 | # Don't allow the user to place us outside of our expected |
||
2242 | # location b/c this prevents finding dependent libraries that |
||
2243 | # are installed to the same prefix. |
||
2244 | # At present, this check doesn't affect windows .dll's that |
||
2245 | # are installed into $libdir/../bin (currently, that works fine) |
||
2246 | # but it's something to keep an eye on. |
||
2247 | test "$inst_prefix_dir" = "$destdir" && \ |
||
2248 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" |
||
2249 | |||
2250 | if test -n "$inst_prefix_dir"; then |
||
2251 | # Stick the inst_prefix_dir data into the link command. |
||
2252 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
||
2253 | else |
||
2254 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
||
2255 | fi |
||
2256 | |||
2257 | func_warning "relinking \`$file'" |
||
2258 | func_show_eval "$relink_command" \ |
||
2259 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' |
||
2260 | fi |
||
2261 | |||
2262 | # See the names of the shared library. |
||
2263 | set dummy $library_names; shift |
||
2264 | if test -n "$1"; then |
||
2265 | realname="$1" |
||
2266 | shift |
||
2267 | |||
2268 | srcname="$realname" |
||
2269 | test -n "$relink_command" && srcname="$realname"T |
||
2270 | |||
2271 | # Install the shared library and build the symlinks. |
||
2272 | func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ |
||
2273 | 'exit $?' |
||
2274 | tstripme="$stripme" |
||
2275 | case $host_os in |
||
2276 | cygwin* | mingw* | pw32* | cegcc*) |
||
2277 | case $realname in |
||
2278 | *.dll.a) |
||
2279 | tstripme="" |
||
2280 | ;; |
||
2281 | esac |
||
2282 | ;; |
||
2283 | esac |
||
2284 | if test -n "$tstripme" && test -n "$striplib"; then |
||
2285 | func_show_eval "$striplib $destdir/$realname" 'exit $?' |
||
2286 | fi |
||
2287 | |||
2288 | if test "$#" -gt 0; then |
||
2289 | # Delete the old symlinks, and create new ones. |
||
2290 | # Try `ln -sf' first, because the `ln' binary might depend on |
||
2291 | # the symlink we replace! Solaris /bin/ln does not understand -f, |
||
2292 | # so we also need to try rm && ln -s. |
||
2293 | for linkname |
||
2294 | do |
||
2295 | test "$linkname" != "$realname" \ |
||
2296 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
||
2297 | done |
||
2298 | fi |
||
2299 | |||
2300 | # Do each command in the postinstall commands. |
||
2301 | lib="$destdir/$realname" |
||
2302 | func_execute_cmds "$postinstall_cmds" 'exit $?' |
||
2303 | fi |
||
2304 | |||
2305 | # Install the pseudo-library for information purposes. |
||
2306 | func_basename "$file" |
||
2307 | name="$func_basename_result" |
||
2308 | instname="$dir/$name"i |
||
2309 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' |
||
2310 | |||
2311 | # Maybe install the static library, too. |
||
2312 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" |
||
2313 | ;; |
||
2314 | |||
2315 | *.lo) |
||
2316 | # Install (i.e. copy) a libtool object. |
||
2317 | |||
2318 | # Figure out destination file name, if it wasn't already specified. |
||
2319 | if test -n "$destname"; then |
||
2320 | destfile="$destdir/$destname" |
||
2321 | else |
||
2322 | func_basename "$file" |
||
2323 | destfile="$func_basename_result" |
||
2324 | destfile="$destdir/$destfile" |
||
2325 | fi |
||
2326 | |||
2327 | # Deduce the name of the destination old-style object file. |
||
2328 | case $destfile in |
||
2329 | *.lo) |
||
2330 | func_lo2o "$destfile" |
||
2331 | staticdest=$func_lo2o_result |
||
2332 | ;; |
||
2333 | *.$objext) |
||
2334 | staticdest="$destfile" |
||
2335 | destfile= |
||
2336 | ;; |
||
2337 | *) |
||
2338 | func_fatal_help "cannot copy a libtool object to \`$destfile'" |
||
2339 | ;; |
||
2340 | esac |
||
2341 | |||
2342 | # Install the libtool object if requested. |
||
2343 | test -n "$destfile" && \ |
||
2344 | func_show_eval "$install_prog $file $destfile" 'exit $?' |
||
2345 | |||
2346 | # Install the old object if enabled. |
||
2347 | if test "$build_old_libs" = yes; then |
||
2348 | # Deduce the name of the old-style object file. |
||
2349 | func_lo2o "$file" |
||
2350 | staticobj=$func_lo2o_result |
||
2351 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' |
||
2352 | fi |
||
2353 | exit $EXIT_SUCCESS |
||
2354 | ;; |
||
2355 | |||
2356 | *) |
||
2357 | # Figure out destination file name, if it wasn't already specified. |
||
2358 | if test -n "$destname"; then |
||
2359 | destfile="$destdir/$destname" |
||
2360 | else |
||
2361 | func_basename "$file" |
||
2362 | destfile="$func_basename_result" |
||
2363 | destfile="$destdir/$destfile" |
||
2364 | fi |
||
2365 | |||
2366 | # If the file is missing, and there is a .exe on the end, strip it |
||
2367 | # because it is most likely a libtool script we actually want to |
||
2368 | # install |
||
2369 | stripped_ext="" |
||
2370 | case $file in |
||
2371 | *.exe) |
||
2372 | if test ! -f "$file"; then |
||
2373 | func_stripname '' '.exe' "$file" |
||
2374 | file=$func_stripname_result |
||
2375 | stripped_ext=".exe" |
||
2376 | fi |
||
2377 | ;; |
||
2378 | esac |
||
2379 | |||
2380 | # Do a test to see if this is really a libtool program. |
||
2381 | case $host in |
||
2382 | *cygwin* | *mingw*) |
||
2383 | if func_ltwrapper_executable_p "$file"; then |
||
2384 | func_ltwrapper_scriptname "$file" |
||
2385 | wrapper=$func_ltwrapper_scriptname_result |
||
2386 | else |
||
2387 | func_stripname '' '.exe' "$file" |
||
2388 | wrapper=$func_stripname_result |
||
2389 | fi |
||
2390 | ;; |
||
2391 | *) |
||
2392 | wrapper=$file |
||
2393 | ;; |
||
2394 | esac |
||
2395 | if func_ltwrapper_script_p "$wrapper"; then |
||
2396 | notinst_deplibs= |
||
2397 | relink_command= |
||
2398 | |||
2399 | func_source "$wrapper" |
||
2400 | |||
2401 | # Check the variables that should have been set. |
||
2402 | test -z "$generated_by_libtool_version" && \ |
||
2403 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" |
||
2404 | |||
2405 | finalize=yes |
||
2406 | for lib in $notinst_deplibs; do |
||
2407 | # Check to see that each library is installed. |
||
2408 | libdir= |
||
2409 | if test -f "$lib"; then |
||
2410 | func_source "$lib" |
||
2411 | fi |
||
2412 | libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test |
||
2413 | if test -n "$libdir" && test ! -f "$libfile"; then |
||
2414 | func_warning "\`$lib' has not been installed in \`$libdir'" |
||
2415 | finalize=no |
||
2416 | fi |
||
2417 | done |
||
2418 | |||
2419 | relink_command= |
||
2420 | func_source "$wrapper" |
||
2421 | |||
2422 | outputname= |
||
2423 | if test "$fast_install" = no && test -n "$relink_command"; then |
||
2424 | $opt_dry_run || { |
||
2425 | if test "$finalize" = yes; then |
||
2426 | tmpdir=`func_mktempdir` |
||
2427 | func_basename "$file$stripped_ext" |
||
2428 | file="$func_basename_result" |
||
2429 | outputname="$tmpdir/$file" |
||
2430 | # Replace the output file specification. |
||
2431 | relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` |
||
2432 | |||
2433 | $opt_silent || { |
||
2434 | func_quote_for_expand "$relink_command" |
||
2435 | eval "func_echo $func_quote_for_expand_result" |
||
2436 | } |
||
2437 | if eval "$relink_command"; then : |
||
2438 | else |
||
2439 | func_error "error: relink \`$file' with the above command before installing it" |
||
2440 | $opt_dry_run || ${RM}r "$tmpdir" |
||
2441 | continue |
||
2442 | fi |
||
2443 | file="$outputname" |
||
2444 | else |
||
2445 | func_warning "cannot relink \`$file'" |
||
2446 | fi |
||
2447 | } |
||
2448 | else |
||
2449 | # Install the binary that we compiled earlier. |
||
2450 | file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` |
||
2451 | fi |
||
2452 | fi |
||
2453 | |||
2454 | # remove .exe since cygwin /usr/bin/install will append another |
||
2455 | # one anyway |
||
2456 | case $install_prog,$host in |
||
2457 | */usr/bin/install*,*cygwin*) |
||
2458 | case $file:$destfile in |
||
2459 | *.exe:*.exe) |
||
2460 | # this is ok |
||
2461 | ;; |
||
2462 | *.exe:*) |
||
2463 | destfile=$destfile.exe |
||
2464 | ;; |
||
2465 | *:*.exe) |
||
2466 | func_stripname '' '.exe' "$destfile" |
||
2467 | destfile=$func_stripname_result |
||
2468 | ;; |
||
2469 | esac |
||
2470 | ;; |
||
2471 | esac |
||
2472 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' |
||
2473 | $opt_dry_run || if test -n "$outputname"; then |
||
2474 | ${RM}r "$tmpdir" |
||
2475 | fi |
||
2476 | ;; |
||
2477 | esac |
||
2478 | done |
||
2479 | |||
2480 | for file in $staticlibs; do |
||
2481 | func_basename "$file" |
||
2482 | name="$func_basename_result" |
||
2483 | |||
2484 | # Set up the ranlib parameters. |
||
2485 | oldlib="$destdir/$name" |
||
2486 | |||
2487 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' |
||
2488 | |||
2489 | if test -n "$stripme" && test -n "$old_striplib"; then |
||
2490 | func_show_eval "$old_striplib $oldlib" 'exit $?' |
||
2491 | fi |
||
2492 | |||
2493 | # Do each command in the postinstall commands. |
||
2494 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' |
||
2495 | done |
||
2496 | |||
2497 | test -n "$future_libdirs" && \ |
||
2498 | func_warning "remember to run \`$progname --finish$future_libdirs'" |
||
2499 | |||
2500 | if test -n "$current_libdirs"; then |
||
2501 | # Maybe just do a dry run. |
||
2502 | $opt_dry_run && current_libdirs=" -n$current_libdirs" |
||
2503 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
||
2504 | else |
||
2505 | exit $EXIT_SUCCESS |
||
2506 | fi |
||
2507 | } |
||
2508 | |||
2509 | test "$mode" = install && func_mode_install ${1+"$@"} |
||
2510 | |||
2511 | |||
2512 | # func_generate_dlsyms outputname originator pic_p |
||
2513 | # Extract symbols from dlprefiles and create ${outputname}S.o with |
||
2514 | # a dlpreopen symbol table. |
||
2515 | func_generate_dlsyms () |
||
2516 | { |
||
2517 | $opt_debug |
||
2518 | my_outputname="$1" |
||
2519 | my_originator="$2" |
||
2520 | my_pic_p="${3-no}" |
||
2521 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` |
||
2522 | my_dlsyms= |
||
2523 | |||
2524 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
||
2525 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
||
2526 | my_dlsyms="${my_outputname}S.c" |
||
2527 | else |
||
2528 | func_error "not configured to extract global symbols from dlpreopened files" |
||
2529 | fi |
||
2530 | fi |
||
2531 | |||
2532 | if test -n "$my_dlsyms"; then |
||
2533 | case $my_dlsyms in |
||
2534 | "") ;; |
||
2535 | *.c) |
||
2536 | # Discover the nlist of each of the dlfiles. |
||
2537 | nlist="$output_objdir/${my_outputname}.nm" |
||
2538 | |||
2539 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
||
2540 | |||
2541 | # Parse the name list into a source file. |
||
2542 | func_verbose "creating $output_objdir/$my_dlsyms" |
||
2543 | |||
2544 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
||
2545 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ |
||
2546 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ |
||
2547 | |||
2548 | #ifdef __cplusplus |
||
2549 | extern \"C\" { |
||
2550 | #endif |
||
2551 | |||
2552 | #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) |
||
2553 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" |
||
2554 | #endif |
||
2555 | |||
2556 | /* External symbol declarations for the compiler. */\ |
||
2557 | " |
||
2558 | |||
2559 | if test "$dlself" = yes; then |
||
2560 | func_verbose "generating symbol list for \`$output'" |
||
2561 | |||
2562 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
||
2563 | |||
2564 | # Add our own program objects to the symbol list. |
||
2565 | progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
||
2566 | for progfile in $progfiles; do |
||
2567 | func_verbose "extracting global C symbols from \`$progfile'" |
||
2568 | $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" |
||
2569 | done |
||
2570 | |||
2571 | if test -n "$exclude_expsyms"; then |
||
2572 | $opt_dry_run || { |
||
2573 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
||
2574 | eval '$MV "$nlist"T "$nlist"' |
||
2575 | } |
||
2576 | fi |
||
2577 | |||
2578 | if test -n "$export_symbols_regex"; then |
||
2579 | $opt_dry_run || { |
||
2580 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
||
2581 | eval '$MV "$nlist"T "$nlist"' |
||
2582 | } |
||
2583 | fi |
||
2584 | |||
2585 | # Prepare the list of exported symbols |
||
2586 | if test -z "$export_symbols"; then |
||
2587 | export_symbols="$output_objdir/$outputname.exp" |
||
2588 | $opt_dry_run || { |
||
2589 | $RM $export_symbols |
||
2590 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
||
2591 | case $host in |
||
2592 | *cygwin* | *mingw* | *cegcc* ) |
||
2593 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
||
2594 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
||
2595 | ;; |
||
2596 | esac |
||
2597 | } |
||
2598 | else |
||
2599 | $opt_dry_run || { |
||
2600 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
||
2601 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
||
2602 | eval '$MV "$nlist"T "$nlist"' |
||
2603 | case $host in |
||
2604 | *cygwin* | *mingw* | *cegcc* ) |
||
2605 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
||
2606 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
||
2607 | ;; |
||
2608 | esac |
||
2609 | } |
||
2610 | fi |
||
2611 | fi |
||
2612 | |||
2613 | for dlprefile in $dlprefiles; do |
||
2614 | func_verbose "extracting global C symbols from \`$dlprefile'" |
||
2615 | func_basename "$dlprefile" |
||
2616 | name="$func_basename_result" |
||
2617 | $opt_dry_run || { |
||
2618 | eval '$ECHO ": $name " >> "$nlist"' |
||
2619 | eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
||
2620 | } |
||
2621 | done |
||
2622 | |||
2623 | $opt_dry_run || { |
||
2624 | # Make sure we have at least an empty file. |
||
2625 | test -f "$nlist" || : > "$nlist" |
||
2626 | |||
2627 | if test -n "$exclude_expsyms"; then |
||
2628 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
||
2629 | $MV "$nlist"T "$nlist" |
||
2630 | fi |
||
2631 | |||
2632 | # Try sorting and uniquifying the output. |
||
2633 | if $GREP -v "^: " < "$nlist" | |
||
2634 | if sort -k 3 /dev/null 2>&1; then |
||
2635 | sort -k 3 |
||
2636 | else |
||
2637 | sort +2 |
||
2638 | fi | |
||
2639 | uniq > "$nlist"S; then |
||
2640 | : |
||
2641 | else |
||
2642 | $GREP -v "^: " < "$nlist" > "$nlist"S |
||
2643 | fi |
||
2644 | |||
2645 | if test -f "$nlist"S; then |
||
2646 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
||
2647 | else |
||
2648 | echo '/* NONE */' >> "$output_objdir/$my_dlsyms" |
||
2649 | fi |
||
2650 | |||
2651 | echo >> "$output_objdir/$my_dlsyms" "\ |
||
2652 | |||
2653 | /* The mapping between symbol names and symbols. */ |
||
2654 | typedef struct { |
||
2655 | const char *name; |
||
2656 | void *address; |
||
2657 | } lt_dlsymlist; |
||
2658 | " |
||
2659 | case $host in |
||
2660 | *cygwin* | *mingw* | *cegcc* ) |
||
2661 | echo >> "$output_objdir/$my_dlsyms" "\ |
||
2662 | /* DATA imports from DLLs on WIN32 con't be const, because |
||
2663 | runtime relocations are performed -- see ld's documentation |
||
2664 | on pseudo-relocs. */" |
||
2665 | lt_dlsym_const= ;; |
||
2666 | *osf5*) |
||
2667 | echo >> "$output_objdir/$my_dlsyms" "\ |
||
2668 | /* This system does not cope well with relocations in const data */" |
||
2669 | lt_dlsym_const= ;; |
||
2670 | *) |
||
2671 | lt_dlsym_const=const ;; |
||
2672 | esac |
||
2673 | |||
2674 | echo >> "$output_objdir/$my_dlsyms" "\ |
||
2675 | extern $lt_dlsym_const lt_dlsymlist |
||
2676 | lt_${my_prefix}_LTX_preloaded_symbols[]; |
||
2677 | $lt_dlsym_const lt_dlsymlist |
||
2678 | lt_${my_prefix}_LTX_preloaded_symbols[] = |
||
2679 | {\ |
||
2680 | { \"$my_originator\", (void *) 0 }," |
||
2681 | |||
2682 | case $need_lib_prefix in |
||
2683 | no) |
||
2684 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
||
2685 | ;; |
||
2686 | *) |
||
2687 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
||
2688 | ;; |
||
2689 | esac |
||
2690 | echo >> "$output_objdir/$my_dlsyms" "\ |
||
2691 | {0, (void *) 0} |
||
2692 | }; |
||
2693 | |||
2694 | /* This works around a problem in FreeBSD linker */ |
||
2695 | #ifdef FREEBSD_WORKAROUND |
||
2696 | static const void *lt_preloaded_setup() { |
||
2697 | return lt_${my_prefix}_LTX_preloaded_symbols; |
||
2698 | } |
||
2699 | #endif |
||
2700 | |||
2701 | #ifdef __cplusplus |
||
2702 | } |
||
2703 | #endif\ |
||
2704 | " |
||
2705 | } # !$opt_dry_run |
||
2706 | |||
2707 | pic_flag_for_symtable= |
||
2708 | case "$compile_command " in |
||
2709 | *" -static "*) ;; |
||
2710 | *) |
||
2711 | case $host in |
||
2712 | # compiling the symbol table file with pic_flag works around |
||
2713 | # a FreeBSD bug that causes programs to crash when -lm is |
||
2714 | # linked before any other PIC object. But we must not use |
||
2715 | # pic_flag when linking with -static. The problem exists in |
||
2716 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
||
2717 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
||
2718 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; |
||
2719 | *-*-hpux*) |
||
2720 | pic_flag_for_symtable=" $pic_flag" ;; |
||
2721 | *) |
||
2722 | if test "X$my_pic_p" != Xno; then |
||
2723 | pic_flag_for_symtable=" $pic_flag" |
||
2724 | fi |
||
2725 | ;; |
||
2726 | esac |
||
2727 | ;; |
||
2728 | esac |
||
2729 | symtab_cflags= |
||
2730 | for arg in $LTCFLAGS; do |
||
2731 | case $arg in |
||
2732 | -pie | -fpie | -fPIE) ;; |
||
2733 | *) symtab_cflags="$symtab_cflags $arg" ;; |
||
2734 | esac |
||
2735 | done |
||
2736 | |||
2737 | # Now compile the dynamic symbol file. |
||
2738 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' |
||
2739 | |||
2740 | # Clean up the generated files. |
||
2741 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' |
||
2742 | |||
2743 | # Transform the symbol file into the correct name. |
||
2744 | symfileobj="$output_objdir/${my_outputname}S.$objext" |
||
2745 | case $host in |
||
2746 | *cygwin* | *mingw* | *cegcc* ) |
||
2747 | if test -f "$output_objdir/$my_outputname.def"; then |
||
2748 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
||
2749 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
||
2750 | else |
||
2751 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
||
2752 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
||
2753 | fi |
||
2754 | ;; |
||
2755 | *) |
||
2756 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
||
2757 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` |
||
2758 | ;; |
||
2759 | esac |
||
2760 | ;; |
||
2761 | *) |
||
2762 | func_fatal_error "unknown suffix for \`$my_dlsyms'" |
||
2763 | ;; |
||
2764 | esac |
||
2765 | else |
||
2766 | # We keep going just in case the user didn't refer to |
||
2767 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
||
2768 | # really was required. |
||
2769 | |||
2770 | # Nullify the symbol file. |
||
2771 | compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` |
||
2772 | finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` |
||
2773 | fi |
||
2774 | } |
||
2775 | |||
2776 | # func_win32_libid arg |
||
2777 | # return the library type of file 'arg' |
||
2778 | # |
||
2779 | # Need a lot of goo to handle *both* DLLs and import libs |
||
2780 | # Has to be a shell function in order to 'eat' the argument |
||
2781 | # that is supplied when $file_magic_command is called. |
||
2782 | # Despite the name, also deal with 64 bit binaries. |
||
2783 | func_win32_libid () |
||
2784 | { |
||
2785 | $opt_debug |
||
2786 | win32_libid_type="unknown" |
||
2787 | win32_fileres=`file -L $1 2>/dev/null` |
||
2788 | case $win32_fileres in |
||
2789 | *ar\ archive\ import\ library*) # definitely import |
||
2790 | win32_libid_type="x86 archive import" |
||
2791 | ;; |
||
2792 | *ar\ archive*) # could be an import, or static |
||
2793 | # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. |
||
2794 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
||
2795 | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then |
||
2796 | win32_nmres=`eval $NM -f posix -A $1 | |
||
2797 | $SED -n -e ' |
||
2798 | 1,100{ |
||
2799 | / I /{ |
||
2800 | s,.*,import, |
||
2801 | p |
||
2802 | q |
||
2803 | } |
||
2804 | }'` |
||
2805 | case $win32_nmres in |
||
2806 | import*) win32_libid_type="x86 archive import";; |
||
2807 | *) win32_libid_type="x86 archive static";; |
||
2808 | esac |
||
2809 | fi |
||
2810 | ;; |
||
2811 | *DLL*) |
||
2812 | win32_libid_type="x86 DLL" |
||
2813 | ;; |
||
2814 | *executable*) # but shell scripts are "executable" too... |
||
2815 | case $win32_fileres in |
||
2816 | *MS\ Windows\ PE\ Intel*) |
||
2817 | win32_libid_type="x86 DLL" |
||
2818 | ;; |
||
2819 | esac |
||
2820 | ;; |
||
2821 | esac |
||
2822 | $ECHO "$win32_libid_type" |
||
2823 | } |
||
2824 | |||
2825 | |||
2826 | |||
2827 | # func_extract_an_archive dir oldlib |
||
2828 | func_extract_an_archive () |
||
2829 | { |
||
2830 | $opt_debug |
||
2831 | f_ex_an_ar_dir="$1"; shift |
||
2832 | f_ex_an_ar_oldlib="$1" |
||
2833 | if test "$lock_old_archive_extraction" = yes; then |
||
2834 | lockfile=$f_ex_an_ar_oldlib.lock |
||
2835 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
||
2836 | func_echo "Waiting for $lockfile to be removed" |
||
2837 | sleep 2 |
||
2838 | done |
||
2839 | fi |
||
2840 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ |
||
2841 | 'stat=$?; rm -f "$lockfile"; exit $stat' |
||
2842 | if test "$lock_old_archive_extraction" = yes; then |
||
2843 | $opt_dry_run || rm -f "$lockfile" |
||
2844 | fi |
||
2845 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
||
2846 | : |
||
2847 | else |
||
2848 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
||
2849 | fi |
||
2850 | } |
||
2851 | |||
2852 | |||
2853 | # func_extract_archives gentop oldlib ... |
||
2854 | func_extract_archives () |
||
2855 | { |
||
2856 | $opt_debug |
||
2857 | my_gentop="$1"; shift |
||
2858 | my_oldlibs=${1+"$@"} |
||
2859 | my_oldobjs="" |
||
2860 | my_xlib="" |
||
2861 | my_xabs="" |
||
2862 | my_xdir="" |
||
2863 | |||
2864 | for my_xlib in $my_oldlibs; do |
||
2865 | # Extract the objects. |
||
2866 | case $my_xlib in |
||
2867 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
||
2868 | *) my_xabs=`pwd`"/$my_xlib" ;; |
||
2869 | esac |
||
2870 | func_basename "$my_xlib" |
||
2871 | my_xlib="$func_basename_result" |
||
2872 | my_xlib_u=$my_xlib |
||
2873 | while :; do |
||
2874 | case " $extracted_archives " in |
||
2875 | *" $my_xlib_u "*) |
||
2876 | func_arith $extracted_serial + 1 |
||
2877 | extracted_serial=$func_arith_result |
||
2878 | my_xlib_u=lt$extracted_serial-$my_xlib ;; |
||
2879 | *) break ;; |
||
2880 | esac |
||
2881 | done |
||
2882 | extracted_archives="$extracted_archives $my_xlib_u" |
||
2883 | my_xdir="$my_gentop/$my_xlib_u" |
||
2884 | |||
2885 | func_mkdir_p "$my_xdir" |
||
2886 | |||
2887 | case $host in |
||
2888 | *-darwin*) |
||
2889 | func_verbose "Extracting $my_xabs" |
||
2890 | # Do not bother doing anything if just a dry run |
||
2891 | $opt_dry_run || { |
||
2892 | darwin_orig_dir=`pwd` |
||
2893 | cd $my_xdir || exit $? |
||
2894 | darwin_archive=$my_xabs |
||
2895 | darwin_curdir=`pwd` |
||
2896 | darwin_base_archive=`basename "$darwin_archive"` |
||
2897 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` |
||
2898 | if test -n "$darwin_arches"; then |
||
2899 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` |
||
2900 | darwin_arch= |
||
2901 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
||
2902 | for darwin_arch in $darwin_arches ; do |
||
2903 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
||
2904 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
||
2905 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
||
2906 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
||
2907 | cd "$darwin_curdir" |
||
2908 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
||
2909 | done # $darwin_arches |
||
2910 | ## Okay now we've a bunch of thin objects, gotta fatten them up :) |
||
2911 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` |
||
2912 | darwin_file= |
||
2913 | darwin_files= |
||
2914 | for darwin_file in $darwin_filelist; do |
||
2915 | darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` |
||
2916 | $LIPO -create -output "$darwin_file" $darwin_files |
||
2917 | done # $darwin_filelist |
||
2918 | $RM -rf unfat-$$ |
||
2919 | cd "$darwin_orig_dir" |
||
2920 | else |
||
2921 | cd $darwin_orig_dir |
||
2922 | func_extract_an_archive "$my_xdir" "$my_xabs" |
||
2923 | fi # $darwin_arches |
||
2924 | } # !$opt_dry_run |
||
2925 | ;; |
||
2926 | *) |
||
2927 | func_extract_an_archive "$my_xdir" "$my_xabs" |
||
2928 | ;; |
||
2929 | esac |
||
2930 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` |
||
2931 | done |
||
2932 | |||
2933 | func_extract_archives_result="$my_oldobjs" |
||
2934 | } |
||
2935 | |||
2936 | |||
2937 | # func_emit_wrapper [arg=no] |
||
2938 | # |
||
2939 | # Emit a libtool wrapper script on stdout. |
||
2940 | # Don't directly open a file because we may want to |
||
2941 | # incorporate the script contents within a cygwin/mingw |
||
2942 | # wrapper executable. Must ONLY be called from within |
||
2943 | # func_mode_link because it depends on a number of variables |
||
2944 | # set therein. |
||
2945 | # |
||
2946 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR |
||
2947 | # variable will take. If 'yes', then the emitted script |
||
2948 | # will assume that the directory in which it is stored is |
||
2949 | # the $objdir directory. This is a cygwin/mingw-specific |
||
2950 | # behavior. |
||
2951 | func_emit_wrapper () |
||
2952 | { |
||
2953 | func_emit_wrapper_arg1=${1-no} |
||
2954 | |||
2955 | $ECHO "\ |
||
2956 | #! $SHELL |
||
2957 | |||
2958 | # $output - temporary wrapper script for $objdir/$outputname |
||
2959 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
||
2960 | # |
||
2961 | # The $output program cannot be directly executed until all the libtool |
||
2962 | # libraries that it depends on are installed. |
||
2963 | # |
||
2964 | # This wrapper script should never be moved out of the build directory. |
||
2965 | # If it is, it will not operate correctly. |
||
2966 | |||
2967 | # Sed substitution that helps us do robust quoting. It backslashifies |
||
2968 | # metacharacters that are still active within double-quoted strings. |
||
2969 | sed_quote_subst='$sed_quote_subst' |
||
2970 | |||
2971 | # Be Bourne compatible |
||
2972 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then |
||
2973 | emulate sh |
||
2974 | NULLCMD=: |
||
2975 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which |
||
2976 | # is contrary to our usage. Disable this feature. |
||
2977 | alias -g '\${1+\"\$@\"}'='\"\$@\"' |
||
2978 | setopt NO_GLOB_SUBST |
||
2979 | else |
||
2980 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac |
||
2981 | fi |
||
2982 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
||
2983 | DUALCASE=1; export DUALCASE # for MKS sh |
||
2984 | |||
2985 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
||
2986 | # if CDPATH is set. |
||
2987 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
||
2988 | |||
2989 | relink_command=\"$relink_command\" |
||
2990 | |||
2991 | # This environment variable determines our operation mode. |
||
2992 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
||
2993 | # install mode needs the following variables: |
||
2994 | generated_by_libtool_version='$macro_version' |
||
2995 | notinst_deplibs='$notinst_deplibs' |
||
2996 | else |
||
2997 | # When we are sourced in execute mode, \$file and \$ECHO are already set. |
||
2998 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
||
2999 | file=\"\$0\"" |
||
3000 | |||
3001 | qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` |
||
3002 | $ECHO "\ |
||
3003 | |||
3004 | # A function that is used when there is no print builtin or printf. |
||
3005 | func_fallback_echo () |
||
3006 | { |
||
3007 | eval 'cat <<_LTECHO_EOF |
||
3008 | \$1 |
||
3009 | _LTECHO_EOF' |
||
3010 | } |
||
3011 | ECHO=\"$qECHO\" |
||
3012 | fi |
||
3013 | |||
3014 | # Very basic option parsing. These options are (a) specific to |
||
3015 | # the libtool wrapper, (b) are identical between the wrapper |
||
3016 | # /script/ and the wrapper /executable/ which is used only on |
||
3017 | # windows platforms, and (c) all begin with the string "--lt-" |
||
3018 | # (application programs are unlikely to have options which match |
||
3019 | # this pattern). |
||
3020 | # |
||
3021 | # There are only two supported options: --lt-debug and |
||
3022 | # --lt-dump-script. There is, deliberately, no --lt-help. |
||
3023 | # |
||
3024 | # The first argument to this parsing function should be the |
||
3025 | # script's $0 value, followed by "$@". |
||
3026 | lt_option_debug= |
||
3027 | func_parse_lt_options () |
||
3028 | { |
||
3029 | lt_script_arg0=\$0 |
||
3030 | shift |
||
3031 | for lt_opt |
||
3032 | do |
||
3033 | case \"\$lt_opt\" in |
||
3034 | --lt-debug) lt_option_debug=1 ;; |
||
3035 | --lt-dump-script) |
||
3036 | lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` |
||
3037 | test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. |
||
3038 | lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` |
||
3039 | cat \"\$lt_dump_D/\$lt_dump_F\" |
||
3040 | exit 0 |
||
3041 | ;; |
||
3042 | --lt-*) |
||
3043 | \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 |
||
3044 | exit 1 |
||
3045 | ;; |
||
3046 | esac |
||
3047 | done |
||
3048 | |||
3049 | # Print the debug banner immediately: |
||
3050 | if test -n \"\$lt_option_debug\"; then |
||
3051 | echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 |
||
3052 | fi |
||
3053 | } |
||
3054 | |||
3055 | # Used when --lt-debug. Prints its arguments to stdout |
||
3056 | # (redirection is the responsibility of the caller) |
||
3057 | func_lt_dump_args () |
||
3058 | { |
||
3059 | lt_dump_args_N=1; |
||
3060 | for lt_arg |
||
3061 | do |
||
3062 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" |
||
3063 | lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` |
||
3064 | done |
||
3065 | } |
||
3066 | |||
3067 | # Core function for launching the target application |
||
3068 | func_exec_program_core () |
||
3069 | { |
||
3070 | " |
||
3071 | case $host in |
||
3072 | # Backslashes separate directories on plain windows |
||
3073 | *-*-mingw | *-*-os2* | *-cegcc*) |
||
3074 | $ECHO "\ |
||
3075 | if test -n \"\$lt_option_debug\"; then |
||
3076 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 |
||
3077 | func_lt_dump_args \${1+\"\$@\"} 1>&2 |
||
3078 | fi |
||
3079 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
||
3080 | " |
||
3081 | ;; |
||
3082 | |||
3083 | *) |
||
3084 | $ECHO "\ |
||
3085 | if test -n \"\$lt_option_debug\"; then |
||
3086 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 |
||
3087 | func_lt_dump_args \${1+\"\$@\"} 1>&2 |
||
3088 | fi |
||
3089 | exec \"\$progdir/\$program\" \${1+\"\$@\"} |
||
3090 | " |
||
3091 | ;; |
||
3092 | esac |
||
3093 | $ECHO "\ |
||
3094 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 |
||
3095 | exit 1 |
||
3096 | } |
||
3097 | |||
3098 | # A function to encapsulate launching the target application |
||
3099 | # Strips options in the --lt-* namespace from \$@ and |
||
3100 | # launches target application with the remaining arguments. |
||
3101 | func_exec_program () |
||
3102 | { |
||
3103 | for lt_wr_arg |
||
3104 | do |
||
3105 | case \$lt_wr_arg in |
||
3106 | --lt-*) ;; |
||
3107 | *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; |
||
3108 | esac |
||
3109 | shift |
||
3110 | done |
||
3111 | func_exec_program_core \${1+\"\$@\"} |
||
3112 | } |
||
3113 | |||
3114 | # Parse options |
||
3115 | func_parse_lt_options \"\$0\" \${1+\"\$@\"} |
||
3116 | |||
3117 | # Find the directory that this script lives in. |
||
3118 | thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` |
||
3119 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
||
3120 | |||
3121 | # Follow symbolic links until we get to the real thisdir. |
||
3122 | file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` |
||
3123 | while test -n \"\$file\"; do |
||
3124 | destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` |
||
3125 | |||
3126 | # If there was a directory component, then change thisdir. |
||
3127 | if test \"x\$destdir\" != \"x\$file\"; then |
||
3128 | case \"\$destdir\" in |
||
3129 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
||
3130 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
||
3131 | esac |
||
3132 | fi |
||
3133 | |||
3134 | file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` |
||
3135 | file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` |
||
3136 | done |
||
3137 | |||
3138 | # Usually 'no', except on cygwin/mingw when embedded into |
||
3139 | # the cwrapper. |
||
3140 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 |
||
3141 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then |
||
3142 | # special case for '.' |
||
3143 | if test \"\$thisdir\" = \".\"; then |
||
3144 | thisdir=\`pwd\` |
||
3145 | fi |
||
3146 | # remove .libs from thisdir |
||
3147 | case \"\$thisdir\" in |
||
3148 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; |
||
3149 | $objdir ) thisdir=. ;; |
||
3150 | esac |
||
3151 | fi |
||
3152 | |||
3153 | # Try to get the absolute directory name. |
||
3154 | absdir=\`cd \"\$thisdir\" && pwd\` |
||
3155 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
||
3156 | " |
||
3157 | |||
3158 | if test "$fast_install" = yes; then |
||
3159 | $ECHO "\ |
||
3160 | program=lt-'$outputname'$exeext |
||
3161 | progdir=\"\$thisdir/$objdir\" |
||
3162 | |||
3163 | if test ! -f \"\$progdir/\$program\" || |
||
3164 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
||
3165 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
||
3166 | |||
3167 | file=\"\$\$-\$program\" |
||
3168 | |||
3169 | if test ! -d \"\$progdir\"; then |
||
3170 | $MKDIR \"\$progdir\" |
||
3171 | else |
||
3172 | $RM \"\$progdir/\$file\" |
||
3173 | fi" |
||
3174 | |||
3175 | $ECHO "\ |
||
3176 | |||
3177 | # relink executable if necessary |
||
3178 | if test -n \"\$relink_command\"; then |
||
3179 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
||
3180 | else |
||
3181 | $ECHO \"\$relink_command_output\" >&2 |
||
3182 | $RM \"\$progdir/\$file\" |
||
3183 | exit 1 |
||
3184 | fi |
||
3185 | fi |
||
3186 | |||
3187 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
||
3188 | { $RM \"\$progdir/\$program\"; |
||
3189 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
||
3190 | $RM \"\$progdir/\$file\" |
||
3191 | fi" |
||
3192 | else |
||
3193 | $ECHO "\ |
||
3194 | program='$outputname' |
||
3195 | progdir=\"\$thisdir/$objdir\" |
||
3196 | " |
||
3197 | fi |
||
3198 | |||
3199 | $ECHO "\ |
||
3200 | |||
3201 | if test -f \"\$progdir/\$program\"; then" |
||
3202 | |||
3203 | # Export our shlibpath_var if we have one. |
||
3204 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
||
3205 | $ECHO "\ |
||
3206 | # Add our own library path to $shlibpath_var |
||
3207 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
||
3208 | |||
3209 | # Some systems cannot cope with colon-terminated $shlibpath_var |
||
3210 | # The second colon is a workaround for a bug in BeOS R4 sed |
||
3211 | $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` |
||
3212 | |||
3213 | export $shlibpath_var |
||
3214 | " |
||
3215 | fi |
||
3216 | |||
3217 | # fixup the dll searchpath if we need to. |
||
3218 | if test -n "$dllsearchpath"; then |
||
3219 | $ECHO "\ |
||
3220 | # Add the dll search path components to the executable PATH |
||
3221 | PATH=$dllsearchpath:\$PATH |
||
3222 | " |
||
3223 | fi |
||
3224 | |||
3225 | $ECHO "\ |
||
3226 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
||
3227 | # Run the actual program with our arguments. |
||
3228 | func_exec_program \${1+\"\$@\"} |
||
3229 | fi |
||
3230 | else |
||
3231 | # The program doesn't exist. |
||
3232 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 |
||
3233 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 |
||
3234 | \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
||
3235 | exit 1 |
||
3236 | fi |
||
3237 | fi\ |
||
3238 | " |
||
3239 | } |
||
3240 | |||
3241 | |||
3242 | # func_to_host_path arg |
||
3243 | # |
||
3244 | # Convert paths to host format when used with build tools. |
||
3245 | # Intended for use with "native" mingw (where libtool itself |
||
3246 | # is running under the msys shell), or in the following cross- |
||
3247 | # build environments: |
||
3248 | # $build $host |
||
3249 | # mingw (msys) mingw [e.g. native] |
||
3250 | # cygwin mingw |
||
3251 | # *nix + wine mingw |
||
3252 | # where wine is equipped with the `winepath' executable. |
||
3253 | # In the native mingw case, the (msys) shell automatically |
||
3254 | # converts paths for any non-msys applications it launches, |
||
3255 | # but that facility isn't available from inside the cwrapper. |
||
3256 | # Similar accommodations are necessary for $host mingw and |
||
3257 | # $build cygwin. Calling this function does no harm for other |
||
3258 | # $host/$build combinations not listed above. |
||
3259 | # |
||
3260 | # ARG is the path (on $build) that should be converted to |
||
3261 | # the proper representation for $host. The result is stored |
||
3262 | # in $func_to_host_path_result. |
||
3263 | func_to_host_path () |
||
3264 | { |
||
3265 | func_to_host_path_result="$1" |
||
3266 | if test -n "$1"; then |
||
3267 | case $host in |
||
3268 | *mingw* ) |
||
3269 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
||
3270 | case $build in |
||
3271 | *mingw* ) # actually, msys |
||
3272 | # awkward: cmd appends spaces to result |
||
3273 | func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | |
||
3274 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
||
3275 | ;; |
||
3276 | *cygwin* ) |
||
3277 | func_to_host_path_result=`cygpath -w "$1" | |
||
3278 | $SED -e "$lt_sed_naive_backslashify"` |
||
3279 | ;; |
||
3280 | * ) |
||
3281 | # Unfortunately, winepath does not exit with a non-zero |
||
3282 | # error code, so we are forced to check the contents of |
||
3283 | # stdout. On the other hand, if the command is not |
||
3284 | # found, the shell will set an exit code of 127 and print |
||
3285 | # *an error message* to stdout. So we must check for both |
||
3286 | # error code of zero AND non-empty stdout, which explains |
||
3287 | # the odd construction: |
||
3288 | func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` |
||
3289 | if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then |
||
3290 | func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | |
||
3291 | $SED -e "$lt_sed_naive_backslashify"` |
||
3292 | else |
||
3293 | # Allow warning below. |
||
3294 | func_to_host_path_result= |
||
3295 | fi |
||
3296 | ;; |
||
3297 | esac |
||
3298 | if test -z "$func_to_host_path_result" ; then |
||
3299 | func_error "Could not determine host path corresponding to" |
||
3300 | func_error " \`$1'" |
||
3301 | func_error "Continuing, but uninstalled executables may not work." |
||
3302 | # Fallback: |
||
3303 | func_to_host_path_result="$1" |
||
3304 | fi |
||
3305 | ;; |
||
3306 | esac |
||
3307 | fi |
||
3308 | } |
||
3309 | # end: func_to_host_path |
||
3310 | |||
3311 | # func_to_host_pathlist arg |
||
3312 | # |
||
3313 | # Convert pathlists to host format when used with build tools. |
||
3314 | # See func_to_host_path(), above. This function supports the |
||
3315 | # following $build/$host combinations (but does no harm for |
||
3316 | # combinations not listed here): |
||
3317 | # $build $host |
||
3318 | # mingw (msys) mingw [e.g. native] |
||
3319 | # cygwin mingw |
||
3320 | # *nix + wine mingw |
||
3321 | # |
||
3322 | # Path separators are also converted from $build format to |
||
3323 | # $host format. If ARG begins or ends with a path separator |
||
3324 | # character, it is preserved (but converted to $host format) |
||
3325 | # on output. |
||
3326 | # |
||
3327 | # ARG is a pathlist (on $build) that should be converted to |
||
3328 | # the proper representation on $host. The result is stored |
||
3329 | # in $func_to_host_pathlist_result. |
||
3330 | func_to_host_pathlist () |
||
3331 | { |
||
3332 | func_to_host_pathlist_result="$1" |
||
3333 | if test -n "$1"; then |
||
3334 | case $host in |
||
3335 | *mingw* ) |
||
3336 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
||
3337 | # Remove leading and trailing path separator characters from |
||
3338 | # ARG. msys behavior is inconsistent here, cygpath turns them |
||
3339 | # into '.;' and ';.', and winepath ignores them completely. |
||
3340 | func_stripname : : "$1" |
||
3341 | func_to_host_pathlist_tmp1=$func_stripname_result |
||
3342 | case $build in |
||
3343 | *mingw* ) # Actually, msys. |
||
3344 | # Awkward: cmd appends spaces to result. |
||
3345 | func_to_host_pathlist_result=` |
||
3346 | ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | |
||
3347 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` |
||
3348 | ;; |
||
3349 | *cygwin* ) |
||
3350 | func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | |
||
3351 | $SED -e "$lt_sed_naive_backslashify"` |
||
3352 | ;; |
||
3353 | * ) |
||
3354 | # unfortunately, winepath doesn't convert pathlists |
||
3355 | func_to_host_pathlist_result="" |
||
3356 | func_to_host_pathlist_oldIFS=$IFS |
||
3357 | IFS=: |
||
3358 | for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do |
||
3359 | IFS=$func_to_host_pathlist_oldIFS |
||
3360 | if test -n "$func_to_host_pathlist_f" ; then |
||
3361 | func_to_host_path "$func_to_host_pathlist_f" |
||
3362 | if test -n "$func_to_host_path_result" ; then |
||
3363 | if test -z "$func_to_host_pathlist_result" ; then |
||
3364 | func_to_host_pathlist_result="$func_to_host_path_result" |
||
3365 | else |
||
3366 | func_append func_to_host_pathlist_result ";$func_to_host_path_result" |
||
3367 | fi |
||
3368 | fi |
||
3369 | fi |
||
3370 | done |
||
3371 | IFS=$func_to_host_pathlist_oldIFS |
||
3372 | ;; |
||
3373 | esac |
||
3374 | if test -z "$func_to_host_pathlist_result"; then |
||
3375 | func_error "Could not determine the host path(s) corresponding to" |
||
3376 | func_error " \`$1'" |
||
3377 | func_error "Continuing, but uninstalled executables may not work." |
||
3378 | # Fallback. This may break if $1 contains DOS-style drive |
||
3379 | # specifications. The fix is not to complicate the expression |
||
3380 | # below, but for the user to provide a working wine installation |
||
3381 | # with winepath so that path translation in the cross-to-mingw |
||
3382 | # case works properly. |
||
3383 | lt_replace_pathsep_nix_to_dos="s|:|;|g" |
||
3384 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ |
||
3385 | $SED -e "$lt_replace_pathsep_nix_to_dos"` |
||
3386 | fi |
||
3387 | # Now, add the leading and trailing path separators back |
||
3388 | case "$1" in |
||
3389 | :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" |
||
3390 | ;; |
||
3391 | esac |
||
3392 | case "$1" in |
||
3393 | *: ) func_append func_to_host_pathlist_result ";" |
||
3394 | ;; |
||
3395 | esac |
||
3396 | ;; |
||
3397 | esac |
||
3398 | fi |
||
3399 | } |
||
3400 | # end: func_to_host_pathlist |
||
3401 | |||
3402 | # func_emit_cwrapperexe_src |
||
3403 | # emit the source code for a wrapper executable on stdout |
||
3404 | # Must ONLY be called from within func_mode_link because |
||
3405 | # it depends on a number of variable set therein. |
||
3406 | func_emit_cwrapperexe_src () |
||
3407 | { |
||
3408 | cat < |
||
3409 | |||
3410 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
||
3411 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
||
3412 | |||
3413 | The $output program cannot be directly executed until all the libtool |
||
3414 | libraries that it depends on are installed. |
||
3415 | |||
3416 | This wrapper executable should never be moved out of the build directory. |
||
3417 | If it is, it will not operate correctly. |
||
3418 | */ |
||
3419 | EOF |
||
3420 | cat <<"EOF" |
||
3421 | #ifdef _MSC_VER |
||
3422 | # define _CRT_SECURE_NO_DEPRECATE 1 |
||
3423 | #endif |
||
3424 | #include |
||
3425 | #include |
||
3426 | #ifdef _MSC_VER |
||
3427 | # include |
||
3428 | # include |
||
3429 | # include |
||
3430 | #else |
||
3431 | # include |
||
3432 | # include |
||
3433 | # ifdef __CYGWIN__ |
||
3434 | # include |
||
3435 | # endif |
||
3436 | #endif |
||
3437 | #include |
||
3438 | #include |
||
3439 | #include |
||
3440 | #include |
||
3441 | #include |
||
3442 | #include |
||
3443 | #include |
||
3444 | #include |
||
3445 | |||
3446 | /* declarations of non-ANSI functions */ |
||
3447 | #if defined(__MINGW32__) |
||
3448 | # ifdef __STRICT_ANSI__ |
||
3449 | int _putenv (const char *); |
||
3450 | # endif |
||
3451 | #elif defined(__CYGWIN__) |
||
3452 | # ifdef __STRICT_ANSI__ |
||
3453 | char *realpath (const char *, char *); |
||
3454 | int putenv (char *); |
||
3455 | int setenv (const char *, const char *, int); |
||
3456 | # endif |
||
3457 | /* #elif defined (other platforms) ... */ |
||
3458 | #endif |
||
3459 | |||
3460 | /* portability defines, excluding path handling macros */ |
||
3461 | #if defined(_MSC_VER) |
||
3462 | # define setmode _setmode |
||
3463 | # define stat _stat |
||
3464 | # define chmod _chmod |
||
3465 | # define getcwd _getcwd |
||
3466 | # define putenv _putenv |
||
3467 | # define S_IXUSR _S_IEXEC |
||
3468 | # ifndef _INTPTR_T_DEFINED |
||
3469 | # define _INTPTR_T_DEFINED |
||
3470 | # define intptr_t int |
||
3471 | # endif |
||
3472 | #elif defined(__MINGW32__) |
||
3473 | # define setmode _setmode |
||
3474 | # define stat _stat |
||
3475 | # define chmod _chmod |
||
3476 | # define getcwd _getcwd |
||
3477 | # define putenv _putenv |
||
3478 | #elif defined(__CYGWIN__) |
||
3479 | # define HAVE_SETENV |
||
3480 | # define FOPEN_WB "wb" |
||
3481 | /* #elif defined (other platforms) ... */ |
||
3482 | #endif |
||
3483 | |||
3484 | #if defined(PATH_MAX) |
||
3485 | # define LT_PATHMAX PATH_MAX |
||
3486 | #elif defined(MAXPATHLEN) |
||
3487 | # define LT_PATHMAX MAXPATHLEN |
||
3488 | #else |
||
3489 | # define LT_PATHMAX 1024 |
||
3490 | #endif |
||
3491 | |||
3492 | #ifndef S_IXOTH |
||
3493 | # define S_IXOTH 0 |
||
3494 | #endif |
||
3495 | #ifndef S_IXGRP |
||
3496 | # define S_IXGRP 0 |
||
3497 | #endif |
||
3498 | |||
3499 | /* path handling portability macros */ |
||
3500 | #ifndef DIR_SEPARATOR |
||
3501 | # define DIR_SEPARATOR '/' |
||
3502 | # define PATH_SEPARATOR ':' |
||
3503 | #endif |
||
3504 | |||
3505 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
||
3506 | defined (__OS2__) |
||
3507 | # define HAVE_DOS_BASED_FILE_SYSTEM |
||
3508 | # define FOPEN_WB "wb" |
||
3509 | # ifndef DIR_SEPARATOR_2 |
||
3510 | # define DIR_SEPARATOR_2 '\\' |
||
3511 | # endif |
||
3512 | # ifndef PATH_SEPARATOR_2 |
||
3513 | # define PATH_SEPARATOR_2 ';' |
||
3514 | # endif |
||
3515 | #endif |
||
3516 | |||
3517 | #ifndef DIR_SEPARATOR_2 |
||
3518 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
||
3519 | #else /* DIR_SEPARATOR_2 */ |
||
3520 | # define IS_DIR_SEPARATOR(ch) \ |
||
3521 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
||
3522 | #endif /* DIR_SEPARATOR_2 */ |
||
3523 | |||
3524 | #ifndef PATH_SEPARATOR_2 |
||
3525 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) |
||
3526 | #else /* PATH_SEPARATOR_2 */ |
||
3527 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) |
||
3528 | #endif /* PATH_SEPARATOR_2 */ |
||
3529 | |||
3530 | #ifndef FOPEN_WB |
||
3531 | # define FOPEN_WB "w" |
||
3532 | #endif |
||
3533 | #ifndef _O_BINARY |
||
3534 | # define _O_BINARY 0 |
||
3535 | #endif |
||
3536 | |||
3537 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
||
3538 | #define XFREE(stale) do { \ |
||
3539 | if (stale) { free ((void *) stale); stale = 0; } \ |
||
3540 | } while (0) |
||
3541 | |||
3542 | #if defined(LT_DEBUGWRAPPER) |
||
3543 | static int lt_debug = 1; |
||
3544 | #else |
||
3545 | static int lt_debug = 0; |
||
3546 | #endif |
||
3547 | |||
3548 | const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ |
||
3549 | |||
3550 | void *xmalloc (size_t num); |
||
3551 | char *xstrdup (const char *string); |
||
3552 | const char *base_name (const char *name); |
||
3553 | char *find_executable (const char *wrapper); |
||
3554 | char *chase_symlinks (const char *pathspec); |
||
3555 | int make_executable (const char *path); |
||
3556 | int check_executable (const char *path); |
||
3557 | char *strendzap (char *str, const char *pat); |
||
3558 | void lt_debugprintf (const char *file, int line, const char *fmt, ...); |
||
3559 | void lt_fatal (const char *file, int line, const char *message, ...); |
||
3560 | static const char *nonnull (const char *s); |
||
3561 | static const char *nonempty (const char *s); |
||
3562 | void lt_setenv (const char *name, const char *value); |
||
3563 | char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
||
3564 | void lt_update_exe_path (const char *name, const char *value); |
||
3565 | void lt_update_lib_path (const char *name, const char *value); |
||
3566 | char **prepare_spawn (char **argv); |
||
3567 | void lt_dump_script (FILE *f); |
||
3568 | EOF |
||
3569 | |||
3570 | cat < |
||
3571 | const char * MAGIC_EXE = "$magic_exe"; |
||
3572 | const char * LIB_PATH_VARNAME = "$shlibpath_var"; |
||
3573 | EOF |
||
3574 | |||
3575 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
||
3576 | func_to_host_pathlist "$temp_rpath" |
||
3577 | cat < |
||
3578 | const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; |
||
3579 | EOF |
||
3580 | else |
||
3581 | cat <<"EOF" |
||
3582 | const char * LIB_PATH_VALUE = ""; |
||
3583 | EOF |
||
3584 | fi |
||
3585 | |||
3586 | if test -n "$dllsearchpath"; then |
||
3587 | func_to_host_pathlist "$dllsearchpath:" |
||
3588 | cat < |
||
3589 | const char * EXE_PATH_VARNAME = "PATH"; |
||
3590 | const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; |
||
3591 | EOF |
||
3592 | else |
||
3593 | cat <<"EOF" |
||
3594 | const char * EXE_PATH_VARNAME = ""; |
||
3595 | const char * EXE_PATH_VALUE = ""; |
||
3596 | EOF |
||
3597 | fi |
||
3598 | |||
3599 | if test "$fast_install" = yes; then |
||
3600 | cat < |
||
3601 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ |
||
3602 | EOF |
||
3603 | else |
||
3604 | cat < |
||
3605 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ |
||
3606 | EOF |
||
3607 | fi |
||
3608 | |||
3609 | |||
3610 | cat <<"EOF" |
||
3611 | |||
3612 | #define LTWRAPPER_OPTION_PREFIX "--lt-" |
||
3613 | |||
3614 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; |
||
3615 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; |
||
3616 | static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; |
||
3617 | |||
3618 | int |
||
3619 | main (int argc, char *argv[]) |
||
3620 | { |
||
3621 | char **newargz; |
||
3622 | int newargc; |
||
3623 | char *tmp_pathspec; |
||
3624 | char *actual_cwrapper_path; |
||
3625 | char *actual_cwrapper_name; |
||
3626 | char *target_name; |
||
3627 | char *lt_argv_zero; |
||
3628 | intptr_t rval = 127; |
||
3629 | |||
3630 | int i; |
||
3631 | |||
3632 | program_name = (char *) xstrdup (base_name (argv[0])); |
||
3633 | newargz = XMALLOC (char *, argc + 1); |
||
3634 | |||
3635 | /* very simple arg parsing; don't want to rely on getopt |
||
3636 | * also, copy all non cwrapper options to newargz, except |
||
3637 | * argz[0], which is handled differently |
||
3638 | */ |
||
3639 | newargc=0; |
||
3640 | for (i = 1; i < argc; i++) |
||
3641 | { |
||
3642 | if (strcmp (argv[i], dumpscript_opt) == 0) |
||
3643 | { |
||
3644 | EOF |
||
3645 | case "$host" in |
||
3646 | *mingw* | *cygwin* ) |
||
3647 | # make stdout use "unix" line endings |
||
3648 | echo " setmode(1,_O_BINARY);" |
||
3649 | ;; |
||
3650 | esac |
||
3651 | |||
3652 | cat <<"EOF" |
||
3653 | lt_dump_script (stdout); |
||
3654 | return 0; |
||
3655 | } |
||
3656 | if (strcmp (argv[i], debug_opt) == 0) |
||
3657 | { |
||
3658 | lt_debug = 1; |
||
3659 | continue; |
||
3660 | } |
||
3661 | if (strcmp (argv[i], ltwrapper_option_prefix) == 0) |
||
3662 | { |
||
3663 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
||
3664 | namespace, but it is not one of the ones we know about and |
||
3665 | have already dealt with, above (inluding dump-script), then |
||
3666 | report an error. Otherwise, targets might begin to believe |
||
3667 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
||
3668 | namespace. The first time any user complains about this, we'll |
||
3669 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
||
3670 | or a configure.ac-settable value. |
||
3671 | */ |
||
3672 | lt_fatal (__FILE__, __LINE__, |
||
3673 | "unrecognized %s option: '%s'", |
||
3674 | ltwrapper_option_prefix, argv[i]); |
||
3675 | } |
||
3676 | /* otherwise ... */ |
||
3677 | newargz[++newargc] = xstrdup (argv[i]); |
||
3678 | } |
||
3679 | newargz[++newargc] = NULL; |
||
3680 | |||
3681 | EOF |
||
3682 | cat < |
||
3683 | /* The GNU banner must be the first non-error debug message */ |
||
3684 | lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); |
||
3685 | EOF |
||
3686 | cat <<"EOF" |
||
3687 | lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); |
||
3688 | lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); |
||
3689 | |||
3690 | tmp_pathspec = find_executable (argv[0]); |
||
3691 | if (tmp_pathspec == NULL) |
||
3692 | lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); |
||
3693 | lt_debugprintf (__FILE__, __LINE__, |
||
3694 | "(main) found exe (before symlink chase) at: %s\n", |
||
3695 | tmp_pathspec); |
||
3696 | |||
3697 | actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
||
3698 | lt_debugprintf (__FILE__, __LINE__, |
||
3699 | "(main) found exe (after symlink chase) at: %s\n", |
||
3700 | actual_cwrapper_path); |
||
3701 | XFREE (tmp_pathspec); |
||
3702 | |||
3703 | actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); |
||
3704 | strendzap (actual_cwrapper_path, actual_cwrapper_name); |
||
3705 | |||
3706 | /* wrapper name transforms */ |
||
3707 | strendzap (actual_cwrapper_name, ".exe"); |
||
3708 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
||
3709 | XFREE (actual_cwrapper_name); |
||
3710 | actual_cwrapper_name = tmp_pathspec; |
||
3711 | tmp_pathspec = 0; |
||
3712 | |||
3713 | /* target_name transforms -- use actual target program name; might have lt- prefix */ |
||
3714 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
||
3715 | strendzap (target_name, ".exe"); |
||
3716 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
||
3717 | XFREE (target_name); |
||
3718 | target_name = tmp_pathspec; |
||
3719 | tmp_pathspec = 0; |
||
3720 | |||
3721 | lt_debugprintf (__FILE__, __LINE__, |
||
3722 | "(main) libtool target name: %s\n", |
||
3723 | target_name); |
||
3724 | EOF |
||
3725 | |||
3726 | cat < |
||
3727 | newargz[0] = |
||
3728 | XMALLOC (char, (strlen (actual_cwrapper_path) + |
||
3729 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); |
||
3730 | strcpy (newargz[0], actual_cwrapper_path); |
||
3731 | strcat (newargz[0], "$objdir"); |
||
3732 | strcat (newargz[0], "/"); |
||
3733 | EOF |
||
3734 | |||
3735 | cat <<"EOF" |
||
3736 | /* stop here, and copy so we don't have to do this twice */ |
||
3737 | tmp_pathspec = xstrdup (newargz[0]); |
||
3738 | |||
3739 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ |
||
3740 | strcat (newargz[0], actual_cwrapper_name); |
||
3741 | |||
3742 | /* DO want the lt- prefix here if it exists, so use target_name */ |
||
3743 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); |
||
3744 | XFREE (tmp_pathspec); |
||
3745 | tmp_pathspec = NULL; |
||
3746 | EOF |
||
3747 | |||
3748 | case $host_os in |
||
3749 | mingw*) |
||
3750 | cat <<"EOF" |
||
3751 | { |
||
3752 | char* p; |
||
3753 | while ((p = strchr (newargz[0], '\\')) != NULL) |
||
3754 | { |
||
3755 | *p = '/'; |
||
3756 | } |
||
3757 | while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
||
3758 | { |
||
3759 | *p = '/'; |
||
3760 | } |
||
3761 | } |
||
3762 | EOF |
||
3763 | ;; |
||
3764 | esac |
||
3765 | |||
3766 | cat <<"EOF" |
||
3767 | XFREE (target_name); |
||
3768 | XFREE (actual_cwrapper_path); |
||
3769 | XFREE (actual_cwrapper_name); |
||
3770 | |||
3771 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ |
||
3772 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */ |
||
3773 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); |
||
3774 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); |
||
3775 | |||
3776 | lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", |
||
3777 | nonnull (lt_argv_zero)); |
||
3778 | for (i = 0; i < newargc; i++) |
||
3779 | { |
||
3780 | lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", |
||
3781 | i, nonnull (newargz[i])); |
||
3782 | } |
||
3783 | |||
3784 | EOF |
||
3785 | |||
3786 | case $host_os in |
||
3787 | mingw*) |
||
3788 | cat <<"EOF" |
||
3789 | /* execv doesn't actually work on mingw as expected on unix */ |
||
3790 | newargz = prepare_spawn (newargz); |
||
3791 | rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
||
3792 | if (rval == -1) |
||
3793 | { |
||
3794 | /* failed to start process */ |
||
3795 | lt_debugprintf (__FILE__, __LINE__, |
||
3796 | "(main) failed to launch target \"%s\": %s\n", |
||
3797 | lt_argv_zero, nonnull (strerror (errno))); |
||
3798 | return 127; |
||
3799 | } |
||
3800 | return rval; |
||
3801 | EOF |
||
3802 | ;; |
||
3803 | *) |
||
3804 | cat <<"EOF" |
||
3805 | execv (lt_argv_zero, newargz); |
||
3806 | return rval; /* =127, but avoids unused variable warning */ |
||
3807 | EOF |
||
3808 | ;; |
||
3809 | esac |
||
3810 | |||
3811 | cat <<"EOF" |
||
3812 | } |
||
3813 | |||
3814 | void * |
||
3815 | xmalloc (size_t num) |
||
3816 | { |
||
3817 | void *p = (void *) malloc (num); |
||
3818 | if (!p) |
||
3819 | lt_fatal (__FILE__, __LINE__, "memory exhausted"); |
||
3820 | |||
3821 | return p; |
||
3822 | } |
||
3823 | |||
3824 | char * |
||
3825 | xstrdup (const char *string) |
||
3826 | { |
||
3827 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), |
||
3828 | string) : NULL; |
||
3829 | } |
||
3830 | |||
3831 | const char * |
||
3832 | base_name (const char *name) |
||
3833 | { |
||
3834 | const char *base; |
||
3835 | |||
3836 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
||
3837 | /* Skip over the disk name in MSDOS pathnames. */ |
||
3838 | if (isalpha ((unsigned char) name[0]) && name[1] == ':') |
||
3839 | name += 2; |
||
3840 | #endif |
||
3841 | |||
3842 | for (base = name; *name; name++) |
||
3843 | if (IS_DIR_SEPARATOR (*name)) |
||
3844 | base = name + 1; |
||
3845 | return base; |
||
3846 | } |
||
3847 | |||
3848 | int |
||
3849 | check_executable (const char *path) |
||
3850 | { |
||
3851 | struct stat st; |
||
3852 | |||
3853 | lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", |
||
3854 | nonempty (path)); |
||
3855 | if ((!path) || (!*path)) |
||
3856 | return 0; |
||
3857 | |||
3858 | if ((stat (path, &st) >= 0) |
||
3859 | && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
||
3860 | return 1; |
||
3861 | else |
||
3862 | return 0; |
||
3863 | } |
||
3864 | |||
3865 | int |
||
3866 | make_executable (const char *path) |
||
3867 | { |
||
3868 | int rval = 0; |
||
3869 | struct stat st; |
||
3870 | |||
3871 | lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", |
||
3872 | nonempty (path)); |
||
3873 | if ((!path) || (!*path)) |
||
3874 | return 0; |
||
3875 | |||
3876 | if (stat (path, &st) >= 0) |
||
3877 | { |
||
3878 | rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); |
||
3879 | } |
||
3880 | return rval; |
||
3881 | } |
||
3882 | |||
3883 | /* Searches for the full path of the wrapper. Returns |
||
3884 | newly allocated full path name if found, NULL otherwise |
||
3885 | Does not chase symlinks, even on platforms that support them. |
||
3886 | */ |
||
3887 | char * |
||
3888 | find_executable (const char *wrapper) |
||
3889 | { |
||
3890 | int has_slash = 0; |
||
3891 | const char *p; |
||
3892 | const char *p_next; |
||
3893 | /* static buffer for getcwd */ |
||
3894 | char tmp[LT_PATHMAX + 1]; |
||
3895 | int tmp_len; |
||
3896 | char *concat_name; |
||
3897 | |||
3898 | lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", |
||
3899 | nonempty (wrapper)); |
||
3900 | |||
3901 | if ((wrapper == NULL) || (*wrapper == '\0')) |
||
3902 | return NULL; |
||
3903 | |||
3904 | /* Absolute path? */ |
||
3905 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
||
3906 | if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') |
||
3907 | { |
||
3908 | concat_name = xstrdup (wrapper); |
||
3909 | if (check_executable (concat_name)) |
||
3910 | return concat_name; |
||
3911 | XFREE (concat_name); |
||
3912 | } |
||
3913 | else |
||
3914 | { |
||
3915 | #endif |
||
3916 | if (IS_DIR_SEPARATOR (wrapper[0])) |
||
3917 | { |
||
3918 | concat_name = xstrdup (wrapper); |
||
3919 | if (check_executable (concat_name)) |
||
3920 | return concat_name; |
||
3921 | XFREE (concat_name); |
||
3922 | } |
||
3923 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
||
3924 | } |
||
3925 | #endif |
||
3926 | |||
3927 | for (p = wrapper; *p; p++) |
||
3928 | if (*p == '/') |
||
3929 | { |
||
3930 | has_slash = 1; |
||
3931 | break; |
||
3932 | } |
||
3933 | if (!has_slash) |
||
3934 | { |
||
3935 | /* no slashes; search PATH */ |
||
3936 | const char *path = getenv ("PATH"); |
||
3937 | if (path != NULL) |
||
3938 | { |
||
3939 | for (p = path; *p; p = p_next) |
||
3940 | { |
||
3941 | const char *q; |
||
3942 | size_t p_len; |
||
3943 | for (q = p; *q; q++) |
||
3944 | if (IS_PATH_SEPARATOR (*q)) |
||
3945 | break; |
||
3946 | p_len = q - p; |
||
3947 | p_next = (*q == '\0' ? q : q + 1); |
||
3948 | if (p_len == 0) |
||
3949 | { |
||
3950 | /* empty path: current directory */ |
||
3951 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
||
3952 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
||
3953 | nonnull (strerror (errno))); |
||
3954 | tmp_len = strlen (tmp); |
||
3955 | concat_name = |
||
3956 | XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
||
3957 | memcpy (concat_name, tmp, tmp_len); |
||
3958 | concat_name[tmp_len] = '/'; |
||
3959 | strcpy (concat_name + tmp_len + 1, wrapper); |
||
3960 | } |
||
3961 | else |
||
3962 | { |
||
3963 | concat_name = |
||
3964 | XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); |
||
3965 | memcpy (concat_name, p, p_len); |
||
3966 | concat_name[p_len] = '/'; |
||
3967 | strcpy (concat_name + p_len + 1, wrapper); |
||
3968 | } |
||
3969 | if (check_executable (concat_name)) |
||
3970 | return concat_name; |
||
3971 | XFREE (concat_name); |
||
3972 | } |
||
3973 | } |
||
3974 | /* not found in PATH; assume curdir */ |
||
3975 | } |
||
3976 | /* Relative path | not found in path: prepend cwd */ |
||
3977 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
||
3978 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", |
||
3979 | nonnull (strerror (errno))); |
||
3980 | tmp_len = strlen (tmp); |
||
3981 | concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
||
3982 | memcpy (concat_name, tmp, tmp_len); |
||
3983 | concat_name[tmp_len] = '/'; |
||
3984 | strcpy (concat_name + tmp_len + 1, wrapper); |
||
3985 | |||
3986 | if (check_executable (concat_name)) |
||
3987 | return concat_name; |
||
3988 | XFREE (concat_name); |
||
3989 | return NULL; |
||
3990 | } |
||
3991 | |||
3992 | char * |
||
3993 | chase_symlinks (const char *pathspec) |
||
3994 | { |
||
3995 | #ifndef S_ISLNK |
||
3996 | return xstrdup (pathspec); |
||
3997 | #else |
||
3998 | char buf[LT_PATHMAX]; |
||
3999 | struct stat s; |
||
4000 | char *tmp_pathspec = xstrdup (pathspec); |
||
4001 | char *p; |
||
4002 | int has_symlinks = 0; |
||
4003 | while (strlen (tmp_pathspec) && !has_symlinks) |
||
4004 | { |
||
4005 | lt_debugprintf (__FILE__, __LINE__, |
||
4006 | "checking path component for symlinks: %s\n", |
||
4007 | tmp_pathspec); |
||
4008 | if (lstat (tmp_pathspec, &s) == 0) |
||
4009 | { |
||
4010 | if (S_ISLNK (s.st_mode) != 0) |
||
4011 | { |
||
4012 | has_symlinks = 1; |
||
4013 | break; |
||
4014 | } |
||
4015 | |||
4016 | /* search backwards for last DIR_SEPARATOR */ |
||
4017 | p = tmp_pathspec + strlen (tmp_pathspec) - 1; |
||
4018 | while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
||
4019 | p--; |
||
4020 | if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
||
4021 | { |
||
4022 | /* no more DIR_SEPARATORS left */ |
||
4023 | break; |
||
4024 | } |
||
4025 | *p = '\0'; |
||
4026 | } |
||
4027 | else |
||
4028 | { |
||
4029 | lt_fatal (__FILE__, __LINE__, |
||
4030 | "error accessing file \"%s\": %s", |
||
4031 | tmp_pathspec, nonnull (strerror (errno))); |
||
4032 | } |
||
4033 | } |
||
4034 | XFREE (tmp_pathspec); |
||
4035 | |||
4036 | if (!has_symlinks) |
||
4037 | { |
||
4038 | return xstrdup (pathspec); |
||
4039 | } |
||
4040 | |||
4041 | tmp_pathspec = realpath (pathspec, buf); |
||
4042 | if (tmp_pathspec == 0) |
||
4043 | { |
||
4044 | lt_fatal (__FILE__, __LINE__, |
||
4045 | "could not follow symlinks for %s", pathspec); |
||
4046 | } |
||
4047 | return xstrdup (tmp_pathspec); |
||
4048 | #endif |
||
4049 | } |
||
4050 | |||
4051 | char * |
||
4052 | strendzap (char *str, const char *pat) |
||
4053 | { |
||
4054 | size_t len, patlen; |
||
4055 | |||
4056 | assert (str != NULL); |
||
4057 | assert (pat != NULL); |
||
4058 | |||
4059 | len = strlen (str); |
||
4060 | patlen = strlen (pat); |
||
4061 | |||
4062 | if (patlen <= len) |
||
4063 | { |
||
4064 | str += len - patlen; |
||
4065 | if (strcmp (str, pat) == 0) |
||
4066 | *str = '\0'; |
||
4067 | } |
||
4068 | return str; |
||
4069 | } |
||
4070 | |||
4071 | void |
||
4072 | lt_debugprintf (const char *file, int line, const char *fmt, ...) |
||
4073 | { |
||
4074 | va_list args; |
||
4075 | if (lt_debug) |
||
4076 | { |
||
4077 | (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); |
||
4078 | va_start (args, fmt); |
||
4079 | (void) vfprintf (stderr, fmt, args); |
||
4080 | va_end (args); |
||
4081 | } |
||
4082 | } |
||
4083 | |||
4084 | static void |
||
4085 | lt_error_core (int exit_status, const char *file, |
||
4086 | int line, const char *mode, |
||
4087 | const char *message, va_list ap) |
||
4088 | { |
||
4089 | fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); |
||
4090 | vfprintf (stderr, message, ap); |
||
4091 | fprintf (stderr, ".\n"); |
||
4092 | |||
4093 | if (exit_status >= 0) |
||
4094 | exit (exit_status); |
||
4095 | } |
||
4096 | |||
4097 | void |
||
4098 | lt_fatal (const char *file, int line, const char *message, ...) |
||
4099 | { |
||
4100 | va_list ap; |
||
4101 | va_start (ap, message); |
||
4102 | lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); |
||
4103 | va_end (ap); |
||
4104 | } |
||
4105 | |||
4106 | static const char * |
||
4107 | nonnull (const char *s) |
||
4108 | { |
||
4109 | return s ? s : "(null)"; |
||
4110 | } |
||
4111 | |||
4112 | static const char * |
||
4113 | nonempty (const char *s) |
||
4114 | { |
||
4115 | return (s && !*s) ? "(empty)" : nonnull (s); |
||
4116 | } |
||
4117 | |||
4118 | void |
||
4119 | lt_setenv (const char *name, const char *value) |
||
4120 | { |
||
4121 | lt_debugprintf (__FILE__, __LINE__, |
||
4122 | "(lt_setenv) setting '%s' to '%s'\n", |
||
4123 | nonnull (name), nonnull (value)); |
||
4124 | { |
||
4125 | #ifdef HAVE_SETENV |
||
4126 | /* always make a copy, for consistency with !HAVE_SETENV */ |
||
4127 | char *str = xstrdup (value); |
||
4128 | setenv (name, str, 1); |
||
4129 | #else |
||
4130 | int len = strlen (name) + 1 + strlen (value) + 1; |
||
4131 | char *str = XMALLOC (char, len); |
||
4132 | sprintf (str, "%s=%s", name, value); |
||
4133 | if (putenv (str) != EXIT_SUCCESS) |
||
4134 | { |
||
4135 | XFREE (str); |
||
4136 | } |
||
4137 | #endif |
||
4138 | } |
||
4139 | } |
||
4140 | |||
4141 | char * |
||
4142 | lt_extend_str (const char *orig_value, const char *add, int to_end) |
||
4143 | { |
||
4144 | char *new_value; |
||
4145 | if (orig_value && *orig_value) |
||
4146 | { |
||
4147 | int orig_value_len = strlen (orig_value); |
||
4148 | int add_len = strlen (add); |
||
4149 | new_value = XMALLOC (char, add_len + orig_value_len + 1); |
||
4150 | if (to_end) |
||
4151 | { |
||
4152 | strcpy (new_value, orig_value); |
||
4153 | strcpy (new_value + orig_value_len, add); |
||
4154 | } |
||
4155 | else |
||
4156 | { |
||
4157 | strcpy (new_value, add); |
||
4158 | strcpy (new_value + add_len, orig_value); |
||
4159 | } |
||
4160 | } |
||
4161 | else |
||
4162 | { |
||
4163 | new_value = xstrdup (add); |
||
4164 | } |
||
4165 | return new_value; |
||
4166 | } |
||
4167 | |||
4168 | void |
||
4169 | lt_update_exe_path (const char *name, const char *value) |
||
4170 | { |
||
4171 | lt_debugprintf (__FILE__, __LINE__, |
||
4172 | "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", |
||
4173 | nonnull (name), nonnull (value)); |
||
4174 | |||
4175 | if (name && *name && value && *value) |
||
4176 | { |
||
4177 | char *new_value = lt_extend_str (getenv (name), value, 0); |
||
4178 | /* some systems can't cope with a ':'-terminated path #' */ |
||
4179 | int len = strlen (new_value); |
||
4180 | while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) |
||
4181 | { |
||
4182 | new_value[len-1] = '\0'; |
||
4183 | } |
||
4184 | lt_setenv (name, new_value); |
||
4185 | XFREE (new_value); |
||
4186 | } |
||
4187 | } |
||
4188 | |||
4189 | void |
||
4190 | lt_update_lib_path (const char *name, const char *value) |
||
4191 | { |
||
4192 | lt_debugprintf (__FILE__, __LINE__, |
||
4193 | "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", |
||
4194 | nonnull (name), nonnull (value)); |
||
4195 | |||
4196 | if (name && *name && value && *value) |
||
4197 | { |
||
4198 | char *new_value = lt_extend_str (getenv (name), value, 0); |
||
4199 | lt_setenv (name, new_value); |
||
4200 | XFREE (new_value); |
||
4201 | } |
||
4202 | } |
||
4203 | |||
4204 | EOF |
||
4205 | case $host_os in |
||
4206 | mingw*) |
||
4207 | cat <<"EOF" |
||
4208 | |||
4209 | /* Prepares an argument vector before calling spawn(). |
||
4210 | Note that spawn() does not by itself call the command interpreter |
||
4211 | (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : |
||
4212 | ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
||
4213 | GetVersionEx(&v); |
||
4214 | v.dwPlatformId == VER_PLATFORM_WIN32_NT; |
||
4215 | }) ? "cmd.exe" : "command.com"). |
||
4216 | Instead it simply concatenates the arguments, separated by ' ', and calls |
||
4217 | CreateProcess(). We must quote the arguments since Win32 CreateProcess() |
||
4218 | interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a |
||
4219 | special way: |
||
4220 | - Space and tab are interpreted as delimiters. They are not treated as |
||
4221 | delimiters if they are surrounded by double quotes: "...". |
||
4222 | - Unescaped double quotes are removed from the input. Their only effect is |
||
4223 | that within double quotes, space and tab are treated like normal |
||
4224 | characters. |
||
4225 | - Backslashes not followed by double quotes are not special. |
||
4226 | - But 2*n+1 backslashes followed by a double quote become |
||
4227 | n backslashes followed by a double quote (n >= 0): |
||
4228 | \" -> " |
||
4229 | \\\" -> \" |
||
4230 | \\\\\" -> \\" |
||
4231 | */ |
||
4232 | #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" |
||
4233 | #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" |
||
4234 | char ** |
||
4235 | prepare_spawn (char **argv) |
||
4236 | { |
||
4237 | size_t argc; |
||
4238 | char **new_argv; |
||
4239 | size_t i; |
||
4240 | |||
4241 | /* Count number of arguments. */ |
||
4242 | for (argc = 0; argv[argc] != NULL; argc++) |
||
4243 | ; |
||
4244 | |||
4245 | /* Allocate new argument vector. */ |
||
4246 | new_argv = XMALLOC (char *, argc + 1); |
||
4247 | |||
4248 | /* Put quoted arguments into the new argument vector. */ |
||
4249 | for (i = 0; i < argc; i++) |
||
4250 | { |
||
4251 | const char *string = argv[i]; |
||
4252 | |||
4253 | if (string[0] == '\0') |
||
4254 | new_argv[i] = xstrdup ("\"\""); |
||
4255 | else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) |
||
4256 | { |
||
4257 | int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); |
||
4258 | size_t length; |
||
4259 | unsigned int backslashes; |
||
4260 | const char *s; |
||
4261 | char *quoted_string; |
||
4262 | char *p; |
||
4263 | |||
4264 | length = 0; |
||
4265 | backslashes = 0; |
||
4266 | if (quote_around) |
||
4267 | length++; |
||
4268 | for (s = string; *s != '\0'; s++) |
||
4269 | { |
||
4270 | char c = *s; |
||
4271 | if (c == '"') |
||
4272 | length += backslashes + 1; |
||
4273 | length++; |
||
4274 | if (c == '\\') |
||
4275 | backslashes++; |
||
4276 | else |
||
4277 | backslashes = 0; |
||
4278 | } |
||
4279 | if (quote_around) |
||
4280 | length += backslashes + 1; |
||
4281 | |||
4282 | quoted_string = XMALLOC (char, length + 1); |
||
4283 | |||
4284 | p = quoted_string; |
||
4285 | backslashes = 0; |
||
4286 | if (quote_around) |
||
4287 | *p++ = '"'; |
||
4288 | for (s = string; *s != '\0'; s++) |
||
4289 | { |
||
4290 | char c = *s; |
||
4291 | if (c == '"') |
||
4292 | { |
||
4293 | unsigned int j; |
||
4294 | for (j = backslashes + 1; j > 0; j--) |
||
4295 | *p++ = '\\'; |
||
4296 | } |
||
4297 | *p++ = c; |
||
4298 | if (c == '\\') |
||
4299 | backslashes++; |
||
4300 | else |
||
4301 | backslashes = 0; |
||
4302 | } |
||
4303 | if (quote_around) |
||
4304 | { |
||
4305 | unsigned int j; |
||
4306 | for (j = backslashes; j > 0; j--) |
||
4307 | *p++ = '\\'; |
||
4308 | *p++ = '"'; |
||
4309 | } |
||
4310 | *p = '\0'; |
||
4311 | |||
4312 | new_argv[i] = quoted_string; |
||
4313 | } |
||
4314 | else |
||
4315 | new_argv[i] = (char *) string; |
||
4316 | } |
||
4317 | new_argv[argc] = NULL; |
||
4318 | |||
4319 | return new_argv; |
||
4320 | } |
||
4321 | EOF |
||
4322 | ;; |
||
4323 | esac |
||
4324 | |||
4325 | cat <<"EOF" |
||
4326 | void lt_dump_script (FILE* f) |
||
4327 | { |
||
4328 | EOF |
||
4329 | func_emit_wrapper yes | |
||
4330 | $SED -e 's/\([\\"]\)/\\\1/g' \ |
||
4331 | -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' |
||
4332 | |||
4333 | cat <<"EOF" |
||
4334 | } |
||
4335 | EOF |
||
4336 | } |
||
4337 | # end: func_emit_cwrapperexe_src |
||
4338 | |||
4339 | # func_win32_import_lib_p ARG |
||
4340 | # True if ARG is an import lib, as indicated by $file_magic_cmd |
||
4341 | func_win32_import_lib_p () |
||
4342 | { |
||
4343 | $opt_debug |
||
4344 | case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in |
||
4345 | *import*) : ;; |
||
4346 | *) false ;; |
||
4347 | esac |
||
4348 | } |
||
4349 | |||
4350 | # func_mode_link arg... |
||
4351 | func_mode_link () |
||
4352 | { |
||
4353 | $opt_debug |
||
4354 | case $host in |
||
4355 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
||
4356 | # It is impossible to link a dll without this setting, and |
||
4357 | # we shouldn't force the makefile maintainer to figure out |
||
4358 | # which system we are compiling for in order to pass an extra |
||
4359 | # flag for every libtool invocation. |
||
4360 | # allow_undefined=no |
||
4361 | |||
4362 | # FIXME: Unfortunately, there are problems with the above when trying |
||
4363 | # to make a dll which has undefined symbols, in which case not |
||
4364 | # even a static library is built. For now, we need to specify |
||
4365 | # -no-undefined on the libtool link line when we can be certain |
||
4366 | # that all symbols are satisfied, otherwise we get a static library. |
||
4367 | allow_undefined=yes |
||
4368 | ;; |
||
4369 | *) |
||
4370 | allow_undefined=yes |
||
4371 | ;; |
||
4372 | esac |
||
4373 | libtool_args=$nonopt |
||
4374 | base_compile="$nonopt $@" |
||
4375 | compile_command=$nonopt |
||
4376 | finalize_command=$nonopt |
||
4377 | |||
4378 | compile_rpath= |
||
4379 | finalize_rpath= |
||
4380 | compile_shlibpath= |
||
4381 | finalize_shlibpath= |
||
4382 | convenience= |
||
4383 | old_convenience= |
||
4384 | deplibs= |
||
4385 | old_deplibs= |
||
4386 | compiler_flags= |
||
4387 | linker_flags= |
||
4388 | dllsearchpath= |
||
4389 | lib_search_path=`pwd` |
||
4390 | inst_prefix_dir= |
||
4391 | new_inherited_linker_flags= |
||
4392 | |||
4393 | avoid_version=no |
||
4394 | bindir= |
||
4395 | dlfiles= |
||
4396 | dlprefiles= |
||
4397 | dlself=no |
||
4398 | export_dynamic=no |
||
4399 | export_symbols= |
||
4400 | export_symbols_regex= |
||
4401 | generated= |
||
4402 | libobjs= |
||
4403 | ltlibs= |
||
4404 | module=no |
||
4405 | no_install=no |
||
4406 | objs= |
||
4407 | non_pic_objects= |
||
4408 | precious_files_regex= |
||
4409 | prefer_static_libs=no |
||
4410 | preload=no |
||
4411 | prev= |
||
4412 | prevarg= |
||
4413 | release= |
||
4414 | rpath= |
||
4415 | xrpath= |
||
4416 | perm_rpath= |
||
4417 | temp_rpath= |
||
4418 | thread_safe=no |
||
4419 | vinfo= |
||
4420 | vinfo_number=no |
||
4421 | weak_libs= |
||
4422 | single_module="${wl}-single_module" |
||
4423 | func_infer_tag $base_compile |
||
4424 | |||
4425 | # We need to know -static, to get the right output filenames. |
||
4426 | for arg |
||
4427 | do |
||
4428 | case $arg in |
||
4429 | -shared) |
||
4430 | test "$build_libtool_libs" != yes && \ |
||
4431 | func_fatal_configuration "can not build a shared library" |
||
4432 | build_old_libs=no |
||
4433 | break |
||
4434 | ;; |
||
4435 | -all-static | -static | -static-libtool-libs) |
||
4436 | case $arg in |
||
4437 | -all-static) |
||
4438 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
||
4439 | func_warning "complete static linking is impossible in this configuration" |
||
4440 | fi |
||
4441 | if test -n "$link_static_flag"; then |
||
4442 | dlopen_self=$dlopen_self_static |
||
4443 | fi |
||
4444 | prefer_static_libs=yes |
||
4445 | ;; |
||
4446 | -static) |
||
4447 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
||
4448 | dlopen_self=$dlopen_self_static |
||
4449 | fi |
||
4450 | prefer_static_libs=built |
||
4451 | ;; |
||
4452 | -static-libtool-libs) |
||
4453 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
||
4454 | dlopen_self=$dlopen_self_static |
||
4455 | fi |
||
4456 | prefer_static_libs=yes |
||
4457 | ;; |
||
4458 | esac |
||
4459 | build_libtool_libs=no |
||
4460 | build_old_libs=yes |
||
4461 | break |
||
4462 | ;; |
||
4463 | esac |
||
4464 | done |
||
4465 | |||
4466 | # See if our shared archives depend on static archives. |
||
4467 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
||
4468 | |||
4469 | # Go through the arguments, transforming them on the way. |
||
4470 | while test "$#" -gt 0; do |
||
4471 | arg="$1" |
||
4472 | shift |
||
4473 | func_quote_for_eval "$arg" |
||
4474 | qarg=$func_quote_for_eval_unquoted_result |
||
4475 | func_append libtool_args " $func_quote_for_eval_result" |
||
4476 | |||
4477 | # If the previous option needs an argument, assign it. |
||
4478 | if test -n "$prev"; then |
||
4479 | case $prev in |
||
4480 | output) |
||
4481 | func_append compile_command " @OUTPUT@" |
||
4482 | func_append finalize_command " @OUTPUT@" |
||
4483 | ;; |
||
4484 | esac |
||
4485 | |||
4486 | case $prev in |
||
4487 | bindir) |
||
4488 | bindir="$arg" |
||
4489 | prev= |
||
4490 | continue |
||
4491 | ;; |
||
4492 | dlfiles|dlprefiles) |
||
4493 | if test "$preload" = no; then |
||
4494 | # Add the symbol object into the linking commands. |
||
4495 | func_append compile_command " @SYMFILE@" |
||
4496 | func_append finalize_command " @SYMFILE@" |
||
4497 | preload=yes |
||
4498 | fi |
||
4499 | case $arg in |
||
4500 | *.la | *.lo) ;; # We handle these cases below. |
||
4501 | force) |
||
4502 | if test "$dlself" = no; then |
||
4503 | dlself=needless |
||
4504 | export_dynamic=yes |
||
4505 | fi |
||
4506 | prev= |
||
4507 | continue |
||
4508 | ;; |
||
4509 | self) |
||
4510 | if test "$prev" = dlprefiles; then |
||
4511 | dlself=yes |
||
4512 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
||
4513 | dlself=yes |
||
4514 | else |
||
4515 | dlself=needless |
||
4516 | export_dynamic=yes |
||
4517 | fi |
||
4518 | prev= |
||
4519 | continue |
||
4520 | ;; |
||
4521 | *) |
||
4522 | if test "$prev" = dlfiles; then |
||
4523 | dlfiles="$dlfiles $arg" |
||
4524 | else |
||
4525 | dlprefiles="$dlprefiles $arg" |
||
4526 | fi |
||
4527 | prev= |
||
4528 | continue |
||
4529 | ;; |
||
4530 | esac |
||
4531 | ;; |
||
4532 | expsyms) |
||
4533 | export_symbols="$arg" |
||
4534 | test -f "$arg" \ |
||
4535 | || func_fatal_error "symbol file \`$arg' does not exist" |
||
4536 | prev= |
||
4537 | continue |
||
4538 | ;; |
||
4539 | expsyms_regex) |
||
4540 | export_symbols_regex="$arg" |
||
4541 | prev= |
||
4542 | continue |
||
4543 | ;; |
||
4544 | framework) |
||
4545 | case $host in |
||
4546 | *-*-darwin*) |
||
4547 | case "$deplibs " in |
||
4548 | *" $qarg.ltframework "*) ;; |
||
4549 | *) deplibs="$deplibs $qarg.ltframework" # this is fixed later |
||
4550 | ;; |
||
4551 | esac |
||
4552 | ;; |
||
4553 | esac |
||
4554 | prev= |
||
4555 | continue |
||
4556 | ;; |
||
4557 | inst_prefix) |
||
4558 | inst_prefix_dir="$arg" |
||
4559 | prev= |
||
4560 | continue |
||
4561 | ;; |
||
4562 | objectlist) |
||
4563 | if test -f "$arg"; then |
||
4564 | save_arg=$arg |
||
4565 | moreargs= |
||
4566 | for fil in `cat "$save_arg"` |
||
4567 | do |
||
4568 | # moreargs="$moreargs $fil" |
||
4569 | arg=$fil |
||
4570 | # A libtool-controlled object. |
||
4571 | |||
4572 | # Check to see that this really is a libtool object. |
||
4573 | if func_lalib_unsafe_p "$arg"; then |
||
4574 | pic_object= |
||
4575 | non_pic_object= |
||
4576 | |||
4577 | # Read the .lo file |
||
4578 | func_source "$arg" |
||
4579 | |||
4580 | if test -z "$pic_object" || |
||
4581 | test -z "$non_pic_object" || |
||
4582 | test "$pic_object" = none && |
||
4583 | test "$non_pic_object" = none; then |
||
4584 | func_fatal_error "cannot find name of object for \`$arg'" |
||
4585 | fi |
||
4586 | |||
4587 | # Extract subdirectory from the argument. |
||
4588 | func_dirname "$arg" "/" "" |
||
4589 | xdir="$func_dirname_result" |
||
4590 | |||
4591 | if test "$pic_object" != none; then |
||
4592 | # Prepend the subdirectory the object is found in. |
||
4593 | pic_object="$xdir$pic_object" |
||
4594 | |||
4595 | if test "$prev" = dlfiles; then |
||
4596 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
||
4597 | dlfiles="$dlfiles $pic_object" |
||
4598 | prev= |
||
4599 | continue |
||
4600 | else |
||
4601 | # If libtool objects are unsupported, then we need to preload. |
||
4602 | prev=dlprefiles |
||
4603 | fi |
||
4604 | fi |
||
4605 | |||
4606 | # CHECK ME: I think I busted this. -Ossama |
||
4607 | if test "$prev" = dlprefiles; then |
||
4608 | # Preload the old-style object. |
||
4609 | dlprefiles="$dlprefiles $pic_object" |
||
4610 | prev= |
||
4611 | fi |
||
4612 | |||
4613 | # A PIC object. |
||
4614 | func_append libobjs " $pic_object" |
||
4615 | arg="$pic_object" |
||
4616 | fi |
||
4617 | |||
4618 | # Non-PIC object. |
||
4619 | if test "$non_pic_object" != none; then |
||
4620 | # Prepend the subdirectory the object is found in. |
||
4621 | non_pic_object="$xdir$non_pic_object" |
||
4622 | |||
4623 | # A standard non-PIC object |
||
4624 | func_append non_pic_objects " $non_pic_object" |
||
4625 | if test -z "$pic_object" || test "$pic_object" = none ; then |
||
4626 | arg="$non_pic_object" |
||
4627 | fi |
||
4628 | else |
||
4629 | # If the PIC object exists, use it instead. |
||
4630 | # $xdir was prepended to $pic_object above. |
||
4631 | non_pic_object="$pic_object" |
||
4632 | func_append non_pic_objects " $non_pic_object" |
||
4633 | fi |
||
4634 | else |
||
4635 | # Only an error if not doing a dry-run. |
||
4636 | if $opt_dry_run; then |
||
4637 | # Extract subdirectory from the argument. |
||
4638 | func_dirname "$arg" "/" "" |
||
4639 | xdir="$func_dirname_result" |
||
4640 | |||
4641 | func_lo2o "$arg" |
||
4642 | pic_object=$xdir$objdir/$func_lo2o_result |
||
4643 | non_pic_object=$xdir$func_lo2o_result |
||
4644 | func_append libobjs " $pic_object" |
||
4645 | func_append non_pic_objects " $non_pic_object" |
||
4646 | else |
||
4647 | func_fatal_error "\`$arg' is not a valid libtool object" |
||
4648 | fi |
||
4649 | fi |
||
4650 | done |
||
4651 | else |
||
4652 | func_fatal_error "link input file \`$arg' does not exist" |
||
4653 | fi |
||
4654 | arg=$save_arg |
||
4655 | prev= |
||
4656 | continue |
||
4657 | ;; |
||
4658 | precious_regex) |
||
4659 | precious_files_regex="$arg" |
||
4660 | prev= |
||
4661 | continue |
||
4662 | ;; |
||
4663 | release) |
||
4664 | release="-$arg" |
||
4665 | prev= |
||
4666 | continue |
||
4667 | ;; |
||
4668 | rpath | xrpath) |
||
4669 | # We need an absolute path. |
||
4670 | case $arg in |
||
4671 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
||
4672 | *) |
||
4673 | func_fatal_error "only absolute run-paths are allowed" |
||
4674 | ;; |
||
4675 | esac |
||
4676 | if test "$prev" = rpath; then |
||
4677 | case "$rpath " in |
||
4678 | *" $arg "*) ;; |
||
4679 | *) rpath="$rpath $arg" ;; |
||
4680 | esac |
||
4681 | else |
||
4682 | case "$xrpath " in |
||
4683 | *" $arg "*) ;; |
||
4684 | *) xrpath="$xrpath $arg" ;; |
||
4685 | esac |
||
4686 | fi |
||
4687 | prev= |
||
4688 | continue |
||
4689 | ;; |
||
4690 | shrext) |
||
4691 | shrext_cmds="$arg" |
||
4692 | prev= |
||
4693 | continue |
||
4694 | ;; |
||
4695 | weak) |
||
4696 | weak_libs="$weak_libs $arg" |
||
4697 | prev= |
||
4698 | continue |
||
4699 | ;; |
||
4700 | xcclinker) |
||
4701 | linker_flags="$linker_flags $qarg" |
||
4702 | compiler_flags="$compiler_flags $qarg" |
||
4703 | prev= |
||
4704 | func_append compile_command " $qarg" |
||
4705 | func_append finalize_command " $qarg" |
||
4706 | continue |
||
4707 | ;; |
||
4708 | xcompiler) |
||
4709 | compiler_flags="$compiler_flags $qarg" |
||
4710 | prev= |
||
4711 | func_append compile_command " $qarg" |
||
4712 | func_append finalize_command " $qarg" |
||
4713 | continue |
||
4714 | ;; |
||
4715 | xlinker) |
||
4716 | linker_flags="$linker_flags $qarg" |
||
4717 | compiler_flags="$compiler_flags $wl$qarg" |
||
4718 | prev= |
||
4719 | func_append compile_command " $wl$qarg" |
||
4720 | func_append finalize_command " $wl$qarg" |
||
4721 | continue |
||
4722 | ;; |
||
4723 | *) |
||
4724 | eval "$prev=\"\$arg\"" |
||
4725 | prev= |
||
4726 | continue |
||
4727 | ;; |
||
4728 | esac |
||
4729 | fi # test -n "$prev" |
||
4730 | |||
4731 | prevarg="$arg" |
||
4732 | |||
4733 | case $arg in |
||
4734 | -all-static) |
||
4735 | if test -n "$link_static_flag"; then |
||
4736 | # See comment for -static flag below, for more details. |
||
4737 | func_append compile_command " $link_static_flag" |
||
4738 | func_append finalize_command " $link_static_flag" |
||
4739 | fi |
||
4740 | continue |
||
4741 | ;; |
||
4742 | |||
4743 | -allow-undefined) |
||
4744 | # FIXME: remove this flag sometime in the future. |
||
4745 | func_fatal_error "\`-allow-undefined' must not be used because it is the default" |
||
4746 | ;; |
||
4747 | |||
4748 | -avoid-version) |
||
4749 | avoid_version=yes |
||
4750 | continue |
||
4751 | ;; |
||
4752 | |||
4753 | -bindir) |
||
4754 | prev=bindir |
||
4755 | continue |
||
4756 | ;; |
||
4757 | |||
4758 | -dlopen) |
||
4759 | prev=dlfiles |
||
4760 | continue |
||
4761 | ;; |
||
4762 | |||
4763 | -dlpreopen) |
||
4764 | prev=dlprefiles |
||
4765 | continue |
||
4766 | ;; |
||
4767 | |||
4768 | -export-dynamic) |
||
4769 | export_dynamic=yes |
||
4770 | continue |
||
4771 | ;; |
||
4772 | |||
4773 | -export-symbols | -export-symbols-regex) |
||
4774 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
||
4775 | func_fatal_error "more than one -exported-symbols argument is not allowed" |
||
4776 | fi |
||
4777 | if test "X$arg" = "X-export-symbols"; then |
||
4778 | prev=expsyms |
||
4779 | else |
||
4780 | prev=expsyms_regex |
||
4781 | fi |
||
4782 | continue |
||
4783 | ;; |
||
4784 | |||
4785 | -framework) |
||
4786 | prev=framework |
||
4787 | continue |
||
4788 | ;; |
||
4789 | |||
4790 | -inst-prefix-dir) |
||
4791 | prev=inst_prefix |
||
4792 | continue |
||
4793 | ;; |
||
4794 | |||
4795 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
||
4796 | # so, if we see these flags be careful not to treat them like -L |
||
4797 | -L[A-Z][A-Z]*:*) |
||
4798 | case $with_gcc/$host in |
||
4799 | no/*-*-irix* | /*-*-irix*) |
||
4800 | func_append compile_command " $arg" |
||
4801 | func_append finalize_command " $arg" |
||
4802 | ;; |
||
4803 | esac |
||
4804 | continue |
||
4805 | ;; |
||
4806 | |||
4807 | -L*) |
||
4808 | func_stripname '-L' '' "$arg" |
||
4809 | dir=$func_stripname_result |
||
4810 | if test -z "$dir"; then |
||
4811 | if test "$#" -gt 0; then |
||
4812 | func_fatal_error "require no space between \`-L' and \`$1'" |
||
4813 | else |
||
4814 | func_fatal_error "need path for \`-L' option" |
||
4815 | fi |
||
4816 | fi |
||
4817 | # We need an absolute path. |
||
4818 | case $dir in |
||
4819 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
||
4820 | *) |
||
4821 | absdir=`cd "$dir" && pwd` |
||
4822 | test -z "$absdir" && \ |
||
4823 | func_fatal_error "cannot determine absolute directory name of \`$dir'" |
||
4824 | dir="$absdir" |
||
4825 | ;; |
||
4826 | esac |
||
4827 | case "$deplibs " in |
||
4828 | *" -L$dir "*) ;; |
||
4829 | *) |
||
4830 | deplibs="$deplibs -L$dir" |
||
4831 | lib_search_path="$lib_search_path $dir" |
||
4832 | ;; |
||
4833 | esac |
||
4834 | case $host in |
||
4835 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
||
4836 | testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` |
||
4837 | case :$dllsearchpath: in |
||
4838 | *":$dir:"*) ;; |
||
4839 | ::) dllsearchpath=$dir;; |
||
4840 | *) dllsearchpath="$dllsearchpath:$dir";; |
||
4841 | esac |
||
4842 | case :$dllsearchpath: in |
||
4843 | *":$testbindir:"*) ;; |
||
4844 | ::) dllsearchpath=$testbindir;; |
||
4845 | *) dllsearchpath="$dllsearchpath:$testbindir";; |
||
4846 | esac |
||
4847 | ;; |
||
4848 | esac |
||
4849 | continue |
||
4850 | ;; |
||
4851 | |||
4852 | -l*) |
||
4853 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
||
4854 | case $host in |
||
4855 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) |
||
4856 | # These systems don't actually have a C or math library (as such) |
||
4857 | continue |
||
4858 | ;; |
||
4859 | *-*-os2*) |
||
4860 | # These systems don't actually have a C library (as such) |
||
4861 | test "X$arg" = "X-lc" && continue |
||
4862 | ;; |
||
4863 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
||
4864 | # Do not include libc due to us having libc/libc_r. |
||
4865 | test "X$arg" = "X-lc" && continue |
||
4866 | ;; |
||
4867 | *-*-rhapsody* | *-*-darwin1.[012]) |
||
4868 | # Rhapsody C and math libraries are in the System framework |
||
4869 | deplibs="$deplibs System.ltframework" |
||
4870 | continue |
||
4871 | ;; |
||
4872 | *-*-sco3.2v5* | *-*-sco5v6*) |
||
4873 | # Causes problems with __ctype |
||
4874 | test "X$arg" = "X-lc" && continue |
||
4875 | ;; |
||
4876 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
||
4877 | # Compiler inserts libc in the correct place for threads to work |
||
4878 | test "X$arg" = "X-lc" && continue |
||
4879 | ;; |
||
4880 | esac |
||
4881 | elif test "X$arg" = "X-lc_r"; then |
||
4882 | case $host in |
||
4883 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
||
4884 | # Do not include libc_r directly, use -pthread flag. |
||
4885 | continue |
||
4886 | ;; |
||
4887 | esac |
||
4888 | fi |
||
4889 | deplibs="$deplibs $arg" |
||
4890 | continue |
||
4891 | ;; |
||
4892 | |||
4893 | -module) |
||
4894 | module=yes |
||
4895 | continue |
||
4896 | ;; |
||
4897 | |||
4898 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
||
4899 | # classes, name mangling, and exception handling. |
||
4900 | # Darwin uses the -arch flag to determine output architecture. |
||
4901 | -model|-arch|-isysroot) |
||
4902 | compiler_flags="$compiler_flags $arg" |
||
4903 | func_append compile_command " $arg" |
||
4904 | func_append finalize_command " $arg" |
||
4905 | prev=xcompiler |
||
4906 | continue |
||
4907 | ;; |
||
4908 | |||
4909 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
||
4910 | compiler_flags="$compiler_flags $arg" |
||
4911 | func_append compile_command " $arg" |
||
4912 | func_append finalize_command " $arg" |
||
4913 | case "$new_inherited_linker_flags " in |
||
4914 | *" $arg "*) ;; |
||
4915 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; |
||
4916 | esac |
||
4917 | continue |
||
4918 | ;; |
||
4919 | |||
4920 | -multi_module) |
||
4921 | single_module="${wl}-multi_module" |
||
4922 | continue |
||
4923 | ;; |
||
4924 | |||
4925 | -no-fast-install) |
||
4926 | fast_install=no |
||
4927 | continue |
||
4928 | ;; |
||
4929 | |||
4930 | -no-install) |
||
4931 | case $host in |
||
4932 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) |
||
4933 | # The PATH hackery in wrapper scripts is required on Windows |
||
4934 | # and Darwin in order for the loader to find any dlls it needs. |
||
4935 | func_warning "\`-no-install' is ignored for $host" |
||
4936 | func_warning "assuming \`-no-fast-install' instead" |
||
4937 | fast_install=no |
||
4938 | ;; |
||
4939 | *) no_install=yes ;; |
||
4940 | esac |
||
4941 | continue |
||
4942 | ;; |
||
4943 | |||
4944 | -no-undefined) |
||
4945 | allow_undefined=no |
||
4946 | continue |
||
4947 | ;; |
||
4948 | |||
4949 | -objectlist) |
||
4950 | prev=objectlist |
||
4951 | continue |
||
4952 | ;; |
||
4953 | |||
4954 | -o) prev=output ;; |
||
4955 | |||
4956 | -precious-files-regex) |
||
4957 | prev=precious_regex |
||
4958 | continue |
||
4959 | ;; |
||
4960 | |||
4961 | -release) |
||
4962 | prev=release |
||
4963 | continue |
||
4964 | ;; |
||
4965 | |||
4966 | -rpath) |
||
4967 | prev=rpath |
||
4968 | continue |
||
4969 | ;; |
||
4970 | |||
4971 | -R) |
||
4972 | prev=xrpath |
||
4973 | continue |
||
4974 | ;; |
||
4975 | |||
4976 | -R*) |
||
4977 | func_stripname '-R' '' "$arg" |
||
4978 | dir=$func_stripname_result |
||
4979 | # We need an absolute path. |
||
4980 | case $dir in |
||
4981 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
||
4982 | *) |
||
4983 | func_fatal_error "only absolute run-paths are allowed" |
||
4984 | ;; |
||
4985 | esac |
||
4986 | case "$xrpath " in |
||
4987 | *" $dir "*) ;; |
||
4988 | *) xrpath="$xrpath $dir" ;; |
||
4989 | esac |
||
4990 | continue |
||
4991 | ;; |
||
4992 | |||
4993 | -shared) |
||
4994 | # The effects of -shared are defined in a previous loop. |
||
4995 | continue |
||
4996 | ;; |
||
4997 | |||
4998 | -shrext) |
||
4999 | prev=shrext |
||
5000 | continue |
||
5001 | ;; |
||
5002 | |||
5003 | -static | -static-libtool-libs) |
||
5004 | # The effects of -static are defined in a previous loop. |
||
5005 | # We used to do the same as -all-static on platforms that |
||
5006 | # didn't have a PIC flag, but the assumption that the effects |
||
5007 | # would be equivalent was wrong. It would break on at least |
||
5008 | # Digital Unix and AIX. |
||
5009 | continue |
||
5010 | ;; |
||
5011 | |||
5012 | -thread-safe) |
||
5013 | thread_safe=yes |
||
5014 | continue |
||
5015 | ;; |
||
5016 | |||
5017 | -version-info) |
||
5018 | prev=vinfo |
||
5019 | continue |
||
5020 | ;; |
||
5021 | |||
5022 | -version-number) |
||
5023 | prev=vinfo |
||
5024 | vinfo_number=yes |
||
5025 | continue |
||
5026 | ;; |
||
5027 | |||
5028 | -weak) |
||
5029 | prev=weak |
||
5030 | continue |
||
5031 | ;; |
||
5032 | |||
5033 | -Wc,*) |
||
5034 | func_stripname '-Wc,' '' "$arg" |
||
5035 | args=$func_stripname_result |
||
5036 | arg= |
||
5037 | save_ifs="$IFS"; IFS=',' |
||
5038 | for flag in $args; do |
||
5039 | IFS="$save_ifs" |
||
5040 | func_quote_for_eval "$flag" |
||
5041 | arg="$arg $func_quote_for_eval_result" |
||
5042 | compiler_flags="$compiler_flags $func_quote_for_eval_result" |
||
5043 | done |
||
5044 | IFS="$save_ifs" |
||
5045 | func_stripname ' ' '' "$arg" |
||
5046 | arg=$func_stripname_result |
||
5047 | ;; |
||
5048 | |||
5049 | -Wl,*) |
||
5050 | func_stripname '-Wl,' '' "$arg" |
||
5051 | args=$func_stripname_result |
||
5052 | arg= |
||
5053 | save_ifs="$IFS"; IFS=',' |
||
5054 | for flag in $args; do |
||
5055 | IFS="$save_ifs" |
||
5056 | func_quote_for_eval "$flag" |
||
5057 | arg="$arg $wl$func_quote_for_eval_result" |
||
5058 | compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" |
||
5059 | linker_flags="$linker_flags $func_quote_for_eval_result" |
||
5060 | done |
||
5061 | IFS="$save_ifs" |
||
5062 | func_stripname ' ' '' "$arg" |
||
5063 | arg=$func_stripname_result |
||
5064 | ;; |
||
5065 | |||
5066 | -Xcompiler) |
||
5067 | prev=xcompiler |
||
5068 | continue |
||
5069 | ;; |
||
5070 | |||
5071 | -Xlinker) |
||
5072 | prev=xlinker |
||
5073 | continue |
||
5074 | ;; |
||
5075 | |||
5076 | -XCClinker) |
||
5077 | prev=xcclinker |
||
5078 | continue |
||
5079 | ;; |
||
5080 | |||
5081 | # -msg_* for osf cc |
||
5082 | -msg_*) |
||
5083 | func_quote_for_eval "$arg" |
||
5084 | arg="$func_quote_for_eval_result" |
||
5085 | ;; |
||
5086 | |||
5087 | # Flags to be passed through unchanged, with rationale: |
||
5088 | # -64, -mips[0-9] enable 64-bit mode for the SGI compiler |
||
5089 | # -r[0-9][0-9]* specify processor for the SGI compiler |
||
5090 | # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler |
||
5091 | # +DA*, +DD* enable 64-bit mode for the HP compiler |
||
5092 | # -q* compiler args for the IBM compiler |
||
5093 | # -m*, -t[45]*, -txscale* architecture-specific flags for GCC |
||
5094 | # -F/path path to uninstalled frameworks, gcc on darwin |
||
5095 | # -p, -pg, --coverage, -fprofile-* profiling flags for GCC |
||
5096 | # @file GCC response files |
||
5097 | # -tp=* Portland pgcc target processor selection |
||
5098 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ |
||
5099 | -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) |
||
5100 | func_quote_for_eval "$arg" |
||
5101 | arg="$func_quote_for_eval_result" |
||
5102 | func_append compile_command " $arg" |
||
5103 | func_append finalize_command " $arg" |
||
5104 | compiler_flags="$compiler_flags $arg" |
||
5105 | continue |
||
5106 | ;; |
||
5107 | |||
5108 | # Some other compiler flag. |
||
5109 | -* | +*) |
||
5110 | func_quote_for_eval "$arg" |
||
5111 | arg="$func_quote_for_eval_result" |
||
5112 | ;; |
||
5113 | |||
5114 | *.$objext) |
||
5115 | # A standard object. |
||
5116 | objs="$objs $arg" |
||
5117 | ;; |
||
5118 | |||
5119 | *.lo) |
||
5120 | # A libtool-controlled object. |
||
5121 | |||
5122 | # Check to see that this really is a libtool object. |
||
5123 | if func_lalib_unsafe_p "$arg"; then |
||
5124 | pic_object= |
||
5125 | non_pic_object= |
||
5126 | |||
5127 | # Read the .lo file |
||
5128 | func_source "$arg" |
||
5129 | |||
5130 | if test -z "$pic_object" || |
||
5131 | test -z "$non_pic_object" || |
||
5132 | test "$pic_object" = none && |
||
5133 | test "$non_pic_object" = none; then |
||
5134 | func_fatal_error "cannot find name of object for \`$arg'" |
||
5135 | fi |
||
5136 | |||
5137 | # Extract subdirectory from the argument. |
||
5138 | func_dirname "$arg" "/" "" |
||
5139 | xdir="$func_dirname_result" |
||
5140 | |||
5141 | if test "$pic_object" != none; then |
||
5142 | # Prepend the subdirectory the object is found in. |
||
5143 | pic_object="$xdir$pic_object" |
||
5144 | |||
5145 | if test "$prev" = dlfiles; then |
||
5146 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
||
5147 | dlfiles="$dlfiles $pic_object" |
||
5148 | prev= |
||
5149 | continue |
||
5150 | else |
||
5151 | # If libtool objects are unsupported, then we need to preload. |
||
5152 | prev=dlprefiles |
||
5153 | fi |
||
5154 | fi |
||
5155 | |||
5156 | # CHECK ME: I think I busted this. -Ossama |
||
5157 | if test "$prev" = dlprefiles; then |
||
5158 | # Preload the old-style object. |
||
5159 | dlprefiles="$dlprefiles $pic_object" |
||
5160 | prev= |
||
5161 | fi |
||
5162 | |||
5163 | # A PIC object. |
||
5164 | func_append libobjs " $pic_object" |
||
5165 | arg="$pic_object" |
||
5166 | fi |
||
5167 | |||
5168 | # Non-PIC object. |
||
5169 | if test "$non_pic_object" != none; then |
||
5170 | # Prepend the subdirectory the object is found in. |
||
5171 | non_pic_object="$xdir$non_pic_object" |
||
5172 | |||
5173 | # A standard non-PIC object |
||
5174 | func_append non_pic_objects " $non_pic_object" |
||
5175 | if test -z "$pic_object" || test "$pic_object" = none ; then |
||
5176 | arg="$non_pic_object" |
||
5177 | fi |
||
5178 | else |
||
5179 | # If the PIC object exists, use it instead. |
||
5180 | # $xdir was prepended to $pic_object above. |
||
5181 | non_pic_object="$pic_object" |
||
5182 | func_append non_pic_objects " $non_pic_object" |
||
5183 | fi |
||
5184 | else |
||
5185 | # Only an error if not doing a dry-run. |
||
5186 | if $opt_dry_run; then |
||
5187 | # Extract subdirectory from the argument. |
||
5188 | func_dirname "$arg" "/" "" |
||
5189 | xdir="$func_dirname_result" |
||
5190 | |||
5191 | func_lo2o "$arg" |
||
5192 | pic_object=$xdir$objdir/$func_lo2o_result |
||
5193 | non_pic_object=$xdir$func_lo2o_result |
||
5194 | func_append libobjs " $pic_object" |
||
5195 | func_append non_pic_objects " $non_pic_object" |
||
5196 | else |
||
5197 | func_fatal_error "\`$arg' is not a valid libtool object" |
||
5198 | fi |
||
5199 | fi |
||
5200 | ;; |
||
5201 | |||
5202 | *.$libext) |
||
5203 | # An archive. |
||
5204 | deplibs="$deplibs $arg" |
||
5205 | old_deplibs="$old_deplibs $arg" |
||
5206 | continue |
||
5207 | ;; |
||
5208 | |||
5209 | *.la) |
||
5210 | # A libtool-controlled library. |
||
5211 | |||
5212 | if test "$prev" = dlfiles; then |
||
5213 | # This library was specified with -dlopen. |
||
5214 | dlfiles="$dlfiles $arg" |
||
5215 | prev= |
||
5216 | elif test "$prev" = dlprefiles; then |
||
5217 | # The library was specified with -dlpreopen. |
||
5218 | dlprefiles="$dlprefiles $arg" |
||
5219 | prev= |
||
5220 | else |
||
5221 | deplibs="$deplibs $arg" |
||
5222 | fi |
||
5223 | continue |
||
5224 | ;; |
||
5225 | |||
5226 | # Some other compiler argument. |
||
5227 | *) |
||
5228 | # Unknown arguments in both finalize_command and compile_command need |
||
5229 | # to be aesthetically quoted because they are evaled later. |
||
5230 | func_quote_for_eval "$arg" |
||
5231 | arg="$func_quote_for_eval_result" |
||
5232 | ;; |
||
5233 | esac # arg |
||
5234 | |||
5235 | # Now actually substitute the argument into the commands. |
||
5236 | if test -n "$arg"; then |
||
5237 | func_append compile_command " $arg" |
||
5238 | func_append finalize_command " $arg" |
||
5239 | fi |
||
5240 | done # argument parsing loop |
||
5241 | |||
5242 | test -n "$prev" && \ |
||
5243 | func_fatal_help "the \`$prevarg' option requires an argument" |
||
5244 | |||
5245 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
||
5246 | eval arg=\"$export_dynamic_flag_spec\" |
||
5247 | func_append compile_command " $arg" |
||
5248 | func_append finalize_command " $arg" |
||
5249 | fi |
||
5250 | |||
5251 | oldlibs= |
||
5252 | # calculate the name of the file, without its directory |
||
5253 | func_basename "$output" |
||
5254 | outputname="$func_basename_result" |
||
5255 | libobjs_save="$libobjs" |
||
5256 | |||
5257 | if test -n "$shlibpath_var"; then |
||
5258 | # get the directories listed in $shlibpath_var |
||
5259 | eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` |
||
5260 | else |
||
5261 | shlib_search_path= |
||
5262 | fi |
||
5263 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
||
5264 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
||
5265 | |||
5266 | func_dirname "$output" "/" "" |
||
5267 | output_objdir="$func_dirname_result$objdir" |
||
5268 | # Create the object directory. |
||
5269 | func_mkdir_p "$output_objdir" |
||
5270 | |||
5271 | # Determine the type of output |
||
5272 | case $output in |
||
5273 | "") |
||
5274 | func_fatal_help "you must specify an output file" |
||
5275 | ;; |
||
5276 | *.$libext) linkmode=oldlib ;; |
||
5277 | *.lo | *.$objext) linkmode=obj ;; |
||
5278 | *.la) linkmode=lib ;; |
||
5279 | *) linkmode=prog ;; # Anything else should be a program. |
||
5280 | esac |
||
5281 | |||
5282 | specialdeplibs= |
||
5283 | |||
5284 | libs= |
||
5285 | # Find all interdependent deplibs by searching for libraries |
||
5286 | # that are linked more than once (e.g. -la -lb -la) |
||
5287 | for deplib in $deplibs; do |
||
5288 | if $opt_duplicate_deps ; then |
||
5289 | case "$libs " in |
||
5290 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
||
5291 | esac |
||
5292 | fi |
||
5293 | libs="$libs $deplib" |
||
5294 | done |
||
5295 | |||
5296 | if test "$linkmode" = lib; then |
||
5297 | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
||
5298 | |||
5299 | # Compute libraries that are listed more than once in $predeps |
||
5300 | # $postdeps and mark them as special (i.e., whose duplicates are |
||
5301 | # not to be eliminated). |
||
5302 | pre_post_deps= |
||
5303 | if $opt_duplicate_compiler_generated_deps; then |
||
5304 | for pre_post_dep in $predeps $postdeps; do |
||
5305 | case "$pre_post_deps " in |
||
5306 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; |
||
5307 | esac |
||
5308 | pre_post_deps="$pre_post_deps $pre_post_dep" |
||
5309 | done |
||
5310 | fi |
||
5311 | pre_post_deps= |
||
5312 | fi |
||
5313 | |||
5314 | deplibs= |
||
5315 | newdependency_libs= |
||
5316 | newlib_search_path= |
||
5317 | need_relink=no # whether we're linking any uninstalled libtool libraries |
||
5318 | notinst_deplibs= # not-installed libtool libraries |
||
5319 | notinst_path= # paths that contain not-installed libtool libraries |
||
5320 | |||
5321 | case $linkmode in |
||
5322 | lib) |
||
5323 | passes="conv dlpreopen link" |
||
5324 | for file in $dlfiles $dlprefiles; do |
||
5325 | case $file in |
||
5326 | *.la) ;; |
||
5327 | *) |
||
5328 | func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" |
||
5329 | ;; |
||
5330 | esac |
||
5331 | done |
||
5332 | ;; |
||
5333 | prog) |
||
5334 | compile_deplibs= |
||
5335 | finalize_deplibs= |
||
5336 | alldeplibs=no |
||
5337 | newdlfiles= |
||
5338 | newdlprefiles= |
||
5339 | passes="conv scan dlopen dlpreopen link" |
||
5340 | ;; |
||
5341 | *) passes="conv" |
||
5342 | ;; |
||
5343 | esac |
||
5344 | |||
5345 | for pass in $passes; do |
||
5346 | # The preopen pass in lib mode reverses $deplibs; put it back here |
||
5347 | # so that -L comes before libs that need it for instance... |
||
5348 | if test "$linkmode,$pass" = "lib,link"; then |
||
5349 | ## FIXME: Find the place where the list is rebuilt in the wrong |
||
5350 | ## order, and fix it there properly |
||
5351 | tmp_deplibs= |
||
5352 | for deplib in $deplibs; do |
||
5353 | tmp_deplibs="$deplib $tmp_deplibs" |
||
5354 | done |
||
5355 | deplibs="$tmp_deplibs" |
||
5356 | fi |
||
5357 | |||
5358 | if test "$linkmode,$pass" = "lib,link" || |
||
5359 | test "$linkmode,$pass" = "prog,scan"; then |
||
5360 | libs="$deplibs" |
||
5361 | deplibs= |
||
5362 | fi |
||
5363 | if test "$linkmode" = prog; then |
||
5364 | case $pass in |
||
5365 | dlopen) libs="$dlfiles" ;; |
||
5366 | dlpreopen) libs="$dlprefiles" ;; |
||
5367 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; |
||
5368 | esac |
||
5369 | fi |
||
5370 | if test "$linkmode,$pass" = "lib,dlpreopen"; then |
||
5371 | # Collect and forward deplibs of preopened libtool libs |
||
5372 | for lib in $dlprefiles; do |
||
5373 | # Ignore non-libtool-libs |
||
5374 | dependency_libs= |
||
5375 | case $lib in |
||
5376 | *.la) func_source "$lib" ;; |
||
5377 | esac |
||
5378 | |||
5379 | # Collect preopened libtool deplibs, except any this library |
||
5380 | # has declared as weak libs |
||
5381 | for deplib in $dependency_libs; do |
||
5382 | func_basename "$deplib" |
||
5383 | deplib_base=$func_basename_result |
||
5384 | case " $weak_libs " in |
||
5385 | *" $deplib_base "*) ;; |
||
5386 | *) deplibs="$deplibs $deplib" ;; |
||
5387 | esac |
||
5388 | done |
||
5389 | done |
||
5390 | libs="$dlprefiles" |
||
5391 | fi |
||
5392 | if test "$pass" = dlopen; then |
||
5393 | # Collect dlpreopened libraries |
||
5394 | save_deplibs="$deplibs" |
||
5395 | deplibs= |
||
5396 | fi |
||
5397 | |||
5398 | for deplib in $libs; do |
||
5399 | lib= |
||
5400 | found=no |
||
5401 | case $deplib in |
||
5402 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
||
5403 | if test "$linkmode,$pass" = "prog,link"; then |
||
5404 | compile_deplibs="$deplib $compile_deplibs" |
||
5405 | finalize_deplibs="$deplib $finalize_deplibs" |
||
5406 | else |
||
5407 | compiler_flags="$compiler_flags $deplib" |
||
5408 | if test "$linkmode" = lib ; then |
||
5409 | case "$new_inherited_linker_flags " in |
||
5410 | *" $deplib "*) ;; |
||
5411 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; |
||
5412 | esac |
||
5413 | fi |
||
5414 | fi |
||
5415 | continue |
||
5416 | ;; |
||
5417 | -l*) |
||
5418 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
||
5419 | func_warning "\`-l' is ignored for archives/objects" |
||
5420 | continue |
||
5421 | fi |
||
5422 | func_stripname '-l' '' "$deplib" |
||
5423 | name=$func_stripname_result |
||
5424 | if test "$linkmode" = lib; then |
||
5425 | searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" |
||
5426 | else |
||
5427 | searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" |
||
5428 | fi |
||
5429 | for searchdir in $searchdirs; do |
||
5430 | for search_ext in .la $std_shrext .so .a; do |
||
5431 | # Search the libtool library |
||
5432 | lib="$searchdir/lib${name}${search_ext}" |
||
5433 | if test -f "$lib"; then |
||
5434 | if test "$search_ext" = ".la"; then |
||
5435 | found=yes |
||
5436 | else |
||
5437 | found=no |
||
5438 | fi |
||
5439 | break 2 |
||
5440 | fi |
||
5441 | done |
||
5442 | done |
||
5443 | if test "$found" != yes; then |
||
5444 | # deplib doesn't seem to be a libtool library |
||
5445 | if test "$linkmode,$pass" = "prog,link"; then |
||
5446 | compile_deplibs="$deplib $compile_deplibs" |
||
5447 | finalize_deplibs="$deplib $finalize_deplibs" |
||
5448 | else |
||
5449 | deplibs="$deplib $deplibs" |
||
5450 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
||
5451 | fi |
||
5452 | continue |
||
5453 | else # deplib is a libtool library |
||
5454 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
||
5455 | # We need to do some special things here, and not later. |
||
5456 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
||
5457 | case " $predeps $postdeps " in |
||
5458 | *" $deplib "*) |
||
5459 | if func_lalib_p "$lib"; then |
||
5460 | library_names= |
||
5461 | old_library= |
||
5462 | func_source "$lib" |
||
5463 | for l in $old_library $library_names; do |
||
5464 | ll="$l" |
||
5465 | done |
||
5466 | if test "X$ll" = "X$old_library" ; then # only static version available |
||
5467 | found=no |
||
5468 | func_dirname "$lib" "" "." |
||
5469 | ladir="$func_dirname_result" |
||
5470 | lib=$ladir/$old_library |
||
5471 | if test "$linkmode,$pass" = "prog,link"; then |
||
5472 | compile_deplibs="$deplib $compile_deplibs" |
||
5473 | finalize_deplibs="$deplib $finalize_deplibs" |
||
5474 | else |
||
5475 | deplibs="$deplib $deplibs" |
||
5476 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
||
5477 | fi |
||
5478 | continue |
||
5479 | fi |
||
5480 | fi |
||
5481 | ;; |
||
5482 | *) ;; |
||
5483 | esac |
||
5484 | fi |
||
5485 | fi |
||
5486 | ;; # -l |
||
5487 | *.ltframework) |
||
5488 | if test "$linkmode,$pass" = "prog,link"; then |
||
5489 | compile_deplibs="$deplib $compile_deplibs" |
||
5490 | finalize_deplibs="$deplib $finalize_deplibs" |
||
5491 | else |
||
5492 | deplibs="$deplib $deplibs" |
||
5493 | if test "$linkmode" = lib ; then |
||
5494 | case "$new_inherited_linker_flags " in |
||
5495 | *" $deplib "*) ;; |
||
5496 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; |
||
5497 | esac |
||
5498 | fi |
||
5499 | fi |
||
5500 | continue |
||
5501 | ;; |
||
5502 | -L*) |
||
5503 | case $linkmode in |
||
5504 | lib) |
||
5505 | deplibs="$deplib $deplibs" |
||
5506 | test "$pass" = conv && continue |
||
5507 | newdependency_libs="$deplib $newdependency_libs" |
||
5508 | func_stripname '-L' '' "$deplib" |
||
5509 | newlib_search_path="$newlib_search_path $func_stripname_result" |
||
5510 | ;; |
||
5511 | prog) |
||
5512 | if test "$pass" = conv; then |
||
5513 | deplibs="$deplib $deplibs" |
||
5514 | continue |
||
5515 | fi |
||
5516 | if test "$pass" = scan; then |
||
5517 | deplibs="$deplib $deplibs" |
||
5518 | else |
||
5519 | compile_deplibs="$deplib $compile_deplibs" |
||
5520 | finalize_deplibs="$deplib $finalize_deplibs" |
||
5521 | fi |
||
5522 | func_stripname '-L' '' "$deplib" |
||
5523 | newlib_search_path="$newlib_search_path $func_stripname_result" |
||
5524 | ;; |
||
5525 | *) |
||
5526 | func_warning "\`-L' is ignored for archives/objects" |
||
5527 | ;; |
||
5528 | esac # linkmode |
||
5529 | continue |
||
5530 | ;; # -L |
||
5531 | -R*) |
||
5532 | if test "$pass" = link; then |
||
5533 | func_stripname '-R' '' "$deplib" |
||
5534 | dir=$func_stripname_result |
||
5535 | # Make sure the xrpath contains only unique directories. |
||
5536 | case "$xrpath " in |
||
5537 | *" $dir "*) ;; |
||
5538 | *) xrpath="$xrpath $dir" ;; |
||
5539 | esac |
||
5540 | fi |
||
5541 | deplibs="$deplib $deplibs" |
||
5542 | continue |
||
5543 | ;; |
||
5544 | *.la) lib="$deplib" ;; |
||
5545 | *.$libext) |
||
5546 | if test "$pass" = conv; then |
||
5547 | deplibs="$deplib $deplibs" |
||
5548 | continue |
||
5549 | fi |
||
5550 | case $linkmode in |
||
5551 | lib) |
||
5552 | # Linking convenience modules into shared libraries is allowed, |
||
5553 | # but linking other static libraries is non-portable. |
||
5554 | case " $dlpreconveniencelibs " in |
||
5555 | *" $deplib "*) ;; |
||
5556 | *) |
||
5557 | valid_a_lib=no |
||
5558 | case $deplibs_check_method in |
||
5559 | match_pattern*) |
||
5560 | set dummy $deplibs_check_method; shift |
||
5561 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
||
5562 | if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ |
||
5563 | | $EGREP "$match_pattern_regex" > /dev/null; then |
||
5564 | valid_a_lib=yes |
||
5565 | fi |
||
5566 | ;; |
||
5567 | pass_all) |
||
5568 | valid_a_lib=yes |
||
5569 | ;; |
||
5570 | esac |
||
5571 | if test "$valid_a_lib" != yes; then |
||
5572 | echo |
||
5573 | $ECHO "*** Warning: Trying to link with static lib archive $deplib." |
||
5574 | echo "*** I have the capability to make that library automatically link in when" |
||
5575 | echo "*** you link to this library. But I can only do this if you have a" |
||
5576 | echo "*** shared version of the library, which you do not appear to have" |
||
5577 | echo "*** because the file extensions .$libext of this argument makes me believe" |
||
5578 | echo "*** that it is just a static archive that I should not use here." |
||
5579 | else |
||
5580 | echo |
||
5581 | $ECHO "*** Warning: Linking the shared library $output against the" |
||
5582 | $ECHO "*** static library $deplib is not portable!" |
||
5583 | deplibs="$deplib $deplibs" |
||
5584 | fi |
||
5585 | ;; |
||
5586 | esac |
||
5587 | continue |
||
5588 | ;; |
||
5589 | prog) |
||
5590 | if test "$pass" != link; then |
||
5591 | deplibs="$deplib $deplibs" |
||
5592 | else |
||
5593 | compile_deplibs="$deplib $compile_deplibs" |
||
5594 | finalize_deplibs="$deplib $finalize_deplibs" |
||
5595 | fi |
||
5596 | continue |
||
5597 | ;; |
||
5598 | esac # linkmode |
||
5599 | ;; # *.$libext |
||
5600 | *.lo | *.$objext) |
||
5601 | if test "$pass" = conv; then |
||
5602 | deplibs="$deplib $deplibs" |
||
5603 | elif test "$linkmode" = prog; then |
||
5604 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
||
5605 | # If there is no dlopen support or we're linking statically, |
||
5606 | # we need to preload. |
||
5607 | newdlprefiles="$newdlprefiles $deplib" |
||
5608 | compile_deplibs="$deplib $compile_deplibs" |
||
5609 | finalize_deplibs="$deplib $finalize_deplibs" |
||
5610 | else |
||
5611 | newdlfiles="$newdlfiles $deplib" |
||
5612 | fi |
||
5613 | fi |
||
5614 | continue |
||
5615 | ;; |
||
5616 | %DEPLIBS%) |
||
5617 | alldeplibs=yes |
||
5618 | continue |
||
5619 | ;; |
||
5620 | esac # case $deplib |
||
5621 | |||
5622 | if test "$found" = yes || test -f "$lib"; then : |
||
5623 | else |
||
5624 | func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" |
||
5625 | fi |
||
5626 | |||
5627 | # Check to see that this really is a libtool archive. |
||
5628 | func_lalib_unsafe_p "$lib" \ |
||
5629 | || func_fatal_error "\`$lib' is not a valid libtool archive" |
||
5630 | |||
5631 | func_dirname "$lib" "" "." |
||
5632 | ladir="$func_dirname_result" |
||
5633 | |||
5634 | dlname= |
||
5635 | dlopen= |
||
5636 | dlpreopen= |
||
5637 | libdir= |
||
5638 | library_names= |
||
5639 | old_library= |
||
5640 | inherited_linker_flags= |
||
5641 | # If the library was installed with an old release of libtool, |
||
5642 | # it will not redefine variables installed, or shouldnotlink |
||
5643 | installed=yes |
||
5644 | shouldnotlink=no |
||
5645 | avoidtemprpath= |
||
5646 | |||
5647 | |||
5648 | # Read the .la file |
||
5649 | func_source "$lib" |
||
5650 | |||
5651 | # Convert "-framework foo" to "foo.ltframework" |
||
5652 | if test -n "$inherited_linker_flags"; then |
||
5653 | tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` |
||
5654 | for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do |
||
5655 | case " $new_inherited_linker_flags " in |
||
5656 | *" $tmp_inherited_linker_flag "*) ;; |
||
5657 | *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; |
||
5658 | esac |
||
5659 | done |
||
5660 | fi |
||
5661 | dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
||
5662 | if test "$linkmode,$pass" = "lib,link" || |
||
5663 | test "$linkmode,$pass" = "prog,scan" || |
||
5664 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
||
5665 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
||
5666 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" |
||
5667 | fi |
||
5668 | |||
5669 | if test "$pass" = conv; then |
||
5670 | # Only check for convenience libraries |
||
5671 | deplibs="$lib $deplibs" |
||
5672 | if test -z "$libdir"; then |
||
5673 | if test -z "$old_library"; then |
||
5674 | func_fatal_error "cannot find name of link library for \`$lib'" |
||
5675 | fi |
||
5676 | # It is a libtool convenience library, so add in its objects. |
||
5677 | convenience="$convenience $ladir/$objdir/$old_library" |
||
5678 | old_convenience="$old_convenience $ladir/$objdir/$old_library" |
||
5679 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
||
5680 | func_fatal_error "\`$lib' is not a convenience library" |
||
5681 | fi |
||
5682 | tmp_libs= |
||
5683 | for deplib in $dependency_libs; do |
||
5684 | deplibs="$deplib $deplibs" |
||
5685 | if $opt_duplicate_deps ; then |
||
5686 | case "$tmp_libs " in |
||
5687 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
||
5688 | esac |
||
5689 | fi |
||
5690 | tmp_libs="$tmp_libs $deplib" |
||
5691 | done |
||
5692 | continue |
||
5693 | fi # $pass = conv |
||
5694 | |||
5695 | |||
5696 | # Get the name of the library we link against. |
||
5697 | linklib= |
||
5698 | for l in $old_library $library_names; do |
||
5699 | linklib="$l" |
||
5700 | done |
||
5701 | if test -z "$linklib"; then |
||
5702 | func_fatal_error "cannot find name of link library for \`$lib'" |
||
5703 | fi |
||
5704 | |||
5705 | # This library was specified with -dlopen. |
||
5706 | if test "$pass" = dlopen; then |
||
5707 | if test -z "$libdir"; then |
||
5708 | func_fatal_error "cannot -dlopen a convenience library: \`$lib'" |
||
5709 | fi |
||
5710 | if test -z "$dlname" || |
||
5711 | test "$dlopen_support" != yes || |
||
5712 | test "$build_libtool_libs" = no; then |
||
5713 | # If there is no dlname, no dlopen support or we're linking |
||
5714 | # statically, we need to preload. We also need to preload any |
||
5715 | # dependent libraries so libltdl's deplib preloader doesn't |
||
5716 | # bomb out in the load deplibs phase. |
||
5717 | dlprefiles="$dlprefiles $lib $dependency_libs" |
||
5718 | else |
||
5719 | newdlfiles="$newdlfiles $lib" |
||
5720 | fi |
||
5721 | continue |
||
5722 | fi # $pass = dlopen |
||
5723 | |||
5724 | # We need an absolute path. |
||
5725 | case $ladir in |
||
5726 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
||
5727 | *) |
||
5728 | abs_ladir=`cd "$ladir" && pwd` |
||
5729 | if test -z "$abs_ladir"; then |
||
5730 | func_warning "cannot determine absolute directory name of \`$ladir'" |
||
5731 | func_warning "passing it literally to the linker, although it might fail" |
||
5732 | abs_ladir="$ladir" |
||
5733 | fi |
||
5734 | ;; |
||
5735 | esac |
||
5736 | func_basename "$lib" |
||
5737 | laname="$func_basename_result" |
||
5738 | |||
5739 | # Find the relevant object directory and library name. |
||
5740 | if test "X$installed" = Xyes; then |
||
5741 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
||
5742 | func_warning "library \`$lib' was moved." |
||
5743 | dir="$ladir" |
||
5744 | absdir="$abs_ladir" |
||
5745 | libdir="$abs_ladir" |
||
5746 | else |
||
5747 | dir="$libdir" |
||
5748 | absdir="$libdir" |
||
5749 | fi |
||
5750 | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes |
||
5751 | else |
||
5752 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
||
5753 | dir="$ladir" |
||
5754 | absdir="$abs_ladir" |
||
5755 | # Remove this search path later |
||
5756 | notinst_path="$notinst_path $abs_ladir" |
||
5757 | else |
||
5758 | dir="$ladir/$objdir" |
||
5759 | absdir="$abs_ladir/$objdir" |
||
5760 | # Remove this search path later |
||
5761 | notinst_path="$notinst_path $abs_ladir" |
||
5762 | fi |
||
5763 | fi # $installed = yes |
||
5764 | func_stripname 'lib' '.la' "$laname" |
||
5765 | name=$func_stripname_result |
||
5766 | |||
5767 | # This library was specified with -dlpreopen. |
||
5768 | if test "$pass" = dlpreopen; then |
||
5769 | if test -z "$libdir" && test "$linkmode" = prog; then |
||
5770 | func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" |
||
5771 | fi |
||
5772 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
||
5773 | # are required to link). |
||
5774 | if test -n "$old_library"; then |
||
5775 | newdlprefiles="$newdlprefiles $dir/$old_library" |
||
5776 | # Keep a list of preopened convenience libraries to check |
||
5777 | # that they are being used correctly in the link pass. |
||
5778 | test -z "$libdir" && \ |
||
5779 | dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" |
||
5780 | # Otherwise, use the dlname, so that lt_dlopen finds it. |
||
5781 | elif test -n "$dlname"; then |
||
5782 | newdlprefiles="$newdlprefiles $dir/$dlname" |
||
5783 | else |
||
5784 | newdlprefiles="$newdlprefiles $dir/$linklib" |
||
5785 | fi |
||
5786 | fi # $pass = dlpreopen |
||
5787 | |||
5788 | if test -z "$libdir"; then |
||
5789 | # Link the convenience library |
||
5790 | if test "$linkmode" = lib; then |
||
5791 | deplibs="$dir/$old_library $deplibs" |
||
5792 | elif test "$linkmode,$pass" = "prog,link"; then |
||
5793 | compile_deplibs="$dir/$old_library $compile_deplibs" |
||
5794 | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
||
5795 | else |
||
5796 | deplibs="$lib $deplibs" # used for prog,scan pass |
||
5797 | fi |
||
5798 | continue |
||
5799 | fi |
||
5800 | |||
5801 | |||
5802 | if test "$linkmode" = prog && test "$pass" != link; then |
||
5803 | newlib_search_path="$newlib_search_path $ladir" |
||
5804 | deplibs="$lib $deplibs" |
||
5805 | |||
5806 | linkalldeplibs=no |
||
5807 | if test "$link_all_deplibs" != no || test -z "$library_names" || |
||
5808 | test "$build_libtool_libs" = no; then |
||
5809 | linkalldeplibs=yes |
||
5810 | fi |
||
5811 | |||
5812 | tmp_libs= |
||
5813 | for deplib in $dependency_libs; do |
||
5814 | case $deplib in |
||
5815 | -L*) func_stripname '-L' '' "$deplib" |
||
5816 | newlib_search_path="$newlib_search_path $func_stripname_result" |
||
5817 | ;; |
||
5818 | esac |
||
5819 | # Need to link against all dependency_libs? |
||
5820 | if test "$linkalldeplibs" = yes; then |
||
5821 | deplibs="$deplib $deplibs" |
||
5822 | else |
||
5823 | # Need to hardcode shared library paths |
||
5824 | # or/and link against static libraries |
||
5825 | newdependency_libs="$deplib $newdependency_libs" |
||
5826 | fi |
||
5827 | if $opt_duplicate_deps ; then |
||
5828 | case "$tmp_libs " in |
||
5829 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
||
5830 | esac |
||
5831 | fi |
||
5832 | tmp_libs="$tmp_libs $deplib" |
||
5833 | done # for deplib |
||
5834 | continue |
||
5835 | fi # $linkmode = prog... |
||
5836 | |||
5837 | if test "$linkmode,$pass" = "prog,link"; then |
||
5838 | if test -n "$library_names" && |
||
5839 | { { test "$prefer_static_libs" = no || |
||
5840 | test "$prefer_static_libs,$installed" = "built,yes"; } || |
||
5841 | test -z "$old_library"; }; then |
||
5842 | # We need to hardcode the library path |
||
5843 | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then |
||
5844 | # Make sure the rpath contains only unique directories. |
||
5845 | case "$temp_rpath:" in |
||
5846 | *"$absdir:"*) ;; |
||
5847 | *) temp_rpath="$temp_rpath$absdir:" ;; |
||
5848 | esac |
||
5849 | fi |
||
5850 | |||
5851 | # Hardcode the library path. |
||
5852 | # Skip directories that are in the system default run-time |
||
5853 | # search path. |
||
5854 | case " $sys_lib_dlsearch_path " in |
||
5855 | *" $absdir "*) ;; |
||
5856 | *) |
||
5857 | case "$compile_rpath " in |
||
5858 | *" $absdir "*) ;; |
||
5859 | *) compile_rpath="$compile_rpath $absdir" |
||
5860 | esac |
||
5861 | ;; |
||
5862 | esac |
||
5863 | case " $sys_lib_dlsearch_path " in |
||
5864 | *" $libdir "*) ;; |
||
5865 | *) |
||
5866 | case "$finalize_rpath " in |
||
5867 | *" $libdir "*) ;; |
||
5868 | *) finalize_rpath="$finalize_rpath $libdir" |
||
5869 | esac |
||
5870 | ;; |
||
5871 | esac |
||
5872 | fi # $linkmode,$pass = prog,link... |
||
5873 | |||
5874 | if test "$alldeplibs" = yes && |
||
5875 | { test "$deplibs_check_method" = pass_all || |
||
5876 | { test "$build_libtool_libs" = yes && |
||
5877 | test -n "$library_names"; }; }; then |
||
5878 | # We only need to search for static libraries |
||
5879 | continue |
||
5880 | fi |
||
5881 | fi |
||
5882 | |||
5883 | link_static=no # Whether the deplib will be linked statically |
||
5884 | use_static_libs=$prefer_static_libs |
||
5885 | if test "$use_static_libs" = built && test "$installed" = yes; then |
||
5886 | use_static_libs=no |
||
5887 | fi |
||
5888 | if test -n "$library_names" && |
||
5889 | { test "$use_static_libs" = no || test -z "$old_library"; }; then |
||
5890 | case $host in |
||
5891 | *cygwin* | *mingw* | *cegcc*) |
||
5892 | # No point in relinking DLLs because paths are not encoded |
||
5893 | notinst_deplibs="$notinst_deplibs $lib" |
||
5894 | need_relink=no |
||
5895 | ;; |
||
5896 | *) |
||
5897 | if test "$installed" = no; then |
||
5898 | notinst_deplibs="$notinst_deplibs $lib" |
||
5899 | need_relink=yes |
||
5900 | fi |
||
5901 | ;; |
||
5902 | esac |
||
5903 | # This is a shared library |
||
5904 | |||
5905 | # Warn about portability, can't link against -module's on some |
||
5906 | # systems (darwin). Don't bleat about dlopened modules though! |
||
5907 | dlopenmodule="" |
||
5908 | for dlpremoduletest in $dlprefiles; do |
||
5909 | if test "X$dlpremoduletest" = "X$lib"; then |
||
5910 | dlopenmodule="$dlpremoduletest" |
||
5911 | break |
||
5912 | fi |
||
5913 | done |
||
5914 | if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then |
||
5915 | echo |
||
5916 | if test "$linkmode" = prog; then |
||
5917 | $ECHO "*** Warning: Linking the executable $output against the loadable module" |
||
5918 | else |
||
5919 | $ECHO "*** Warning: Linking the shared library $output against the loadable module" |
||
5920 | fi |
||
5921 | $ECHO "*** $linklib is not portable!" |
||
5922 | fi |
||
5923 | if test "$linkmode" = lib && |
||
5924 | test "$hardcode_into_libs" = yes; then |
||
5925 | # Hardcode the library path. |
||
5926 | # Skip directories that are in the system default run-time |
||
5927 | # search path. |
||
5928 | case " $sys_lib_dlsearch_path " in |
||
5929 | *" $absdir "*) ;; |
||
5930 | *) |
||
5931 | case "$compile_rpath " in |
||
5932 | *" $absdir "*) ;; |
||
5933 | *) compile_rpath="$compile_rpath $absdir" |
||
5934 | esac |
||
5935 | ;; |
||
5936 | esac |
||
5937 | case " $sys_lib_dlsearch_path " in |
||
5938 | *" $libdir "*) ;; |
||
5939 | *) |
||
5940 | case "$finalize_rpath " in |
||
5941 | *" $libdir "*) ;; |
||
5942 | *) finalize_rpath="$finalize_rpath $libdir" |
||
5943 | esac |
||
5944 | ;; |
||
5945 | esac |
||
5946 | fi |
||
5947 | |||
5948 | if test -n "$old_archive_from_expsyms_cmds"; then |
||
5949 | # figure out the soname |
||
5950 | set dummy $library_names |
||
5951 | shift |
||
5952 | realname="$1" |
||
5953 | shift |
||
5954 | libname=`eval "\\$ECHO \"$libname_spec\""` |
||
5955 | # use dlname if we got it. it's perfectly good, no? |
||
5956 | if test -n "$dlname"; then |
||
5957 | soname="$dlname" |
||
5958 | elif test -n "$soname_spec"; then |
||
5959 | # bleh windows |
||
5960 | case $host in |
||
5961 | *cygwin* | mingw* | *cegcc*) |
||
5962 | func_arith $current - $age |
||
5963 | major=$func_arith_result |
||
5964 | versuffix="-$major" |
||
5965 | ;; |
||
5966 | esac |
||
5967 | eval soname=\"$soname_spec\" |
||
5968 | else |
||
5969 | soname="$realname" |
||
5970 | fi |
||
5971 | |||
5972 | # Make a new name for the extract_expsyms_cmds to use |
||
5973 | soroot="$soname" |
||
5974 | func_basename "$soroot" |
||
5975 | soname="$func_basename_result" |
||
5976 | func_stripname 'lib' '.dll' "$soname" |
||
5977 | newlib=libimp-$func_stripname_result.a |
||
5978 | |||
5979 | # If the library has no export list, then create one now |
||
5980 | if test -f "$output_objdir/$soname-def"; then : |
||
5981 | else |
||
5982 | func_verbose "extracting exported symbol list from \`$soname'" |
||
5983 | func_execute_cmds "$extract_expsyms_cmds" 'exit $?' |
||
5984 | fi |
||
5985 | |||
5986 | # Create $newlib |
||
5987 | if test -f "$output_objdir/$newlib"; then :; else |
||
5988 | func_verbose "generating import library for \`$soname'" |
||
5989 | func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' |
||
5990 | fi |
||
5991 | # make sure the library variables are pointing to the new library |
||
5992 | dir=$output_objdir |
||
5993 | linklib=$newlib |
||
5994 | fi # test -n "$old_archive_from_expsyms_cmds" |
||
5995 | |||
5996 | if test "$linkmode" = prog || test "$mode" != relink; then |
||
5997 | add_shlibpath= |
||
5998 | add_dir= |
||
5999 | add= |
||
6000 | lib_linked=yes |
||
6001 | case $hardcode_action in |
||
6002 | immediate | unsupported) |
||
6003 | if test "$hardcode_direct" = no; then |
||
6004 | add="$dir/$linklib" |
||
6005 | case $host in |
||
6006 | *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; |
||
6007 | *-*-sysv4*uw2*) add_dir="-L$dir" ;; |
||
6008 | *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ |
||
6009 | *-*-unixware7*) add_dir="-L$dir" ;; |
||
6010 | *-*-darwin* ) |
||
6011 | # if the lib is a (non-dlopened) module then we can not |
||
6012 | # link against it, someone is ignoring the earlier warnings |
||
6013 | if /usr/bin/file -L $add 2> /dev/null | |
||
6014 | $GREP ": [^:]* bundle" >/dev/null ; then |
||
6015 | if test "X$dlopenmodule" != "X$lib"; then |
||
6016 | $ECHO "*** Warning: lib $linklib is a module, not a shared library" |
||
6017 | if test -z "$old_library" ; then |
||
6018 | echo |
||
6019 | echo "*** And there doesn't seem to be a static archive available" |
||
6020 | echo "*** The link will probably fail, sorry" |
||
6021 | else |
||
6022 | add="$dir/$old_library" |
||
6023 | fi |
||
6024 | elif test -n "$old_library"; then |
||
6025 | add="$dir/$old_library" |
||
6026 | fi |
||
6027 | fi |
||
6028 | esac |
||
6029 | elif test "$hardcode_minus_L" = no; then |
||
6030 | case $host in |
||
6031 | *-*-sunos*) add_shlibpath="$dir" ;; |
||
6032 | esac |
||
6033 | add_dir="-L$dir" |
||
6034 | add="-l$name" |
||
6035 | elif test "$hardcode_shlibpath_var" = no; then |
||
6036 | add_shlibpath="$dir" |
||
6037 | add="-l$name" |
||
6038 | else |
||
6039 | lib_linked=no |
||
6040 | fi |
||
6041 | ;; |
||
6042 | relink) |
||
6043 | if test "$hardcode_direct" = yes && |
||
6044 | test "$hardcode_direct_absolute" = no; then |
||
6045 | add="$dir/$linklib" |
||
6046 | elif test "$hardcode_minus_L" = yes; then |
||
6047 | add_dir="-L$dir" |
||
6048 | # Try looking first in the location we're being installed to. |
||
6049 | if test -n "$inst_prefix_dir"; then |
||
6050 | case $libdir in |
||
6051 | [\\/]*) |
||
6052 | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
||
6053 | ;; |
||
6054 | esac |
||
6055 | fi |
||
6056 | add="-l$name" |
||
6057 | elif test "$hardcode_shlibpath_var" = yes; then |
||
6058 | add_shlibpath="$dir" |
||
6059 | add="-l$name" |
||
6060 | else |
||
6061 | lib_linked=no |
||
6062 | fi |
||
6063 | ;; |
||
6064 | *) lib_linked=no ;; |
||
6065 | esac |
||
6066 | |||
6067 | if test "$lib_linked" != yes; then |
||
6068 | func_fatal_configuration "unsupported hardcode properties" |
||
6069 | fi |
||
6070 | |||
6071 | if test -n "$add_shlibpath"; then |
||
6072 | case :$compile_shlibpath: in |
||
6073 | *":$add_shlibpath:"*) ;; |
||
6074 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; |
||
6075 | esac |
||
6076 | fi |
||
6077 | if test "$linkmode" = prog; then |
||
6078 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
||
6079 | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
||
6080 | else |
||
6081 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
||
6082 | test -n "$add" && deplibs="$add $deplibs" |
||
6083 | if test "$hardcode_direct" != yes && |
||
6084 | test "$hardcode_minus_L" != yes && |
||
6085 | test "$hardcode_shlibpath_var" = yes; then |
||
6086 | case :$finalize_shlibpath: in |
||
6087 | *":$libdir:"*) ;; |
||
6088 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
||
6089 | esac |
||
6090 | fi |
||
6091 | fi |
||
6092 | fi |
||
6093 | |||
6094 | if test "$linkmode" = prog || test "$mode" = relink; then |
||
6095 | add_shlibpath= |
||
6096 | add_dir= |
||
6097 | add= |
||
6098 | # Finalize command for both is simple: just hardcode it. |
||
6099 | if test "$hardcode_direct" = yes && |
||
6100 | test "$hardcode_direct_absolute" = no; then |
||
6101 | add="$libdir/$linklib" |
||
6102 | elif test "$hardcode_minus_L" = yes; then |
||
6103 | add_dir="-L$libdir" |
||
6104 | add="-l$name" |
||
6105 | elif test "$hardcode_shlibpath_var" = yes; then |
||
6106 | case :$finalize_shlibpath: in |
||
6107 | *":$libdir:"*) ;; |
||
6108 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
||
6109 | esac |
||
6110 | add="-l$name" |
||
6111 | elif test "$hardcode_automatic" = yes; then |
||
6112 | if test -n "$inst_prefix_dir" && |
||
6113 | test -f "$inst_prefix_dir$libdir/$linklib" ; then |
||
6114 | add="$inst_prefix_dir$libdir/$linklib" |
||
6115 | else |
||
6116 | add="$libdir/$linklib" |
||
6117 | fi |
||
6118 | else |
||
6119 | # We cannot seem to hardcode it, guess we'll fake it. |
||
6120 | add_dir="-L$libdir" |
||
6121 | # Try looking first in the location we're being installed to. |
||
6122 | if test -n "$inst_prefix_dir"; then |
||
6123 | case $libdir in |
||
6124 | [\\/]*) |
||
6125 | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
||
6126 | ;; |
||
6127 | esac |
||
6128 | fi |
||
6129 | add="-l$name" |
||
6130 | fi |
||
6131 | |||
6132 | if test "$linkmode" = prog; then |
||
6133 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
||
6134 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
||
6135 | else |
||
6136 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
||
6137 | test -n "$add" && deplibs="$add $deplibs" |
||
6138 | fi |
||
6139 | fi |
||
6140 | elif test "$linkmode" = prog; then |
||
6141 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
||
6142 | # is not unsupported. This is valid on all known static and |
||
6143 | # shared platforms. |
||
6144 | if test "$hardcode_direct" != unsupported; then |
||
6145 | test -n "$old_library" && linklib="$old_library" |
||
6146 | compile_deplibs="$dir/$linklib $compile_deplibs" |
||
6147 | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
||
6148 | else |
||
6149 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
||
6150 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
||
6151 | fi |
||
6152 | elif test "$build_libtool_libs" = yes; then |
||
6153 | # Not a shared library |
||
6154 | if test "$deplibs_check_method" != pass_all; then |
||
6155 | # We're trying link a shared library against a static one |
||
6156 | # but the system doesn't support it. |
||
6157 | |||
6158 | # Just print a warning and add the library to dependency_libs so |
||
6159 | # that the program can be linked against the static library. |
||
6160 | echo |
||
6161 | $ECHO "*** Warning: This system can not link to static lib archive $lib." |
||
6162 | echo "*** I have the capability to make that library automatically link in when" |
||
6163 | echo "*** you link to this library. But I can only do this if you have a" |
||
6164 | echo "*** shared version of the library, which you do not appear to have." |
||
6165 | if test "$module" = yes; then |
||
6166 | echo "*** But as you try to build a module library, libtool will still create " |
||
6167 | echo "*** a static module, that should work as long as the dlopening application" |
||
6168 | echo "*** is linked with the -dlopen flag to resolve symbols at runtime." |
||
6169 | if test -z "$global_symbol_pipe"; then |
||
6170 | echo |
||
6171 | echo "*** However, this would only work if libtool was able to extract symbol" |
||
6172 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
||
6173 | echo "*** not find such a program. So, this module is probably useless." |
||
6174 | echo "*** \`nm' from GNU binutils and a full rebuild may help." |
||
6175 | fi |
||
6176 | if test "$build_old_libs" = no; then |
||
6177 | build_libtool_libs=module |
||
6178 | build_old_libs=yes |
||
6179 | else |
||
6180 | build_libtool_libs=no |
||
6181 | fi |
||
6182 | fi |
||
6183 | else |
||
6184 | deplibs="$dir/$old_library $deplibs" |
||
6185 | link_static=yes |
||
6186 | fi |
||
6187 | fi # link shared/static library? |
||
6188 | |||
6189 | if test "$linkmode" = lib; then |
||
6190 | if test -n "$dependency_libs" && |
||
6191 | { test "$hardcode_into_libs" != yes || |
||
6192 | test "$build_old_libs" = yes || |
||
6193 | test "$link_static" = yes; }; then |
||
6194 | # Extract -R from dependency_libs |
||
6195 | temp_deplibs= |
||
6196 | for libdir in $dependency_libs; do |
||
6197 | case $libdir in |
||
6198 | -R*) func_stripname '-R' '' "$libdir" |
||
6199 | temp_xrpath=$func_stripname_result |
||
6200 | case " $xrpath " in |
||
6201 | *" $temp_xrpath "*) ;; |
||
6202 | *) xrpath="$xrpath $temp_xrpath";; |
||
6203 | esac;; |
||
6204 | *) temp_deplibs="$temp_deplibs $libdir";; |
||
6205 | esac |
||
6206 | done |
||
6207 | dependency_libs="$temp_deplibs" |
||
6208 | fi |
||
6209 | |||
6210 | newlib_search_path="$newlib_search_path $absdir" |
||
6211 | # Link against this library |
||
6212 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
||
6213 | # ... and its dependency_libs |
||
6214 | tmp_libs= |
||
6215 | for deplib in $dependency_libs; do |
||
6216 | newdependency_libs="$deplib $newdependency_libs" |
||
6217 | if $opt_duplicate_deps ; then |
||
6218 | case "$tmp_libs " in |
||
6219 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
||
6220 | esac |
||
6221 | fi |
||
6222 | tmp_libs="$tmp_libs $deplib" |
||
6223 | done |
||
6224 | |||
6225 | if test "$link_all_deplibs" != no; then |
||
6226 | # Add the search paths of all dependency libraries |
||
6227 | for deplib in $dependency_libs; do |
||
6228 | path= |
||
6229 | case $deplib in |
||
6230 | -L*) path="$deplib" ;; |
||
6231 | *.la) |
||
6232 | func_dirname "$deplib" "" "." |
||
6233 | dir="$func_dirname_result" |
||
6234 | # We need an absolute path. |
||
6235 | case $dir in |
||
6236 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; |
||
6237 | *) |
||
6238 | absdir=`cd "$dir" && pwd` |
||
6239 | if test -z "$absdir"; then |
||
6240 | func_warning "cannot determine absolute directory name of \`$dir'" |
||
6241 | absdir="$dir" |
||
6242 | fi |
||
6243 | ;; |
||
6244 | esac |
||
6245 | if $GREP "^installed=no" $deplib > /dev/null; then |
||
6246 | case $host in |
||
6247 | *-*-darwin*) |
||
6248 | depdepl= |
||
6249 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` |
||
6250 | if test -n "$deplibrary_names" ; then |
||
6251 | for tmp in $deplibrary_names ; do |
||
6252 | depdepl=$tmp |
||
6253 | done |
||
6254 | if test -f "$absdir/$objdir/$depdepl" ; then |
||
6255 | depdepl="$absdir/$objdir/$depdepl" |
||
6256 | darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
||
6257 | if test -z "$darwin_install_name"; then |
||
6258 | darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
||
6259 | fi |
||
6260 | compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" |
||
6261 | linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" |
||
6262 | path= |
||
6263 | fi |
||
6264 | fi |
||
6265 | ;; |
||
6266 | *) |
||
6267 | path="-L$absdir/$objdir" |
||
6268 | ;; |
||
6269 | esac |
||
6270 | else |
||
6271 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
||
6272 | test -z "$libdir" && \ |
||
6273 | func_fatal_error "\`$deplib' is not a valid libtool archive" |
||
6274 | test "$absdir" != "$libdir" && \ |
||
6275 | func_warning "\`$deplib' seems to be moved" |
||
6276 | |||
6277 | path="-L$absdir" |
||
6278 | fi |
||
6279 | ;; |
||
6280 | esac |
||
6281 | case " $deplibs " in |
||
6282 | *" $path "*) ;; |
||
6283 | *) deplibs="$path $deplibs" ;; |
||
6284 | esac |
||
6285 | done |
||
6286 | fi # link_all_deplibs != no |
||
6287 | fi # linkmode = lib |
||
6288 | done # for deplib in $libs |
||
6289 | if test "$pass" = link; then |
||
6290 | if test "$linkmode" = "prog"; then |
||
6291 | compile_deplibs="$new_inherited_linker_flags $compile_deplibs" |
||
6292 | finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" |
||
6293 | else |
||
6294 | compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
||
6295 | fi |
||
6296 | fi |
||
6297 | dependency_libs="$newdependency_libs" |
||
6298 | if test "$pass" = dlpreopen; then |
||
6299 | # Link the dlpreopened libraries before other libraries |
||
6300 | for deplib in $save_deplibs; do |
||
6301 | deplibs="$deplib $deplibs" |
||
6302 | done |
||
6303 | fi |
||
6304 | if test "$pass" != dlopen; then |
||
6305 | if test "$pass" != conv; then |
||
6306 | # Make sure lib_search_path contains only unique directories. |
||
6307 | lib_search_path= |
||
6308 | for dir in $newlib_search_path; do |
||
6309 | case "$lib_search_path " in |
||
6310 | *" $dir "*) ;; |
||
6311 | *) lib_search_path="$lib_search_path $dir" ;; |
||
6312 | esac |
||
6313 | done |
||
6314 | newlib_search_path= |
||
6315 | fi |
||
6316 | |||
6317 | if test "$linkmode,$pass" != "prog,link"; then |
||
6318 | vars="deplibs" |
||
6319 | else |
||
6320 | vars="compile_deplibs finalize_deplibs" |
||
6321 | fi |
||
6322 | for var in $vars dependency_libs; do |
||
6323 | # Add libraries to $var in reverse order |
||
6324 | eval tmp_libs=\"\$$var\" |
||
6325 | new_libs= |
||
6326 | for deplib in $tmp_libs; do |
||
6327 | # FIXME: Pedantically, this is the right thing to do, so |
||
6328 | # that some nasty dependency loop isn't accidentally |
||
6329 | # broken: |
||
6330 | #new_libs="$deplib $new_libs" |
||
6331 | # Pragmatically, this seems to cause very few problems in |
||
6332 | # practice: |
||
6333 | case $deplib in |
||
6334 | -L*) new_libs="$deplib $new_libs" ;; |
||
6335 | -R*) ;; |
||
6336 | *) |
||
6337 | # And here is the reason: when a library appears more |
||
6338 | # than once as an explicit dependence of a library, or |
||
6339 | # is implicitly linked in more than once by the |
||
6340 | # compiler, it is considered special, and multiple |
||
6341 | # occurrences thereof are not removed. Compare this |
||
6342 | # with having the same library being listed as a |
||
6343 | # dependency of multiple other libraries: in this case, |
||
6344 | # we know (pedantically, we assume) the library does not |
||
6345 | # need to be listed more than once, so we keep only the |
||
6346 | # last copy. This is not always right, but it is rare |
||
6347 | # enough that we require users that really mean to play |
||
6348 | # such unportable linking tricks to link the library |
||
6349 | # using -Wl,-lname, so that libtool does not consider it |
||
6350 | # for duplicate removal. |
||
6351 | case " $specialdeplibs " in |
||
6352 | *" $deplib "*) new_libs="$deplib $new_libs" ;; |
||
6353 | *) |
||
6354 | case " $new_libs " in |
||
6355 | *" $deplib "*) ;; |
||
6356 | *) new_libs="$deplib $new_libs" ;; |
||
6357 | esac |
||
6358 | ;; |
||
6359 | esac |
||
6360 | ;; |
||
6361 | esac |
||
6362 | done |
||
6363 | tmp_libs= |
||
6364 | for deplib in $new_libs; do |
||
6365 | case $deplib in |
||
6366 | -L*) |
||
6367 | case " $tmp_libs " in |
||
6368 | *" $deplib "*) ;; |
||
6369 | *) tmp_libs="$tmp_libs $deplib" ;; |
||
6370 | esac |
||
6371 | ;; |
||
6372 | *) tmp_libs="$tmp_libs $deplib" ;; |
||
6373 | esac |
||
6374 | done |
||
6375 | eval $var=\"$tmp_libs\" |
||
6376 | done # for var |
||
6377 | fi |
||
6378 | # Last step: remove runtime libs from dependency_libs |
||
6379 | # (they stay in deplibs) |
||
6380 | tmp_libs= |
||
6381 | for i in $dependency_libs ; do |
||
6382 | case " $predeps $postdeps $compiler_lib_search_path " in |
||
6383 | *" $i "*) |
||
6384 | i="" |
||
6385 | ;; |
||
6386 | esac |
||
6387 | if test -n "$i" ; then |
||
6388 | tmp_libs="$tmp_libs $i" |
||
6389 | fi |
||
6390 | done |
||
6391 | dependency_libs=$tmp_libs |
||
6392 | done # for pass |
||
6393 | if test "$linkmode" = prog; then |
||
6394 | dlfiles="$newdlfiles" |
||
6395 | fi |
||
6396 | if test "$linkmode" = prog || test "$linkmode" = lib; then |
||
6397 | dlprefiles="$newdlprefiles" |
||
6398 | fi |
||
6399 | |||
6400 | case $linkmode in |
||
6401 | oldlib) |
||
6402 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
||
6403 | func_warning "\`-dlopen' is ignored for archives" |
||
6404 | fi |
||
6405 | |||
6406 | case " $deplibs" in |
||
6407 | *\ -l* | *\ -L*) |
||
6408 | func_warning "\`-l' and \`-L' are ignored for archives" ;; |
||
6409 | esac |
||
6410 | |||
6411 | test -n "$rpath" && \ |
||
6412 | func_warning "\`-rpath' is ignored for archives" |
||
6413 | |||
6414 | test -n "$xrpath" && \ |
||
6415 | func_warning "\`-R' is ignored for archives" |
||
6416 | |||
6417 | test -n "$vinfo" && \ |
||
6418 | func_warning "\`-version-info/-version-number' is ignored for archives" |
||
6419 | |||
6420 | test -n "$release" && \ |
||
6421 | func_warning "\`-release' is ignored for archives" |
||
6422 | |||
6423 | test -n "$export_symbols$export_symbols_regex" && \ |
||
6424 | func_warning "\`-export-symbols' is ignored for archives" |
||
6425 | |||
6426 | # Now set the variables for building old libraries. |
||
6427 | build_libtool_libs=no |
||
6428 | oldlibs="$output" |
||
6429 | objs="$objs$old_deplibs" |
||
6430 | ;; |
||
6431 | |||
6432 | lib) |
||
6433 | # Make sure we only generate libraries of the form `libNAME.la'. |
||
6434 | case $outputname in |
||
6435 | lib*) |
||
6436 | func_stripname 'lib' '.la' "$outputname" |
||
6437 | name=$func_stripname_result |
||
6438 | eval shared_ext=\"$shrext_cmds\" |
||
6439 | eval libname=\"$libname_spec\" |
||
6440 | ;; |
||
6441 | *) |
||
6442 | test "$module" = no && \ |
||
6443 | func_fatal_help "libtool library \`$output' must begin with \`lib'" |
||
6444 | |||
6445 | if test "$need_lib_prefix" != no; then |
||
6446 | # Add the "lib" prefix for modules if required |
||
6447 | func_stripname '' '.la' "$outputname" |
||
6448 | name=$func_stripname_result |
||
6449 | eval shared_ext=\"$shrext_cmds\" |
||
6450 | eval libname=\"$libname_spec\" |
||
6451 | else |
||
6452 | func_stripname '' '.la' "$outputname" |
||
6453 | libname=$func_stripname_result |
||
6454 | fi |
||
6455 | ;; |
||
6456 | esac |
||
6457 | |||
6458 | if test -n "$objs"; then |
||
6459 | if test "$deplibs_check_method" != pass_all; then |
||
6460 | func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" |
||
6461 | else |
||
6462 | echo |
||
6463 | $ECHO "*** Warning: Linking the shared library $output against the non-libtool" |
||
6464 | $ECHO "*** objects $objs is not portable!" |
||
6465 | libobjs="$libobjs $objs" |
||
6466 | fi |
||
6467 | fi |
||
6468 | |||
6469 | test "$dlself" != no && \ |
||
6470 | func_warning "\`-dlopen self' is ignored for libtool libraries" |
||
6471 | |||
6472 | set dummy $rpath |
||
6473 | shift |
||
6474 | test "$#" -gt 1 && \ |
||
6475 | func_warning "ignoring multiple \`-rpath's for a libtool library" |
||
6476 | |||
6477 | install_libdir="$1" |
||
6478 | |||
6479 | oldlibs= |
||
6480 | if test -z "$rpath"; then |
||
6481 | if test "$build_libtool_libs" = yes; then |
||
6482 | # Building a libtool convenience library. |
||
6483 | # Some compilers have problems with a `.al' extension so |
||
6484 | # convenience libraries should have the same extension an |
||
6485 | # archive normally would. |
||
6486 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
||
6487 | build_libtool_libs=convenience |
||
6488 | build_old_libs=yes |
||
6489 | fi |
||
6490 | |||
6491 | test -n "$vinfo" && \ |
||
6492 | func_warning "\`-version-info/-version-number' is ignored for convenience libraries" |
||
6493 | |||
6494 | test -n "$release" && \ |
||
6495 | func_warning "\`-release' is ignored for convenience libraries" |
||
6496 | else |
||
6497 | |||
6498 | # Parse the version information argument. |
||
6499 | save_ifs="$IFS"; IFS=':' |
||
6500 | set dummy $vinfo 0 0 0 |
||
6501 | shift |
||
6502 | IFS="$save_ifs" |
||
6503 | |||
6504 | test -n "$7" && \ |
||
6505 | func_fatal_help "too many parameters to \`-version-info'" |
||
6506 | |||
6507 | # convert absolute version numbers to libtool ages |
||
6508 | # this retains compatibility with .la files and attempts |
||
6509 | # to make the code below a bit more comprehensible |
||
6510 | |||
6511 | case $vinfo_number in |
||
6512 | yes) |
||
6513 | number_major="$1" |
||
6514 | number_minor="$2" |
||
6515 | number_revision="$3" |
||
6516 | # |
||
6517 | # There are really only two kinds -- those that |
||
6518 | # use the current revision as the major version |
||
6519 | # and those that subtract age and use age as |
||
6520 | # a minor version. But, then there is irix |
||
6521 | # which has an extra 1 added just for fun |
||
6522 | # |
||
6523 | case $version_type in |
||
6524 | darwin|linux|osf|windows|none) |
||
6525 | func_arith $number_major + $number_minor |
||
6526 | current=$func_arith_result |
||
6527 | age="$number_minor" |
||
6528 | revision="$number_revision" |
||
6529 | ;; |
||
6530 | freebsd-aout|freebsd-elf|qnx|sunos) |
||
6531 | current="$number_major" |
||
6532 | revision="$number_minor" |
||
6533 | age="0" |
||
6534 | ;; |
||
6535 | irix|nonstopux) |
||
6536 | func_arith $number_major + $number_minor |
||
6537 | current=$func_arith_result |
||
6538 | age="$number_minor" |
||
6539 | revision="$number_minor" |
||
6540 | lt_irix_increment=no |
||
6541 | ;; |
||
6542 | esac |
||
6543 | ;; |
||
6544 | no) |
||
6545 | current="$1" |
||
6546 | revision="$2" |
||
6547 | age="$3" |
||
6548 | ;; |
||
6549 | esac |
||
6550 | |||
6551 | # Check that each of the things are valid numbers. |
||
6552 | case $current in |
||
6553 | 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]) ;; |
||
6554 | *) |
||
6555 | func_error "CURRENT \`$current' must be a nonnegative integer" |
||
6556 | func_fatal_error "\`$vinfo' is not valid version information" |
||
6557 | ;; |
||
6558 | esac |
||
6559 | |||
6560 | case $revision in |
||
6561 | 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]) ;; |
||
6562 | *) |
||
6563 | func_error "REVISION \`$revision' must be a nonnegative integer" |
||
6564 | func_fatal_error "\`$vinfo' is not valid version information" |
||
6565 | ;; |
||
6566 | esac |
||
6567 | |||
6568 | case $age in |
||
6569 | 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]) ;; |
||
6570 | *) |
||
6571 | func_error "AGE \`$age' must be a nonnegative integer" |
||
6572 | func_fatal_error "\`$vinfo' is not valid version information" |
||
6573 | ;; |
||
6574 | esac |
||
6575 | |||
6576 | if test "$age" -gt "$current"; then |
||
6577 | func_error "AGE \`$age' is greater than the current interface number \`$current'" |
||
6578 | func_fatal_error "\`$vinfo' is not valid version information" |
||
6579 | fi |
||
6580 | |||
6581 | # Calculate the version variables. |
||
6582 | major= |
||
6583 | versuffix= |
||
6584 | verstring= |
||
6585 | case $version_type in |
||
6586 | none) ;; |
||
6587 | |||
6588 | darwin) |
||
6589 | # Like Linux, but with the current version available in |
||
6590 | # verstring for coding it into the library header |
||
6591 | func_arith $current - $age |
||
6592 | major=.$func_arith_result |
||
6593 | versuffix="$major.$age.$revision" |
||
6594 | # Darwin ld doesn't like 0 for these options... |
||
6595 | func_arith $current + 1 |
||
6596 | minor_current=$func_arith_result |
||
6597 | xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" |
||
6598 | verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" |
||
6599 | ;; |
||
6600 | |||
6601 | freebsd-aout) |
||
6602 | major=".$current" |
||
6603 | versuffix=".$current.$revision"; |
||
6604 | ;; |
||
6605 | |||
6606 | freebsd-elf) |
||
6607 | major=".$current" |
||
6608 | versuffix=".$current" |
||
6609 | ;; |
||
6610 | |||
6611 | irix | nonstopux) |
||
6612 | if test "X$lt_irix_increment" = "Xno"; then |
||
6613 | func_arith $current - $age |
||
6614 | else |
||
6615 | func_arith $current - $age + 1 |
||
6616 | fi |
||
6617 | major=$func_arith_result |
||
6618 | |||
6619 | case $version_type in |
||
6620 | nonstopux) verstring_prefix=nonstopux ;; |
||
6621 | *) verstring_prefix=sgi ;; |
||
6622 | esac |
||
6623 | verstring="$verstring_prefix$major.$revision" |
||
6624 | |||
6625 | # Add in all the interfaces that we are compatible with. |
||
6626 | loop=$revision |
||
6627 | while test "$loop" -ne 0; do |
||
6628 | func_arith $revision - $loop |
||
6629 | iface=$func_arith_result |
||
6630 | func_arith $loop - 1 |
||
6631 | loop=$func_arith_result |
||
6632 | verstring="$verstring_prefix$major.$iface:$verstring" |
||
6633 | done |
||
6634 | |||
6635 | # Before this point, $major must not contain `.'. |
||
6636 | major=.$major |
||
6637 | versuffix="$major.$revision" |
||
6638 | ;; |
||
6639 | |||
6640 | linux) |
||
6641 | func_arith $current - $age |
||
6642 | major=.$func_arith_result |
||
6643 | versuffix="$major.$age.$revision" |
||
6644 | ;; |
||
6645 | |||
6646 | osf) |
||
6647 | func_arith $current - $age |
||
6648 | major=.$func_arith_result |
||
6649 | versuffix=".$current.$age.$revision" |
||
6650 | verstring="$current.$age.$revision" |
||
6651 | |||
6652 | # Add in all the interfaces that we are compatible with. |
||
6653 | loop=$age |
||
6654 | while test "$loop" -ne 0; do |
||
6655 | func_arith $current - $loop |
||
6656 | iface=$func_arith_result |
||
6657 | func_arith $loop - 1 |
||
6658 | loop=$func_arith_result |
||
6659 | verstring="$verstring:${iface}.0" |
||
6660 | done |
||
6661 | |||
6662 | # Make executables depend on our current version. |
||
6663 | verstring="$verstring:${current}.0" |
||
6664 | ;; |
||
6665 | |||
6666 | qnx) |
||
6667 | major=".$current" |
||
6668 | versuffix=".$current" |
||
6669 | ;; |
||
6670 | |||
6671 | sunos) |
||
6672 | major=".$current" |
||
6673 | versuffix=".$current.$revision" |
||
6674 | ;; |
||
6675 | |||
6676 | windows) |
||
6677 | # Use '-' rather than '.', since we only want one |
||
6678 | # extension on DOS 8.3 filesystems. |
||
6679 | func_arith $current - $age |
||
6680 | major=$func_arith_result |
||
6681 | versuffix="-$major" |
||
6682 | ;; |
||
6683 | |||
6684 | *) |
||
6685 | func_fatal_configuration "unknown library version type \`$version_type'" |
||
6686 | ;; |
||
6687 | esac |
||
6688 | |||
6689 | # Clear the version info if we defaulted, and they specified a release. |
||
6690 | if test -z "$vinfo" && test -n "$release"; then |
||
6691 | major= |
||
6692 | case $version_type in |
||
6693 | darwin) |
||
6694 | # we can't check for "0.0" in archive_cmds due to quoting |
||
6695 | # problems, so we reset it completely |
||
6696 | verstring= |
||
6697 | ;; |
||
6698 | *) |
||
6699 | verstring="0.0" |
||
6700 | ;; |
||
6701 | esac |
||
6702 | if test "$need_version" = no; then |
||
6703 | versuffix= |
||
6704 | else |
||
6705 | versuffix=".0.0" |
||
6706 | fi |
||
6707 | fi |
||
6708 | |||
6709 | # Remove version info from name if versioning should be avoided |
||
6710 | if test "$avoid_version" = yes && test "$need_version" = no; then |
||
6711 | major= |
||
6712 | versuffix= |
||
6713 | verstring="" |
||
6714 | fi |
||
6715 | |||
6716 | # Check to see if the archive will have undefined symbols. |
||
6717 | if test "$allow_undefined" = yes; then |
||
6718 | if test "$allow_undefined_flag" = unsupported; then |
||
6719 | func_warning "undefined symbols not allowed in $host shared libraries" |
||
6720 | build_libtool_libs=no |
||
6721 | build_old_libs=yes |
||
6722 | fi |
||
6723 | else |
||
6724 | # Don't allow undefined symbols. |
||
6725 | allow_undefined_flag="$no_undefined_flag" |
||
6726 | fi |
||
6727 | |||
6728 | fi |
||
6729 | |||
6730 | func_generate_dlsyms "$libname" "$libname" "yes" |
||
6731 | libobjs="$libobjs $symfileobj" |
||
6732 | test "X$libobjs" = "X " && libobjs= |
||
6733 | |||
6734 | if test "$mode" != relink; then |
||
6735 | # Remove our outputs, but don't remove object files since they |
||
6736 | # may have been created when compiling PIC objects. |
||
6737 | removelist= |
||
6738 | tempremovelist=`$ECHO "$output_objdir/*"` |
||
6739 | for p in $tempremovelist; do |
||
6740 | case $p in |
||
6741 | *.$objext | *.gcno) |
||
6742 | ;; |
||
6743 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) |
||
6744 | if test "X$precious_files_regex" != "X"; then |
||
6745 | if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 |
||
6746 | then |
||
6747 | continue |
||
6748 | fi |
||
6749 | fi |
||
6750 | removelist="$removelist $p" |
||
6751 | ;; |
||
6752 | *) ;; |
||
6753 | esac |
||
6754 | done |
||
6755 | test -n "$removelist" && \ |
||
6756 | func_show_eval "${RM}r \$removelist" |
||
6757 | fi |
||
6758 | |||
6759 | # Now set the variables for building old libraries. |
||
6760 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then |
||
6761 | oldlibs="$oldlibs $output_objdir/$libname.$libext" |
||
6762 | |||
6763 | # Transform .lo files to .o files. |
||
6764 | oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` |
||
6765 | fi |
||
6766 | |||
6767 | # Eliminate all temporary directories. |
||
6768 | #for path in $notinst_path; do |
||
6769 | # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` |
||
6770 | # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` |
||
6771 | # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` |
||
6772 | #done |
||
6773 | |||
6774 | if test -n "$xrpath"; then |
||
6775 | # If the user specified any rpath flags, then add them. |
||
6776 | temp_xrpath= |
||
6777 | for libdir in $xrpath; do |
||
6778 | temp_xrpath="$temp_xrpath -R$libdir" |
||
6779 | case "$finalize_rpath " in |
||
6780 | *" $libdir "*) ;; |
||
6781 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
||
6782 | esac |
||
6783 | done |
||
6784 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
||
6785 | dependency_libs="$temp_xrpath $dependency_libs" |
||
6786 | fi |
||
6787 | fi |
||
6788 | |||
6789 | # Make sure dlfiles contains only unique files that won't be dlpreopened |
||
6790 | old_dlfiles="$dlfiles" |
||
6791 | dlfiles= |
||
6792 | for lib in $old_dlfiles; do |
||
6793 | case " $dlprefiles $dlfiles " in |
||
6794 | *" $lib "*) ;; |
||
6795 | *) dlfiles="$dlfiles $lib" ;; |
||
6796 | esac |
||
6797 | done |
||
6798 | |||
6799 | # Make sure dlprefiles contains only unique files |
||
6800 | old_dlprefiles="$dlprefiles" |
||
6801 | dlprefiles= |
||
6802 | for lib in $old_dlprefiles; do |
||
6803 | case "$dlprefiles " in |
||
6804 | *" $lib "*) ;; |
||
6805 | *) dlprefiles="$dlprefiles $lib" ;; |
||
6806 | esac |
||
6807 | done |
||
6808 | |||
6809 | if test "$build_libtool_libs" = yes; then |
||
6810 | if test -n "$rpath"; then |
||
6811 | case $host in |
||
6812 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) |
||
6813 | # these systems don't actually have a c library (as such)! |
||
6814 | ;; |
||
6815 | *-*-rhapsody* | *-*-darwin1.[012]) |
||
6816 | # Rhapsody C library is in the System framework |
||
6817 | deplibs="$deplibs System.ltframework" |
||
6818 | ;; |
||
6819 | *-*-netbsd*) |
||
6820 | # Don't link with libc until the a.out ld.so is fixed. |
||
6821 | ;; |
||
6822 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
||
6823 | # Do not include libc due to us having libc/libc_r. |
||
6824 | ;; |
||
6825 | *-*-sco3.2v5* | *-*-sco5v6*) |
||
6826 | # Causes problems with __ctype |
||
6827 | ;; |
||
6828 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
||
6829 | # Compiler inserts libc in the correct place for threads to work |
||
6830 | ;; |
||
6831 | *) |
||
6832 | # Add libc to deplibs on all other systems if necessary. |
||
6833 | if test "$build_libtool_need_lc" = "yes"; then |
||
6834 | deplibs="$deplibs -lc" |
||
6835 | fi |
||
6836 | ;; |
||
6837 | esac |
||
6838 | fi |
||
6839 | |||
6840 | # Transform deplibs into only deplibs that can be linked in shared. |
||
6841 | name_save=$name |
||
6842 | libname_save=$libname |
||
6843 | release_save=$release |
||
6844 | versuffix_save=$versuffix |
||
6845 | major_save=$major |
||
6846 | # I'm not sure if I'm treating the release correctly. I think |
||
6847 | # release should show up in the -l (ie -lgmp5) so we don't want to |
||
6848 | # add it in twice. Is that correct? |
||
6849 | release="" |
||
6850 | versuffix="" |
||
6851 | major="" |
||
6852 | newdeplibs= |
||
6853 | droppeddeps=no |
||
6854 | case $deplibs_check_method in |
||
6855 | pass_all) |
||
6856 | # Don't check for shared/static. Everything works. |
||
6857 | # This might be a little naive. We might want to check |
||
6858 | # whether the library exists or not. But this is on |
||
6859 | # osf3 & osf4 and I'm not really sure... Just |
||
6860 | # implementing what was already the behavior. |
||
6861 | newdeplibs=$deplibs |
||
6862 | ;; |
||
6863 | test_compile) |
||
6864 | # This code stresses the "libraries are programs" paradigm to its |
||
6865 | # limits. Maybe even breaks it. We compile a program, linking it |
||
6866 | # against the deplibs as a proxy for the library. Then we can check |
||
6867 | # whether they linked in statically or dynamically with ldd. |
||
6868 | $opt_dry_run || $RM conftest.c |
||
6869 | cat > conftest.c < |
||
6870 | int main() { return 0; } |
||
6871 | EOF |
||
6872 | $opt_dry_run || $RM conftest |
||
6873 | if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then |
||
6874 | ldd_output=`ldd conftest` |
||
6875 | for i in $deplibs; do |
||
6876 | case $i in |
||
6877 | -l*) |
||
6878 | func_stripname -l '' "$i" |
||
6879 | name=$func_stripname_result |
||
6880 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
||
6881 | case " $predeps $postdeps " in |
||
6882 | *" $i "*) |
||
6883 | newdeplibs="$newdeplibs $i" |
||
6884 | i="" |
||
6885 | ;; |
||
6886 | esac |
||
6887 | fi |
||
6888 | if test -n "$i" ; then |
||
6889 | libname=`eval "\\$ECHO \"$libname_spec\""` |
||
6890 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
||
6891 | set dummy $deplib_matches; shift |
||
6892 | deplib_match=$1 |
||
6893 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
||
6894 | newdeplibs="$newdeplibs $i" |
||
6895 | else |
||
6896 | droppeddeps=yes |
||
6897 | echo |
||
6898 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." |
||
6899 | echo "*** I have the capability to make that library automatically link in when" |
||
6900 | echo "*** you link to this library. But I can only do this if you have a" |
||
6901 | echo "*** shared version of the library, which I believe you do not have" |
||
6902 | echo "*** because a test_compile did reveal that the linker did not use it for" |
||
6903 | echo "*** its dynamic dependency list that programs get resolved with at runtime." |
||
6904 | fi |
||
6905 | fi |
||
6906 | ;; |
||
6907 | *) |
||
6908 | newdeplibs="$newdeplibs $i" |
||
6909 | ;; |
||
6910 | esac |
||
6911 | done |
||
6912 | else |
||
6913 | # Error occurred in the first compile. Let's try to salvage |
||
6914 | # the situation: Compile a separate program for each library. |
||
6915 | for i in $deplibs; do |
||
6916 | case $i in |
||
6917 | -l*) |
||
6918 | func_stripname -l '' "$i" |
||
6919 | name=$func_stripname_result |
||
6920 | $opt_dry_run || $RM conftest |
||
6921 | if $LTCC $LTCFLAGS -o conftest conftest.c $i; then |
||
6922 | ldd_output=`ldd conftest` |
||
6923 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
||
6924 | case " $predeps $postdeps " in |
||
6925 | *" $i "*) |
||
6926 | newdeplibs="$newdeplibs $i" |
||
6927 | i="" |
||
6928 | ;; |
||
6929 | esac |
||
6930 | fi |
||
6931 | if test -n "$i" ; then |
||
6932 | libname=`eval "\\$ECHO \"$libname_spec\""` |
||
6933 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
||
6934 | set dummy $deplib_matches; shift |
||
6935 | deplib_match=$1 |
||
6936 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
||
6937 | newdeplibs="$newdeplibs $i" |
||
6938 | else |
||
6939 | droppeddeps=yes |
||
6940 | echo |
||
6941 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." |
||
6942 | echo "*** I have the capability to make that library automatically link in when" |
||
6943 | echo "*** you link to this library. But I can only do this if you have a" |
||
6944 | echo "*** shared version of the library, which you do not appear to have" |
||
6945 | echo "*** because a test_compile did reveal that the linker did not use this one" |
||
6946 | echo "*** as a dynamic dependency that programs can get resolved with at runtime." |
||
6947 | fi |
||
6948 | fi |
||
6949 | else |
||
6950 | droppeddeps=yes |
||
6951 | echo |
||
6952 | $ECHO "*** Warning! Library $i is needed by this library but I was not able to" |
||
6953 | echo "*** make it link in! You will probably need to install it or some" |
||
6954 | echo "*** library that it depends on before this library will be fully" |
||
6955 | echo "*** functional. Installing it before continuing would be even better." |
||
6956 | fi |
||
6957 | ;; |
||
6958 | *) |
||
6959 | newdeplibs="$newdeplibs $i" |
||
6960 | ;; |
||
6961 | esac |
||
6962 | done |
||
6963 | fi |
||
6964 | ;; |
||
6965 | file_magic*) |
||
6966 | set dummy $deplibs_check_method; shift |
||
6967 | file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
||
6968 | for a_deplib in $deplibs; do |
||
6969 | case $a_deplib in |
||
6970 | -l*) |
||
6971 | func_stripname -l '' "$a_deplib" |
||
6972 | name=$func_stripname_result |
||
6973 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
||
6974 | case " $predeps $postdeps " in |
||
6975 | *" $a_deplib "*) |
||
6976 | newdeplibs="$newdeplibs $a_deplib" |
||
6977 | a_deplib="" |
||
6978 | ;; |
||
6979 | esac |
||
6980 | fi |
||
6981 | if test -n "$a_deplib" ; then |
||
6982 | libname=`eval "\\$ECHO \"$libname_spec\""` |
||
6983 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
||
6984 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
||
6985 | for potent_lib in $potential_libs; do |
||
6986 | # Follow soft links. |
||
6987 | if ls -lLd "$potent_lib" 2>/dev/null | |
||
6988 | $GREP " -> " >/dev/null; then |
||
6989 | continue |
||
6990 | fi |
||
6991 | # The statement above tries to avoid entering an |
||
6992 | # endless loop below, in case of cyclic links. |
||
6993 | # We might still enter an endless loop, since a link |
||
6994 | # loop can be closed while we follow links, |
||
6995 | # but so what? |
||
6996 | potlib="$potent_lib" |
||
6997 | while test -h "$potlib" 2>/dev/null; do |
||
6998 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
||
6999 | case $potliblink in |
||
7000 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
||
7001 | *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; |
||
7002 | esac |
||
7003 | done |
||
7004 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | |
||
7005 | $SED -e 10q | |
||
7006 | $EGREP "$file_magic_regex" > /dev/null; then |
||
7007 | newdeplibs="$newdeplibs $a_deplib" |
||
7008 | a_deplib="" |
||
7009 | break 2 |
||
7010 | fi |
||
7011 | done |
||
7012 | done |
||
7013 | fi |
||
7014 | if test -n "$a_deplib" ; then |
||
7015 | droppeddeps=yes |
||
7016 | echo |
||
7017 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
||
7018 | echo "*** I have the capability to make that library automatically link in when" |
||
7019 | echo "*** you link to this library. But I can only do this if you have a" |
||
7020 | echo "*** shared version of the library, which you do not appear to have" |
||
7021 | echo "*** because I did check the linker path looking for a file starting" |
||
7022 | if test -z "$potlib" ; then |
||
7023 | $ECHO "*** with $libname but no candidates were found. (...for file magic test)" |
||
7024 | else |
||
7025 | $ECHO "*** with $libname and none of the candidates passed a file format test" |
||
7026 | $ECHO "*** using a file magic. Last file checked: $potlib" |
||
7027 | fi |
||
7028 | fi |
||
7029 | ;; |
||
7030 | *) |
||
7031 | # Add a -L argument. |
||
7032 | newdeplibs="$newdeplibs $a_deplib" |
||
7033 | ;; |
||
7034 | esac |
||
7035 | done # Gone through all deplibs. |
||
7036 | ;; |
||
7037 | match_pattern*) |
||
7038 | set dummy $deplibs_check_method; shift |
||
7039 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
||
7040 | for a_deplib in $deplibs; do |
||
7041 | case $a_deplib in |
||
7042 | -l*) |
||
7043 | func_stripname -l '' "$a_deplib" |
||
7044 | name=$func_stripname_result |
||
7045 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
||
7046 | case " $predeps $postdeps " in |
||
7047 | *" $a_deplib "*) |
||
7048 | newdeplibs="$newdeplibs $a_deplib" |
||
7049 | a_deplib="" |
||
7050 | ;; |
||
7051 | esac |
||
7052 | fi |
||
7053 | if test -n "$a_deplib" ; then |
||
7054 | libname=`eval "\\$ECHO \"$libname_spec\""` |
||
7055 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
||
7056 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
||
7057 | for potent_lib in $potential_libs; do |
||
7058 | potlib="$potent_lib" # see symlink-check above in file_magic test |
||
7059 | if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ |
||
7060 | $EGREP "$match_pattern_regex" > /dev/null; then |
||
7061 | newdeplibs="$newdeplibs $a_deplib" |
||
7062 | a_deplib="" |
||
7063 | break 2 |
||
7064 | fi |
||
7065 | done |
||
7066 | done |
||
7067 | fi |
||
7068 | if test -n "$a_deplib" ; then |
||
7069 | droppeddeps=yes |
||
7070 | echo |
||
7071 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
||
7072 | echo "*** I have the capability to make that library automatically link in when" |
||
7073 | echo "*** you link to this library. But I can only do this if you have a" |
||
7074 | echo "*** shared version of the library, which you do not appear to have" |
||
7075 | echo "*** because I did check the linker path looking for a file starting" |
||
7076 | if test -z "$potlib" ; then |
||
7077 | $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" |
||
7078 | else |
||
7079 | $ECHO "*** with $libname and none of the candidates passed a file format test" |
||
7080 | $ECHO "*** using a regex pattern. Last file checked: $potlib" |
||
7081 | fi |
||
7082 | fi |
||
7083 | ;; |
||
7084 | *) |
||
7085 | # Add a -L argument. |
||
7086 | newdeplibs="$newdeplibs $a_deplib" |
||
7087 | ;; |
||
7088 | esac |
||
7089 | done # Gone through all deplibs. |
||
7090 | ;; |
||
7091 | none | unknown | *) |
||
7092 | newdeplibs="" |
||
7093 | tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` |
||
7094 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
||
7095 | for i in $predeps $postdeps ; do |
||
7096 | # can't use Xsed below, because $i might contain '/' |
||
7097 | tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` |
||
7098 | done |
||
7099 | fi |
||
7100 | case $tmp_deplibs in |
||
7101 | *[!\ \ ]*) |
||
7102 | echo |
||
7103 | if test "X$deplibs_check_method" = "Xnone"; then |
||
7104 | echo "*** Warning: inter-library dependencies are not supported in this platform." |
||
7105 | else |
||
7106 | echo "*** Warning: inter-library dependencies are not known to be supported." |
||
7107 | fi |
||
7108 | echo "*** All declared inter-library dependencies are being dropped." |
||
7109 | droppeddeps=yes |
||
7110 | ;; |
||
7111 | esac |
||
7112 | ;; |
||
7113 | esac |
||
7114 | versuffix=$versuffix_save |
||
7115 | major=$major_save |
||
7116 | release=$release_save |
||
7117 | libname=$libname_save |
||
7118 | name=$name_save |
||
7119 | |||
7120 | case $host in |
||
7121 | *-*-rhapsody* | *-*-darwin1.[012]) |
||
7122 | # On Rhapsody replace the C library with the System framework |
||
7123 | newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` |
||
7124 | ;; |
||
7125 | esac |
||
7126 | |||
7127 | if test "$droppeddeps" = yes; then |
||
7128 | if test "$module" = yes; then |
||
7129 | echo |
||
7130 | echo "*** Warning: libtool could not satisfy all declared inter-library" |
||
7131 | $ECHO "*** dependencies of module $libname. Therefore, libtool will create" |
||
7132 | echo "*** a static module, that should work as long as the dlopening" |
||
7133 | echo "*** application is linked with the -dlopen flag." |
||
7134 | if test -z "$global_symbol_pipe"; then |
||
7135 | echo |
||
7136 | echo "*** However, this would only work if libtool was able to extract symbol" |
||
7137 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
||
7138 | echo "*** not find such a program. So, this module is probably useless." |
||
7139 | echo "*** \`nm' from GNU binutils and a full rebuild may help." |
||
7140 | fi |
||
7141 | if test "$build_old_libs" = no; then |
||
7142 | oldlibs="$output_objdir/$libname.$libext" |
||
7143 | build_libtool_libs=module |
||
7144 | build_old_libs=yes |
||
7145 | else |
||
7146 | build_libtool_libs=no |
||
7147 | fi |
||
7148 | else |
||
7149 | echo "*** The inter-library dependencies that have been dropped here will be" |
||
7150 | echo "*** automatically added whenever a program is linked with this library" |
||
7151 | echo "*** or is declared to -dlopen it." |
||
7152 | |||
7153 | if test "$allow_undefined" = no; then |
||
7154 | echo |
||
7155 | echo "*** Since this library must not contain undefined symbols," |
||
7156 | echo "*** because either the platform does not support them or" |
||
7157 | echo "*** it was explicitly requested with -no-undefined," |
||
7158 | echo "*** libtool will only create a static version of it." |
||
7159 | if test "$build_old_libs" = no; then |
||
7160 | oldlibs="$output_objdir/$libname.$libext" |
||
7161 | build_libtool_libs=module |
||
7162 | build_old_libs=yes |
||
7163 | else |
||
7164 | build_libtool_libs=no |
||
7165 | fi |
||
7166 | fi |
||
7167 | fi |
||
7168 | fi |
||
7169 | # Done checking deplibs! |
||
7170 | deplibs=$newdeplibs |
||
7171 | fi |
||
7172 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" |
||
7173 | case $host in |
||
7174 | *-*-darwin*) |
||
7175 | newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
||
7176 | new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
||
7177 | deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
||
7178 | ;; |
||
7179 | esac |
||
7180 | |||
7181 | # move library search paths that coincide with paths to not yet |
||
7182 | # installed libraries to the beginning of the library search list |
||
7183 | new_libs= |
||
7184 | for path in $notinst_path; do |
||
7185 | case " $new_libs " in |
||
7186 | *" -L$path/$objdir "*) ;; |
||
7187 | *) |
||
7188 | case " $deplibs " in |
||
7189 | *" -L$path/$objdir "*) |
||
7190 | new_libs="$new_libs -L$path/$objdir" ;; |
||
7191 | esac |
||
7192 | ;; |
||
7193 | esac |
||
7194 | done |
||
7195 | for deplib in $deplibs; do |
||
7196 | case $deplib in |
||
7197 | -L*) |
||
7198 | case " $new_libs " in |
||
7199 | *" $deplib "*) ;; |
||
7200 | *) new_libs="$new_libs $deplib" ;; |
||
7201 | esac |
||
7202 | ;; |
||
7203 | *) new_libs="$new_libs $deplib" ;; |
||
7204 | esac |
||
7205 | done |
||
7206 | deplibs="$new_libs" |
||
7207 | |||
7208 | # All the library-specific variables (install_libdir is set above). |
||
7209 | library_names= |
||
7210 | old_library= |
||
7211 | dlname= |
||
7212 | |||
7213 | # Test again, we may have decided not to build it any more |
||
7214 | if test "$build_libtool_libs" = yes; then |
||
7215 | if test "$hardcode_into_libs" = yes; then |
||
7216 | # Hardcode the library paths |
||
7217 | hardcode_libdirs= |
||
7218 | dep_rpath= |
||
7219 | rpath="$finalize_rpath" |
||
7220 | test "$mode" != relink && rpath="$compile_rpath$rpath" |
||
7221 | for libdir in $rpath; do |
||
7222 | if test -n "$hardcode_libdir_flag_spec"; then |
||
7223 | if test -n "$hardcode_libdir_separator"; then |
||
7224 | if test -z "$hardcode_libdirs"; then |
||
7225 | hardcode_libdirs="$libdir" |
||
7226 | else |
||
7227 | # Just accumulate the unique libdirs. |
||
7228 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
||
7229 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
||
7230 | ;; |
||
7231 | *) |
||
7232 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
||
7233 | ;; |
||
7234 | esac |
||
7235 | fi |
||
7236 | else |
||
7237 | eval flag=\"$hardcode_libdir_flag_spec\" |
||
7238 | dep_rpath="$dep_rpath $flag" |
||
7239 | fi |
||
7240 | elif test -n "$runpath_var"; then |
||
7241 | case "$perm_rpath " in |
||
7242 | *" $libdir "*) ;; |
||
7243 | *) perm_rpath="$perm_rpath $libdir" ;; |
||
7244 | esac |
||
7245 | fi |
||
7246 | done |
||
7247 | # Substitute the hardcoded libdirs into the rpath. |
||
7248 | if test -n "$hardcode_libdir_separator" && |
||
7249 | test -n "$hardcode_libdirs"; then |
||
7250 | libdir="$hardcode_libdirs" |
||
7251 | if test -n "$hardcode_libdir_flag_spec_ld"; then |
||
7252 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" |
||
7253 | else |
||
7254 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" |
||
7255 | fi |
||
7256 | fi |
||
7257 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
||
7258 | # We should set the runpath_var. |
||
7259 | rpath= |
||
7260 | for dir in $perm_rpath; do |
||
7261 | rpath="$rpath$dir:" |
||
7262 | done |
||
7263 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
||
7264 | fi |
||
7265 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
||
7266 | fi |
||
7267 | |||
7268 | shlibpath="$finalize_shlibpath" |
||
7269 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" |
||
7270 | if test -n "$shlibpath"; then |
||
7271 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
||
7272 | fi |
||
7273 | |||
7274 | # Get the real and link names of the library. |
||
7275 | eval shared_ext=\"$shrext_cmds\" |
||
7276 | eval library_names=\"$library_names_spec\" |
||
7277 | set dummy $library_names |
||
7278 | shift |
||
7279 | realname="$1" |
||
7280 | shift |
||
7281 | |||
7282 | if test -n "$soname_spec"; then |
||
7283 | eval soname=\"$soname_spec\" |
||
7284 | else |
||
7285 | soname="$realname" |
||
7286 | fi |
||
7287 | if test -z "$dlname"; then |
||
7288 | dlname=$soname |
||
7289 | fi |
||
7290 | |||
7291 | lib="$output_objdir/$realname" |
||
7292 | linknames= |
||
7293 | for link |
||
7294 | do |
||
7295 | linknames="$linknames $link" |
||
7296 | done |
||
7297 | |||
7298 | # Use standard objects if they are pic |
||
7299 | test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` |
||
7300 | test "X$libobjs" = "X " && libobjs= |
||
7301 | |||
7302 | delfiles= |
||
7303 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
||
7304 | $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" |
||
7305 | export_symbols="$output_objdir/$libname.uexp" |
||
7306 | delfiles="$delfiles $export_symbols" |
||
7307 | fi |
||
7308 | |||
7309 | orig_export_symbols= |
||
7310 | case $host_os in |
||
7311 | cygwin* | mingw* | cegcc*) |
||
7312 | if test -n "$export_symbols" && test -z "$export_symbols_regex"; then |
||
7313 | # exporting using user supplied symfile |
||
7314 | if test "x`$SED 1q $export_symbols`" != xEXPORTS; then |
||
7315 | # and it's NOT already a .def file. Must figure out |
||
7316 | # which of the given symbols are data symbols and tag |
||
7317 | # them as such. So, trigger use of export_symbols_cmds. |
||
7318 | # export_symbols gets reassigned inside the "prepare |
||
7319 | # the list of exported symbols" if statement, so the |
||
7320 | # include_expsyms logic still works. |
||
7321 | orig_export_symbols="$export_symbols" |
||
7322 | export_symbols= |
||
7323 | always_export_symbols=yes |
||
7324 | fi |
||
7325 | fi |
||
7326 | ;; |
||
7327 | esac |
||
7328 | |||
7329 | # Prepare the list of exported symbols |
||
7330 | if test -z "$export_symbols"; then |
||
7331 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then |
||
7332 | func_verbose "generating symbol list for \`$libname.la'" |
||
7333 | export_symbols="$output_objdir/$libname.exp" |
||
7334 | $opt_dry_run || $RM $export_symbols |
||
7335 | cmds=$export_symbols_cmds |
||
7336 | save_ifs="$IFS"; IFS='~' |
||
7337 | for cmd in $cmds; do |
||
7338 | IFS="$save_ifs" |
||
7339 | eval cmd=\"$cmd\" |
||
7340 | func_len " $cmd" |
||
7341 | len=$func_len_result |
||
7342 | if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
||
7343 | func_show_eval "$cmd" 'exit $?' |
||
7344 | skipped_export=false |
||
7345 | else |
||
7346 | # The command line is too long to execute in one step. |
||
7347 | func_verbose "using reloadable object file for export list..." |
||
7348 | skipped_export=: |
||
7349 | # Break out early, otherwise skipped_export may be |
||
7350 | # set to false by a later but shorter cmd. |
||
7351 | break |
||
7352 | fi |
||
7353 | done |
||
7354 | IFS="$save_ifs" |
||
7355 | if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then |
||
7356 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
||
7357 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' |
||
7358 | fi |
||
7359 | fi |
||
7360 | fi |
||
7361 | |||
7362 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
||
7363 | tmp_export_symbols="$export_symbols" |
||
7364 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" |
||
7365 | $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' |
||
7366 | fi |
||
7367 | |||
7368 | if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then |
||
7369 | # The given exports_symbols file has to be filtered, so filter it. |
||
7370 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" |
||
7371 | # FIXME: $output_objdir/$libname.filter potentially contains lots of |
||
7372 | # 's' commands which not all seds can handle. GNU sed should be fine |
||
7373 | # though. Also, the filter scales superlinearly with the number of |
||
7374 | # global variables. join(1) would be nice here, but unfortunately |
||
7375 | # isn't a blessed tool. |
||
7376 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
||
7377 | delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" |
||
7378 | export_symbols=$output_objdir/$libname.def |
||
7379 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
||
7380 | fi |
||
7381 | |||
7382 | tmp_deplibs= |
||
7383 | for test_deplib in $deplibs; do |
||
7384 | case " $convenience " in |
||
7385 | *" $test_deplib "*) ;; |
||
7386 | *) |
||
7387 | tmp_deplibs="$tmp_deplibs $test_deplib" |
||
7388 | ;; |
||
7389 | esac |
||
7390 | done |
||
7391 | deplibs="$tmp_deplibs" |
||
7392 | |||
7393 | if test -n "$convenience"; then |
||
7394 | if test -n "$whole_archive_flag_spec" && |
||
7395 | test "$compiler_needs_object" = yes && |
||
7396 | test -z "$libobjs"; then |
||
7397 | # extract the archives, so we have objects to list. |
||
7398 | # TODO: could optimize this to just extract one archive. |
||
7399 | whole_archive_flag_spec= |
||
7400 | fi |
||
7401 | if test -n "$whole_archive_flag_spec"; then |
||
7402 | save_libobjs=$libobjs |
||
7403 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
||
7404 | test "X$libobjs" = "X " && libobjs= |
||
7405 | else |
||
7406 | gentop="$output_objdir/${outputname}x" |
||
7407 | generated="$generated $gentop" |
||
7408 | |||
7409 | func_extract_archives $gentop $convenience |
||
7410 | libobjs="$libobjs $func_extract_archives_result" |
||
7411 | test "X$libobjs" = "X " && libobjs= |
||
7412 | fi |
||
7413 | fi |
||
7414 | |||
7415 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
||
7416 | eval flag=\"$thread_safe_flag_spec\" |
||
7417 | linker_flags="$linker_flags $flag" |
||
7418 | fi |
||
7419 | |||
7420 | # Make a backup of the uninstalled library when relinking |
||
7421 | if test "$mode" = relink; then |
||
7422 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? |
||
7423 | fi |
||
7424 | |||
7425 | # Do each of the archive commands. |
||
7426 | if test "$module" = yes && test -n "$module_cmds" ; then |
||
7427 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
||
7428 | eval test_cmds=\"$module_expsym_cmds\" |
||
7429 | cmds=$module_expsym_cmds |
||
7430 | else |
||
7431 | eval test_cmds=\"$module_cmds\" |
||
7432 | cmds=$module_cmds |
||
7433 | fi |
||
7434 | else |
||
7435 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
||
7436 | eval test_cmds=\"$archive_expsym_cmds\" |
||
7437 | cmds=$archive_expsym_cmds |
||
7438 | else |
||
7439 | eval test_cmds=\"$archive_cmds\" |
||
7440 | cmds=$archive_cmds |
||
7441 | fi |
||
7442 | fi |
||
7443 | |||
7444 | if test "X$skipped_export" != "X:" && |
||
7445 | func_len " $test_cmds" && |
||
7446 | len=$func_len_result && |
||
7447 | test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
||
7448 | : |
||
7449 | else |
||
7450 | # The command line is too long to link in one step, link piecewise |
||
7451 | # or, if using GNU ld and skipped_export is not :, use a linker |
||
7452 | # script. |
||
7453 | |||
7454 | # Save the value of $output and $libobjs because we want to |
||
7455 | # use them later. If we have whole_archive_flag_spec, we |
||
7456 | # want to use save_libobjs as it was before |
||
7457 | # whole_archive_flag_spec was expanded, because we can't |
||
7458 | # assume the linker understands whole_archive_flag_spec. |
||
7459 | # This may have to be revisited, in case too many |
||
7460 | # convenience libraries get linked in and end up exceeding |
||
7461 | # the spec. |
||
7462 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then |
||
7463 | save_libobjs=$libobjs |
||
7464 | fi |
||
7465 | save_output=$output |
||
7466 | func_basename "$output" |
||
7467 | output_la=$func_basename_result |
||
7468 | |||
7469 | # Clear the reloadable object creation command queue and |
||
7470 | # initialize k to one. |
||
7471 | test_cmds= |
||
7472 | concat_cmds= |
||
7473 | objlist= |
||
7474 | last_robj= |
||
7475 | k=1 |
||
7476 | |||
7477 | if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then |
||
7478 | output=${output_objdir}/${output_la}.lnkscript |
||
7479 | func_verbose "creating GNU ld script: $output" |
||
7480 | echo 'INPUT (' > $output |
||
7481 | for obj in $save_libobjs |
||
7482 | do |
||
7483 | $ECHO "$obj" >> $output |
||
7484 | done |
||
7485 | echo ')' >> $output |
||
7486 | delfiles="$delfiles $output" |
||
7487 | elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then |
||
7488 | output=${output_objdir}/${output_la}.lnk |
||
7489 | func_verbose "creating linker input file list: $output" |
||
7490 | : > $output |
||
7491 | set x $save_libobjs |
||
7492 | shift |
||
7493 | firstobj= |
||
7494 | if test "$compiler_needs_object" = yes; then |
||
7495 | firstobj="$1 " |
||
7496 | shift |
||
7497 | fi |
||
7498 | for obj |
||
7499 | do |
||
7500 | $ECHO "$obj" >> $output |
||
7501 | done |
||
7502 | delfiles="$delfiles $output" |
||
7503 | output=$firstobj\"$file_list_spec$output\" |
||
7504 | else |
||
7505 | if test -n "$save_libobjs"; then |
||
7506 | func_verbose "creating reloadable object files..." |
||
7507 | output=$output_objdir/$output_la-${k}.$objext |
||
7508 | eval test_cmds=\"$reload_cmds\" |
||
7509 | func_len " $test_cmds" |
||
7510 | len0=$func_len_result |
||
7511 | len=$len0 |
||
7512 | |||
7513 | # Loop over the list of objects to be linked. |
||
7514 | for obj in $save_libobjs |
||
7515 | do |
||
7516 | func_len " $obj" |
||
7517 | func_arith $len + $func_len_result |
||
7518 | len=$func_arith_result |
||
7519 | if test "X$objlist" = X || |
||
7520 | test "$len" -lt "$max_cmd_len"; then |
||
7521 | func_append objlist " $obj" |
||
7522 | else |
||
7523 | # The command $test_cmds is almost too long, add a |
||
7524 | # command to the queue. |
||
7525 | if test "$k" -eq 1 ; then |
||
7526 | # The first file doesn't have a previous command to add. |
||
7527 | reload_objs=$objlist |
||
7528 | eval concat_cmds=\"$reload_cmds\" |
||
7529 | else |
||
7530 | # All subsequent reloadable object files will link in |
||
7531 | # the last one created. |
||
7532 | reload_objs="$objlist $last_robj" |
||
7533 | eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" |
||
7534 | fi |
||
7535 | last_robj=$output_objdir/$output_la-${k}.$objext |
||
7536 | func_arith $k + 1 |
||
7537 | k=$func_arith_result |
||
7538 | output=$output_objdir/$output_la-${k}.$objext |
||
7539 | objlist=" $obj" |
||
7540 | func_len " $last_robj" |
||
7541 | func_arith $len0 + $func_len_result |
||
7542 | len=$func_arith_result |
||
7543 | fi |
||
7544 | done |
||
7545 | # Handle the remaining objects by creating one last |
||
7546 | # reloadable object file. All subsequent reloadable object |
||
7547 | # files will link in the last one created. |
||
7548 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
||
7549 | reload_objs="$objlist $last_robj" |
||
7550 | eval concat_cmds=\"\${concat_cmds}$reload_cmds\" |
||
7551 | if test -n "$last_robj"; then |
||
7552 | eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" |
||
7553 | fi |
||
7554 | delfiles="$delfiles $output" |
||
7555 | |||
7556 | else |
||
7557 | output= |
||
7558 | fi |
||
7559 | |||
7560 | if ${skipped_export-false}; then |
||
7561 | func_verbose "generating symbol list for \`$libname.la'" |
||
7562 | export_symbols="$output_objdir/$libname.exp" |
||
7563 | $opt_dry_run || $RM $export_symbols |
||
7564 | libobjs=$output |
||
7565 | # Append the command to create the export file. |
||
7566 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
||
7567 | eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" |
||
7568 | if test -n "$last_robj"; then |
||
7569 | eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" |
||
7570 | fi |
||
7571 | fi |
||
7572 | |||
7573 | test -n "$save_libobjs" && |
||
7574 | func_verbose "creating a temporary reloadable object file: $output" |
||
7575 | |||
7576 | # Loop through the commands generated above and execute them. |
||
7577 | save_ifs="$IFS"; IFS='~' |
||
7578 | for cmd in $concat_cmds; do |
||
7579 | IFS="$save_ifs" |
||
7580 | $opt_silent || { |
||
7581 | func_quote_for_expand "$cmd" |
||
7582 | eval "func_echo $func_quote_for_expand_result" |
||
7583 | } |
||
7584 | $opt_dry_run || eval "$cmd" || { |
||
7585 | lt_exit=$? |
||
7586 | |||
7587 | # Restore the uninstalled library and exit |
||
7588 | if test "$mode" = relink; then |
||
7589 | ( cd "$output_objdir" && \ |
||
7590 | $RM "${realname}T" && \ |
||
7591 | $MV "${realname}U" "$realname" ) |
||
7592 | fi |
||
7593 | |||
7594 | exit $lt_exit |
||
7595 | } |
||
7596 | done |
||
7597 | IFS="$save_ifs" |
||
7598 | |||
7599 | if test -n "$export_symbols_regex" && ${skipped_export-false}; then |
||
7600 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
||
7601 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' |
||
7602 | fi |
||
7603 | fi |
||
7604 | |||
7605 | if ${skipped_export-false}; then |
||
7606 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
||
7607 | tmp_export_symbols="$export_symbols" |
||
7608 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" |
||
7609 | $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' |
||
7610 | fi |
||
7611 | |||
7612 | if test -n "$orig_export_symbols"; then |
||
7613 | # The given exports_symbols file has to be filtered, so filter it. |
||
7614 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" |
||
7615 | # FIXME: $output_objdir/$libname.filter potentially contains lots of |
||
7616 | # 's' commands which not all seds can handle. GNU sed should be fine |
||
7617 | # though. Also, the filter scales superlinearly with the number of |
||
7618 | # global variables. join(1) would be nice here, but unfortunately |
||
7619 | # isn't a blessed tool. |
||
7620 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
||
7621 | delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" |
||
7622 | export_symbols=$output_objdir/$libname.def |
||
7623 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
||
7624 | fi |
||
7625 | fi |
||
7626 | |||
7627 | libobjs=$output |
||
7628 | # Restore the value of output. |
||
7629 | output=$save_output |
||
7630 | |||
7631 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then |
||
7632 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
||
7633 | test "X$libobjs" = "X " && libobjs= |
||
7634 | fi |
||
7635 | # Expand the library linking commands again to reset the |
||
7636 | # value of $libobjs for piecewise linking. |
||
7637 | |||
7638 | # Do each of the archive commands. |
||
7639 | if test "$module" = yes && test -n "$module_cmds" ; then |
||
7640 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
||
7641 | cmds=$module_expsym_cmds |
||
7642 | else |
||
7643 | cmds=$module_cmds |
||
7644 | fi |
||
7645 | else |
||
7646 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
||
7647 | cmds=$archive_expsym_cmds |
||
7648 | else |
||
7649 | cmds=$archive_cmds |
||
7650 | fi |
||
7651 | fi |
||
7652 | fi |
||
7653 | |||
7654 | if test -n "$delfiles"; then |
||
7655 | # Append the command to remove temporary files to $cmds. |
||
7656 | eval cmds=\"\$cmds~\$RM $delfiles\" |
||
7657 | fi |
||
7658 | |||
7659 | # Add any objects from preloaded convenience libraries |
||
7660 | if test -n "$dlprefiles"; then |
||
7661 | gentop="$output_objdir/${outputname}x" |
||
7662 | generated="$generated $gentop" |
||
7663 | |||
7664 | func_extract_archives $gentop $dlprefiles |
||
7665 | libobjs="$libobjs $func_extract_archives_result" |
||
7666 | test "X$libobjs" = "X " && libobjs= |
||
7667 | fi |
||
7668 | |||
7669 | save_ifs="$IFS"; IFS='~' |
||
7670 | for cmd in $cmds; do |
||
7671 | IFS="$save_ifs" |
||
7672 | eval cmd=\"$cmd\" |
||
7673 | $opt_silent || { |
||
7674 | func_quote_for_expand "$cmd" |
||
7675 | eval "func_echo $func_quote_for_expand_result" |
||
7676 | } |
||
7677 | $opt_dry_run || eval "$cmd" || { |
||
7678 | lt_exit=$? |
||
7679 | |||
7680 | # Restore the uninstalled library and exit |
||
7681 | if test "$mode" = relink; then |
||
7682 | ( cd "$output_objdir" && \ |
||
7683 | $RM "${realname}T" && \ |
||
7684 | $MV "${realname}U" "$realname" ) |
||
7685 | fi |
||
7686 | |||
7687 | exit $lt_exit |
||
7688 | } |
||
7689 | done |
||
7690 | IFS="$save_ifs" |
||
7691 | |||
7692 | # Restore the uninstalled library and exit |
||
7693 | if test "$mode" = relink; then |
||
7694 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? |
||
7695 | |||
7696 | if test -n "$convenience"; then |
||
7697 | if test -z "$whole_archive_flag_spec"; then |
||
7698 | func_show_eval '${RM}r "$gentop"' |
||
7699 | fi |
||
7700 | fi |
||
7701 | |||
7702 | exit $EXIT_SUCCESS |
||
7703 | fi |
||
7704 | |||
7705 | # Create links to the real library. |
||
7706 | for linkname in $linknames; do |
||
7707 | if test "$realname" != "$linkname"; then |
||
7708 | func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' |
||
7709 | fi |
||
7710 | done |
||
7711 | |||
7712 | # If -module or -export-dynamic was specified, set the dlname. |
||
7713 | if test "$module" = yes || test "$export_dynamic" = yes; then |
||
7714 | # On all known operating systems, these are identical. |
||
7715 | dlname="$soname" |
||
7716 | fi |
||
7717 | fi |
||
7718 | ;; |
||
7719 | |||
7720 | obj) |
||
7721 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
||
7722 | func_warning "\`-dlopen' is ignored for objects" |
||
7723 | fi |
||
7724 | |||
7725 | case " $deplibs" in |
||
7726 | *\ -l* | *\ -L*) |
||
7727 | func_warning "\`-l' and \`-L' are ignored for objects" ;; |
||
7728 | esac |
||
7729 | |||
7730 | test -n "$rpath" && \ |
||
7731 | func_warning "\`-rpath' is ignored for objects" |
||
7732 | |||
7733 | test -n "$xrpath" && \ |
||
7734 | func_warning "\`-R' is ignored for objects" |
||
7735 | |||
7736 | test -n "$vinfo" && \ |
||
7737 | func_warning "\`-version-info' is ignored for objects" |
||
7738 | |||
7739 | test -n "$release" && \ |
||
7740 | func_warning "\`-release' is ignored for objects" |
||
7741 | |||
7742 | case $output in |
||
7743 | *.lo) |
||
7744 | test -n "$objs$old_deplibs" && \ |
||
7745 | func_fatal_error "cannot build library object \`$output' from non-libtool objects" |
||
7746 | |||
7747 | libobj=$output |
||
7748 | func_lo2o "$libobj" |
||
7749 | obj=$func_lo2o_result |
||
7750 | ;; |
||
7751 | *) |
||
7752 | libobj= |
||
7753 | obj="$output" |
||
7754 | ;; |
||
7755 | esac |
||
7756 | |||
7757 | # Delete the old objects. |
||
7758 | $opt_dry_run || $RM $obj $libobj |
||
7759 | |||
7760 | # Objects from convenience libraries. This assumes |
||
7761 | # single-version convenience libraries. Whenever we create |
||
7762 | # different ones for PIC/non-PIC, this we'll have to duplicate |
||
7763 | # the extraction. |
||
7764 | reload_conv_objs= |
||
7765 | gentop= |
||
7766 | # reload_cmds runs $LD directly, so let us get rid of |
||
7767 | # -Wl from whole_archive_flag_spec and hope we can get by with |
||
7768 | # turning comma into space.. |
||
7769 | wl= |
||
7770 | |||
7771 | if test -n "$convenience"; then |
||
7772 | if test -n "$whole_archive_flag_spec"; then |
||
7773 | eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" |
||
7774 | reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` |
||
7775 | else |
||
7776 | gentop="$output_objdir/${obj}x" |
||
7777 | generated="$generated $gentop" |
||
7778 | |||
7779 | func_extract_archives $gentop $convenience |
||
7780 | reload_conv_objs="$reload_objs $func_extract_archives_result" |
||
7781 | fi |
||
7782 | fi |
||
7783 | |||
7784 | # Create the old-style object. |
||
7785 | reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test |
||
7786 | |||
7787 | output="$obj" |
||
7788 | func_execute_cmds "$reload_cmds" 'exit $?' |
||
7789 | |||
7790 | # Exit if we aren't doing a library object file. |
||
7791 | if test -z "$libobj"; then |
||
7792 | if test -n "$gentop"; then |
||
7793 | func_show_eval '${RM}r "$gentop"' |
||
7794 | fi |
||
7795 | |||
7796 | exit $EXIT_SUCCESS |
||
7797 | fi |
||
7798 | |||
7799 | if test "$build_libtool_libs" != yes; then |
||
7800 | if test -n "$gentop"; then |
||
7801 | func_show_eval '${RM}r "$gentop"' |
||
7802 | fi |
||
7803 | |||
7804 | # Create an invalid libtool object if no PIC, so that we don't |
||
7805 | # accidentally link it into a program. |
||
7806 | # $show "echo timestamp > $libobj" |
||
7807 | # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? |
||
7808 | exit $EXIT_SUCCESS |
||
7809 | fi |
||
7810 | |||
7811 | if test -n "$pic_flag" || test "$pic_mode" != default; then |
||
7812 | # Only do commands if we really have different PIC objects. |
||
7813 | reload_objs="$libobjs $reload_conv_objs" |
||
7814 | output="$libobj" |
||
7815 | func_execute_cmds "$reload_cmds" 'exit $?' |
||
7816 | fi |
||
7817 | |||
7818 | if test -n "$gentop"; then |
||
7819 | func_show_eval '${RM}r "$gentop"' |
||
7820 | fi |
||
7821 | |||
7822 | exit $EXIT_SUCCESS |
||
7823 | ;; |
||
7824 | |||
7825 | prog) |
||
7826 | case $host in |
||
7827 | *cygwin*) func_stripname '' '.exe' "$output" |
||
7828 | output=$func_stripname_result.exe;; |
||
7829 | esac |
||
7830 | test -n "$vinfo" && \ |
||
7831 | func_warning "\`-version-info' is ignored for programs" |
||
7832 | |||
7833 | test -n "$release" && \ |
||
7834 | func_warning "\`-release' is ignored for programs" |
||
7835 | |||
7836 | test "$preload" = yes \ |
||
7837 | && test "$dlopen_support" = unknown \ |
||
7838 | && test "$dlopen_self" = unknown \ |
||
7839 | && test "$dlopen_self_static" = unknown && \ |
||
7840 | func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." |
||
7841 | |||
7842 | case $host in |
||
7843 | *-*-rhapsody* | *-*-darwin1.[012]) |
||
7844 | # On Rhapsody replace the C library is the System framework |
||
7845 | compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` |
||
7846 | finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` |
||
7847 | ;; |
||
7848 | esac |
||
7849 | |||
7850 | case $host in |
||
7851 | *-*-darwin*) |
||
7852 | # Don't allow lazy linking, it breaks C++ global constructors |
||
7853 | # But is supposedly fixed on 10.4 or later (yay!). |
||
7854 | if test "$tagname" = CXX ; then |
||
7855 | case ${MACOSX_DEPLOYMENT_TARGET-10.0} in |
||
7856 | 10.[0123]) |
||
7857 | compile_command="$compile_command ${wl}-bind_at_load" |
||
7858 | finalize_command="$finalize_command ${wl}-bind_at_load" |
||
7859 | ;; |
||
7860 | esac |
||
7861 | fi |
||
7862 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" |
||
7863 | compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
||
7864 | finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` |
||
7865 | ;; |
||
7866 | esac |
||
7867 | |||
7868 | |||
7869 | # move library search paths that coincide with paths to not yet |
||
7870 | # installed libraries to the beginning of the library search list |
||
7871 | new_libs= |
||
7872 | for path in $notinst_path; do |
||
7873 | case " $new_libs " in |
||
7874 | *" -L$path/$objdir "*) ;; |
||
7875 | *) |
||
7876 | case " $compile_deplibs " in |
||
7877 | *" -L$path/$objdir "*) |
||
7878 | new_libs="$new_libs -L$path/$objdir" ;; |
||
7879 | esac |
||
7880 | ;; |
||
7881 | esac |
||
7882 | done |
||
7883 | for deplib in $compile_deplibs; do |
||
7884 | case $deplib in |
||
7885 | -L*) |
||
7886 | case " $new_libs " in |
||
7887 | *" $deplib "*) ;; |
||
7888 | *) new_libs="$new_libs $deplib" ;; |
||
7889 | esac |
||
7890 | ;; |
||
7891 | *) new_libs="$new_libs $deplib" ;; |
||
7892 | esac |
||
7893 | done |
||
7894 | compile_deplibs="$new_libs" |
||
7895 | |||
7896 | |||
7897 | compile_command="$compile_command $compile_deplibs" |
||
7898 | finalize_command="$finalize_command $finalize_deplibs" |
||
7899 | |||
7900 | if test -n "$rpath$xrpath"; then |
||
7901 | # If the user specified any rpath flags, then add them. |
||
7902 | for libdir in $rpath $xrpath; do |
||
7903 | # This is the magic to use -rpath. |
||
7904 | case "$finalize_rpath " in |
||
7905 | *" $libdir "*) ;; |
||
7906 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
||
7907 | esac |
||
7908 | done |
||
7909 | fi |
||
7910 | |||
7911 | # Now hardcode the library paths |
||
7912 | rpath= |
||
7913 | hardcode_libdirs= |
||
7914 | for libdir in $compile_rpath $finalize_rpath; do |
||
7915 | if test -n "$hardcode_libdir_flag_spec"; then |
||
7916 | if test -n "$hardcode_libdir_separator"; then |
||
7917 | if test -z "$hardcode_libdirs"; then |
||
7918 | hardcode_libdirs="$libdir" |
||
7919 | else |
||
7920 | # Just accumulate the unique libdirs. |
||
7921 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
||
7922 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
||
7923 | ;; |
||
7924 | *) |
||
7925 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
||
7926 | ;; |
||
7927 | esac |
||
7928 | fi |
||
7929 | else |
||
7930 | eval flag=\"$hardcode_libdir_flag_spec\" |
||
7931 | rpath="$rpath $flag" |
||
7932 | fi |
||
7933 | elif test -n "$runpath_var"; then |
||
7934 | case "$perm_rpath " in |
||
7935 | *" $libdir "*) ;; |
||
7936 | *) perm_rpath="$perm_rpath $libdir" ;; |
||
7937 | esac |
||
7938 | fi |
||
7939 | case $host in |
||
7940 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
||
7941 | testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` |
||
7942 | case :$dllsearchpath: in |
||
7943 | *":$libdir:"*) ;; |
||
7944 | ::) dllsearchpath=$libdir;; |
||
7945 | *) dllsearchpath="$dllsearchpath:$libdir";; |
||
7946 | esac |
||
7947 | case :$dllsearchpath: in |
||
7948 | *":$testbindir:"*) ;; |
||
7949 | ::) dllsearchpath=$testbindir;; |
||
7950 | *) dllsearchpath="$dllsearchpath:$testbindir";; |
||
7951 | esac |
||
7952 | ;; |
||
7953 | esac |
||
7954 | done |
||
7955 | # Substitute the hardcoded libdirs into the rpath. |
||
7956 | if test -n "$hardcode_libdir_separator" && |
||
7957 | test -n "$hardcode_libdirs"; then |
||
7958 | libdir="$hardcode_libdirs" |
||
7959 | eval rpath=\" $hardcode_libdir_flag_spec\" |
||
7960 | fi |
||
7961 | compile_rpath="$rpath" |
||
7962 | |||
7963 | rpath= |
||
7964 | hardcode_libdirs= |
||
7965 | for libdir in $finalize_rpath; do |
||
7966 | if test -n "$hardcode_libdir_flag_spec"; then |
||
7967 | if test -n "$hardcode_libdir_separator"; then |
||
7968 | if test -z "$hardcode_libdirs"; then |
||
7969 | hardcode_libdirs="$libdir" |
||
7970 | else |
||
7971 | # Just accumulate the unique libdirs. |
||
7972 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
||
7973 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
||
7974 | ;; |
||
7975 | *) |
||
7976 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
||
7977 | ;; |
||
7978 | esac |
||
7979 | fi |
||
7980 | else |
||
7981 | eval flag=\"$hardcode_libdir_flag_spec\" |
||
7982 | rpath="$rpath $flag" |
||
7983 | fi |
||
7984 | elif test -n "$runpath_var"; then |
||
7985 | case "$finalize_perm_rpath " in |
||
7986 | *" $libdir "*) ;; |
||
7987 | *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; |
||
7988 | esac |
||
7989 | fi |
||
7990 | done |
||
7991 | # Substitute the hardcoded libdirs into the rpath. |
||
7992 | if test -n "$hardcode_libdir_separator" && |
||
7993 | test -n "$hardcode_libdirs"; then |
||
7994 | libdir="$hardcode_libdirs" |
||
7995 | eval rpath=\" $hardcode_libdir_flag_spec\" |
||
7996 | fi |
||
7997 | finalize_rpath="$rpath" |
||
7998 | |||
7999 | if test -n "$libobjs" && test "$build_old_libs" = yes; then |
||
8000 | # Transform all the library objects into standard objects. |
||
8001 | compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` |
||
8002 | finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` |
||
8003 | fi |
||
8004 | |||
8005 | func_generate_dlsyms "$outputname" "@PROGRAM@" "no" |
||
8006 | |||
8007 | # template prelinking step |
||
8008 | if test -n "$prelink_cmds"; then |
||
8009 | func_execute_cmds "$prelink_cmds" 'exit $?' |
||
8010 | fi |
||
8011 | |||
8012 | wrappers_required=yes |
||
8013 | case $host in |
||
8014 | *cegcc* | *mingw32ce*) |
||
8015 | # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. |
||
8016 | wrappers_required=no |
||
8017 | ;; |
||
8018 | *cygwin* | *mingw* ) |
||
8019 | if test "$build_libtool_libs" != yes; then |
||
8020 | wrappers_required=no |
||
8021 | fi |
||
8022 | ;; |
||
8023 | *) |
||
8024 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then |
||
8025 | wrappers_required=no |
||
8026 | fi |
||
8027 | ;; |
||
8028 | esac |
||
8029 | if test "$wrappers_required" = no; then |
||
8030 | # Replace the output file specification. |
||
8031 | compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` |
||
8032 | link_command="$compile_command$compile_rpath" |
||
8033 | |||
8034 | # We have no uninstalled library dependencies, so finalize right now. |
||
8035 | exit_status=0 |
||
8036 | func_show_eval "$link_command" 'exit_status=$?' |
||
8037 | |||
8038 | # Delete the generated files. |
||
8039 | if test -f "$output_objdir/${outputname}S.${objext}"; then |
||
8040 | func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' |
||
8041 | fi |
||
8042 | |||
8043 | exit $exit_status |
||
8044 | fi |
||
8045 | |||
8046 | if test -n "$compile_shlibpath$finalize_shlibpath"; then |
||
8047 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" |
||
8048 | fi |
||
8049 | if test -n "$finalize_shlibpath"; then |
||
8050 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
||
8051 | fi |
||
8052 | |||
8053 | compile_var= |
||
8054 | finalize_var= |
||
8055 | if test -n "$runpath_var"; then |
||
8056 | if test -n "$perm_rpath"; then |
||
8057 | # We should set the runpath_var. |
||
8058 | rpath= |
||
8059 | for dir in $perm_rpath; do |
||
8060 | rpath="$rpath$dir:" |
||
8061 | done |
||
8062 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " |
||
8063 | fi |
||
8064 | if test -n "$finalize_perm_rpath"; then |
||
8065 | # We should set the runpath_var. |
||
8066 | rpath= |
||
8067 | for dir in $finalize_perm_rpath; do |
||
8068 | rpath="$rpath$dir:" |
||
8069 | done |
||
8070 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " |
||
8071 | fi |
||
8072 | fi |
||
8073 | |||
8074 | if test "$no_install" = yes; then |
||
8075 | # We don't need to create a wrapper script. |
||
8076 | link_command="$compile_var$compile_command$compile_rpath" |
||
8077 | # Replace the output file specification. |
||
8078 | link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` |
||
8079 | # Delete the old output file. |
||
8080 | $opt_dry_run || $RM $output |
||
8081 | # Link the executable and exit |
||
8082 | func_show_eval "$link_command" 'exit $?' |
||
8083 | exit $EXIT_SUCCESS |
||
8084 | fi |
||
8085 | |||
8086 | if test "$hardcode_action" = relink; then |
||
8087 | # Fast installation is not supported |
||
8088 | link_command="$compile_var$compile_command$compile_rpath" |
||
8089 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
||
8090 | |||
8091 | func_warning "this platform does not like uninstalled shared libraries" |
||
8092 | func_warning "\`$output' will be relinked during installation" |
||
8093 | else |
||
8094 | if test "$fast_install" != no; then |
||
8095 | link_command="$finalize_var$compile_command$finalize_rpath" |
||
8096 | if test "$fast_install" = yes; then |
||
8097 | relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` |
||
8098 | else |
||
8099 | # fast_install is set to needless |
||
8100 | relink_command= |
||
8101 | fi |
||
8102 | else |
||
8103 | link_command="$compile_var$compile_command$compile_rpath" |
||
8104 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
||
8105 | fi |
||
8106 | fi |
||
8107 | |||
8108 | # Replace the output file specification. |
||
8109 | link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` |
||
8110 | |||
8111 | # Delete the old output files. |
||
8112 | $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname |
||
8113 | |||
8114 | func_show_eval "$link_command" 'exit $?' |
||
8115 | |||
8116 | # Now create the wrapper script. |
||
8117 | func_verbose "creating $output" |
||
8118 | |||
8119 | # Quote the relink command for shipping. |
||
8120 | if test -n "$relink_command"; then |
||
8121 | # Preserve any variables that may affect compiler behavior |
||
8122 | for var in $variables_saved_for_relink; do |
||
8123 | if eval test -z \"\${$var+set}\"; then |
||
8124 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
||
8125 | elif eval var_value=\$$var; test -z "$var_value"; then |
||
8126 | relink_command="$var=; export $var; $relink_command" |
||
8127 | else |
||
8128 | func_quote_for_eval "$var_value" |
||
8129 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
||
8130 | fi |
||
8131 | done |
||
8132 | relink_command="(cd `pwd`; $relink_command)" |
||
8133 | relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` |
||
8134 | fi |
||
8135 | |||
8136 | # Only actually do things if not in dry run mode. |
||
8137 | $opt_dry_run || { |
||
8138 | # win32 will think the script is a binary if it has |
||
8139 | # a .exe suffix, so we strip it off here. |
||
8140 | case $output in |
||
8141 | *.exe) func_stripname '' '.exe' "$output" |
||
8142 | output=$func_stripname_result ;; |
||
8143 | esac |
||
8144 | # test for cygwin because mv fails w/o .exe extensions |
||
8145 | case $host in |
||
8146 | *cygwin*) |
||
8147 | exeext=.exe |
||
8148 | func_stripname '' '.exe' "$outputname" |
||
8149 | outputname=$func_stripname_result ;; |
||
8150 | *) exeext= ;; |
||
8151 | esac |
||
8152 | case $host in |
||
8153 | *cygwin* | *mingw* ) |
||
8154 | func_dirname_and_basename "$output" "" "." |
||
8155 | output_name=$func_basename_result |
||
8156 | output_path=$func_dirname_result |
||
8157 | cwrappersource="$output_path/$objdir/lt-$output_name.c" |
||
8158 | cwrapper="$output_path/$output_name.exe" |
||
8159 | $RM $cwrappersource $cwrapper |
||
8160 | trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 |
||
8161 | |||
8162 | func_emit_cwrapperexe_src > $cwrappersource |
||
8163 | |||
8164 | # The wrapper executable is built using the $host compiler, |
||
8165 | # because it contains $host paths and files. If cross- |
||
8166 | # compiling, it, like the target executable, must be |
||
8167 | # executed on the $host or under an emulation environment. |
||
8168 | $opt_dry_run || { |
||
8169 | $LTCC $LTCFLAGS -o $cwrapper $cwrappersource |
||
8170 | $STRIP $cwrapper |
||
8171 | } |
||
8172 | |||
8173 | # Now, create the wrapper script for func_source use: |
||
8174 | func_ltwrapper_scriptname $cwrapper |
||
8175 | $RM $func_ltwrapper_scriptname_result |
||
8176 | trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 |
||
8177 | $opt_dry_run || { |
||
8178 | # note: this script will not be executed, so do not chmod. |
||
8179 | if test "x$build" = "x$host" ; then |
||
8180 | $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result |
||
8181 | else |
||
8182 | func_emit_wrapper no > $func_ltwrapper_scriptname_result |
||
8183 | fi |
||
8184 | } |
||
8185 | ;; |
||
8186 | * ) |
||
8187 | $RM $output |
||
8188 | trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 |
||
8189 | |||
8190 | func_emit_wrapper no > $output |
||
8191 | chmod +x $output |
||
8192 | ;; |
||
8193 | esac |
||
8194 | } |
||
8195 | exit $EXIT_SUCCESS |
||
8196 | ;; |
||
8197 | esac |
||
8198 | |||
8199 | # See if we need to build an old-fashioned archive. |
||
8200 | for oldlib in $oldlibs; do |
||
8201 | |||
8202 | if test "$build_libtool_libs" = convenience; then |
||
8203 | oldobjs="$libobjs_save $symfileobj" |
||
8204 | addlibs="$convenience" |
||
8205 | build_libtool_libs=no |
||
8206 | else |
||
8207 | if test "$build_libtool_libs" = module; then |
||
8208 | oldobjs="$libobjs_save" |
||
8209 | build_libtool_libs=no |
||
8210 | else |
||
8211 | oldobjs="$old_deplibs $non_pic_objects" |
||
8212 | if test "$preload" = yes && test -f "$symfileobj"; then |
||
8213 | oldobjs="$oldobjs $symfileobj" |
||
8214 | fi |
||
8215 | fi |
||
8216 | addlibs="$old_convenience" |
||
8217 | fi |
||
8218 | |||
8219 | if test -n "$addlibs"; then |
||
8220 | gentop="$output_objdir/${outputname}x" |
||
8221 | generated="$generated $gentop" |
||
8222 | |||
8223 | func_extract_archives $gentop $addlibs |
||
8224 | oldobjs="$oldobjs $func_extract_archives_result" |
||
8225 | fi |
||
8226 | |||
8227 | # Do each command in the archive commands. |
||
8228 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
||
8229 | cmds=$old_archive_from_new_cmds |
||
8230 | else |
||
8231 | |||
8232 | # Add any objects from preloaded convenience libraries |
||
8233 | if test -n "$dlprefiles"; then |
||
8234 | gentop="$output_objdir/${outputname}x" |
||
8235 | generated="$generated $gentop" |
||
8236 | |||
8237 | func_extract_archives $gentop $dlprefiles |
||
8238 | oldobjs="$oldobjs $func_extract_archives_result" |
||
8239 | fi |
||
8240 | |||
8241 | # POSIX demands no paths to be encoded in archives. We have |
||
8242 | # to avoid creating archives with duplicate basenames if we |
||
8243 | # might have to extract them afterwards, e.g., when creating a |
||
8244 | # static archive out of a convenience library, or when linking |
||
8245 | # the entirety of a libtool archive into another (currently |
||
8246 | # not supported by libtool). |
||
8247 | if (for obj in $oldobjs |
||
8248 | do |
||
8249 | func_basename "$obj" |
||
8250 | $ECHO "$func_basename_result" |
||
8251 | done | sort | sort -uc >/dev/null 2>&1); then |
||
8252 | : |
||
8253 | else |
||
8254 | echo "copying selected object files to avoid basename conflicts..." |
||
8255 | gentop="$output_objdir/${outputname}x" |
||
8256 | generated="$generated $gentop" |
||
8257 | func_mkdir_p "$gentop" |
||
8258 | save_oldobjs=$oldobjs |
||
8259 | oldobjs= |
||
8260 | counter=1 |
||
8261 | for obj in $save_oldobjs |
||
8262 | do |
||
8263 | func_basename "$obj" |
||
8264 | objbase="$func_basename_result" |
||
8265 | case " $oldobjs " in |
||
8266 | " ") oldobjs=$obj ;; |
||
8267 | *[\ /]"$objbase "*) |
||
8268 | while :; do |
||
8269 | # Make sure we don't pick an alternate name that also |
||
8270 | # overlaps. |
||
8271 | newobj=lt$counter-$objbase |
||
8272 | func_arith $counter + 1 |
||
8273 | counter=$func_arith_result |
||
8274 | case " $oldobjs " in |
||
8275 | *[\ /]"$newobj "*) ;; |
||
8276 | *) if test ! -f "$gentop/$newobj"; then break; fi ;; |
||
8277 | esac |
||
8278 | done |
||
8279 | func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" |
||
8280 | oldobjs="$oldobjs $gentop/$newobj" |
||
8281 | ;; |
||
8282 | *) oldobjs="$oldobjs $obj" ;; |
||
8283 | esac |
||
8284 | done |
||
8285 | fi |
||
8286 | eval cmds=\"$old_archive_cmds\" |
||
8287 | |||
8288 | func_len " $cmds" |
||
8289 | len=$func_len_result |
||
8290 | if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
||
8291 | cmds=$old_archive_cmds |
||
8292 | else |
||
8293 | # the command line is too long to link in one step, link in parts |
||
8294 | func_verbose "using piecewise archive linking..." |
||
8295 | save_RANLIB=$RANLIB |
||
8296 | RANLIB=: |
||
8297 | objlist= |
||
8298 | concat_cmds= |
||
8299 | save_oldobjs=$oldobjs |
||
8300 | oldobjs= |
||
8301 | # Is there a better way of finding the last object in the list? |
||
8302 | for obj in $save_oldobjs |
||
8303 | do |
||
8304 | last_oldobj=$obj |
||
8305 | done |
||
8306 | eval test_cmds=\"$old_archive_cmds\" |
||
8307 | func_len " $test_cmds" |
||
8308 | len0=$func_len_result |
||
8309 | len=$len0 |
||
8310 | for obj in $save_oldobjs |
||
8311 | do |
||
8312 | func_len " $obj" |
||
8313 | func_arith $len + $func_len_result |
||
8314 | len=$func_arith_result |
||
8315 | func_append objlist " $obj" |
||
8316 | if test "$len" -lt "$max_cmd_len"; then |
||
8317 | : |
||
8318 | else |
||
8319 | # the above command should be used before it gets too long |
||
8320 | oldobjs=$objlist |
||
8321 | if test "$obj" = "$last_oldobj" ; then |
||
8322 | RANLIB=$save_RANLIB |
||
8323 | fi |
||
8324 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
||
8325 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" |
||
8326 | objlist= |
||
8327 | len=$len0 |
||
8328 | fi |
||
8329 | done |
||
8330 | RANLIB=$save_RANLIB |
||
8331 | oldobjs=$objlist |
||
8332 | if test "X$oldobjs" = "X" ; then |
||
8333 | eval cmds=\"\$concat_cmds\" |
||
8334 | else |
||
8335 | eval cmds=\"\$concat_cmds~\$old_archive_cmds\" |
||
8336 | fi |
||
8337 | fi |
||
8338 | fi |
||
8339 | func_execute_cmds "$cmds" 'exit $?' |
||
8340 | done |
||
8341 | |||
8342 | test -n "$generated" && \ |
||
8343 | func_show_eval "${RM}r$generated" |
||
8344 | |||
8345 | # Now create the libtool archive. |
||
8346 | case $output in |
||
8347 | *.la) |
||
8348 | old_library= |
||
8349 | test "$build_old_libs" = yes && old_library="$libname.$libext" |
||
8350 | func_verbose "creating $output" |
||
8351 | |||
8352 | # Preserve any variables that may affect compiler behavior |
||
8353 | for var in $variables_saved_for_relink; do |
||
8354 | if eval test -z \"\${$var+set}\"; then |
||
8355 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
||
8356 | elif eval var_value=\$$var; test -z "$var_value"; then |
||
8357 | relink_command="$var=; export $var; $relink_command" |
||
8358 | else |
||
8359 | func_quote_for_eval "$var_value" |
||
8360 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
||
8361 | fi |
||
8362 | done |
||
8363 | # Quote the link command for shipping. |
||
8364 | relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" |
||
8365 | relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` |
||
8366 | if test "$hardcode_automatic" = yes ; then |
||
8367 | relink_command= |
||
8368 | fi |
||
8369 | |||
8370 | # Only create the output if not a dry run. |
||
8371 | $opt_dry_run || { |
||
8372 | for installed in no yes; do |
||
8373 | if test "$installed" = yes; then |
||
8374 | if test -z "$install_libdir"; then |
||
8375 | break |
||
8376 | fi |
||
8377 | output="$output_objdir/$outputname"i |
||
8378 | # Replace all uninstalled libtool libraries with the installed ones |
||
8379 | newdependency_libs= |
||
8380 | for deplib in $dependency_libs; do |
||
8381 | case $deplib in |
||
8382 | *.la) |
||
8383 | func_basename "$deplib" |
||
8384 | name="$func_basename_result" |
||
8385 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
||
8386 | test -z "$libdir" && \ |
||
8387 | func_fatal_error "\`$deplib' is not a valid libtool archive" |
||
8388 | newdependency_libs="$newdependency_libs $libdir/$name" |
||
8389 | ;; |
||
8390 | *) newdependency_libs="$newdependency_libs $deplib" ;; |
||
8391 | esac |
||
8392 | done |
||
8393 | dependency_libs="$newdependency_libs" |
||
8394 | newdlfiles= |
||
8395 | |||
8396 | for lib in $dlfiles; do |
||
8397 | case $lib in |
||
8398 | *.la) |
||
8399 | func_basename "$lib" |
||
8400 | name="$func_basename_result" |
||
8401 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
||
8402 | test -z "$libdir" && \ |
||
8403 | func_fatal_error "\`$lib' is not a valid libtool archive" |
||
8404 | newdlfiles="$newdlfiles $libdir/$name" |
||
8405 | ;; |
||
8406 | *) newdlfiles="$newdlfiles $lib" ;; |
||
8407 | esac |
||
8408 | done |
||
8409 | dlfiles="$newdlfiles" |
||
8410 | newdlprefiles= |
||
8411 | for lib in $dlprefiles; do |
||
8412 | case $lib in |
||
8413 | *.la) |
||
8414 | # Only pass preopened files to the pseudo-archive (for |
||
8415 | # eventual linking with the app. that links it) if we |
||
8416 | # didn't already link the preopened objects directly into |
||
8417 | # the library: |
||
8418 | func_basename "$lib" |
||
8419 | name="$func_basename_result" |
||
8420 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
||
8421 | test -z "$libdir" && \ |
||
8422 | func_fatal_error "\`$lib' is not a valid libtool archive" |
||
8423 | newdlprefiles="$newdlprefiles $libdir/$name" |
||
8424 | ;; |
||
8425 | esac |
||
8426 | done |
||
8427 | dlprefiles="$newdlprefiles" |
||
8428 | else |
||
8429 | newdlfiles= |
||
8430 | for lib in $dlfiles; do |
||
8431 | case $lib in |
||
8432 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
||
8433 | *) abs=`pwd`"/$lib" ;; |
||
8434 | esac |
||
8435 | newdlfiles="$newdlfiles $abs" |
||
8436 | done |
||
8437 | dlfiles="$newdlfiles" |
||
8438 | newdlprefiles= |
||
8439 | for lib in $dlprefiles; do |
||
8440 | case $lib in |
||
8441 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
||
8442 | *) abs=`pwd`"/$lib" ;; |
||
8443 | esac |
||
8444 | newdlprefiles="$newdlprefiles $abs" |
||
8445 | done |
||
8446 | dlprefiles="$newdlprefiles" |
||
8447 | fi |
||
8448 | $RM $output |
||
8449 | # place dlname in correct position for cygwin |
||
8450 | # In fact, it would be nice if we could use this code for all target |
||
8451 | # systems that can't hard-code library paths into their executables |
||
8452 | # and that have no shared library path variable independent of PATH, |
||
8453 | # but it turns out we can't easily determine that from inspecting |
||
8454 | # libtool variables, so we have to hard-code the OSs to which it |
||
8455 | # applies here; at the moment, that means platforms that use the PE |
||
8456 | # object format with DLL files. See the long comment at the top of |
||
8457 | # tests/bindir.at for full details. |
||
8458 | tdlname=$dlname |
||
8459 | case $host,$output,$installed,$module,$dlname in |
||
8460 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) |
||
8461 | # If a -bindir argument was supplied, place the dll there. |
||
8462 | if test "x$bindir" != x ; |
||
8463 | then |
||
8464 | func_relative_path "$install_libdir" "$bindir" |
||
8465 | tdlname=$func_relative_path_result$dlname |
||
8466 | else |
||
8467 | # Otherwise fall back on heuristic. |
||
8468 | tdlname=../bin/$dlname |
||
8469 | fi |
||
8470 | ;; |
||
8471 | esac |
||
8472 | $ECHO > $output "\ |
||
8473 | # $outputname - a libtool library file |
||
8474 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
||
8475 | # |
||
8476 | # Please DO NOT delete this file! |
||
8477 | # It is necessary for linking the library. |
||
8478 | |||
8479 | # The name that we can dlopen(3). |
||
8480 | dlname='$tdlname' |
||
8481 | |||
8482 | # Names of this library. |
||
8483 | library_names='$library_names' |
||
8484 | |||
8485 | # The name of the static archive. |
||
8486 | old_library='$old_library' |
||
8487 | |||
8488 | # Linker flags that can not go in dependency_libs. |
||
8489 | inherited_linker_flags='$new_inherited_linker_flags' |
||
8490 | |||
8491 | # Libraries that this one depends upon. |
||
8492 | dependency_libs='$dependency_libs' |
||
8493 | |||
8494 | # Names of additional weak libraries provided by this library |
||
8495 | weak_library_names='$weak_libs' |
||
8496 | |||
8497 | # Version information for $libname. |
||
8498 | current=$current |
||
8499 | age=$age |
||
8500 | revision=$revision |
||
8501 | |||
8502 | # Is this an already installed library? |
||
8503 | installed=$installed |
||
8504 | |||
8505 | # Should we warn about portability when linking against -modules? |
||
8506 | shouldnotlink=$module |
||
8507 | |||
8508 | # Files to dlopen/dlpreopen |
||
8509 | dlopen='$dlfiles' |
||
8510 | dlpreopen='$dlprefiles' |
||
8511 | |||
8512 | # Directory that this library needs to be installed in: |
||
8513 | libdir='$install_libdir'" |
||
8514 | if test "$installed" = no && test "$need_relink" = yes; then |
||
8515 | $ECHO >> $output "\ |
||
8516 | relink_command=\"$relink_command\"" |
||
8517 | fi |
||
8518 | done |
||
8519 | } |
||
8520 | |||
8521 | # Do a symbolic link so that the libtool archive can be found in |
||
8522 | # LD_LIBRARY_PATH before the program is installed. |
||
8523 | func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' |
||
8524 | ;; |
||
8525 | esac |
||
8526 | exit $EXIT_SUCCESS |
||
8527 | } |
||
8528 | |||
8529 | { test "$mode" = link || test "$mode" = relink; } && |
||
8530 | func_mode_link ${1+"$@"} |
||
8531 | |||
8532 | |||
8533 | # func_mode_uninstall arg... |
||
8534 | func_mode_uninstall () |
||
8535 | { |
||
8536 | $opt_debug |
||
8537 | RM="$nonopt" |
||
8538 | files= |
||
8539 | rmforce= |
||
8540 | exit_status=0 |
||
8541 | |||
8542 | # This variable tells wrapper scripts just to set variables rather |
||
8543 | # than running their programs. |
||
8544 | libtool_install_magic="$magic" |
||
8545 | |||
8546 | for arg |
||
8547 | do |
||
8548 | case $arg in |
||
8549 | -f) RM="$RM $arg"; rmforce=yes ;; |
||
8550 | -*) RM="$RM $arg" ;; |
||
8551 | *) files="$files $arg" ;; |
||
8552 | esac |
||
8553 | done |
||
8554 | |||
8555 | test -z "$RM" && \ |
||
8556 | func_fatal_help "you must specify an RM program" |
||
8557 | |||
8558 | rmdirs= |
||
8559 | |||
8560 | origobjdir="$objdir" |
||
8561 | for file in $files; do |
||
8562 | func_dirname "$file" "" "." |
||
8563 | dir="$func_dirname_result" |
||
8564 | if test "X$dir" = X.; then |
||
8565 | objdir="$origobjdir" |
||
8566 | else |
||
8567 | objdir="$dir/$origobjdir" |
||
8568 | fi |
||
8569 | func_basename "$file" |
||
8570 | name="$func_basename_result" |
||
8571 | test "$mode" = uninstall && objdir="$dir" |
||
8572 | |||
8573 | # Remember objdir for removal later, being careful to avoid duplicates |
||
8574 | if test "$mode" = clean; then |
||
8575 | case " $rmdirs " in |
||
8576 | *" $objdir "*) ;; |
||
8577 | *) rmdirs="$rmdirs $objdir" ;; |
||
8578 | esac |
||
8579 | fi |
||
8580 | |||
8581 | # Don't error if the file doesn't exist and rm -f was used. |
||
8582 | if { test -L "$file"; } >/dev/null 2>&1 || |
||
8583 | { test -h "$file"; } >/dev/null 2>&1 || |
||
8584 | test -f "$file"; then |
||
8585 | : |
||
8586 | elif test -d "$file"; then |
||
8587 | exit_status=1 |
||
8588 | continue |
||
8589 | elif test "$rmforce" = yes; then |
||
8590 | continue |
||
8591 | fi |
||
8592 | |||
8593 | rmfiles="$file" |
||
8594 | |||
8595 | case $name in |
||
8596 | *.la) |
||
8597 | # Possibly a libtool archive, so verify it. |
||
8598 | if func_lalib_p "$file"; then |
||
8599 | func_source $dir/$name |
||
8600 | |||
8601 | # Delete the libtool libraries and symlinks. |
||
8602 | for n in $library_names; do |
||
8603 | rmfiles="$rmfiles $objdir/$n" |
||
8604 | done |
||
8605 | test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" |
||
8606 | |||
8607 | case "$mode" in |
||
8608 | clean) |
||
8609 | case " $library_names " in |
||
8610 | # " " in the beginning catches empty $dlname |
||
8611 | *" $dlname "*) ;; |
||
8612 | *) rmfiles="$rmfiles $objdir/$dlname" ;; |
||
8613 | esac |
||
8614 | test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" |
||
8615 | ;; |
||
8616 | uninstall) |
||
8617 | if test -n "$library_names"; then |
||
8618 | # Do each command in the postuninstall commands. |
||
8619 | func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' |
||
8620 | fi |
||
8621 | |||
8622 | if test -n "$old_library"; then |
||
8623 | # Do each command in the old_postuninstall commands. |
||
8624 | func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' |
||
8625 | fi |
||
8626 | # FIXME: should reinstall the best remaining shared library. |
||
8627 | ;; |
||
8628 | esac |
||
8629 | fi |
||
8630 | ;; |
||
8631 | |||
8632 | *.lo) |
||
8633 | # Possibly a libtool object, so verify it. |
||
8634 | if func_lalib_p "$file"; then |
||
8635 | |||
8636 | # Read the .lo file |
||
8637 | func_source $dir/$name |
||
8638 | |||
8639 | # Add PIC object to the list of files to remove. |
||
8640 | if test -n "$pic_object" && |
||
8641 | test "$pic_object" != none; then |
||
8642 | rmfiles="$rmfiles $dir/$pic_object" |
||
8643 | fi |
||
8644 | |||
8645 | # Add non-PIC object to the list of files to remove. |
||
8646 | if test -n "$non_pic_object" && |
||
8647 | test "$non_pic_object" != none; then |
||
8648 | rmfiles="$rmfiles $dir/$non_pic_object" |
||
8649 | fi |
||
8650 | fi |
||
8651 | ;; |
||
8652 | |||
8653 | *) |
||
8654 | if test "$mode" = clean ; then |
||
8655 | noexename=$name |
||
8656 | case $file in |
||
8657 | *.exe) |
||
8658 | func_stripname '' '.exe' "$file" |
||
8659 | file=$func_stripname_result |
||
8660 | func_stripname '' '.exe' "$name" |
||
8661 | noexename=$func_stripname_result |
||
8662 | # $file with .exe has already been added to rmfiles, |
||
8663 | # add $file without .exe |
||
8664 | rmfiles="$rmfiles $file" |
||
8665 | ;; |
||
8666 | esac |
||
8667 | # Do a test to see if this is a libtool program. |
||
8668 | if func_ltwrapper_p "$file"; then |
||
8669 | if func_ltwrapper_executable_p "$file"; then |
||
8670 | func_ltwrapper_scriptname "$file" |
||
8671 | relink_command= |
||
8672 | func_source $func_ltwrapper_scriptname_result |
||
8673 | rmfiles="$rmfiles $func_ltwrapper_scriptname_result" |
||
8674 | else |
||
8675 | relink_command= |
||
8676 | func_source $dir/$noexename |
||
8677 | fi |
||
8678 | |||
8679 | # note $name still contains .exe if it was in $file originally |
||
8680 | # as does the version of $file that was added into $rmfiles |
||
8681 | rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" |
||
8682 | if test "$fast_install" = yes && test -n "$relink_command"; then |
||
8683 | rmfiles="$rmfiles $objdir/lt-$name" |
||
8684 | fi |
||
8685 | if test "X$noexename" != "X$name" ; then |
||
8686 | rmfiles="$rmfiles $objdir/lt-${noexename}.c" |
||
8687 | fi |
||
8688 | fi |
||
8689 | fi |
||
8690 | ;; |
||
8691 | esac |
||
8692 | func_show_eval "$RM $rmfiles" 'exit_status=1' |
||
8693 | done |
||
8694 | objdir="$origobjdir" |
||
8695 | |||
8696 | # Try to remove the ${objdir}s in the directories where we deleted files |
||
8697 | for dir in $rmdirs; do |
||
8698 | if test -d "$dir"; then |
||
8699 | func_show_eval "rmdir $dir >/dev/null 2>&1" |
||
8700 | fi |
||
8701 | done |
||
8702 | |||
8703 | exit $exit_status |
||
8704 | } |
||
8705 | |||
8706 | { test "$mode" = uninstall || test "$mode" = clean; } && |
||
8707 | func_mode_uninstall ${1+"$@"} |
||
8708 | |||
8709 | test -z "$mode" && { |
||
8710 | help="$generic_help" |
||
8711 | func_fatal_help "you must specify a MODE" |
||
8712 | } |
||
8713 | |||
8714 | test -z "$exec_cmd" && \ |
||
8715 | func_fatal_help "invalid operation mode \`$mode'" |
||
8716 | |||
8717 | if test -n "$exec_cmd"; then |
||
8718 | eval exec "$exec_cmd" |
||
8719 | exit $EXIT_FAILURE |
||
8720 | fi |
||
8721 | |||
8722 | exit $exit_status |
||
8723 | |||
8724 | |||
8725 | # The TAGs below are defined such that we never get into a situation |
||
8726 | # in which we disable both kinds of libraries. Given conflicting |
||
8727 | # choices, we go for a static library, that is the most portable, |
||
8728 | # since we can't tell whether shared libraries were disabled because |
||
8729 | # the user asked for that or because the platform doesn't support |
||
8730 | # them. This is particularly important on AIX, because we don't |
||
8731 | # support having both static and shared libraries enabled at the same |
||
8732 | # time on that platform, so we default to a shared-only configuration. |
||
8733 | # If a disable-shared tag is given, we'll fallback to a static-only |
||
8734 | # configuration. But we'll never go from static-only to shared-only. |
||
8735 | |||
8736 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared |
||
8737 | build_libtool_libs=no |
||
8738 | build_old_libs=yes |
||
8739 | # ### END LIBTOOL TAG CONFIG: disable-shared |
||
8740 | |||
8741 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static |
||
8742 | build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` |
||
8743 | # ### END LIBTOOL TAG CONFIG: disable-static |
||
8744 | |||
8745 | # Local Variables: |
||
8746 | # mode:shell-script |
||
8747 | # sh-indentation:2 |
||
8748 | # End: |
||
8749 | # vi:sw=2>>>> |
||
8750 |