1 |
|
---|
2 | # libtool (GNU libtool) 2.4.2
|
---|
3 | # Written by Gordon Matzigkeit <[email protected]>, 1996
|
---|
4 |
|
---|
5 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
|
---|
6 | # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
---|
7 | # This is free software; see the source for copying conditions. There is NO
|
---|
8 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
9 |
|
---|
10 | # GNU Libtool is free software; you can redistribute it and/or modify
|
---|
11 | # it under the terms of the GNU General Public License as published by
|
---|
12 | # the Free Software Foundation; either version 2 of the License, or
|
---|
13 | # (at your option) any later version.
|
---|
14 | #
|
---|
15 | # As a special exception to the GNU General Public License,
|
---|
16 | # if you distribute this file as part of a program or library that
|
---|
17 | # is built using GNU Libtool, you may include this file under the
|
---|
18 | # same distribution terms that you use for the rest of that program.
|
---|
19 | #
|
---|
20 | # GNU Libtool is distributed in the hope that it will be useful, but
|
---|
21 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
23 | # General Public License for more details.
|
---|
24 | #
|
---|
25 | # You should have received a copy of the GNU General Public License
|
---|
26 | # along with GNU Libtool; see the file COPYING. If not, a copy
|
---|
27 | # can be downloaded from http://www.gnu.org/licenses/gpl.html,
|
---|
28 | # or obtained by writing to the Free Software Foundation, Inc.,
|
---|
29 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
---|
30 |
|
---|
31 |
|
---|
32 | # Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
33 | # other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
34 | # the General Public License version 2 (GPLv2) at this time for any software where
|
---|
35 | # a choice of GPL license versions is made available with the language indicating
|
---|
36 | # that GPLv2 or any later version may be used, or where a choice of which version
|
---|
37 | # of the GPL is applied is otherwise unspecified.
|
---|
38 |
|
---|
39 |
|
---|
40 | # Usage: $progname [OPTION]... [MODE-ARG]...
|
---|
41 | #
|
---|
42 | # Provide generalized library-building support services.
|
---|
43 | #
|
---|
44 | # --config show all configuration variables
|
---|
45 | # --debug enable verbose shell tracing
|
---|
46 | # -n, --dry-run display commands without modifying any files
|
---|
47 | # --features display basic configuration information and exit
|
---|
48 | # --mode=MODE use operation mode MODE
|
---|
49 | # --preserve-dup-deps don't remove duplicate dependency libraries
|
---|
50 | # --quiet, --silent don't print informational messages
|
---|
51 | # --no-quiet, --no-silent
|
---|
52 | # print informational messages (default)
|
---|
53 | # --no-warn don't display warning messages
|
---|
54 | # --tag=TAG use configuration variables from tag TAG
|
---|
55 | # -v, --verbose print more informational messages than default
|
---|
56 | # --no-verbose don't print the extra informational messages
|
---|
57 | # --version print version information
|
---|
58 | # -h, --help, --help-all print short, long, or detailed help message
|
---|
59 | #
|
---|
60 | # MODE must be one of the following:
|
---|
61 | #
|
---|
62 | # clean remove files from the build directory
|
---|
63 | # compile compile a source file into a libtool object
|
---|
64 | # execute automatically set library path, then run a program
|
---|
65 | # finish complete the installation of libtool libraries
|
---|
66 | # install install libraries or executables
|
---|
67 | # link create a library or an executable
|
---|
68 | # uninstall remove libraries from an installed directory
|
---|
69 | #
|
---|
70 | # MODE-ARGS vary depending on the MODE. When passed as first option,
|
---|
71 | # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
|
---|
72 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
|
---|
73 | #
|
---|
74 | # When reporting a bug, please describe a test case to reproduce it and
|
---|
75 | # include the following information:
|
---|
76 | #
|
---|
77 | # host-triplet: $host
|
---|
78 | # shell: $SHELL
|
---|
79 | # compiler: $LTCC
|
---|
80 | # compiler flags: $LTCFLAGS
|
---|
81 | # linker: $LD (gnu? $with_gnu_ld)
|
---|
82 | # $progname: (GNU libtool) 2.4.2
|
---|
83 | # automake: $automake_version
|
---|
84 | # autoconf: $autoconf_version
|
---|
85 | #
|
---|
86 | # Report bugs to <[email protected]>.
|
---|
87 | # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
|
---|
88 | # General help using GNU software: <http://www.gnu.org/gethelp/>.
|
---|
89 |
|
---|
90 | PROGRAM=libtool
|
---|
91 | PACKAGE=libtool
|
---|
92 | VERSION=2.4.2
|
---|
93 | TIMESTAMP=""
|
---|
94 | package_revision=1.3337
|
---|
95 |
|
---|
96 | # Be Bourne compatible
|
---|
97 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
---|
98 | emulate sh
|
---|
99 | NULLCMD=:
|
---|
100 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
---|
101 | # is contrary to our usage. Disable this feature.
|
---|
102 | alias -g '${1+"$@"}'='"$@"'
|
---|
103 | setopt NO_GLOB_SUBST
|
---|
104 | else
|
---|
105 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
---|
106 | fi
|
---|
107 | BIN_SH=xpg4; export BIN_SH # for Tru64
|
---|
108 | DUALCASE=1; export DUALCASE # for MKS sh
|
---|
109 |
|
---|
110 | # A function that is used when there is no print builtin or printf.
|
---|
111 | func_fallback_echo ()
|
---|
112 | {
|
---|
113 | eval 'cat <<_LTECHO_EOF
|
---|
114 | $1
|
---|
115 | _LTECHO_EOF'
|
---|
116 | }
|
---|
117 |
|
---|
118 | # NLS nuisances: We save the old values to restore during execute mode.
|
---|
119 | lt_user_locale=
|
---|
120 | lt_safe_locale=
|
---|
121 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
---|
122 | do
|
---|
123 | eval "if test \"\${$lt_var+set}\" = set; then
|
---|
124 | save_$lt_var=\$$lt_var
|
---|
125 | $lt_var=C
|
---|
126 | export $lt_var
|
---|
127 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
|
---|
128 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
|
---|
129 | fi"
|
---|
130 | done
|
---|
131 | LC_ALL=C
|
---|
132 | LANGUAGE=C
|
---|
133 | export LANGUAGE LC_ALL
|
---|
134 |
|
---|
135 | $lt_unset CDPATH
|
---|
136 |
|
---|
137 |
|
---|
138 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
|
---|
139 | # is ksh but when the shell is invoked as "sh" and the current value of
|
---|
140 | # the _XPG environment variable is not equal to 1 (one), the special
|
---|
141 | # positional parameter $0, within a function call, is the name of the
|
---|
142 | # function.
|
---|
143 | progpath="$0"
|
---|
144 |
|
---|
145 |
|
---|
146 |
|
---|
147 | : ${CP="cp -f"}
|
---|
148 | test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
|
---|
149 | : ${MAKE="make"}
|
---|
150 | : ${MKDIR="mkdir"}
|
---|
151 | : ${MV="mv -f"}
|
---|
152 | : ${RM="rm -f"}
|
---|
153 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
|
---|
154 | : ${Xsed="$SED -e 1s/^X//"}
|
---|
155 |
|
---|
156 | # Global variables:
|
---|
157 | EXIT_SUCCESS=0
|
---|
158 | EXIT_FAILURE=1
|
---|
159 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
|
---|
160 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
|
---|
161 |
|
---|
162 | exit_status=$EXIT_SUCCESS
|
---|
163 |
|
---|
164 | # Make sure IFS has a sensible default
|
---|
165 | lt_nl='
|
---|
166 | '
|
---|
167 | IFS=" $lt_nl"
|
---|
168 |
|
---|
169 | dirname="s,/[^/]*$,,"
|
---|
170 | basename="s,^.*/,,"
|
---|
171 |
|
---|
172 | # func_dirname file append nondir_replacement
|
---|
173 | # Compute the dirname of FILE. If nonempty, add APPEND to the result,
|
---|
174 | # otherwise set result to NONDIR_REPLACEMENT.
|
---|
175 | func_dirname ()
|
---|
176 | {
|
---|
177 | func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
|
---|
178 | if test "X$func_dirname_result" = "X${1}"; then
|
---|
179 | func_dirname_result="${3}"
|
---|
180 | else
|
---|
181 | func_dirname_result="$func_dirname_result${2}"
|
---|
182 | fi
|
---|
183 | } # func_dirname may be replaced by extended shell implementation
|
---|
184 |
|
---|
185 |
|
---|
186 | # func_basename file
|
---|
187 | func_basename ()
|
---|
188 | {
|
---|
189 | func_basename_result=`$ECHO "${1}" | $SED "$basename"`
|
---|
190 | } # func_basename may be replaced by extended shell implementation
|
---|
191 |
|
---|
192 |
|
---|
193 | # func_dirname_and_basename file append nondir_replacement
|
---|
194 | # perform func_basename and func_dirname in a single function
|
---|
195 | # call:
|
---|
196 | # dirname: Compute the dirname of FILE. If nonempty,
|
---|
197 | # add APPEND to the result, otherwise set result
|
---|
198 | # to NONDIR_REPLACEMENT.
|
---|
199 | # value returned in "$func_dirname_result"
|
---|
200 | # basename: Compute filename of FILE.
|
---|
201 | # value retuned in "$func_basename_result"
|
---|
202 | # Implementation must be kept synchronized with func_dirname
|
---|
203 | # and func_basename. For efficiency, we do not delegate to
|
---|
204 | # those functions but instead duplicate the functionality here.
|
---|
205 | func_dirname_and_basename ()
|
---|
206 | {
|
---|
207 | # Extract subdirectory from the argument.
|
---|
208 | func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
|
---|
209 | if test "X$func_dirname_result" = "X${1}"; then
|
---|
210 | func_dirname_result="${3}"
|
---|
211 | else
|
---|
212 | func_dirname_result="$func_dirname_result${2}"
|
---|
213 | fi
|
---|
214 | func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
|
---|
215 | } # func_dirname_and_basename may be replaced by extended shell implementation
|
---|
216 |
|
---|
217 |
|
---|
218 | # func_stripname prefix suffix name
|
---|
219 | # strip PREFIX and SUFFIX off of NAME.
|
---|
220 | # PREFIX and SUFFIX must not contain globbing or regex special
|
---|
221 | # characters, hashes, percent signs, but SUFFIX may contain a leading
|
---|
222 | # dot (in which case that matches only a dot).
|
---|
223 | # func_strip_suffix prefix name
|
---|
224 | func_stripname ()
|
---|
225 | {
|
---|
226 | case ${2} in
|
---|
227 | .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
|
---|
228 | *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
|
---|
229 | esac
|
---|
230 | } # func_stripname may be replaced by extended shell implementation
|
---|
231 |
|
---|
232 |
|
---|
233 | # These SED scripts presuppose an absolute path with a trailing slash.
|
---|
234 | pathcar='s,^/\([^/]*\).*$,\1,'
|
---|
235 | pathcdr='s,^/[^/]*,,'
|
---|
236 | removedotparts=':dotsl
|
---|
237 | s@/\./@/@g
|
---|
238 | t dotsl
|
---|
239 | s,/\.$,/,'
|
---|
240 | collapseslashes='s@/\{1,\}@/@g'
|
---|
241 | finalslash='s,/*$,/,'
|
---|
242 |
|
---|
243 | # func_normal_abspath PATH
|
---|
244 | # Remove doubled-up and trailing slashes, "." path components,
|
---|
245 | # and cancel out any ".." path components in PATH after making
|
---|
246 | # it an absolute path.
|
---|
247 | # value returned in "$func_normal_abspath_result"
|
---|
248 | func_normal_abspath ()
|
---|
249 | {
|
---|
250 | # Start from root dir and reassemble the path.
|
---|
251 | func_normal_abspath_result=
|
---|
252 | func_normal_abspath_tpath=$1
|
---|
253 | func_normal_abspath_altnamespace=
|
---|
254 | case $func_normal_abspath_tpath in
|
---|
255 | "")
|
---|
256 | # Empty path, that just means $cwd.
|
---|
257 | func_stripname '' '/' "`pwd`"
|
---|
258 | func_normal_abspath_result=$func_stripname_result
|
---|
259 | return
|
---|
260 | ;;
|
---|
261 | # The next three entries are used to spot a run of precisely
|
---|
262 | # two leading slashes without using negated character classes;
|
---|
263 | # we take advantage of case's first-match behaviour.
|
---|
264 | ///*)
|
---|
265 | # Unusual form of absolute path, do nothing.
|
---|
266 | ;;
|
---|
267 | //*)
|
---|
268 | # Not necessarily an ordinary path; POSIX reserves leading '//'
|
---|
269 | # and for example Cygwin uses it to access remote file shares
|
---|
270 | # over CIFS/SMB, so we conserve a leading double slash if found.
|
---|
271 | func_normal_abspath_altnamespace=/
|
---|
272 | ;;
|
---|
273 | /*)
|
---|
274 | # Absolute path, do nothing.
|
---|
275 | ;;
|
---|
276 | *)
|
---|
277 | # Relative path, prepend $cwd.
|
---|
278 | func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
|
---|
279 | ;;
|
---|
280 | esac
|
---|
281 | # Cancel out all the simple stuff to save iterations. We also want
|
---|
282 | # the path to end with a slash for ease of parsing, so make sure
|
---|
283 | # there is one (and only one) here.
|
---|
284 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
|
---|
285 | -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
|
---|
286 | while :; do
|
---|
287 | # Processed it all yet?
|
---|
288 | if test "$func_normal_abspath_tpath" = / ; then
|
---|
289 | # If we ascended to the root using ".." the result may be empty now.
|
---|
290 | if test -z "$func_normal_abspath_result" ; then
|
---|
291 | func_normal_abspath_result=/
|
---|
292 | fi
|
---|
293 | break
|
---|
294 | fi
|
---|
295 | func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
|
---|
296 | -e "$pathcar"`
|
---|
297 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
|
---|
298 | -e "$pathcdr"`
|
---|
299 | # Figure out what to do with it
|
---|
300 | case $func_normal_abspath_tcomponent in
|
---|
301 | "")
|
---|
302 | # Trailing empty path component, ignore it.
|
---|
303 | ;;
|
---|
304 | ..)
|
---|
305 | # Parent dir; strip last assembled component from result.
|
---|
306 | func_dirname "$func_normal_abspath_result"
|
---|
307 | func_normal_abspath_result=$func_dirname_result
|
---|
308 | ;;
|
---|
309 | *)
|
---|
310 | # Actual path component, append it.
|
---|
311 | func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
|
---|
312 | ;;
|
---|
313 | esac
|
---|
314 | done
|
---|
315 | # Restore leading double-slash if one was found on entry.
|
---|
316 | func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
|
---|
317 | }
|
---|
318 |
|
---|
319 | # func_relative_path SRCDIR DSTDIR
|
---|
320 | # generates a relative path from SRCDIR to DSTDIR, with a trailing
|
---|
321 | # slash if non-empty, suitable for immediately appending a filename
|
---|
322 | # without needing to append a separator.
|
---|
323 | # value returned in "$func_relative_path_result"
|
---|
324 | func_relative_path ()
|
---|
325 | {
|
---|
326 | func_relative_path_result=
|
---|
327 | func_normal_abspath "$1"
|
---|
328 | func_relative_path_tlibdir=$func_normal_abspath_result
|
---|
329 | func_normal_abspath "$2"
|
---|
330 | func_relative_path_tbindir=$func_normal_abspath_result
|
---|
331 |
|
---|
332 | # Ascend the tree starting from libdir
|
---|
333 | while :; do
|
---|
334 | # check if we have found a prefix of bindir
|
---|
335 | case $func_relative_path_tbindir in
|
---|
336 | $func_relative_path_tlibdir)
|
---|
337 | # found an exact match
|
---|
338 | func_relative_path_tcancelled=
|
---|
339 | break
|
---|
340 | ;;
|
---|
341 | $func_relative_path_tlibdir*)
|
---|
342 | # found a matching prefix
|
---|
343 | func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
|
---|
344 | func_relative_path_tcancelled=$func_stripname_result
|
---|
345 | if test -z "$func_relative_path_result"; then
|
---|
346 | func_relative_path_result=.
|
---|
347 | fi
|
---|
348 | break
|
---|
349 | ;;
|
---|
350 | *)
|
---|
351 | func_dirname $func_relative_path_tlibdir
|
---|
352 | func_relative_path_tlibdir=${func_dirname_result}
|
---|
353 | if test "x$func_relative_path_tlibdir" = x ; then
|
---|
354 | # Have to descend all the way to the root!
|
---|
355 | func_relative_path_result=../$func_relative_path_result
|
---|
356 | func_relative_path_tcancelled=$func_relative_path_tbindir
|
---|
357 | break
|
---|
358 | fi
|
---|
359 | func_relative_path_result=../$func_relative_path_result
|
---|
360 | ;;
|
---|
361 | esac
|
---|
362 | done
|
---|
363 |
|
---|
364 | # Now calculate path; take care to avoid doubling-up slashes.
|
---|
365 | func_stripname '' '/' "$func_relative_path_result"
|
---|
366 | func_relative_path_result=$func_stripname_result
|
---|
367 | func_stripname '/' '/' "$func_relative_path_tcancelled"
|
---|
368 | if test "x$func_stripname_result" != x ; then
|
---|
369 | func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
|
---|
370 | fi
|
---|
371 |
|
---|
372 | # Normalisation. If bindir is libdir, return empty string,
|
---|
373 | # else relative path ending with a slash; either way, target
|
---|
374 | # file name can be directly appended.
|
---|
375 | if test ! -z "$func_relative_path_result"; then
|
---|
376 | func_stripname './' '' "$func_relative_path_result/"
|
---|
377 | func_relative_path_result=$func_stripname_result
|
---|
378 | fi
|
---|
379 | }
|
---|
380 |
|
---|
381 | # The name of this program:
|
---|
382 | func_dirname_and_basename "$progpath"
|
---|
383 | progname=$func_basename_result
|
---|
384 |
|
---|
385 | # Make sure we have an absolute path for reexecution:
|
---|
386 | case $progpath in
|
---|
387 | [\\/]*|[A-Za-z]:\\*) ;;
|
---|
388 | *[\\/]*)
|
---|
389 | progdir=$func_dirname_result
|
---|
390 | progdir=`cd "$progdir" && pwd`
|
---|
391 | progpath="$progdir/$progname"
|
---|
392 | ;;
|
---|
393 | *)
|
---|
394 | save_IFS="$IFS"
|
---|
395 | IFS=${PATH_SEPARATOR-:}
|
---|
396 | for progdir in $PATH; do
|
---|
397 | IFS="$save_IFS"
|
---|
398 | test -x "$progdir/$progname" && break
|
---|
399 | done
|
---|
400 | IFS="$save_IFS"
|
---|
401 | test -n "$progdir" || progdir=`pwd`
|
---|
402 | progpath="$progdir/$progname"
|
---|
403 | ;;
|
---|
404 | esac
|
---|
405 |
|
---|
406 | # Sed substitution that helps us do robust quoting. It backslashifies
|
---|
407 | # metacharacters that are still active within double-quoted strings.
|
---|
408 | Xsed="${SED}"' -e 1s/^X//'
|
---|
409 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
|
---|
410 |
|
---|
411 | # Same as above, but do not quote variable references.
|
---|
412 | double_quote_subst='s/\(["`\\]\)/\\\1/g'
|
---|
413 |
|
---|
414 | # Sed substitution that turns a string into a regex matching for the
|
---|
415 | # string literally.
|
---|
416 | sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
|
---|
417 |
|
---|
418 | # Sed substitution that converts a w32 file name or path
|
---|
419 | # which contains forward slashes, into one that contains
|
---|
420 | # (escaped) backslashes. A very naive implementation.
|
---|
421 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
|
---|
422 |
|
---|
423 | # Re-`\' parameter expansions in output of double_quote_subst that were
|
---|
424 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
|
---|
425 | # in input to double_quote_subst, that '$' was protected from expansion.
|
---|
426 | # Since each input `\' is now two `\'s, look for any number of runs of
|
---|
427 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
|
---|
428 | bs='\\'
|
---|
429 | bs2='\\\\'
|
---|
430 | bs4='\\\\\\\\'
|
---|
431 | dollar='\$'
|
---|
432 | sed_double_backslash="\
|
---|
433 | s/$bs4/&\\
|
---|
434 | /g
|
---|
435 | s/^$bs2$dollar/$bs&/
|
---|
436 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
|
---|
437 | s/\n//g"
|
---|
438 |
|
---|
439 | # Standard options:
|
---|
440 | opt_dry_run=false
|
---|
441 | opt_help=false
|
---|
442 | opt_quiet=false
|
---|
443 | opt_verbose=false
|
---|
444 | opt_warning=:
|
---|
445 |
|
---|
446 | # func_echo arg...
|
---|
447 | # Echo program name prefixed message, along with the current mode
|
---|
448 | # name if it has been set yet.
|
---|
449 | func_echo ()
|
---|
450 | {
|
---|
451 | $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
|
---|
452 | }
|
---|
453 |
|
---|
454 | # func_verbose arg...
|
---|
455 | # Echo program name prefixed message in verbose mode only.
|
---|
456 | func_verbose ()
|
---|
457 | {
|
---|
458 | $opt_verbose && func_echo ${1+"$@"}
|
---|
459 |
|
---|
460 | # A bug in bash halts the script if the last line of a function
|
---|
461 | # fails when set -e is in force, so we need another command to
|
---|
462 | # work around that:
|
---|
463 | :
|
---|
464 | }
|
---|
465 |
|
---|
466 | # func_echo_all arg...
|
---|
467 | # Invoke $ECHO with all args, space-separated.
|
---|
468 | func_echo_all ()
|
---|
469 | {
|
---|
470 | $ECHO "$*"
|
---|
471 | }
|
---|
472 |
|
---|
473 | # func_error arg...
|
---|
474 | # Echo program name prefixed message to standard error.
|
---|
475 | func_error ()
|
---|
476 | {
|
---|
477 | $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
|
---|
478 | }
|
---|
479 |
|
---|
480 | # func_warning arg...
|
---|
481 | # Echo program name prefixed warning message to standard error.
|
---|
482 | func_warning ()
|
---|
483 | {
|
---|
484 | $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
|
---|
485 |
|
---|
486 | # bash bug again:
|
---|
487 | :
|
---|
488 | }
|
---|
489 |
|
---|
490 | # func_fatal_error arg...
|
---|
491 | # Echo program name prefixed message to standard error, and exit.
|
---|
492 | func_fatal_error ()
|
---|
493 | {
|
---|
494 | func_error ${1+"$@"}
|
---|
495 | exit $EXIT_FAILURE
|
---|
496 | }
|
---|
497 |
|
---|
498 | # func_fatal_help arg...
|
---|
499 | # Echo program name prefixed message to standard error, followed by
|
---|
500 | # a help hint, and exit.
|
---|
501 | func_fatal_help ()
|
---|
502 | {
|
---|
503 | func_error ${1+"$@"}
|
---|
504 | func_fatal_error "$help"
|
---|
505 | }
|
---|
506 | help="Try \`$progname --help' for more information." ## default
|
---|
507 |
|
---|
508 |
|
---|
509 | # func_grep expression filename
|
---|
510 | # Check whether EXPRESSION matches any line of FILENAME, without output.
|
---|
511 | func_grep ()
|
---|
512 | {
|
---|
513 | $GREP "$1" "$2" >/dev/null 2>&1
|
---|
514 | }
|
---|
515 |
|
---|
516 |
|
---|
517 | # func_mkdir_p directory-path
|
---|
518 | # Make sure the entire path to DIRECTORY-PATH is available.
|
---|
519 | func_mkdir_p ()
|
---|
520 | {
|
---|
521 | my_directory_path="$1"
|
---|
522 | my_dir_list=
|
---|
523 |
|
---|
524 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
|
---|
525 |
|
---|
526 | # Protect directory names starting with `-'
|
---|
527 | case $my_directory_path in
|
---|
528 | -*) my_directory_path="./$my_directory_path" ;;
|
---|
529 | esac
|
---|
530 |
|
---|
531 | # While some portion of DIR does not yet exist...
|
---|
532 | while test ! -d "$my_directory_path"; do
|
---|
533 | # ...make a list in topmost first order. Use a colon delimited
|
---|
534 | # list incase some portion of path contains whitespace.
|
---|
535 | my_dir_list="$my_directory_path:$my_dir_list"
|
---|
536 |
|
---|
537 | # If the last portion added has no slash in it, the list is done
|
---|
538 | case $my_directory_path in */*) ;; *) break ;; esac
|
---|
539 |
|
---|
540 | # ...otherwise throw away the child directory and loop
|
---|
541 | my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
|
---|
542 | done
|
---|
543 | my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
|
---|
544 |
|
---|
545 | save_mkdir_p_IFS="$IFS"; IFS=':'
|
---|
546 | for my_dir in $my_dir_list; do
|
---|
547 | IFS="$save_mkdir_p_IFS"
|
---|
548 | # mkdir can fail with a `File exist' error if two processes
|
---|
549 | # try to create one of the directories concurrently. Don't
|
---|
550 | # stop in that case!
|
---|
551 | $MKDIR "$my_dir" 2>/dev/null || :
|
---|
552 | done
|
---|
553 | IFS="$save_mkdir_p_IFS"
|
---|
554 |
|
---|
555 | # Bail out if we (or some other process) failed to create a directory.
|
---|
556 | test -d "$my_directory_path" || \
|
---|
557 | func_fatal_error "Failed to create \`$1'"
|
---|
558 | fi
|
---|
559 | }
|
---|
560 |
|
---|
561 |
|
---|
562 | # func_mktempdir [string]
|
---|
563 | # Make a temporary directory that won't clash with other running
|
---|
564 | # libtool processes, and avoids race conditions if possible. If
|
---|
565 | # given, STRING is the basename for that directory.
|
---|
566 | func_mktempdir ()
|
---|
567 | {
|
---|
568 | my_template="${TMPDIR-/tmp}/${1-$progname}"
|
---|
569 |
|
---|
570 | if test "$opt_dry_run" = ":"; then
|
---|
571 | # Return a directory name, but don't create it in dry-run mode
|
---|
572 | my_tmpdir="${my_template}-$$"
|
---|
573 | else
|
---|
574 |
|
---|
575 | # If mktemp works, use that first and foremost
|
---|
576 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
|
---|
577 |
|
---|
578 | if test ! -d "$my_tmpdir"; then
|
---|
579 | # Failing that, at least try and use $RANDOM to avoid a race
|
---|
580 | my_tmpdir="${my_template}-${RANDOM-0}$$"
|
---|
581 |
|
---|
582 | save_mktempdir_umask=`umask`
|
---|
583 | umask 0077
|
---|
584 | $MKDIR "$my_tmpdir"
|
---|
585 | umask $save_mktempdir_umask
|
---|
586 | fi
|
---|
587 |
|
---|
588 | # If we're not in dry-run mode, bomb out on failure
|
---|
589 | test -d "$my_tmpdir" || \
|
---|
590 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
|
---|
591 | fi
|
---|
592 |
|
---|
593 | $ECHO "$my_tmpdir"
|
---|
594 | }
|
---|
595 |
|
---|
596 |
|
---|
597 | # func_quote_for_eval arg
|
---|
598 | # Aesthetically quote ARG to be evaled later.
|
---|
599 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
|
---|
600 | # is double-quoted, suitable for a subsequent eval, whereas
|
---|
601 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
|
---|
602 | # which are still active within double quotes backslashified.
|
---|
603 | func_quote_for_eval ()
|
---|
604 | {
|
---|
605 | case $1 in
|
---|
606 | *[\\\`\"\$]*)
|
---|
607 | func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
|
---|
608 | *)
|
---|
609 | func_quote_for_eval_unquoted_result="$1" ;;
|
---|
610 | esac
|
---|
611 |
|
---|
612 | case $func_quote_for_eval_unquoted_result in
|
---|
613 | # Double-quote args containing shell metacharacters to delay
|
---|
614 | # word splitting, command substitution and and variable
|
---|
615 | # expansion for a subsequent eval.
|
---|
616 | # Many Bourne shells cannot handle close brackets correctly
|
---|
617 | # in scan sets, so we specify it separately.
|
---|
618 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
---|
619 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
|
---|
620 | ;;
|
---|
621 | *)
|
---|
622 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
|
---|
623 | esac
|
---|
624 | }
|
---|
625 |
|
---|
626 |
|
---|
627 | # func_quote_for_expand arg
|
---|
628 | # Aesthetically quote ARG to be evaled later; same as above,
|
---|
629 | # but do not quote variable references.
|
---|
630 | func_quote_for_expand ()
|
---|
631 | {
|
---|
632 | case $1 in
|
---|
633 | *[\\\`\"]*)
|
---|
634 | my_arg=`$ECHO "$1" | $SED \
|
---|
635 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
|
---|
636 | *)
|
---|
637 | my_arg="$1" ;;
|
---|
638 | esac
|
---|
639 |
|
---|
640 | case $my_arg in
|
---|
641 | # Double-quote args containing shell metacharacters to delay
|
---|
642 | # word splitting and command substitution for a subsequent eval.
|
---|
643 | # Many Bourne shells cannot handle close brackets correctly
|
---|
644 | # in scan sets, so we specify it separately.
|
---|
645 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
---|
646 | my_arg="\"$my_arg\""
|
---|
647 | ;;
|
---|
648 | esac
|
---|
649 |
|
---|
650 | func_quote_for_expand_result="$my_arg"
|
---|
651 | }
|
---|
652 |
|
---|
653 |
|
---|
654 | # func_show_eval cmd [fail_exp]
|
---|
655 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
|
---|
656 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
---|
657 | # is given, then evaluate it.
|
---|
658 | func_show_eval ()
|
---|
659 | {
|
---|
660 | my_cmd="$1"
|
---|
661 | my_fail_exp="${2-:}"
|
---|
662 |
|
---|
663 | ${opt_silent-false} || {
|
---|
664 | func_quote_for_expand "$my_cmd"
|
---|
665 | eval "func_echo $func_quote_for_expand_result"
|
---|
666 | }
|
---|
667 |
|
---|
668 | if ${opt_dry_run-false}; then :; else
|
---|
669 | eval "$my_cmd"
|
---|
670 | my_status=$?
|
---|
671 | if test "$my_status" -eq 0; then :; else
|
---|
672 | eval "(exit $my_status); $my_fail_exp"
|
---|
673 | fi
|
---|
674 | fi
|
---|
675 | }
|
---|
676 |
|
---|
677 |
|
---|
678 | # func_show_eval_locale cmd [fail_exp]
|
---|
679 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
|
---|
680 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
---|
681 | # is given, then evaluate it. Use the saved locale for evaluation.
|
---|
682 | func_show_eval_locale ()
|
---|
683 | {
|
---|
684 | my_cmd="$1"
|
---|
685 | my_fail_exp="${2-:}"
|
---|
686 |
|
---|
687 | ${opt_silent-false} || {
|
---|
688 | func_quote_for_expand "$my_cmd"
|
---|
689 | eval "func_echo $func_quote_for_expand_result"
|
---|
690 | }
|
---|
691 |
|
---|
692 | if ${opt_dry_run-false}; then :; else
|
---|
693 | eval "$lt_user_locale
|
---|
694 | $my_cmd"
|
---|
695 | my_status=$?
|
---|
696 | eval "$lt_safe_locale"
|
---|
697 | if test "$my_status" -eq 0; then :; else
|
---|
698 | eval "(exit $my_status); $my_fail_exp"
|
---|
699 | fi
|
---|
700 | fi
|
---|
701 | }
|
---|
702 |
|
---|
703 | # func_tr_sh
|
---|
704 | # Turn $1 into a string suitable for a shell variable name.
|
---|
705 | # Result is stored in $func_tr_sh_result. All characters
|
---|
706 | # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
|
---|
707 | # if $1 begins with a digit, a '_' is prepended as well.
|
---|
708 | func_tr_sh ()
|
---|
709 | {
|
---|
710 | case $1 in
|
---|
711 | [0-9]* | *[!a-zA-Z0-9_]*)
|
---|
712 | func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
|
---|
713 | ;;
|
---|
714 | * )
|
---|
715 | func_tr_sh_result=$1
|
---|
716 | ;;
|
---|
717 | esac
|
---|
718 | }
|
---|
719 |
|
---|
720 |
|
---|
721 | # func_version
|
---|
722 | # Echo version message to standard output and exit.
|
---|
723 | func_version ()
|
---|
724 | {
|
---|
725 | $opt_debug
|
---|
726 |
|
---|
727 | $SED -n '/(C)/!b go
|
---|
728 | :more
|
---|
729 | /\./!{
|
---|
730 | N
|
---|
731 | s/\n# / /
|
---|
732 | b more
|
---|
733 | }
|
---|
734 | :go
|
---|
735 | /^# '$PROGRAM' (GNU /,/# warranty; / {
|
---|
736 | s/^# //
|
---|
737 | s/^# *$//
|
---|
738 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
|
---|
739 | p
|
---|
740 | }' < "$progpath"
|
---|
741 | exit $?
|
---|
742 | }
|
---|
743 |
|
---|
744 | # func_usage
|
---|
745 | # Echo short help message to standard output and exit.
|
---|
746 | func_usage ()
|
---|
747 | {
|
---|
748 | $opt_debug
|
---|
749 |
|
---|
750 | $SED -n '/^# Usage:/,/^# *.*--help/ {
|
---|
751 | s/^# //
|
---|
752 | s/^# *$//
|
---|
753 | s/\$progname/'$progname'/
|
---|
754 | p
|
---|
755 | }' < "$progpath"
|
---|
756 | echo
|
---|
757 | $ECHO "run \`$progname --help | more' for full usage"
|
---|
758 | exit $?
|
---|
759 | }
|
---|
760 |
|
---|
761 | # func_help [NOEXIT]
|
---|
762 | # Echo long help message to standard output and exit,
|
---|
763 | # unless 'noexit' is passed as argument.
|
---|
764 | func_help ()
|
---|
765 | {
|
---|
766 | $opt_debug
|
---|
767 |
|
---|
768 | $SED -n '/^# Usage:/,/# Report bugs to/ {
|
---|
769 | :print
|
---|
770 | s/^# //
|
---|
771 | s/^# *$//
|
---|
772 | s*\$progname*'$progname'*
|
---|
773 | s*\$host*'"$host"'*
|
---|
774 | s*\$SHELL*'"$SHELL"'*
|
---|
775 | s*\$LTCC*'"$LTCC"'*
|
---|
776 | s*\$LTCFLAGS*'"$LTCFLAGS"'*
|
---|
777 | s*\$LD*'"$LD"'*
|
---|
778 | s/\$with_gnu_ld/'"$with_gnu_ld"'/
|
---|
779 | s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
|
---|
780 | s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
|
---|
781 | p
|
---|
782 | d
|
---|
783 | }
|
---|
784 | /^# .* home page:/b print
|
---|
785 | /^# General help using/b print
|
---|
786 | ' < "$progpath"
|
---|
787 | ret=$?
|
---|
788 | if test -z "$1"; then
|
---|
789 | exit $ret
|
---|
790 | fi
|
---|
791 | }
|
---|
792 |
|
---|
793 | # func_missing_arg argname
|
---|
794 | # Echo program name prefixed message to standard error and set global
|
---|
795 | # exit_cmd.
|
---|
796 | func_missing_arg ()
|
---|
797 | {
|
---|
798 | $opt_debug
|
---|
799 |
|
---|
800 | func_error "missing argument for $1."
|
---|
801 | exit_cmd=exit
|
---|
802 | }
|
---|
803 |
|
---|
804 |
|
---|
805 | # func_split_short_opt shortopt
|
---|
806 | # Set func_split_short_opt_name and func_split_short_opt_arg shell
|
---|
807 | # variables after splitting SHORTOPT after the 2nd character.
|
---|
808 | func_split_short_opt ()
|
---|
809 | {
|
---|
810 | my_sed_short_opt='1s/^\(..\).*$/\1/;q'
|
---|
811 | my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
|
---|
812 |
|
---|
813 | func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
|
---|
814 | func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
|
---|
815 | } # func_split_short_opt may be replaced by extended shell implementation
|
---|
816 |
|
---|
817 |
|
---|
818 | # func_split_long_opt longopt
|
---|
819 | # Set func_split_long_opt_name and func_split_long_opt_arg shell
|
---|
820 | # variables after splitting LONGOPT at the `=' sign.
|
---|
821 | func_split_long_opt ()
|
---|
822 | {
|
---|
823 | my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
|
---|
824 | my_sed_long_arg='1s/^--[^=]*=//'
|
---|
825 |
|
---|
826 | func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
|
---|
827 | func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
|
---|
828 | } # func_split_long_opt may be replaced by extended shell implementation
|
---|
829 |
|
---|
830 | exit_cmd=:
|
---|
831 |
|
---|
832 |
|
---|
833 |
|
---|
834 |
|
---|
835 |
|
---|
836 | magic="%%%MAGIC variable%%%"
|
---|
837 | magic_exe="%%%MAGIC EXE variable%%%"
|
---|
838 |
|
---|
839 | # Global variables.
|
---|
840 | nonopt=
|
---|
841 | preserve_args=
|
---|
842 | lo2o="s/\\.lo\$/.${objext}/"
|
---|
843 | o2lo="s/\\.${objext}\$/.lo/"
|
---|
844 | extracted_archives=
|
---|
845 | extracted_serial=0
|
---|
846 |
|
---|
847 | # If this variable is set in any of the actions, the command in it
|
---|
848 | # will be execed at the end. This prevents here-documents from being
|
---|
849 | # left over by shells.
|
---|
850 | exec_cmd=
|
---|
851 |
|
---|
852 | # func_append var value
|
---|
853 | # Append VALUE to the end of shell variable VAR.
|
---|
854 | func_append ()
|
---|
855 | {
|
---|
856 | eval "${1}=\$${1}\${2}"
|
---|
857 | } # func_append may be replaced by extended shell implementation
|
---|
858 |
|
---|
859 | # func_append_quoted var value
|
---|
860 | # Quote VALUE and append to the end of shell variable VAR, separated
|
---|
861 | # by a space.
|
---|
862 | func_append_quoted ()
|
---|
863 | {
|
---|
864 | func_quote_for_eval "${2}"
|
---|
865 | eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
|
---|
866 | } # func_append_quoted may be replaced by extended shell implementation
|
---|
867 |
|
---|
868 |
|
---|
869 | # func_arith arithmetic-term...
|
---|
870 | func_arith ()
|
---|
871 | {
|
---|
872 | func_arith_result=`expr "${@}"`
|
---|
873 | } # func_arith may be replaced by extended shell implementation
|
---|
874 |
|
---|
875 |
|
---|
876 | # func_len string
|
---|
877 | # STRING may not start with a hyphen.
|
---|
878 | func_len ()
|
---|
879 | {
|
---|
880 | func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
|
---|
881 | } # func_len may be replaced by extended shell implementation
|
---|
882 |
|
---|
883 |
|
---|
884 | # func_lo2o object
|
---|
885 | func_lo2o ()
|
---|
886 | {
|
---|
887 | func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
|
---|
888 | } # func_lo2o may be replaced by extended shell implementation
|
---|
889 |
|
---|
890 |
|
---|
891 | # func_xform libobj-or-source
|
---|
892 | func_xform ()
|
---|
893 | {
|
---|
894 | func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
|
---|
895 | } # func_xform may be replaced by extended shell implementation
|
---|
896 |
|
---|
897 |
|
---|
898 | # func_fatal_configuration arg...
|
---|
899 | # Echo program name prefixed message to standard error, followed by
|
---|
900 | # a configuration failure hint, and exit.
|
---|
901 | func_fatal_configuration ()
|
---|
902 | {
|
---|
903 | func_error ${1+"$@"}
|
---|
904 | func_error "See the $PACKAGE documentation for more information."
|
---|
905 | func_fatal_error "Fatal configuration error."
|
---|
906 | }
|
---|
907 |
|
---|
908 |
|
---|
909 | # func_config
|
---|
910 | # Display the configuration for all the tags in this script.
|
---|
911 | func_config ()
|
---|
912 | {
|
---|
913 | re_begincf='^# ### BEGIN LIBTOOL'
|
---|
914 | re_endcf='^# ### END LIBTOOL'
|
---|
915 |
|
---|
916 | # Default configuration.
|
---|
917 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
|
---|
918 |
|
---|
919 | # Now print the configurations for the tags.
|
---|
920 | for tagname in $taglist; do
|
---|
921 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
|
---|
922 | done
|
---|
923 |
|
---|
924 | exit $?
|
---|
925 | }
|
---|
926 |
|
---|
927 | # func_features
|
---|
928 | # Display the features supported by this script.
|
---|
929 | func_features ()
|
---|
930 | {
|
---|
931 | echo "host: $host"
|
---|
932 | if test "$build_libtool_libs" = yes; then
|
---|
933 | echo "enable shared libraries"
|
---|
934 | else
|
---|
935 | echo "disable shared libraries"
|
---|
936 | fi
|
---|
937 | if test "$build_old_libs" = yes; then
|
---|
938 | echo "enable static libraries"
|
---|
939 | else
|
---|
940 | echo "disable static libraries"
|
---|
941 | fi
|
---|
942 |
|
---|
943 | exit $?
|
---|
944 | }
|
---|
945 |
|
---|
946 | # func_enable_tag tagname
|
---|
947 | # Verify that TAGNAME is valid, and either flag an error and exit, or
|
---|
948 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
|
---|
949 | # variable here.
|
---|
950 | func_enable_tag ()
|
---|
951 | {
|
---|
952 | # Global variable:
|
---|
953 | tagname="$1"
|
---|
954 |
|
---|
955 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
|
---|
956 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
|
---|
957 | sed_extractcf="/$re_begincf/,/$re_endcf/p"
|
---|
958 |
|
---|
959 | # Validate tagname.
|
---|
960 | case $tagname in
|
---|
961 | *[!-_A-Za-z0-9,/]*)
|
---|
962 | func_fatal_error "invalid tag name: $tagname"
|
---|
963 | ;;
|
---|
964 | esac
|
---|
965 |
|
---|
966 | # Don't test for the "default" C tag, as we know it's
|
---|
967 | # there but not specially marked.
|
---|
968 | case $tagname in
|
---|
969 | CC) ;;
|
---|
970 | *)
|
---|
971 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
|
---|
972 | taglist="$taglist $tagname"
|
---|
973 |
|
---|
974 | # Evaluate the configuration. Be careful to quote the path
|
---|
975 | # and the sed script, to avoid splitting on whitespace, but
|
---|
976 | # also don't use non-portable quotes within backquotes within
|
---|
977 | # quotes we have to do it in 2 steps:
|
---|
978 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
|
---|
979 | eval "$extractedcf"
|
---|
980 | else
|
---|
981 | func_error "ignoring unknown tag $tagname"
|
---|
982 | fi
|
---|
983 | ;;
|
---|
984 | esac
|
---|
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 | # Shorthand for --mode=foo, only valid as the first argument
|
---|
1024 | case $1 in
|
---|
1025 | clean|clea|cle|cl)
|
---|
1026 | shift; set dummy --mode clean ${1+"$@"}; shift
|
---|
1027 | ;;
|
---|
1028 | compile|compil|compi|comp|com|co|c)
|
---|
1029 | shift; set dummy --mode compile ${1+"$@"}; shift
|
---|
1030 | ;;
|
---|
1031 | execute|execut|execu|exec|exe|ex|e)
|
---|
1032 | shift; set dummy --mode execute ${1+"$@"}; shift
|
---|
1033 | ;;
|
---|
1034 | finish|finis|fini|fin|fi|f)
|
---|
1035 | shift; set dummy --mode finish ${1+"$@"}; shift
|
---|
1036 | ;;
|
---|
1037 | install|instal|insta|inst|ins|in|i)
|
---|
1038 | shift; set dummy --mode install ${1+"$@"}; shift
|
---|
1039 | ;;
|
---|
1040 | link|lin|li|l)
|
---|
1041 | shift; set dummy --mode link ${1+"$@"}; shift
|
---|
1042 | ;;
|
---|
1043 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
|
---|
1044 | shift; set dummy --mode uninstall ${1+"$@"}; shift
|
---|
1045 | ;;
|
---|
1046 | esac
|
---|
1047 |
|
---|
1048 |
|
---|
1049 |
|
---|
1050 | # Option defaults:
|
---|
1051 | opt_debug=:
|
---|
1052 | opt_dry_run=false
|
---|
1053 | opt_config=false
|
---|
1054 | opt_preserve_dup_deps=false
|
---|
1055 | opt_features=false
|
---|
1056 | opt_finish=false
|
---|
1057 | opt_help=false
|
---|
1058 | opt_help_all=false
|
---|
1059 | opt_silent=:
|
---|
1060 | opt_warning=:
|
---|
1061 | opt_verbose=:
|
---|
1062 | opt_silent=false
|
---|
1063 | opt_verbose=false
|
---|
1064 |
|
---|
1065 |
|
---|
1066 | # Parse options once, thoroughly. This comes as soon as possible in the
|
---|
1067 | # script to make things like `--version' happen as quickly as we can.
|
---|
1068 | {
|
---|
1069 | # this just eases exit handling
|
---|
1070 | while test $# -gt 0; do
|
---|
1071 | opt="$1"
|
---|
1072 | shift
|
---|
1073 | case $opt in
|
---|
1074 | --debug|-x) opt_debug='set -x'
|
---|
1075 | func_echo "enabling shell trace mode"
|
---|
1076 | $opt_debug
|
---|
1077 | ;;
|
---|
1078 | --dry-run|--dryrun|-n)
|
---|
1079 | opt_dry_run=:
|
---|
1080 | ;;
|
---|
1081 | --config)
|
---|
1082 | opt_config=:
|
---|
1083 | func_config
|
---|
1084 | ;;
|
---|
1085 | --dlopen|-dlopen)
|
---|
1086 | optarg="$1"
|
---|
1087 | opt_dlopen="${opt_dlopen+$opt_dlopen
|
---|
1088 | }$optarg"
|
---|
1089 | shift
|
---|
1090 | ;;
|
---|
1091 | --preserve-dup-deps)
|
---|
1092 | opt_preserve_dup_deps=:
|
---|
1093 | ;;
|
---|
1094 | --features)
|
---|
1095 | opt_features=:
|
---|
1096 | func_features
|
---|
1097 | ;;
|
---|
1098 | --finish)
|
---|
1099 | opt_finish=:
|
---|
1100 | set dummy --mode finish ${1+"$@"}; shift
|
---|
1101 | ;;
|
---|
1102 | --help)
|
---|
1103 | opt_help=:
|
---|
1104 | ;;
|
---|
1105 | --help-all)
|
---|
1106 | opt_help_all=:
|
---|
1107 | opt_help=': help-all'
|
---|
1108 | ;;
|
---|
1109 | --mode)
|
---|
1110 | test $# = 0 && func_missing_arg $opt && break
|
---|
1111 | optarg="$1"
|
---|
1112 | opt_mode="$optarg"
|
---|
1113 | case $optarg in
|
---|
1114 | # Valid mode arguments:
|
---|
1115 | clean|compile|execute|finish|install|link|relink|uninstall) ;;
|
---|
1116 |
|
---|
1117 | # Catch anything else as an error
|
---|
1118 | *) func_error "invalid argument for $opt"
|
---|
1119 | exit_cmd=exit
|
---|
1120 | break
|
---|
1121 | ;;
|
---|
1122 | esac
|
---|
1123 | shift
|
---|
1124 | ;;
|
---|
1125 | --no-silent|--no-quiet)
|
---|
1126 | opt_silent=false
|
---|
1127 | func_append preserve_args " $opt"
|
---|
1128 | ;;
|
---|
1129 | --no-warning|--no-warn)
|
---|
1130 | opt_warning=false
|
---|
1131 | func_append preserve_args " $opt"
|
---|
1132 | ;;
|
---|
1133 | --no-verbose)
|
---|
1134 | opt_verbose=false
|
---|
1135 | func_append preserve_args " $opt"
|
---|
1136 | ;;
|
---|
1137 | --silent|--quiet)
|
---|
1138 | opt_silent=:
|
---|
1139 | func_append preserve_args " $opt"
|
---|
1140 | opt_verbose=false
|
---|
1141 | ;;
|
---|
1142 | --verbose|-v)
|
---|
1143 | opt_verbose=:
|
---|
1144 | func_append preserve_args " $opt"
|
---|
1145 | opt_silent=false
|
---|
1146 | ;;
|
---|
1147 | --tag)
|
---|
1148 | test $# = 0 && func_missing_arg $opt && break
|
---|
1149 | optarg="$1"
|
---|
1150 | opt_tag="$optarg"
|
---|
1151 | func_append preserve_args " $opt $optarg"
|
---|
1152 | func_enable_tag "$optarg"
|
---|
1153 | shift
|
---|
1154 | ;;
|
---|
1155 |
|
---|
1156 | -\?|-h) func_usage ;;
|
---|
1157 | --help) func_help ;;
|
---|
1158 | --version) func_version ;;
|
---|
1159 |
|
---|
1160 | # Separate optargs to long options:
|
---|
1161 | --*=*)
|
---|
1162 | func_split_long_opt "$opt"
|
---|
1163 | set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
|
---|
1164 | shift
|
---|
1165 | ;;
|
---|
1166 |
|
---|
1167 | # Separate non-argument short options:
|
---|
1168 | -\?*|-h*|-n*|-v*)
|
---|
1169 | func_split_short_opt "$opt"
|
---|
1170 | set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
|
---|
1171 | shift
|
---|
1172 | ;;
|
---|
1173 |
|
---|
1174 | --) break ;;
|
---|
1175 | -*) func_fatal_help "unrecognized option \`$opt'" ;;
|
---|
1176 | *) set dummy "$opt" ${1+"$@"}; shift; break ;;
|
---|
1177 | esac
|
---|
1178 | done
|
---|
1179 |
|
---|
1180 | # Validate options:
|
---|
1181 |
|
---|
1182 | # save first non-option argument
|
---|
1183 | if test "$#" -gt 0; then
|
---|
1184 | nonopt="$opt"
|
---|
1185 | shift
|
---|
1186 | fi
|
---|
1187 |
|
---|
1188 | # preserve --debug
|
---|
1189 | test "$opt_debug" = : || func_append preserve_args " --debug"
|
---|
1190 |
|
---|
1191 | case $host in
|
---|
1192 | *cygwin* | *mingw* | *pw32* | *cegcc*)
|
---|
1193 | # don't eliminate duplications in $postdeps and $predeps
|
---|
1194 | opt_duplicate_compiler_generated_deps=:
|
---|
1195 | ;;
|
---|
1196 | *)
|
---|
1197 | opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
|
---|
1198 | ;;
|
---|
1199 | esac
|
---|
1200 |
|
---|
1201 | $opt_help || {
|
---|
1202 | # Sanity checks first:
|
---|
1203 | func_check_version_match
|
---|
1204 |
|
---|
1205 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
|
---|
1206 | func_fatal_configuration "not configured to build any kind of library"
|
---|
1207 | fi
|
---|
1208 |
|
---|
1209 | # Darwin sucks
|
---|
1210 | eval std_shrext=\"$shrext_cmds\"
|
---|
1211 |
|
---|
1212 | # Only execute mode is allowed to have -dlopen flags.
|
---|
1213 | if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
|
---|
1214 | func_error "unrecognized option \`-dlopen'"
|
---|
1215 | $ECHO "$help" 1>&2
|
---|
1216 | exit $EXIT_FAILURE
|
---|
1217 | fi
|
---|
1218 |
|
---|
1219 | # Change the help message to a mode-specific one.
|
---|
1220 | generic_help="$help"
|
---|
1221 | help="Try \`$progname --help --mode=$opt_mode' for more information."
|
---|
1222 | }
|
---|
1223 |
|
---|
1224 |
|
---|
1225 | # Bail if the options were screwed
|
---|
1226 | $exit_cmd $EXIT_FAILURE
|
---|
1227 | }
|
---|
1228 |
|
---|
1229 |
|
---|
1230 |
|
---|
1231 |
|
---|
1232 | ## ----------- ##
|
---|
1233 | ## Main. ##
|
---|
1234 | ## ----------- ##
|
---|
1235 |
|
---|
1236 | # func_lalib_p file
|
---|
1237 | # True iff FILE is a libtool `.la' library or `.lo' object file.
|
---|
1238 | # This function is only a basic sanity check; it will hardly flush out
|
---|
1239 | # determined imposters.
|
---|
1240 | func_lalib_p ()
|
---|
1241 | {
|
---|
1242 | test -f "$1" &&
|
---|
1243 | $SED -e 4q "$1" 2>/dev/null \
|
---|
1244 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
|
---|
1245 | }
|
---|
1246 |
|
---|
1247 | # func_lalib_unsafe_p file
|
---|
1248 | # True iff FILE is a libtool `.la' library or `.lo' object file.
|
---|
1249 | # This function implements the same check as func_lalib_p without
|
---|
1250 | # resorting to external programs. To this end, it redirects stdin and
|
---|
1251 | # closes it afterwards, without saving the original file descriptor.
|
---|
1252 | # As a safety measure, use it only where a negative result would be
|
---|
1253 | # fatal anyway. Works if `file' does not exist.
|
---|
1254 | func_lalib_unsafe_p ()
|
---|
1255 | {
|
---|
1256 | lalib_p=no
|
---|
1257 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
|
---|
1258 | for lalib_p_l in 1 2 3 4
|
---|
1259 | do
|
---|
1260 | read lalib_p_line
|
---|
1261 | case "$lalib_p_line" in
|
---|
1262 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
|
---|
1263 | esac
|
---|
1264 | done
|
---|
1265 | exec 0<&5 5<&-
|
---|
1266 | fi
|
---|
1267 | test "$lalib_p" = yes
|
---|
1268 | }
|
---|
1269 |
|
---|
1270 | # func_ltwrapper_script_p file
|
---|
1271 | # True iff FILE is a libtool wrapper script
|
---|
1272 | # This function is only a basic sanity check; it will hardly flush out
|
---|
1273 | # determined imposters.
|
---|
1274 | func_ltwrapper_script_p ()
|
---|
1275 | {
|
---|
1276 | func_lalib_p "$1"
|
---|
1277 | }
|
---|
1278 |
|
---|
1279 | # func_ltwrapper_executable_p file
|
---|
1280 | # True iff FILE is a libtool wrapper executable
|
---|
1281 | # This function is only a basic sanity check; it will hardly flush out
|
---|
1282 | # determined imposters.
|
---|
1283 | func_ltwrapper_executable_p ()
|
---|
1284 | {
|
---|
1285 | func_ltwrapper_exec_suffix=
|
---|
1286 | case $1 in
|
---|
1287 | *.exe) ;;
|
---|
1288 | *) func_ltwrapper_exec_suffix=.exe ;;
|
---|
1289 | esac
|
---|
1290 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
|
---|
1291 | }
|
---|
1292 |
|
---|
1293 | # func_ltwrapper_scriptname file
|
---|
1294 | # Assumes file is an ltwrapper_executable
|
---|
1295 | # uses $file to determine the appropriate filename for a
|
---|
1296 | # temporary ltwrapper_script.
|
---|
1297 | func_ltwrapper_scriptname ()
|
---|
1298 | {
|
---|
1299 | func_dirname_and_basename "$1" "" "."
|
---|
1300 | func_stripname '' '.exe' "$func_basename_result"
|
---|
1301 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | # func_ltwrapper_p file
|
---|
1305 | # True iff FILE is a libtool wrapper script or wrapper executable
|
---|
1306 | # This function is only a basic sanity check; it will hardly flush out
|
---|
1307 | # determined imposters.
|
---|
1308 | func_ltwrapper_p ()
|
---|
1309 | {
|
---|
1310 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
|
---|
1311 | }
|
---|
1312 |
|
---|
1313 |
|
---|
1314 | # func_execute_cmds commands fail_cmd
|
---|
1315 | # Execute tilde-delimited COMMANDS.
|
---|
1316 | # If FAIL_CMD is given, eval that upon failure.
|
---|
1317 | # FAIL_CMD may read-access the current command in variable CMD!
|
---|
1318 | func_execute_cmds ()
|
---|
1319 | {
|
---|
1320 | $opt_debug
|
---|
1321 | save_ifs=$IFS; IFS='~'
|
---|
1322 | for cmd in $1; do
|
---|
1323 | IFS=$save_ifs
|
---|
1324 | eval cmd=\"$cmd\"
|
---|
1325 | func_show_eval "$cmd" "${2-:}"
|
---|
1326 | done
|
---|
1327 | IFS=$save_ifs
|
---|
1328 | }
|
---|
1329 |
|
---|
1330 |
|
---|
1331 | # func_source file
|
---|
1332 | # Source FILE, adding directory component if necessary.
|
---|
1333 | # Note that it is not necessary on cygwin/mingw to append a dot to
|
---|
1334 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
|
---|
1335 | # behavior happens only for exec(3), not for open(2)! Also, sourcing
|
---|
1336 | # `FILE.' does not work on cygwin managed mounts.
|
---|
1337 | func_source ()
|
---|
1338 | {
|
---|
1339 | $opt_debug
|
---|
1340 | case $1 in
|
---|
1341 | */* | *\\*) . "$1" ;;
|
---|
1342 | *) . "./$1" ;;
|
---|
1343 | esac
|
---|
1344 | }
|
---|
1345 |
|
---|
1346 |
|
---|
1347 | # func_resolve_sysroot PATH
|
---|
1348 | # Replace a leading = in PATH with a sysroot. Store the result into
|
---|
1349 | # func_resolve_sysroot_result
|
---|
1350 | func_resolve_sysroot ()
|
---|
1351 | {
|
---|
1352 | func_resolve_sysroot_result=$1
|
---|
1353 | case $func_resolve_sysroot_result in
|
---|
1354 | =*)
|
---|
1355 | func_stripname '=' '' "$func_resolve_sysroot_result"
|
---|
1356 | func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
|
---|
1357 | ;;
|
---|
1358 | esac
|
---|
1359 | }
|
---|
1360 |
|
---|
1361 | # func_replace_sysroot PATH
|
---|
1362 | # If PATH begins with the sysroot, replace it with = and
|
---|
1363 | # store the result into func_replace_sysroot_result.
|
---|
1364 | func_replace_sysroot ()
|
---|
1365 | {
|
---|
1366 | case "$lt_sysroot:$1" in
|
---|
1367 | ?*:"$lt_sysroot"*)
|
---|
1368 | func_stripname "$lt_sysroot" '' "$1"
|
---|
1369 | func_replace_sysroot_result="=$func_stripname_result"
|
---|
1370 | ;;
|
---|
1371 | *)
|
---|
1372 | # Including no sysroot.
|
---|
1373 | func_replace_sysroot_result=$1
|
---|
1374 | ;;
|
---|
1375 | esac
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | # func_infer_tag arg
|
---|
1379 | # Infer tagged configuration to use if any are available and
|
---|
1380 | # if one wasn't chosen via the "--tag" command line option.
|
---|
1381 | # Only attempt this if the compiler in the base compile
|
---|
1382 | # command doesn't match the default compiler.
|
---|
1383 | # arg is usually of the form 'gcc ...'
|
---|
1384 | func_infer_tag ()
|
---|
1385 | {
|
---|
1386 | $opt_debug
|
---|
1387 | if test -n "$available_tags" && test -z "$tagname"; then
|
---|
1388 | CC_quoted=
|
---|
1389 | for arg in $CC; do
|
---|
1390 | func_append_quoted CC_quoted "$arg"
|
---|
1391 | done
|
---|
1392 | CC_expanded=`func_echo_all $CC`
|
---|
1393 | CC_quoted_expanded=`func_echo_all $CC_quoted`
|
---|
1394 | case $@ in
|
---|
1395 | # Blanks in the command may have been stripped by the calling shell,
|
---|
1396 | # but not from the CC environment variable when configure was run.
|
---|
1397 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
|
---|
1398 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
|
---|
1399 | # Blanks at the start of $base_compile will cause this to fail
|
---|
1400 | # if we don't check for them as well.
|
---|
1401 | *)
|
---|
1402 | for z in $available_tags; do
|
---|
1403 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
|
---|
1404 | # Evaluate the configuration.
|
---|
1405 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
|
---|
1406 | CC_quoted=
|
---|
1407 | for arg in $CC; do
|
---|
1408 | # Double-quote args containing other shell metacharacters.
|
---|
1409 | func_append_quoted CC_quoted "$arg"
|
---|
1410 | done
|
---|
1411 | CC_expanded=`func_echo_all $CC`
|
---|
1412 | CC_quoted_expanded=`func_echo_all $CC_quoted`
|
---|
1413 | case "$@ " in
|
---|
1414 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
|
---|
1415 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
|
---|
1416 | # The compiler in the base compile command matches
|
---|
1417 | # the one in the tagged configuration.
|
---|
1418 | # Assume this is the tagged configuration we want.
|
---|
1419 | tagname=$z
|
---|
1420 | break
|
---|
1421 | ;;
|
---|
1422 | esac
|
---|
1423 | fi
|
---|
1424 | done
|
---|
1425 | # If $tagname still isn't set, then no tagged configuration
|
---|
1426 | # was found and let the user know that the "--tag" command
|
---|
1427 | # line option must be used.
|
---|
1428 | if test -z "$tagname"; then
|
---|
1429 | func_echo "unable to infer tagged configuration"
|
---|
1430 | func_fatal_error "specify a tag with \`--tag'"
|
---|
1431 | # else
|
---|
1432 | # func_verbose "using $tagname tagged configuration"
|
---|
1433 | fi
|
---|
1434 | ;;
|
---|
1435 | esac
|
---|
1436 | fi
|
---|
1437 | }
|
---|
1438 |
|
---|
1439 |
|
---|
1440 |
|
---|
1441 | # func_write_libtool_object output_name pic_name nonpic_name
|
---|
1442 | # Create a libtool object file (analogous to a ".la" file),
|
---|
1443 | # but don't create it if we're doing a dry run.
|
---|
1444 | func_write_libtool_object ()
|
---|
1445 | {
|
---|
1446 | write_libobj=${1}
|
---|
1447 | if test "$build_libtool_libs" = yes; then
|
---|
1448 | write_lobj=\'${2}\'
|
---|
1449 | else
|
---|
1450 | write_lobj=none
|
---|
1451 | fi
|
---|
1452 |
|
---|
1453 | if test "$build_old_libs" = yes; then
|
---|
1454 | write_oldobj=\'${3}\'
|
---|
1455 | else
|
---|
1456 | write_oldobj=none
|
---|
1457 | fi
|
---|
1458 |
|
---|
1459 | $opt_dry_run || {
|
---|
1460 | cat >${write_libobj}T <<EOF
|
---|
1461 | # $write_libobj - a libtool object file
|
---|
1462 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
---|
1463 | #
|
---|
1464 | # Please DO NOT delete this file!
|
---|
1465 | # It is necessary for linking the library.
|
---|
1466 |
|
---|
1467 | # Name of the PIC object.
|
---|
1468 | pic_object=$write_lobj
|
---|
1469 |
|
---|
1470 | # Name of the non-PIC object
|
---|
1471 | non_pic_object=$write_oldobj
|
---|
1472 |
|
---|
1473 | EOF
|
---|
1474 | $MV "${write_libobj}T" "${write_libobj}"
|
---|
1475 | }
|
---|
1476 | }
|
---|
1477 |
|
---|
1478 |
|
---|
1479 | ##################################################
|
---|
1480 | # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
|
---|
1481 | ##################################################
|
---|
1482 |
|
---|
1483 | # func_convert_core_file_wine_to_w32 ARG
|
---|
1484 | # Helper function used by file name conversion functions when $build is *nix,
|
---|
1485 | # and $host is mingw, cygwin, or some other w32 environment. Relies on a
|
---|
1486 | # correctly configured wine environment available, with the winepath program
|
---|
1487 | # in $build's $PATH.
|
---|
1488 | #
|
---|
1489 | # ARG is the $build file name to be converted to w32 format.
|
---|
1490 | # Result is available in $func_convert_core_file_wine_to_w32_result, and will
|
---|
1491 | # be empty on error (or when ARG is empty)
|
---|
1492 | func_convert_core_file_wine_to_w32 ()
|
---|
1493 | {
|
---|
1494 | $opt_debug
|
---|
1495 | func_convert_core_file_wine_to_w32_result="$1"
|
---|
1496 | if test -n "$1"; then
|
---|
1497 | # Unfortunately, winepath does not exit with a non-zero error code, so we
|
---|
1498 | # are forced to check the contents of stdout. On the other hand, if the
|
---|
1499 | # command is not found, the shell will set an exit code of 127 and print
|
---|
1500 | # *an error message* to stdout. So we must check for both error code of
|
---|
1501 | # zero AND non-empty stdout, which explains the odd construction:
|
---|
1502 | func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
|
---|
1503 | if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
|
---|
1504 | func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
|
---|
1505 | $SED -e "$lt_sed_naive_backslashify"`
|
---|
1506 | else
|
---|
1507 | func_convert_core_file_wine_to_w32_result=
|
---|
1508 | fi
|
---|
1509 | fi
|
---|
1510 | }
|
---|
1511 | # end: func_convert_core_file_wine_to_w32
|
---|
1512 |
|
---|
1513 |
|
---|
1514 | # func_convert_core_path_wine_to_w32 ARG
|
---|
1515 | # Helper function used by path conversion functions when $build is *nix, and
|
---|
1516 | # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
|
---|
1517 | # configured wine environment available, with the winepath program in $build's
|
---|
1518 | # $PATH. Assumes ARG has no leading or trailing path separator characters.
|
---|
1519 | #
|
---|
1520 | # ARG is path to be converted from $build format to win32.
|
---|
1521 | # Result is available in $func_convert_core_path_wine_to_w32_result.
|
---|
1522 | # Unconvertible file (directory) names in ARG are skipped; if no directory names
|
---|
1523 | # are convertible, then the result may be empty.
|
---|
1524 | func_convert_core_path_wine_to_w32 ()
|
---|
1525 | {
|
---|
1526 | $opt_debug
|
---|
1527 | # unfortunately, winepath doesn't convert paths, only file names
|
---|
1528 | func_convert_core_path_wine_to_w32_result=""
|
---|
1529 | if test -n "$1"; then
|
---|
1530 | oldIFS=$IFS
|
---|
1531 | IFS=:
|
---|
1532 | for func_convert_core_path_wine_to_w32_f in $1; do
|
---|
1533 | IFS=$oldIFS
|
---|
1534 | func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
|
---|
1535 | if test -n "$func_convert_core_file_wine_to_w32_result" ; then
|
---|
1536 | if test -z "$func_convert_core_path_wine_to_w32_result"; then
|
---|
1537 | func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
|
---|
1538 | else
|
---|
1539 | func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
|
---|
1540 | fi
|
---|
1541 | fi
|
---|
1542 | done
|
---|
1543 | IFS=$oldIFS
|
---|
1544 | fi
|
---|
1545 | }
|
---|
1546 | # end: func_convert_core_path_wine_to_w32
|
---|
1547 |
|
---|
1548 |
|
---|
1549 | # func_cygpath ARGS...
|
---|
1550 | # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
|
---|
1551 | # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
|
---|
1552 | # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
|
---|
1553 | # (2), returns the Cygwin file name or path in func_cygpath_result (input
|
---|
1554 | # file name or path is assumed to be in w32 format, as previously converted
|
---|
1555 | # from $build's *nix or MSYS format). In case (3), returns the w32 file name
|
---|
1556 | # or path in func_cygpath_result (input file name or path is assumed to be in
|
---|
1557 | # Cygwin format). Returns an empty string on error.
|
---|
1558 | #
|
---|
1559 | # ARGS are passed to cygpath, with the last one being the file name or path to
|
---|
1560 | # be converted.
|
---|
1561 | #
|
---|
1562 | # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
|
---|
1563 | # environment variable; do not put it in $PATH.
|
---|
1564 | func_cygpath ()
|
---|
1565 | {
|
---|
1566 | $opt_debug
|
---|
1567 | if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
|
---|
1568 | func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
|
---|
1569 | if test "$?" -ne 0; then
|
---|
1570 | # on failure, ensure result is empty
|
---|
1571 | func_cygpath_result=
|
---|
1572 | fi
|
---|
1573 | else
|
---|
1574 | func_cygpath_result=
|
---|
1575 | func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
|
---|
1576 | fi
|
---|
1577 | }
|
---|
1578 | #end: func_cygpath
|
---|
1579 |
|
---|
1580 |
|
---|
1581 | # func_convert_core_msys_to_w32 ARG
|
---|
1582 | # Convert file name or path ARG from MSYS format to w32 format. Return
|
---|
1583 | # result in func_convert_core_msys_to_w32_result.
|
---|
1584 | func_convert_core_msys_to_w32 ()
|
---|
1585 | {
|
---|
1586 | $opt_debug
|
---|
1587 | # awkward: cmd appends spaces to result
|
---|
1588 | func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
|
---|
1589 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
|
---|
1590 | }
|
---|
1591 | #end: func_convert_core_msys_to_w32
|
---|
1592 |
|
---|
1593 |
|
---|
1594 | # func_convert_file_check ARG1 ARG2
|
---|
1595 | # Verify that ARG1 (a file name in $build format) was converted to $host
|
---|
1596 | # format in ARG2. Otherwise, emit an error message, but continue (resetting
|
---|
1597 | # func_to_host_file_result to ARG1).
|
---|
1598 | func_convert_file_check ()
|
---|
1599 | {
|
---|
1600 | $opt_debug
|
---|
1601 | if test -z "$2" && test -n "$1" ; then
|
---|
1602 | func_error "Could not determine host file name corresponding to"
|
---|
1603 | func_error " \`$1'"
|
---|
1604 | func_error "Continuing, but uninstalled executables may not work."
|
---|
1605 | # Fallback:
|
---|
1606 | func_to_host_file_result="$1"
|
---|
1607 | fi
|
---|
1608 | }
|
---|
1609 | # end func_convert_file_check
|
---|
1610 |
|
---|
1611 |
|
---|
1612 | # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
|
---|
1613 | # Verify that FROM_PATH (a path in $build format) was converted to $host
|
---|
1614 | # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
|
---|
1615 | # func_to_host_file_result to a simplistic fallback value (see below).
|
---|
1616 | func_convert_path_check ()
|
---|
1617 | {
|
---|
1618 | $opt_debug
|
---|
1619 | if test -z "$4" && test -n "$3"; then
|
---|
1620 | func_error "Could not determine the host path corresponding to"
|
---|
1621 | func_error " \`$3'"
|
---|
1622 | func_error "Continuing, but uninstalled executables may not work."
|
---|
1623 | # Fallback. This is a deliberately simplistic "conversion" and
|
---|
1624 | # should not be "improved". See libtool.info.
|
---|
1625 | if test "x$1" != "x$2"; then
|
---|
1626 | lt_replace_pathsep_chars="s|$1|$2|g"
|
---|
1627 | func_to_host_path_result=`echo "$3" |
|
---|
1628 | $SED -e "$lt_replace_pathsep_chars"`
|
---|
1629 | else
|
---|
1630 | func_to_host_path_result="$3"
|
---|
1631 | fi
|
---|
1632 | fi
|
---|
1633 | }
|
---|
1634 | # end func_convert_path_check
|
---|
1635 |
|
---|
1636 |
|
---|
1637 | # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
|
---|
1638 | # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
|
---|
1639 | # and appending REPL if ORIG matches BACKPAT.
|
---|
1640 | func_convert_path_front_back_pathsep ()
|
---|
1641 | {
|
---|
1642 | $opt_debug
|
---|
1643 | case $4 in
|
---|
1644 | $1 ) func_to_host_path_result="$3$func_to_host_path_result"
|
---|
1645 | ;;
|
---|
1646 | esac
|
---|
1647 | case $4 in
|
---|
1648 | $2 ) func_append func_to_host_path_result "$3"
|
---|
1649 | ;;
|
---|
1650 | esac
|
---|
1651 | }
|
---|
1652 | # end func_convert_path_front_back_pathsep
|
---|
1653 |
|
---|
1654 |
|
---|
1655 | ##################################################
|
---|
1656 | # $build to $host FILE NAME CONVERSION FUNCTIONS #
|
---|
1657 | ##################################################
|
---|
1658 | # invoked via `$to_host_file_cmd ARG'
|
---|
1659 | #
|
---|
1660 | # In each case, ARG is the path to be converted from $build to $host format.
|
---|
1661 | # Result will be available in $func_to_host_file_result.
|
---|
1662 |
|
---|
1663 |
|
---|
1664 | # func_to_host_file ARG
|
---|
1665 | # Converts the file name ARG from $build format to $host format. Return result
|
---|
1666 | # in func_to_host_file_result.
|
---|
1667 | func_to_host_file ()
|
---|
1668 | {
|
---|
1669 | $opt_debug
|
---|
1670 | $to_host_file_cmd "$1"
|
---|
1671 | }
|
---|
1672 | # end func_to_host_file
|
---|
1673 |
|
---|
1674 |
|
---|
1675 | # func_to_tool_file ARG LAZY
|
---|
1676 | # converts the file name ARG from $build format to toolchain format. Return
|
---|
1677 | # result in func_to_tool_file_result. If the conversion in use is listed
|
---|
1678 | # in (the comma separated) LAZY, no conversion takes place.
|
---|
1679 | func_to_tool_file ()
|
---|
1680 | {
|
---|
1681 | $opt_debug
|
---|
1682 | case ,$2, in
|
---|
1683 | *,"$to_tool_file_cmd",*)
|
---|
1684 | func_to_tool_file_result=$1
|
---|
1685 | ;;
|
---|
1686 | *)
|
---|
1687 | $to_tool_file_cmd "$1"
|
---|
1688 | func_to_tool_file_result=$func_to_host_file_result
|
---|
1689 | ;;
|
---|
1690 | esac
|
---|
1691 | }
|
---|
1692 | # end func_to_tool_file
|
---|
1693 |
|
---|
1694 |
|
---|
1695 | # func_convert_file_noop ARG
|
---|
1696 | # Copy ARG to func_to_host_file_result.
|
---|
1697 | func_convert_file_noop ()
|
---|
1698 | {
|
---|
1699 | func_to_host_file_result="$1"
|
---|
1700 | }
|
---|
1701 | # end func_convert_file_noop
|
---|
1702 |
|
---|
1703 |
|
---|
1704 | # func_convert_file_msys_to_w32 ARG
|
---|
1705 | # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
|
---|
1706 | # conversion to w32 is not available inside the cwrapper. Returns result in
|
---|
1707 | # func_to_host_file_result.
|
---|
1708 | func_convert_file_msys_to_w32 ()
|
---|
1709 | {
|
---|
1710 | $opt_debug
|
---|
1711 | func_to_host_file_result="$1"
|
---|
1712 | if test -n "$1"; then
|
---|
1713 | func_convert_core_msys_to_w32 "$1"
|
---|
1714 | func_to_host_file_result="$func_convert_core_msys_to_w32_result"
|
---|
1715 | fi
|
---|
1716 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
1717 | }
|
---|
1718 | # end func_convert_file_msys_to_w32
|
---|
1719 |
|
---|
1720 |
|
---|
1721 | # func_convert_file_cygwin_to_w32 ARG
|
---|
1722 | # Convert file name ARG from Cygwin to w32 format. Returns result in
|
---|
1723 | # func_to_host_file_result.
|
---|
1724 | func_convert_file_cygwin_to_w32 ()
|
---|
1725 | {
|
---|
1726 | $opt_debug
|
---|
1727 | func_to_host_file_result="$1"
|
---|
1728 | if test -n "$1"; then
|
---|
1729 | # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
|
---|
1730 | # LT_CYGPATH in this case.
|
---|
1731 | func_to_host_file_result=`cygpath -m "$1"`
|
---|
1732 | fi
|
---|
1733 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
1734 | }
|
---|
1735 | # end func_convert_file_cygwin_to_w32
|
---|
1736 |
|
---|
1737 |
|
---|
1738 | # func_convert_file_nix_to_w32 ARG
|
---|
1739 | # Convert file name ARG from *nix to w32 format. Requires a wine environment
|
---|
1740 | # and a working winepath. Returns result in func_to_host_file_result.
|
---|
1741 | func_convert_file_nix_to_w32 ()
|
---|
1742 | {
|
---|
1743 | $opt_debug
|
---|
1744 | func_to_host_file_result="$1"
|
---|
1745 | if test -n "$1"; then
|
---|
1746 | func_convert_core_file_wine_to_w32 "$1"
|
---|
1747 | func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
|
---|
1748 | fi
|
---|
1749 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
1750 | }
|
---|
1751 | # end func_convert_file_nix_to_w32
|
---|
1752 |
|
---|
1753 |
|
---|
1754 | # func_convert_file_msys_to_cygwin ARG
|
---|
1755 | # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
|
---|
1756 | # Returns result in func_to_host_file_result.
|
---|
1757 | func_convert_file_msys_to_cygwin ()
|
---|
1758 | {
|
---|
1759 | $opt_debug
|
---|
1760 | func_to_host_file_result="$1"
|
---|
1761 | if test -n "$1"; then
|
---|
1762 | func_convert_core_msys_to_w32 "$1"
|
---|
1763 | func_cygpath -u "$func_convert_core_msys_to_w32_result"
|
---|
1764 | func_to_host_file_result="$func_cygpath_result"
|
---|
1765 | fi
|
---|
1766 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
1767 | }
|
---|
1768 | # end func_convert_file_msys_to_cygwin
|
---|
1769 |
|
---|
1770 |
|
---|
1771 | # func_convert_file_nix_to_cygwin ARG
|
---|
1772 | # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
|
---|
1773 | # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
|
---|
1774 | # in func_to_host_file_result.
|
---|
1775 | func_convert_file_nix_to_cygwin ()
|
---|
1776 | {
|
---|
1777 | $opt_debug
|
---|
1778 | func_to_host_file_result="$1"
|
---|
1779 | if test -n "$1"; then
|
---|
1780 | # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
|
---|
1781 | func_convert_core_file_wine_to_w32 "$1"
|
---|
1782 | func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
|
---|
1783 | func_to_host_file_result="$func_cygpath_result"
|
---|
1784 | fi
|
---|
1785 | func_convert_file_check "$1" "$func_to_host_file_result"
|
---|
1786 | }
|
---|
1787 | # end func_convert_file_nix_to_cygwin
|
---|
1788 |
|
---|
1789 |
|
---|
1790 | #############################################
|
---|
1791 | # $build to $host PATH CONVERSION FUNCTIONS #
|
---|
1792 | #############################################
|
---|
1793 | # invoked via `$to_host_path_cmd ARG'
|
---|
1794 | #
|
---|
1795 | # In each case, ARG is the path to be converted from $build to $host format.
|
---|
1796 | # The result will be available in $func_to_host_path_result.
|
---|
1797 | #
|
---|
1798 | # Path separators are also converted from $build format to $host format. If
|
---|
1799 | # ARG begins or ends with a path separator character, it is preserved (but
|
---|
1800 | # converted to $host format) on output.
|
---|
1801 | #
|
---|
1802 | # All path conversion functions are named using the following convention:
|
---|
1803 | # file name conversion function : func_convert_file_X_to_Y ()
|
---|
1804 | # path conversion function : func_convert_path_X_to_Y ()
|
---|
1805 | # where, for any given $build/$host combination the 'X_to_Y' value is the
|
---|
1806 | # same. If conversion functions are added for new $build/$host combinations,
|
---|
1807 | # the two new functions must follow this pattern, or func_init_to_host_path_cmd
|
---|
1808 | # will break.
|
---|
1809 |
|
---|
1810 |
|
---|
1811 | # func_init_to_host_path_cmd
|
---|
1812 | # Ensures that function "pointer" variable $to_host_path_cmd is set to the
|
---|
1813 | # appropriate value, based on the value of $to_host_file_cmd.
|
---|
1814 | to_host_path_cmd=
|
---|
1815 | func_init_to_host_path_cmd ()
|
---|
1816 | {
|
---|
1817 | $opt_debug
|
---|
1818 | if test -z "$to_host_path_cmd"; then
|
---|
1819 | func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
|
---|
1820 | to_host_path_cmd="func_convert_path_${func_stripname_result}"
|
---|
1821 | fi
|
---|
1822 | }
|
---|
1823 |
|
---|
1824 |
|
---|
1825 | # func_to_host_path ARG
|
---|
1826 | # Converts the path ARG from $build format to $host format. Return result
|
---|
1827 | # in func_to_host_path_result.
|
---|
1828 | func_to_host_path ()
|
---|
1829 | {
|
---|
1830 | $opt_debug
|
---|
1831 | func_init_to_host_path_cmd
|
---|
1832 | $to_host_path_cmd "$1"
|
---|
1833 | }
|
---|
1834 | # end func_to_host_path
|
---|
1835 |
|
---|
1836 |
|
---|
1837 | # func_convert_path_noop ARG
|
---|
1838 | # Copy ARG to func_to_host_path_result.
|
---|
1839 | func_convert_path_noop ()
|
---|
1840 | {
|
---|
1841 | func_to_host_path_result="$1"
|
---|
1842 | }
|
---|
1843 | # end func_convert_path_noop
|
---|
1844 |
|
---|
1845 |
|
---|
1846 | # func_convert_path_msys_to_w32 ARG
|
---|
1847 | # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
|
---|
1848 | # conversion to w32 is not available inside the cwrapper. Returns result in
|
---|
1849 | # func_to_host_path_result.
|
---|
1850 | func_convert_path_msys_to_w32 ()
|
---|
1851 | {
|
---|
1852 | $opt_debug
|
---|
1853 | func_to_host_path_result="$1"
|
---|
1854 | if test -n "$1"; then
|
---|
1855 | # Remove leading and trailing path separator characters from ARG. MSYS
|
---|
1856 | # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
|
---|
1857 | # and winepath ignores them completely.
|
---|
1858 | func_stripname : : "$1"
|
---|
1859 | func_to_host_path_tmp1=$func_stripname_result
|
---|
1860 | func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
|
---|
1861 | func_to_host_path_result="$func_convert_core_msys_to_w32_result"
|
---|
1862 | func_convert_path_check : ";" \
|
---|
1863 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
1864 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
|
---|
1865 | fi
|
---|
1866 | }
|
---|
1867 | # end func_convert_path_msys_to_w32
|
---|
1868 |
|
---|
1869 |
|
---|
1870 | # func_convert_path_cygwin_to_w32 ARG
|
---|
1871 | # Convert path ARG from Cygwin to w32 format. Returns result in
|
---|
1872 | # func_to_host_file_result.
|
---|
1873 | func_convert_path_cygwin_to_w32 ()
|
---|
1874 | {
|
---|
1875 | $opt_debug
|
---|
1876 | func_to_host_path_result="$1"
|
---|
1877 | if test -n "$1"; then
|
---|
1878 | # See func_convert_path_msys_to_w32:
|
---|
1879 | func_stripname : : "$1"
|
---|
1880 | func_to_host_path_tmp1=$func_stripname_result
|
---|
1881 | func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
|
---|
1882 | func_convert_path_check : ";" \
|
---|
1883 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
1884 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
|
---|
1885 | fi
|
---|
1886 | }
|
---|
1887 | # end func_convert_path_cygwin_to_w32
|
---|
1888 |
|
---|
1889 |
|
---|
1890 | # func_convert_path_nix_to_w32 ARG
|
---|
1891 | # Convert path ARG from *nix to w32 format. Requires a wine environment and
|
---|
1892 | # a working winepath. Returns result in func_to_host_file_result.
|
---|
1893 | func_convert_path_nix_to_w32 ()
|
---|
1894 | {
|
---|
1895 | $opt_debug
|
---|
1896 | func_to_host_path_result="$1"
|
---|
1897 | if test -n "$1"; then
|
---|
1898 | # See func_convert_path_msys_to_w32:
|
---|
1899 | func_stripname : : "$1"
|
---|
1900 | func_to_host_path_tmp1=$func_stripname_result
|
---|
1901 | func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
|
---|
1902 | func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
|
---|
1903 | func_convert_path_check : ";" \
|
---|
1904 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
1905 | func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
|
---|
1906 | fi
|
---|
1907 | }
|
---|
1908 | # end func_convert_path_nix_to_w32
|
---|
1909 |
|
---|
1910 |
|
---|
1911 | # func_convert_path_msys_to_cygwin ARG
|
---|
1912 | # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
|
---|
1913 | # Returns result in func_to_host_file_result.
|
---|
1914 | func_convert_path_msys_to_cygwin ()
|
---|
1915 | {
|
---|
1916 | $opt_debug
|
---|
1917 | func_to_host_path_result="$1"
|
---|
1918 | if test -n "$1"; then
|
---|
1919 | # See func_convert_path_msys_to_w32:
|
---|
1920 | func_stripname : : "$1"
|
---|
1921 | func_to_host_path_tmp1=$func_stripname_result
|
---|
1922 | func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
|
---|
1923 | func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
|
---|
1924 | func_to_host_path_result="$func_cygpath_result"
|
---|
1925 | func_convert_path_check : : \
|
---|
1926 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
1927 | func_convert_path_front_back_pathsep ":*" "*:" : "$1"
|
---|
1928 | fi
|
---|
1929 | }
|
---|
1930 | # end func_convert_path_msys_to_cygwin
|
---|
1931 |
|
---|
1932 |
|
---|
1933 | # func_convert_path_nix_to_cygwin ARG
|
---|
1934 | # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
|
---|
1935 | # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
|
---|
1936 | # func_to_host_file_result.
|
---|
1937 | func_convert_path_nix_to_cygwin ()
|
---|
1938 | {
|
---|
1939 | $opt_debug
|
---|
1940 | func_to_host_path_result="$1"
|
---|
1941 | if test -n "$1"; then
|
---|
1942 | # Remove leading and trailing path separator characters from
|
---|
1943 | # ARG. msys behavior is inconsistent here, cygpath turns them
|
---|
1944 | # into '.;' and ';.', and winepath ignores them completely.
|
---|
1945 | func_stripname : : "$1"
|
---|
1946 | func_to_host_path_tmp1=$func_stripname_result
|
---|
1947 | func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
|
---|
1948 | func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
|
---|
1949 | func_to_host_path_result="$func_cygpath_result"
|
---|
1950 | func_convert_path_check : : \
|
---|
1951 | "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
---|
1952 | func_convert_path_front_back_pathsep ":*" "*:" : "$1"
|
---|
1953 | fi
|
---|
1954 | }
|
---|
1955 | # end func_convert_path_nix_to_cygwin
|
---|
1956 |
|
---|
1957 |
|
---|
1958 | # func_mode_compile arg...
|
---|
1959 | func_mode_compile ()
|
---|
1960 | {
|
---|
1961 | $opt_debug
|
---|
1962 | # Get the compilation command and the source file.
|
---|
1963 | base_compile=
|
---|
1964 | srcfile="$nonopt" # always keep a non-empty value in "srcfile"
|
---|
1965 | suppress_opt=yes
|
---|
1966 | suppress_output=
|
---|
1967 | arg_mode=normal
|
---|
1968 | libobj=
|
---|
1969 | later=
|
---|
1970 | pie_flag=
|
---|
1971 |
|
---|
1972 | for arg
|
---|
1973 | do
|
---|
1974 | case $arg_mode in
|
---|
1975 | arg )
|
---|
1976 | # do not "continue". Instead, add this to base_compile
|
---|
1977 | lastarg="$arg"
|
---|
1978 | arg_mode=normal
|
---|
1979 | ;;
|
---|
1980 |
|
---|
1981 | target )
|
---|
1982 | libobj="$arg"
|
---|
1983 | arg_mode=normal
|
---|
1984 | continue
|
---|
1985 | ;;
|
---|
1986 |
|
---|
1987 | normal )
|
---|
1988 | # Accept any command-line options.
|
---|
1989 | case $arg in
|
---|
1990 | -o)
|
---|
1991 | test -n "$libobj" && \
|
---|
1992 | func_fatal_error "you cannot specify \`-o' more than once"
|
---|
1993 | arg_mode=target
|
---|
1994 | continue
|
---|
1995 | ;;
|
---|
1996 |
|
---|
1997 | -pie | -fpie | -fPIE)
|
---|
1998 | func_append pie_flag " $arg"
|
---|
1999 | continue
|
---|
2000 | ;;
|
---|
2001 |
|
---|
2002 | -shared | -static | -prefer-pic | -prefer-non-pic)
|
---|
2003 | func_append later " $arg"
|
---|
2004 | continue
|
---|
2005 | ;;
|
---|
2006 |
|
---|
2007 | -no-suppress)
|
---|
2008 | suppress_opt=no
|
---|
2009 | continue
|
---|
2010 | ;;
|
---|
2011 |
|
---|
2012 | -Xcompiler)
|
---|
2013 | arg_mode=arg # the next one goes into the "base_compile" arg list
|
---|
2014 | continue # The current "srcfile" will either be retained or
|
---|
2015 | ;; # replaced later. I would guess that would be a bug.
|
---|
2016 |
|
---|
2017 | -Wc,*)
|
---|
2018 | func_stripname '-Wc,' '' "$arg"
|
---|
2019 | args=$func_stripname_result
|
---|
2020 | lastarg=
|
---|
2021 | save_ifs="$IFS"; IFS=','
|
---|
2022 | for arg in $args; do
|
---|
2023 | IFS="$save_ifs"
|
---|
2024 | func_append_quoted lastarg "$arg"
|
---|
2025 | done
|
---|
2026 | IFS="$save_ifs"
|
---|
2027 | func_stripname ' ' '' "$lastarg"
|
---|
2028 | lastarg=$func_stripname_result
|
---|
2029 |
|
---|
2030 | # Add the arguments to base_compile.
|
---|
2031 | func_append base_compile " $lastarg"
|
---|
2032 | continue
|
---|
2033 | ;;
|
---|
2034 |
|
---|
2035 | *)
|
---|
2036 | # Accept the current argument as the source file.
|
---|
2037 | # The previous "srcfile" becomes the current argument.
|
---|
2038 | #
|
---|
2039 | lastarg="$srcfile"
|
---|
2040 | srcfile="$arg"
|
---|
2041 | ;;
|
---|
2042 | esac # case $arg
|
---|
2043 | ;;
|
---|
2044 | esac # case $arg_mode
|
---|
2045 |
|
---|
2046 | # Aesthetically quote the previous argument.
|
---|
2047 | func_append_quoted base_compile "$lastarg"
|
---|
2048 | done # for arg
|
---|
2049 |
|
---|
2050 | case $arg_mode in
|
---|
2051 | arg)
|
---|
2052 | func_fatal_error "you must specify an argument for -Xcompile"
|
---|
2053 | ;;
|
---|
2054 | target)
|
---|
2055 | func_fatal_error "you must specify a target with \`-o'"
|
---|
2056 | ;;
|
---|
2057 | *)
|
---|
2058 | # Get the name of the library object.
|
---|
2059 | test -z "$libobj" && {
|
---|
2060 | func_basename "$srcfile"
|
---|
2061 | libobj="$func_basename_result"
|
---|
2062 | }
|
---|
2063 | ;;
|
---|
2064 | esac
|
---|
2065 |
|
---|
2066 | # Recognize several different file suffixes.
|
---|
2067 | # If the user specifies -o file.o, it is replaced with file.lo
|
---|
2068 | case $libobj in
|
---|
2069 | *.[cCFSifmso] | \
|
---|
2070 | *.ada | *.adb | *.ads | *.asm | \
|
---|
2071 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
|
---|
2072 | *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
|
---|
2073 | func_xform "$libobj"
|
---|
2074 | libobj=$func_xform_result
|
---|
2075 | ;;
|
---|
2076 | esac
|
---|
2077 |
|
---|
2078 | case $libobj in
|
---|
2079 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
|
---|
2080 | *)
|
---|
2081 | func_fatal_error "cannot determine name of library object from \`$libobj'"
|
---|
2082 | ;;
|
---|
2083 | esac
|
---|
2084 |
|
---|
2085 | func_infer_tag $base_compile
|
---|
2086 |
|
---|
2087 | for arg in $later; do
|
---|
2088 | case $arg in
|
---|
2089 | -shared)
|
---|
2090 | test "$build_libtool_libs" != yes && \
|
---|
2091 | func_fatal_configuration "can not build a shared library"
|
---|
2092 | build_old_libs=no
|
---|
2093 | continue
|
---|
2094 | ;;
|
---|
2095 |
|
---|
2096 | -static)
|
---|
2097 | build_libtool_libs=no
|
---|
2098 | build_old_libs=yes
|
---|
2099 | continue
|
---|
2100 | ;;
|
---|
2101 |
|
---|
2102 | -prefer-pic)
|
---|
2103 | pic_mode=yes
|
---|
2104 | continue
|
---|
2105 | ;;
|
---|
2106 |
|
---|
2107 | -prefer-non-pic)
|
---|
2108 | pic_mode=no
|
---|
2109 | continue
|
---|
2110 | ;;
|
---|
2111 | esac
|
---|
2112 | done
|
---|
2113 |
|
---|
2114 | func_quote_for_eval "$libobj"
|
---|
2115 | test "X$libobj" != "X$func_quote_for_eval_result" \
|
---|
2116 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
|
---|
2117 | && func_warning "libobj name \`$libobj' may not contain shell special characters."
|
---|
2118 | func_dirname_and_basename "$obj" "/" ""
|
---|
2119 | objname="$func_basename_result"
|
---|
2120 | xdir="$func_dirname_result"
|
---|
2121 | lobj=${xdir}$objdir/$objname
|
---|
2122 |
|
---|
2123 | test -z "$base_compile" && \
|
---|
2124 | func_fatal_help "you must specify a compilation command"
|
---|
2125 |
|
---|
2126 | # Delete any leftover library objects.
|
---|
2127 | if test "$build_old_libs" = yes; then
|
---|
2128 | removelist="$obj $lobj $libobj ${libobj}T"
|
---|
2129 | else
|
---|
2130 | removelist="$lobj $libobj ${libobj}T"
|
---|
2131 | fi
|
---|
2132 |
|
---|
2133 | # On Cygwin there's no "real" PIC flag so we must build both object types
|
---|
2134 | case $host_os in
|
---|
2135 | cygwin* | mingw* | pw32* | os2* | cegcc*)
|
---|
2136 | pic_mode=default
|
---|
2137 | ;;
|
---|
2138 | esac
|
---|
2139 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
|
---|
2140 | # non-PIC code in shared libraries is not supported
|
---|
2141 | pic_mode=default
|
---|
2142 | fi
|
---|
2143 |
|
---|
2144 | # Calculate the filename of the output object if compiler does
|
---|
2145 | # not support -o with -c
|
---|
2146 | if test "$compiler_c_o" = no; then
|
---|
2147 | output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
|
---|
2148 | lockfile="$output_obj.lock"
|
---|
2149 | else
|
---|
2150 | output_obj=
|
---|
2151 | need_locks=no
|
---|
2152 | lockfile=
|
---|
2153 | fi
|
---|
2154 |
|
---|
2155 | # Lock this critical section if it is needed
|
---|
2156 | # We use this script file to make the link, it avoids creating a new file
|
---|
2157 | if test "$need_locks" = yes; then
|
---|
2158 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
|
---|
2159 | func_echo "Waiting for $lockfile to be removed"
|
---|
2160 | sleep 2
|
---|
2161 | done
|
---|
2162 | elif test "$need_locks" = warn; then
|
---|
2163 | if test -f "$lockfile"; then
|
---|
2164 | $ECHO "\
|
---|
2165 | *** ERROR, $lockfile exists and contains:
|
---|
2166 | `cat $lockfile 2>/dev/null`
|
---|
2167 |
|
---|
2168 | This indicates that another process is trying to use the same
|
---|
2169 | temporary object file, and libtool could not work around it because
|
---|
2170 | your compiler does not support \`-c' and \`-o' together. If you
|
---|
2171 | repeat this compilation, it may succeed, by chance, but you had better
|
---|
2172 | avoid parallel builds (make -j) in this platform, or get a better
|
---|
2173 | compiler."
|
---|
2174 |
|
---|
2175 | $opt_dry_run || $RM $removelist
|
---|
2176 | exit $EXIT_FAILURE
|
---|
2177 | fi
|
---|
2178 | func_append removelist " $output_obj"
|
---|
2179 | $ECHO "$srcfile" > "$lockfile"
|
---|
2180 | fi
|
---|
2181 |
|
---|
2182 | $opt_dry_run || $RM $removelist
|
---|
2183 | func_append removelist " $lockfile"
|
---|
2184 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
|
---|
2185 |
|
---|
2186 | func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
|
---|
2187 | srcfile=$func_to_tool_file_result
|
---|
2188 | func_quote_for_eval "$srcfile"
|
---|
2189 | qsrcfile=$func_quote_for_eval_result
|
---|
2190 |
|
---|
2191 | # Only build a PIC object if we are building libtool libraries.
|
---|
2192 | if test "$build_libtool_libs" = yes; then
|
---|
2193 | # Without this assignment, base_compile gets emptied.
|
---|
2194 | fbsd_hideous_sh_bug=$base_compile
|
---|
2195 |
|
---|
2196 | if test "$pic_mode" != no; then
|
---|
2197 | command="$base_compile $qsrcfile $pic_flag"
|
---|
2198 | else
|
---|
2199 | # Don't build PIC code
|
---|
2200 | command="$base_compile $qsrcfile"
|
---|
2201 | fi
|
---|
2202 |
|
---|
2203 | func_mkdir_p "$xdir$objdir"
|
---|
2204 |
|
---|
2205 | if test -z "$output_obj"; then
|
---|
2206 | # Place PIC objects in $objdir
|
---|
2207 | func_append command " -o $lobj"
|
---|
2208 | fi
|
---|
2209 |
|
---|
2210 | func_show_eval_locale "$command" \
|
---|
2211 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
|
---|
2212 |
|
---|
2213 | if test "$need_locks" = warn &&
|
---|
2214 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
---|
2215 | $ECHO "\
|
---|
2216 | *** ERROR, $lockfile contains:
|
---|
2217 | `cat $lockfile 2>/dev/null`
|
---|
2218 |
|
---|
2219 | but it should contain:
|
---|
2220 | $srcfile
|
---|
2221 |
|
---|
2222 | This indicates that another process is trying to use the same
|
---|
2223 | temporary object file, and libtool could not work around it because
|
---|
2224 | your compiler does not support \`-c' and \`-o' together. If you
|
---|
2225 | repeat this compilation, it may succeed, by chance, but you had better
|
---|
2226 | avoid parallel builds (make -j) in this platform, or get a better
|
---|
2227 | compiler."
|
---|
2228 |
|
---|
2229 | $opt_dry_run || $RM $removelist
|
---|
2230 | exit $EXIT_FAILURE
|
---|
2231 | fi
|
---|
2232 |
|
---|
2233 | # Just move the object if needed, then go on to compile the next one
|
---|
2234 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
|
---|
2235 | func_show_eval '$MV "$output_obj" "$lobj"' \
|
---|
2236 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
---|
2237 | fi
|
---|
2238 |
|
---|
2239 | # Allow error messages only from the first compilation.
|
---|
2240 | if test "$suppress_opt" = yes; then
|
---|
2241 | suppress_output=' >/dev/null 2>&1'
|
---|
2242 | fi
|
---|
2243 | fi
|
---|
2244 |
|
---|
2245 | # Only build a position-dependent object if we build old libraries.
|
---|
2246 | if test "$build_old_libs" = yes; then
|
---|
2247 | if test "$pic_mode" != yes; then
|
---|
2248 | # Don't build PIC code
|
---|
2249 | command="$base_compile $qsrcfile$pie_flag"
|
---|
2250 | else
|
---|
2251 | command="$base_compile $qsrcfile $pic_flag"
|
---|
2252 | fi
|
---|
2253 | if test "$compiler_c_o" = yes; then
|
---|
2254 | func_append command " -o $obj"
|
---|
2255 | fi
|
---|
2256 |
|
---|
2257 | # Suppress compiler output if we already did a PIC compilation.
|
---|
2258 | func_append command "$suppress_output"
|
---|
2259 | func_show_eval_locale "$command" \
|
---|
2260 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
|
---|
2261 |
|
---|
2262 | if test "$need_locks" = warn &&
|
---|
2263 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
---|
2264 | $ECHO "\
|
---|
2265 | *** ERROR, $lockfile contains:
|
---|
2266 | `cat $lockfile 2>/dev/null`
|
---|
2267 |
|
---|
2268 | but it should contain:
|
---|
2269 | $srcfile
|
---|
2270 |
|
---|
2271 | This indicates that another process is trying to use the same
|
---|
2272 | temporary object file, and libtool could not work around it because
|
---|
2273 | your compiler does not support \`-c' and \`-o' together. If you
|
---|
2274 | repeat this compilation, it may succeed, by chance, but you had better
|
---|
2275 | avoid parallel builds (make -j) in this platform, or get a better
|
---|
2276 | compiler."
|
---|
2277 |
|
---|
2278 | $opt_dry_run || $RM $removelist
|
---|
2279 | exit $EXIT_FAILURE
|
---|
2280 | fi
|
---|
2281 |
|
---|
2282 | # Just move the object if needed
|
---|
2283 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
|
---|
2284 | func_show_eval '$MV "$output_obj" "$obj"' \
|
---|
2285 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
---|
2286 | fi
|
---|
2287 | fi
|
---|
2288 |
|
---|
2289 | $opt_dry_run || {
|
---|
2290 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
|
---|
2291 |
|
---|
2292 | # Unlock the critical section if it was locked
|
---|
2293 | if test "$need_locks" != no; then
|
---|
2294 | removelist=$lockfile
|
---|
2295 | $RM "$lockfile"
|
---|
2296 | fi
|
---|
2297 | }
|
---|
2298 |
|
---|
2299 | exit $EXIT_SUCCESS
|
---|
2300 | }
|
---|
2301 |
|
---|
2302 | $opt_help || {
|
---|
2303 | test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
|
---|
2304 | }
|
---|
2305 |
|
---|
2306 | func_mode_help ()
|
---|
2307 | {
|
---|
2308 | # We need to display help for each of the modes.
|
---|
2309 | case $opt_mode in
|
---|
2310 | "")
|
---|
2311 | # Generic help is extracted from the usage comments
|
---|
2312 | # at the start of this file.
|
---|
2313 | func_help
|
---|
2314 | ;;
|
---|
2315 |
|
---|
2316 | clean)
|
---|
2317 | $ECHO \
|
---|
2318 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
|
---|
2319 |
|
---|
2320 | Remove files from the build directory.
|
---|
2321 |
|
---|
2322 | RM is the name of the program to use to delete files associated with each FILE
|
---|
2323 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
|
---|
2324 | to RM.
|
---|
2325 |
|
---|
2326 | If FILE is a libtool library, object or program, all the files associated
|
---|
2327 | with it are deleted. Otherwise, only FILE itself is deleted using RM."
|
---|
2328 | ;;
|
---|
2329 |
|
---|
2330 | compile)
|
---|
2331 | $ECHO \
|
---|
2332 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
|
---|
2333 |
|
---|
2334 | Compile a source file into a libtool library object.
|
---|
2335 |
|
---|
2336 | This mode accepts the following additional options:
|
---|
2337 |
|
---|
2338 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE
|
---|
2339 | -no-suppress do not suppress compiler output for multiple passes
|
---|
2340 | -prefer-pic try to build PIC objects only
|
---|
2341 | -prefer-non-pic try to build non-PIC objects only
|
---|
2342 | -shared do not build a \`.o' file suitable for static linking
|
---|
2343 | -static only build a \`.o' file suitable for static linking
|
---|
2344 | -Wc,FLAG pass FLAG directly to the compiler
|
---|
2345 |
|
---|
2346 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file
|
---|
2347 | from the given SOURCEFILE.
|
---|
2348 |
|
---|
2349 | The output file name is determined by removing the directory component from
|
---|
2350 | SOURCEFILE, then substituting the C source code suffix \`.c' with the
|
---|
2351 | library object suffix, \`.lo'."
|
---|
2352 | ;;
|
---|
2353 |
|
---|
2354 | execute)
|
---|
2355 | $ECHO \
|
---|
2356 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
|
---|
2357 |
|
---|
2358 | Automatically set library path, then run a program.
|
---|
2359 |
|
---|
2360 | This mode accepts the following additional options:
|
---|
2361 |
|
---|
2362 | -dlopen FILE add the directory containing FILE to the library path
|
---|
2363 |
|
---|
2364 | This mode sets the library path environment variable according to \`-dlopen'
|
---|
2365 | flags.
|
---|
2366 |
|
---|
2367 | If any of the ARGS are libtool executable wrappers, then they are translated
|
---|
2368 | into their corresponding uninstalled binary, and any of their required library
|
---|
2369 | directories are added to the library path.
|
---|
2370 |
|
---|
2371 | Then, COMMAND is executed, with ARGS as arguments."
|
---|
2372 | ;;
|
---|
2373 |
|
---|
2374 | finish)
|
---|
2375 | $ECHO \
|
---|
2376 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
|
---|
2377 |
|
---|
2378 | Complete the installation of libtool libraries.
|
---|
2379 |
|
---|
2380 | Each LIBDIR is a directory that contains libtool libraries.
|
---|
2381 |
|
---|
2382 | The commands that this mode executes may require superuser privileges. Use
|
---|
2383 | the \`--dry-run' option if you just want to see what would be executed."
|
---|
2384 | ;;
|
---|
2385 |
|
---|
2386 | install)
|
---|
2387 | $ECHO \
|
---|
2388 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
|
---|
2389 |
|
---|
2390 | Install executables or libraries.
|
---|
2391 |
|
---|
2392 | INSTALL-COMMAND is the installation command. The first component should be
|
---|
2393 | either the \`install' or \`cp' program.
|
---|
2394 |
|
---|
2395 | The following components of INSTALL-COMMAND are treated specially:
|
---|
2396 |
|
---|
2397 | -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
|
---|
2398 |
|
---|
2399 | The rest of the components are interpreted as arguments to that command (only
|
---|
2400 | BSD-compatible install options are recognized)."
|
---|
2401 | ;;
|
---|
2402 |
|
---|
2403 | link)
|
---|
2404 | $ECHO \
|
---|
2405 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
|
---|
2406 |
|
---|
2407 | Link object files or libraries together to form another library, or to
|
---|
2408 | create an executable program.
|
---|
2409 |
|
---|
2410 | LINK-COMMAND is a command using the C compiler that you would use to create
|
---|
2411 | a program from several object files.
|
---|
2412 |
|
---|
2413 | The following components of LINK-COMMAND are treated specially:
|
---|
2414 |
|
---|
2415 | -all-static do not do any dynamic linking at all
|
---|
2416 | -avoid-version do not add a version suffix if possible
|
---|
2417 | -bindir BINDIR specify path to binaries directory (for systems where
|
---|
2418 | libraries must be found in the PATH setting at runtime)
|
---|
2419 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
|
---|
2420 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
|
---|
2421 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
|
---|
2422 | -export-symbols SYMFILE
|
---|
2423 | try to export only the symbols listed in SYMFILE
|
---|
2424 | -export-symbols-regex REGEX
|
---|
2425 | try to export only the symbols matching REGEX
|
---|
2426 | -LLIBDIR search LIBDIR for required installed libraries
|
---|
2427 | -lNAME OUTPUT-FILE requires the installed library libNAME
|
---|
2428 | -module build a library that can dlopened
|
---|
2429 | -no-fast-install disable the fast-install mode
|
---|
2430 | -no-install link a not-installable executable
|
---|
2431 | -no-undefined declare that a library does not refer to external symbols
|
---|
2432 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
|
---|
2433 | -objectlist FILE Use a list of object files found in FILE to specify objects
|
---|
2434 | -precious-files-regex REGEX
|
---|
2435 | don't remove output files matching REGEX
|
---|
2436 | -release RELEASE specify package release information
|
---|
2437 | -rpath LIBDIR the created library will eventually be installed in LIBDIR
|
---|
2438 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
|
---|
2439 | -shared only do dynamic linking of libtool libraries
|
---|
2440 | -shrext SUFFIX override the standard shared library file extension
|
---|
2441 | -static do not do any dynamic linking of uninstalled libtool libraries
|
---|
2442 | -static-libtool-libs
|
---|
2443 | do not do any dynamic linking of libtool libraries
|
---|
2444 | -version-info CURRENT[:REVISION[:AGE]]
|
---|
2445 | specify library version info [each variable defaults to 0]
|
---|
2446 | -weak LIBNAME declare that the target provides the LIBNAME interface
|
---|
2447 | -Wc,FLAG
|
---|
2448 | -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
|
---|
2449 | -Wl,FLAG
|
---|
2450 | -Xlinker FLAG pass linker-specific FLAG directly to the linker
|
---|
2451 | -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
|
---|
2452 |
|
---|
2453 | All other options (arguments beginning with \`-') are ignored.
|
---|
2454 |
|
---|
2455 | Every other argument is treated as a filename. Files ending in \`.la' are
|
---|
2456 | treated as uninstalled libtool libraries, other files are standard or library
|
---|
2457 | object files.
|
---|
2458 |
|
---|
2459 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
|
---|
2460 | only library objects (\`.lo' files) may be specified, and \`-rpath' is
|
---|
2461 | required, except when creating a convenience library.
|
---|
2462 |
|
---|
2463 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
|
---|
2464 | using \`ar' and \`ranlib', or on Windows using \`lib'.
|
---|
2465 |
|
---|
2466 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
|
---|
2467 | is created, otherwise an executable program is created."
|
---|
2468 | ;;
|
---|
2469 |
|
---|
2470 | uninstall)
|
---|
2471 | $ECHO \
|
---|
2472 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
|
---|
2473 |
|
---|
2474 | Remove libraries from an installation directory.
|
---|
2475 |
|
---|
2476 | RM is the name of the program to use to delete files associated with each FILE
|
---|
2477 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
|
---|
2478 | to RM.
|
---|
2479 |
|
---|
2480 | If FILE is a libtool library, all the files associated with it are deleted.
|
---|
2481 | Otherwise, only FILE itself is deleted using RM."
|
---|
2482 | ;;
|
---|
2483 |
|
---|
2484 | *)
|
---|
2485 | func_fatal_help "invalid operation mode \`$opt_mode'"
|
---|
2486 | ;;
|
---|
2487 | esac
|
---|
2488 |
|
---|
2489 | echo
|
---|
2490 | $ECHO "Try \`$progname --help' for more information about other modes."
|
---|
2491 | }
|
---|
2492 |
|
---|
2493 | # Now that we've collected a possible --mode arg, show help if necessary
|
---|
2494 | if $opt_help; then
|
---|
2495 | if test "$opt_help" = :; then
|
---|
2496 | func_mode_help
|
---|
2497 | else
|
---|
2498 | {
|
---|
2499 | func_help noexit
|
---|
2500 | for opt_mode in compile link execute install finish uninstall clean; do
|
---|
2501 | func_mode_help
|
---|
2502 | done
|
---|
2503 | } | sed -n '1p; 2,$s/^Usage:/ or: /p'
|
---|
2504 | {
|
---|
2505 | func_help noexit
|
---|
2506 | for opt_mode in compile link execute install finish uninstall clean; do
|
---|
2507 | echo
|
---|
2508 | func_mode_help
|
---|
2509 | done
|
---|
2510 | } |
|
---|
2511 | sed '1d
|
---|
2512 | /^When reporting/,/^Report/{
|
---|
2513 | H
|
---|
2514 | d
|
---|
2515 | }
|
---|
2516 | $x
|
---|
2517 | /information about other modes/d
|
---|
2518 | /more detailed .*MODE/d
|
---|
2519 | s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
|
---|
2520 | fi
|
---|
2521 | exit $?
|
---|
2522 | fi
|
---|
2523 |
|
---|
2524 |
|
---|
2525 | # func_mode_execute arg...
|
---|
2526 | func_mode_execute ()
|
---|
2527 | {
|
---|
2528 | $opt_debug
|
---|
2529 | # The first argument is the command name.
|
---|
2530 | cmd="$nonopt"
|
---|
2531 | test -z "$cmd" && \
|
---|
2532 | func_fatal_help "you must specify a COMMAND"
|
---|
2533 |
|
---|
2534 | # Handle -dlopen flags immediately.
|
---|
2535 | for file in $opt_dlopen; do
|
---|
2536 | test -f "$file" \
|
---|
2537 | || func_fatal_help "\`$file' is not a file"
|
---|
2538 |
|
---|
2539 | dir=
|
---|
2540 | case $file in
|
---|
2541 | *.la)
|
---|
2542 | func_resolve_sysroot "$file"
|
---|
2543 | file=$func_resolve_sysroot_result
|
---|
2544 |
|
---|
2545 | # Check to see that this really is a libtool archive.
|
---|
2546 | func_lalib_unsafe_p "$file" \
|
---|
2547 | || func_fatal_help "\`$lib' is not a valid libtool archive"
|
---|
2548 |
|
---|
2549 | # Read the libtool library.
|
---|
2550 | dlname=
|
---|
2551 | library_names=
|
---|
2552 | func_source "$file"
|
---|
2553 |
|
---|
2554 | # Skip this library if it cannot be dlopened.
|
---|
2555 | if test -z "$dlname"; then
|
---|
2556 | # Warn if it was a shared library.
|
---|
2557 | test -n "$library_names" && \
|
---|
2558 | func_warning "\`$file' was not linked with \`-export-dynamic'"
|
---|
2559 | continue
|
---|
2560 | fi
|
---|
2561 |
|
---|
2562 | func_dirname "$file" "" "."
|
---|
2563 | dir="$func_dirname_result"
|
---|
2564 |
|
---|
2565 | if test -f "$dir/$objdir/$dlname"; then
|
---|
2566 | func_append dir "/$objdir"
|
---|
2567 | else
|
---|
2568 | if test ! -f "$dir/$dlname"; then
|
---|
2569 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
|
---|
2570 | fi
|
---|
2571 | fi
|
---|
2572 | ;;
|
---|
2573 |
|
---|
2574 | *.lo)
|
---|
2575 | # Just add the directory containing the .lo file.
|
---|
2576 | func_dirname "$file" "" "."
|
---|
2577 | dir="$func_dirname_result"
|
---|
2578 | ;;
|
---|
2579 |
|
---|
2580 | *)
|
---|
2581 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
|
---|
2582 | continue
|
---|
2583 | ;;
|
---|
2584 | esac
|
---|
2585 |
|
---|
2586 | # Get the absolute pathname.
|
---|
2587 | absdir=`cd "$dir" && pwd`
|
---|
2588 | test -n "$absdir" && dir="$absdir"
|
---|
2589 |
|
---|
2590 | # Now add the directory to shlibpath_var.
|
---|
2591 | if eval "test -z \"\$$shlibpath_var\""; then
|
---|
2592 | eval "$shlibpath_var=\"\$dir\""
|
---|
2593 | else
|
---|
2594 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
|
---|
2595 | fi
|
---|
2596 | done
|
---|
2597 |
|
---|
2598 | # This variable tells wrapper scripts just to set shlibpath_var
|
---|
2599 | # rather than running their programs.
|
---|
2600 | libtool_execute_magic="$magic"
|
---|
2601 |
|
---|
2602 | # Check if any of the arguments is a wrapper script.
|
---|
2603 | args=
|
---|
2604 | for file
|
---|
2605 | do
|
---|
2606 | case $file in
|
---|
2607 | -* | *.la | *.lo ) ;;
|
---|
2608 | *)
|
---|
2609 | # Do a test to see if this is really a libtool program.
|
---|
2610 | if func_ltwrapper_script_p "$file"; then
|
---|
2611 | func_source "$file"
|
---|
2612 | # Transform arg to wrapped name.
|
---|
2613 | file="$progdir/$program"
|
---|
2614 | elif func_ltwrapper_executable_p "$file"; then
|
---|
2615 | func_ltwrapper_scriptname "$file"
|
---|
2616 | func_source "$func_ltwrapper_scriptname_result"
|
---|
2617 | # Transform arg to wrapped name.
|
---|
2618 | file="$progdir/$program"
|
---|
2619 | fi
|
---|
2620 | ;;
|
---|
2621 | esac
|
---|
2622 | # Quote arguments (to preserve shell metacharacters).
|
---|
2623 | func_append_quoted args "$file"
|
---|
2624 | done
|
---|
2625 |
|
---|
2626 | if test "X$opt_dry_run" = Xfalse; then
|
---|
2627 | if test -n "$shlibpath_var"; then
|
---|
2628 | # Export the shlibpath_var.
|
---|
2629 | eval "export $shlibpath_var"
|
---|
2630 | fi
|
---|
2631 |
|
---|
2632 | # Restore saved environment variables
|
---|
2633 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
---|
2634 | do
|
---|
2635 | eval "if test \"\${save_$lt_var+set}\" = set; then
|
---|
2636 | $lt_var=\$save_$lt_var; export $lt_var
|
---|
2637 | else
|
---|
2638 | $lt_unset $lt_var
|
---|
2639 | fi"
|
---|
2640 | done
|
---|
2641 |
|
---|
2642 | # Now prepare to actually exec the command.
|
---|
2643 | exec_cmd="\$cmd$args"
|
---|
2644 | else
|
---|
2645 | # Display what would be done.
|
---|
2646 | if test -n "$shlibpath_var"; then
|
---|
2647 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
|
---|
2648 | echo "export $shlibpath_var"
|
---|
2649 | fi
|
---|
2650 | $ECHO "$cmd$args"
|
---|
2651 | exit $EXIT_SUCCESS
|
---|
2652 | fi
|
---|
2653 | }
|
---|
2654 |
|
---|
2655 | test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
|
---|
2656 |
|
---|
2657 |
|
---|
2658 | # func_mode_finish arg...
|
---|
2659 | func_mode_finish ()
|
---|
2660 | {
|
---|
2661 | $opt_debug
|
---|
2662 | libs=
|
---|
2663 | libdirs=
|
---|
2664 | admincmds=
|
---|
2665 |
|
---|
2666 | for opt in "$nonopt" ${1+"$@"}
|
---|
2667 | do
|
---|
2668 | if test -d "$opt"; then
|
---|
2669 | func_append libdirs " $opt"
|
---|
2670 |
|
---|
2671 | elif test -f "$opt"; then
|
---|
2672 | if func_lalib_unsafe_p "$opt"; then
|
---|
2673 | func_append libs " $opt"
|
---|
2674 | else
|
---|
2675 | func_warning "\`$opt' is not a valid libtool archive"
|
---|
2676 | fi
|
---|
2677 |
|
---|
2678 | else
|
---|
2679 | func_fatal_error "invalid argument \`$opt'"
|
---|
2680 | fi
|
---|
2681 | done
|
---|
2682 |
|
---|
2683 | if test -n "$libs"; then
|
---|
2684 | if test -n "$lt_sysroot"; then
|
---|
2685 | sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
|
---|
2686 | sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
|
---|
2687 | else
|
---|
2688 | sysroot_cmd=
|
---|
2689 | fi
|
---|
2690 |
|
---|
2691 | # Remove sysroot references
|
---|
2692 | if $opt_dry_run; then
|
---|
2693 | for lib in $libs; do
|
---|
2694 | echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
|
---|
2695 | done
|
---|
2696 | else
|
---|
2697 | tmpdir=`func_mktempdir`
|
---|
2698 | for lib in $libs; do
|
---|
2699 | sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
|
---|
2700 | > $tmpdir/tmp-la
|
---|
2701 | mv -f $tmpdir/tmp-la $lib
|
---|
2702 | done
|
---|
2703 | ${RM}r "$tmpdir"
|
---|
2704 | fi
|
---|
2705 | fi
|
---|
2706 |
|
---|
2707 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
|
---|
2708 | for libdir in $libdirs; do
|
---|
2709 | if test -n "$finish_cmds"; then
|
---|
2710 | # Do each command in the finish commands.
|
---|
2711 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
|
---|
2712 | '"$cmd"'"'
|
---|
2713 | fi
|
---|
2714 | if test -n "$finish_eval"; then
|
---|
2715 | # Do the single finish_eval.
|
---|
2716 | eval cmds=\"$finish_eval\"
|
---|
2717 | $opt_dry_run || eval "$cmds" || func_append admincmds "
|
---|
2718 | $cmds"
|
---|
2719 | fi
|
---|
2720 | done
|
---|
2721 | fi
|
---|
2722 |
|
---|
2723 | # Exit here if they wanted silent mode.
|
---|
2724 | $opt_silent && exit $EXIT_SUCCESS
|
---|
2725 |
|
---|
2726 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
|
---|
2727 | echo "----------------------------------------------------------------------"
|
---|
2728 | echo "Libraries have been installed in:"
|
---|
2729 | for libdir in $libdirs; do
|
---|
2730 | $ECHO " $libdir"
|
---|
2731 | done
|
---|
2732 | echo
|
---|
2733 | echo "If you ever happen to want to link against installed libraries"
|
---|
2734 | echo "in a given directory, LIBDIR, you must either use libtool, and"
|
---|
2735 | echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
|
---|
2736 | echo "flag during linking and do at least one of the following:"
|
---|
2737 | if test -n "$shlibpath_var"; then
|
---|
2738 | echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
|
---|
2739 | echo " during execution"
|
---|
2740 | fi
|
---|
2741 | if test -n "$runpath_var"; then
|
---|
2742 | echo " - add LIBDIR to the \`$runpath_var' environment variable"
|
---|
2743 | echo " during linking"
|
---|
2744 | fi
|
---|
2745 | if test -n "$hardcode_libdir_flag_spec"; then
|
---|
2746 | libdir=LIBDIR
|
---|
2747 | eval flag=\"$hardcode_libdir_flag_spec\"
|
---|
2748 |
|
---|
2749 | $ECHO " - use the \`$flag' linker flag"
|
---|
2750 | fi
|
---|
2751 | if test -n "$admincmds"; then
|
---|
2752 | $ECHO " - have your system administrator run these commands:$admincmds"
|
---|
2753 | fi
|
---|
2754 | if test -f /etc/ld.so.conf; then
|
---|
2755 | echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
|
---|
2756 | fi
|
---|
2757 | echo
|
---|
2758 |
|
---|
2759 | echo "See any operating system documentation about shared libraries for"
|
---|
2760 | case $host in
|
---|
2761 | solaris2.[6789]|solaris2.1[0-9])
|
---|
2762 | echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
|
---|
2763 | echo "pages."
|
---|
2764 | ;;
|
---|
2765 | *)
|
---|
2766 | echo "more information, such as the ld(1) and ld.so(8) manual pages."
|
---|
2767 | ;;
|
---|
2768 | esac
|
---|
2769 | echo "----------------------------------------------------------------------"
|
---|
2770 | fi
|
---|
2771 | exit $EXIT_SUCCESS
|
---|
2772 | }
|
---|
2773 |
|
---|
2774 | test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
|
---|
2775 |
|
---|
2776 |
|
---|
2777 | # func_mode_install arg...
|
---|
2778 | func_mode_install ()
|
---|
2779 | {
|
---|
2780 | $opt_debug
|
---|
2781 | # There may be an optional sh(1) argument at the beginning of
|
---|
2782 | # install_prog (especially on Windows NT).
|
---|
2783 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
|
---|
2784 | # Allow the use of GNU shtool's install command.
|
---|
2785 | case $nonopt in *shtool*) :;; *) false;; esac; then
|
---|
2786 | # Aesthetically quote it.
|
---|
2787 | func_quote_for_eval "$nonopt"
|
---|
2788 | install_prog="$func_quote_for_eval_result "
|
---|
2789 | arg=$1
|
---|
2790 | shift
|
---|
2791 | else
|
---|
2792 | install_prog=
|
---|
2793 | arg=$nonopt
|
---|
2794 | fi
|
---|
2795 |
|
---|
2796 | # The real first argument should be the name of the installation program.
|
---|
2797 | # Aesthetically quote it.
|
---|
2798 | func_quote_for_eval "$arg"
|
---|
2799 | func_append install_prog "$func_quote_for_eval_result"
|
---|
2800 | install_shared_prog=$install_prog
|
---|
2801 | case " $install_prog " in
|
---|
2802 | *[\\\ /]cp\ *) install_cp=: ;;
|
---|
2803 | *) install_cp=false ;;
|
---|
2804 | esac
|
---|
2805 |
|
---|
2806 | # We need to accept at least all the BSD install flags.
|
---|
2807 | dest=
|
---|
2808 | files=
|
---|
2809 | opts=
|
---|
2810 | prev=
|
---|
2811 | install_type=
|
---|
2812 | isdir=no
|
---|
2813 | stripme=
|
---|
2814 | no_mode=:
|
---|
2815 | for arg
|
---|
2816 | do
|
---|
2817 | arg2=
|
---|
2818 | if test -n "$dest"; then
|
---|
2819 | func_append files " $dest"
|
---|
2820 | dest=$arg
|
---|
2821 | continue
|
---|
2822 | fi
|
---|
2823 |
|
---|
2824 | case $arg in
|
---|
2825 | -d) isdir=yes ;;
|
---|
2826 | -f)
|
---|
2827 | if $install_cp; then :; else
|
---|
2828 | prev=$arg
|
---|
2829 | fi
|
---|
2830 | ;;
|
---|
2831 | -g | -m | -o)
|
---|
2832 | prev=$arg
|
---|
2833 | ;;
|
---|
2834 | -s)
|
---|
2835 | stripme=" -s"
|
---|
2836 | continue
|
---|
2837 | ;;
|
---|
2838 | -*)
|
---|
2839 | ;;
|
---|
2840 | *)
|
---|
2841 | # If the previous option needed an argument, then skip it.
|
---|
2842 | if test -n "$prev"; then
|
---|
2843 | if test "x$prev" = x-m && test -n "$install_override_mode"; then
|
---|
2844 | arg2=$install_override_mode
|
---|
2845 | no_mode=false
|
---|
2846 | fi
|
---|
2847 | prev=
|
---|
2848 | else
|
---|
2849 | dest=$arg
|
---|
2850 | continue
|
---|
2851 | fi
|
---|
2852 | ;;
|
---|
2853 | esac
|
---|
2854 |
|
---|
2855 | # Aesthetically quote the argument.
|
---|
2856 | func_quote_for_eval "$arg"
|
---|
2857 | func_append install_prog " $func_quote_for_eval_result"
|
---|
2858 | if test -n "$arg2"; then
|
---|
2859 | func_quote_for_eval "$arg2"
|
---|
2860 | fi
|
---|
2861 | func_append install_shared_prog " $func_quote_for_eval_result"
|
---|
2862 | done
|
---|
2863 |
|
---|
2864 | test -z "$install_prog" && \
|
---|
2865 | func_fatal_help "you must specify an install program"
|
---|
2866 |
|
---|
2867 | test -n "$prev" && \
|
---|
2868 | func_fatal_help "the \`$prev' option requires an argument"
|
---|
2869 |
|
---|
2870 | if test -n "$install_override_mode" && $no_mode; then
|
---|
2871 | if $install_cp; then :; else
|
---|
2872 | func_quote_for_eval "$install_override_mode"
|
---|
2873 | func_append install_shared_prog " -m $func_quote_for_eval_result"
|
---|
2874 | fi
|
---|
2875 | fi
|
---|
2876 |
|
---|
2877 | if test -z "$files"; then
|
---|
2878 | if test -z "$dest"; then
|
---|
2879 | func_fatal_help "no file or destination specified"
|
---|
2880 | else
|
---|
2881 | func_fatal_help "you must specify a destination"
|
---|
2882 | fi
|
---|
2883 | fi
|
---|
2884 |
|
---|
2885 | # Strip any trailing slash from the destination.
|
---|
2886 | func_stripname '' '/' "$dest"
|
---|
2887 | dest=$func_stripname_result
|
---|
2888 |
|
---|
2889 | # Check to see that the destination is a directory.
|
---|
2890 | test -d "$dest" && isdir=yes
|
---|
2891 | if test "$isdir" = yes; then
|
---|
2892 | destdir="$dest"
|
---|
2893 | destname=
|
---|
2894 | else
|
---|
2895 | func_dirname_and_basename "$dest" "" "."
|
---|
2896 | destdir="$func_dirname_result"
|
---|
2897 | destname="$func_basename_result"
|
---|
2898 |
|
---|
2899 | # Not a directory, so check to see that there is only one file specified.
|
---|
2900 | set dummy $files; shift
|
---|
2901 | test "$#" -gt 1 && \
|
---|
2902 | func_fatal_help "\`$dest' is not a directory"
|
---|
2903 | fi
|
---|
2904 | case $destdir in
|
---|
2905 | [\\/]* | [A-Za-z]:[\\/]*) ;;
|
---|
2906 | *)
|
---|
2907 | for file in $files; do
|
---|
2908 | case $file in
|
---|
2909 | *.lo) ;;
|
---|
2910 | *)
|
---|
2911 | func_fatal_help "\`$destdir' must be an absolute directory name"
|
---|
2912 | ;;
|
---|
2913 | esac
|
---|
2914 | done
|
---|
2915 | ;;
|
---|
2916 | esac
|
---|
2917 |
|
---|
2918 | # This variable tells wrapper scripts just to set variables rather
|
---|
2919 | # than running their programs.
|
---|
2920 | libtool_install_magic="$magic"
|
---|
2921 |
|
---|
2922 | staticlibs=
|
---|
2923 | future_libdirs=
|
---|
2924 | current_libdirs=
|
---|
2925 | for file in $files; do
|
---|
2926 |
|
---|
2927 | # Do each installation.
|
---|
2928 | case $file in
|
---|
2929 | *.$libext)
|
---|
2930 | # Do the static libraries later.
|
---|
2931 | func_append staticlibs " $file"
|
---|
2932 | ;;
|
---|
2933 |
|
---|
2934 | *.la)
|
---|
2935 | func_resolve_sysroot "$file"
|
---|
2936 | file=$func_resolve_sysroot_result
|
---|
2937 |
|
---|
2938 | # Check to see that this really is a libtool archive.
|
---|
2939 | func_lalib_unsafe_p "$file" \
|
---|
2940 | || func_fatal_help "\`$file' is not a valid libtool archive"
|
---|
2941 |
|
---|
2942 | library_names=
|
---|
2943 | old_library=
|
---|
2944 | relink_command=
|
---|
2945 | func_source "$file"
|
---|
2946 |
|
---|
2947 | # Add the libdir to current_libdirs if it is the destination.
|
---|
2948 | if test "X$destdir" = "X$libdir"; then
|
---|
2949 | case "$current_libdirs " in
|
---|
2950 | *" $libdir "*) ;;
|
---|
2951 | *) func_append current_libdirs " $libdir" ;;
|
---|
2952 | esac
|
---|
2953 | else
|
---|
2954 | # Note the libdir as a future libdir.
|
---|
2955 | case "$future_libdirs " in
|
---|
2956 | *" $libdir "*) ;;
|
---|
2957 | *) func_append future_libdirs " $libdir" ;;
|
---|
2958 | esac
|
---|
2959 | fi
|
---|
2960 |
|
---|
2961 | func_dirname "$file" "/" ""
|
---|
2962 | dir="$func_dirname_result"
|
---|
2963 | func_append dir "$objdir"
|
---|
2964 |
|
---|
2965 | if test -n "$relink_command"; then
|
---|
2966 | # Determine the prefix the user has applied to our future dir.
|
---|
2967 | inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
|
---|
2968 |
|
---|
2969 | # Don't allow the user to place us outside of our expected
|
---|
2970 | # location b/c this prevents finding dependent libraries that
|
---|
2971 | # are installed to the same prefix.
|
---|
2972 | # At present, this check doesn't affect windows .dll's that
|
---|
2973 | # are installed into $libdir/../bin (currently, that works fine)
|
---|
2974 | # but it's something to keep an eye on.
|
---|
2975 | test "$inst_prefix_dir" = "$destdir" && \
|
---|
2976 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
|
---|
2977 |
|
---|
2978 | if test -n "$inst_prefix_dir"; then
|
---|
2979 | # Stick the inst_prefix_dir data into the link command.
|
---|
2980 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
|
---|
2981 | else
|
---|
2982 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
|
---|
2983 | fi
|
---|
2984 |
|
---|
2985 | func_warning "relinking \`$file'"
|
---|
2986 | func_show_eval "$relink_command" \
|
---|
2987 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
|
---|
2988 | fi
|
---|
2989 |
|
---|
2990 | # See the names of the shared library.
|
---|
2991 | set dummy $library_names; shift
|
---|
2992 | if test -n "$1"; then
|
---|
2993 | realname="$1"
|
---|
2994 | shift
|
---|
2995 |
|
---|
2996 | srcname="$realname"
|
---|
2997 | test -n "$relink_command" && srcname="$realname"T
|
---|
2998 |
|
---|
2999 | # Install the shared library and build the symlinks.
|
---|
3000 | func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
|
---|
3001 | 'exit $?'
|
---|
3002 | tstripme="$stripme"
|
---|
3003 | case $host_os in
|
---|
3004 | cygwin* | mingw* | pw32* | cegcc*)
|
---|
3005 | case $realname in
|
---|
3006 | *.dll.a)
|
---|
3007 | tstripme=""
|
---|
3008 | ;;
|
---|
3009 | esac
|
---|
3010 | ;;
|
---|
3011 | esac
|
---|
3012 | if test -n "$tstripme" && test -n "$striplib"; then
|
---|
3013 | func_show_eval "$striplib $destdir/$realname" 'exit $?'
|
---|
3014 | fi
|
---|
3015 |
|
---|
3016 | if test "$#" -gt 0; then
|
---|
3017 | # Delete the old symlinks, and create new ones.
|
---|
3018 | # Try `ln -sf' first, because the `ln' binary might depend on
|
---|
3019 | # the symlink we replace! Solaris /bin/ln does not understand -f,
|
---|
3020 | # so we also need to try rm && ln -s.
|
---|
3021 | for linkname
|
---|
3022 | do
|
---|
3023 | test "$linkname" != "$realname" \
|
---|
3024 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
|
---|
3025 | done
|
---|
3026 | fi
|
---|
3027 |
|
---|
3028 | # Do each command in the postinstall commands.
|
---|
3029 | lib="$destdir/$realname"
|
---|
3030 | func_execute_cmds "$postinstall_cmds" 'exit $?'
|
---|
3031 | fi
|
---|
3032 |
|
---|
3033 | # Install the pseudo-library for information purposes.
|
---|
3034 | func_basename "$file"
|
---|
3035 | name="$func_basename_result"
|
---|
3036 | instname="$dir/$name"i
|
---|
3037 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
|
---|
3038 |
|
---|
3039 | # Maybe install the static library, too.
|
---|
3040 | test -n "$old_library" && func_append staticlibs " $dir/$old_library"
|
---|
3041 | ;;
|
---|
3042 |
|
---|
3043 | *.lo)
|
---|
3044 | # Install (i.e. copy) a libtool object.
|
---|
3045 |
|
---|
3046 | # Figure out destination file name, if it wasn't already specified.
|
---|
3047 | if test -n "$destname"; then
|
---|
3048 | destfile="$destdir/$destname"
|
---|
3049 | else
|
---|
3050 | func_basename "$file"
|
---|
3051 | destfile="$func_basename_result"
|
---|
3052 | destfile="$destdir/$destfile"
|
---|
3053 | fi
|
---|
3054 |
|
---|
3055 | # Deduce the name of the destination old-style object file.
|
---|
3056 | case $destfile in
|
---|
3057 | *.lo)
|
---|
3058 | func_lo2o "$destfile"
|
---|
3059 | staticdest=$func_lo2o_result
|
---|
3060 | ;;
|
---|
3061 | *.$objext)
|
---|
3062 | staticdest="$destfile"
|
---|
3063 | destfile=
|
---|
3064 | ;;
|
---|
3065 | *)
|
---|
3066 | func_fatal_help "cannot copy a libtool object to \`$destfile'"
|
---|
3067 | ;;
|
---|
3068 | esac
|
---|
3069 |
|
---|
3070 | # Install the libtool object if requested.
|
---|
3071 | test -n "$destfile" && \
|
---|
3072 | func_show_eval "$install_prog $file $destfile" 'exit $?'
|
---|
3073 |
|
---|
3074 | # Install the old object if enabled.
|
---|
3075 | if test "$build_old_libs" = yes; then
|
---|
3076 | # Deduce the name of the old-style object file.
|
---|
3077 | func_lo2o "$file"
|
---|
3078 | staticobj=$func_lo2o_result
|
---|
3079 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
|
---|
3080 | fi
|
---|
3081 | exit $EXIT_SUCCESS
|
---|
3082 | ;;
|
---|
3083 |
|
---|
3084 | *)
|
---|
3085 | # Figure out destination file name, if it wasn't already specified.
|
---|
3086 | if test -n "$destname"; then
|
---|
3087 | destfile="$destdir/$destname"
|
---|
3088 | else
|
---|
3089 | func_basename "$file"
|
---|
3090 | destfile="$func_basename_result"
|
---|
3091 | destfile="$destdir/$destfile"
|
---|
3092 | fi
|
---|
3093 |
|
---|
3094 | # If the file is missing, and there is a .exe on the end, strip it
|
---|
3095 | # because it is most likely a libtool script we actually want to
|
---|
3096 | # install
|
---|
3097 | stripped_ext=""
|
---|
3098 | case $file in
|
---|
3099 | *.exe)
|
---|
3100 | if test ! -f "$file"; then
|
---|
3101 | func_stripname '' '.exe' "$file"
|
---|
3102 | file=$func_stripname_result
|
---|
3103 | stripped_ext=".exe"
|
---|
3104 | fi
|
---|
3105 | ;;
|
---|
3106 | esac
|
---|
3107 |
|
---|
3108 | # Do a test to see if this is really a libtool program.
|
---|
3109 | case $host in
|
---|
3110 | *cygwin* | *mingw*)
|
---|
3111 | if func_ltwrapper_executable_p "$file"; then
|
---|
3112 | func_ltwrapper_scriptname "$file"
|
---|
3113 | wrapper=$func_ltwrapper_scriptname_result
|
---|
3114 | else
|
---|
3115 | func_stripname '' '.exe' "$file"
|
---|
3116 | wrapper=$func_stripname_result
|
---|
3117 | fi
|
---|
3118 | ;;
|
---|
3119 | *)
|
---|
3120 | wrapper=$file
|
---|
3121 | ;;
|
---|
3122 | esac
|
---|
3123 | if func_ltwrapper_script_p "$wrapper"; then
|
---|
3124 | notinst_deplibs=
|
---|
3125 | relink_command=
|
---|
3126 |
|
---|
3127 | func_source "$wrapper"
|
---|
3128 |
|
---|
3129 | # Check the variables that should have been set.
|
---|
3130 | test -z "$generated_by_libtool_version" && \
|
---|
3131 | func_fatal_error "invalid libtool wrapper script \`$wrapper'"
|
---|
3132 |
|
---|
3133 | finalize=yes
|
---|
3134 | for lib in $notinst_deplibs; do
|
---|
3135 | # Check to see that each library is installed.
|
---|
3136 | libdir=
|
---|
3137 | if test -f "$lib"; then
|
---|
3138 | func_source "$lib"
|
---|
3139 | fi
|
---|
3140 | libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
|
---|
3141 | if test -n "$libdir" && test ! -f "$libfile"; then
|
---|
3142 | func_warning "\`$lib' has not been installed in \`$libdir'"
|
---|
3143 | finalize=no
|
---|
3144 | fi
|
---|
3145 | done
|
---|
3146 |
|
---|
3147 | relink_command=
|
---|
3148 | func_source "$wrapper"
|
---|
3149 |
|
---|
3150 | outputname=
|
---|
3151 | if test "$fast_install" = no && test -n "$relink_command"; then
|
---|
3152 | $opt_dry_run || {
|
---|
3153 | if test "$finalize" = yes; then
|
---|
3154 | tmpdir=`func_mktempdir`
|
---|
3155 | func_basename "$file$stripped_ext"
|
---|
3156 | file="$func_basename_result"
|
---|
3157 | outputname="$tmpdir/$file"
|
---|
3158 | # Replace the output file specification.
|
---|
3159 | relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
|
---|
3160 |
|
---|
3161 | $opt_silent || {
|
---|
3162 | func_quote_for_expand "$relink_command"
|
---|
3163 | eval "func_echo $func_quote_for_expand_result"
|
---|
3164 | }
|
---|
3165 | if eval "$relink_command"; then :
|
---|
3166 | else
|
---|
3167 | func_error "error: relink \`$file' with the above command before installing it"
|
---|
3168 | $opt_dry_run || ${RM}r "$tmpdir"
|
---|
3169 | continue
|
---|
3170 | fi
|
---|
3171 | file="$outputname"
|
---|
3172 | else
|
---|
3173 | func_warning "cannot relink \`$file'"
|
---|
3174 | fi
|
---|
3175 | }
|
---|
3176 | else
|
---|
3177 | # Install the binary that we compiled earlier.
|
---|
3178 | file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
|
---|
3179 | fi
|
---|
3180 | fi
|
---|
3181 |
|
---|
3182 | # remove .exe since cygwin /usr/bin/install will append another
|
---|
3183 | # one anyway
|
---|
3184 | case $install_prog,$host in
|
---|
3185 | */usr/bin/install*,*cygwin*)
|
---|
3186 | case $file:$destfile in
|
---|
3187 | *.exe:*.exe)
|
---|
3188 | # this is ok
|
---|
3189 | ;;
|
---|
3190 | *.exe:*)
|
---|
3191 | destfile=$destfile.exe
|
---|
3192 | ;;
|
---|
3193 | *:*.exe)
|
---|
3194 | func_stripname '' '.exe' "$destfile"
|
---|
3195 | destfile=$func_stripname_result
|
---|
3196 | ;;
|
---|
3197 | esac
|
---|
3198 | ;;
|
---|
3199 | esac
|
---|
3200 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
|
---|
3201 | $opt_dry_run || if test -n "$outputname"; then
|
---|
3202 | ${RM}r "$tmpdir"
|
---|
3203 | fi
|
---|
3204 | ;;
|
---|
3205 | esac
|
---|
3206 | done
|
---|
3207 |
|
---|
3208 | for file in $staticlibs; do
|
---|
3209 | func_basename "$file"
|
---|
3210 | name="$func_basename_result"
|
---|
3211 |
|
---|
3212 | # Set up the ranlib parameters.
|
---|
3213 | oldlib="$destdir/$name"
|
---|
3214 | func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
|
---|
3215 | tool_oldlib=$func_to_tool_file_result
|
---|
3216 |
|
---|
3217 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
|
---|
3218 |
|
---|
3219 | if test -n "$stripme" && test -n "$old_striplib"; then
|
---|
3220 | func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
|
---|
3221 | fi
|
---|
3222 |
|
---|
3223 | # Do each command in the postinstall commands.
|
---|
3224 | func_execute_cmds "$old_postinstall_cmds" 'exit $?'
|
---|
3225 | done
|
---|
3226 |
|
---|
3227 | test -n "$future_libdirs" && \
|
---|
3228 | func_warning "remember to run \`$progname --finish$future_libdirs'"
|
---|
3229 |
|
---|
3230 | if test -n "$current_libdirs"; then
|
---|
3231 | # Maybe just do a dry run.
|
---|
3232 | $opt_dry_run && current_libdirs=" -n$current_libdirs"
|
---|
3233 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
|
---|
3234 | else
|
---|
3235 | exit $EXIT_SUCCESS
|
---|
3236 | fi
|
---|
3237 | }
|
---|
3238 |
|
---|
3239 | test "$opt_mode" = install && func_mode_install ${1+"$@"}
|
---|
3240 |
|
---|
3241 |
|
---|
3242 | # func_generate_dlsyms outputname originator pic_p
|
---|
3243 | # Extract symbols from dlprefiles and create ${outputname}S.o with
|
---|
3244 | # a dlpreopen symbol table.
|
---|
3245 | func_generate_dlsyms ()
|
---|
3246 | {
|
---|
3247 | $opt_debug
|
---|
3248 | my_outputname="$1"
|
---|
3249 | my_originator="$2"
|
---|
3250 | my_pic_p="${3-no}"
|
---|
3251 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
|
---|
3252 | my_dlsyms=
|
---|
3253 |
|
---|
3254 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
---|
3255 | if test -n "$NM" && test -n "$global_symbol_pipe"; then
|
---|
3256 | my_dlsyms="${my_outputname}S.c"
|
---|
3257 | else
|
---|
3258 | func_error "not configured to extract global symbols from dlpreopened files"
|
---|
3259 | fi
|
---|
3260 | fi
|
---|
3261 |
|
---|
3262 | if test -n "$my_dlsyms"; then
|
---|
3263 | case $my_dlsyms in
|
---|
3264 | "") ;;
|
---|
3265 | *.c)
|
---|
3266 | # Discover the nlist of each of the dlfiles.
|
---|
3267 | nlist="$output_objdir/${my_outputname}.nm"
|
---|
3268 |
|
---|
3269 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
|
---|
3270 |
|
---|
3271 | # Parse the name list into a source file.
|
---|
3272 | func_verbose "creating $output_objdir/$my_dlsyms"
|
---|
3273 |
|
---|
3274 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
|
---|
3275 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
|
---|
3276 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
|
---|
3277 |
|
---|
3278 | #ifdef __cplusplus
|
---|
3279 | extern \"C\" {
|
---|
3280 | #endif
|
---|
3281 |
|
---|
3282 | #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
|
---|
3283 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
|
---|
3284 | #endif
|
---|
3285 |
|
---|
3286 | /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
|
---|
3287 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
|
---|
3288 | /* DATA imports from DLLs on WIN32 con't be const, because runtime
|
---|
3289 | relocations are performed -- see ld's documentation on pseudo-relocs. */
|
---|
3290 | # define LT_DLSYM_CONST
|
---|
3291 | #elif defined(__osf__)
|
---|
3292 | /* This system does not cope well with relocations in const data. */
|
---|
3293 | # define LT_DLSYM_CONST
|
---|
3294 | #else
|
---|
3295 | # define LT_DLSYM_CONST const
|
---|
3296 | #endif
|
---|
3297 |
|
---|
3298 | /* External symbol declarations for the compiler. */\
|
---|
3299 | "
|
---|
3300 |
|
---|
3301 | if test "$dlself" = yes; then
|
---|
3302 | func_verbose "generating symbol list for \`$output'"
|
---|
3303 |
|
---|
3304 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
|
---|
3305 |
|
---|
3306 | # Add our own program objects to the symbol list.
|
---|
3307 | progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
---|
3308 | for progfile in $progfiles; do
|
---|
3309 | func_to_tool_file "$progfile" func_convert_file_msys_to_w32
|
---|
3310 | func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
|
---|
3311 | $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
|
---|
3312 | done
|
---|
3313 |
|
---|
3314 | if test -n "$exclude_expsyms"; then
|
---|
3315 | $opt_dry_run || {
|
---|
3316 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
|
---|
3317 | eval '$MV "$nlist"T "$nlist"'
|
---|
3318 | }
|
---|
3319 | fi
|
---|
3320 |
|
---|
3321 | if test -n "$export_symbols_regex"; then
|
---|
3322 | $opt_dry_run || {
|
---|
3323 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
|
---|
3324 | eval '$MV "$nlist"T "$nlist"'
|
---|
3325 | }
|
---|
3326 | fi
|
---|
3327 |
|
---|
3328 | # Prepare the list of exported symbols
|
---|
3329 | if test -z "$export_symbols"; then
|
---|
3330 | export_symbols="$output_objdir/$outputname.exp"
|
---|
3331 | $opt_dry_run || {
|
---|
3332 | $RM $export_symbols
|
---|
3333 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
|
---|
3334 | case $host in
|
---|
3335 | *cygwin* | *mingw* | *cegcc* )
|
---|
3336 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
---|
3337 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
|
---|
3338 | ;;
|
---|
3339 | esac
|
---|
3340 | }
|
---|
3341 | else
|
---|
3342 | $opt_dry_run || {
|
---|
3343 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
|
---|
3344 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
|
---|
3345 | eval '$MV "$nlist"T "$nlist"'
|
---|
3346 | case $host in
|
---|
3347 | *cygwin* | *mingw* | *cegcc* )
|
---|
3348 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
---|
3349 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
|
---|
3350 | ;;
|
---|
3351 | esac
|
---|
3352 | }
|
---|
3353 | fi
|
---|
3354 | fi
|
---|
3355 |
|
---|
3356 | for dlprefile in $dlprefiles; do
|
---|
3357 | func_verbose "extracting global C symbols from \`$dlprefile'"
|
---|
3358 | func_basename "$dlprefile"
|
---|
3359 | name="$func_basename_result"
|
---|
3360 | case $host in
|
---|
3361 | *cygwin* | *mingw* | *cegcc* )
|
---|
3362 | # if an import library, we need to obtain dlname
|
---|
3363 | if func_win32_import_lib_p "$dlprefile"; then
|
---|
3364 | func_tr_sh "$dlprefile"
|
---|
3365 | eval "curr_lafile=\$libfile_$func_tr_sh_result"
|
---|
3366 | dlprefile_dlbasename=""
|
---|
3367 | if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
|
---|
3368 | # Use subshell, to avoid clobbering current variable values
|
---|
3369 | dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
|
---|
3370 | if test -n "$dlprefile_dlname" ; then
|
---|
3371 | func_basename "$dlprefile_dlname"
|
---|
3372 | dlprefile_dlbasename="$func_basename_result"
|
---|
3373 | else
|
---|
3374 | # no lafile. user explicitly requested -dlpreopen <import library>.
|
---|
3375 | $sharedlib_from_linklib_cmd "$dlprefile"
|
---|
3376 | dlprefile_dlbasename=$sharedlib_from_linklib_result
|
---|
3377 | fi
|
---|
3378 | fi
|
---|
3379 | $opt_dry_run || {
|
---|
3380 | if test -n "$dlprefile_dlbasename" ; then
|
---|
3381 | eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
|
---|
3382 | else
|
---|
3383 | func_warning "Could not compute DLL name from $name"
|
---|
3384 | eval '$ECHO ": $name " >> "$nlist"'
|
---|
3385 | fi
|
---|
3386 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
---|
3387 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
|
---|
3388 | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
|
---|
3389 | }
|
---|
3390 | else # not an import lib
|
---|
3391 | $opt_dry_run || {
|
---|
3392 | eval '$ECHO ": $name " >> "$nlist"'
|
---|
3393 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
---|
3394 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
|
---|
3395 | }
|
---|
3396 | fi
|
---|
3397 | ;;
|
---|
3398 | *)
|
---|
3399 | $opt_dry_run || {
|
---|
3400 | eval '$ECHO ": $name " >> "$nlist"'
|
---|
3401 | func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
---|
3402 | eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
|
---|
3403 | }
|
---|
3404 | ;;
|
---|
3405 | esac
|
---|
3406 | done
|
---|
3407 |
|
---|
3408 | $opt_dry_run || {
|
---|
3409 | # Make sure we have at least an empty file.
|
---|
3410 | test -f "$nlist" || : > "$nlist"
|
---|
3411 |
|
---|
3412 | if test -n "$exclude_expsyms"; then
|
---|
3413 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
|
---|
3414 | $MV "$nlist"T "$nlist"
|
---|
3415 | fi
|
---|
3416 |
|
---|
3417 | # Try sorting and uniquifying the output.
|
---|
3418 | if $GREP -v "^: " < "$nlist" |
|
---|
3419 | if sort -k 3 </dev/null >/dev/null 2>&1; then
|
---|
3420 | sort -k 3
|
---|
3421 | else
|
---|
3422 | sort +2
|
---|
3423 | fi |
|
---|
3424 | uniq > "$nlist"S; then
|
---|
3425 | :
|
---|
3426 | else
|
---|
3427 | $GREP -v "^: " < "$nlist" > "$nlist"S
|
---|
3428 | fi
|
---|
3429 |
|
---|
3430 | if test -f "$nlist"S; then
|
---|
3431 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
|
---|
3432 | else
|
---|
3433 | echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
|
---|
3434 | fi
|
---|
3435 |
|
---|
3436 | echo >> "$output_objdir/$my_dlsyms" "\
|
---|
3437 |
|
---|
3438 | /* The mapping between symbol names and symbols. */
|
---|
3439 | typedef struct {
|
---|
3440 | const char *name;
|
---|
3441 | void *address;
|
---|
3442 | } lt_dlsymlist;
|
---|
3443 | extern LT_DLSYM_CONST lt_dlsymlist
|
---|
3444 | lt_${my_prefix}_LTX_preloaded_symbols[];
|
---|
3445 | LT_DLSYM_CONST lt_dlsymlist
|
---|
3446 | lt_${my_prefix}_LTX_preloaded_symbols[] =
|
---|
3447 | {\
|
---|
3448 | { \"$my_originator\", (void *) 0 },"
|
---|
3449 |
|
---|
3450 | case $need_lib_prefix in
|
---|
3451 | no)
|
---|
3452 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
---|
3453 | ;;
|
---|
3454 | *)
|
---|
3455 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
---|
3456 | ;;
|
---|
3457 | esac
|
---|
3458 | echo >> "$output_objdir/$my_dlsyms" "\
|
---|
3459 | {0, (void *) 0}
|
---|
3460 | };
|
---|
3461 |
|
---|
3462 | /* This works around a problem in FreeBSD linker */
|
---|
3463 | #ifdef FREEBSD_WORKAROUND
|
---|
3464 | static const void *lt_preloaded_setup() {
|
---|
3465 | return lt_${my_prefix}_LTX_preloaded_symbols;
|
---|
3466 | }
|
---|
3467 | #endif
|
---|
3468 |
|
---|
3469 | #ifdef __cplusplus
|
---|
3470 | }
|
---|
3471 | #endif\
|
---|
3472 | "
|
---|
3473 | } # !$opt_dry_run
|
---|
3474 |
|
---|
3475 | pic_flag_for_symtable=
|
---|
3476 | case "$compile_command " in
|
---|
3477 | *" -static "*) ;;
|
---|
3478 | *)
|
---|
3479 | case $host in
|
---|
3480 | # compiling the symbol table file with pic_flag works around
|
---|
3481 | # a FreeBSD bug that causes programs to crash when -lm is
|
---|
3482 | # linked before any other PIC object. But we must not use
|
---|
3483 | # pic_flag when linking with -static. The problem exists in
|
---|
3484 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
---|
3485 | *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
---|
3486 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
|
---|
3487 | *-*-hpux*)
|
---|
3488 | pic_flag_for_symtable=" $pic_flag" ;;
|
---|
3489 | *)
|
---|
3490 | if test "X$my_pic_p" != Xno; then
|
---|
3491 | pic_flag_for_symtable=" $pic_flag"
|
---|
3492 | fi
|
---|
3493 | ;;
|
---|
3494 | esac
|
---|
3495 | ;;
|
---|
3496 | esac
|
---|
3497 | symtab_cflags=
|
---|
3498 | for arg in $LTCFLAGS; do
|
---|
3499 | case $arg in
|
---|
3500 | -pie | -fpie | -fPIE) ;;
|
---|
3501 | *) func_append symtab_cflags " $arg" ;;
|
---|
3502 | esac
|
---|
3503 | done
|
---|
3504 |
|
---|
3505 | # Now compile the dynamic symbol file.
|
---|
3506 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
|
---|
3507 |
|
---|
3508 | # Clean up the generated files.
|
---|
3509 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
|
---|
3510 |
|
---|
3511 | # Transform the symbol file into the correct name.
|
---|
3512 | symfileobj="$output_objdir/${my_outputname}S.$objext"
|
---|
3513 | case $host in
|
---|
3514 | *cygwin* | *mingw* | *cegcc* )
|
---|
3515 | if test -f "$output_objdir/$my_outputname.def"; then
|
---|
3516 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
---|
3517 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
---|
3518 | else
|
---|
3519 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
---|
3520 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
---|
3521 | fi
|
---|
3522 | ;;
|
---|
3523 | *)
|
---|
3524 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
---|
3525 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
---|
3526 | ;;
|
---|
3527 | esac
|
---|
3528 | ;;
|
---|
3529 | *)
|
---|
3530 | func_fatal_error "unknown suffix for \`$my_dlsyms'"
|
---|
3531 | ;;
|
---|
3532 | esac
|
---|
3533 | else
|
---|
3534 | # We keep going just in case the user didn't refer to
|
---|
3535 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
|
---|
3536 | # really was required.
|
---|
3537 |
|
---|
3538 | # Nullify the symbol file.
|
---|
3539 | compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
|
---|
3540 | finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
|
---|
3541 | fi
|
---|
3542 | }
|
---|
3543 |
|
---|
3544 | # func_win32_libid arg
|
---|
3545 | # return the library type of file 'arg'
|
---|
3546 | #
|
---|
3547 | # Need a lot of goo to handle *both* DLLs and import libs
|
---|
3548 | # Has to be a shell function in order to 'eat' the argument
|
---|
3549 | # that is supplied when $file_magic_command is called.
|
---|
3550 | # Despite the name, also deal with 64 bit binaries.
|
---|
3551 | func_win32_libid ()
|
---|
3552 | {
|
---|
3553 | $opt_debug
|
---|
3554 | win32_libid_type="unknown"
|
---|
3555 | win32_fileres=`file -L $1 2>/dev/null`
|
---|
3556 | case $win32_fileres in
|
---|
3557 | *ar\ archive\ import\ library*) # definitely import
|
---|
3558 | win32_libid_type="x86 archive import"
|
---|
3559 | ;;
|
---|
3560 | *ar\ archive*) # could be an import, or static
|
---|
3561 | # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
|
---|
3562 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
|
---|
3563 | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
|
---|
3564 | func_to_tool_file "$1" func_convert_file_msys_to_w32
|
---|
3565 | win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
|
---|
3566 | $SED -n -e '
|
---|
3567 | 1,100{
|
---|
3568 | / I /{
|
---|
3569 | s,.*,import,
|
---|
3570 | p
|
---|
3571 | q
|
---|
3572 | }
|
---|
3573 | }'`
|
---|
3574 | case $win32_nmres in
|
---|
3575 | import*) win32_libid_type="x86 archive import";;
|
---|
3576 | *) win32_libid_type="x86 archive static";;
|
---|
3577 | esac
|
---|
3578 | fi
|
---|
3579 | ;;
|
---|
3580 | *DLL*)
|
---|
3581 | win32_libid_type="x86 DLL"
|
---|
3582 | ;;
|
---|
3583 | *executable*) # but shell scripts are "executable" too...
|
---|
3584 | case $win32_fileres in
|
---|
3585 | *MS\ Windows\ PE\ Intel*)
|
---|
3586 | win32_libid_type="x86 DLL"
|
---|
3587 | ;;
|
---|
3588 | esac
|
---|
3589 | ;;
|
---|
3590 | esac
|
---|
3591 | $ECHO "$win32_libid_type"
|
---|
3592 | }
|
---|
3593 |
|
---|
3594 | # func_cygming_dll_for_implib ARG
|
---|
3595 | #
|
---|
3596 | # Platform-specific function to extract the
|
---|
3597 | # name of the DLL associated with the specified
|
---|
3598 | # import library ARG.
|
---|
3599 | # Invoked by eval'ing the libtool variable
|
---|
3600 | # $sharedlib_from_linklib_cmd
|
---|
3601 | # Result is available in the variable
|
---|
3602 | # $sharedlib_from_linklib_result
|
---|
3603 | func_cygming_dll_for_implib ()
|
---|
3604 | {
|
---|
3605 | $opt_debug
|
---|
3606 | sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
|
---|
3607 | }
|
---|
3608 |
|
---|
3609 | # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
|
---|
3610 | #
|
---|
3611 | # The is the core of a fallback implementation of a
|
---|
3612 | # platform-specific function to extract the name of the
|
---|
3613 | # DLL associated with the specified import library LIBNAME.
|
---|
3614 | #
|
---|
3615 | # SECTION_NAME is either .idata$6 or .idata$7, depending
|
---|
3616 | # on the platform and compiler that created the implib.
|
---|
3617 | #
|
---|
3618 | # Echos the name of the DLL associated with the
|
---|
3619 | # specified import library.
|
---|
3620 | func_cygming_dll_for_implib_fallback_core ()
|
---|
3621 | {
|
---|
3622 | $opt_debug
|
---|
3623 | match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
|
---|
3624 | $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
|
---|
3625 | $SED '/^Contents of section '"$match_literal"':/{
|
---|
3626 | # Place marker at beginning of archive member dllname section
|
---|
3627 | s/.*/====MARK====/
|
---|
3628 | p
|
---|
3629 | d
|
---|
3630 | }
|
---|
3631 | # These lines can sometimes be longer than 43 characters, but
|
---|
3632 | # are always uninteresting
|
---|
3633 | /:[ ]*file format pe[i]\{,1\}-/d
|
---|
3634 | /^In archive [^:]*:/d
|
---|
3635 | # Ensure marker is printed
|
---|
3636 | /^====MARK====/p
|
---|
3637 | # Remove all lines with less than 43 characters
|
---|
3638 | /^.\{43\}/!d
|
---|
3639 | # From remaining lines, remove first 43 characters
|
---|
3640 | s/^.\{43\}//' |
|
---|
3641 | $SED -n '
|
---|
3642 | # Join marker and all lines until next marker into a single line
|
---|
3643 | /^====MARK====/ b para
|
---|
3644 | H
|
---|
3645 | $ b para
|
---|
3646 | b
|
---|
3647 | :para
|
---|
3648 | x
|
---|
3649 | s/\n//g
|
---|
3650 | # Remove the marker
|
---|
3651 | s/^====MARK====//
|
---|
3652 | # Remove trailing dots and whitespace
|
---|
3653 | s/[\. \t]*$//
|
---|
3654 | # Print
|
---|
3655 | /./p' |
|
---|
3656 | # we now have a list, one entry per line, of the stringified
|
---|
3657 | # contents of the appropriate section of all members of the
|
---|
3658 | # archive which possess that section. Heuristic: eliminate
|
---|
3659 | # all those which have a first or second character that is
|
---|
3660 | # a '.' (that is, objdump's representation of an unprintable
|
---|
3661 | # character.) This should work for all archives with less than
|
---|
3662 | # 0x302f exports -- but will fail for DLLs whose name actually
|
---|
3663 | # begins with a literal '.' or a single character followed by
|
---|
3664 | # a '.'.
|
---|
3665 | #
|
---|
3666 | # Of those that remain, print the first one.
|
---|
3667 | $SED -e '/^\./d;/^.\./d;q'
|
---|
3668 | }
|
---|
3669 |
|
---|
3670 | # func_cygming_gnu_implib_p ARG
|
---|
3671 | # This predicate returns with zero status (TRUE) if
|
---|
3672 | # ARG is a GNU/binutils-style import library. Returns
|
---|
3673 | # with nonzero status (FALSE) otherwise.
|
---|
3674 | func_cygming_gnu_implib_p ()
|
---|
3675 | {
|
---|
3676 | $opt_debug
|
---|
3677 | func_to_tool_file "$1" func_convert_file_msys_to_w32
|
---|
3678 | func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
|
---|
3679 | test -n "$func_cygming_gnu_implib_tmp"
|
---|
3680 | }
|
---|
3681 |
|
---|
3682 | # func_cygming_ms_implib_p ARG
|
---|
3683 | # This predicate returns with zero status (TRUE) if
|
---|
3684 | # ARG is an MS-style import library. Returns
|
---|
3685 | # with nonzero status (FALSE) otherwise.
|
---|
3686 | func_cygming_ms_implib_p ()
|
---|
3687 | {
|
---|
3688 | $opt_debug
|
---|
3689 | func_to_tool_file "$1" func_convert_file_msys_to_w32
|
---|
3690 | func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
|
---|
3691 | test -n "$func_cygming_ms_implib_tmp"
|
---|
3692 | }
|
---|
3693 |
|
---|
3694 | # func_cygming_dll_for_implib_fallback ARG
|
---|
3695 | # Platform-specific function to extract the
|
---|
3696 | # name of the DLL associated with the specified
|
---|
3697 | # import library ARG.
|
---|
3698 | #
|
---|
3699 | # This fallback implementation is for use when $DLLTOOL
|
---|
3700 | # does not support the --identify-strict option.
|
---|
3701 | # Invoked by eval'ing the libtool variable
|
---|
3702 | # $sharedlib_from_linklib_cmd
|
---|
3703 | # Result is available in the variable
|
---|
3704 | # $sharedlib_from_linklib_result
|
---|
3705 | func_cygming_dll_for_implib_fallback ()
|
---|
3706 | {
|
---|
3707 | $opt_debug
|
---|
3708 | if func_cygming_gnu_implib_p "$1" ; then
|
---|
3709 | # binutils import library
|
---|
3710 | sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
|
---|
3711 | elif func_cygming_ms_implib_p "$1" ; then
|
---|
3712 | # ms-generated import library
|
---|
3713 | sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
|
---|
3714 | else
|
---|
3715 | # unknown
|
---|
3716 | sharedlib_from_linklib_result=""
|
---|
3717 | fi
|
---|
3718 | }
|
---|
3719 |
|
---|
3720 |
|
---|
3721 | # func_extract_an_archive dir oldlib
|
---|
3722 | func_extract_an_archive ()
|
---|
3723 | {
|
---|
3724 | $opt_debug
|
---|
3725 | f_ex_an_ar_dir="$1"; shift
|
---|
3726 | f_ex_an_ar_oldlib="$1"
|
---|
3727 | if test "$lock_old_archive_extraction" = yes; then
|
---|
3728 | lockfile=$f_ex_an_ar_oldlib.lock
|
---|
3729 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
|
---|
3730 | func_echo "Waiting for $lockfile to be removed"
|
---|
3731 | sleep 2
|
---|
3732 | done
|
---|
3733 | fi
|
---|
3734 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
|
---|
3735 | 'stat=$?; rm -f "$lockfile"; exit $stat'
|
---|
3736 | if test "$lock_old_archive_extraction" = yes; then
|
---|
3737 | $opt_dry_run || rm -f "$lockfile"
|
---|
3738 | fi
|
---|
3739 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
|
---|
3740 | :
|
---|
3741 | else
|
---|
3742 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
|
---|
3743 | fi
|
---|
3744 | }
|
---|
3745 |
|
---|
3746 |
|
---|
3747 | # func_extract_archives gentop oldlib ...
|
---|
3748 | func_extract_archives ()
|
---|
3749 | {
|
---|
3750 | $opt_debug
|
---|
3751 | my_gentop="$1"; shift
|
---|
3752 | my_oldlibs=${1+"$@"}
|
---|
3753 | my_oldobjs=""
|
---|
3754 | my_xlib=""
|
---|
3755 | my_xabs=""
|
---|
3756 | my_xdir=""
|
---|
3757 |
|
---|
3758 | for my_xlib in $my_oldlibs; do
|
---|
3759 | # Extract the objects.
|
---|
3760 | case $my_xlib in
|
---|
3761 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
|
---|
3762 | *) my_xabs=`pwd`"/$my_xlib" ;;
|
---|
3763 | esac
|
---|
3764 | func_basename "$my_xlib"
|
---|
3765 | my_xlib="$func_basename_result"
|
---|
3766 | my_xlib_u=$my_xlib
|
---|
3767 | while :; do
|
---|
3768 | case " $extracted_archives " in
|
---|
3769 | *" $my_xlib_u "*)
|
---|
3770 | func_arith $extracted_serial + 1
|
---|
3771 | extracted_serial=$func_arith_result
|
---|
3772 | my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
---|
3773 | *) break ;;
|
---|
3774 | esac
|
---|
3775 | done
|
---|
3776 | extracted_archives="$extracted_archives $my_xlib_u"
|
---|
3777 | my_xdir="$my_gentop/$my_xlib_u"
|
---|
3778 |
|
---|
3779 | func_mkdir_p "$my_xdir"
|
---|
3780 |
|
---|
3781 | case $host in
|
---|
3782 | *-darwin*)
|
---|
3783 | func_verbose "Extracting $my_xabs"
|
---|
3784 | # Do not bother doing anything if just a dry run
|
---|
3785 | $opt_dry_run || {
|
---|
3786 | darwin_orig_dir=`pwd`
|
---|
3787 | cd $my_xdir || exit $?
|
---|
3788 | darwin_archive=$my_xabs
|
---|
3789 | darwin_curdir=`pwd`
|
---|
3790 | darwin_base_archive=`basename "$darwin_archive"`
|
---|
3791 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
|
---|
3792 | if test -n "$darwin_arches"; then
|
---|
3793 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
|
---|
3794 | darwin_arch=
|
---|
3795 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
|
---|
3796 | for darwin_arch in $darwin_arches ; do
|
---|
3797 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
|
---|
3798 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
|
---|
3799 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
|
---|
3800 | func_extract_an_archive "`pwd`" "${darwin_base_archive}"
|
---|
3801 | cd "$darwin_curdir"
|
---|
3802 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
|
---|
3803 | done # $darwin_arches
|
---|
3804 | ## Okay now we've a bunch of thin objects, gotta fatten them up :)
|
---|
3805 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
|
---|
3806 | darwin_file=
|
---|
3807 | darwin_files=
|
---|
3808 | for darwin_file in $darwin_filelist; do
|
---|
3809 | darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
|
---|
3810 | $LIPO -create -output "$darwin_file" $darwin_files
|
---|
3811 | done # $darwin_filelist
|
---|
3812 | $RM -rf unfat-$$
|
---|
3813 | cd "$darwin_orig_dir"
|
---|
3814 | else
|
---|
3815 | cd $darwin_orig_dir
|
---|
3816 | func_extract_an_archive "$my_xdir" "$my_xabs"
|
---|
3817 | fi # $darwin_arches
|
---|
3818 | } # !$opt_dry_run
|
---|
3819 | ;;
|
---|
3820 | *)
|
---|
3821 | func_extract_an_archive "$my_xdir" "$my_xabs"
|
---|
3822 | ;;
|
---|
3823 | esac
|
---|
3824 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
|
---|
3825 | done
|
---|
3826 |
|
---|
3827 | func_extract_archives_result="$my_oldobjs"
|
---|
3828 | }
|
---|
3829 |
|
---|
3830 |
|
---|
3831 | # func_emit_wrapper [arg=no]
|
---|
3832 | #
|
---|
3833 | # Emit a libtool wrapper script on stdout.
|
---|
3834 | # Don't directly open a file because we may want to
|
---|
3835 | # incorporate the script contents within a cygwin/mingw
|
---|
3836 | # wrapper executable. Must ONLY be called from within
|
---|
3837 | # func_mode_link because it depends on a number of variables
|
---|
3838 | # set therein.
|
---|
3839 | #
|
---|
3840 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
|
---|
3841 | # variable will take. If 'yes', then the emitted script
|
---|
3842 | # will assume that the directory in which it is stored is
|
---|
3843 | # the $objdir directory. This is a cygwin/mingw-specific
|
---|
3844 | # behavior.
|
---|
3845 | func_emit_wrapper ()
|
---|
3846 | {
|
---|
3847 | func_emit_wrapper_arg1=${1-no}
|
---|
3848 |
|
---|
3849 | $ECHO "\
|
---|
3850 | #! $SHELL
|
---|
3851 |
|
---|
3852 | # $output - temporary wrapper script for $objdir/$outputname
|
---|
3853 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
---|
3854 | #
|
---|
3855 | # The $output program cannot be directly executed until all the libtool
|
---|
3856 | # libraries that it depends on are installed.
|
---|
3857 | #
|
---|
3858 | # This wrapper script should never be moved out of the build directory.
|
---|
3859 | # If it is, it will not operate correctly.
|
---|
3860 |
|
---|
3861 | # Sed substitution that helps us do robust quoting. It backslashifies
|
---|
3862 | # metacharacters that are still active within double-quoted strings.
|
---|
3863 | sed_quote_subst='$sed_quote_subst'
|
---|
3864 |
|
---|
3865 | # Be Bourne compatible
|
---|
3866 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
---|
3867 | emulate sh
|
---|
3868 | NULLCMD=:
|
---|
3869 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
|
---|
3870 | # is contrary to our usage. Disable this feature.
|
---|
3871 | alias -g '\${1+\"\$@\"}'='\"\$@\"'
|
---|
3872 | setopt NO_GLOB_SUBST
|
---|
3873 | else
|
---|
3874 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
---|
3875 | fi
|
---|
3876 | BIN_SH=xpg4; export BIN_SH # for Tru64
|
---|
3877 | DUALCASE=1; export DUALCASE # for MKS sh
|
---|
3878 |
|
---|
3879 | # The HP-UX ksh and POSIX shell print the target directory to stdout
|
---|
3880 | # if CDPATH is set.
|
---|
3881 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
---|
3882 |
|
---|
3883 | relink_command=\"$relink_command\"
|
---|
3884 |
|
---|
3885 | # This environment variable determines our operation mode.
|
---|
3886 | if test \"\$libtool_install_magic\" = \"$magic\"; then
|
---|
3887 | # install mode needs the following variables:
|
---|
3888 | generated_by_libtool_version='$macro_version'
|
---|
3889 | notinst_deplibs='$notinst_deplibs'
|
---|
3890 | else
|
---|
3891 | # When we are sourced in execute mode, \$file and \$ECHO are already set.
|
---|
3892 | if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
---|
3893 | file=\"\$0\""
|
---|
3894 |
|
---|
3895 | qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
|
---|
3896 | $ECHO "\
|
---|
3897 |
|
---|
3898 | # A function that is used when there is no print builtin or printf.
|
---|
3899 | func_fallback_echo ()
|
---|
3900 | {
|
---|
3901 | eval 'cat <<_LTECHO_EOF
|
---|
3902 | \$1
|
---|
3903 | _LTECHO_EOF'
|
---|
3904 | }
|
---|
3905 | ECHO=\"$qECHO\"
|
---|
3906 | fi
|
---|
3907 |
|
---|
3908 | # Very basic option parsing. These options are (a) specific to
|
---|
3909 | # the libtool wrapper, (b) are identical between the wrapper
|
---|
3910 | # /script/ and the wrapper /executable/ which is used only on
|
---|
3911 | # windows platforms, and (c) all begin with the string "--lt-"
|
---|
3912 | # (application programs are unlikely to have options which match
|
---|
3913 | # this pattern).
|
---|
3914 | #
|
---|
3915 | # There are only two supported options: --lt-debug and
|
---|
3916 | # --lt-dump-script. There is, deliberately, no --lt-help.
|
---|
3917 | #
|
---|
3918 | # The first argument to this parsing function should be the
|
---|
3919 | # script's $0 value, followed by "$@".
|
---|
3920 | lt_option_debug=
|
---|
3921 | func_parse_lt_options ()
|
---|
3922 | {
|
---|
3923 | lt_script_arg0=\$0
|
---|
3924 | shift
|
---|
3925 | for lt_opt
|
---|
3926 | do
|
---|
3927 | case \"\$lt_opt\" in
|
---|
3928 | --lt-debug) lt_option_debug=1 ;;
|
---|
3929 | --lt-dump-script)
|
---|
3930 | lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
|
---|
3931 | test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
|
---|
3932 | lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
|
---|
3933 | cat \"\$lt_dump_D/\$lt_dump_F\"
|
---|
3934 | exit 0
|
---|
3935 | ;;
|
---|
3936 | --lt-*)
|
---|
3937 | \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
|
---|
3938 | exit 1
|
---|
3939 | ;;
|
---|
3940 | esac
|
---|
3941 | done
|
---|
3942 |
|
---|
3943 | # Print the debug banner immediately:
|
---|
3944 | if test -n \"\$lt_option_debug\"; then
|
---|
3945 | echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
|
---|
3946 | fi
|
---|
3947 | }
|
---|
3948 |
|
---|
3949 | # Used when --lt-debug. Prints its arguments to stdout
|
---|
3950 | # (redirection is the responsibility of the caller)
|
---|
3951 | func_lt_dump_args ()
|
---|
3952 | {
|
---|
3953 | lt_dump_args_N=1;
|
---|
3954 | for lt_arg
|
---|
3955 | do
|
---|
3956 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
|
---|
3957 | lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
|
---|
3958 | done
|
---|
3959 | }
|
---|
3960 |
|
---|
3961 | # Core function for launching the target application
|
---|
3962 | func_exec_program_core ()
|
---|
3963 | {
|
---|
3964 | "
|
---|
3965 | case $host in
|
---|
3966 | # Backslashes separate directories on plain windows
|
---|
3967 | *-*-mingw | *-*-os2* | *-cegcc*)
|
---|
3968 | $ECHO "\
|
---|
3969 | if test -n \"\$lt_option_debug\"; then
|
---|
3970 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
|
---|
3971 | func_lt_dump_args \${1+\"\$@\"} 1>&2
|
---|
3972 | fi
|
---|
3973 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
|
---|
3974 | "
|
---|
3975 | ;;
|
---|
3976 |
|
---|
3977 | *)
|
---|
3978 | $ECHO "\
|
---|
3979 | if test -n \"\$lt_option_debug\"; then
|
---|
3980 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
|
---|
3981 | func_lt_dump_args \${1+\"\$@\"} 1>&2
|
---|
3982 | fi
|
---|
3983 | exec \"\$progdir/\$program\" \${1+\"\$@\"}
|
---|
3984 | "
|
---|
3985 | ;;
|
---|
3986 | esac
|
---|
3987 | $ECHO "\
|
---|
3988 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
|
---|
3989 | exit 1
|
---|
3990 | }
|
---|
3991 |
|
---|
3992 | # A function to encapsulate launching the target application
|
---|
3993 | # Strips options in the --lt-* namespace from \$@ and
|
---|
3994 | # launches target application with the remaining arguments.
|
---|
3995 | func_exec_program ()
|
---|
3996 | {
|
---|
3997 | case \" \$* \" in
|
---|
3998 | *\\ --lt-*)
|
---|
3999 | for lt_wr_arg
|
---|
4000 | do
|
---|
4001 | case \$lt_wr_arg in
|
---|
4002 | --lt-*) ;;
|
---|
4003 | *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
|
---|
4004 | esac
|
---|
4005 | shift
|
---|
4006 | done ;;
|
---|
4007 | esac
|
---|
4008 | func_exec_program_core \${1+\"\$@\"}
|
---|
4009 | }
|
---|
4010 |
|
---|
4011 | # Parse options
|
---|
4012 | func_parse_lt_options \"\$0\" \${1+\"\$@\"}
|
---|
4013 |
|
---|
4014 | # Find the directory that this script lives in.
|
---|
4015 | thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
|
---|
4016 | test \"x\$thisdir\" = \"x\$file\" && thisdir=.
|
---|
4017 |
|
---|
4018 | # Follow symbolic links until we get to the real thisdir.
|
---|
4019 | file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
|
---|
4020 | while test -n \"\$file\"; do
|
---|
4021 | destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
|
---|
4022 |
|
---|
4023 | # If there was a directory component, then change thisdir.
|
---|
4024 | if test \"x\$destdir\" != \"x\$file\"; then
|
---|
4025 | case \"\$destdir\" in
|
---|
4026 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
|
---|
4027 | *) thisdir=\"\$thisdir/\$destdir\" ;;
|
---|
4028 | esac
|
---|
4029 | fi
|
---|
4030 |
|
---|
4031 | file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
|
---|
4032 | file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
|
---|
4033 | done
|
---|
4034 |
|
---|
4035 | # Usually 'no', except on cygwin/mingw when embedded into
|
---|
4036 | # the cwrapper.
|
---|
4037 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
|
---|
4038 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
|
---|
4039 | # special case for '.'
|
---|
4040 | if test \"\$thisdir\" = \".\"; then
|
---|
4041 | thisdir=\`pwd\`
|
---|
4042 | fi
|
---|
4043 | # remove .libs from thisdir
|
---|
4044 | case \"\$thisdir\" in
|
---|
4045 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
|
---|
4046 | $objdir ) thisdir=. ;;
|
---|
4047 | esac
|
---|
4048 | fi
|
---|
4049 |
|
---|
4050 | # Try to get the absolute directory name.
|
---|
4051 | absdir=\`cd \"\$thisdir\" && pwd\`
|
---|
4052 | test -n \"\$absdir\" && thisdir=\"\$absdir\"
|
---|
4053 | "
|
---|
4054 |
|
---|
4055 | if test "$fast_install" = yes; then
|
---|
4056 | $ECHO "\
|
---|
4057 | program=lt-'$outputname'$exeext
|
---|
4058 | progdir=\"\$thisdir/$objdir\"
|
---|
4059 |
|
---|
4060 | if test ! -f \"\$progdir/\$program\" ||
|
---|
4061 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
|
---|
4062 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then
|
---|
4063 |
|
---|
4064 | file=\"\$\$-\$program\"
|
---|
4065 |
|
---|
4066 | if test ! -d \"\$progdir\"; then
|
---|
4067 | $MKDIR \"\$progdir\"
|
---|
4068 | else
|
---|
4069 | $RM \"\$progdir/\$file\"
|
---|
4070 | fi"
|
---|
4071 |
|
---|
4072 | $ECHO "\
|
---|
4073 |
|
---|
4074 | # relink executable if necessary
|
---|
4075 | if test -n \"\$relink_command\"; then
|
---|
4076 | if relink_command_output=\`eval \$relink_command 2>&1\`; then :
|
---|
4077 | else
|
---|
4078 | $ECHO \"\$relink_command_output\" >&2
|
---|
4079 | $RM \"\$progdir/\$file\"
|
---|
4080 | exit 1
|
---|
4081 | fi
|
---|
4082 | fi
|
---|
4083 |
|
---|
4084 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
|
---|
4085 | { $RM \"\$progdir/\$program\";
|
---|
4086 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
|
---|
4087 | $RM \"\$progdir/\$file\"
|
---|
4088 | fi"
|
---|
4089 | else
|
---|
4090 | $ECHO "\
|
---|
4091 | program='$outputname'
|
---|
4092 | progdir=\"\$thisdir/$objdir\"
|
---|
4093 | "
|
---|
4094 | fi
|
---|
4095 |
|
---|
4096 | $ECHO "\
|
---|
4097 |
|
---|
4098 | if test -f \"\$progdir/\$program\"; then"
|
---|
4099 |
|
---|
4100 | # fixup the dll searchpath if we need to.
|
---|
4101 | #
|
---|
4102 | # Fix the DLL searchpath if we need to. Do this before prepending
|
---|
4103 | # to shlibpath, because on Windows, both are PATH and uninstalled
|
---|
4104 | # libraries must come first.
|
---|
4105 | if test -n "$dllsearchpath"; then
|
---|
4106 | $ECHO "\
|
---|
4107 | # Add the dll search path components to the executable PATH
|
---|
4108 | PATH=$dllsearchpath:\$PATH
|
---|
4109 | "
|
---|
4110 | fi
|
---|
4111 |
|
---|
4112 | # Export our shlibpath_var if we have one.
|
---|
4113 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
---|
4114 | $ECHO "\
|
---|
4115 | # Add our own library path to $shlibpath_var
|
---|
4116 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
|
---|
4117 |
|
---|
4118 | # Some systems cannot cope with colon-terminated $shlibpath_var
|
---|
4119 | # The second colon is a workaround for a bug in BeOS R4 sed
|
---|
4120 | $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
|
---|
4121 |
|
---|
4122 | export $shlibpath_var
|
---|
4123 | "
|
---|
4124 | fi
|
---|
4125 |
|
---|
4126 | $ECHO "\
|
---|
4127 | if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
---|
4128 | # Run the actual program with our arguments.
|
---|
4129 | func_exec_program \${1+\"\$@\"}
|
---|
4130 | fi
|
---|
4131 | else
|
---|
4132 | # The program doesn't exist.
|
---|
4133 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
|
---|
4134 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
|
---|
4135 | \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
|
---|
4136 | exit 1
|
---|
4137 | fi
|
---|
4138 | fi\
|
---|
4139 | "
|
---|
4140 | }
|
---|
4141 |
|
---|
4142 |
|
---|
4143 | # func_emit_cwrapperexe_src
|
---|
4144 | # emit the source code for a wrapper executable on stdout
|
---|
4145 | # Must ONLY be called from within func_mode_link because
|
---|
4146 | # it depends on a number of variable set therein.
|
---|
4147 | func_emit_cwrapperexe_src ()
|
---|
4148 | {
|
---|
4149 | cat <<EOF
|
---|
4150 |
|
---|
4151 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
|
---|
4152 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
---|
4153 |
|
---|
4154 | The $output program cannot be directly executed until all the libtool
|
---|
4155 | libraries that it depends on are installed.
|
---|
4156 |
|
---|
4157 | This wrapper executable should never be moved out of the build directory.
|
---|
4158 | If it is, it will not operate correctly.
|
---|
4159 | */
|
---|
4160 | EOF
|
---|
4161 | cat <<"EOF"
|
---|
4162 | #ifdef _MSC_VER
|
---|
4163 | # define _CRT_SECURE_NO_DEPRECATE 1
|
---|
4164 | #endif
|
---|
4165 | #include <stdio.h>
|
---|
4166 | #include <stdlib.h>
|
---|
4167 | #ifdef _MSC_VER
|
---|
4168 | # include <direct.h>
|
---|
4169 | # include <process.h>
|
---|
4170 | # include <io.h>
|
---|
4171 | #else
|
---|
4172 | # include <unistd.h>
|
---|
4173 | # include <stdint.h>
|
---|
4174 | # ifdef __CYGWIN__
|
---|
4175 | # include <io.h>
|
---|
4176 | # endif
|
---|
4177 | #endif
|
---|
4178 | #include <malloc.h>
|
---|
4179 | #include <stdarg.h>
|
---|
4180 | #include <assert.h>
|
---|
4181 | #include <string.h>
|
---|
4182 | #include <ctype.h>
|
---|
4183 | #include <errno.h>
|
---|
4184 | #include <fcntl.h>
|
---|
4185 | #include <sys/stat.h>
|
---|
4186 |
|
---|
4187 | /* declarations of non-ANSI functions */
|
---|
4188 | #if defined(__MINGW32__)
|
---|
4189 | # ifdef __STRICT_ANSI__
|
---|
4190 | int _putenv (const char *);
|
---|
4191 | # endif
|
---|
4192 | #elif defined(__CYGWIN__)
|
---|
4193 | # ifdef __STRICT_ANSI__
|
---|
4194 | char *realpath (const char *, char *);
|
---|
4195 | int putenv (char *);
|
---|
4196 | int setenv (const char *, const char *, int);
|
---|
4197 | # endif
|
---|
4198 | /* #elif defined (other platforms) ... */
|
---|
4199 | #endif
|
---|
4200 |
|
---|
4201 | /* portability defines, excluding path handling macros */
|
---|
4202 | #if defined(_MSC_VER)
|
---|
4203 | # define setmode _setmode
|
---|
4204 | # define stat _stat
|
---|
4205 | # define chmod _chmod
|
---|
4206 | # define getcwd _getcwd
|
---|
4207 | # define putenv _putenv
|
---|
4208 | # define S_IXUSR _S_IEXEC
|
---|
4209 | # ifndef _INTPTR_T_DEFINED
|
---|
4210 | # define _INTPTR_T_DEFINED
|
---|
4211 | # define intptr_t int
|
---|
4212 | # endif
|
---|
4213 | #elif defined(__MINGW32__)
|
---|
4214 | # define setmode _setmode
|
---|
4215 | # define stat _stat
|
---|
4216 | # define chmod _chmod
|
---|
4217 | # define getcwd _getcwd
|
---|
4218 | # define putenv _putenv
|
---|
4219 | #elif defined(__CYGWIN__)
|
---|
4220 | # define HAVE_SETENV
|
---|
4221 | # define FOPEN_WB "wb"
|
---|
4222 | /* #elif defined (other platforms) ... */
|
---|
4223 | #endif
|
---|
4224 |
|
---|
4225 | #if defined(PATH_MAX)
|
---|
4226 | # define LT_PATHMAX PATH_MAX
|
---|
4227 | #elif defined(MAXPATHLEN)
|
---|
4228 | # define LT_PATHMAX MAXPATHLEN
|
---|
4229 | #else
|
---|
4230 | # define LT_PATHMAX 1024
|
---|
4231 | #endif
|
---|
4232 |
|
---|
4233 | #ifndef S_IXOTH
|
---|
4234 | # define S_IXOTH 0
|
---|
4235 | #endif
|
---|
4236 | #ifndef S_IXGRP
|
---|
4237 | # define S_IXGRP 0
|
---|
4238 | #endif
|
---|
4239 |
|
---|
4240 | /* path handling portability macros */
|
---|
4241 | #ifndef DIR_SEPARATOR
|
---|
4242 | # define DIR_SEPARATOR '/'
|
---|
4243 | # define PATH_SEPARATOR ':'
|
---|
4244 | #endif
|
---|
4245 |
|
---|
4246 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
|
---|
4247 | defined (__OS2__)
|
---|
4248 | # define HAVE_DOS_BASED_FILE_SYSTEM
|
---|
4249 | # define FOPEN_WB "wb"
|
---|
4250 | # ifndef DIR_SEPARATOR_2
|
---|
4251 | # define DIR_SEPARATOR_2 '\\'
|
---|
4252 | # endif
|
---|
4253 | # ifndef PATH_SEPARATOR_2
|
---|
4254 | # define PATH_SEPARATOR_2 ';'
|
---|
4255 | # endif
|
---|
4256 | #endif
|
---|
4257 |
|
---|
4258 | #ifndef DIR_SEPARATOR_2
|
---|
4259 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
|
---|
4260 | #else /* DIR_SEPARATOR_2 */
|
---|
4261 | # define IS_DIR_SEPARATOR(ch) \
|
---|
4262 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
|
---|
4263 | #endif /* DIR_SEPARATOR_2 */
|
---|
4264 |
|
---|
4265 | #ifndef PATH_SEPARATOR_2
|
---|
4266 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
|
---|
4267 | #else /* PATH_SEPARATOR_2 */
|
---|
4268 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
|
---|
4269 | #endif /* PATH_SEPARATOR_2 */
|
---|
4270 |
|
---|
4271 | #ifndef FOPEN_WB
|
---|
4272 | # define FOPEN_WB "w"
|
---|
4273 | #endif
|
---|
4274 | #ifndef _O_BINARY
|
---|
4275 | # define _O_BINARY 0
|
---|
4276 | #endif
|
---|
4277 |
|
---|
4278 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
|
---|
4279 | #define XFREE(stale) do { \
|
---|
4280 | if (stale) { free ((void *) stale); stale = 0; } \
|
---|
4281 | } while (0)
|
---|
4282 |
|
---|
4283 | #if defined(LT_DEBUGWRAPPER)
|
---|
4284 | static int lt_debug = 1;
|
---|
4285 | #else
|
---|
4286 | static int lt_debug = 0;
|
---|
4287 | #endif
|
---|
4288 |
|
---|
4289 | const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
|
---|
4290 |
|
---|
4291 | void *xmalloc (size_t num);
|
---|
4292 | char *xstrdup (const char *string);
|
---|
4293 | const char *base_name (const char *name);
|
---|
4294 | char *find_executable (const char *wrapper);
|
---|
4295 | char *chase_symlinks (const char *pathspec);
|
---|
4296 | int make_executable (const char *path);
|
---|
4297 | int check_executable (const char *path);
|
---|
4298 | char *strendzap (char *str, const char *pat);
|
---|
4299 | void lt_debugprintf (const char *file, int line, const char *fmt, ...);
|
---|
4300 | void lt_fatal (const char *file, int line, const char *message, ...);
|
---|
4301 | static const char *nonnull (const char *s);
|
---|
4302 | static const char *nonempty (const char *s);
|
---|
4303 | void lt_setenv (const char *name, const char *value);
|
---|
4304 | char *lt_extend_str (const char *orig_value, const char *add, int to_end);
|
---|
4305 | void lt_update_exe_path (const char *name, const char *value);
|
---|
4306 | void lt_update_lib_path (const char *name, const char *value);
|
---|
4307 | char **prepare_spawn (char **argv);
|
---|
4308 | void lt_dump_script (FILE *f);
|
---|
4309 | EOF
|
---|
4310 |
|
---|
4311 | cat <<EOF
|
---|
4312 | volatile const char * MAGIC_EXE = "$magic_exe";
|
---|
4313 | const char * LIB_PATH_VARNAME = "$shlibpath_var";
|
---|
4314 | EOF
|
---|
4315 |
|
---|
4316 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
---|
4317 | func_to_host_path "$temp_rpath"
|
---|
4318 | cat <<EOF
|
---|
4319 | const char * LIB_PATH_VALUE = "$func_to_host_path_result";
|
---|
4320 | EOF
|
---|
4321 | else
|
---|
4322 | cat <<"EOF"
|
---|
4323 | const char * LIB_PATH_VALUE = "";
|
---|
4324 | EOF
|
---|
4325 | fi
|
---|
4326 |
|
---|
4327 | if test -n "$dllsearchpath"; then
|
---|
4328 | func_to_host_path "$dllsearchpath:"
|
---|
4329 | cat <<EOF
|
---|
4330 | const char * EXE_PATH_VARNAME = "PATH";
|
---|
4331 | const char * EXE_PATH_VALUE = "$func_to_host_path_result";
|
---|
4332 | EOF
|
---|
4333 | else
|
---|
4334 | cat <<"EOF"
|
---|
4335 | const char * EXE_PATH_VARNAME = "";
|
---|
4336 | const char * EXE_PATH_VALUE = "";
|
---|
4337 | EOF
|
---|
4338 | fi
|
---|
4339 |
|
---|
4340 | if test "$fast_install" = yes; then
|
---|
4341 | cat <<EOF
|
---|
4342 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
|
---|
4343 | EOF
|
---|
4344 | else
|
---|
4345 | cat <<EOF
|
---|
4346 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
|
---|
4347 | EOF
|
---|
4348 | fi
|
---|
4349 |
|
---|
4350 |
|
---|
4351 | cat <<"EOF"
|
---|
4352 |
|
---|
4353 | #define LTWRAPPER_OPTION_PREFIX "--lt-"
|
---|
4354 |
|
---|
4355 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
|
---|
4356 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
|
---|
4357 | static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
|
---|
4358 |
|
---|
4359 | int
|
---|
4360 | main (int argc, char *argv[])
|
---|
4361 | {
|
---|
4362 | char **newargz;
|
---|
4363 | int newargc;
|
---|
4364 | char *tmp_pathspec;
|
---|
4365 | char *actual_cwrapper_path;
|
---|
4366 | char *actual_cwrapper_name;
|
---|
4367 | char *target_name;
|
---|
4368 | char *lt_argv_zero;
|
---|
4369 | intptr_t rval = 127;
|
---|
4370 |
|
---|
4371 | int i;
|
---|
4372 |
|
---|
4373 | program_name = (char *) xstrdup (base_name (argv[0]));
|
---|
4374 | newargz = XMALLOC (char *, argc + 1);
|
---|
4375 |
|
---|
4376 | /* very simple arg parsing; don't want to rely on getopt
|
---|
4377 | * also, copy all non cwrapper options to newargz, except
|
---|
4378 | * argz[0], which is handled differently
|
---|
4379 | */
|
---|
4380 | newargc=0;
|
---|
4381 | for (i = 1; i < argc; i++)
|
---|
4382 | {
|
---|
4383 | if (strcmp (argv[i], dumpscript_opt) == 0)
|
---|
4384 | {
|
---|
4385 | EOF
|
---|
4386 | case "$host" in
|
---|
4387 | *mingw* | *cygwin* )
|
---|
4388 | # make stdout use "unix" line endings
|
---|
4389 | echo " setmode(1,_O_BINARY);"
|
---|
4390 | ;;
|
---|
4391 | esac
|
---|
4392 |
|
---|
4393 | cat <<"EOF"
|
---|
4394 | lt_dump_script (stdout);
|
---|
4395 | return 0;
|
---|
4396 | }
|
---|
4397 | if (strcmp (argv[i], debug_opt) == 0)
|
---|
4398 | {
|
---|
4399 | lt_debug = 1;
|
---|
4400 | continue;
|
---|
4401 | }
|
---|
4402 | if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
|
---|
4403 | {
|
---|
4404 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
|
---|
4405 | namespace, but it is not one of the ones we know about and
|
---|
4406 | have already dealt with, above (inluding dump-script), then
|
---|
4407 | report an error. Otherwise, targets might begin to believe
|
---|
4408 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
|
---|
4409 | namespace. The first time any user complains about this, we'll
|
---|
4410 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option
|
---|
4411 | or a configure.ac-settable value.
|
---|
4412 | */
|
---|
4413 | lt_fatal (__FILE__, __LINE__,
|
---|
4414 | "unrecognized %s option: '%s'",
|
---|
4415 | ltwrapper_option_prefix, argv[i]);
|
---|
4416 | }
|
---|
4417 | /* otherwise ... */
|
---|
4418 | newargz[++newargc] = xstrdup (argv[i]);
|
---|
4419 | }
|
---|
4420 | newargz[++newargc] = NULL;
|
---|
4421 |
|
---|
4422 | EOF
|
---|
4423 | cat <<EOF
|
---|
4424 | /* The GNU banner must be the first non-error debug message */
|
---|
4425 | lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
|
---|
4426 | EOF
|
---|
4427 | cat <<"EOF"
|
---|
4428 | lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
|
---|
4429 | lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
|
---|
4430 |
|
---|
4431 | tmp_pathspec = find_executable (argv[0]);
|
---|
4432 | if (tmp_pathspec == NULL)
|
---|
4433 | lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
|
---|
4434 | lt_debugprintf (__FILE__, __LINE__,
|
---|
4435 | "(main) found exe (before symlink chase) at: %s\n",
|
---|
4436 | tmp_pathspec);
|
---|
4437 |
|
---|
4438 | actual_cwrapper_path = chase_symlinks (tmp_pathspec);
|
---|
4439 | lt_debugprintf (__FILE__, __LINE__,
|
---|
4440 | "(main) found exe (after symlink chase) at: %s\n",
|
---|
4441 | actual_cwrapper_path);
|
---|
4442 | XFREE (tmp_pathspec);
|
---|
4443 |
|
---|
4444 | actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
|
---|
4445 | strendzap (actual_cwrapper_path, actual_cwrapper_name);
|
---|
4446 |
|
---|
4447 | /* wrapper name transforms */
|
---|
4448 | strendzap (actual_cwrapper_name, ".exe");
|
---|
4449 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
|
---|
4450 | XFREE (actual_cwrapper_name);
|
---|
4451 | actual_cwrapper_name = tmp_pathspec;
|
---|
4452 | tmp_pathspec = 0;
|
---|
4453 |
|
---|
4454 | /* target_name transforms -- use actual target program name; might have lt- prefix */
|
---|
4455 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
|
---|
4456 | strendzap (target_name, ".exe");
|
---|
4457 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
|
---|
4458 | XFREE (target_name);
|
---|
4459 | target_name = tmp_pathspec;
|
---|
4460 | tmp_pathspec = 0;
|
---|
4461 |
|
---|
4462 | lt_debugprintf (__FILE__, __LINE__,
|
---|
4463 | "(main) libtool target name: %s\n",
|
---|
4464 | target_name);
|
---|
4465 | EOF
|
---|
4466 |
|
---|
4467 | cat <<EOF
|
---|
4468 | newargz[0] =
|
---|
4469 | XMALLOC (char, (strlen (actual_cwrapper_path) +
|
---|
4470 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
|
---|
4471 | strcpy (newargz[0], actual_cwrapper_path);
|
---|
4472 | strcat (newargz[0], "$objdir");
|
---|
4473 | strcat (newargz[0], "/");
|
---|
4474 | EOF
|
---|
4475 |
|
---|
4476 | cat <<"EOF"
|
---|
4477 | /* stop here, and copy so we don't have to do this twice */
|
---|
4478 | tmp_pathspec = xstrdup (newargz[0]);
|
---|
4479 |
|
---|
4480 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
|
---|
4481 | strcat (newargz[0], actual_cwrapper_name);
|
---|
4482 |
|
---|
4483 | /* DO want the lt- prefix here if it exists, so use target_name */
|
---|
4484 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
|
---|
4485 | XFREE (tmp_pathspec);
|
---|
4486 | tmp_pathspec = NULL;
|
---|
4487 | EOF
|
---|
4488 |
|
---|
4489 | case $host_os in
|
---|
4490 | mingw*)
|
---|
4491 | cat <<"EOF"
|
---|
4492 | {
|
---|
4493 | char* p;
|
---|
4494 | while ((p = strchr (newargz[0], '\\')) != NULL)
|
---|
4495 | {
|
---|
4496 | *p = '/';
|
---|
4497 | }
|
---|
4498 | while ((p = strchr (lt_argv_zero, '\\')) != NULL)
|
---|
4499 | {
|
---|
4500 | *p = '/';
|
---|
4501 | }
|
---|
4502 | }
|
---|
4503 | EOF
|
---|
4504 | ;;
|
---|
4505 | esac
|
---|
4506 |
|
---|
4507 | cat <<"EOF"
|
---|
4508 | XFREE (target_name);
|
---|
4509 | XFREE (actual_cwrapper_path);
|
---|
4510 | XFREE (actual_cwrapper_name);
|
---|
4511 |
|
---|
4512 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
|
---|
4513 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */
|
---|
4514 | /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
|
---|
4515 | be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
|
---|
4516 | because on Windows, both *_VARNAMEs are PATH but uninstalled
|
---|
4517 | libraries must come first. */
|
---|
4518 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
|
---|
4519 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
|
---|
4520 |
|
---|
4521 | lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
|
---|
4522 | nonnull (lt_argv_zero));
|
---|
4523 | for (i = 0; i < newargc; i++)
|
---|
4524 | {
|
---|
4525 | lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
|
---|
4526 | i, nonnull (newargz[i]));
|
---|
4527 | }
|
---|
4528 |
|
---|
4529 | EOF
|
---|
4530 |
|
---|
4531 | case $host_os in
|
---|
4532 | mingw*)
|
---|
4533 | cat <<"EOF"
|
---|
4534 | /* execv doesn't actually work on mingw as expected on unix */
|
---|
4535 | newargz = prepare_spawn (newargz);
|
---|
4536 | rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
|
---|
4537 | if (rval == -1)
|
---|
4538 | {
|
---|
4539 | /* failed to start process */
|
---|
4540 | lt_debugprintf (__FILE__, __LINE__,
|
---|
4541 | "(main) failed to launch target \"%s\": %s\n",
|
---|
4542 | lt_argv_zero, nonnull (strerror (errno)));
|
---|
4543 | return 127;
|
---|
4544 | }
|
---|
4545 | return rval;
|
---|
4546 | EOF
|
---|
4547 | ;;
|
---|
4548 | *)
|
---|
4549 | cat <<"EOF"
|
---|
4550 | execv (lt_argv_zero, newargz);
|
---|
4551 | return rval; /* =127, but avoids unused variable warning */
|
---|
4552 | EOF
|
---|
4553 | ;;
|
---|
4554 | esac
|
---|
4555 |
|
---|
4556 | cat <<"EOF"
|
---|
4557 | }
|
---|
4558 |
|
---|
4559 | void *
|
---|
4560 | xmalloc (size_t num)
|
---|
4561 | {
|
---|
4562 | void *p = (void *) malloc (num);
|
---|
4563 | if (!p)
|
---|
4564 | lt_fatal (__FILE__, __LINE__, "memory exhausted");
|
---|
4565 |
|
---|
4566 | return p;
|
---|
4567 | }
|
---|
4568 |
|
---|
4569 | char *
|
---|
4570 | xstrdup (const char *string)
|
---|
4571 | {
|
---|
4572 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
|
---|
4573 | string) : NULL;
|
---|
4574 | }
|
---|
4575 |
|
---|
4576 | const char *
|
---|
4577 | base_name (const char *name)
|
---|
4578 | {
|
---|
4579 | const char *base;
|
---|
4580 |
|
---|
4581 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
---|
4582 | /* Skip over the disk name in MSDOS pathnames. */
|
---|
4583 | if (isalpha ((unsigned char) name[0]) && name[1] == ':')
|
---|
4584 | name += 2;
|
---|
4585 | #endif
|
---|
4586 |
|
---|
4587 | for (base = name; *name; name++)
|
---|
4588 | if (IS_DIR_SEPARATOR (*name))
|
---|
4589 | base = name + 1;
|
---|
4590 | return base;
|
---|
4591 | }
|
---|
4592 |
|
---|
4593 | int
|
---|
4594 | check_executable (const char *path)
|
---|
4595 | {
|
---|
4596 | struct stat st;
|
---|
4597 |
|
---|
4598 | lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
|
---|
4599 | nonempty (path));
|
---|
4600 | if ((!path) || (!*path))
|
---|
4601 | return 0;
|
---|
4602 |
|
---|
4603 | if ((stat (path, &st) >= 0)
|
---|
4604 | && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
---|
4605 | return 1;
|
---|
4606 | else
|
---|
4607 | return 0;
|
---|
4608 | }
|
---|
4609 |
|
---|
4610 | int
|
---|
4611 | make_executable (const char *path)
|
---|
4612 | {
|
---|
4613 | int rval = 0;
|
---|
4614 | struct stat st;
|
---|
4615 |
|
---|
4616 | lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
|
---|
4617 | nonempty (path));
|
---|
4618 | if ((!path) || (!*path))
|
---|
4619 | return 0;
|
---|
4620 |
|
---|
4621 | if (stat (path, &st) >= 0)
|
---|
4622 | {
|
---|
4623 | rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
|
---|
4624 | }
|
---|
4625 | return rval;
|
---|
4626 | }
|
---|
4627 |
|
---|
4628 | /* Searches for the full path of the wrapper. Returns
|
---|
4629 | newly allocated full path name if found, NULL otherwise
|
---|
4630 | Does not chase symlinks, even on platforms that support them.
|
---|
4631 | */
|
---|
4632 | char *
|
---|
4633 | find_executable (const char *wrapper)
|
---|
4634 | {
|
---|
4635 | int has_slash = 0;
|
---|
4636 | const char *p;
|
---|
4637 | const char *p_next;
|
---|
4638 | /* static buffer for getcwd */
|
---|
4639 | char tmp[LT_PATHMAX + 1];
|
---|
4640 | int tmp_len;
|
---|
4641 | char *concat_name;
|
---|
4642 |
|
---|
4643 | lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
|
---|
4644 | nonempty (wrapper));
|
---|
4645 |
|
---|
4646 | if ((wrapper == NULL) || (*wrapper == '\0'))
|
---|
4647 | return NULL;
|
---|
4648 |
|
---|
4649 | /* Absolute path? */
|
---|
4650 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
---|
4651 | if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
|
---|
4652 | {
|
---|
4653 | concat_name = xstrdup (wrapper);
|
---|
4654 | if (check_executable (concat_name))
|
---|
4655 | return concat_name;
|
---|
4656 | XFREE (concat_name);
|
---|
4657 | }
|
---|
4658 | else
|
---|
4659 | {
|
---|
4660 | #endif
|
---|
4661 | if (IS_DIR_SEPARATOR (wrapper[0]))
|
---|
4662 | {
|
---|
4663 | concat_name = xstrdup (wrapper);
|
---|
4664 | if (check_executable (concat_name))
|
---|
4665 | return concat_name;
|
---|
4666 | XFREE (concat_name);
|
---|
4667 | }
|
---|
4668 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
---|
4669 | }
|
---|
4670 | #endif
|
---|
4671 |
|
---|
4672 | for (p = wrapper; *p; p++)
|
---|
4673 | if (*p == '/')
|
---|
4674 | {
|
---|
4675 | has_slash = 1;
|
---|
4676 | break;
|
---|
4677 | }
|
---|
4678 | if (!has_slash)
|
---|
4679 | {
|
---|
4680 | /* no slashes; search PATH */
|
---|
4681 | const char *path = getenv ("PATH");
|
---|
4682 | if (path != NULL)
|
---|
4683 | {
|
---|
4684 | for (p = path; *p; p = p_next)
|
---|
4685 | {
|
---|
4686 | const char *q;
|
---|
4687 | size_t p_len;
|
---|
4688 | for (q = p; *q; q++)
|
---|
4689 | if (IS_PATH_SEPARATOR (*q))
|
---|
4690 | break;
|
---|
4691 | p_len = q - p;
|
---|
4692 | p_next = (*q == '\0' ? q : q + 1);
|
---|
4693 | if (p_len == 0)
|
---|
4694 | {
|
---|
4695 | /* empty path: current directory */
|
---|
4696 | if (getcwd (tmp, LT_PATHMAX) == NULL)
|
---|
4697 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
|
---|
4698 | nonnull (strerror (errno)));
|
---|
4699 | tmp_len = strlen (tmp);
|
---|
4700 | concat_name =
|
---|
4701 | XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
---|
4702 | memcpy (concat_name, tmp, tmp_len);
|
---|
4703 | concat_name[tmp_len] = '/';
|
---|
4704 | strcpy (concat_name + tmp_len + 1, wrapper);
|
---|
4705 | }
|
---|
4706 | else
|
---|
4707 | {
|
---|
4708 | concat_name =
|
---|
4709 | XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
|
---|
4710 | memcpy (concat_name, p, p_len);
|
---|
4711 | concat_name[p_len] = '/';
|
---|
4712 | strcpy (concat_name + p_len + 1, wrapper);
|
---|
4713 | }
|
---|
4714 | if (check_executable (concat_name))
|
---|
4715 | return concat_name;
|
---|
4716 | XFREE (concat_name);
|
---|
4717 | }
|
---|
4718 | }
|
---|
4719 | /* not found in PATH; assume curdir */
|
---|
4720 | }
|
---|
4721 | /* Relative path | not found in path: prepend cwd */
|
---|
4722 | if (getcwd (tmp, LT_PATHMAX) == NULL)
|
---|
4723 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
|
---|
4724 | nonnull (strerror (errno)));
|
---|
4725 | tmp_len = strlen (tmp);
|
---|
4726 | concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
---|
4727 | memcpy (concat_name, tmp, tmp_len);
|
---|
4728 | concat_name[tmp_len] = '/';
|
---|
4729 | strcpy (concat_name + tmp_len + 1, wrapper);
|
---|
4730 |
|
---|
4731 | if (check_executable (concat_name))
|
---|
4732 | return concat_name;
|
---|
4733 | XFREE (concat_name);
|
---|
4734 | return NULL;
|
---|
4735 | }
|
---|
4736 |
|
---|
4737 | char *
|
---|
4738 | chase_symlinks (const char *pathspec)
|
---|
4739 | {
|
---|
4740 | #ifndef S_ISLNK
|
---|
4741 | return xstrdup (pathspec);
|
---|
4742 | #else
|
---|
4743 | char buf[LT_PATHMAX];
|
---|
4744 | struct stat s;
|
---|
4745 | char *tmp_pathspec = xstrdup (pathspec);
|
---|
4746 | char *p;
|
---|
4747 | int has_symlinks = 0;
|
---|
4748 | while (strlen (tmp_pathspec) && !has_symlinks)
|
---|
4749 | {
|
---|
4750 | lt_debugprintf (__FILE__, __LINE__,
|
---|
4751 | "checking path component for symlinks: %s\n",
|
---|
4752 | tmp_pathspec);
|
---|
4753 | if (lstat (tmp_pathspec, &s) == 0)
|
---|
4754 | {
|
---|
4755 | if (S_ISLNK (s.st_mode) != 0)
|
---|
4756 | {
|
---|
4757 | has_symlinks = 1;
|
---|
4758 | break;
|
---|
4759 | }
|
---|
4760 |
|
---|
4761 | /* search backwards for last DIR_SEPARATOR */
|
---|
4762 | p = tmp_pathspec + strlen (tmp_pathspec) - 1;
|
---|
4763 | while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
---|
4764 | p--;
|
---|
4765 | if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
---|
4766 | {
|
---|
4767 | /* no more DIR_SEPARATORS left */
|
---|
4768 | break;
|
---|
4769 | }
|
---|
4770 | *p = '\0';
|
---|
4771 | }
|
---|
4772 | else
|
---|
4773 | {
|
---|
4774 | lt_fatal (__FILE__, __LINE__,
|
---|
4775 | "error accessing file \"%s\": %s",
|
---|
4776 | tmp_pathspec, nonnull (strerror (errno)));
|
---|
4777 | }
|
---|
4778 | }
|
---|
4779 | XFREE (tmp_pathspec);
|
---|
4780 |
|
---|
4781 | if (!has_symlinks)
|
---|
4782 | {
|
---|
4783 | return xstrdup (pathspec);
|
---|
4784 | }
|
---|
4785 |
|
---|
4786 | tmp_pathspec = realpath (pathspec, buf);
|
---|
4787 | if (tmp_pathspec == 0)
|
---|
4788 | {
|
---|
4789 | lt_fatal (__FILE__, __LINE__,
|
---|
4790 | "could not follow symlinks for %s", pathspec);
|
---|
4791 | }
|
---|
4792 | return xstrdup (tmp_pathspec);
|
---|
4793 | #endif
|
---|
4794 | }
|
---|
4795 |
|
---|
4796 | char *
|
---|
4797 | strendzap (char *str, const char *pat)
|
---|
4798 | {
|
---|
4799 | size_t len, patlen;
|
---|
4800 |
|
---|
4801 | assert (str != NULL);
|
---|
4802 | assert (pat != NULL);
|
---|
4803 |
|
---|
4804 | len = strlen (str);
|
---|
4805 | patlen = strlen (pat);
|
---|
4806 |
|
---|
4807 | if (patlen <= len)
|
---|
4808 | {
|
---|
4809 | str += len - patlen;
|
---|
4810 | if (strcmp (str, pat) == 0)
|
---|
4811 | *str = '\0';
|
---|
4812 | }
|
---|
4813 | return str;
|
---|
4814 | }
|
---|
4815 |
|
---|
4816 | void
|
---|
4817 | lt_debugprintf (const char *file, int line, const char *fmt, ...)
|
---|
4818 | {
|
---|
4819 | va_list args;
|
---|
4820 | if (lt_debug)
|
---|
4821 | {
|
---|
4822 | (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
|
---|
4823 | va_start (args, fmt);
|
---|
4824 | (void) vfprintf (stderr, fmt, args);
|
---|
4825 | va_end (args);
|
---|
4826 | }
|
---|
4827 | }
|
---|
4828 |
|
---|
4829 | static void
|
---|
4830 | lt_error_core (int exit_status, const char *file,
|
---|
4831 | int line, const char *mode,
|
---|
4832 | const char *message, va_list ap)
|
---|
4833 | {
|
---|
4834 | fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
|
---|
4835 | vfprintf (stderr, message, ap);
|
---|
4836 | fprintf (stderr, ".\n");
|
---|
4837 |
|
---|
4838 | if (exit_status >= 0)
|
---|
4839 | exit (exit_status);
|
---|
4840 | }
|
---|
4841 |
|
---|
4842 | void
|
---|
4843 | lt_fatal (const char *file, int line, const char *message, ...)
|
---|
4844 | {
|
---|
4845 | va_list ap;
|
---|
4846 | va_start (ap, message);
|
---|
4847 | lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
|
---|
4848 | va_end (ap);
|
---|
4849 | }
|
---|
4850 |
|
---|
4851 | static const char *
|
---|
4852 | nonnull (const char *s)
|
---|
4853 | {
|
---|
4854 | return s ? s : "(null)";
|
---|
4855 | }
|
---|
4856 |
|
---|
4857 | static const char *
|
---|
4858 | nonempty (const char *s)
|
---|
4859 | {
|
---|
4860 | return (s && !*s) ? "(empty)" : nonnull (s);
|
---|
4861 | }
|
---|
4862 |
|
---|
4863 | void
|
---|
4864 | lt_setenv (const char *name, const char *value)
|
---|
4865 | {
|
---|
4866 | lt_debugprintf (__FILE__, __LINE__,
|
---|
4867 | "(lt_setenv) setting '%s' to '%s'\n",
|
---|
4868 | nonnull (name), nonnull (value));
|
---|
4869 | {
|
---|
4870 | #ifdef HAVE_SETENV
|
---|
4871 | /* always make a copy, for consistency with !HAVE_SETENV */
|
---|
4872 | char *str = xstrdup (value);
|
---|
4873 | setenv (name, str, 1);
|
---|
4874 | #else
|
---|
4875 | int len = strlen (name) + 1 + strlen (value) + 1;
|
---|
4876 | char *str = XMALLOC (char, len);
|
---|
4877 | sprintf (str, "%s=%s", name, value);
|
---|
4878 | if (putenv (str) != EXIT_SUCCESS)
|
---|
4879 | {
|
---|
4880 | XFREE (str);
|
---|
4881 | }
|
---|
4882 | #endif
|
---|
4883 | }
|
---|
4884 | }
|
---|
4885 |
|
---|
4886 | char *
|
---|
4887 | lt_extend_str (const char *orig_value, const char *add, int to_end)
|
---|
4888 | {
|
---|
4889 | char *new_value;
|
---|
4890 | if (orig_value && *orig_value)
|
---|
4891 | {
|
---|
4892 | int orig_value_len = strlen (orig_value);
|
---|
4893 | int add_len = strlen (add);
|
---|
4894 | new_value = XMALLOC (char, add_len + orig_value_len + 1);
|
---|
4895 | if (to_end)
|
---|
4896 | {
|
---|
4897 | strcpy (new_value, orig_value);
|
---|
4898 | strcpy (new_value + orig_value_len, add);
|
---|
4899 | }
|
---|
4900 | else
|
---|
4901 | {
|
---|
4902 | strcpy (new_value, add);
|
---|
4903 | strcpy (new_value + add_len, orig_value);
|
---|
4904 | }
|
---|
4905 | }
|
---|
4906 | else
|
---|
4907 | {
|
---|
4908 | new_value = xstrdup (add);
|
---|
4909 | }
|
---|
4910 | return new_value;
|
---|
4911 | }
|
---|
4912 |
|
---|
4913 | void
|
---|
4914 | lt_update_exe_path (const char *name, const char *value)
|
---|
4915 | {
|
---|
4916 | lt_debugprintf (__FILE__, __LINE__,
|
---|
4917 | "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
|
---|
4918 | nonnull (name), nonnull (value));
|
---|
4919 |
|
---|
4920 | if (name && *name && value && *value)
|
---|
4921 | {
|
---|
4922 | char *new_value = lt_extend_str (getenv (name), value, 0);
|
---|
4923 | /* some systems can't cope with a ':'-terminated path #' */
|
---|
4924 | int len = strlen (new_value);
|
---|
4925 | while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
|
---|
4926 | {
|
---|
4927 | new_value[len-1] = '\0';
|
---|
4928 | }
|
---|
4929 | lt_setenv (name, new_value);
|
---|
4930 | XFREE (new_value);
|
---|
4931 | }
|
---|
4932 | }
|
---|
4933 |
|
---|
4934 | void
|
---|
4935 | lt_update_lib_path (const char *name, const char *value)
|
---|
4936 | {
|
---|
4937 | lt_debugprintf (__FILE__, __LINE__,
|
---|
4938 | "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
|
---|
4939 | nonnull (name), nonnull (value));
|
---|
4940 |
|
---|
4941 | if (name && *name && value && *value)
|
---|
4942 | {
|
---|
4943 | char *new_value = lt_extend_str (getenv (name), value, 0);
|
---|
4944 | lt_setenv (name, new_value);
|
---|
4945 | XFREE (new_value);
|
---|
4946 | }
|
---|
4947 | }
|
---|
4948 |
|
---|
4949 | EOF
|
---|
4950 | case $host_os in
|
---|
4951 | mingw*)
|
---|
4952 | cat <<"EOF"
|
---|
4953 |
|
---|
4954 | /* Prepares an argument vector before calling spawn().
|
---|
4955 | Note that spawn() does not by itself call the command interpreter
|
---|
4956 | (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
|
---|
4957 | ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
---|
4958 | GetVersionEx(&v);
|
---|
4959 | v.dwPlatformId == VER_PLATFORM_WIN32_NT;
|
---|
4960 | }) ? "cmd.exe" : "command.com").
|
---|
4961 | Instead it simply concatenates the arguments, separated by ' ', and calls
|
---|
4962 | CreateProcess(). We must quote the arguments since Win32 CreateProcess()
|
---|
4963 | interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
|
---|
4964 | special way:
|
---|
4965 | - Space and tab are interpreted as delimiters. They are not treated as
|
---|
4966 | delimiters if they are surrounded by double quotes: "...".
|
---|
4967 | - Unescaped double quotes are removed from the input. Their only effect is
|
---|
4968 | that within double quotes, space and tab are treated like normal
|
---|
4969 | characters.
|
---|
4970 | - Backslashes not followed by double quotes are not special.
|
---|
4971 | - But 2*n+1 backslashes followed by a double quote become
|
---|
4972 | n backslashes followed by a double quote (n >= 0):
|
---|
4973 | \" -> "
|
---|
4974 | \\\" -> \"
|
---|
4975 | \\\\\" -> \\"
|
---|
4976 | */
|
---|
4977 | #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"
|
---|
4978 | #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"
|
---|
4979 | char **
|
---|
4980 | prepare_spawn (char **argv)
|
---|
4981 | {
|
---|
4982 | size_t argc;
|
---|
4983 | char **new_argv;
|
---|
4984 | size_t i;
|
---|
4985 |
|
---|
4986 | /* Count number of arguments. */
|
---|
4987 | for (argc = 0; argv[argc] != NULL; argc++)
|
---|
4988 | ;
|
---|
4989 |
|
---|
4990 | /* Allocate new argument vector. */
|
---|
4991 | new_argv = XMALLOC (char *, argc + 1);
|
---|
4992 |
|
---|
4993 | /* Put quoted arguments into the new argument vector. */
|
---|
4994 | for (i = 0; i < argc; i++)
|
---|
4995 | {
|
---|
4996 | const char *string = argv[i];
|
---|
4997 |
|
---|
4998 | if (string[0] == '\0')
|
---|
4999 | new_argv[i] = xstrdup ("\"\"");
|
---|
5000 | else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
|
---|
5001 | {
|
---|
5002 | int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
|
---|
5003 | size_t length;
|
---|
5004 | unsigned int backslashes;
|
---|
5005 | const char *s;
|
---|
5006 | char *quoted_string;
|
---|
5007 | char *p;
|
---|
5008 |
|
---|
5009 | length = 0;
|
---|
5010 | backslashes = 0;
|
---|
5011 | if (quote_around)
|
---|
5012 | length++;
|
---|
5013 | for (s = string; *s != '\0'; s++)
|
---|
5014 | {
|
---|
5015 | char c = *s;
|
---|
5016 | if (c == '"')
|
---|
5017 | length += backslashes + 1;
|
---|
5018 | length++;
|
---|
5019 | if (c == '\\')
|
---|
5020 | backslashes++;
|
---|
5021 | else
|
---|
5022 | backslashes = 0;
|
---|
5023 | }
|
---|
5024 | if (quote_around)
|
---|
5025 | length += backslashes + 1;
|
---|
5026 |
|
---|
5027 | quoted_string = XMALLOC (char, length + 1);
|
---|
5028 |
|
---|
5029 | p = quoted_string;
|
---|
5030 | backslashes = 0;
|
---|
5031 | if (quote_around)
|
---|
5032 | *p++ = '"';
|
---|
5033 | for (s = string; *s != '\0'; s++)
|
---|
5034 | {
|
---|
5035 | char c = *s;
|
---|
5036 | if (c == '"')
|
---|
5037 | {
|
---|
5038 | unsigned int j;
|
---|
5039 | for (j = backslashes + 1; j > 0; j--)
|
---|
5040 | *p++ = '\\';
|
---|
5041 | }
|
---|
5042 | *p++ = c;
|
---|
5043 | if (c == '\\')
|
---|
5044 | backslashes++;
|
---|
5045 | else
|
---|
5046 | backslashes = 0;
|
---|
5047 | }
|
---|
5048 | if (quote_around)
|
---|
5049 | {
|
---|
5050 | unsigned int j;
|
---|
5051 | for (j = backslashes; j > 0; j--)
|
---|
5052 | *p++ = '\\';
|
---|
5053 | *p++ = '"';
|
---|
5054 | }
|
---|
5055 | *p = '\0';
|
---|
5056 |
|
---|
5057 | new_argv[i] = quoted_string;
|
---|
5058 | }
|
---|
5059 | else
|
---|
5060 | new_argv[i] = (char *) string;
|
---|
5061 | }
|
---|
5062 | new_argv[argc] = NULL;
|
---|
5063 |
|
---|
5064 | return new_argv;
|
---|
5065 | }
|
---|
5066 | EOF
|
---|
5067 | ;;
|
---|
5068 | esac
|
---|
5069 |
|
---|
5070 | cat <<"EOF"
|
---|
5071 | void lt_dump_script (FILE* f)
|
---|
5072 | {
|
---|
5073 | EOF
|
---|
5074 | func_emit_wrapper yes |
|
---|
5075 | $SED -n -e '
|
---|
5076 | s/^\(.\{79\}\)\(..*\)/\1\
|
---|
5077 | \2/
|
---|
5078 | h
|
---|
5079 | s/\([\\"]\)/\\\1/g
|
---|
5080 | s/$/\\n/
|
---|
5081 | s/\([^\n]*\).*/ fputs ("\1", f);/p
|
---|
5082 | g
|
---|
5083 | D'
|
---|
5084 | cat <<"EOF"
|
---|
5085 | }
|
---|
5086 | EOF
|
---|
5087 | }
|
---|
5088 | # end: func_emit_cwrapperexe_src
|
---|
5089 |
|
---|
5090 | # func_win32_import_lib_p ARG
|
---|
5091 | # True if ARG is an import lib, as indicated by $file_magic_cmd
|
---|
5092 | func_win32_import_lib_p ()
|
---|
5093 | {
|
---|
5094 | $opt_debug
|
---|
5095 | case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
|
---|
5096 | *import*) : ;;
|
---|
5097 | *) false ;;
|
---|
5098 | esac
|
---|
5099 | }
|
---|
5100 |
|
---|
5101 | # func_mode_link arg...
|
---|
5102 | func_mode_link ()
|
---|
5103 | {
|
---|
5104 | $opt_debug
|
---|
5105 | case $host in
|
---|
5106 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
---|
5107 | # It is impossible to link a dll without this setting, and
|
---|
5108 | # we shouldn't force the makefile maintainer to figure out
|
---|
5109 | # which system we are compiling for in order to pass an extra
|
---|
5110 | # flag for every libtool invocation.
|
---|
5111 | # allow_undefined=no
|
---|
5112 |
|
---|
5113 | # FIXME: Unfortunately, there are problems with the above when trying
|
---|
5114 | # to make a dll which has undefined symbols, in which case not
|
---|
5115 | # even a static library is built. For now, we need to specify
|
---|
5116 | # -no-undefined on the libtool link line when we can be certain
|
---|
5117 | # that all symbols are satisfied, otherwise we get a static library.
|
---|
5118 | allow_undefined=yes
|
---|
5119 | ;;
|
---|
5120 | *)
|
---|
5121 | allow_undefined=yes
|
---|
5122 | ;;
|
---|
5123 | esac
|
---|
5124 | libtool_args=$nonopt
|
---|
5125 | base_compile="$nonopt $@"
|
---|
5126 | compile_command=$nonopt
|
---|
5127 | finalize_command=$nonopt
|
---|
5128 |
|
---|
5129 | compile_rpath=
|
---|
5130 | finalize_rpath=
|
---|
5131 | compile_shlibpath=
|
---|
5132 | finalize_shlibpath=
|
---|
5133 | convenience=
|
---|
5134 | old_convenience=
|
---|
5135 | deplibs=
|
---|
5136 | old_deplibs=
|
---|
5137 | compiler_flags=
|
---|
5138 | linker_flags=
|
---|
5139 | dllsearchpath=
|
---|
5140 | lib_search_path=`pwd`
|
---|
5141 | inst_prefix_dir=
|
---|
5142 | new_inherited_linker_flags=
|
---|
5143 |
|
---|
5144 | avoid_version=no
|
---|
5145 | bindir=
|
---|
5146 | dlfiles=
|
---|
5147 | dlprefiles=
|
---|
5148 | dlself=no
|
---|
5149 | export_dynamic=no
|
---|
5150 | export_symbols=
|
---|
5151 | export_symbols_regex=
|
---|
5152 | generated=
|
---|
5153 | libobjs=
|
---|
5154 | ltlibs=
|
---|
5155 | module=no
|
---|
5156 | no_install=no
|
---|
5157 | objs=
|
---|
5158 | non_pic_objects=
|
---|
5159 | precious_files_regex=
|
---|
5160 | prefer_static_libs=no
|
---|
5161 | preload=no
|
---|
5162 | prev=
|
---|
5163 | prevarg=
|
---|
5164 | release=
|
---|
5165 | rpath=
|
---|
5166 | xrpath=
|
---|
5167 | perm_rpath=
|
---|
5168 | temp_rpath=
|
---|
5169 | thread_safe=no
|
---|
5170 | vinfo=
|
---|
5171 | vinfo_number=no
|
---|
5172 | weak_libs=
|
---|
5173 | single_module="${wl}-single_module"
|
---|
5174 | func_infer_tag $base_compile
|
---|
5175 |
|
---|
5176 | # We need to know -static, to get the right output filenames.
|
---|
5177 | for arg
|
---|
5178 | do
|
---|
5179 | case $arg in
|
---|
5180 | -shared)
|
---|
5181 | test "$build_libtool_libs" != yes && \
|
---|
5182 | func_fatal_configuration "can not build a shared library"
|
---|
5183 | build_old_libs=no
|
---|
5184 | break
|
---|
5185 | ;;
|
---|
5186 | -all-static | -static | -static-libtool-libs)
|
---|
5187 | case $arg in
|
---|
5188 | -all-static)
|
---|
5189 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
|
---|
5190 | func_warning "complete static linking is impossible in this configuration"
|
---|
5191 | fi
|
---|
5192 | if test -n "$link_static_flag"; then
|
---|
5193 | dlopen_self=$dlopen_self_static
|
---|
5194 | fi
|
---|
5195 | prefer_static_libs=yes
|
---|
5196 | ;;
|
---|
5197 | -static)
|
---|
5198 | if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
---|
5199 | dlopen_self=$dlopen_self_static
|
---|
5200 | fi
|
---|
5201 | prefer_static_libs=built
|
---|
5202 | ;;
|
---|
5203 | -static-libtool-libs)
|
---|
5204 | if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
---|
5205 | dlopen_self=$dlopen_self_static
|
---|
5206 | fi
|
---|
5207 | prefer_static_libs=yes
|
---|
5208 | ;;
|
---|
5209 | esac
|
---|
5210 | build_libtool_libs=no
|
---|
5211 | build_old_libs=yes
|
---|
5212 | break
|
---|
5213 | ;;
|
---|
5214 | esac
|
---|
5215 | done
|
---|
5216 |
|
---|
5217 | # See if our shared archives depend on static archives.
|
---|
5218 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes
|
---|
5219 |
|
---|
5220 | # Go through the arguments, transforming them on the way.
|
---|
5221 | while test "$#" -gt 0; do
|
---|
5222 | arg="$1"
|
---|
5223 | shift
|
---|
5224 | func_quote_for_eval "$arg"
|
---|
5225 | qarg=$func_quote_for_eval_unquoted_result
|
---|
5226 | func_append libtool_args " $func_quote_for_eval_result"
|
---|
5227 |
|
---|
5228 | # If the previous option needs an argument, assign it.
|
---|
5229 | if test -n "$prev"; then
|
---|
5230 | case $prev in
|
---|
5231 | output)
|
---|
5232 | func_append compile_command " @OUTPUT@"
|
---|
5233 | func_append finalize_command " @OUTPUT@"
|
---|
5234 | ;;
|
---|
5235 | esac
|
---|
5236 |
|
---|
5237 | case $prev in
|
---|
5238 | bindir)
|
---|
5239 | bindir="$arg"
|
---|
5240 | prev=
|
---|
5241 | continue
|
---|
5242 | ;;
|
---|
5243 | dlfiles|dlprefiles)
|
---|
5244 | if test "$preload" = no; then
|
---|
5245 | # Add the symbol object into the linking commands.
|
---|
5246 | func_append compile_command " @SYMFILE@"
|
---|
5247 | func_append finalize_command " @SYMFILE@"
|
---|
5248 | preload=yes
|
---|
5249 | fi
|
---|
5250 | case $arg in
|
---|
5251 | *.la | *.lo) ;; # We handle these cases below.
|
---|
5252 | force)
|
---|
5253 | if test "$dlself" = no; then
|
---|
5254 | dlself=needless
|
---|
5255 | export_dynamic=yes
|
---|
5256 | fi
|
---|
5257 | prev=
|
---|
5258 | continue
|
---|
5259 | ;;
|
---|
5260 | self)
|
---|
5261 | if test "$prev" = dlprefiles; then
|
---|
5262 | dlself=yes
|
---|
5263 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
|
---|
5264 | dlself=yes
|
---|
5265 | else
|
---|
5266 | dlself=needless
|
---|
5267 | export_dynamic=yes
|
---|
5268 | fi
|
---|
5269 | prev=
|
---|
5270 | continue
|
---|
5271 | ;;
|
---|
5272 | *)
|
---|
5273 | if test "$prev" = dlfiles; then
|
---|
5274 | func_append dlfiles " $arg"
|
---|
5275 | else
|
---|
5276 | func_append dlprefiles " $arg"
|
---|
5277 | fi
|
---|
5278 | prev=
|
---|
5279 | continue
|
---|
5280 | ;;
|
---|
5281 | esac
|
---|
5282 | ;;
|
---|
5283 | expsyms)
|
---|
5284 | export_symbols="$arg"
|
---|
5285 | test -f "$arg" \
|
---|
5286 | || func_fatal_error "symbol file \`$arg' does not exist"
|
---|
5287 | prev=
|
---|
5288 | continue
|
---|
5289 | ;;
|
---|
5290 | expsyms_regex)
|
---|
5291 | export_symbols_regex="$arg"
|
---|
5292 | prev=
|
---|
5293 | continue
|
---|
5294 | ;;
|
---|
5295 | framework)
|
---|
5296 | case $host in
|
---|
5297 | *-*-darwin*)
|
---|
5298 | case "$deplibs " in
|
---|
5299 | *" $qarg.ltframework "*) ;;
|
---|
5300 | *) func_append deplibs " $qarg.ltframework" # this is fixed later
|
---|
5301 | ;;
|
---|
5302 | esac
|
---|
5303 | ;;
|
---|
5304 | esac
|
---|
5305 | prev=
|
---|
5306 | continue
|
---|
5307 | ;;
|
---|
5308 | inst_prefix)
|
---|
5309 | inst_prefix_dir="$arg"
|
---|
5310 | prev=
|
---|
5311 | continue
|
---|
5312 | ;;
|
---|
5313 | objectlist)
|
---|
5314 | if test -f "$arg"; then
|
---|
5315 | save_arg=$arg
|
---|
5316 | moreargs=
|
---|
5317 | for fil in `cat "$save_arg"`
|
---|
5318 | do
|
---|
5319 | # func_append moreargs " $fil"
|
---|
5320 | arg=$fil
|
---|
5321 | # A libtool-controlled object.
|
---|
5322 |
|
---|
5323 | # Check to see that this really is a libtool object.
|
---|
5324 | if func_lalib_unsafe_p "$arg"; then
|
---|
5325 | pic_object=
|
---|
5326 | non_pic_object=
|
---|
5327 |
|
---|
5328 | # Read the .lo file
|
---|
5329 | func_source "$arg"
|
---|
5330 |
|
---|
5331 | if test -z "$pic_object" ||
|
---|
5332 | test -z "$non_pic_object" ||
|
---|
5333 | test "$pic_object" = none &&
|
---|
5334 | test "$non_pic_object" = none; then
|
---|
5335 | func_fatal_error "cannot find name of object for \`$arg'"
|
---|
5336 | fi
|
---|
5337 |
|
---|
5338 | # Extract subdirectory from the argument.
|
---|
5339 | func_dirname "$arg" "/" ""
|
---|
5340 | xdir="$func_dirname_result"
|
---|
5341 |
|
---|
5342 | if test "$pic_object" != none; then
|
---|
5343 | # Prepend the subdirectory the object is found in.
|
---|
5344 | pic_object="$xdir$pic_object"
|
---|
5345 |
|
---|
5346 | if test "$prev" = dlfiles; then
|
---|
5347 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
|
---|
5348 | func_append dlfiles " $pic_object"
|
---|
5349 | prev=
|
---|
5350 | continue
|
---|
5351 | else
|
---|
5352 | # If libtool objects are unsupported, then we need to preload.
|
---|
5353 | prev=dlprefiles
|
---|
5354 | fi
|
---|
5355 | fi
|
---|
5356 |
|
---|
5357 | # CHECK ME: I think I busted this. -Ossama
|
---|
5358 | if test "$prev" = dlprefiles; then
|
---|
5359 | # Preload the old-style object.
|
---|
5360 | func_append dlprefiles " $pic_object"
|
---|
5361 | prev=
|
---|
5362 | fi
|
---|
5363 |
|
---|
5364 | # A PIC object.
|
---|
5365 | func_append libobjs " $pic_object"
|
---|
5366 | arg="$pic_object"
|
---|
5367 | fi
|
---|
5368 |
|
---|
5369 | # Non-PIC object.
|
---|
5370 | if test "$non_pic_object" != none; then
|
---|
5371 | # Prepend the subdirectory the object is found in.
|
---|
5372 | non_pic_object="$xdir$non_pic_object"
|
---|
5373 |
|
---|
5374 | # A standard non-PIC object
|
---|
5375 | func_append non_pic_objects " $non_pic_object"
|
---|
5376 | if test -z "$pic_object" || test "$pic_object" = none ; then
|
---|
5377 | arg="$non_pic_object"
|
---|
5378 | fi
|
---|
5379 | else
|
---|
5380 | # If the PIC object exists, use it instead.
|
---|
5381 | # $xdir was prepended to $pic_object above.
|
---|
5382 | non_pic_object="$pic_object"
|
---|
5383 | func_append non_pic_objects " $non_pic_object"
|
---|
5384 | fi
|
---|
5385 | else
|
---|
5386 | # Only an error if not doing a dry-run.
|
---|
5387 | if $opt_dry_run; then
|
---|
5388 | # Extract subdirectory from the argument.
|
---|
5389 | func_dirname "$arg" "/" ""
|
---|
5390 | xdir="$func_dirname_result"
|
---|
5391 |
|
---|
5392 | func_lo2o "$arg"
|
---|
5393 | pic_object=$xdir$objdir/$func_lo2o_result
|
---|
5394 | non_pic_object=$xdir$func_lo2o_result
|
---|
5395 | func_append libobjs " $pic_object"
|
---|
5396 | func_append non_pic_objects " $non_pic_object"
|
---|
5397 | else
|
---|
5398 | func_fatal_error "\`$arg' is not a valid libtool object"
|
---|
5399 | fi
|
---|
5400 | fi
|
---|
5401 | done
|
---|
5402 | else
|
---|
5403 | func_fatal_error "link input file \`$arg' does not exist"
|
---|
5404 | fi
|
---|
5405 | arg=$save_arg
|
---|
5406 | prev=
|
---|
5407 | continue
|
---|
5408 | ;;
|
---|
5409 | precious_regex)
|
---|
5410 | precious_files_regex="$arg"
|
---|
5411 | prev=
|
---|
5412 | continue
|
---|
5413 | ;;
|
---|
5414 | release)
|
---|
5415 | release="-$arg"
|
---|
5416 | prev=
|
---|
5417 | continue
|
---|
5418 | ;;
|
---|
5419 | rpath | xrpath)
|
---|
5420 | # We need an absolute path.
|
---|
5421 | case $arg in
|
---|
5422 | [\\/]* | [A-Za-z]:[\\/]*) ;;
|
---|
5423 | *)
|
---|
5424 | func_fatal_error "only absolute run-paths are allowed"
|
---|
5425 | ;;
|
---|
5426 | esac
|
---|
5427 | if test "$prev" = rpath; then
|
---|
5428 | case "$rpath " in
|
---|
5429 | *" $arg "*) ;;
|
---|
5430 | *) func_append rpath " $arg" ;;
|
---|
5431 | esac
|
---|
5432 | else
|
---|
5433 | case "$xrpath " in
|
---|
5434 | *" $arg "*) ;;
|
---|
5435 | *) func_append xrpath " $arg" ;;
|
---|
5436 | esac
|
---|
5437 | fi
|
---|
5438 | prev=
|
---|
5439 | continue
|
---|
5440 | ;;
|
---|
5441 | shrext)
|
---|
5442 | shrext_cmds="$arg"
|
---|
5443 | prev=
|
---|
5444 | continue
|
---|
5445 | ;;
|
---|
5446 | weak)
|
---|
5447 | func_append weak_libs " $arg"
|
---|
5448 | prev=
|
---|
5449 | continue
|
---|
5450 | ;;
|
---|
5451 | xcclinker)
|
---|
5452 | func_append linker_flags " $qarg"
|
---|
5453 | func_append compiler_flags " $qarg"
|
---|
5454 | prev=
|
---|
5455 | func_append compile_command " $qarg"
|
---|
5456 | func_append finalize_command " $qarg"
|
---|
5457 | continue
|
---|
5458 | ;;
|
---|
5459 | xcompiler)
|
---|
5460 | func_append compiler_flags " $qarg"
|
---|
5461 | prev=
|
---|
5462 | func_append compile_command " $qarg"
|
---|
5463 | func_append finalize_command " $qarg"
|
---|
5464 | continue
|
---|
5465 | ;;
|
---|
5466 | xlinker)
|
---|
5467 | func_append linker_flags " $qarg"
|
---|
5468 | func_append compiler_flags " $wl$qarg"
|
---|
5469 | prev=
|
---|
5470 | func_append compile_command " $wl$qarg"
|
---|
5471 | func_append finalize_command " $wl$qarg"
|
---|
5472 | continue
|
---|
5473 | ;;
|
---|
5474 | *)
|
---|
5475 | eval "$prev=\"\$arg\""
|
---|
5476 | prev=
|
---|
5477 | continue
|
---|
5478 | ;;
|
---|
5479 | esac
|
---|
5480 | fi # test -n "$prev"
|
---|
5481 |
|
---|
5482 | prevarg="$arg"
|
---|
5483 |
|
---|
5484 | case $arg in
|
---|
5485 | -all-static)
|
---|
5486 | if test -n "$link_static_flag"; then
|
---|
5487 | # See comment for -static flag below, for more details.
|
---|
5488 | func_append compile_command " $link_static_flag"
|
---|
5489 | func_append finalize_command " $link_static_flag"
|
---|
5490 | fi
|
---|
5491 | continue
|
---|
5492 | ;;
|
---|
5493 |
|
---|
5494 | -allow-undefined)
|
---|
5495 | # FIXME: remove this flag sometime in the future.
|
---|
5496 | func_fatal_error "\`-allow-undefined' must not be used because it is the default"
|
---|
5497 | ;;
|
---|
5498 |
|
---|
5499 | -avoid-version)
|
---|
5500 | avoid_version=yes
|
---|
5501 | continue
|
---|
5502 | ;;
|
---|
5503 |
|
---|
5504 | -bindir)
|
---|
5505 | prev=bindir
|
---|
5506 | continue
|
---|
5507 | ;;
|
---|
5508 |
|
---|
5509 | -dlopen)
|
---|
5510 | prev=dlfiles
|
---|
5511 | continue
|
---|
5512 | ;;
|
---|
5513 |
|
---|
5514 | -dlpreopen)
|
---|
5515 | prev=dlprefiles
|
---|
5516 | continue
|
---|
5517 | ;;
|
---|
5518 |
|
---|
5519 | -export-dynamic)
|
---|
5520 | export_dynamic=yes
|
---|
5521 | continue
|
---|
5522 | ;;
|
---|
5523 |
|
---|
5524 | -export-symbols | -export-symbols-regex)
|
---|
5525 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
|
---|
5526 | func_fatal_error "more than one -exported-symbols argument is not allowed"
|
---|
5527 | fi
|
---|
5528 | if test "X$arg" = "X-export-symbols"; then
|
---|
5529 | prev=expsyms
|
---|
5530 | else
|
---|
5531 | prev=expsyms_regex
|
---|
5532 | fi
|
---|
5533 | continue
|
---|
5534 | ;;
|
---|
5535 |
|
---|
5536 | -framework)
|
---|
5537 | prev=framework
|
---|
5538 | continue
|
---|
5539 | ;;
|
---|
5540 |
|
---|
5541 | -inst-prefix-dir)
|
---|
5542 | prev=inst_prefix
|
---|
5543 | continue
|
---|
5544 | ;;
|
---|
5545 |
|
---|
5546 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
|
---|
5547 | # so, if we see these flags be careful not to treat them like -L
|
---|
5548 | -L[A-Z][A-Z]*:*)
|
---|
5549 | case $with_gcc/$host in
|
---|
5550 | no/*-*-irix* | /*-*-irix*)
|
---|
5551 | func_append compile_command " $arg"
|
---|
5552 | func_append finalize_command " $arg"
|
---|
5553 | ;;
|
---|
5554 | esac
|
---|
5555 | continue
|
---|
5556 | ;;
|
---|
5557 |
|
---|
5558 | -L*)
|
---|
5559 | func_stripname "-L" '' "$arg"
|
---|
5560 | if test -z "$func_stripname_result"; then
|
---|
5561 | if test "$#" -gt 0; then
|
---|
5562 | func_fatal_error "require no space between \`-L' and \`$1'"
|
---|
5563 | else
|
---|
5564 | func_fatal_error "need path for \`-L' option"
|
---|
5565 | fi
|
---|
5566 | fi
|
---|
5567 | func_resolve_sysroot "$func_stripname_result"
|
---|
5568 | dir=$func_resolve_sysroot_result
|
---|
5569 | # We need an absolute path.
|
---|
5570 | case $dir in
|
---|
5571 | [\\/]* | [A-Za-z]:[\\/]*) ;;
|
---|
5572 | *)
|
---|
5573 | absdir=`cd "$dir" && pwd`
|
---|
5574 | test -z "$absdir" && \
|
---|
5575 | func_fatal_error "cannot determine absolute directory name of \`$dir'"
|
---|
5576 | dir="$absdir"
|
---|
5577 | ;;
|
---|
5578 | esac
|
---|
5579 | case "$deplibs " in
|
---|
5580 | *" -L$dir "* | *" $arg "*)
|
---|
5581 | # Will only happen for absolute or sysroot arguments
|
---|
5582 | ;;
|
---|
5583 | *)
|
---|
5584 | # Preserve sysroot, but never include relative directories
|
---|
5585 | case $dir in
|
---|
5586 | [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
|
---|
5587 | *) func_append deplibs " -L$dir" ;;
|
---|
5588 | esac
|
---|
5589 | func_append lib_search_path " $dir"
|
---|
5590 | ;;
|
---|
5591 | esac
|
---|
5592 | case $host in
|
---|
5593 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
---|
5594 | testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
|
---|
5595 | case :$dllsearchpath: in
|
---|
5596 | *":$dir:"*) ;;
|
---|
5597 | ::) dllsearchpath=$dir;;
|
---|
5598 | *) func_append dllsearchpath ":$dir";;
|
---|
5599 | esac
|
---|
5600 | case :$dllsearchpath: in
|
---|
5601 | *":$testbindir:"*) ;;
|
---|
5602 | ::) dllsearchpath=$testbindir;;
|
---|
5603 | *) func_append dllsearchpath ":$testbindir";;
|
---|
5604 | esac
|
---|
5605 | ;;
|
---|
5606 | esac
|
---|
5607 | continue
|
---|
5608 | ;;
|
---|
5609 |
|
---|
5610 | -l*)
|
---|
5611 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
|
---|
5612 | case $host in
|
---|
5613 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
---|
5614 | # These systems don't actually have a C or math library (as such)
|
---|
5615 | continue
|
---|
5616 | ;;
|
---|
5617 | *-*-os2*)
|
---|
5618 | # These systems don't actually have a C library (as such)
|
---|
5619 | test "X$arg" = "X-lc" && continue
|
---|
5620 | ;;
|
---|
5621 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
---|
5622 | # Do not include libc due to us having libc/libc_r.
|
---|
5623 | test "X$arg" = "X-lc" && continue
|
---|
5624 | ;;
|
---|
5625 | *-*-rhapsody* | *-*-darwin1.[012])
|
---|
5626 | # Rhapsody C and math libraries are in the System framework
|
---|
5627 | func_append deplibs " System.ltframework"
|
---|
5628 | continue
|
---|
5629 | ;;
|
---|
5630 | *-*-sco3.2v5* | *-*-sco5v6*)
|
---|
5631 | # Causes problems with __ctype
|
---|
5632 | test "X$arg" = "X-lc" && continue
|
---|
5633 | ;;
|
---|
5634 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
---|
5635 | # Compiler inserts libc in the correct place for threads to work
|
---|
5636 | test "X$arg" = "X-lc" && continue
|
---|
5637 | ;;
|
---|
5638 | esac
|
---|
5639 | elif test "X$arg" = "X-lc_r"; then
|
---|
5640 | case $host in
|
---|
5641 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
---|
5642 | # Do not include libc_r directly, use -pthread flag.
|
---|
5643 | continue
|
---|
5644 | ;;
|
---|
5645 | esac
|
---|
5646 | fi
|
---|
5647 | func_append deplibs " $arg"
|
---|
5648 | continue
|
---|
5649 | ;;
|
---|
5650 |
|
---|
5651 | -module)
|
---|
5652 | module=yes
|
---|
5653 | continue
|
---|
5654 | ;;
|
---|
5655 |
|
---|
5656 | # Tru64 UNIX uses -model [arg] to determine the layout of C++
|
---|
5657 | # classes, name mangling, and exception handling.
|
---|
5658 | # Darwin uses the -arch flag to determine output architecture.
|
---|
5659 | -model|-arch|-isysroot|--sysroot)
|
---|
5660 | func_append compiler_flags " $arg"
|
---|
5661 | func_append compile_command " $arg"
|
---|
5662 | func_append finalize_command " $arg"
|
---|
5663 | prev=xcompiler
|
---|
5664 | continue
|
---|
5665 | ;;
|
---|
5666 |
|
---|
5667 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|
---|
5668 | |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
|
---|
5669 | func_append compiler_flags " $arg"
|
---|
5670 | func_append compile_command " $arg"
|
---|
5671 | func_append finalize_command " $arg"
|
---|
5672 | case "$new_inherited_linker_flags " in
|
---|
5673 | *" $arg "*) ;;
|
---|
5674 | * ) func_append new_inherited_linker_flags " $arg" ;;
|
---|
5675 | esac
|
---|
5676 | continue
|
---|
5677 | ;;
|
---|
5678 |
|
---|
5679 | -multi_module)
|
---|
5680 | single_module="${wl}-multi_module"
|
---|
5681 | continue
|
---|
5682 | ;;
|
---|
5683 |
|
---|
5684 | -no-fast-install)
|
---|
5685 | fast_install=no
|
---|
5686 | continue
|
---|
5687 | ;;
|
---|
5688 |
|
---|
5689 | -no-install)
|
---|
5690 | case $host in
|
---|
5691 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
|
---|
5692 | # The PATH hackery in wrapper scripts is required on Windows
|
---|
5693 | # and Darwin in order for the loader to find any dlls it needs.
|
---|
5694 | func_warning "\`-no-install' is ignored for $host"
|
---|
5695 | func_warning "assuming \`-no-fast-install' instead"
|
---|
5696 | fast_install=no
|
---|
5697 | ;;
|
---|
5698 | *) no_install=yes ;;
|
---|
5699 | esac
|
---|
5700 | continue
|
---|
5701 | ;;
|
---|
5702 |
|
---|
5703 | -no-undefined)
|
---|
5704 | allow_undefined=no
|
---|
5705 | continue
|
---|
5706 | ;;
|
---|
5707 |
|
---|
5708 | -objectlist)
|
---|
5709 | prev=objectlist
|
---|
5710 | continue
|
---|
5711 | ;;
|
---|
5712 |
|
---|
5713 | -o) prev=output ;;
|
---|
5714 |
|
---|
5715 | -precious-files-regex)
|
---|
5716 | prev=precious_regex
|
---|
5717 | continue
|
---|
5718 | ;;
|
---|
5719 |
|
---|
5720 | -release)
|
---|
5721 | prev=release
|
---|
5722 | continue
|
---|
5723 | ;;
|
---|
5724 |
|
---|
5725 | -rpath)
|
---|
5726 | prev=rpath
|
---|
5727 | continue
|
---|
5728 | ;;
|
---|
5729 |
|
---|
5730 | -R)
|
---|
5731 | prev=xrpath
|
---|
5732 | continue
|
---|
5733 | ;;
|
---|
5734 |
|
---|
5735 | -R*)
|
---|
5736 | func_stripname '-R' '' "$arg"
|
---|
5737 | dir=$func_stripname_result
|
---|
5738 | # We need an absolute path.
|
---|
5739 | case $dir in
|
---|
5740 | [\\/]* | [A-Za-z]:[\\/]*) ;;
|
---|
5741 | =*)
|
---|
5742 | func_stripname '=' '' "$dir"
|
---|
5743 | dir=$lt_sysroot$func_stripname_result
|
---|
5744 | ;;
|
---|
5745 | *)
|
---|
5746 | func_fatal_error "only absolute run-paths are allowed"
|
---|
5747 | ;;
|
---|
5748 | esac
|
---|
5749 | case "$xrpath " in
|
---|
5750 | *" $dir "*) ;;
|
---|
5751 | *) func_append xrpath " $dir" ;;
|
---|
5752 | esac
|
---|
5753 | continue
|
---|
5754 | ;;
|
---|
5755 |
|
---|
5756 | -shared)
|
---|
5757 | # The effects of -shared are defined in a previous loop.
|
---|
5758 | continue
|
---|
5759 | ;;
|
---|
5760 |
|
---|
5761 | -shrext)
|
---|
5762 | prev=shrext
|
---|
5763 | continue
|
---|
5764 | ;;
|
---|
5765 |
|
---|
5766 | -static | -static-libtool-libs)
|
---|
5767 | # The effects of -static are defined in a previous loop.
|
---|
5768 | # We used to do the same as -all-static on platforms that
|
---|
5769 | # didn't have a PIC flag, but the assumption that the effects
|
---|
5770 | # would be equivalent was wrong. It would break on at least
|
---|
5771 | # Digital Unix and AIX.
|
---|
5772 | continue
|
---|
5773 | ;;
|
---|
5774 |
|
---|
5775 | -thread-safe)
|
---|
5776 | thread_safe=yes
|
---|
5777 | continue
|
---|
5778 | ;;
|
---|
5779 |
|
---|
5780 | -version-info)
|
---|
5781 | prev=vinfo
|
---|
5782 | continue
|
---|
5783 | ;;
|
---|
5784 |
|
---|
5785 | -version-number)
|
---|
5786 | prev=vinfo
|
---|
5787 | vinfo_number=yes
|
---|
5788 | continue
|
---|
5789 | ;;
|
---|
5790 |
|
---|
5791 | -weak)
|
---|
5792 | prev=weak
|
---|
5793 | continue
|
---|
5794 | ;;
|
---|
5795 |
|
---|
5796 | -Wc,*)
|
---|
5797 | func_stripname '-Wc,' '' "$arg"
|
---|
5798 | args=$func_stripname_result
|
---|
5799 | arg=
|
---|
5800 | save_ifs="$IFS"; IFS=','
|
---|
5801 | for flag in $args; do
|
---|
5802 | IFS="$save_ifs"
|
---|
5803 | func_quote_for_eval "$flag"
|
---|
5804 | func_append arg " $func_quote_for_eval_result"
|
---|
5805 | func_append compiler_flags " $func_quote_for_eval_result"
|
---|
5806 | done
|
---|
5807 | IFS="$save_ifs"
|
---|
5808 | func_stripname ' ' '' "$arg"
|
---|
5809 | arg=$func_stripname_result
|
---|
5810 | ;;
|
---|
5811 |
|
---|
5812 | -Wl,*)
|
---|
5813 | func_stripname '-Wl,' '' "$arg"
|
---|
5814 | args=$func_stripname_result
|
---|
5815 | arg=
|
---|
5816 | save_ifs="$IFS"; IFS=','
|
---|
5817 | for flag in $args; do
|
---|
5818 | IFS="$save_ifs"
|
---|
5819 | func_quote_for_eval "$flag"
|
---|
5820 | func_append arg " $wl$func_quote_for_eval_result"
|
---|
5821 | func_append compiler_flags " $wl$func_quote_for_eval_result"
|
---|
5822 | func_append linker_flags " $func_quote_for_eval_result"
|
---|
5823 | done
|
---|
5824 | IFS="$save_ifs"
|
---|
5825 | func_stripname ' ' '' "$arg"
|
---|
5826 | arg=$func_stripname_result
|
---|
5827 | ;;
|
---|
5828 |
|
---|
5829 | -Xcompiler)
|
---|
5830 | prev=xcompiler
|
---|
5831 | continue
|
---|
5832 | ;;
|
---|
5833 |
|
---|
5834 | -Xlinker)
|
---|
5835 | prev=xlinker
|
---|
5836 | continue
|
---|
5837 | ;;
|
---|
5838 |
|
---|
5839 | -XCClinker)
|
---|
5840 | prev=xcclinker
|
---|
5841 | continue
|
---|
5842 | ;;
|
---|
5843 |
|
---|
5844 | # -msg_* for osf cc
|
---|
5845 | -msg_*)
|
---|
5846 | func_quote_for_eval "$arg"
|
---|
5847 | arg="$func_quote_for_eval_result"
|
---|
5848 | ;;
|
---|
5849 |
|
---|
5850 | # Flags to be passed through unchanged, with rationale:
|
---|
5851 | # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
|
---|
5852 | # -r[0-9][0-9]* specify processor for the SGI compiler
|
---|
5853 | # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
|
---|
5854 | # +DA*, +DD* enable 64-bit mode for the HP compiler
|
---|
5855 | # -q* compiler args for the IBM compiler
|
---|
5856 | # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
|
---|
5857 | # -F/path path to uninstalled frameworks, gcc on darwin
|
---|
5858 | # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
|
---|
5859 | # @file GCC response files
|
---|
5860 | # -tp=* Portland pgcc target processor selection
|
---|
5861 | # --sysroot=* for sysroot support
|
---|
5862 | # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
|
---|
5863 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
|
---|
5864 | -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
|
---|
5865 | -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
|
---|
5866 | func_quote_for_eval "$arg"
|
---|
5867 | arg="$func_quote_for_eval_result"
|
---|
5868 | func_append compile_command " $arg"
|
---|
5869 | func_append finalize_command " $arg"
|
---|
5870 | func_append compiler_flags " $arg"
|
---|
5871 | continue
|
---|
5872 | ;;
|
---|
5873 |
|
---|
5874 | # Some other compiler flag.
|
---|
5875 | -* | +*)
|
---|
5876 | func_quote_for_eval "$arg"
|
---|
5877 | arg="$func_quote_for_eval_result"
|
---|
5878 | ;;
|
---|
5879 |
|
---|
5880 | *.$objext)
|
---|
5881 | # A standard object.
|
---|
5882 | func_append objs " $arg"
|
---|
5883 | ;;
|
---|
5884 |
|
---|
5885 | *.lo)
|
---|
5886 | # A libtool-controlled object.
|
---|
5887 |
|
---|
5888 | # Check to see that this really is a libtool object.
|
---|
5889 | if func_lalib_unsafe_p "$arg"; then
|
---|
5890 | pic_object=
|
---|
5891 | non_pic_object=
|
---|
5892 |
|
---|
5893 | # Read the .lo file
|
---|
5894 | func_source "$arg"
|
---|
5895 |
|
---|
5896 | if test -z "$pic_object" ||
|
---|
5897 | test -z "$non_pic_object" ||
|
---|
5898 | test "$pic_object" = none &&
|
---|
5899 | test "$non_pic_object" = none; then
|
---|
5900 | func_fatal_error "cannot find name of object for \`$arg'"
|
---|
5901 | fi
|
---|
5902 |
|
---|
5903 | # Extract subdirectory from the argument.
|
---|
5904 | func_dirname "$arg" "/" ""
|
---|
5905 | xdir="$func_dirname_result"
|
---|
5906 |
|
---|
5907 | if test "$pic_object" != none; then
|
---|
5908 | # Prepend the subdirectory the object is found in.
|
---|
5909 | pic_object="$xdir$pic_object"
|
---|
5910 |
|
---|
5911 | if test "$prev" = dlfiles; then
|
---|
5912 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
|
---|
5913 | func_append dlfiles " $pic_object"
|
---|
5914 | prev=
|
---|
5915 | continue
|
---|
5916 | else
|
---|
5917 | # If libtool objects are unsupported, then we need to preload.
|
---|
5918 | prev=dlprefiles
|
---|
5919 | fi
|
---|
5920 | fi
|
---|
5921 |
|
---|
5922 | # CHECK ME: I think I busted this. -Ossama
|
---|
5923 | if test "$prev" = dlprefiles; then
|
---|
5924 | # Preload the old-style object.
|
---|
5925 | func_append dlprefiles " $pic_object"
|
---|
5926 | prev=
|
---|
5927 | fi
|
---|
5928 |
|
---|
5929 | # A PIC object.
|
---|
5930 | func_append libobjs " $pic_object"
|
---|
5931 | arg="$pic_object"
|
---|
5932 | fi
|
---|
5933 |
|
---|
5934 | # Non-PIC object.
|
---|
5935 | if test "$non_pic_object" != none; then
|
---|
5936 | # Prepend the subdirectory the object is found in.
|
---|
5937 | non_pic_object="$xdir$non_pic_object"
|
---|
5938 |
|
---|
5939 | # A standard non-PIC object
|
---|
5940 | func_append non_pic_objects " $non_pic_object"
|
---|
5941 | if test -z "$pic_object" || test "$pic_object" = none ; then
|
---|
5942 | arg="$non_pic_object"
|
---|
5943 | fi
|
---|
5944 | else
|
---|
5945 | # If the PIC object exists, use it instead.
|
---|
5946 | # $xdir was prepended to $pic_object above.
|
---|
5947 | non_pic_object="$pic_object"
|
---|
5948 | func_append non_pic_objects " $non_pic_object"
|
---|
5949 | fi
|
---|
5950 | else
|
---|
5951 | # Only an error if not doing a dry-run.
|
---|
5952 | if $opt_dry_run; then
|
---|
5953 | # Extract subdirectory from the argument.
|
---|
5954 | func_dirname "$arg" "/" ""
|
---|
5955 | xdir="$func_dirname_result"
|
---|
5956 |
|
---|
5957 | func_lo2o "$arg"
|
---|
5958 | pic_object=$xdir$objdir/$func_lo2o_result
|
---|
5959 | non_pic_object=$xdir$func_lo2o_result
|
---|
5960 | func_append libobjs " $pic_object"
|
---|
5961 | func_append non_pic_objects " $non_pic_object"
|
---|
5962 | else
|
---|
5963 | func_fatal_error "\`$arg' is not a valid libtool object"
|
---|
5964 | fi
|
---|
5965 | fi
|
---|
5966 | ;;
|
---|
5967 |
|
---|
5968 | *.$libext)
|
---|
5969 | # An archive.
|
---|
5970 | func_append deplibs " $arg"
|
---|
5971 | func_append old_deplibs " $arg"
|
---|
5972 | continue
|
---|
5973 | ;;
|
---|
5974 |
|
---|
5975 | *.la)
|
---|
5976 | # A libtool-controlled library.
|
---|
5977 |
|
---|
5978 | func_resolve_sysroot "$arg"
|
---|
5979 | if test "$prev" = dlfiles; then
|
---|
5980 | # This library was specified with -dlopen.
|
---|
5981 | func_append dlfiles " $func_resolve_sysroot_result"
|
---|
5982 | prev=
|
---|
5983 | elif test "$prev" = dlprefiles; then
|
---|
5984 | # The library was specified with -dlpreopen.
|
---|
5985 | func_append dlprefiles " $func_resolve_sysroot_result"
|
---|
5986 | prev=
|
---|
5987 | else
|
---|
5988 | func_append deplibs " $func_resolve_sysroot_result"
|
---|
5989 | fi
|
---|
5990 | continue
|
---|
5991 | ;;
|
---|
5992 |
|
---|
5993 | # Some other compiler argument.
|
---|
5994 | *)
|
---|
5995 | # Unknown arguments in both finalize_command and compile_command need
|
---|
5996 | # to be aesthetically quoted because they are evaled later.
|
---|
5997 | func_quote_for_eval "$arg"
|
---|
5998 | arg="$func_quote_for_eval_result"
|
---|
5999 | ;;
|
---|
6000 | esac # arg
|
---|
6001 |
|
---|
6002 | # Now actually substitute the argument into the commands.
|
---|
6003 | if test -n "$arg"; then
|
---|
6004 | func_append compile_command " $arg"
|
---|
6005 | func_append finalize_command " $arg"
|
---|
6006 | fi
|
---|
6007 | done # argument parsing loop
|
---|
6008 |
|
---|
6009 | test -n "$prev" && \
|
---|
6010 | func_fatal_help "the \`$prevarg' option requires an argument"
|
---|
6011 |
|
---|
6012 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
|
---|
6013 | eval arg=\"$export_dynamic_flag_spec\"
|
---|
6014 | func_append compile_command " $arg"
|
---|
6015 | func_append finalize_command " $arg"
|
---|
6016 | fi
|
---|
6017 |
|
---|
6018 | oldlibs=
|
---|
6019 | # calculate the name of the file, without its directory
|
---|
6020 | func_basename "$output"
|
---|
6021 | outputname="$func_basename_result"
|
---|
6022 | libobjs_save="$libobjs"
|
---|
6023 |
|
---|
6024 | if test -n "$shlibpath_var"; then
|
---|
6025 | # get the directories listed in $shlibpath_var
|
---|
6026 | eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
|
---|
6027 | else
|
---|
6028 | shlib_search_path=
|
---|
6029 | fi
|
---|
6030 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
|
---|
6031 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
|
---|
6032 |
|
---|
6033 | func_dirname "$output" "/" ""
|
---|
6034 | output_objdir="$func_dirname_result$objdir"
|
---|
6035 | func_to_tool_file "$output_objdir/"
|
---|
6036 | tool_output_objdir=$func_to_tool_file_result
|
---|
6037 | # Create the object directory.
|
---|
6038 | func_mkdir_p "$output_objdir"
|
---|
6039 |
|
---|
6040 | # Determine the type of output
|
---|
6041 | case $output in
|
---|
6042 | "")
|
---|
6043 | func_fatal_help "you must specify an output file"
|
---|
6044 | ;;
|
---|
6045 | *.$libext) linkmode=oldlib ;;
|
---|
6046 | *.lo | *.$objext) linkmode=obj ;;
|
---|
6047 | *.la) linkmode=lib ;;
|
---|
6048 | *) linkmode=prog ;; # Anything else should be a program.
|
---|
6049 | esac
|
---|
6050 |
|
---|
6051 | specialdeplibs=
|
---|
6052 |
|
---|
6053 | libs=
|
---|
6054 | # Find all interdependent deplibs by searching for libraries
|
---|
6055 | # that are linked more than once (e.g. -la -lb -la)
|
---|
6056 | for deplib in $deplibs; do
|
---|
6057 | if $opt_preserve_dup_deps ; then
|
---|
6058 | case "$libs " in
|
---|
6059 | *" $deplib "*) func_append specialdeplibs " $deplib" ;;
|
---|
6060 | esac
|
---|
6061 | fi
|
---|
6062 | func_append libs " $deplib"
|
---|
6063 | done
|
---|
6064 |
|
---|
6065 | if test "$linkmode" = lib; then
|
---|
6066 | libs="$predeps $libs $compiler_lib_search_path $postdeps"
|
---|
6067 |
|
---|
6068 | # Compute libraries that are listed more than once in $predeps
|
---|
6069 | # $postdeps and mark them as special (i.e., whose duplicates are
|
---|
6070 | # not to be eliminated).
|
---|
6071 | pre_post_deps=
|
---|
6072 | if $opt_duplicate_compiler_generated_deps; then
|
---|
6073 | for pre_post_dep in $predeps $postdeps; do
|
---|
6074 | case "$pre_post_deps " in
|
---|
6075 | *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
|
---|
6076 | esac
|
---|
6077 | func_append pre_post_deps " $pre_post_dep"
|
---|
6078 | done
|
---|
6079 | fi
|
---|
6080 | pre_post_deps=
|
---|
6081 | fi
|
---|
6082 |
|
---|
6083 | deplibs=
|
---|
6084 | newdependency_libs=
|
---|
6085 | newlib_search_path=
|
---|
6086 | need_relink=no # whether we're linking any uninstalled libtool libraries
|
---|
6087 | notinst_deplibs= # not-installed libtool libraries
|
---|
6088 | notinst_path= # paths that contain not-installed libtool libraries
|
---|
6089 |
|
---|
6090 | case $linkmode in
|
---|
6091 | lib)
|
---|
6092 | passes="conv dlpreopen link"
|
---|
6093 | for file in $dlfiles $dlprefiles; do
|
---|
6094 | case $file in
|
---|
6095 | *.la) ;;
|
---|
6096 | *)
|
---|
6097 | func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
|
---|
6098 | ;;
|
---|
6099 | esac
|
---|
6100 | done
|
---|
6101 | ;;
|
---|
6102 | prog)
|
---|
6103 | compile_deplibs=
|
---|
6104 | finalize_deplibs=
|
---|
6105 | alldeplibs=no
|
---|
6106 | newdlfiles=
|
---|
6107 | newdlprefiles=
|
---|
6108 | passes="conv scan dlopen dlpreopen link"
|
---|
6109 | ;;
|
---|
6110 | *) passes="conv"
|
---|
6111 | ;;
|
---|
6112 | esac
|
---|
6113 |
|
---|
6114 | for pass in $passes; do
|
---|
6115 | # The preopen pass in lib mode reverses $deplibs; put it back here
|
---|
6116 | # so that -L comes before libs that need it for instance...
|
---|
6117 | if test "$linkmode,$pass" = "lib,link"; then
|
---|
6118 | ## FIXME: Find the place where the list is rebuilt in the wrong
|
---|
6119 | ## order, and fix it there properly
|
---|
6120 | tmp_deplibs=
|
---|
6121 | for deplib in $deplibs; do
|
---|
6122 | tmp_deplibs="$deplib $tmp_deplibs"
|
---|
6123 | done
|
---|
6124 | deplibs="$tmp_deplibs"
|
---|
6125 | fi
|
---|
6126 |
|
---|
6127 | if test "$linkmode,$pass" = "lib,link" ||
|
---|
6128 | test "$linkmode,$pass" = "prog,scan"; then
|
---|
6129 | libs="$deplibs"
|
---|
6130 | deplibs=
|
---|
6131 | fi
|
---|
6132 | if test "$linkmode" = prog; then
|
---|
6133 | case $pass in
|
---|
6134 | dlopen) libs="$dlfiles" ;;
|
---|
6135 | dlpreopen) libs="$dlprefiles" ;;
|
---|
6136 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
|
---|
6137 | esac
|
---|
6138 | fi
|
---|
6139 | if test "$linkmode,$pass" = "lib,dlpreopen"; then
|
---|
6140 | # Collect and forward deplibs of preopened libtool libs
|
---|
6141 | for lib in $dlprefiles; do
|
---|
6142 | # Ignore non-libtool-libs
|
---|
6143 | dependency_libs=
|
---|
6144 | func_resolve_sysroot "$lib"
|
---|
6145 | case $lib in
|
---|
6146 | *.la) func_source "$func_resolve_sysroot_result" ;;
|
---|
6147 | esac
|
---|
6148 |
|
---|
6149 | # Collect preopened libtool deplibs, except any this library
|
---|
6150 | # has declared as weak libs
|
---|
6151 | for deplib in $dependency_libs; do
|
---|
6152 | func_basename "$deplib"
|
---|
6153 | deplib_base=$func_basename_result
|
---|
6154 | case " $weak_libs " in
|
---|
6155 | *" $deplib_base "*) ;;
|
---|
6156 | *) func_append deplibs " $deplib" ;;
|
---|
6157 | esac
|
---|
6158 | done
|
---|
6159 | done
|
---|
6160 | libs="$dlprefiles"
|
---|
6161 | fi
|
---|
6162 | if test "$pass" = dlopen; then
|
---|
6163 | # Collect dlpreopened libraries
|
---|
6164 | save_deplibs="$deplibs"
|
---|
6165 | deplibs=
|
---|
6166 | fi
|
---|
6167 |
|
---|
6168 | for deplib in $libs; do
|
---|
6169 | lib=
|
---|
6170 | found=no
|
---|
6171 | case $deplib in
|
---|
6172 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|
---|
6173 | |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
|
---|
6174 | if test "$linkmode,$pass" = "prog,link"; then
|
---|
6175 | compile_deplibs="$deplib $compile_deplibs"
|
---|
6176 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
6177 | else
|
---|
6178 | func_append compiler_flags " $deplib"
|
---|
6179 | if test "$linkmode" = lib ; then
|
---|
6180 | case "$new_inherited_linker_flags " in
|
---|
6181 | *" $deplib "*) ;;
|
---|
6182 | * ) func_append new_inherited_linker_flags " $deplib" ;;
|
---|
6183 | esac
|
---|
6184 | fi
|
---|
6185 | fi
|
---|
6186 | continue
|
---|
6187 | ;;
|
---|
6188 | -l*)
|
---|
6189 | if test "$linkmode" != lib && test "$linkmode" != prog; then
|
---|
6190 | func_warning "\`-l' is ignored for archives/objects"
|
---|
6191 | continue
|
---|
6192 | fi
|
---|
6193 | func_stripname '-l' '' "$deplib"
|
---|
6194 | name=$func_stripname_result
|
---|
6195 | if test "$linkmode" = lib; then
|
---|
6196 | searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
|
---|
6197 | else
|
---|
6198 | searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
|
---|
6199 | fi
|
---|
6200 | for searchdir in $searchdirs; do
|
---|
6201 | for search_ext in .la $std_shrext .so .a; do
|
---|
6202 | # Search the libtool library
|
---|
6203 | lib="$searchdir/lib${name}${search_ext}"
|
---|
6204 | if test -f "$lib"; then
|
---|
6205 | if test "$search_ext" = ".la"; then
|
---|
6206 | found=yes
|
---|
6207 | else
|
---|
6208 | found=no
|
---|
6209 | fi
|
---|
6210 | break 2
|
---|
6211 | fi
|
---|
6212 | done
|
---|
6213 | done
|
---|
6214 | if test "$found" != yes; then
|
---|
6215 | # deplib doesn't seem to be a libtool library
|
---|
6216 | if test "$linkmode,$pass" = "prog,link"; then
|
---|
6217 | compile_deplibs="$deplib $compile_deplibs"
|
---|
6218 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
6219 | else
|
---|
6220 | deplibs="$deplib $deplibs"
|
---|
6221 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
|
---|
6222 | fi
|
---|
6223 | continue
|
---|
6224 | else # deplib is a libtool library
|
---|
6225 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
|
---|
6226 | # We need to do some special things here, and not later.
|
---|
6227 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
---|
6228 | case " $predeps $postdeps " in
|
---|
6229 | *" $deplib "*)
|
---|
6230 | if func_lalib_p "$lib"; then
|
---|
6231 | library_names=
|
---|
6232 | old_library=
|
---|
6233 | func_source "$lib"
|
---|
6234 | for l in $old_library $library_names; do
|
---|
6235 | ll="$l"
|
---|
6236 | done
|
---|
6237 | if test "X$ll" = "X$old_library" ; then # only static version available
|
---|
6238 | found=no
|
---|
6239 | func_dirname "$lib" "" "."
|
---|
6240 | ladir="$func_dirname_result"
|
---|
6241 | lib=$ladir/$old_library
|
---|
6242 | if test "$linkmode,$pass" = "prog,link"; then
|
---|
6243 | compile_deplibs="$deplib $compile_deplibs"
|
---|
6244 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
6245 | else
|
---|
6246 | deplibs="$deplib $deplibs"
|
---|
6247 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
|
---|
6248 | fi
|
---|
6249 | continue
|
---|
6250 | fi
|
---|
6251 | fi
|
---|
6252 | ;;
|
---|
6253 | *) ;;
|
---|
6254 | esac
|
---|
6255 | fi
|
---|
6256 | fi
|
---|
6257 | ;; # -l
|
---|
6258 | *.ltframework)
|
---|
6259 | if test "$linkmode,$pass" = "prog,link"; then
|
---|
6260 | compile_deplibs="$deplib $compile_deplibs"
|
---|
6261 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
6262 | else
|
---|
6263 | deplibs="$deplib $deplibs"
|
---|
6264 | if test "$linkmode" = lib ; then
|
---|
6265 | case "$new_inherited_linker_flags " in
|
---|
6266 | *" $deplib "*) ;;
|
---|
6267 | * ) func_append new_inherited_linker_flags " $deplib" ;;
|
---|
6268 | esac
|
---|
6269 | fi
|
---|
6270 | fi
|
---|
6271 | continue
|
---|
6272 | ;;
|
---|
6273 | -L*)
|
---|
6274 | case $linkmode in
|
---|
6275 | lib)
|
---|
6276 | deplibs="$deplib $deplibs"
|
---|
6277 | test "$pass" = conv && continue
|
---|
6278 | newdependency_libs="$deplib $newdependency_libs"
|
---|
6279 | func_stripname '-L' '' "$deplib"
|
---|
6280 | func_resolve_sysroot "$func_stripname_result"
|
---|
6281 | func_append newlib_search_path " $func_resolve_sysroot_result"
|
---|
6282 | ;;
|
---|
6283 | prog)
|
---|
6284 | if test "$pass" = conv; then
|
---|
6285 | deplibs="$deplib $deplibs"
|
---|
6286 | continue
|
---|
6287 | fi
|
---|
6288 | if test "$pass" = scan; then
|
---|
6289 | deplibs="$deplib $deplibs"
|
---|
6290 | else
|
---|
6291 | compile_deplibs="$deplib $compile_deplibs"
|
---|
6292 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
6293 | fi
|
---|
6294 | func_stripname '-L' '' "$deplib"
|
---|
6295 | func_resolve_sysroot "$func_stripname_result"
|
---|
6296 | func_append newlib_search_path " $func_resolve_sysroot_result"
|
---|
6297 | ;;
|
---|
6298 | *)
|
---|
6299 | func_warning "\`-L' is ignored for archives/objects"
|
---|
6300 | ;;
|
---|
6301 | esac # linkmode
|
---|
6302 | continue
|
---|
6303 | ;; # -L
|
---|
6304 | -R*)
|
---|
6305 | if test "$pass" = link; then
|
---|
6306 | func_stripname '-R' '' "$deplib"
|
---|
6307 | func_resolve_sysroot "$func_stripname_result"
|
---|
6308 | dir=$func_resolve_sysroot_result
|
---|
6309 | # Make sure the xrpath contains only unique directories.
|
---|
6310 | case "$xrpath " in
|
---|
6311 | *" $dir "*) ;;
|
---|
6312 | *) func_append xrpath " $dir" ;;
|
---|
6313 | esac
|
---|
6314 | fi
|
---|
6315 | deplibs="$deplib $deplibs"
|
---|
6316 | continue
|
---|
6317 | ;;
|
---|
6318 | *.la)
|
---|
6319 | func_resolve_sysroot "$deplib"
|
---|
6320 | lib=$func_resolve_sysroot_result
|
---|
6321 | ;;
|
---|
6322 | *.$libext)
|
---|
6323 | if test "$pass" = conv; then
|
---|
6324 | deplibs="$deplib $deplibs"
|
---|
6325 | continue
|
---|
6326 | fi
|
---|
6327 | case $linkmode in
|
---|
6328 | lib)
|
---|
6329 | # Linking convenience modules into shared libraries is allowed,
|
---|
6330 | # but linking other static libraries is non-portable.
|
---|
6331 | case " $dlpreconveniencelibs " in
|
---|
6332 | *" $deplib "*) ;;
|
---|
6333 | *)
|
---|
6334 | valid_a_lib=no
|
---|
6335 | case $deplibs_check_method in
|
---|
6336 | match_pattern*)
|
---|
6337 | set dummy $deplibs_check_method; shift
|
---|
6338 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
---|
6339 | if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
|
---|
6340 | | $EGREP "$match_pattern_regex" > /dev/null; then
|
---|
6341 | valid_a_lib=yes
|
---|
6342 | fi
|
---|
6343 | ;;
|
---|
6344 | pass_all)
|
---|
6345 | valid_a_lib=yes
|
---|
6346 | ;;
|
---|
6347 | esac
|
---|
6348 | if test "$valid_a_lib" != yes; then
|
---|
6349 | echo
|
---|
6350 | $ECHO "*** Warning: Trying to link with static lib archive $deplib."
|
---|
6351 | echo "*** I have the capability to make that library automatically link in when"
|
---|
6352 | echo "*** you link to this library. But I can only do this if you have a"
|
---|
6353 | echo "*** shared version of the library, which you do not appear to have"
|
---|
6354 | echo "*** because the file extensions .$libext of this argument makes me believe"
|
---|
6355 | echo "*** that it is just a static archive that I should not use here."
|
---|
6356 | else
|
---|
6357 | echo
|
---|
6358 | $ECHO "*** Warning: Linking the shared library $output against the"
|
---|
6359 | $ECHO "*** static library $deplib is not portable!"
|
---|
6360 | deplibs="$deplib $deplibs"
|
---|
6361 | fi
|
---|
6362 | ;;
|
---|
6363 | esac
|
---|
6364 | continue
|
---|
6365 | ;;
|
---|
6366 | prog)
|
---|
6367 | if test "$pass" != link; then
|
---|
6368 | deplibs="$deplib $deplibs"
|
---|
6369 | else
|
---|
6370 | compile_deplibs="$deplib $compile_deplibs"
|
---|
6371 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
6372 | fi
|
---|
6373 | continue
|
---|
6374 | ;;
|
---|
6375 | esac # linkmode
|
---|
6376 | ;; # *.$libext
|
---|
6377 | *.lo | *.$objext)
|
---|
6378 | if test "$pass" = conv; then
|
---|
6379 | deplibs="$deplib $deplibs"
|
---|
6380 | elif test "$linkmode" = prog; then
|
---|
6381 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
|
---|
6382 | # If there is no dlopen support or we're linking statically,
|
---|
6383 | # we need to preload.
|
---|
6384 | func_append newdlprefiles " $deplib"
|
---|
6385 | compile_deplibs="$deplib $compile_deplibs"
|
---|
6386 | finalize_deplibs="$deplib $finalize_deplibs"
|
---|
6387 | else
|
---|
6388 | func_append newdlfiles " $deplib"
|
---|
6389 | fi
|
---|
6390 | fi
|
---|
6391 | continue
|
---|
6392 | ;;
|
---|
6393 | %DEPLIBS%)
|
---|
6394 | alldeplibs=yes
|
---|
6395 | continue
|
---|
6396 | ;;
|
---|
6397 | esac # case $deplib
|
---|
6398 |
|
---|
6399 | if test "$found" = yes || test -f "$lib"; then :
|
---|
6400 | else
|
---|
6401 | func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
|
---|
6402 | fi
|
---|
6403 |
|
---|
6404 | # Check to see that this really is a libtool archive.
|
---|
6405 | func_lalib_unsafe_p "$lib" \
|
---|
6406 | || func_fatal_error "\`$lib' is not a valid libtool archive"
|
---|
6407 |
|
---|
6408 | func_dirname "$lib" "" "."
|
---|
6409 | ladir="$func_dirname_result"
|
---|
6410 |
|
---|
6411 | dlname=
|
---|
6412 | dlopen=
|
---|
6413 | dlpreopen=
|
---|
6414 | libdir=
|
---|
6415 | library_names=
|
---|
6416 | old_library=
|
---|
6417 | inherited_linker_flags=
|
---|
6418 | # If the library was installed with an old release of libtool,
|
---|
6419 | # it will not redefine variables installed, or shouldnotlink
|
---|
6420 | installed=yes
|
---|
6421 | shouldnotlink=no
|
---|
6422 | avoidtemprpath=
|
---|
6423 |
|
---|
6424 |
|
---|
6425 | # Read the .la file
|
---|
6426 | func_source "$lib"
|
---|
6427 |
|
---|
6428 | # Convert "-framework foo" to "foo.ltframework"
|
---|
6429 | if test -n "$inherited_linker_flags"; then
|
---|
6430 | tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
|
---|
6431 | for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
|
---|
6432 | case " $new_inherited_linker_flags " in
|
---|
6433 | *" $tmp_inherited_linker_flag "*) ;;
|
---|
6434 | *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
|
---|
6435 | esac
|
---|
6436 | done
|
---|
6437 | fi
|
---|
6438 | dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
---|
6439 | if test "$linkmode,$pass" = "lib,link" ||
|
---|
6440 | test "$linkmode,$pass" = "prog,scan" ||
|
---|
6441 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then
|
---|
6442 | test -n "$dlopen" && func_append dlfiles " $dlopen"
|
---|
6443 | test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
|
---|
6444 | fi
|
---|
6445 |
|
---|
6446 | if test "$pass" = conv; then
|
---|
6447 | # Only check for convenience libraries
|
---|
6448 | deplibs="$lib $deplibs"
|
---|
6449 | if test -z "$libdir"; then
|
---|
6450 | if test -z "$old_library"; then
|
---|
6451 | func_fatal_error "cannot find name of link library for \`$lib'"
|
---|
6452 | fi
|
---|
6453 | # It is a libtool convenience library, so add in its objects.
|
---|
6454 | func_append convenience " $ladir/$objdir/$old_library"
|
---|
6455 | func_append old_convenience " $ladir/$objdir/$old_library"
|
---|
6456 | elif test "$linkmode" != prog && test "$linkmode" != lib; then
|
---|
6457 | func_fatal_error "\`$lib' is not a convenience library"
|
---|
6458 | fi
|
---|
6459 | tmp_libs=
|
---|
6460 | for deplib in $dependency_libs; do
|
---|
6461 | deplibs="$deplib $deplibs"
|
---|
6462 | if $opt_preserve_dup_deps ; then
|
---|
6463 | case "$tmp_libs " in
|
---|
6464 | *" $deplib "*) func_append specialdeplibs " $deplib" ;;
|
---|
6465 | esac
|
---|
6466 | fi
|
---|
6467 | func_append tmp_libs " $deplib"
|
---|
6468 | done
|
---|
6469 | continue
|
---|
6470 | fi # $pass = conv
|
---|
6471 |
|
---|
6472 |
|
---|
6473 | # Get the name of the library we link against.
|
---|
6474 | linklib=
|
---|
6475 | if test -n "$old_library" &&
|
---|
6476 | { test "$prefer_static_libs" = yes ||
|
---|
6477 | test "$prefer_static_libs,$installed" = "built,no"; }; then
|
---|
6478 | linklib=$old_library
|
---|
6479 | else
|
---|
6480 | for l in $old_library $library_names; do
|
---|
6481 | linklib="$l"
|
---|
6482 | done
|
---|
6483 | fi
|
---|
6484 | if test -z "$linklib"; then
|
---|
6485 | func_fatal_error "cannot find name of link library for \`$lib'"
|
---|
6486 | fi
|
---|
6487 |
|
---|
6488 | # This library was specified with -dlopen.
|
---|
6489 | if test "$pass" = dlopen; then
|
---|
6490 | if test -z "$libdir"; then
|
---|
6491 | func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
|
---|
6492 | fi
|
---|
6493 | if test -z "$dlname" ||
|
---|
6494 | test "$dlopen_support" != yes ||
|
---|
6495 | test "$build_libtool_libs" = no; then
|
---|
6496 | # If there is no dlname, no dlopen support or we're linking
|
---|
6497 | # statically, we need to preload. We also need to preload any
|
---|
6498 | # dependent libraries so libltdl's deplib preloader doesn't
|
---|
6499 | # bomb out in the load deplibs phase.
|
---|
6500 | func_append dlprefiles " $lib $dependency_libs"
|
---|
6501 | else
|
---|
6502 | func_append newdlfiles " $lib"
|
---|
6503 | fi
|
---|
6504 | continue
|
---|
6505 | fi # $pass = dlopen
|
---|
6506 |
|
---|
6507 | # We need an absolute path.
|
---|
6508 | case $ladir in
|
---|
6509 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
|
---|
6510 | *)
|
---|
6511 | abs_ladir=`cd "$ladir" && pwd`
|
---|
6512 | if test -z "$abs_ladir"; then
|
---|
6513 | func_warning "cannot determine absolute directory name of \`$ladir'"
|
---|
6514 | func_warning "passing it literally to the linker, although it might fail"
|
---|
6515 | abs_ladir="$ladir"
|
---|
6516 | fi
|
---|
6517 | ;;
|
---|
6518 | esac
|
---|
6519 | func_basename "$lib"
|
---|
6520 | laname="$func_basename_result"
|
---|
6521 |
|
---|
6522 | # Find the relevant object directory and library name.
|
---|
6523 | if test "X$installed" = Xyes; then
|
---|
6524 | if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
|
---|
6525 | func_warning "library \`$lib' was moved."
|
---|
6526 | dir="$ladir"
|
---|
6527 | absdir="$abs_ladir"
|
---|
6528 | libdir="$abs_ladir"
|
---|
6529 | else
|
---|
6530 | dir="$lt_sysroot$libdir"
|
---|
6531 | absdir="$lt_sysroot$libdir"
|
---|
6532 | fi
|
---|
6533 | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
|
---|
6534 | else
|
---|
6535 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
|
---|
6536 | dir="$ladir"
|
---|
6537 | absdir="$abs_ladir"
|
---|
6538 | # Remove this search path later
|
---|
6539 | func_append notinst_path " $abs_ladir"
|
---|
6540 | else
|
---|
6541 | dir="$ladir/$objdir"
|
---|
6542 | absdir="$abs_ladir/$objdir"
|
---|
6543 | # Remove this search path later
|
---|
6544 | func_append notinst_path " $abs_ladir"
|
---|
6545 | fi
|
---|
6546 | fi # $installed = yes
|
---|
6547 | func_stripname 'lib' '.la' "$laname"
|
---|
6548 | name=$func_stripname_result
|
---|
6549 |
|
---|
6550 | # This library was specified with -dlpreopen.
|
---|
6551 | if test "$pass" = dlpreopen; then
|
---|
6552 | if test -z "$libdir" && test "$linkmode" = prog; then
|
---|
6553 | func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
|
---|
6554 | fi
|
---|
6555 | case "$host" in
|
---|
6556 | # special handling for platforms with PE-DLLs.
|
---|
6557 | *cygwin* | *mingw* | *cegcc* )
|
---|
6558 | # Linker will automatically link against shared library if both
|
---|
6559 | # static and shared are present. Therefore, ensure we extract
|
---|
6560 | # symbols from the import library if a shared library is present
|
---|
6561 | # (otherwise, the dlopen module name will be incorrect). We do
|
---|
6562 | # this by putting the import library name into $newdlprefiles.
|
---|
6563 | # We recover the dlopen module name by 'saving' the la file
|
---|
6564 | # name in a special purpose variable, and (later) extracting the
|
---|
6565 | # dlname from the la file.
|
---|
6566 | if test -n "$dlname"; then
|
---|
6567 | func_tr_sh "$dir/$linklib"
|
---|
6568 | eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
|
---|
6569 | func_append newdlprefiles " $dir/$linklib"
|
---|
6570 | else
|
---|
6571 | func_append newdlprefiles " $dir/$old_library"
|
---|
6572 | # Keep a list of preopened convenience libraries to check
|
---|
6573 | # that they are being used correctly in the link pass.
|
---|
6574 | test -z "$libdir" && \
|
---|
6575 | func_append dlpreconveniencelibs " $dir/$old_library"
|
---|
6576 | fi
|
---|
6577 | ;;
|
---|
6578 | * )
|
---|
6579 | # Prefer using a static library (so that no silly _DYNAMIC symbols
|
---|
6580 | # are required to link).
|
---|
6581 | if test -n "$old_library"; then
|
---|
6582 | func_append newdlprefiles " $dir/$old_library"
|
---|
6583 | # Keep a list of preopened convenience libraries to check
|
---|
6584 | # that they are being used correctly in the link pass.
|
---|
6585 | test -z "$libdir" && \
|
---|
6586 | func_append dlpreconveniencelibs " $dir/$old_library"
|
---|
6587 | # Otherwise, use the dlname, so that lt_dlopen finds it.
|
---|
6588 | elif test -n "$dlname"; then
|
---|
6589 | func_append newdlprefiles " $dir/$dlname"
|
---|
6590 | else
|
---|
6591 | func_append newdlprefiles " $dir/$linklib"
|
---|
6592 | fi
|
---|
6593 | ;;
|
---|
6594 | esac
|
---|
6595 | fi # $pass = dlpreopen
|
---|
6596 |
|
---|
6597 | if test -z "$libdir"; then
|
---|
6598 | # Link the convenience library
|
---|
6599 | if test "$linkmode" = lib; then
|
---|
6600 | deplibs="$dir/$old_library $deplibs"
|
---|
6601 | elif test "$linkmode,$pass" = "prog,link"; then
|
---|
6602 | compile_deplibs="$dir/$old_library $compile_deplibs"
|
---|
6603 | finalize_deplibs="$dir/$old_library $finalize_deplibs"
|
---|
6604 | else
|
---|
6605 | deplibs="$lib $deplibs" # used for prog,scan pass
|
---|
6606 | fi
|
---|
6607 | continue
|
---|
6608 | fi
|
---|
6609 |
|
---|
6610 |
|
---|
6611 | if test "$linkmode" = prog && test "$pass" != link; then
|
---|
6612 | func_append newlib_search_path " $ladir"
|
---|
6613 | deplibs="$lib $deplibs"
|
---|
6614 |
|
---|
6615 | linkalldeplibs=no
|
---|
6616 | if test "$link_all_deplibs" != no || test -z "$library_names" ||
|
---|
6617 | test "$build_libtool_libs" = no; then
|
---|
6618 | linkalldeplibs=yes
|
---|
6619 | fi
|
---|
6620 |
|
---|
6621 | tmp_libs=
|
---|
6622 | for deplib in $dependency_libs; do
|
---|
6623 | case $deplib in
|
---|
6624 | -L*) func_stripname '-L' '' "$deplib"
|
---|
6625 | func_resolve_sysroot "$func_stripname_result"
|
---|
6626 | func_append newlib_search_path " $func_resolve_sysroot_result"
|
---|
6627 | ;;
|
---|
6628 | esac
|
---|
6629 | # Need to link against all dependency_libs?
|
---|
6630 | if test "$linkalldeplibs" = yes; then
|
---|
6631 | deplibs="$deplib $deplibs"
|
---|
6632 | else
|
---|
6633 | # Need to hardcode shared library paths
|
---|
6634 | # or/and link against static libraries
|
---|
6635 | newdependency_libs="$deplib $newdependency_libs"
|
---|
6636 | fi
|
---|
6637 | if $opt_preserve_dup_deps ; then
|
---|
6638 | case "$tmp_libs " in
|
---|
6639 | *" $deplib "*) func_append specialdeplibs " $deplib" ;;
|
---|
6640 | esac
|
---|
6641 | fi
|
---|
6642 | func_append tmp_libs " $deplib"
|
---|
6643 | done # for deplib
|
---|
6644 | continue
|
---|
6645 | fi # $linkmode = prog...
|
---|
6646 |
|
---|
6647 | if test "$linkmode,$pass" = "prog,link"; then
|
---|
6648 | if test -n "$library_names" &&
|
---|
6649 | { { test "$prefer_static_libs" = no ||
|
---|
6650 | test "$prefer_static_libs,$installed" = "built,yes"; } ||
|
---|
6651 | test -z "$old_library"; }; then
|
---|
6652 | # We need to hardcode the library path
|
---|
6653 | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
|
---|
6654 | # Make sure the rpath contains only unique directories.
|
---|
6655 | case "$temp_rpath:" in
|
---|
6656 | *"$absdir:"*) ;;
|
---|
6657 | *) func_append temp_rpath "$absdir:" ;;
|
---|
6658 | esac
|
---|
6659 | fi
|
---|
6660 |
|
---|
6661 | # Hardcode the library path.
|
---|
6662 | # Skip directories that are in the system default run-time
|
---|
6663 | # search path.
|
---|
6664 | case " $sys_lib_dlsearch_path " in
|
---|
6665 | *" $absdir "*) ;;
|
---|
6666 | *)
|
---|
6667 | case "$compile_rpath " in
|
---|
6668 | *" $absdir "*) ;;
|
---|
6669 | *) func_append compile_rpath " $absdir" ;;
|
---|
6670 | esac
|
---|
6671 | ;;
|
---|
6672 | esac
|
---|
6673 | case " $sys_lib_dlsearch_path " in
|
---|
6674 | *" $libdir "*) ;;
|
---|
6675 | *)
|
---|
6676 | case "$finalize_rpath " in
|
---|
6677 | *" $libdir "*) ;;
|
---|
6678 | *) func_append finalize_rpath " $libdir" ;;
|
---|
6679 | esac
|
---|
6680 | ;;
|
---|
6681 | esac
|
---|
6682 | fi # $linkmode,$pass = prog,link...
|
---|
6683 |
|
---|
6684 | if test "$alldeplibs" = yes &&
|
---|
6685 | { test "$deplibs_check_method" = pass_all ||
|
---|
6686 | { test "$build_libtool_libs" = yes &&
|
---|
6687 | test -n "$library_names"; }; }; then
|
---|
6688 | # We only need to search for static libraries
|
---|
6689 | continue
|
---|
6690 | fi
|
---|
6691 | fi
|
---|
6692 |
|
---|
6693 | link_static=no # Whether the deplib will be linked statically
|
---|
6694 | use_static_libs=$prefer_static_libs
|
---|
6695 | if test "$use_static_libs" = built && test "$installed" = yes; then
|
---|
6696 | use_static_libs=no
|
---|
6697 | fi
|
---|
6698 | if test -n "$library_names" &&
|
---|
6699 | { test "$use_static_libs" = no || test -z "$old_library"; }; then
|
---|
6700 | case $host in
|
---|
6701 | *cygwin* | *mingw* | *cegcc*)
|
---|
6702 | # No point in relinking DLLs because paths are not encoded
|
---|
6703 | func_append notinst_deplibs " $lib"
|
---|
6704 | need_relink=no
|
---|
6705 | ;;
|
---|
6706 | *)
|
---|
6707 | if test "$installed" = no; then
|
---|
6708 | func_append notinst_deplibs " $lib"
|
---|
6709 | need_relink=yes
|
---|
6710 | fi
|
---|
6711 | ;;
|
---|
6712 | esac
|
---|
6713 | # This is a shared library
|
---|
6714 |
|
---|
6715 | # Warn about portability, can't link against -module's on some
|
---|
6716 | # systems (darwin). Don't bleat about dlopened modules though!
|
---|
6717 | dlopenmodule=""
|
---|
6718 | for dlpremoduletest in $dlprefiles; do
|
---|
6719 | if test "X$dlpremoduletest" = "X$lib"; then
|
---|
6720 | dlopenmodule="$dlpremoduletest"
|
---|
6721 | break
|
---|
6722 | fi
|
---|
6723 | done
|
---|
6724 | if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
|
---|
6725 | echo
|
---|
6726 | if test "$linkmode" = prog; then
|
---|
6727 | $ECHO "*** Warning: Linking the executable $output against the loadable module"
|
---|
6728 | else
|
---|
6729 | $ECHO "*** Warning: Linking the shared library $output against the loadable module"
|
---|
6730 | fi
|
---|
6731 | $ECHO "*** $linklib is not portable!"
|
---|
6732 | fi
|
---|
6733 | if test "$linkmode" = lib &&
|
---|
6734 | test "$hardcode_into_libs" = yes; then
|
---|
6735 | # Hardcode the library path.
|
---|
6736 | # Skip directories that are in the system default run-time
|
---|
6737 | # search path.
|
---|
6738 | case " $sys_lib_dlsearch_path " in
|
---|
6739 | *" $absdir "*) ;;
|
---|
6740 | *)
|
---|
6741 | case "$compile_rpath " in
|
---|
6742 | *" $absdir "*) ;;
|
---|
6743 | *) func_append compile_rpath " $absdir" ;;
|
---|
6744 | esac
|
---|
6745 | ;;
|
---|
6746 | esac
|
---|
6747 | case " $sys_lib_dlsearch_path " in
|
---|
6748 | *" $libdir "*) ;;
|
---|
6749 | *)
|
---|
6750 | case "$finalize_rpath " in
|
---|
6751 | *" $libdir "*) ;;
|
---|
6752 | *) func_append finalize_rpath " $libdir" ;;
|
---|
6753 | esac
|
---|
6754 | ;;
|
---|
6755 | esac
|
---|
6756 | fi
|
---|
6757 |
|
---|
6758 | if test -n "$old_archive_from_expsyms_cmds"; then
|
---|
6759 | # figure out the soname
|
---|
6760 | set dummy $library_names
|
---|
6761 | shift
|
---|
6762 | realname="$1"
|
---|
6763 | shift
|
---|
6764 | libname=`eval "\\$ECHO \"$libname_spec\""`
|
---|
6765 | # use dlname if we got it. it's perfectly good, no?
|
---|
6766 | if test -n "$dlname"; then
|
---|
6767 | soname="$dlname"
|
---|
6768 | elif test -n "$soname_spec"; then
|
---|
6769 | # bleh windows
|
---|
6770 | case $host in
|
---|
6771 | *cygwin* | mingw* | *cegcc*)
|
---|
6772 | func_arith $current - $age
|
---|
6773 | major=$func_arith_result
|
---|
6774 | versuffix="-$major"
|
---|
6775 | ;;
|
---|
6776 | esac
|
---|
6777 | eval soname=\"$soname_spec\"
|
---|
6778 | else
|
---|
6779 | soname="$realname"
|
---|
6780 | fi
|
---|
6781 |
|
---|
6782 | # Make a new name for the extract_expsyms_cmds to use
|
---|
6783 | soroot="$soname"
|
---|
6784 | func_basename "$soroot"
|
---|
6785 | soname="$func_basename_result"
|
---|
6786 | func_stripname 'lib' '.dll' "$soname"
|
---|
6787 | newlib=libimp-$func_stripname_result.a
|
---|
6788 |
|
---|
6789 | # If the library has no export list, then create one now
|
---|
6790 | if test -f "$output_objdir/$soname-def"; then :
|
---|
6791 | else
|
---|
6792 | func_verbose "extracting exported symbol list from \`$soname'"
|
---|
6793 | func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
|
---|
6794 | fi
|
---|
6795 |
|
---|
6796 | # Create $newlib
|
---|
6797 | if test -f "$output_objdir/$newlib"; then :; else
|
---|
6798 | func_verbose "generating import library for \`$soname'"
|
---|
6799 | func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
|
---|
6800 | fi
|
---|
6801 | # make sure the library variables are pointing to the new library
|
---|
6802 | dir=$output_objdir
|
---|
6803 | linklib=$newlib
|
---|
6804 | fi # test -n "$old_archive_from_expsyms_cmds"
|
---|
6805 |
|
---|
6806 | if test "$linkmode" = prog || test "$opt_mode" != relink; then
|
---|
6807 | add_shlibpath=
|
---|
6808 | add_dir=
|
---|
6809 | add=
|
---|
6810 | lib_linked=yes
|
---|
6811 | case $hardcode_action in
|
---|
6812 | immediate | unsupported)
|
---|
6813 | if test "$hardcode_direct" = no; then
|
---|
6814 | add="$dir/$linklib"
|
---|
6815 | case $host in
|
---|
6816 | *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
|
---|
6817 | *-*-sysv4*uw2*) add_dir="-L$dir" ;;
|
---|
6818 | *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
|
---|
6819 | *-*-unixware7*) add_dir="-L$dir" ;;
|
---|
6820 | *-*-darwin* )
|
---|
6821 | # if the lib is a (non-dlopened) module then we can not
|
---|
6822 | # link against it, someone is ignoring the earlier warnings
|
---|
6823 | if /usr/bin/file -L $add 2> /dev/null |
|
---|
6824 | $GREP ": [^:]* bundle" >/dev/null ; then
|
---|
6825 | if test "X$dlopenmodule" != "X$lib"; then
|
---|
6826 | $ECHO "*** Warning: lib $linklib is a module, not a shared library"
|
---|
6827 | if test -z "$old_library" ; then
|
---|
6828 | echo
|
---|
6829 | echo "*** And there doesn't seem to be a static archive available"
|
---|
6830 | echo "*** The link will probably fail, sorry"
|
---|
6831 | else
|
---|
6832 | add="$dir/$old_library"
|
---|
6833 | fi
|
---|
6834 | elif test -n "$old_library"; then
|
---|
6835 | add="$dir/$old_library"
|
---|
6836 | fi
|
---|
6837 | fi
|
---|
6838 | esac
|
---|
6839 | elif test "$hardcode_minus_L" = no; then
|
---|
6840 | case $host in
|
---|
6841 | *-*-sunos*) add_shlibpath="$dir" ;;
|
---|
6842 | esac
|
---|
6843 | add_dir="-L$dir"
|
---|
6844 | add="-l$name"
|
---|
6845 | elif test "$hardcode_shlibpath_var" = no; then
|
---|
6846 | add_shlibpath="$dir"
|
---|
6847 | add="-l$name"
|
---|
6848 | else
|
---|
6849 | lib_linked=no
|
---|
6850 | fi
|
---|
6851 | ;;
|
---|
6852 | relink)
|
---|
6853 | if test "$hardcode_direct" = yes &&
|
---|
6854 | test "$hardcode_direct_absolute" = no; then
|
---|
6855 | add="$dir/$linklib"
|
---|
6856 | elif test "$hardcode_minus_L" = yes; then
|
---|
6857 | add_dir="-L$absdir"
|
---|
6858 | # Try looking first in the location we're being installed to.
|
---|
6859 | if test -n "$inst_prefix_dir"; then
|
---|
6860 | case $libdir in
|
---|
6861 | [\\/]*)
|
---|
6862 | func_append add_dir " -L$inst_prefix_dir$libdir"
|
---|
6863 | ;;
|
---|
6864 | esac
|
---|
6865 | fi
|
---|
6866 | add="-l$name"
|
---|
6867 | elif test "$hardcode_shlibpath_var" = yes; then
|
---|
6868 | add_shlibpath="$dir"
|
---|
6869 | add="-l$name"
|
---|
6870 | else
|
---|
6871 | lib_linked=no
|
---|
6872 | fi
|
---|
6873 | ;;
|
---|
6874 | *) lib_linked=no ;;
|
---|
6875 | esac
|
---|
6876 |
|
---|
6877 | if test "$lib_linked" != yes; then
|
---|
6878 | func_fatal_configuration "unsupported hardcode properties"
|
---|
6879 | fi
|
---|
6880 |
|
---|
6881 | if test -n "$add_shlibpath"; then
|
---|
6882 | case :$compile_shlibpath: in
|
---|
6883 | *":$add_shlibpath:"*) ;;
|
---|
6884 | *) func_append compile_shlibpath "$add_shlibpath:" ;;
|
---|
6885 | esac
|
---|
6886 | fi
|
---|
6887 | if test "$linkmode" = prog; then
|
---|
6888 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
|
---|
6889 | test -n "$add" && compile_deplibs="$add $compile_deplibs"
|
---|
6890 | else
|
---|
6891 | test -n "$add_dir" && deplibs="$add_dir $deplibs"
|
---|
6892 | test -n "$add" && deplibs="$add $deplibs"
|
---|
6893 | if test "$hardcode_direct" != yes &&
|
---|
6894 | test "$hardcode_minus_L" != yes &&
|
---|
6895 | test "$hardcode_shlibpath_var" = yes; then
|
---|
6896 | case :$finalize_shlibpath: in
|
---|
6897 | *":$libdir:"*) ;;
|
---|
6898 | *) func_append finalize_shlibpath "$libdir:" ;;
|
---|
6899 | esac
|
---|
6900 | fi
|
---|
6901 | fi
|
---|
6902 | fi
|
---|
6903 |
|
---|
6904 | if test "$linkmode" = prog || test "$opt_mode" = relink; then
|
---|
6905 | add_shlibpath=
|
---|
6906 | add_dir=
|
---|
6907 | add=
|
---|
6908 | # Finalize command for both is simple: just hardcode it.
|
---|
6909 | if test "$hardcode_direct" = yes &&
|
---|
6910 | test "$hardcode_direct_absolute" = no; then
|
---|
6911 | add="$libdir/$linklib"
|
---|
6912 | elif test "$hardcode_minus_L" = yes; then
|
---|
6913 | add_dir="-L$libdir"
|
---|
6914 | add="-l$name"
|
---|
6915 | elif test "$hardcode_shlibpath_var" = yes; then
|
---|
6916 | case :$finalize_shlibpath: in
|
---|
6917 | *":$libdir:"*) ;;
|
---|
6918 | *) func_append finalize_shlibpath "$libdir:" ;;
|
---|
6919 | esac
|
---|
6920 | add="-l$name"
|
---|
6921 | elif test "$hardcode_automatic" = yes; then
|
---|
6922 | if test -n "$inst_prefix_dir" &&
|
---|
6923 | test -f "$inst_prefix_dir$libdir/$linklib" ; then
|
---|
6924 | add="$inst_prefix_dir$libdir/$linklib"
|
---|
6925 | else
|
---|
6926 | add="$libdir/$linklib"
|
---|
6927 | fi
|
---|
6928 | else
|
---|
6929 | # We cannot seem to hardcode it, guess we'll fake it.
|
---|
6930 | add_dir="-L$libdir"
|
---|
6931 | # Try looking first in the location we're being installed to.
|
---|
6932 | if test -n "$inst_prefix_dir"; then
|
---|
6933 | case $libdir in
|
---|
6934 | [\\/]*)
|
---|
6935 | func_append add_dir " -L$inst_prefix_dir$libdir"
|
---|
6936 | ;;
|
---|
6937 | esac
|
---|
6938 | fi
|
---|
6939 | add="-l$name"
|
---|
6940 | fi
|
---|
6941 |
|
---|
6942 | if test "$linkmode" = prog; then
|
---|
6943 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
|
---|
6944 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
|
---|
6945 | else
|
---|
6946 | test -n "$add_dir" && deplibs="$add_dir $deplibs"
|
---|
6947 | test -n "$add" && deplibs="$add $deplibs"
|
---|
6948 | fi
|
---|
6949 | fi
|
---|
6950 | elif test "$linkmode" = prog; then
|
---|
6951 | # Here we assume that one of hardcode_direct or hardcode_minus_L
|
---|
6952 | # is not unsupported. This is valid on all known static and
|
---|
6953 | # shared platforms.
|
---|
6954 | if test "$hardcode_direct" != unsupported; then
|
---|
6955 | test -n "$old_library" && linklib="$old_library"
|
---|
6956 | compile_deplibs="$dir/$linklib $compile_deplibs"
|
---|
6957 | finalize_deplibs="$dir/$linklib $finalize_deplibs"
|
---|
6958 | else
|
---|
6959 | compile_deplibs="-l$name -L$dir $compile_deplibs"
|
---|
6960 | finalize_deplibs="-l$name -L$dir $finalize_deplibs"
|
---|
6961 | fi
|
---|
6962 | elif test "$build_libtool_libs" = yes; then
|
---|
6963 | # Not a shared library
|
---|
6964 | if test "$deplibs_check_method" != pass_all; then
|
---|
6965 | # We're trying link a shared library against a static one
|
---|
6966 | # but the system doesn't support it.
|
---|
6967 |
|
---|
6968 | # Just print a warning and add the library to dependency_libs so
|
---|
6969 | # that the program can be linked against the static library.
|
---|
6970 | echo
|
---|
6971 | $ECHO "*** Warning: This system can not link to static lib archive $lib."
|
---|
6972 | echo "*** I have the capability to make that library automatically link in when"
|
---|
6973 | echo "*** you link to this library. But I can only do this if you have a"
|
---|
6974 | echo "*** shared version of the library, which you do not appear to have."
|
---|
6975 | if test "$module" = yes; then
|
---|
6976 | echo "*** But as you try to build a module library, libtool will still create "
|
---|
6977 | echo "*** a static module, that should work as long as the dlopening application"
|
---|
6978 | echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
|
---|
6979 | if test -z "$global_symbol_pipe"; then
|
---|
6980 | echo
|
---|
6981 | echo "*** However, this would only work if libtool was able to extract symbol"
|
---|
6982 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
|
---|
6983 | echo "*** not find such a program. So, this module is probably useless."
|
---|
6984 | echo "*** \`nm' from GNU binutils and a full rebuild may help."
|
---|
6985 | fi
|
---|
6986 | if test "$build_old_libs" = no; then
|
---|
6987 | build_libtool_libs=module
|
---|
6988 | build_old_libs=yes
|
---|
6989 | else
|
---|
6990 | build_libtool_libs=no
|
---|
6991 | fi
|
---|
6992 | fi
|
---|
6993 | else
|
---|
6994 | deplibs="$dir/$old_library $deplibs"
|
---|
6995 | link_static=yes
|
---|
6996 | fi
|
---|
6997 | fi # link shared/static library?
|
---|
6998 |
|
---|
6999 | if test "$linkmode" = lib; then
|
---|
7000 | if test -n "$dependency_libs" &&
|
---|
7001 | { test "$hardcode_into_libs" != yes ||
|
---|
7002 | test "$build_old_libs" = yes ||
|
---|
7003 | test "$link_static" = yes; }; then
|
---|
7004 | # Extract -R from dependency_libs
|
---|
7005 | temp_deplibs=
|
---|
7006 | for libdir in $dependency_libs; do
|
---|
7007 | case $libdir in
|
---|
7008 | -R*) func_stripname '-R' '' "$libdir"
|
---|
7009 | temp_xrpath=$func_stripname_result
|
---|
7010 | case " $xrpath " in
|
---|
7011 | *" $temp_xrpath "*) ;;
|
---|
7012 | *) func_append xrpath " $temp_xrpath";;
|
---|
7013 | esac;;
|
---|
7014 | *) func_append temp_deplibs " $libdir";;
|
---|
7015 | esac
|
---|
7016 | done
|
---|
7017 | dependency_libs="$temp_deplibs"
|
---|
7018 | fi
|
---|
7019 |
|
---|
7020 | func_append newlib_search_path " $absdir"
|
---|
7021 | # Link against this library
|
---|
7022 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
|
---|
7023 | # ... and its dependency_libs
|
---|
7024 | tmp_libs=
|
---|
7025 | for deplib in $dependency_libs; do
|
---|
7026 | newdependency_libs="$deplib $newdependency_libs"
|
---|
7027 | case $deplib in
|
---|
7028 | -L*) func_stripname '-L' '' "$deplib"
|
---|
7029 | func_resolve_sysroot "$func_stripname_result";;
|
---|
7030 | *) func_resolve_sysroot "$deplib" ;;
|
---|
7031 | esac
|
---|
7032 | if $opt_preserve_dup_deps ; then
|
---|
7033 | case "$tmp_libs " in
|
---|
7034 | *" $func_resolve_sysroot_result "*)
|
---|
7035 | func_append specialdeplibs " $func_resolve_sysroot_result" ;;
|
---|
7036 | esac
|
---|
7037 | fi
|
---|
7038 | func_append tmp_libs " $func_resolve_sysroot_result"
|
---|
7039 | done
|
---|
7040 |
|
---|
7041 | if test "$link_all_deplibs" != no; then
|
---|
7042 | # Add the search paths of all dependency libraries
|
---|
7043 | for deplib in $dependency_libs; do
|
---|
7044 | path=
|
---|
7045 | case $deplib in
|
---|
7046 | -L*) path="$deplib" ;;
|
---|
7047 | *.la)
|
---|
7048 | func_resolve_sysroot "$deplib"
|
---|
7049 | deplib=$func_resolve_sysroot_result
|
---|
7050 | func_dirname "$deplib" "" "."
|
---|
7051 | dir=$func_dirname_result
|
---|
7052 | # We need an absolute path.
|
---|
7053 | case $dir in
|
---|
7054 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
|
---|
7055 | *)
|
---|
7056 | absdir=`cd "$dir" && pwd`
|
---|
7057 | if test -z "$absdir"; then
|
---|
7058 | func_warning "cannot determine absolute directory name of \`$dir'"
|
---|
7059 | absdir="$dir"
|
---|
7060 | fi
|
---|
7061 | ;;
|
---|
7062 | esac
|
---|
7063 | if $GREP "^installed=no" $deplib > /dev/null; then
|
---|
7064 | case $host in
|
---|
7065 | *-*-darwin*)
|
---|
7066 | depdepl=
|
---|
7067 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
|
---|
7068 | if test -n "$deplibrary_names" ; then
|
---|
7069 | for tmp in $deplibrary_names ; do
|
---|
7070 | depdepl=$tmp
|
---|
7071 | done
|
---|
7072 | if test -f "$absdir/$objdir/$depdepl" ; then
|
---|
7073 | depdepl="$absdir/$objdir/$depdepl"
|
---|
7074 | darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
|
---|
7075 | if test -z "$darwin_install_name"; then
|
---|
7076 | darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
|
---|
7077 | fi
|
---|
7078 | func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
|
---|
7079 | func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
|
---|
7080 | path=
|
---|
7081 | fi
|
---|
7082 | fi
|
---|
7083 | ;;
|
---|
7084 | *)
|
---|
7085 | path="-L$absdir/$objdir"
|
---|
7086 | ;;
|
---|
7087 | esac
|
---|
7088 | else
|
---|
7089 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
---|
7090 | test -z "$libdir" && \
|
---|
7091 | func_fatal_error "\`$deplib' is not a valid libtool archive"
|
---|
7092 | test "$absdir" != "$libdir" && \
|
---|
7093 | func_warning "\`$deplib' seems to be moved"
|
---|
7094 |
|
---|
7095 | path="-L$absdir"
|
---|
7096 | fi
|
---|
7097 | ;;
|
---|
7098 | esac
|
---|
7099 | case " $deplibs " in
|
---|
7100 | *" $path "*) ;;
|
---|
7101 | *) deplibs="$path $deplibs" ;;
|
---|
7102 | esac
|
---|
7103 | done
|
---|
7104 | fi # link_all_deplibs != no
|
---|
7105 | fi # linkmode = lib
|
---|
7106 | done # for deplib in $libs
|
---|
7107 | if test "$pass" = link; then
|
---|
7108 | if test "$linkmode" = "prog"; then
|
---|
7109 | compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
|
---|
7110 | finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
|
---|
7111 | else
|
---|
7112 | compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
---|
7113 | fi
|
---|
7114 | fi
|
---|
7115 | dependency_libs="$newdependency_libs"
|
---|
7116 | if test "$pass" = dlpreopen; then
|
---|
7117 | # Link the dlpreopened libraries before other libraries
|
---|
7118 | for deplib in $save_deplibs; do
|
---|
7119 | deplibs="$deplib $deplibs"
|
---|
7120 | done
|
---|
7121 | fi
|
---|
7122 | if test "$pass" != dlopen; then
|
---|
7123 | if test "$pass" != conv; then
|
---|
7124 | # Make sure lib_search_path contains only unique directories.
|
---|
7125 | lib_search_path=
|
---|
7126 | for dir in $newlib_search_path; do
|
---|
7127 | case "$lib_search_path " in
|
---|
7128 | *" $dir "*) ;;
|
---|
7129 | *) func_append lib_search_path " $dir" ;;
|
---|
7130 | esac
|
---|
7131 | done
|
---|
7132 | newlib_search_path=
|
---|
7133 | fi
|
---|
7134 |
|
---|
7135 | if test "$linkmode,$pass" != "prog,link"; then
|
---|
7136 | vars="deplibs"
|
---|
7137 | else
|
---|
7138 | vars="compile_deplibs finalize_deplibs"
|
---|
7139 | fi
|
---|
7140 | for var in $vars dependency_libs; do
|
---|
7141 | # Add libraries to $var in reverse order
|
---|
7142 | eval tmp_libs=\"\$$var\"
|
---|
7143 | new_libs=
|
---|
7144 | for deplib in $tmp_libs; do
|
---|
7145 | # FIXME: Pedantically, this is the right thing to do, so
|
---|
7146 | # that some nasty dependency loop isn't accidentally
|
---|
7147 | # broken:
|
---|
7148 | #new_libs="$deplib $new_libs"
|
---|
7149 | # Pragmatically, this seems to cause very few problems in
|
---|
7150 | # practice:
|
---|
7151 | case $deplib in
|
---|
7152 | -L*) new_libs="$deplib $new_libs" ;;
|
---|
7153 | -R*) ;;
|
---|
7154 | *)
|
---|
7155 | # And here is the reason: when a library appears more
|
---|
7156 | # than once as an explicit dependence of a library, or
|
---|
7157 | # is implicitly linked in more than once by the
|
---|
7158 | # compiler, it is considered special, and multiple
|
---|
7159 | # occurrences thereof are not removed. Compare this
|
---|
7160 | # with having the same library being listed as a
|
---|
7161 | # dependency of multiple other libraries: in this case,
|
---|
7162 | # we know (pedantically, we assume) the library does not
|
---|
7163 | # need to be listed more than once, so we keep only the
|
---|
7164 | # last copy. This is not always right, but it is rare
|
---|
7165 | # enough that we require users that really mean to play
|
---|
7166 | # such unportable linking tricks to link the library
|
---|
7167 | # using -Wl,-lname, so that libtool does not consider it
|
---|
7168 | # for duplicate removal.
|
---|
7169 | case " $specialdeplibs " in
|
---|
7170 | *" $deplib "*) new_libs="$deplib $new_libs" ;;
|
---|
7171 | *)
|
---|
7172 | case " $new_libs " in
|
---|
7173 | *" $deplib "*) ;;
|
---|
7174 | *) new_libs="$deplib $new_libs" ;;
|
---|
7175 | esac
|
---|
7176 | ;;
|
---|
7177 | esac
|
---|
7178 | ;;
|
---|
7179 | esac
|
---|
7180 | done
|
---|
7181 | tmp_libs=
|
---|
7182 | for deplib in $new_libs; do
|
---|
7183 | case $deplib in
|
---|
7184 | -L*)
|
---|
7185 | case " $tmp_libs " in
|
---|
7186 | *" $deplib "*) ;;
|
---|
7187 | *) func_append tmp_libs " $deplib" ;;
|
---|
7188 | esac
|
---|
7189 | ;;
|
---|
7190 | *) func_append tmp_libs " $deplib" ;;
|
---|
7191 | esac
|
---|
7192 | done
|
---|
7193 | eval $var=\"$tmp_libs\"
|
---|
7194 | done # for var
|
---|
7195 | fi
|
---|
7196 | # Last step: remove runtime libs from dependency_libs
|
---|
7197 | # (they stay in deplibs)
|
---|
7198 | tmp_libs=
|
---|
7199 | for i in $dependency_libs ; do
|
---|
7200 | case " $predeps $postdeps $compiler_lib_search_path " in
|
---|
7201 | *" $i "*)
|
---|
7202 | i=""
|
---|
7203 | ;;
|
---|
7204 | esac
|
---|
7205 | if test -n "$i" ; then
|
---|
7206 | func_append tmp_libs " $i"
|
---|
7207 | fi
|
---|
7208 | done
|
---|
7209 | dependency_libs=$tmp_libs
|
---|
7210 | done # for pass
|
---|
7211 | if test "$linkmode" = prog; then
|
---|
7212 | dlfiles="$newdlfiles"
|
---|
7213 | fi
|
---|
7214 | if test "$linkmode" = prog || test "$linkmode" = lib; then
|
---|
7215 | dlprefiles="$newdlprefiles"
|
---|
7216 | fi
|
---|
7217 |
|
---|
7218 | case $linkmode in
|
---|
7219 | oldlib)
|
---|
7220 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
---|
7221 | func_warning "\`-dlopen' is ignored for archives"
|
---|
7222 | fi
|
---|
7223 |
|
---|
7224 | case " $deplibs" in
|
---|
7225 | *\ -l* | *\ -L*)
|
---|
7226 | func_warning "\`-l' and \`-L' are ignored for archives" ;;
|
---|
7227 | esac
|
---|
7228 |
|
---|
7229 | test -n "$rpath" && \
|
---|
7230 | func_warning "\`-rpath' is ignored for archives"
|
---|
7231 |
|
---|
7232 | test -n "$xrpath" && \
|
---|
7233 | func_warning "\`-R' is ignored for archives"
|
---|
7234 |
|
---|
7235 | test -n "$vinfo" && \
|
---|
7236 | func_warning "\`-version-info/-version-number' is ignored for archives"
|
---|
7237 |
|
---|
7238 | test -n "$release" && \
|
---|
7239 | func_warning "\`-release' is ignored for archives"
|
---|
7240 |
|
---|
7241 | test -n "$export_symbols$export_symbols_regex" && \
|
---|
7242 | func_warning "\`-export-symbols' is ignored for archives"
|
---|
7243 |
|
---|
7244 | # Now set the variables for building old libraries.
|
---|
7245 | build_libtool_libs=no
|
---|
7246 | oldlibs="$output"
|
---|
7247 | func_append objs "$old_deplibs"
|
---|
7248 | ;;
|
---|
7249 |
|
---|
7250 | lib)
|
---|
7251 | # Make sure we only generate libraries of the form `libNAME.la'.
|
---|
7252 | case $outputname in
|
---|
7253 | lib*)
|
---|
7254 | func_stripname 'lib' '.la' "$outputname"
|
---|
7255 | name=$func_stripname_result
|
---|
7256 | eval shared_ext=\"$shrext_cmds\"
|
---|
7257 | eval libname=\"$libname_spec\"
|
---|
7258 | ;;
|
---|
7259 | *)
|
---|
7260 | test "$module" = no && \
|
---|
7261 | func_fatal_help "libtool library \`$output' must begin with \`lib'"
|
---|
7262 |
|
---|
7263 | if test "$need_lib_prefix" != no; then
|
---|
7264 | # Add the "lib" prefix for modules if required
|
---|
7265 | func_stripname '' '.la' "$outputname"
|
---|
7266 | name=$func_stripname_result
|
---|
7267 | eval shared_ext=\"$shrext_cmds\"
|
---|
7268 | eval libname=\"$libname_spec\"
|
---|
7269 | else
|
---|
7270 | func_stripname '' '.la' "$outputname"
|
---|
7271 | libname=$func_stripname_result
|
---|
7272 | fi
|
---|
7273 | ;;
|
---|
7274 | esac
|
---|
7275 |
|
---|
7276 | if test -n "$objs"; then
|
---|
7277 | if test "$deplibs_check_method" != pass_all; then
|
---|
7278 | func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
|
---|
7279 | else
|
---|
7280 | echo
|
---|
7281 | $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
|
---|
7282 | $ECHO "*** objects $objs is not portable!"
|
---|
7283 | func_append libobjs " $objs"
|
---|
7284 | fi
|
---|
7285 | fi
|
---|
7286 |
|
---|
7287 | test "$dlself" != no && \
|
---|
7288 | func_warning "\`-dlopen self' is ignored for libtool libraries"
|
---|
7289 |
|
---|
7290 | set dummy $rpath
|
---|
7291 | shift
|
---|
7292 | test "$#" -gt 1 && \
|
---|
7293 | func_warning "ignoring multiple \`-rpath's for a libtool library"
|
---|
7294 |
|
---|
7295 | install_libdir="$1"
|
---|
7296 |
|
---|
7297 | oldlibs=
|
---|
7298 | if test -z "$rpath"; then
|
---|
7299 | if test "$build_libtool_libs" = yes; then
|
---|
7300 | # Building a libtool convenience library.
|
---|
7301 | # Some compilers have problems with a `.al' extension so
|
---|
7302 | # convenience libraries should have the same extension an
|
---|
7303 | # archive normally would.
|
---|
7304 | oldlibs="$output_objdir/$libname.$libext $oldlibs"
|
---|
7305 | build_libtool_libs=convenience
|
---|
7306 | build_old_libs=yes
|
---|
7307 | fi
|
---|
7308 |
|
---|
7309 | test -n "$vinfo" && \
|
---|
7310 | func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
|
---|
7311 |
|
---|
7312 | test -n "$release" && \
|
---|
7313 | func_warning "\`-release' is ignored for convenience libraries"
|
---|
7314 | else
|
---|
7315 |
|
---|
7316 | # Parse the version information argument.
|
---|
7317 | save_ifs="$IFS"; IFS=':'
|
---|
7318 | set dummy $vinfo 0 0 0
|
---|
7319 | shift
|
---|
7320 | IFS="$save_ifs"
|
---|
7321 |
|
---|
7322 | test -n "$7" && \
|
---|
7323 | func_fatal_help "too many parameters to \`-version-info'"
|
---|
7324 |
|
---|
7325 | # convert absolute version numbers to libtool ages
|
---|
7326 | # this retains compatibility with .la files and attempts
|
---|
7327 | # to make the code below a bit more comprehensible
|
---|
7328 |
|
---|
7329 | case $vinfo_number in
|
---|
7330 | yes)
|
---|
7331 | number_major="$1"
|
---|
7332 | number_minor="$2"
|
---|
7333 | number_revision="$3"
|
---|
7334 | #
|
---|
7335 | # There are really only two kinds -- those that
|
---|
7336 | # use the current revision as the major version
|
---|
7337 | # and those that subtract age and use age as
|
---|
7338 | # a minor version. But, then there is irix
|
---|
7339 | # which has an extra 1 added just for fun
|
---|
7340 | #
|
---|
7341 | case $version_type in
|
---|
7342 | # correct linux to gnu/linux during the next big refactor
|
---|
7343 | darwin|linux|osf|windows|none)
|
---|
7344 | func_arith $number_major + $number_minor
|
---|
7345 | current=$func_arith_result
|
---|
7346 | age="$number_minor"
|
---|
7347 | revision="$number_revision"
|
---|
7348 | ;;
|
---|
7349 | freebsd-aout|freebsd-elf|qnx|sunos)
|
---|
7350 | current="$number_major"
|
---|
7351 | revision="$number_minor"
|
---|
7352 | age="0"
|
---|
7353 | ;;
|
---|
7354 | irix|nonstopux)
|
---|
7355 | func_arith $number_major + $number_minor
|
---|
7356 | current=$func_arith_result
|
---|
7357 | age="$number_minor"
|
---|
7358 | revision="$number_minor"
|
---|
7359 | lt_irix_increment=no
|
---|
7360 | ;;
|
---|
7361 | esac
|
---|
7362 | ;;
|
---|
7363 | no)
|
---|
7364 | current="$1"
|
---|
7365 | revision="$2"
|
---|
7366 | age="$3"
|
---|
7367 | ;;
|
---|
7368 | esac
|
---|
7369 |
|
---|
7370 | # Check that each of the things are valid numbers.
|
---|
7371 | case $current in
|
---|
7372 | 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]) ;;
|
---|
7373 | *)
|
---|
7374 | func_error "CURRENT \`$current' must be a nonnegative integer"
|
---|
7375 | func_fatal_error "\`$vinfo' is not valid version information"
|
---|
7376 | ;;
|
---|
7377 | esac
|
---|
7378 |
|
---|
7379 | case $revision in
|
---|
7380 | 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]) ;;
|
---|
7381 | *)
|
---|
7382 | func_error "REVISION \`$revision' must be a nonnegative integer"
|
---|
7383 | func_fatal_error "\`$vinfo' is not valid version information"
|
---|
7384 | ;;
|
---|
7385 | esac
|
---|
7386 |
|
---|
7387 | case $age in
|
---|
7388 | 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]) ;;
|
---|
7389 | *)
|
---|
7390 | func_error "AGE \`$age' must be a nonnegative integer"
|
---|
7391 | func_fatal_error "\`$vinfo' is not valid version information"
|
---|
7392 | ;;
|
---|
7393 | esac
|
---|
7394 |
|
---|
7395 | if test "$age" -gt "$current"; then
|
---|
7396 | func_error "AGE \`$age' is greater than the current interface number \`$current'"
|
---|
7397 | func_fatal_error "\`$vinfo' is not valid version information"
|
---|
7398 | fi
|
---|
7399 |
|
---|
7400 | # Calculate the version variables.
|
---|
7401 | major=
|
---|
7402 | versuffix=
|
---|
7403 | verstring=
|
---|
7404 | case $version_type in
|
---|
7405 | none) ;;
|
---|
7406 |
|
---|
7407 | darwin)
|
---|
7408 | # Like Linux, but with the current version available in
|
---|
7409 | # verstring for coding it into the library header
|
---|
7410 | func_arith $current - $age
|
---|
7411 | major=.$func_arith_result
|
---|
7412 | versuffix="$major.$age.$revision"
|
---|
7413 | # Darwin ld doesn't like 0 for these options...
|
---|
7414 | func_arith $current + 1
|
---|
7415 | minor_current=$func_arith_result
|
---|
7416 | xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
---|
7417 | verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
|
---|
7418 | ;;
|
---|
7419 |
|
---|
7420 | freebsd-aout)
|
---|
7421 | major=".$current"
|
---|
7422 | versuffix=".$current.$revision";
|
---|
7423 | ;;
|
---|
7424 |
|
---|
7425 | freebsd-elf)
|
---|
7426 | major=".$current"
|
---|
7427 | versuffix=".$current"
|
---|
7428 | ;;
|
---|
7429 |
|
---|
7430 | irix | nonstopux)
|
---|
7431 | if test "X$lt_irix_increment" = "Xno"; then
|
---|
7432 | func_arith $current - $age
|
---|
7433 | else
|
---|
7434 | func_arith $current - $age + 1
|
---|
7435 | fi
|
---|
7436 | major=$func_arith_result
|
---|
7437 |
|
---|
7438 | case $version_type in
|
---|
7439 | nonstopux) verstring_prefix=nonstopux ;;
|
---|
7440 | *) verstring_prefix=sgi ;;
|
---|
7441 | esac
|
---|
7442 | verstring="$verstring_prefix$major.$revision"
|
---|
7443 |
|
---|
7444 | # Add in all the interfaces that we are compatible with.
|
---|
7445 | loop=$revision
|
---|
7446 | while test "$loop" -ne 0; do
|
---|
7447 | func_arith $revision - $loop
|
---|
7448 | iface=$func_arith_result
|
---|
7449 | func_arith $loop - 1
|
---|
7450 | loop=$func_arith_result
|
---|
7451 | verstring="$verstring_prefix$major.$iface:$verstring"
|
---|
7452 | done
|
---|
7453 |
|
---|
7454 | # Before this point, $major must not contain `.'.
|
---|
7455 | major=.$major
|
---|
7456 | versuffix="$major.$revision"
|
---|
7457 | ;;
|
---|
7458 |
|
---|
7459 | linux) # correct to gnu/linux during the next big refactor
|
---|
7460 | func_arith $current - $age
|
---|
7461 | major=.$func_arith_result
|
---|
7462 | versuffix="$major.$age.$revision"
|
---|
7463 | ;;
|
---|
7464 |
|
---|
7465 | osf)
|
---|
7466 | func_arith $current - $age
|
---|
7467 | major=.$func_arith_result
|
---|
7468 | versuffix=".$current.$age.$revision"
|
---|
7469 | verstring="$current.$age.$revision"
|
---|
7470 |
|
---|
7471 | # Add in all the interfaces that we are compatible with.
|
---|
7472 | loop=$age
|
---|
7473 | while test "$loop" -ne 0; do
|
---|
7474 | func_arith $current - $loop
|
---|
7475 | iface=$func_arith_result
|
---|
7476 | func_arith $loop - 1
|
---|
7477 | loop=$func_arith_result
|
---|
7478 | verstring="$verstring:${iface}.0"
|
---|
7479 | done
|
---|
7480 |
|
---|
7481 | # Make executables depend on our current version.
|
---|
7482 | func_append verstring ":${current}.0"
|
---|
7483 | ;;
|
---|
7484 |
|
---|
7485 | qnx)
|
---|
7486 | major=".$current"
|
---|
7487 | versuffix=".$current"
|
---|
7488 | ;;
|
---|
7489 |
|
---|
7490 | sunos)
|
---|
7491 | major=".$current"
|
---|
7492 | versuffix=".$current.$revision"
|
---|
7493 | ;;
|
---|
7494 |
|
---|
7495 | windows)
|
---|
7496 | # Use '-' rather than '.', since we only want one
|
---|
7497 | # extension on DOS 8.3 filesystems.
|
---|
7498 | func_arith $current - $age
|
---|
7499 | major=$func_arith_result
|
---|
7500 | versuffix="-$major"
|
---|
7501 | ;;
|
---|
7502 |
|
---|
7503 | *)
|
---|
7504 | func_fatal_configuration "unknown library version type \`$version_type'"
|
---|
7505 | ;;
|
---|
7506 | esac
|
---|
7507 |
|
---|
7508 | # Clear the version info if we defaulted, and they specified a release.
|
---|
7509 | if test -z "$vinfo" && test -n "$release"; then
|
---|
7510 | major=
|
---|
7511 | case $version_type in
|
---|
7512 | darwin)
|
---|
7513 | # we can't check for "0.0" in archive_cmds due to quoting
|
---|
7514 | # problems, so we reset it completely
|
---|
7515 | verstring=
|
---|
7516 | ;;
|
---|
7517 | *)
|
---|
7518 | verstring="0.0"
|
---|
7519 | ;;
|
---|
7520 | esac
|
---|
7521 | if test "$need_version" = no; then
|
---|
7522 | versuffix=
|
---|
7523 | else
|
---|
7524 | versuffix=".0.0"
|
---|
7525 | fi
|
---|
7526 | fi
|
---|
7527 |
|
---|
7528 | # Remove version info from name if versioning should be avoided
|
---|
7529 | if test "$avoid_version" = yes && test "$need_version" = no; then
|
---|
7530 | major=
|
---|
7531 | versuffix=
|
---|
7532 | verstring=""
|
---|
7533 | fi
|
---|
7534 |
|
---|
7535 | # Check to see if the archive will have undefined symbols.
|
---|
7536 | if test "$allow_undefined" = yes; then
|
---|
7537 | if test "$allow_undefined_flag" = unsupported; then
|
---|
7538 | func_warning "undefined symbols not allowed in $host shared libraries"
|
---|
7539 | build_libtool_libs=no
|
---|
7540 | build_old_libs=yes
|
---|
7541 | fi
|
---|
7542 | else
|
---|
7543 | # Don't allow undefined symbols.
|
---|
7544 | allow_undefined_flag="$no_undefined_flag"
|
---|
7545 | fi
|
---|
7546 |
|
---|
7547 | fi
|
---|
7548 |
|
---|
7549 | func_generate_dlsyms "$libname" "$libname" "yes"
|
---|
7550 | func_append libobjs " $symfileobj"
|
---|
7551 | test "X$libobjs" = "X " && libobjs=
|
---|
7552 |
|
---|
7553 | if test "$opt_mode" != relink; then
|
---|
7554 | # Remove our outputs, but don't remove object files since they
|
---|
7555 | # may have been created when compiling PIC objects.
|
---|
7556 | removelist=
|
---|
7557 | tempremovelist=`$ECHO "$output_objdir/*"`
|
---|
7558 | for p in $tempremovelist; do
|
---|
7559 | case $p in
|
---|
7560 | *.$objext | *.gcno)
|
---|
7561 | ;;
|
---|
7562 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
|
---|
7563 | if test "X$precious_files_regex" != "X"; then
|
---|
7564 | if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
|
---|
7565 | then
|
---|
7566 | continue
|
---|
7567 | fi
|
---|
7568 | fi
|
---|
7569 | func_append removelist " $p"
|
---|
7570 | ;;
|
---|
7571 | *) ;;
|
---|
7572 | esac
|
---|
7573 | done
|
---|
7574 | test -n "$removelist" && \
|
---|
7575 | func_show_eval "${RM}r \$removelist"
|
---|
7576 | fi
|
---|
7577 |
|
---|
7578 | # Now set the variables for building old libraries.
|
---|
7579 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
|
---|
7580 | func_append oldlibs " $output_objdir/$libname.$libext"
|
---|
7581 |
|
---|
7582 | # Transform .lo files to .o files.
|
---|
7583 | oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
|
---|
7584 | fi
|
---|
7585 |
|
---|
7586 | # Eliminate all temporary directories.
|
---|
7587 | #for path in $notinst_path; do
|
---|
7588 | # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
|
---|
7589 | # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
|
---|
7590 | # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
|
---|
7591 | #done
|
---|
7592 |
|
---|
7593 | if test -n "$xrpath"; then
|
---|
7594 | # If the user specified any rpath flags, then add them.
|
---|
7595 | temp_xrpath=
|
---|
7596 | for libdir in $xrpath; do
|
---|
7597 | func_replace_sysroot "$libdir"
|
---|
7598 | func_append temp_xrpath " -R$func_replace_sysroot_result"
|
---|
7599 | case "$finalize_rpath " in
|
---|
7600 | *" $libdir "*) ;;
|
---|
7601 | *) func_append finalize_rpath " $libdir" ;;
|
---|
7602 | esac
|
---|
7603 | done
|
---|
7604 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
|
---|
7605 | dependency_libs="$temp_xrpath $dependency_libs"
|
---|
7606 | fi
|
---|
7607 | fi
|
---|
7608 |
|
---|
7609 | # Make sure dlfiles contains only unique files that won't be dlpreopened
|
---|
7610 | old_dlfiles="$dlfiles"
|
---|
7611 | dlfiles=
|
---|
7612 | for lib in $old_dlfiles; do
|
---|
7613 | case " $dlprefiles $dlfiles " in
|
---|
7614 | *" $lib "*) ;;
|
---|
7615 | *) func_append dlfiles " $lib" ;;
|
---|
7616 | esac
|
---|
7617 | done
|
---|
7618 |
|
---|
7619 | # Make sure dlprefiles contains only unique files
|
---|
7620 | old_dlprefiles="$dlprefiles"
|
---|
7621 | dlprefiles=
|
---|
7622 | for lib in $old_dlprefiles; do
|
---|
7623 | case "$dlprefiles " in
|
---|
7624 | *" $lib "*) ;;
|
---|
7625 | *) func_append dlprefiles " $lib" ;;
|
---|
7626 | esac
|
---|
7627 | done
|
---|
7628 |
|
---|
7629 | if test "$build_libtool_libs" = yes; then
|
---|
7630 | if test -n "$rpath"; then
|
---|
7631 | case $host in
|
---|
7632 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
---|
7633 | # these systems don't actually have a c library (as such)!
|
---|
7634 | ;;
|
---|
7635 | *-*-rhapsody* | *-*-darwin1.[012])
|
---|
7636 | # Rhapsody C library is in the System framework
|
---|
7637 | func_append deplibs " System.ltframework"
|
---|
7638 | ;;
|
---|
7639 | *-*-netbsd*)
|
---|
7640 | # Don't link with libc until the a.out ld.so is fixed.
|
---|
7641 | ;;
|
---|
7642 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
---|
7643 | # Do not include libc due to us having libc/libc_r.
|
---|
7644 | ;;
|
---|
7645 | *-*-sco3.2v5* | *-*-sco5v6*)
|
---|
7646 | # Causes problems with __ctype
|
---|
7647 | ;;
|
---|
7648 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
---|
7649 | # Compiler inserts libc in the correct place for threads to work
|
---|
7650 | ;;
|
---|
7651 | *)
|
---|
7652 | # Add libc to deplibs on all other systems if necessary.
|
---|
7653 | if test "$build_libtool_need_lc" = "yes"; then
|
---|
7654 | func_append deplibs " -lc"
|
---|
7655 | fi
|
---|
7656 | ;;
|
---|
7657 | esac
|
---|
7658 | fi
|
---|
7659 |
|
---|
7660 | # Transform deplibs into only deplibs that can be linked in shared.
|
---|
7661 | name_save=$name
|
---|
7662 | libname_save=$libname
|
---|
7663 | release_save=$release
|
---|
7664 | versuffix_save=$versuffix
|
---|
7665 | major_save=$major
|
---|
7666 | # I'm not sure if I'm treating the release correctly. I think
|
---|
7667 | # release should show up in the -l (ie -lgmp5) so we don't want to
|
---|
7668 | # add it in twice. Is that correct?
|
---|
7669 | release=""
|
---|
7670 | versuffix=""
|
---|
7671 | major=""
|
---|
7672 | newdeplibs=
|
---|
7673 | droppeddeps=no
|
---|
7674 | case $deplibs_check_method in
|
---|
7675 | pass_all)
|
---|
7676 | # Don't check for shared/static. Everything works.
|
---|
7677 | # This might be a little naive. We might want to check
|
---|
7678 | # whether the library exists or not. But this is on
|
---|
7679 | # osf3 & osf4 and I'm not really sure... Just
|
---|
7680 | # implementing what was already the behavior.
|
---|
7681 | newdeplibs=$deplibs
|
---|
7682 | ;;
|
---|
7683 | test_compile)
|
---|
7684 | # This code stresses the "libraries are programs" paradigm to its
|
---|
7685 | # limits. Maybe even breaks it. We compile a program, linking it
|
---|
7686 | # against the deplibs as a proxy for the library. Then we can check
|
---|
7687 | # whether they linked in statically or dynamically with ldd.
|
---|
7688 | $opt_dry_run || $RM conftest.c
|
---|
7689 | cat > conftest.c <<EOF
|
---|
7690 | int main() { return 0; }
|
---|
7691 | EOF
|
---|
7692 | $opt_dry_run || $RM conftest
|
---|
7693 | if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
|
---|
7694 | ldd_output=`ldd conftest`
|
---|
7695 | for i in $deplibs; do
|
---|
7696 | case $i in
|
---|
7697 | -l*)
|
---|
7698 | func_stripname -l '' "$i"
|
---|
7699 | name=$func_stripname_result
|
---|
7700 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
---|
7701 | case " $predeps $postdeps " in
|
---|
7702 | *" $i "*)
|
---|
7703 | func_append newdeplibs " $i"
|
---|
7704 | i=""
|
---|
7705 | ;;
|
---|
7706 | esac
|
---|
7707 | fi
|
---|
7708 | if test -n "$i" ; then
|
---|
7709 | libname=`eval "\\$ECHO \"$libname_spec\""`
|
---|
7710 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
|
---|
7711 | set dummy $deplib_matches; shift
|
---|
7712 | deplib_match=$1
|
---|
7713 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
|
---|
7714 | func_append newdeplibs " $i"
|
---|
7715 | else
|
---|
7716 | droppeddeps=yes
|
---|
7717 | echo
|
---|
7718 | $ECHO "*** Warning: dynamic linker does not accept needed library $i."
|
---|
7719 | echo "*** I have the capability to make that library automatically link in when"
|
---|
7720 | echo "*** you link to this library. But I can only do this if you have a"
|
---|
7721 | echo "*** shared version of the library, which I believe you do not have"
|
---|
7722 | echo "*** because a test_compile did reveal that the linker did not use it for"
|
---|
7723 | echo "*** its dynamic dependency list that programs get resolved with at runtime."
|
---|
7724 | fi
|
---|
7725 | fi
|
---|
7726 | ;;
|
---|
7727 | *)
|
---|
7728 | func_append newdeplibs " $i"
|
---|
7729 | ;;
|
---|
7730 | esac
|
---|
7731 | done
|
---|
7732 | else
|
---|
7733 | # Error occurred in the first compile. Let's try to salvage
|
---|
7734 | # the situation: Compile a separate program for each library.
|
---|
7735 | for i in $deplibs; do
|
---|
7736 | case $i in
|
---|
7737 | -l*)
|
---|
7738 | func_stripname -l '' "$i"
|
---|
7739 | name=$func_stripname_result
|
---|
7740 | $opt_dry_run || $RM conftest
|
---|
7741 | if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
|
---|
7742 | ldd_output=`ldd conftest`
|
---|
7743 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
---|
7744 | case " $predeps $postdeps " in
|
---|
7745 | *" $i "*)
|
---|
7746 | func_append newdeplibs " $i"
|
---|
7747 | i=""
|
---|
7748 | ;;
|
---|
7749 | esac
|
---|
7750 | fi
|
---|
7751 | if test -n "$i" ; then
|
---|
7752 | libname=`eval "\\$ECHO \"$libname_spec\""`
|
---|
7753 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
|
---|
7754 | set dummy $deplib_matches; shift
|
---|
7755 | deplib_match=$1
|
---|
7756 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
|
---|
7757 | func_append newdeplibs " $i"
|
---|
7758 | else
|
---|
7759 | droppeddeps=yes
|
---|
7760 | echo
|
---|
7761 | $ECHO "*** Warning: dynamic linker does not accept needed library $i."
|
---|
7762 | echo "*** I have the capability to make that library automatically link in when"
|
---|
7763 | echo "*** you link to this library. But I can only do this if you have a"
|
---|
7764 | echo "*** shared version of the library, which you do not appear to have"
|
---|
7765 | echo "*** because a test_compile did reveal that the linker did not use this one"
|
---|
7766 | echo "*** as a dynamic dependency that programs can get resolved with at runtime."
|
---|
7767 | fi
|
---|
7768 | fi
|
---|
7769 | else
|
---|
7770 | droppeddeps=yes
|
---|
7771 | echo
|
---|
7772 | $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
|
---|
7773 | echo "*** make it link in! You will probably need to install it or some"
|
---|
7774 | echo "*** library that it depends on before this library will be fully"
|
---|
7775 | echo "*** functional. Installing it before continuing would be even better."
|
---|
7776 | fi
|
---|
7777 | ;;
|
---|
7778 | *)
|
---|
7779 | func_append newdeplibs " $i"
|
---|
7780 | ;;
|
---|
7781 | esac
|
---|
7782 | done
|
---|
7783 | fi
|
---|
7784 | ;;
|
---|
7785 | file_magic*)
|
---|
7786 | set dummy $deplibs_check_method; shift
|
---|
7787 | file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
---|
7788 | for a_deplib in $deplibs; do
|
---|
7789 | case $a_deplib in
|
---|
7790 | -l*)
|
---|
7791 | func_stripname -l '' "$a_deplib"
|
---|
7792 | name=$func_stripname_result
|
---|
7793 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
---|
7794 | case " $predeps $postdeps " in
|
---|
7795 | *" $a_deplib "*)
|
---|
7796 | func_append newdeplibs " $a_deplib"
|
---|
7797 | a_deplib=""
|
---|
7798 | ;;
|
---|
7799 | esac
|
---|
7800 | fi
|
---|
7801 | if test -n "$a_deplib" ; then
|
---|
7802 | libname=`eval "\\$ECHO \"$libname_spec\""`
|
---|
7803 | if test -n "$file_magic_glob"; then
|
---|
7804 | libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
|
---|
7805 | else
|
---|
7806 | libnameglob=$libname
|
---|
7807 | fi
|
---|
7808 | test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
|
---|
7809 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
---|
7810 | if test "$want_nocaseglob" = yes; then
|
---|
7811 | shopt -s nocaseglob
|
---|
7812 | potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
|
---|
7813 | $nocaseglob
|
---|
7814 | else
|
---|
7815 | potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
|
---|
7816 | fi
|
---|
7817 | for potent_lib in $potential_libs; do
|
---|
7818 | # Follow soft links.
|
---|
7819 | if ls -lLd "$potent_lib" 2>/dev/null |
|
---|
7820 | $GREP " -> " >/dev/null; then
|
---|
7821 | continue
|
---|
7822 | fi
|
---|
7823 | # The statement above tries to avoid entering an
|
---|
7824 | # endless loop below, in case of cyclic links.
|
---|
7825 | # We might still enter an endless loop, since a link
|
---|
7826 | # loop can be closed while we follow links,
|
---|
7827 | # but so what?
|
---|
7828 | potlib="$potent_lib"
|
---|
7829 | while test -h "$potlib" 2>/dev/null; do
|
---|
7830 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
|
---|
7831 | case $potliblink in
|
---|
7832 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
|
---|
7833 | *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
|
---|
7834 | esac
|
---|
7835 | done
|
---|
7836 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
|
---|
7837 | $SED -e 10q |
|
---|
7838 | $EGREP "$file_magic_regex" > /dev/null; then
|
---|
7839 | func_append newdeplibs " $a_deplib"
|
---|
7840 | a_deplib=""
|
---|
7841 | break 2
|
---|
7842 | fi
|
---|
7843 | done
|
---|
7844 | done
|
---|
7845 | fi
|
---|
7846 | if test -n "$a_deplib" ; then
|
---|
7847 | droppeddeps=yes
|
---|
7848 | echo
|
---|
7849 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
|
---|
7850 | echo "*** I have the capability to make that library automatically link in when"
|
---|
7851 | echo "*** you link to this library. But I can only do this if you have a"
|
---|
7852 | echo "*** shared version of the library, which you do not appear to have"
|
---|
7853 | echo "*** because I did check the linker path looking for a file starting"
|
---|
7854 | if test -z "$potlib" ; then
|
---|
7855 | $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
|
---|
7856 | else
|
---|
7857 | $ECHO "*** with $libname and none of the candidates passed a file format test"
|
---|
7858 | $ECHO "*** using a file magic. Last file checked: $potlib"
|
---|
7859 | fi
|
---|
7860 | fi
|
---|
7861 | ;;
|
---|
7862 | *)
|
---|
7863 | # Add a -L argument.
|
---|
7864 | func_append newdeplibs " $a_deplib"
|
---|
7865 | ;;
|
---|
7866 | esac
|
---|
7867 | done # Gone through all deplibs.
|
---|
7868 | ;;
|
---|
7869 | match_pattern*)
|
---|
7870 | set dummy $deplibs_check_method; shift
|
---|
7871 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
---|
7872 | for a_deplib in $deplibs; do
|
---|
7873 | case $a_deplib in
|
---|
7874 | -l*)
|
---|
7875 | func_stripname -l '' "$a_deplib"
|
---|
7876 | name=$func_stripname_result
|
---|
7877 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
---|
7878 | case " $predeps $postdeps " in
|
---|
7879 | *" $a_deplib "*)
|
---|
7880 | func_append newdeplibs " $a_deplib"
|
---|
7881 | a_deplib=""
|
---|
7882 | ;;
|
---|
7883 | esac
|
---|
7884 | fi
|
---|
7885 | if test -n "$a_deplib" ; then
|
---|
7886 | libname=`eval "\\$ECHO \"$libname_spec\""`
|
---|
7887 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
---|
7888 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
|
---|
7889 | for potent_lib in $potential_libs; do
|
---|
7890 | potlib="$potent_lib" # see symlink-check above in file_magic test
|
---|
7891 | if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
|
---|
7892 | $EGREP "$match_pattern_regex" > /dev/null; then
|
---|
7893 | func_append newdeplibs " $a_deplib"
|
---|
7894 | a_deplib=""
|
---|
7895 | break 2
|
---|
7896 | fi
|
---|
7897 | done
|
---|
7898 | done
|
---|
7899 | fi
|
---|
7900 | if test -n "$a_deplib" ; then
|
---|
7901 | droppeddeps=yes
|
---|
7902 | echo
|
---|
7903 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
|
---|
7904 | echo "*** I have the capability to make that library automatically link in when"
|
---|
7905 | echo "*** you link to this library. But I can only do this if you have a"
|
---|
7906 | echo "*** shared version of the library, which you do not appear to have"
|
---|
7907 | echo "*** because I did check the linker path looking for a file starting"
|
---|
7908 | if test -z "$potlib" ; then
|
---|
7909 | $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
|
---|
7910 | else
|
---|
7911 | $ECHO "*** with $libname and none of the candidates passed a file format test"
|
---|
7912 | $ECHO "*** using a regex pattern. Last file checked: $potlib"
|
---|
7913 | fi
|
---|
7914 | fi
|
---|
7915 | ;;
|
---|
7916 | *)
|
---|
7917 | # Add a -L argument.
|
---|
7918 | func_append newdeplibs " $a_deplib"
|
---|
7919 | ;;
|
---|
7920 | esac
|
---|
7921 | done # Gone through all deplibs.
|
---|
7922 | ;;
|
---|
7923 | none | unknown | *)
|
---|
7924 | newdeplibs=""
|
---|
7925 | tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
|
---|
7926 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
---|
7927 | for i in $predeps $postdeps ; do
|
---|
7928 | # can't use Xsed below, because $i might contain '/'
|
---|
7929 | tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
|
---|
7930 | done
|
---|
7931 | fi
|
---|
7932 | case $tmp_deplibs in
|
---|
7933 | *[!\ \ ]*)
|
---|
7934 | echo
|
---|
7935 | if test "X$deplibs_check_method" = "Xnone"; then
|
---|
7936 | echo "*** Warning: inter-library dependencies are not supported in this platform."
|
---|
7937 | else
|
---|
7938 | echo "*** Warning: inter-library dependencies are not known to be supported."
|
---|
7939 | fi
|
---|
7940 | echo "*** All declared inter-library dependencies are being dropped."
|
---|
7941 | droppeddeps=yes
|
---|
7942 | ;;
|
---|
7943 | esac
|
---|
7944 | ;;
|
---|
7945 | esac
|
---|
7946 | versuffix=$versuffix_save
|
---|
7947 | major=$major_save
|
---|
7948 | release=$release_save
|
---|
7949 | libname=$libname_save
|
---|
7950 | name=$name_save
|
---|
7951 |
|
---|
7952 | case $host in
|
---|
7953 | *-*-rhapsody* | *-*-darwin1.[012])
|
---|
7954 | # On Rhapsody replace the C library with the System framework
|
---|
7955 | newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
|
---|
7956 | ;;
|
---|
7957 | esac
|
---|
7958 |
|
---|
7959 | if test "$droppeddeps" = yes; then
|
---|
7960 | if test "$module" = yes; then
|
---|
7961 | echo
|
---|
7962 | echo "*** Warning: libtool could not satisfy all declared inter-library"
|
---|
7963 | $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
|
---|
7964 | echo "*** a static module, that should work as long as the dlopening"
|
---|
7965 | echo "*** application is linked with the -dlopen flag."
|
---|
7966 | if test -z "$global_symbol_pipe"; then
|
---|
7967 | echo
|
---|
7968 | echo "*** However, this would only work if libtool was able to extract symbol"
|
---|
7969 | echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
|
---|
7970 | echo "*** not find such a program. So, this module is probably useless."
|
---|
7971 | echo "*** \`nm' from GNU binutils and a full rebuild may help."
|
---|
7972 | fi
|
---|
7973 | if test "$build_old_libs" = no; then
|
---|
7974 | oldlibs="$output_objdir/$libname.$libext"
|
---|
7975 | build_libtool_libs=module
|
---|
7976 | build_old_libs=yes
|
---|
7977 | else
|
---|
7978 | build_libtool_libs=no
|
---|
7979 | fi
|
---|
7980 | else
|
---|
7981 | echo "*** The inter-library dependencies that have been dropped here will be"
|
---|
7982 | echo "*** automatically added whenever a program is linked with this library"
|
---|
7983 | echo "*** or is declared to -dlopen it."
|
---|
7984 |
|
---|
7985 | if test "$allow_undefined" = no; then
|
---|
7986 | echo
|
---|
7987 | echo "*** Since this library must not contain undefined symbols,"
|
---|
7988 | echo "*** because either the platform does not support them or"
|
---|
7989 | echo "*** it was explicitly requested with -no-undefined,"
|
---|
7990 | echo "*** libtool will only create a static version of it."
|
---|
7991 | if test "$build_old_libs" = no; then
|
---|
7992 | oldlibs="$output_objdir/$libname.$libext"
|
---|
7993 | build_libtool_libs=module
|
---|
7994 | build_old_libs=yes
|
---|
7995 | else
|
---|
7996 | build_libtool_libs=no
|
---|
7997 | fi
|
---|
7998 | fi
|
---|
7999 | fi
|
---|
8000 | fi
|
---|
8001 | # Done checking deplibs!
|
---|
8002 | deplibs=$newdeplibs
|
---|
8003 | fi
|
---|
8004 | # Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
---|
8005 | case $host in
|
---|
8006 | *-*-darwin*)
|
---|
8007 | newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
---|
8008 | new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
---|
8009 | deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
---|
8010 | ;;
|
---|
8011 | esac
|
---|
8012 |
|
---|
8013 | # move library search paths that coincide with paths to not yet
|
---|
8014 | # installed libraries to the beginning of the library search list
|
---|
8015 | new_libs=
|
---|
8016 | for path in $notinst_path; do
|
---|
8017 | case " $new_libs " in
|
---|
8018 | *" -L$path/$objdir "*) ;;
|
---|
8019 | *)
|
---|
8020 | case " $deplibs " in
|
---|
8021 | *" -L$path/$objdir "*)
|
---|
8022 | func_append new_libs " -L$path/$objdir" ;;
|
---|
8023 | esac
|
---|
8024 | ;;
|
---|
8025 | esac
|
---|
8026 | done
|
---|
8027 | for deplib in $deplibs; do
|
---|
8028 | case $deplib in
|
---|
8029 | -L*)
|
---|
8030 | case " $new_libs " in
|
---|
8031 | *" $deplib "*) ;;
|
---|
8032 | *) func_append new_libs " $deplib" ;;
|
---|
8033 | esac
|
---|
8034 | ;;
|
---|
8035 | *) func_append new_libs " $deplib" ;;
|
---|
8036 | esac
|
---|
8037 | done
|
---|
8038 | deplibs="$new_libs"
|
---|
8039 |
|
---|
8040 | # All the library-specific variables (install_libdir is set above).
|
---|
8041 | library_names=
|
---|
8042 | old_library=
|
---|
8043 | dlname=
|
---|
8044 |
|
---|
8045 | # Test again, we may have decided not to build it any more
|
---|
8046 | if test "$build_libtool_libs" = yes; then
|
---|
8047 | # Remove ${wl} instances when linking with ld.
|
---|
8048 | # FIXME: should test the right _cmds variable.
|
---|
8049 | case $archive_cmds in
|
---|
8050 | *\$LD\ *) wl= ;;
|
---|
8051 | esac
|
---|
8052 | if test "$hardcode_into_libs" = yes; then
|
---|
8053 | # Hardcode the library paths
|
---|
8054 | hardcode_libdirs=
|
---|
8055 | dep_rpath=
|
---|
8056 | rpath="$finalize_rpath"
|
---|
8057 | test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
|
---|
8058 | for libdir in $rpath; do
|
---|
8059 | if test -n "$hardcode_libdir_flag_spec"; then
|
---|
8060 | if test -n "$hardcode_libdir_separator"; then
|
---|
8061 | func_replace_sysroot "$libdir"
|
---|
8062 | libdir=$func_replace_sysroot_result
|
---|
8063 | if test -z "$hardcode_libdirs"; then
|
---|
8064 | hardcode_libdirs="$libdir"
|
---|
8065 | else
|
---|
8066 | # Just accumulate the unique libdirs.
|
---|
8067 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
---|
8068 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
---|
8069 | ;;
|
---|
8070 | *)
|
---|
8071 | func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
|
---|
8072 | ;;
|
---|
8073 | esac
|
---|
8074 | fi
|
---|
8075 | else
|
---|
8076 | eval flag=\"$hardcode_libdir_flag_spec\"
|
---|
8077 | func_append dep_rpath " $flag"
|
---|
8078 | fi
|
---|
8079 | elif test -n "$runpath_var"; then
|
---|
8080 | case "$perm_rpath " in
|
---|
8081 | *" $libdir "*) ;;
|
---|
8082 | *) func_append perm_rpath " $libdir" ;;
|
---|
8083 | esac
|
---|
8084 | fi
|
---|
8085 | done
|
---|
8086 | # Substitute the hardcoded libdirs into the rpath.
|
---|
8087 | if test -n "$hardcode_libdir_separator" &&
|
---|
8088 | test -n "$hardcode_libdirs"; then
|
---|
8089 | libdir="$hardcode_libdirs"
|
---|
8090 | eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
|
---|
8091 | fi
|
---|
8092 | if test -n "$runpath_var" && test -n "$perm_rpath"; then
|
---|
8093 | # We should set the runpath_var.
|
---|
8094 | rpath=
|
---|
8095 | for dir in $perm_rpath; do
|
---|
8096 | func_append rpath "$dir:"
|
---|
8097 | done
|
---|
8098 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
|
---|
8099 | fi
|
---|
8100 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
|
---|
8101 | fi
|
---|
8102 |
|
---|
8103 | shlibpath="$finalize_shlibpath"
|
---|
8104 | test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
|
---|
8105 | if test -n "$shlibpath"; then
|
---|
8106 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
|
---|
8107 | fi
|
---|
8108 |
|
---|
8109 | # Get the real and link names of the library.
|
---|
8110 | eval shared_ext=\"$shrext_cmds\"
|
---|
8111 | eval library_names=\"$library_names_spec\"
|
---|
8112 | set dummy $library_names
|
---|
8113 | shift
|
---|
8114 | realname="$1"
|
---|
8115 | shift
|
---|
8116 |
|
---|
8117 | if test -n "$soname_spec"; then
|
---|
8118 | eval soname=\"$soname_spec\"
|
---|
8119 | else
|
---|
8120 | soname="$realname"
|
---|
8121 | fi
|
---|
8122 | if test -z "$dlname"; then
|
---|
8123 | dlname=$soname
|
---|
8124 | fi
|
---|
8125 |
|
---|
8126 | lib="$output_objdir/$realname"
|
---|
8127 | linknames=
|
---|
8128 | for link
|
---|
8129 | do
|
---|
8130 | func_append linknames " $link"
|
---|
8131 | done
|
---|
8132 |
|
---|
8133 | # Use standard objects if they are pic
|
---|
8134 | test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
---|
8135 | test "X$libobjs" = "X " && libobjs=
|
---|
8136 |
|
---|
8137 | delfiles=
|
---|
8138 | if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
---|
8139 | $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
|
---|
8140 | export_symbols="$output_objdir/$libname.uexp"
|
---|
8141 | func_append delfiles " $export_symbols"
|
---|
8142 | fi
|
---|
8143 |
|
---|
8144 | orig_export_symbols=
|
---|
8145 | case $host_os in
|
---|
8146 | cygwin* | mingw* | cegcc*)
|
---|
8147 | if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
|
---|
8148 | # exporting using user supplied symfile
|
---|
8149 | if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
|
---|
8150 | # and it's NOT already a .def file. Must figure out
|
---|
8151 | # which of the given symbols are data symbols and tag
|
---|
8152 | # them as such. So, trigger use of export_symbols_cmds.
|
---|
8153 | # export_symbols gets reassigned inside the "prepare
|
---|
8154 | # the list of exported symbols" if statement, so the
|
---|
8155 | # include_expsyms logic still works.
|
---|
8156 | orig_export_symbols="$export_symbols"
|
---|
8157 | export_symbols=
|
---|
8158 | always_export_symbols=yes
|
---|
8159 | fi
|
---|
8160 | fi
|
---|
8161 | ;;
|
---|
8162 | esac
|
---|
8163 |
|
---|
8164 | # Prepare the list of exported symbols
|
---|
8165 | if test -z "$export_symbols"; then
|
---|
8166 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
|
---|
8167 | func_verbose "generating symbol list for \`$libname.la'"
|
---|
8168 | export_symbols="$output_objdir/$libname.exp"
|
---|
8169 | $opt_dry_run || $RM $export_symbols
|
---|
8170 | cmds=$export_symbols_cmds
|
---|
8171 | save_ifs="$IFS"; IFS='~'
|
---|
8172 | for cmd1 in $cmds; do
|
---|
8173 | IFS="$save_ifs"
|
---|
8174 | # Take the normal branch if the nm_file_list_spec branch
|
---|
8175 | # doesn't work or if tool conversion is not needed.
|
---|
8176 | case $nm_file_list_spec~$to_tool_file_cmd in
|
---|
8177 | *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
|
---|
8178 | try_normal_branch=yes
|
---|
8179 | eval cmd=\"$cmd1\"
|
---|
8180 | func_len " $cmd"
|
---|
8181 | len=$func_len_result
|
---|
8182 | ;;
|
---|
8183 | *)
|
---|
8184 | try_normal_branch=no
|
---|
8185 | ;;
|
---|
8186 | esac
|
---|
8187 | if test "$try_normal_branch" = yes \
|
---|
8188 | && { test "$len" -lt "$max_cmd_len" \
|
---|
8189 | || test "$max_cmd_len" -le -1; }
|
---|
8190 | then
|
---|
8191 | func_show_eval "$cmd" 'exit $?'
|
---|
8192 | skipped_export=false
|
---|
8193 | elif test -n "$nm_file_list_spec"; then
|
---|
8194 | func_basename "$output"
|
---|
8195 | output_la=$func_basename_result
|
---|
8196 | save_libobjs=$libobjs
|
---|
8197 | save_output=$output
|
---|
8198 | output=${output_objdir}/${output_la}.nm
|
---|
8199 | func_to_tool_file "$output"
|
---|
8200 | libobjs=$nm_file_list_spec$func_to_tool_file_result
|
---|
8201 | func_append delfiles " $output"
|
---|
8202 | func_verbose "creating $NM input file list: $output"
|
---|
8203 | for obj in $save_libobjs; do
|
---|
8204 | func_to_tool_file "$obj"
|
---|
8205 | $ECHO "$func_to_tool_file_result"
|
---|
8206 | done > "$output"
|
---|
8207 | eval cmd=\"$cmd1\"
|
---|
8208 | func_show_eval "$cmd" 'exit $?'
|
---|
8209 | output=$save_output
|
---|
8210 | libobjs=$save_libobjs
|
---|
8211 | skipped_export=false
|
---|
8212 | else
|
---|
8213 | # The command line is too long to execute in one step.
|
---|
8214 | func_verbose "using reloadable object file for export list..."
|
---|
8215 | skipped_export=:
|
---|
8216 | # Break out early, otherwise skipped_export may be
|
---|
8217 | # set to false by a later but shorter cmd.
|
---|
8218 | break
|
---|
8219 | fi
|
---|
8220 | done
|
---|
8221 | IFS="$save_ifs"
|
---|
8222 | if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
|
---|
8223 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
---|
8224 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
---|
8225 | fi
|
---|
8226 | fi
|
---|
8227 | fi
|
---|
8228 |
|
---|
8229 | if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
---|
8230 | tmp_export_symbols="$export_symbols"
|
---|
8231 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
|
---|
8232 | $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
|
---|
8233 | fi
|
---|
8234 |
|
---|
8235 | if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
|
---|
8236 | # The given exports_symbols file has to be filtered, so filter it.
|
---|
8237 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
|
---|
8238 | # FIXME: $output_objdir/$libname.filter potentially contains lots of
|
---|
8239 | # 's' commands which not all seds can handle. GNU sed should be fine
|
---|
8240 | # though. Also, the filter scales superlinearly with the number of
|
---|
8241 | # global variables. join(1) would be nice here, but unfortunately
|
---|
8242 | # isn't a blessed tool.
|
---|
8243 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
|
---|
8244 | func_append delfiles " $export_symbols $output_objdir/$libname.filter"
|
---|
8245 | export_symbols=$output_objdir/$libname.def
|
---|
8246 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
|
---|
8247 | fi
|
---|
8248 |
|
---|
8249 | tmp_deplibs=
|
---|
8250 | for test_deplib in $deplibs; do
|
---|
8251 | case " $convenience " in
|
---|
8252 | *" $test_deplib "*) ;;
|
---|
8253 | *)
|
---|
8254 | func_append tmp_deplibs " $test_deplib"
|
---|
8255 | ;;
|
---|
8256 | esac
|
---|
8257 | done
|
---|
8258 | deplibs="$tmp_deplibs"
|
---|
8259 |
|
---|
8260 | if test -n "$convenience"; then
|
---|
8261 | if test -n "$whole_archive_flag_spec" &&
|
---|
8262 | test "$compiler_needs_object" = yes &&
|
---|
8263 | test -z "$libobjs"; then
|
---|
8264 | # extract the archives, so we have objects to list.
|
---|
8265 | # TODO: could optimize this to just extract one archive.
|
---|
8266 | whole_archive_flag_spec=
|
---|
8267 | fi
|
---|
8268 | if test -n "$whole_archive_flag_spec"; then
|
---|
8269 | save_libobjs=$libobjs
|
---|
8270 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
|
---|
8271 | test "X$libobjs" = "X " && libobjs=
|
---|
8272 | else
|
---|
8273 | gentop="$output_objdir/${outputname}x"
|
---|
8274 | func_append generated " $gentop"
|
---|
8275 |
|
---|
8276 | func_extract_archives $gentop $convenience
|
---|
8277 | func_append libobjs " $func_extract_archives_result"
|
---|
8278 | test "X$libobjs" = "X " && libobjs=
|
---|
8279 | fi
|
---|
8280 | fi
|
---|
8281 |
|
---|
8282 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
|
---|
8283 | eval flag=\"$thread_safe_flag_spec\"
|
---|
8284 | func_append linker_flags " $flag"
|
---|
8285 | fi
|
---|
8286 |
|
---|
8287 | # Make a backup of the uninstalled library when relinking
|
---|
8288 | if test "$opt_mode" = relink; then
|
---|
8289 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
|
---|
8290 | fi
|
---|
8291 |
|
---|
8292 | # Do each of the archive commands.
|
---|
8293 | if test "$module" = yes && test -n "$module_cmds" ; then
|
---|
8294 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
|
---|
8295 | eval test_cmds=\"$module_expsym_cmds\"
|
---|
8296 | cmds=$module_expsym_cmds
|
---|
8297 | else
|
---|
8298 | eval test_cmds=\"$module_cmds\"
|
---|
8299 | cmds=$module_cmds
|
---|
8300 | fi
|
---|
8301 | else
|
---|
8302 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
|
---|
8303 | eval test_cmds=\"$archive_expsym_cmds\"
|
---|
8304 | cmds=$archive_expsym_cmds
|
---|
8305 | else
|
---|
8306 | eval test_cmds=\"$archive_cmds\"
|
---|
8307 | cmds=$archive_cmds
|
---|
8308 | fi
|
---|
8309 | fi
|
---|
8310 |
|
---|
8311 | if test "X$skipped_export" != "X:" &&
|
---|
8312 | func_len " $test_cmds" &&
|
---|
8313 | len=$func_len_result &&
|
---|
8314 | test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
---|
8315 | :
|
---|
8316 | else
|
---|
8317 | # The command line is too long to link in one step, link piecewise
|
---|
8318 | # or, if using GNU ld and skipped_export is not :, use a linker
|
---|
8319 | # script.
|
---|
8320 |
|
---|
8321 | # Save the value of $output and $libobjs because we want to
|
---|
8322 | # use them later. If we have whole_archive_flag_spec, we
|
---|
8323 | # want to use save_libobjs as it was before
|
---|
8324 | # whole_archive_flag_spec was expanded, because we can't
|
---|
8325 | # assume the linker understands whole_archive_flag_spec.
|
---|
8326 | # This may have to be revisited, in case too many
|
---|
8327 | # convenience libraries get linked in and end up exceeding
|
---|
8328 | # the spec.
|
---|
8329 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
|
---|
8330 | save_libobjs=$libobjs
|
---|
8331 | fi
|
---|
8332 | save_output=$output
|
---|
8333 | func_basename "$output"
|
---|
8334 | output_la=$func_basename_result
|
---|
8335 |
|
---|
8336 | # Clear the reloadable object creation command queue and
|
---|
8337 | # initialize k to one.
|
---|
8338 | test_cmds=
|
---|
8339 | concat_cmds=
|
---|
8340 | objlist=
|
---|
8341 | last_robj=
|
---|
8342 | k=1
|
---|
8343 |
|
---|
8344 | if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
|
---|
8345 | output=${output_objdir}/${output_la}.lnkscript
|
---|
8346 | func_verbose "creating GNU ld script: $output"
|
---|
8347 | echo 'INPUT (' > $output
|
---|
8348 | for obj in $save_libobjs
|
---|
8349 | do
|
---|
8350 | func_to_tool_file "$obj"
|
---|
8351 | $ECHO "$func_to_tool_file_result" >> $output
|
---|
8352 | done
|
---|
8353 | echo ')' >> $output
|
---|
8354 | func_append delfiles " $output"
|
---|
8355 | func_to_tool_file "$output"
|
---|
8356 | output=$func_to_tool_file_result
|
---|
8357 | elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
|
---|
8358 | output=${output_objdir}/${output_la}.lnk
|
---|
8359 | func_verbose "creating linker input file list: $output"
|
---|
8360 | : > $output
|
---|
8361 | set x $save_libobjs
|
---|
8362 | shift
|
---|
8363 | firstobj=
|
---|
8364 | if test "$compiler_needs_object" = yes; then
|
---|
8365 | firstobj="$1 "
|
---|
8366 | shift
|
---|
8367 | fi
|
---|
8368 | for obj
|
---|
8369 | do
|
---|
8370 | func_to_tool_file "$obj"
|
---|
8371 | $ECHO "$func_to_tool_file_result" >> $output
|
---|
8372 | done
|
---|
8373 | func_append delfiles " $output"
|
---|
8374 | func_to_tool_file "$output"
|
---|
8375 | output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
|
---|
8376 | else
|
---|
8377 | if test -n "$save_libobjs"; then
|
---|
8378 | func_verbose "creating reloadable object files..."
|
---|
8379 | output=$output_objdir/$output_la-${k}.$objext
|
---|
8380 | eval test_cmds=\"$reload_cmds\"
|
---|
8381 | func_len " $test_cmds"
|
---|
8382 | len0=$func_len_result
|
---|
8383 | len=$len0
|
---|
8384 |
|
---|
8385 | # Loop over the list of objects to be linked.
|
---|
8386 | for obj in $save_libobjs
|
---|
8387 | do
|
---|
8388 | func_len " $obj"
|
---|
8389 | func_arith $len + $func_len_result
|
---|
8390 | len=$func_arith_result
|
---|
8391 | if test "X$objlist" = X ||
|
---|
8392 | test "$len" -lt "$max_cmd_len"; then
|
---|
8393 | func_append objlist " $obj"
|
---|
8394 | else
|
---|
8395 | # The command $test_cmds is almost too long, add a
|
---|
8396 | # command to the queue.
|
---|
8397 | if test "$k" -eq 1 ; then
|
---|
8398 | # The first file doesn't have a previous command to add.
|
---|
8399 | reload_objs=$objlist
|
---|
8400 | eval concat_cmds=\"$reload_cmds\"
|
---|
8401 | else
|
---|
8402 | # All subsequent reloadable object files will link in
|
---|
8403 | # the last one created.
|
---|
8404 | reload_objs="$objlist $last_robj"
|
---|
8405 | eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
|
---|
8406 | fi
|
---|
8407 | last_robj=$output_objdir/$output_la-${k}.$objext
|
---|
8408 | func_arith $k + 1
|
---|
8409 | k=$func_arith_result
|
---|
8410 | output=$output_objdir/$output_la-${k}.$objext
|
---|
8411 | objlist=" $obj"
|
---|
8412 | func_len " $last_robj"
|
---|
8413 | func_arith $len0 + $func_len_result
|
---|
8414 | len=$func_arith_result
|
---|
8415 | fi
|
---|
8416 | done
|
---|
8417 | # Handle the remaining objects by creating one last
|
---|
8418 | # reloadable object file. All subsequent reloadable object
|
---|
8419 | # files will link in the last one created.
|
---|
8420 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
---|
8421 | reload_objs="$objlist $last_robj"
|
---|
8422 | eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
|
---|
8423 | if test -n "$last_robj"; then
|
---|
8424 | eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
|
---|
8425 | fi
|
---|
8426 | func_append delfiles " $output"
|
---|
8427 |
|
---|
8428 | else
|
---|
8429 | output=
|
---|
8430 | fi
|
---|
8431 |
|
---|
8432 | if ${skipped_export-false}; then
|
---|
8433 | func_verbose "generating symbol list for \`$libname.la'"
|
---|
8434 | export_symbols="$output_objdir/$libname.exp"
|
---|
8435 | $opt_dry_run || $RM $export_symbols
|
---|
8436 | libobjs=$output
|
---|
8437 | # Append the command to create the export file.
|
---|
8438 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
---|
8439 | eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
|
---|
8440 | if test -n "$last_robj"; then
|
---|
8441 | eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
|
---|
8442 | fi
|
---|
8443 | fi
|
---|
8444 |
|
---|
8445 | test -n "$save_libobjs" &&
|
---|
8446 | func_verbose "creating a temporary reloadable object file: $output"
|
---|
8447 |
|
---|
8448 | # Loop through the commands generated above and execute them.
|
---|
8449 | save_ifs="$IFS"; IFS='~'
|
---|
8450 | for cmd in $concat_cmds; do
|
---|
8451 | IFS="$save_ifs"
|
---|
8452 | $opt_silent || {
|
---|
8453 | func_quote_for_expand "$cmd"
|
---|
8454 | eval "func_echo $func_quote_for_expand_result"
|
---|
8455 | }
|
---|
8456 | $opt_dry_run || eval "$cmd" || {
|
---|
8457 | lt_exit=$?
|
---|
8458 |
|
---|
8459 | # Restore the uninstalled library and exit
|
---|
8460 | if test "$opt_mode" = relink; then
|
---|
8461 | ( cd "$output_objdir" && \
|
---|
8462 | $RM "${realname}T" && \
|
---|
8463 | $MV "${realname}U" "$realname" )
|
---|
8464 | fi
|
---|
8465 |
|
---|
8466 | exit $lt_exit
|
---|
8467 | }
|
---|
8468 | done
|
---|
8469 | IFS="$save_ifs"
|
---|
8470 |
|
---|
8471 | if test -n "$export_symbols_regex" && ${skipped_export-false}; then
|
---|
8472 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
---|
8473 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
---|
8474 | fi
|
---|
8475 | fi
|
---|
8476 |
|
---|
8477 | if ${skipped_export-false}; then
|
---|
8478 | if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
---|
8479 | tmp_export_symbols="$export_symbols"
|
---|
8480 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
|
---|
8481 | $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
|
---|
8482 | fi
|
---|
8483 |
|
---|
8484 | if test -n "$orig_export_symbols"; then
|
---|
8485 | # The given exports_symbols file has to be filtered, so filter it.
|
---|
8486 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
|
---|
8487 | # FIXME: $output_objdir/$libname.filter potentially contains lots of
|
---|
8488 | # 's' commands which not all seds can handle. GNU sed should be fine
|
---|
8489 | # though. Also, the filter scales superlinearly with the number of
|
---|
8490 | # global variables. join(1) would be nice here, but unfortunately
|
---|
8491 | # isn't a blessed tool.
|
---|
8492 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
|
---|
8493 | func_append delfiles " $export_symbols $output_objdir/$libname.filter"
|
---|
8494 | export_symbols=$output_objdir/$libname.def
|
---|
8495 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
|
---|
8496 | fi
|
---|
8497 | fi
|
---|
8498 |
|
---|
8499 | libobjs=$output
|
---|
8500 | # Restore the value of output.
|
---|
8501 | output=$save_output
|
---|
8502 |
|
---|
8503 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
|
---|
8504 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
|
---|
8505 | test "X$libobjs" = "X " && libobjs=
|
---|
8506 | fi
|
---|
8507 | # Expand the library linking commands again to reset the
|
---|
8508 | # value of $libobjs for piecewise linking.
|
---|
8509 |
|
---|
8510 | # Do each of the archive commands.
|
---|
8511 | if test "$module" = yes && test -n "$module_cmds" ; then
|
---|
8512 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
|
---|
8513 | cmds=$module_expsym_cmds
|
---|
8514 | else
|
---|
8515 | cmds=$module_cmds
|
---|
8516 | fi
|
---|
8517 | else
|
---|
8518 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
|
---|
8519 | cmds=$archive_expsym_cmds
|
---|
8520 | else
|
---|
8521 | cmds=$archive_cmds
|
---|
8522 | fi
|
---|
8523 | fi
|
---|
8524 | fi
|
---|
8525 |
|
---|
8526 | if test -n "$delfiles"; then
|
---|
8527 | # Append the command to remove temporary files to $cmds.
|
---|
8528 | eval cmds=\"\$cmds~\$RM $delfiles\"
|
---|
8529 | fi
|
---|
8530 |
|
---|
8531 | # Add any objects from preloaded convenience libraries
|
---|
8532 | if test -n "$dlprefiles"; then
|
---|
8533 | gentop="$output_objdir/${outputname}x"
|
---|
8534 | func_append generated " $gentop"
|
---|
8535 |
|
---|
8536 | func_extract_archives $gentop $dlprefiles
|
---|
8537 | func_append libobjs " $func_extract_archives_result"
|
---|
8538 | test "X$libobjs" = "X " && libobjs=
|
---|
8539 | fi
|
---|
8540 |
|
---|
8541 | save_ifs="$IFS"; IFS='~'
|
---|
8542 | for cmd in $cmds; do
|
---|
8543 | IFS="$save_ifs"
|
---|
8544 | eval cmd=\"$cmd\"
|
---|
8545 | $opt_silent || {
|
---|
8546 | func_quote_for_expand "$cmd"
|
---|
8547 | eval "func_echo $func_quote_for_expand_result"
|
---|
8548 | }
|
---|
8549 | $opt_dry_run || eval "$cmd" || {
|
---|
8550 | lt_exit=$?
|
---|
8551 |
|
---|
8552 | # Restore the uninstalled library and exit
|
---|
8553 | if test "$opt_mode" = relink; then
|
---|
8554 | ( cd "$output_objdir" && \
|
---|
8555 | $RM "${realname}T" && \
|
---|
8556 | $MV "${realname}U" "$realname" )
|
---|
8557 | fi
|
---|
8558 |
|
---|
8559 | exit $lt_exit
|
---|
8560 | }
|
---|
8561 | done
|
---|
8562 | IFS="$save_ifs"
|
---|
8563 |
|
---|
8564 | # Restore the uninstalled library and exit
|
---|
8565 | if test "$opt_mode" = relink; then
|
---|
8566 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
|
---|
8567 |
|
---|
8568 | if test -n "$convenience"; then
|
---|
8569 | if test -z "$whole_archive_flag_spec"; then
|
---|
8570 | func_show_eval '${RM}r "$gentop"'
|
---|
8571 | fi
|
---|
8572 | fi
|
---|
8573 |
|
---|
8574 | exit $EXIT_SUCCESS
|
---|
8575 | fi
|
---|
8576 |
|
---|
8577 | # Create links to the real library.
|
---|
8578 | for linkname in $linknames; do
|
---|
8579 | if test "$realname" != "$linkname"; then
|
---|
8580 | func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
|
---|
8581 | fi
|
---|
8582 | done
|
---|
8583 |
|
---|
8584 | # If -module or -export-dynamic was specified, set the dlname.
|
---|
8585 | if test "$module" = yes || test "$export_dynamic" = yes; then
|
---|
8586 | # On all known operating systems, these are identical.
|
---|
8587 | dlname="$soname"
|
---|
8588 | fi
|
---|
8589 | fi
|
---|
8590 | ;;
|
---|
8591 |
|
---|
8592 | obj)
|
---|
8593 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
---|
8594 | func_warning "\`-dlopen' is ignored for objects"
|
---|
8595 | fi
|
---|
8596 |
|
---|
8597 | case " $deplibs" in
|
---|
8598 | *\ -l* | *\ -L*)
|
---|
8599 | func_warning "\`-l' and \`-L' are ignored for objects" ;;
|
---|
8600 | esac
|
---|
8601 |
|
---|
8602 | test -n "$rpath" && \
|
---|
8603 | func_warning "\`-rpath' is ignored for objects"
|
---|
8604 |
|
---|
8605 | test -n "$xrpath" && \
|
---|
8606 | func_warning "\`-R' is ignored for objects"
|
---|
8607 |
|
---|
8608 | test -n "$vinfo" && \
|
---|
8609 | func_warning "\`-version-info' is ignored for objects"
|
---|
8610 |
|
---|
8611 | test -n "$release" && \
|
---|
8612 | func_warning "\`-release' is ignored for objects"
|
---|
8613 |
|
---|
8614 | case $output in
|
---|
8615 | *.lo)
|
---|
8616 | test -n "$objs$old_deplibs" && \
|
---|
8617 | func_fatal_error "cannot build library object \`$output' from non-libtool objects"
|
---|
8618 |
|
---|
8619 | libobj=$output
|
---|
8620 | func_lo2o "$libobj"
|
---|
8621 | obj=$func_lo2o_result
|
---|
8622 | ;;
|
---|
8623 | *)
|
---|
8624 | libobj=
|
---|
8625 | obj="$output"
|
---|
8626 | ;;
|
---|
8627 | esac
|
---|
8628 |
|
---|
8629 | # Delete the old objects.
|
---|
8630 | $opt_dry_run || $RM $obj $libobj
|
---|
8631 |
|
---|
8632 | # Objects from convenience libraries. This assumes
|
---|
8633 | # single-version convenience libraries. Whenever we create
|
---|
8634 | # different ones for PIC/non-PIC, this we'll have to duplicate
|
---|
8635 | # the extraction.
|
---|
8636 | reload_conv_objs=
|
---|
8637 | gentop=
|
---|
8638 | # reload_cmds runs $LD directly, so let us get rid of
|
---|
8639 | # -Wl from whole_archive_flag_spec and hope we can get by with
|
---|
8640 | # turning comma into space..
|
---|
8641 | wl=
|
---|
8642 |
|
---|
8643 | if test -n "$convenience"; then
|
---|
8644 | if test -n "$whole_archive_flag_spec"; then
|
---|
8645 | eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
|
---|
8646 | reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
|
---|
8647 | else
|
---|
8648 | gentop="$output_objdir/${obj}x"
|
---|
8649 | func_append generated " $gentop"
|
---|
8650 |
|
---|
8651 | func_extract_archives $gentop $convenience
|
---|
8652 | reload_conv_objs="$reload_objs $func_extract_archives_result"
|
---|
8653 | fi
|
---|
8654 | fi
|
---|
8655 |
|
---|
8656 | # If we're not building shared, we need to use non_pic_objs
|
---|
8657 | test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
|
---|
8658 |
|
---|
8659 | # Create the old-style object.
|
---|
8660 | reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
|
---|
8661 |
|
---|
8662 | output="$obj"
|
---|
8663 | func_execute_cmds "$reload_cmds" 'exit $?'
|
---|
8664 |
|
---|
8665 | # Exit if we aren't doing a library object file.
|
---|
8666 | if test -z "$libobj"; then
|
---|
8667 | if test -n "$gentop"; then
|
---|
8668 | func_show_eval '${RM}r "$gentop"'
|
---|
8669 | fi
|
---|
8670 |
|
---|
8671 | exit $EXIT_SUCCESS
|
---|
8672 | fi
|
---|
8673 |
|
---|
8674 | if test "$build_libtool_libs" != yes; then
|
---|
8675 | if test -n "$gentop"; then
|
---|
8676 | func_show_eval '${RM}r "$gentop"'
|
---|
8677 | fi
|
---|
8678 |
|
---|
8679 | # Create an invalid libtool object if no PIC, so that we don't
|
---|
8680 | # accidentally link it into a program.
|
---|
8681 | # $show "echo timestamp > $libobj"
|
---|
8682 | # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
|
---|
8683 | exit $EXIT_SUCCESS
|
---|
8684 | fi
|
---|
8685 |
|
---|
8686 | if test -n "$pic_flag" || test "$pic_mode" != default; then
|
---|
8687 | # Only do commands if we really have different PIC objects.
|
---|
8688 | reload_objs="$libobjs $reload_conv_objs"
|
---|
8689 | output="$libobj"
|
---|
8690 | func_execute_cmds "$reload_cmds" 'exit $?'
|
---|
8691 | fi
|
---|
8692 |
|
---|
8693 | if test -n "$gentop"; then
|
---|
8694 | func_show_eval '${RM}r "$gentop"'
|
---|
8695 | fi
|
---|
8696 |
|
---|
8697 | exit $EXIT_SUCCESS
|
---|
8698 | ;;
|
---|
8699 |
|
---|
8700 | prog)
|
---|
8701 | case $host in
|
---|
8702 | *cygwin*) func_stripname '' '.exe' "$output"
|
---|
8703 | output=$func_stripname_result.exe;;
|
---|
8704 | esac
|
---|
8705 | test -n "$vinfo" && \
|
---|
8706 | func_warning "\`-version-info' is ignored for programs"
|
---|
8707 |
|
---|
8708 | test -n "$release" && \
|
---|
8709 | func_warning "\`-release' is ignored for programs"
|
---|
8710 |
|
---|
8711 | test "$preload" = yes \
|
---|
8712 | && test "$dlopen_support" = unknown \
|
---|
8713 | && test "$dlopen_self" = unknown \
|
---|
8714 | && test "$dlopen_self_static" = unknown && \
|
---|
8715 | func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
|
---|
8716 |
|
---|
8717 | case $host in
|
---|
8718 | *-*-rhapsody* | *-*-darwin1.[012])
|
---|
8719 | # On Rhapsody replace the C library is the System framework
|
---|
8720 | compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
|
---|
8721 | finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
|
---|
8722 | ;;
|
---|
8723 | esac
|
---|
8724 |
|
---|
8725 | case $host in
|
---|
8726 | *-*-darwin*)
|
---|
8727 | # Don't allow lazy linking, it breaks C++ global constructors
|
---|
8728 | # But is supposedly fixed on 10.4 or later (yay!).
|
---|
8729 | if test "$tagname" = CXX ; then
|
---|
8730 | case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
|
---|
8731 | 10.[0123])
|
---|
8732 | func_append compile_command " ${wl}-bind_at_load"
|
---|
8733 | func_append finalize_command " ${wl}-bind_at_load"
|
---|
8734 | ;;
|
---|
8735 | esac
|
---|
8736 | fi
|
---|
8737 | # Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
---|
8738 | compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
---|
8739 | finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
---|
8740 | ;;
|
---|
8741 | esac
|
---|
8742 |
|
---|
8743 |
|
---|
8744 | # move library search paths that coincide with paths to not yet
|
---|
8745 | # installed libraries to the beginning of the library search list
|
---|
8746 | new_libs=
|
---|
8747 | for path in $notinst_path; do
|
---|
8748 | case " $new_libs " in
|
---|
8749 | *" -L$path/$objdir "*) ;;
|
---|
8750 | *)
|
---|
8751 | case " $compile_deplibs " in
|
---|
8752 | *" -L$path/$objdir "*)
|
---|
8753 | func_append new_libs " -L$path/$objdir" ;;
|
---|
8754 | esac
|
---|
8755 | ;;
|
---|
8756 | esac
|
---|
8757 | done
|
---|
8758 | for deplib in $compile_deplibs; do
|
---|
8759 | case $deplib in
|
---|
8760 | -L*)
|
---|
8761 | case " $new_libs " in
|
---|
8762 | *" $deplib "*) ;;
|
---|
8763 | *) func_append new_libs " $deplib" ;;
|
---|
8764 | esac
|
---|
8765 | ;;
|
---|
8766 | *) func_append new_libs " $deplib" ;;
|
---|
8767 | esac
|
---|
8768 | done
|
---|
8769 | compile_deplibs="$new_libs"
|
---|
8770 |
|
---|
8771 |
|
---|
8772 | func_append compile_command " $compile_deplibs"
|
---|
8773 | func_append finalize_command " $finalize_deplibs"
|
---|
8774 |
|
---|
8775 | if test -n "$rpath$xrpath"; then
|
---|
8776 | # If the user specified any rpath flags, then add them.
|
---|
8777 | for libdir in $rpath $xrpath; do
|
---|
8778 | # This is the magic to use -rpath.
|
---|
8779 | case "$finalize_rpath " in
|
---|
8780 | *" $libdir "*) ;;
|
---|
8781 | *) func_append finalize_rpath " $libdir" ;;
|
---|
8782 | esac
|
---|
8783 | done
|
---|
8784 | fi
|
---|
8785 |
|
---|
8786 | # Now hardcode the library paths
|
---|
8787 | rpath=
|
---|
8788 | hardcode_libdirs=
|
---|
8789 | for libdir in $compile_rpath $finalize_rpath; do
|
---|
8790 | if test -n "$hardcode_libdir_flag_spec"; then
|
---|
8791 | if test -n "$hardcode_libdir_separator"; then
|
---|
8792 | if test -z "$hardcode_libdirs"; then
|
---|
8793 | hardcode_libdirs="$libdir"
|
---|
8794 | else
|
---|
8795 | # Just accumulate the unique libdirs.
|
---|
8796 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
---|
8797 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
---|
8798 | ;;
|
---|
8799 | *)
|
---|
8800 | func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
|
---|
8801 | ;;
|
---|
8802 | esac
|
---|
8803 | fi
|
---|
8804 | else
|
---|
8805 | eval flag=\"$hardcode_libdir_flag_spec\"
|
---|
8806 | func_append rpath " $flag"
|
---|
8807 | fi
|
---|
8808 | elif test -n "$runpath_var"; then
|
---|
8809 | case "$perm_rpath " in
|
---|
8810 | *" $libdir "*) ;;
|
---|
8811 | *) func_append perm_rpath " $libdir" ;;
|
---|
8812 | esac
|
---|
8813 | fi
|
---|
8814 | case $host in
|
---|
8815 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
---|
8816 | testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
|
---|
8817 | case :$dllsearchpath: in
|
---|
8818 | *":$libdir:"*) ;;
|
---|
8819 | ::) dllsearchpath=$libdir;;
|
---|
8820 | *) func_append dllsearchpath ":$libdir";;
|
---|
8821 | esac
|
---|
8822 | case :$dllsearchpath: in
|
---|
8823 | *":$testbindir:"*) ;;
|
---|
8824 | ::) dllsearchpath=$testbindir;;
|
---|
8825 | *) func_append dllsearchpath ":$testbindir";;
|
---|
8826 | esac
|
---|
8827 | ;;
|
---|
8828 | esac
|
---|
8829 | done
|
---|
8830 | # Substitute the hardcoded libdirs into the rpath.
|
---|
8831 | if test -n "$hardcode_libdir_separator" &&
|
---|
8832 | test -n "$hardcode_libdirs"; then
|
---|
8833 | libdir="$hardcode_libdirs"
|
---|
8834 | eval rpath=\" $hardcode_libdir_flag_spec\"
|
---|
8835 | fi
|
---|
8836 | compile_rpath="$rpath"
|
---|
8837 |
|
---|
8838 | rpath=
|
---|
8839 | hardcode_libdirs=
|
---|
8840 | for libdir in $finalize_rpath; do
|
---|
8841 | if test -n "$hardcode_libdir_flag_spec"; then
|
---|
8842 | if test -n "$hardcode_libdir_separator"; then
|
---|
8843 | if test -z "$hardcode_libdirs"; then
|
---|
8844 | hardcode_libdirs="$libdir"
|
---|
8845 | else
|
---|
8846 | # Just accumulate the unique libdirs.
|
---|
8847 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
---|
8848 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
---|
8849 | ;;
|
---|
8850 | *)
|
---|
8851 | func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
|
---|
8852 | ;;
|
---|
8853 | esac
|
---|
8854 | fi
|
---|
8855 | else
|
---|
8856 | eval flag=\"$hardcode_libdir_flag_spec\"
|
---|
8857 | func_append rpath " $flag"
|
---|
8858 | fi
|
---|
8859 | elif test -n "$runpath_var"; then
|
---|
8860 | case "$finalize_perm_rpath " in
|
---|
8861 | *" $libdir "*) ;;
|
---|
8862 | *) func_append finalize_perm_rpath " $libdir" ;;
|
---|
8863 | esac
|
---|
8864 | fi
|
---|
8865 | done
|
---|
8866 | # Substitute the hardcoded libdirs into the rpath.
|
---|
8867 | if test -n "$hardcode_libdir_separator" &&
|
---|
8868 | test -n "$hardcode_libdirs"; then
|
---|
8869 | libdir="$hardcode_libdirs"
|
---|
8870 | eval rpath=\" $hardcode_libdir_flag_spec\"
|
---|
8871 | fi
|
---|
8872 | finalize_rpath="$rpath"
|
---|
8873 |
|
---|
8874 | if test -n "$libobjs" && test "$build_old_libs" = yes; then
|
---|
8875 | # Transform all the library objects into standard objects.
|
---|
8876 | compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
---|
8877 | finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
---|
8878 | fi
|
---|
8879 |
|
---|
8880 | func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
|
---|
8881 |
|
---|
8882 | # template prelinking step
|
---|
8883 | if test -n "$prelink_cmds"; then
|
---|
8884 | func_execute_cmds "$prelink_cmds" 'exit $?'
|
---|
8885 | fi
|
---|
8886 |
|
---|
8887 | wrappers_required=yes
|
---|
8888 | case $host in
|
---|
8889 | *cegcc* | *mingw32ce*)
|
---|
8890 | # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
|
---|
8891 | wrappers_required=no
|
---|
8892 | ;;
|
---|
8893 | *cygwin* | *mingw* )
|
---|
8894 | if test "$build_libtool_libs" != yes; then
|
---|
8895 | wrappers_required=no
|
---|
8896 | fi
|
---|
8897 | ;;
|
---|
8898 | *)
|
---|
8899 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
|
---|
8900 | wrappers_required=no
|
---|
8901 | fi
|
---|
8902 | ;;
|
---|
8903 | esac
|
---|
8904 | if test "$wrappers_required" = no; then
|
---|
8905 | # Replace the output file specification.
|
---|
8906 | compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
|
---|
8907 | link_command="$compile_command$compile_rpath"
|
---|
8908 |
|
---|
8909 | # We have no uninstalled library dependencies, so finalize right now.
|
---|
8910 | exit_status=0
|
---|
8911 | func_show_eval "$link_command" 'exit_status=$?'
|
---|
8912 |
|
---|
8913 | if test -n "$postlink_cmds"; then
|
---|
8914 | func_to_tool_file "$output"
|
---|
8915 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
|
---|
8916 | func_execute_cmds "$postlink_cmds" 'exit $?'
|
---|
8917 | fi
|
---|
8918 |
|
---|
8919 | # Delete the generated files.
|
---|
8920 | if test -f "$output_objdir/${outputname}S.${objext}"; then
|
---|
8921 | func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
|
---|
8922 | fi
|
---|
8923 |
|
---|
8924 | exit $exit_status
|
---|
8925 | fi
|
---|
8926 |
|
---|
8927 | if test -n "$compile_shlibpath$finalize_shlibpath"; then
|
---|
8928 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
|
---|
8929 | fi
|
---|
8930 | if test -n "$finalize_shlibpath"; then
|
---|
8931 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
|
---|
8932 | fi
|
---|
8933 |
|
---|
8934 | compile_var=
|
---|
8935 | finalize_var=
|
---|
8936 | if test -n "$runpath_var"; then
|
---|
8937 | if test -n "$perm_rpath"; then
|
---|
8938 | # We should set the runpath_var.
|
---|
8939 | rpath=
|
---|
8940 | for dir in $perm_rpath; do
|
---|
8941 | func_append rpath "$dir:"
|
---|
8942 | done
|
---|
8943 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
|
---|
8944 | fi
|
---|
8945 | if test -n "$finalize_perm_rpath"; then
|
---|
8946 | # We should set the runpath_var.
|
---|
8947 | rpath=
|
---|
8948 | for dir in $finalize_perm_rpath; do
|
---|
8949 | func_append rpath "$dir:"
|
---|
8950 | done
|
---|
8951 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
|
---|
8952 | fi
|
---|
8953 | fi
|
---|
8954 |
|
---|
8955 | if test "$no_install" = yes; then
|
---|
8956 | # We don't need to create a wrapper script.
|
---|
8957 | link_command="$compile_var$compile_command$compile_rpath"
|
---|
8958 | # Replace the output file specification.
|
---|
8959 | link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
|
---|
8960 | # Delete the old output file.
|
---|
8961 | $opt_dry_run || $RM $output
|
---|
8962 | # Link the executable and exit
|
---|
8963 | func_show_eval "$link_command" 'exit $?'
|
---|
8964 |
|
---|
8965 | if test -n "$postlink_cmds"; then
|
---|
8966 | func_to_tool_file "$output"
|
---|
8967 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
|
---|
8968 | func_execute_cmds "$postlink_cmds" 'exit $?'
|
---|
8969 | fi
|
---|
8970 |
|
---|
8971 | exit $EXIT_SUCCESS
|
---|
8972 | fi
|
---|
8973 |
|
---|
8974 | if test "$hardcode_action" = relink; then
|
---|
8975 | # Fast installation is not supported
|
---|
8976 | link_command="$compile_var$compile_command$compile_rpath"
|
---|
8977 | relink_command="$finalize_var$finalize_command$finalize_rpath"
|
---|
8978 |
|
---|
8979 | func_warning "this platform does not like uninstalled shared libraries"
|
---|
8980 | func_warning "\`$output' will be relinked during installation"
|
---|
8981 | else
|
---|
8982 | if test "$fast_install" != no; then
|
---|
8983 | link_command="$finalize_var$compile_command$finalize_rpath"
|
---|
8984 | if test "$fast_install" = yes; then
|
---|
8985 | relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
|
---|
8986 | else
|
---|
8987 | # fast_install is set to needless
|
---|
8988 | relink_command=
|
---|
8989 | fi
|
---|
8990 | else
|
---|
8991 | link_command="$compile_var$compile_command$compile_rpath"
|
---|
8992 | relink_command="$finalize_var$finalize_command$finalize_rpath"
|
---|
8993 | fi
|
---|
8994 | fi
|
---|
8995 |
|
---|
8996 | # Replace the output file specification.
|
---|
8997 | link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
|
---|
8998 |
|
---|
8999 | # Delete the old output files.
|
---|
9000 | $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
|
---|
9001 |
|
---|
9002 | func_show_eval "$link_command" 'exit $?'
|
---|
9003 |
|
---|
9004 | if test -n "$postlink_cmds"; then
|
---|
9005 | func_to_tool_file "$output_objdir/$outputname"
|
---|
9006 | postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
|
---|
9007 | func_execute_cmds "$postlink_cmds" 'exit $?'
|
---|
9008 | fi
|
---|
9009 |
|
---|
9010 | # Now create the wrapper script.
|
---|
9011 | func_verbose "creating $output"
|
---|
9012 |
|
---|
9013 | # Quote the relink command for shipping.
|
---|
9014 | if test -n "$relink_command"; then
|
---|
9015 | # Preserve any variables that may affect compiler behavior
|
---|
9016 | for var in $variables_saved_for_relink; do
|
---|
9017 | if eval test -z \"\${$var+set}\"; then
|
---|
9018 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
|
---|
9019 | elif eval var_value=\$$var; test -z "$var_value"; then
|
---|
9020 | relink_command="$var=; export $var; $relink_command"
|
---|
9021 | else
|
---|
9022 | func_quote_for_eval "$var_value"
|
---|
9023 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
|
---|
9024 | fi
|
---|
9025 | done
|
---|
9026 | relink_command="(cd `pwd`; $relink_command)"
|
---|
9027 | relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
|
---|
9028 | fi
|
---|
9029 |
|
---|
9030 | # Only actually do things if not in dry run mode.
|
---|
9031 | $opt_dry_run || {
|
---|
9032 | # win32 will think the script is a binary if it has
|
---|
9033 | # a .exe suffix, so we strip it off here.
|
---|
9034 | case $output in
|
---|
9035 | *.exe) func_stripname '' '.exe' "$output"
|
---|
9036 | output=$func_stripname_result ;;
|
---|
9037 | esac
|
---|
9038 | # test for cygwin because mv fails w/o .exe extensions
|
---|
9039 | case $host in
|
---|
9040 | *cygwin*)
|
---|
9041 | exeext=.exe
|
---|
9042 | func_stripname '' '.exe' "$outputname"
|
---|
9043 | outputname=$func_stripname_result ;;
|
---|
9044 | *) exeext= ;;
|
---|
9045 | esac
|
---|
9046 | case $host in
|
---|
9047 | *cygwin* | *mingw* )
|
---|
9048 | func_dirname_and_basename "$output" "" "."
|
---|
9049 | output_name=$func_basename_result
|
---|
9050 | output_path=$func_dirname_result
|
---|
9051 | cwrappersource="$output_path/$objdir/lt-$output_name.c"
|
---|
9052 | cwrapper="$output_path/$output_name.exe"
|
---|
9053 | $RM $cwrappersource $cwrapper
|
---|
9054 | trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
|
---|
9055 |
|
---|
9056 | func_emit_cwrapperexe_src > $cwrappersource
|
---|
9057 |
|
---|
9058 | # The wrapper executable is built using the $host compiler,
|
---|
9059 | # because it contains $host paths and files. If cross-
|
---|
9060 | # compiling, it, like the target executable, must be
|
---|
9061 | # executed on the $host or under an emulation environment.
|
---|
9062 | $opt_dry_run || {
|
---|
9063 | $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
|
---|
9064 | $STRIP $cwrapper
|
---|
9065 | }
|
---|
9066 |
|
---|
9067 | # Now, create the wrapper script for func_source use:
|
---|
9068 | func_ltwrapper_scriptname $cwrapper
|
---|
9069 | $RM $func_ltwrapper_scriptname_result
|
---|
9070 | trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
|
---|
9071 | $opt_dry_run || {
|
---|
9072 | # note: this script will not be executed, so do not chmod.
|
---|
9073 | if test "x$build" = "x$host" ; then
|
---|
9074 | $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
|
---|
9075 | else
|
---|
9076 | func_emit_wrapper no > $func_ltwrapper_scriptname_result
|
---|
9077 | fi
|
---|
9078 | }
|
---|
9079 | ;;
|
---|
9080 | * )
|
---|
9081 | $RM $output
|
---|
9082 | trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
|
---|
9083 |
|
---|
9084 | func_emit_wrapper no > $output
|
---|
9085 | chmod +x $output
|
---|
9086 | ;;
|
---|
9087 | esac
|
---|
9088 | }
|
---|
9089 | exit $EXIT_SUCCESS
|
---|
9090 | ;;
|
---|
9091 | esac
|
---|
9092 |
|
---|
9093 | # See if we need to build an old-fashioned archive.
|
---|
9094 | for oldlib in $oldlibs; do
|
---|
9095 |
|
---|
9096 | if test "$build_libtool_libs" = convenience; then
|
---|
9097 | oldobjs="$libobjs_save $symfileobj"
|
---|
9098 | addlibs="$convenience"
|
---|
9099 | build_libtool_libs=no
|
---|
9100 | else
|
---|
9101 | if test "$build_libtool_libs" = module; then
|
---|
9102 | oldobjs="$libobjs_save"
|
---|
9103 | build_libtool_libs=no
|
---|
9104 | else
|
---|
9105 | oldobjs="$old_deplibs $non_pic_objects"
|
---|
9106 | if test "$preload" = yes && test -f "$symfileobj"; then
|
---|
9107 | func_append oldobjs " $symfileobj"
|
---|
9108 | fi
|
---|
9109 | fi
|
---|
9110 | addlibs="$old_convenience"
|
---|
9111 | fi
|
---|
9112 |
|
---|
9113 | if test -n "$addlibs"; then
|
---|
9114 | gentop="$output_objdir/${outputname}x"
|
---|
9115 | func_append generated " $gentop"
|
---|
9116 |
|
---|
9117 | func_extract_archives $gentop $addlibs
|
---|
9118 | func_append oldobjs " $func_extract_archives_result"
|
---|
9119 | fi
|
---|
9120 |
|
---|
9121 | # Do each command in the archive commands.
|
---|
9122 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
|
---|
9123 | cmds=$old_archive_from_new_cmds
|
---|
9124 | else
|
---|
9125 |
|
---|
9126 | # Add any objects from preloaded convenience libraries
|
---|
9127 | if test -n "$dlprefiles"; then
|
---|
9128 | gentop="$output_objdir/${outputname}x"
|
---|
9129 | func_append generated " $gentop"
|
---|
9130 |
|
---|
9131 | func_extract_archives $gentop $dlprefiles
|
---|
9132 | func_append oldobjs " $func_extract_archives_result"
|
---|
9133 | fi
|
---|
9134 |
|
---|
9135 | # POSIX demands no paths to be encoded in archives. We have
|
---|
9136 | # to avoid creating archives with duplicate basenames if we
|
---|
9137 | # might have to extract them afterwards, e.g., when creating a
|
---|
9138 | # static archive out of a convenience library, or when linking
|
---|
9139 | # the entirety of a libtool archive into another (currently
|
---|
9140 | # not supported by libtool).
|
---|
9141 | if (for obj in $oldobjs
|
---|
9142 | do
|
---|
9143 | func_basename "$obj"
|
---|
9144 | $ECHO "$func_basename_result"
|
---|
9145 | done | sort | sort -uc >/dev/null 2>&1); then
|
---|
9146 | :
|
---|
9147 | else
|
---|
9148 | echo "copying selected object files to avoid basename conflicts..."
|
---|
9149 | gentop="$output_objdir/${outputname}x"
|
---|
9150 | func_append generated " $gentop"
|
---|
9151 | func_mkdir_p "$gentop"
|
---|
9152 | save_oldobjs=$oldobjs
|
---|
9153 | oldobjs=
|
---|
9154 | counter=1
|
---|
9155 | for obj in $save_oldobjs
|
---|
9156 | do
|
---|
9157 | func_basename "$obj"
|
---|
9158 | objbase="$func_basename_result"
|
---|
9159 | case " $oldobjs " in
|
---|
9160 | " ") oldobjs=$obj ;;
|
---|
9161 | *[\ /]"$objbase "*)
|
---|
9162 | while :; do
|
---|
9163 | # Make sure we don't pick an alternate name that also
|
---|
9164 | # overlaps.
|
---|
9165 | newobj=lt$counter-$objbase
|
---|
9166 | func_arith $counter + 1
|
---|
9167 | counter=$func_arith_result
|
---|
9168 | case " $oldobjs " in
|
---|
9169 | *[\ /]"$newobj "*) ;;
|
---|
9170 | *) if test ! -f "$gentop/$newobj"; then break; fi ;;
|
---|
9171 | esac
|
---|
9172 | done
|
---|
9173 | func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
|
---|
9174 | func_append oldobjs " $gentop/$newobj"
|
---|
9175 | ;;
|
---|
9176 | *) func_append oldobjs " $obj" ;;
|
---|
9177 | esac
|
---|
9178 | done
|
---|
9179 | fi
|
---|
9180 | func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
|
---|
9181 | tool_oldlib=$func_to_tool_file_result
|
---|
9182 | eval cmds=\"$old_archive_cmds\"
|
---|
9183 |
|
---|
9184 | func_len " $cmds"
|
---|
9185 | len=$func_len_result
|
---|
9186 | if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
---|
9187 | cmds=$old_archive_cmds
|
---|
9188 | elif test -n "$archiver_list_spec"; then
|
---|
9189 | func_verbose "using command file archive linking..."
|
---|
9190 | for obj in $oldobjs
|
---|
9191 | do
|
---|
9192 | func_to_tool_file "$obj"
|
---|
9193 | $ECHO "$func_to_tool_file_result"
|
---|
9194 | done > $output_objdir/$libname.libcmd
|
---|
9195 | func_to_tool_file "$output_objdir/$libname.libcmd"
|
---|
9196 | oldobjs=" $archiver_list_spec$func_to_tool_file_result"
|
---|
9197 | cmds=$old_archive_cmds
|
---|
9198 | else
|
---|
9199 | # the command line is too long to link in one step, link in parts
|
---|
9200 | func_verbose "using piecewise archive linking..."
|
---|
9201 | save_RANLIB=$RANLIB
|
---|
9202 | RANLIB=:
|
---|
9203 | objlist=
|
---|
9204 | concat_cmds=
|
---|
9205 | save_oldobjs=$oldobjs
|
---|
9206 | oldobjs=
|
---|
9207 | # Is there a better way of finding the last object in the list?
|
---|
9208 | for obj in $save_oldobjs
|
---|
9209 | do
|
---|
9210 | last_oldobj=$obj
|
---|
9211 | done
|
---|
9212 | eval test_cmds=\"$old_archive_cmds\"
|
---|
9213 | func_len " $test_cmds"
|
---|
9214 | len0=$func_len_result
|
---|
9215 | len=$len0
|
---|
9216 | for obj in $save_oldobjs
|
---|
9217 | do
|
---|
9218 | func_len " $obj"
|
---|
9219 | func_arith $len + $func_len_result
|
---|
9220 | len=$func_arith_result
|
---|
9221 | func_append objlist " $obj"
|
---|
9222 | if test "$len" -lt "$max_cmd_len"; then
|
---|
9223 | :
|
---|
9224 | else
|
---|
9225 | # the above command should be used before it gets too long
|
---|
9226 | oldobjs=$objlist
|
---|
9227 | if test "$obj" = "$last_oldobj" ; then
|
---|
9228 | RANLIB=$save_RANLIB
|
---|
9229 | fi
|
---|
9230 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
---|
9231 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
|
---|
9232 | objlist=
|
---|
9233 | len=$len0
|
---|
9234 | fi
|
---|
9235 | done
|
---|
9236 | RANLIB=$save_RANLIB
|
---|
9237 | oldobjs=$objlist
|
---|
9238 | if test "X$oldobjs" = "X" ; then
|
---|
9239 | eval cmds=\"\$concat_cmds\"
|
---|
9240 | else
|
---|
9241 | eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
|
---|
9242 | fi
|
---|
9243 | fi
|
---|
9244 | fi
|
---|
9245 | func_execute_cmds "$cmds" 'exit $?'
|
---|
9246 | done
|
---|
9247 |
|
---|
9248 | test -n "$generated" && \
|
---|
9249 | func_show_eval "${RM}r$generated"
|
---|
9250 |
|
---|
9251 | # Now create the libtool archive.
|
---|
9252 | case $output in
|
---|
9253 | *.la)
|
---|
9254 | old_library=
|
---|
9255 | test "$build_old_libs" = yes && old_library="$libname.$libext"
|
---|
9256 | func_verbose "creating $output"
|
---|
9257 |
|
---|
9258 | # Preserve any variables that may affect compiler behavior
|
---|
9259 | for var in $variables_saved_for_relink; do
|
---|
9260 | if eval test -z \"\${$var+set}\"; then
|
---|
9261 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
|
---|
9262 | elif eval var_value=\$$var; test -z "$var_value"; then
|
---|
9263 | relink_command="$var=; export $var; $relink_command"
|
---|
9264 | else
|
---|
9265 | func_quote_for_eval "$var_value"
|
---|
9266 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
|
---|
9267 | fi
|
---|
9268 | done
|
---|
9269 | # Quote the link command for shipping.
|
---|
9270 | relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
|
---|
9271 | relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
|
---|
9272 | if test "$hardcode_automatic" = yes ; then
|
---|
9273 | relink_command=
|
---|
9274 | fi
|
---|
9275 |
|
---|
9276 | # Only create the output if not a dry run.
|
---|
9277 | $opt_dry_run || {
|
---|
9278 | for installed in no yes; do
|
---|
9279 | if test "$installed" = yes; then
|
---|
9280 | if test -z "$install_libdir"; then
|
---|
9281 | break
|
---|
9282 | fi
|
---|
9283 | output="$output_objdir/$outputname"i
|
---|
9284 | # Replace all uninstalled libtool libraries with the installed ones
|
---|
9285 | newdependency_libs=
|
---|
9286 | for deplib in $dependency_libs; do
|
---|
9287 | case $deplib in
|
---|
9288 | *.la)
|
---|
9289 | func_basename "$deplib"
|
---|
9290 | name="$func_basename_result"
|
---|
9291 | func_resolve_sysroot "$deplib"
|
---|
9292 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
|
---|
9293 | test -z "$libdir" && \
|
---|
9294 | func_fatal_error "\`$deplib' is not a valid libtool archive"
|
---|
9295 | func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
|
---|
9296 | ;;
|
---|
9297 | -L*)
|
---|
9298 | func_stripname -L '' "$deplib"
|
---|
9299 | func_replace_sysroot "$func_stripname_result"
|
---|
9300 | func_append newdependency_libs " -L$func_replace_sysroot_result"
|
---|
9301 | ;;
|
---|
9302 | -R*)
|
---|
9303 | func_stripname -R '' "$deplib"
|
---|
9304 | func_replace_sysroot "$func_stripname_result"
|
---|
9305 | func_append newdependency_libs " -R$func_replace_sysroot_result"
|
---|
9306 | ;;
|
---|
9307 | *) func_append newdependency_libs " $deplib" ;;
|
---|
9308 | esac
|
---|
9309 | done
|
---|
9310 | dependency_libs="$newdependency_libs"
|
---|
9311 | newdlfiles=
|
---|
9312 |
|
---|
9313 | for lib in $dlfiles; do
|
---|
9314 | case $lib in
|
---|
9315 | *.la)
|
---|
9316 | func_basename "$lib"
|
---|
9317 | name="$func_basename_result"
|
---|
9318 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
|
---|
9319 | test -z "$libdir" && \
|
---|
9320 | func_fatal_error "\`$lib' is not a valid libtool archive"
|
---|
9321 | func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
|
---|
9322 | ;;
|
---|
9323 | *) func_append newdlfiles " $lib" ;;
|
---|
9324 | esac
|
---|
9325 | done
|
---|
9326 | dlfiles="$newdlfiles"
|
---|
9327 | newdlprefiles=
|
---|
9328 | for lib in $dlprefiles; do
|
---|
9329 | case $lib in
|
---|
9330 | *.la)
|
---|
9331 | # Only pass preopened files to the pseudo-archive (for
|
---|
9332 | # eventual linking with the app. that links it) if we
|
---|
9333 | # didn't already link the preopened objects directly into
|
---|
9334 | # the library:
|
---|
9335 | func_basename "$lib"
|
---|
9336 | name="$func_basename_result"
|
---|
9337 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
|
---|
9338 | test -z "$libdir" && \
|
---|
9339 | func_fatal_error "\`$lib' is not a valid libtool archive"
|
---|
9340 | func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
|
---|
9341 | ;;
|
---|
9342 | esac
|
---|
9343 | done
|
---|
9344 | dlprefiles="$newdlprefiles"
|
---|
9345 | else
|
---|
9346 | newdlfiles=
|
---|
9347 | for lib in $dlfiles; do
|
---|
9348 | case $lib in
|
---|
9349 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
|
---|
9350 | *) abs=`pwd`"/$lib" ;;
|
---|
9351 | esac
|
---|
9352 | func_append newdlfiles " $abs"
|
---|
9353 | done
|
---|
9354 | dlfiles="$newdlfiles"
|
---|
9355 | newdlprefiles=
|
---|
9356 | for lib in $dlprefiles; do
|
---|
9357 | case $lib in
|
---|
9358 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
|
---|
9359 | *) abs=`pwd`"/$lib" ;;
|
---|
9360 | esac
|
---|
9361 | func_append newdlprefiles " $abs"
|
---|
9362 | done
|
---|
9363 | dlprefiles="$newdlprefiles"
|
---|
9364 | fi
|
---|
9365 | $RM $output
|
---|
9366 | # place dlname in correct position for cygwin
|
---|
9367 | # In fact, it would be nice if we could use this code for all target
|
---|
9368 | # systems that can't hard-code library paths into their executables
|
---|
9369 | # and that have no shared library path variable independent of PATH,
|
---|
9370 | # but it turns out we can't easily determine that from inspecting
|
---|
9371 | # libtool variables, so we have to hard-code the OSs to which it
|
---|
9372 | # applies here; at the moment, that means platforms that use the PE
|
---|
9373 | # object format with DLL files. See the long comment at the top of
|
---|
9374 | # tests/bindir.at for full details.
|
---|
9375 | tdlname=$dlname
|
---|
9376 | case $host,$output,$installed,$module,$dlname in
|
---|
9377 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
|
---|
9378 | # If a -bindir argument was supplied, place the dll there.
|
---|
9379 | if test "x$bindir" != x ;
|
---|
9380 | then
|
---|
9381 | func_relative_path "$install_libdir" "$bindir"
|
---|
9382 | tdlname=$func_relative_path_result$dlname
|
---|
9383 | else
|
---|
9384 | # Otherwise fall back on heuristic.
|
---|
9385 | tdlname=../bin/$dlname
|
---|
9386 | fi
|
---|
9387 | ;;
|
---|
9388 | esac
|
---|
9389 | $ECHO > $output "\
|
---|
9390 | # $outputname - a libtool library file
|
---|
9391 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
---|
9392 | #
|
---|
9393 | # Please DO NOT delete this file!
|
---|
9394 | # It is necessary for linking the library.
|
---|
9395 |
|
---|
9396 | # The name that we can dlopen(3).
|
---|
9397 | dlname='$tdlname'
|
---|
9398 |
|
---|
9399 | # Names of this library.
|
---|
9400 | library_names='$library_names'
|
---|
9401 |
|
---|
9402 | # The name of the static archive.
|
---|
9403 | old_library='$old_library'
|
---|
9404 |
|
---|
9405 | # Linker flags that can not go in dependency_libs.
|
---|
9406 | inherited_linker_flags='$new_inherited_linker_flags'
|
---|
9407 |
|
---|
9408 | # Libraries that this one depends upon.
|
---|
9409 | dependency_libs='$dependency_libs'
|
---|
9410 |
|
---|
9411 | # Names of additional weak libraries provided by this library
|
---|
9412 | weak_library_names='$weak_libs'
|
---|
9413 |
|
---|
9414 | # Version information for $libname.
|
---|
9415 | current=$current
|
---|
9416 | age=$age
|
---|
9417 | revision=$revision
|
---|
9418 |
|
---|
9419 | # Is this an already installed library?
|
---|
9420 | installed=$installed
|
---|
9421 |
|
---|
9422 | # Should we warn about portability when linking against -modules?
|
---|
9423 | shouldnotlink=$module
|
---|
9424 |
|
---|
9425 | # Files to dlopen/dlpreopen
|
---|
9426 | dlopen='$dlfiles'
|
---|
9427 | dlpreopen='$dlprefiles'
|
---|
9428 |
|
---|
9429 | # Directory that this library needs to be installed in:
|
---|
9430 | libdir='$install_libdir'"
|
---|
9431 | if test "$installed" = no && test "$need_relink" = yes; then
|
---|
9432 | $ECHO >> $output "\
|
---|
9433 | relink_command=\"$relink_command\""
|
---|
9434 | fi
|
---|
9435 | done
|
---|
9436 | }
|
---|
9437 |
|
---|
9438 | # Do a symbolic link so that the libtool archive can be found in
|
---|
9439 | # LD_LIBRARY_PATH before the program is installed.
|
---|
9440 | func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
|
---|
9441 | ;;
|
---|
9442 | esac
|
---|
9443 | exit $EXIT_SUCCESS
|
---|
9444 | }
|
---|
9445 |
|
---|
9446 | { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
|
---|
9447 | func_mode_link ${1+"$@"}
|
---|
9448 |
|
---|
9449 |
|
---|
9450 | # func_mode_uninstall arg...
|
---|
9451 | func_mode_uninstall ()
|
---|
9452 | {
|
---|
9453 | $opt_debug
|
---|
9454 | RM="$nonopt"
|
---|
9455 | files=
|
---|
9456 | rmforce=
|
---|
9457 | exit_status=0
|
---|
9458 |
|
---|
9459 | # This variable tells wrapper scripts just to set variables rather
|
---|
9460 | # than running their programs.
|
---|
9461 | libtool_install_magic="$magic"
|
---|
9462 |
|
---|
9463 | for arg
|
---|
9464 | do
|
---|
9465 | case $arg in
|
---|
9466 | -f) func_append RM " $arg"; rmforce=yes ;;
|
---|
9467 | -*) func_append RM " $arg" ;;
|
---|
9468 | *) func_append files " $arg" ;;
|
---|
9469 | esac
|
---|
9470 | done
|
---|
9471 |
|
---|
9472 | test -z "$RM" && \
|
---|
9473 | func_fatal_help "you must specify an RM program"
|
---|
9474 |
|
---|
9475 | rmdirs=
|
---|
9476 |
|
---|
9477 | for file in $files; do
|
---|
9478 | func_dirname "$file" "" "."
|
---|
9479 | dir="$func_dirname_result"
|
---|
9480 | if test "X$dir" = X.; then
|
---|
9481 | odir="$objdir"
|
---|
9482 | else
|
---|
9483 | odir="$dir/$objdir"
|
---|
9484 | fi
|
---|
9485 | func_basename "$file"
|
---|
9486 | name="$func_basename_result"
|
---|
9487 | test "$opt_mode" = uninstall && odir="$dir"
|
---|
9488 |
|
---|
9489 | # Remember odir for removal later, being careful to avoid duplicates
|
---|
9490 | if test "$opt_mode" = clean; then
|
---|
9491 | case " $rmdirs " in
|
---|
9492 | *" $odir "*) ;;
|
---|
9493 | *) func_append rmdirs " $odir" ;;
|
---|
9494 | esac
|
---|
9495 | fi
|
---|
9496 |
|
---|
9497 | # Don't error if the file doesn't exist and rm -f was used.
|
---|
9498 | if { test -L "$file"; } >/dev/null 2>&1 ||
|
---|
9499 | { test -h "$file"; } >/dev/null 2>&1 ||
|
---|
9500 | test -f "$file"; then
|
---|
9501 | :
|
---|
9502 | elif test -d "$file"; then
|
---|
9503 | exit_status=1
|
---|
9504 | continue
|
---|
9505 | elif test "$rmforce" = yes; then
|
---|
9506 | continue
|
---|
9507 | fi
|
---|
9508 |
|
---|
9509 | rmfiles="$file"
|
---|
9510 |
|
---|
9511 | case $name in
|
---|
9512 | *.la)
|
---|
9513 | # Possibly a libtool archive, so verify it.
|
---|
9514 | if func_lalib_p "$file"; then
|
---|
9515 | func_source $dir/$name
|
---|
9516 |
|
---|
9517 | # Delete the libtool libraries and symlinks.
|
---|
9518 | for n in $library_names; do
|
---|
9519 | func_append rmfiles " $odir/$n"
|
---|
9520 | done
|
---|
9521 | test -n "$old_library" && func_append rmfiles " $odir/$old_library"
|
---|
9522 |
|
---|
9523 | case "$opt_mode" in
|
---|
9524 | clean)
|
---|
9525 | case " $library_names " in
|
---|
9526 | *" $dlname "*) ;;
|
---|
9527 | *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
|
---|
9528 | esac
|
---|
9529 | test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
|
---|
9530 | ;;
|
---|
9531 | uninstall)
|
---|
9532 | if test -n "$library_names"; then
|
---|
9533 | # Do each command in the postuninstall commands.
|
---|
9534 | func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
|
---|
9535 | fi
|
---|
9536 |
|
---|
9537 | if test -n "$old_library"; then
|
---|
9538 | # Do each command in the old_postuninstall commands.
|
---|
9539 | func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
|
---|
9540 | fi
|
---|
9541 | # FIXME: should reinstall the best remaining shared library.
|
---|
9542 | ;;
|
---|
9543 | esac
|
---|
9544 | fi
|
---|
9545 | ;;
|
---|
9546 |
|
---|
9547 | *.lo)
|
---|
9548 | # Possibly a libtool object, so verify it.
|
---|
9549 | if func_lalib_p "$file"; then
|
---|
9550 |
|
---|
9551 | # Read the .lo file
|
---|
9552 | func_source $dir/$name
|
---|
9553 |
|
---|
9554 | # Add PIC object to the list of files to remove.
|
---|
9555 | if test -n "$pic_object" &&
|
---|
9556 | test "$pic_object" != none; then
|
---|
9557 | func_append rmfiles " $dir/$pic_object"
|
---|
9558 | fi
|
---|
9559 |
|
---|
9560 | # Add non-PIC object to the list of files to remove.
|
---|
9561 | if test -n "$non_pic_object" &&
|
---|
9562 | test "$non_pic_object" != none; then
|
---|
9563 | func_append rmfiles " $dir/$non_pic_object"
|
---|
9564 | fi
|
---|
9565 | fi
|
---|
9566 | ;;
|
---|
9567 |
|
---|
9568 | *)
|
---|
9569 | if test "$opt_mode" = clean ; then
|
---|
9570 | noexename=$name
|
---|
9571 | case $file in
|
---|
9572 | *.exe)
|
---|
9573 | func_stripname '' '.exe' "$file"
|
---|
9574 | file=$func_stripname_result
|
---|
9575 | func_stripname '' '.exe' "$name"
|
---|
9576 | noexename=$func_stripname_result
|
---|
9577 | # $file with .exe has already been added to rmfiles,
|
---|
9578 | # add $file without .exe
|
---|
9579 | func_append rmfiles " $file"
|
---|
9580 | ;;
|
---|
9581 | esac
|
---|
9582 | # Do a test to see if this is a libtool program.
|
---|
9583 | if func_ltwrapper_p "$file"; then
|
---|
9584 | if func_ltwrapper_executable_p "$file"; then
|
---|
9585 | func_ltwrapper_scriptname "$file"
|
---|
9586 | relink_command=
|
---|
9587 | func_source $func_ltwrapper_scriptname_result
|
---|
9588 | func_append rmfiles " $func_ltwrapper_scriptname_result"
|
---|
9589 | else
|
---|
9590 | relink_command=
|
---|
9591 | func_source $dir/$noexename
|
---|
9592 | fi
|
---|
9593 |
|
---|
9594 | # note $name still contains .exe if it was in $file originally
|
---|
9595 | # as does the version of $file that was added into $rmfiles
|
---|
9596 | func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
|
---|
9597 | if test "$fast_install" = yes && test -n "$relink_command"; then
|
---|
9598 | func_append rmfiles " $odir/lt-$name"
|
---|
9599 | fi
|
---|
9600 | if test "X$noexename" != "X$name" ; then
|
---|
9601 | func_append rmfiles " $odir/lt-${noexename}.c"
|
---|
9602 | fi
|
---|
9603 | fi
|
---|
9604 | fi
|
---|
9605 | ;;
|
---|
9606 | esac
|
---|
9607 | func_show_eval "$RM $rmfiles" 'exit_status=1'
|
---|
9608 | done
|
---|
9609 |
|
---|
9610 | # Try to remove the ${objdir}s in the directories where we deleted files
|
---|
9611 | for dir in $rmdirs; do
|
---|
9612 | if test -d "$dir"; then
|
---|
9613 | func_show_eval "rmdir $dir >/dev/null 2>&1"
|
---|
9614 | fi
|
---|
9615 | done
|
---|
9616 |
|
---|
9617 | exit $exit_status
|
---|
9618 | }
|
---|
9619 |
|
---|
9620 | { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
|
---|
9621 | func_mode_uninstall ${1+"$@"}
|
---|
9622 |
|
---|
9623 | test -z "$opt_mode" && {
|
---|
9624 | help="$generic_help"
|
---|
9625 | func_fatal_help "you must specify a MODE"
|
---|
9626 | }
|
---|
9627 |
|
---|
9628 | test -z "$exec_cmd" && \
|
---|
9629 | func_fatal_help "invalid operation mode \`$opt_mode'"
|
---|
9630 |
|
---|
9631 | if test -n "$exec_cmd"; then
|
---|
9632 | eval exec "$exec_cmd"
|
---|
9633 | exit $EXIT_FAILURE
|
---|
9634 | fi
|
---|
9635 |
|
---|
9636 | exit $exit_status
|
---|
9637 |
|
---|
9638 |
|
---|
9639 | # The TAGs below are defined such that we never get into a situation
|
---|
9640 | # in which we disable both kinds of libraries. Given conflicting
|
---|
9641 | # choices, we go for a static library, that is the most portable,
|
---|
9642 | # since we can't tell whether shared libraries were disabled because
|
---|
9643 | # the user asked for that or because the platform doesn't support
|
---|
9644 | # them. This is particularly important on AIX, because we don't
|
---|
9645 | # support having both static and shared libraries enabled at the same
|
---|
9646 | # time on that platform, so we default to a shared-only configuration.
|
---|
9647 | # If a disable-shared tag is given, we'll fallback to a static-only
|
---|
9648 | # configuration. But we'll never go from static-only to shared-only.
|
---|
9649 |
|
---|
9650 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
|
---|
9651 | build_libtool_libs=no
|
---|
9652 | build_old_libs=yes
|
---|
9653 | # ### END LIBTOOL TAG CONFIG: disable-shared
|
---|
9654 |
|
---|
9655 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static
|
---|
9656 | build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
|
---|
9657 | # ### END LIBTOOL TAG CONFIG: disable-static
|
---|
9658 |
|
---|
9659 | # Local Variables:
|
---|
9660 | # mode:shell-script
|
---|
9661 | # sh-indentation:2
|
---|
9662 | # End:
|
---|
9663 | # vi:sw=2
|
---|
9664 |
|
---|